react-native-roku 0.0.0-stage → 0.2.0-preview.1

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 (200) hide show
  1. package/CHANGELOG.md +318 -0
  2. package/CONTRIBUTING.md +34 -0
  3. package/LICENSE +21 -0
  4. package/NOTICE.md +10 -0
  5. package/README.md +66 -2
  6. package/bin/react-native-roku.mjs +91 -0
  7. package/build/assets.cjs +311 -0
  8. package/build/assets.d.cts +50 -0
  9. package/build/compatibility.d.mts +40 -0
  10. package/build/compatibility.mjs +272 -0
  11. package/build/dev.d.mts +34 -0
  12. package/build/dev.mjs +297 -0
  13. package/build/devWorkspace.d.mts +11 -0
  14. package/build/devWorkspace.mjs +86 -0
  15. package/build/device.d.mts +47 -0
  16. package/build/device.mjs +310 -0
  17. package/build/environment.d.mts +29 -0
  18. package/build/environment.mjs +144 -0
  19. package/build/esbuild.d.mts +5 -0
  20. package/build/esbuild.mjs +118 -0
  21. package/build/fontVariants.d.mts +27 -0
  22. package/build/fontVariants.mjs +424 -0
  23. package/build/frontend.d.mts +52 -0
  24. package/build/frontend.mjs +75 -0
  25. package/build/identity.mjs +45 -0
  26. package/build/index.d.mts +22 -0
  27. package/build/index.mjs +87 -0
  28. package/build/intl.mjs +121 -0
  29. package/build/metro.cjs +38 -0
  30. package/build/metro.d.cts +37 -0
  31. package/build/metroFrontend.mjs +222 -0
  32. package/build/metroMetadata.mjs +119 -0
  33. package/build/metroModules.mjs +397 -0
  34. package/build/metroRefresh.d.mts +64 -0
  35. package/build/metroRefresh.mjs +346 -0
  36. package/build/metroTransformer.cjs +146 -0
  37. package/build/nativeTextMemo.mjs +296 -0
  38. package/build/nativewind.d.mts +9 -0
  39. package/build/nativewind.mjs +92 -0
  40. package/build/project.d.mts +111 -0
  41. package/build/project.mjs +615 -0
  42. package/build/reactCompiler.mjs +113 -0
  43. package/build/reactProfile.cjs +35 -0
  44. package/build/refreshRuntime.mjs +187 -0
  45. package/build/refreshSourceMap.mjs +53 -0
  46. package/build/release.mjs +99 -0
  47. package/build/resolution.d.mts +3 -0
  48. package/build/resolution.mjs +25 -0
  49. package/build/surfaces.d.mts +1 -0
  50. package/build/surfaces.mjs +42 -0
  51. package/build/testing/node.d.mts +29 -0
  52. package/build/testing/node.mjs +106 -0
  53. package/build/yoga.d.mts +8 -0
  54. package/build/yoga.mjs +186 -0
  55. package/compatibility/public-api.json +327 -0
  56. package/compatibility/registry.json +2258 -0
  57. package/config/release.json +15 -0
  58. package/config/toolchain.json +34 -0
  59. package/docs/compatibility.md +813 -0
  60. package/docs/getting-started.md +460 -0
  61. package/docs/maintenance.md +362 -0
  62. package/docs/qualification.md +241 -0
  63. package/docs/standalone-testing.md +56 -0
  64. package/examples/hello-roku/README.md +35 -0
  65. package/examples/hello-roku/package.template.json +31 -0
  66. package/examples/hello-roku/pnpm-workspace.yaml +11 -0
  67. package/examples/hello-roku/roku.config.json +22 -0
  68. package/examples/hello-roku/src/App.tsx +54 -0
  69. package/examples/hello-roku/src/Catalog.tsx +200 -0
  70. package/examples/hello-roku/src/assets.d.ts +16 -0
  71. package/examples/hello-roku/src/catalog-cover.png +0 -0
  72. package/examples/hello-roku/tsconfig.json +1 -0
  73. package/examples/hello-roku/tsconfig.react.json +1 -0
  74. package/native/components/RNRAppControl.brs +215 -0
  75. package/native/components/RNRAppControl.xml +13 -0
  76. package/native/components/RNRDeviceFacts.brs +19 -0
  77. package/native/components/RNRDeviceFacts.xml +9 -0
  78. package/native/components/RNRDeviceFactsTask.brs +74 -0
  79. package/native/components/RNRDeviceFactsTask.xml +9 -0
  80. package/native/components/RNRTextRaster.brs +15 -0
  81. package/native/components/RNRTextRaster.xml +9 -0
  82. package/native/components/RNRTextRasterTask.brs +77 -0
  83. package/native/components/RNRTextRasterTask.xml +9 -0
  84. package/native/manifest.json +7 -0
  85. package/package.json +183 -3
  86. package/src/animation/clock.ts +10 -0
  87. package/src/animation/derivedValue.ts +163 -0
  88. package/src/animation/legacyAnimated.ts +255 -0
  89. package/src/animation/reanimated.ts +243 -0
  90. package/src/animation/sharedValue.ts +285 -0
  91. package/src/animation/worklets.ts +23 -0
  92. package/src/application/AppRegistry.ts +31 -0
  93. package/src/application/mountApplication.ts +136 -0
  94. package/src/graphics/BitmapLayer.tsx +68 -0
  95. package/src/graphics/RoundedBorder.tsx +116 -0
  96. package/src/graphics/TextRasterCache.ts +259 -0
  97. package/src/graphics/gradient.ts +37 -0
  98. package/src/graphics/inlineRaster.ts +85 -0
  99. package/src/graphics/png.ts +77 -0
  100. package/src/graphics/rasterPixels.ts +89 -0
  101. package/src/graphics/surfaces.ts +105 -0
  102. package/src/graphics/textRaster.types.ts +60 -0
  103. package/src/graphics/textRasterGeometry.ts +116 -0
  104. package/src/host/host.types.ts +57 -0
  105. package/src/index.ts +22 -0
  106. package/src/interop/nativewind.ts +2 -0
  107. package/src/layout/FontResources.ts +252 -0
  108. package/src/layout/affine.ts +89 -0
  109. package/src/layout/flexLayout.ts +398 -0
  110. package/src/layout/fontFaces.d.mts +19 -0
  111. package/src/layout/fontFaces.mjs +85 -0
  112. package/src/layout/fontVariants.d.mts +2 -0
  113. package/src/layout/fontVariants.mjs +8 -0
  114. package/src/layout/inlineParagraph.ts +158 -0
  115. package/src/layout/inlineText.ts +68 -0
  116. package/src/layout/layoutReuse.ts +117 -0
  117. package/src/layout/nativeNodeFields.ts +179 -0
  118. package/src/layout/preparedFields.ts +78 -0
  119. package/src/layout/textLayout.ts +138 -0
  120. package/src/layout/transform.ts +113 -0
  121. package/src/media/SceneGraphAudio.ts +161 -0
  122. package/src/media/SceneGraphVideo.ts +167 -0
  123. package/src/media/audioSession.ts +84 -0
  124. package/src/media/index.ts +2 -0
  125. package/src/media/videoErrorDetails.ts +40 -0
  126. package/src/media/videoSession.ts +136 -0
  127. package/src/navigation/RouterStore.ts +244 -0
  128. package/src/navigation/expoRouter.ts +115 -0
  129. package/src/react-native/NativeInput.ts +494 -0
  130. package/src/react-native/NativeSystemState.ts +95 -0
  131. package/src/react-native/accessibility.ts +265 -0
  132. package/src/react-native/activityIndicator.ts +72 -0
  133. package/src/react-native/compilerPressable.ts +26 -0
  134. package/src/react-native/createNativeRoot.ts +2126 -0
  135. package/src/react-native/directionalFocus.ts +55 -0
  136. package/src/react-native/environment.ts +275 -0
  137. package/src/react-native/flatList.ts +1001 -0
  138. package/src/react-native/flatListViewability.ts +231 -0
  139. package/src/react-native/focusEvents.ts +85 -0
  140. package/src/react-native/image.ts +247 -0
  141. package/src/react-native/index.ts +54 -0
  142. package/src/react-native/interactionManager.ts +76 -0
  143. package/src/react-native/keyboard.ts +60 -0
  144. package/src/react-native/linearGradient.ts +94 -0
  145. package/src/react-native/modal.tsx +148 -0
  146. package/src/react-native/nativeHostContext.ts +80 -0
  147. package/src/react-native/nativeModules.ts +86 -0
  148. package/src/react-native/nativeRoot.types.ts +22 -0
  149. package/src/react-native/nativeViewHandle.ts +191 -0
  150. package/src/react-native/nativewindPressable.ts +38 -0
  151. package/src/react-native/panResponder.ts +73 -0
  152. package/src/react-native/primitives.ts +685 -0
  153. package/src/react-native/safeArea.ts +76 -0
  154. package/src/react-native/scrollView.ts +289 -0
  155. package/src/react-native/styleInterop.ts +8 -0
  156. package/src/react-native/styleSheet.ts +54 -0
  157. package/src/react-native/textInput.ts +334 -0
  158. package/src/react-native/unsupported.ts +25 -0
  159. package/src/renderer/SceneRoot.ts +1006 -0
  160. package/src/scene/SdkDeviceFacts.ts +151 -0
  161. package/src/scene/SdkDeviceServices.ts +72 -0
  162. package/src/scene/SdkSceneGraph.ts +124 -0
  163. package/src/scene/SdkTextEntry.ts +321 -0
  164. package/src/scene/SdkTextMetrics.ts +136 -0
  165. package/src/scene/SdkTextRasterTransport.ts +191 -0
  166. package/src/scene/SdkWebTransport.ts +122 -0
  167. package/src/scene/createRokuHost.ts +213 -0
  168. package/src/scene/sceneGraph.types.ts +38 -0
  169. package/src/services/DeviceServices.ts +53 -0
  170. package/src/services/RegistryStorage.ts +85 -0
  171. package/src/services/RokuKeySession.ts +29 -0
  172. package/src/services/asyncStorage.ts +23 -0
  173. package/src/services/base64.ts +52 -0
  174. package/src/services/crypto.ts +18 -0
  175. package/src/services/expoConstants.ts +11 -0
  176. package/src/services/expoLinking.ts +12 -0
  177. package/src/services/expoStatusBar.ts +4 -0
  178. package/src/services/installWebRuntime.ts +105 -0
  179. package/src/services/intlEnglish.ts +54 -0
  180. package/src/services/languageRuntime.ts +65 -0
  181. package/src/services/nativeTimers.ts +96 -0
  182. package/src/services/secureStore.ts +23 -0
  183. package/src/services/textEntryRequest.ts +22 -0
  184. package/src/services/utf8.ts +57 -0
  185. package/src/services/webRuntime.ts +346 -0
  186. package/src/testing/CanvasResources.ts +141 -0
  187. package/src/testing/CanvasSceneGraph.ts +496 -0
  188. package/src/testing/CanvasTextEntry.ts +237 -0
  189. package/src/testing/PreviewTextObservations.ts +82 -0
  190. package/src/testing/RecordingSceneGraph.ts +136 -0
  191. package/src/types/normalize-colors.d.ts +4 -0
  192. package/src/vector/dynamicSvg.tsx +226 -0
  193. package/src/vector/svg.ts +222 -0
  194. package/src/vector/svg.types.ts +4 -0
  195. package/src/vector/svgElements.ts +58 -0
  196. package/src/vector/svgKey.d.mts +4 -0
  197. package/src/vector/svgKey.mjs +16 -0
  198. package/src/vector/svgPath.ts +157 -0
  199. package/src/vector/svgPixels.ts +133 -0
  200. package/tsconfig.consumer.json +29 -0
@@ -0,0 +1,13 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <component name="RNRAppControl" extends="Group" focusable="false">
3
+ <interface>
4
+ <field id="focusSampleTarget" type="node" />
5
+ <field id="focusSamplePrevious" type="node" />
6
+ <field id="focusSampleTicket" type="integer" onChange="onFocusSample" />
7
+ <field id="focusSampleReply" type="string" value="" />
8
+ <field id="exitRequested" type="boolean" value="false" onChange="onExitRequested" />
9
+ <field id="textEntryRequest" type="string" value="" alwaysNotify="true" />
10
+ <field id="textEntryReply" type="string" value="" alwaysNotify="true" />
11
+ </interface>
12
+ <script type="text/brightscript" uri="RNRAppControl.brs" />
13
+ </component>
@@ -0,0 +1,19 @@
1
+ sub onRequest()
2
+ if m.task = invalid
3
+ m.task = CreateObject("roSGNode", "RNRDeviceFactsTask")
4
+ m.task.observeField("reply", "onReply")
5
+ m.task.observeField("event", "onEvent")
6
+ m.task.command = m.top.request
7
+ m.task.control = "RUN"
8
+ else
9
+ m.task.command = m.top.request
10
+ end if
11
+ end sub
12
+
13
+ sub onReply()
14
+ m.top.reply = m.task.reply
15
+ end sub
16
+
17
+ sub onEvent()
18
+ m.top.event = m.task.event
19
+ end sub
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <component name="RNRDeviceFacts" extends="Group" focusable="false">
3
+ <interface>
4
+ <field id="request" type="string" onChange="onRequest" alwaysNotify="true" />
5
+ <field id="reply" type="string" alwaysNotify="true" />
6
+ <field id="event" type="string" alwaysNotify="true" />
7
+ </interface>
8
+ <script type="text/brightscript" uri="RNRDeviceFacts.brs" />
9
+ </component>
@@ -0,0 +1,74 @@
1
+ sub init()
2
+ m.top.functionName = "runDeviceFacts"
3
+ end sub
4
+
5
+ sub runDeviceFacts()
6
+ m.device = CreateObject("roDeviceInfo")
7
+ m.routeEpoch = 0
8
+ port = CreateObject("roMessagePort")
9
+ m.device.setMessagePort(port)
10
+ m.device.enableCodecCapChangedEvent(true)
11
+ m.device.enableAudioGuideChangedEvent(true)
12
+ m.device.enableAppFocusEvent(true)
13
+ m.device.enableLowGeneralMemoryEvent(true)
14
+ m.top.observeField("command", port)
15
+ m.top.event = FormatJson({ type: "system", snapshot: { screenReader: m.device.isAudioGuideEnabled() } })
16
+ command = m.top.command
17
+ while true
18
+ if command <> ""
19
+ request = ParseJson(command)
20
+ if type(request) = "roAssociativeArray"
21
+ if request.type = "dispose" then exit while
22
+ reply = probeDeviceFacts(request)
23
+ reply.id = request.id
24
+ m.top.reply = FormatJson(reply)
25
+ end if
26
+ end if
27
+ command = ""
28
+ message = wait(0, port)
29
+ if type(message) = "roSGNodeEvent"
30
+ command = message.getData()
31
+ else if type(message) = "roDeviceInfoEvent"
32
+ info = message.getInfo()
33
+ if type(info) = "roAssociativeArray"
34
+ if info.audioCodecCapabilityChanged = true or info.videoCodecCapabilityChanged = true
35
+ m.routeEpoch = m.routeEpoch + 1
36
+ m.top.event = FormatJson({ type: "capabilities", routeEpoch: m.routeEpoch })
37
+ end if
38
+ if info.doesExist("audioGuideEnabled")
39
+ m.top.event = FormatJson({ type: "system", snapshot: { screenReader: info.audioGuideEnabled } })
40
+ end if
41
+ if info.doesExist("appFocused")
42
+ appState = "inactive"
43
+ if info.appFocused = true then appState = "active"
44
+ m.top.event = FormatJson({ type: "system", snapshot: { appState: appState } })
45
+ end if
46
+ if info.doesExist("generalMemoryLevel")
47
+ m.top.event = FormatJson({ type: "memory", level: info.generalMemoryLevel })
48
+ end if
49
+ end if
50
+ end if
51
+ end while
52
+ m.device.enableCodecCapChangedEvent(false)
53
+ m.device.enableAudioGuideChangedEvent(false)
54
+ m.device.enableAppFocusEvent(false)
55
+ m.device.enableLowGeneralMemoryEvent(false)
56
+ end sub
57
+
58
+ function probeDeviceFacts(request as Object) as Object
59
+ if type(request.video) <> "roArray" or type(request.audio) <> "roArray" then return { error: "Invalid decoder query arrays" }
60
+ if request.video.count() > 32 or request.audio.count() > 32 then return { error: "Decoder query limit exceeded" }
61
+ video = {}
62
+ audio = {}
63
+ for each query in request.video
64
+ video[query.id] = m.device.canDecodeVideo(query.format)
65
+ end for
66
+ for each query in request.audio
67
+ audio[query.id] = m.device.canDecodeAudio(query.format)
68
+ end for
69
+ display = m.device.getDisplayProperties()
70
+ hdcp22 = false
71
+ hdmi = CreateObject("roHdmiStatus")
72
+ if hdmi <> invalid then hdcp22 = hdmi.isHdcpActive("2.2")
73
+ return { facts: { schema: "react-native-roku-device-facts/v1", timeZone: m.device.getTimeZone(), model: m.device.getModel(), firmware: m.device.getVersion(), modelType: m.device.getModelType(), videoMode: m.device.getVideoMode(), hdcp22: hdcp22, audioOutput: m.device.getAudioOutputChannel(), routeEpoch: m.routeEpoch, video: video, audio: audio, display: { hdr10: display.hdr10, hdr10plus: display.hdr10plus, dolbyvision: display.dolbyvision, hlg: display.hlg } } }
74
+ end function
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <component name="RNRDeviceFactsTask" extends="Task">
3
+ <interface>
4
+ <field id="command" type="string" alwaysNotify="true" />
5
+ <field id="reply" type="string" alwaysNotify="true" />
6
+ <field id="event" type="string" alwaysNotify="true" />
7
+ </interface>
8
+ <script type="text/brightscript" uri="RNRDeviceFactsTask.brs" />
9
+ </component>
@@ -0,0 +1,15 @@
1
+ sub onRequest()
2
+ if m.task = invalid
3
+ m.task = CreateObject("roSGNode", "RNRTextRasterTask")
4
+ m.task.namespace = m.top.namespace
5
+ m.task.observeField("reply", "onReply")
6
+ m.task.command = m.top.request
7
+ m.task.control = "RUN"
8
+ else
9
+ m.task.command = m.top.request
10
+ end if
11
+ end sub
12
+
13
+ sub onReply()
14
+ m.top.reply = m.task.reply
15
+ end sub
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <component name="RNRTextRaster" extends="Group" focusable="false">
3
+ <interface>
4
+ <field id="namespace" type="string" />
5
+ <field id="request" type="string" onChange="onRequest" alwaysNotify="true" />
6
+ <field id="reply" type="string" alwaysNotify="true" />
7
+ </interface>
8
+ <script type="text/brightscript" uri="RNRTextRaster.brs" />
9
+ </component>
@@ -0,0 +1,77 @@
1
+ sub init()
2
+ m.top.functionName = "runRaster"
3
+ end sub
4
+
5
+ sub runRaster()
6
+ namespace = m.top.namespace
7
+ if not CreateObject("roRegex", "^[a-zA-Z0-9-]{1,80}$", "").isMatch(namespace) then return
8
+ m.directory = "tmp:/react-native-roku-text-" + namespace
9
+ m.fs = CreateObject("roFileSystem")
10
+ m.fs.createDirectory(m.directory)
11
+ m.paths = {}
12
+ m.fonts = {}
13
+ port = CreateObject("roMessagePort")
14
+ m.top.observeField("command", port)
15
+ command = m.top.command
16
+ while true
17
+ if command <> ""
18
+ request = ParseJson(command)
19
+ if request <> invalid
20
+ if request.type = "dispose" then exit while
21
+ reply = rasterOperation(request)
22
+ reply.id = request.id
23
+ m.top.reply = FormatJson(reply)
24
+ end if
25
+ end if
26
+ message = wait(0, port)
27
+ if type(message) = "roSGNodeEvent" then command = message.getData() else command = ""
28
+ end while
29
+ for each path in m.paths
30
+ m.fs.delete(path)
31
+ end for
32
+ m.fs.delete(m.directory)
33
+ end sub
34
+
35
+ function rasterOperation(request as Object) as Object
36
+ if request.type = "mask"
37
+ if request.width < 1 or request.height < 1 or request.width > 2048 or request.height > 2048 then return { error: "Invalid native text bitmap dimensions" }
38
+ if request.size < 1 or request.size > 512 then return { error: "Invalid native text font size" }
39
+ if left(request.font, 11) <> "pkg:/fonts/" then return { error: "Text raster font must be packaged" }
40
+ registry = m.fonts[request.font]
41
+ if registry = invalid
42
+ registry = CreateObject("roFontRegistry")
43
+ if not registry.register(request.font) then return { error: "Native raster font registration failed" }
44
+ m.fonts[request.font] = registry
45
+ end if
46
+ families = registry.getFamilies()
47
+ if families.count() <> 1 then return { error: "Native raster font family is ambiguous" }
48
+ font = registry.getFont(families[0], request.size, false, false)
49
+ if font = invalid then return { error: "Native raster font creation failed" }
50
+ if abs(font.getOneLineHeight() - request.lineHeight) > 2 then return { error: "Label and bitmap font line metrics differ" }
51
+ bitmap = CreateObject("roBitmap", { width: request.width, height: request.height, alphaEnable: true })
52
+ if bitmap = invalid then return { error: "Native text bitmap allocation failed" }
53
+ bitmap.clear(&h00000000)
54
+ if request.commands.count() > 4096 then return { error: "Native text command budget exceeded" }
55
+ for each draw in request.commands
56
+ if not bitmap.drawText(draw.text, int(draw.x + 0.5), int(draw.y + 0.5), &hFFFFFFFF, font) then return { error: "Native text drawing failed" }
57
+ end for
58
+ pixels = bitmap.getByteArray(0, 0, request.width, request.height)
59
+ if pixels = invalid then return { error: "Native text bitmap readback failed" }
60
+ return { pixels: pixels.toBase64String() }
61
+ else if request.type = "write"
62
+ if not CreateObject("roRegex", "^text-[0-9]+\.png$", "").isMatch(request.name) then return { error: "Invalid native text asset name" }
63
+ path = m.directory + "/" + request.name
64
+ bytes = CreateObject("roByteArray")
65
+ bytes.fromBase64String(request.data)
66
+ if not bytes.writeFile(path) then return { error: "Native text asset write failed" }
67
+ m.paths[path] = true
68
+ return { uri: path }
69
+ else if request.type = "delete"
70
+ if m.paths[request.uri] <> invalid
71
+ if not m.fs.delete(request.uri) then return { error: "Native text asset removal failed" }
72
+ m.paths.delete(request.uri)
73
+ end if
74
+ return {}
75
+ end if
76
+ return { error: "Unsupported native text operation" }
77
+ end function
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8" ?>
2
+ <component name="RNRTextRasterTask" extends="Task">
3
+ <interface>
4
+ <field id="namespace" type="string" />
5
+ <field id="command" type="string" alwaysNotify="true" />
6
+ <field id="reply" type="string" alwaysNotify="true" />
7
+ </interface>
8
+ <script type="text/brightscript" uri="RNRTextRasterTask.brs" />
9
+ </component>
@@ -0,0 +1,7 @@
1
+ {
2
+ "AppControl": "RNRAppControl",
3
+ "TextRaster": "RNRTextRaster",
4
+ "TextRasterTask": "RNRTextRasterTask",
5
+ "DeviceFacts": "RNRDeviceFacts",
6
+ "DeviceFactsTask": "RNRDeviceFactsTask"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,186 @@
1
1
  {
2
2
  "name": "react-native-roku",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.2.0-preview.1",
4
+ "type": "module",
5
+ "main": "src/index.ts",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./react-native": "./src/react-native/index.ts",
9
+ "./scene": "./src/scene/sceneGraph.types.ts",
10
+ "./text": "./src/layout/textLayout.ts",
11
+ "./text-raster": "./src/graphics/textRaster.types.ts",
12
+ "./text-raster-cache": "./src/graphics/TextRasterCache.ts",
13
+ "./sdk": "./src/scene/SdkSceneGraph.ts",
14
+ "./sdk-text": "./src/scene/SdkTextMetrics.ts",
15
+ "./sdk-text-raster": "./src/scene/SdkTextRasterTransport.ts",
16
+ "./testing": "./src/testing/RecordingSceneGraph.ts",
17
+ "./testing/node": "./build/testing/node.mjs",
18
+ "./preview": "./src/testing/CanvasSceneGraph.ts",
19
+ "./expo-router": "./src/navigation/expoRouter.ts",
20
+ "./router": "./src/navigation/RouterStore.ts",
21
+ "./vector": "./src/vector/svg.types.ts",
22
+ "./graphics": "./src/graphics/surfaces.ts",
23
+ "./services": "./src/services/DeviceServices.ts",
24
+ "./timers": "./src/services/nativeTimers.ts",
25
+ "./sdk-services": "./src/scene/SdkDeviceServices.ts",
26
+ "./keys": "./src/services/RokuKeySession.ts",
27
+ "./media": "./src/media/index.ts",
28
+ "./web": "./src/services/installWebRuntime.ts",
29
+ "./sdk-web": "./src/scene/SdkWebTransport.ts",
30
+ "./system": "./src/react-native/NativeSystemState.ts",
31
+ "./sdk-device-facts": "./src/scene/SdkDeviceFacts.ts",
32
+ "./package.json": "./package.json",
33
+ "./svg": "./src/vector/svg.ts",
34
+ "./svg-key": "./src/vector/svgKey.mjs",
35
+ "./reanimated": "./src/animation/reanimated.ts",
36
+ "./worklets": "./src/animation/worklets.ts",
37
+ "./image": "./src/react-native/image.ts",
38
+ "./linear-gradient": "./src/react-native/linearGradient.ts",
39
+ "./safe-area": "./src/react-native/safeArea.ts",
40
+ "./async-storage": "./src/services/asyncStorage.ts",
41
+ "./secure-store": "./src/services/secureStore.ts",
42
+ "./crypto": "./src/services/crypto.ts",
43
+ "./expo-constants": "./src/services/expoConstants.ts",
44
+ "./expo-linking": "./src/services/expoLinking.ts",
45
+ "./expo-status-bar": "./src/services/expoStatusBar.ts",
46
+ "./fonts": "./src/layout/FontResources.ts",
47
+ "./registry-storage": "./src/services/RegistryStorage.ts",
48
+ "./interop/nativewind": "./src/interop/nativewind.ts",
49
+ "./build": "./build/index.mjs",
50
+ "./build/yoga": "./build/yoga.mjs",
51
+ "./build/nativewind": "./build/nativewind.mjs",
52
+ "./build/surfaces": "./build/surfaces.mjs",
53
+ "./native/manifest": "./native/manifest.json",
54
+ "./build/esbuild": "./build/esbuild.mjs",
55
+ "./sdk-host": "./src/scene/createRokuHost.ts",
56
+ "./tsconfig": "./tsconfig.consumer.json",
57
+ "./host": "./src/host/host.types.ts",
58
+ "./app-registry": "./src/application/AppRegistry.ts",
59
+ "./application": "./src/application/mountApplication.ts",
60
+ "./build/resolution": "./build/resolution.mjs",
61
+ "./build/project": "./build/project.mjs",
62
+ "./build/dev": "./build/dev.mjs",
63
+ "./metro": "./build/metro.cjs",
64
+ "./build/environment": "./build/environment.mjs",
65
+ "./build/compatibility": "./build/compatibility.mjs",
66
+ "./build/dev-workspace": "./build/devWorkspace.mjs",
67
+ "./build/device": "./build/device.mjs",
68
+ "./intl/en": "./src/services/intlEnglish.ts",
69
+ "./build/frontend": "./build/frontend.mjs",
70
+ "./build/assets": "./build/assets.cjs"
71
+ },
72
+ "dependencies": {
73
+ "@formatjs/intl-collator": "0.3.1",
74
+ "@formatjs/intl-datetimeformat": "8.0.2",
75
+ "@formatjs/intl-getcanonicallocales": "3.3.0",
76
+ "@formatjs/intl-locale": "5.4.2",
77
+ "@formatjs/intl-numberformat": "10.0.2",
78
+ "@formatjs/intl-pluralrules": "7.0.2",
79
+ "@jridgewell/gen-mapping": "0.3.13",
80
+ "@jridgewell/trace-mapping": "0.3.31",
81
+ "@react-native/normalize-colors": "0.86.2",
82
+ "@roku-sdk/common": "2.19.1",
83
+ "@roku-sdk/components": "2.19.1",
84
+ "@roku-sdk/interfaces": "2.19.1",
85
+ "@roku-sdk/runtime": "2.19.1",
86
+ "@roku-sdk/solid": "2.19.1",
87
+ "@types/react-reconciler": "0.33.0",
88
+ "react-native-url-polyfill": "4.0.0",
89
+ "react-reconciler": "0.33.0",
90
+ "scheduler": "0.27.0",
91
+ "typescript": "npm:@typescript/typescript6@6.0.2",
92
+ "yoga-layout-prebuilt": "1.10.0"
93
+ },
94
+ "peerDependencies": {
95
+ "esbuild": "0.28.1",
96
+ "react": "19.2.8"
97
+ },
98
+ "devDependencies": {
99
+ "@babel/core": "7.29.13",
100
+ "@expo-google-fonts/inter": "0.4.2",
101
+ "@roku-sdk/dev-tools": "2.19.1",
102
+ "@roku-sdk/rsg-ts": "2.19.1",
103
+ "@roku-sdk/tooling": "2.19.1",
104
+ "@types/node": "24.19.1",
105
+ "@types/react": "19.2.18",
106
+ "@typescript/native": "npm:typescript@7.0.2",
107
+ "brighterscript": "0.73.5",
108
+ "esbuild": "0.28.1",
109
+ "nativewind": "4.2.6",
110
+ "prettier": "3.9.10",
111
+ "react": "19.2.8",
112
+ "react-native-css-interop": "0.2.6",
113
+ "tailwindcss": "3.4.19",
114
+ "vitest": "4.1.12"
115
+ },
116
+ "description": "Experimental React Native-compatible renderer and platform adapters for Roku SceneGraph.",
117
+ "license": "MIT",
118
+ "publishConfig": {
119
+ "access": "public",
120
+ "tag": "preview",
121
+ "provenance": true
122
+ },
123
+ "repository": {
124
+ "type": "git",
125
+ "url": "https://github.com/react-native-roku/react-native-roku.git"
126
+ },
127
+ "homepage": "https://github.com/react-native-roku/react-native-roku#readme",
128
+ "bugs": {
129
+ "url": "https://github.com/react-native-roku/react-native-roku/issues"
130
+ },
131
+ "files": [
132
+ "src",
133
+ "build",
134
+ "native",
135
+ "README.md",
136
+ "NOTICE.md",
137
+ "LICENSE",
138
+ "docs/compatibility.md",
139
+ "tsconfig.consumer.json",
140
+ "docs/getting-started.md",
141
+ "CONTRIBUTING.md",
142
+ "bin",
143
+ "examples/hello-roku",
144
+ "config",
145
+ "compatibility",
146
+ "CHANGELOG.md",
147
+ "docs/maintenance.md",
148
+ "docs/qualification.md",
149
+ "docs/standalone-testing.md"
150
+ ],
151
+ "engines": {
152
+ "node": ">=24.18.1 <25",
153
+ "pnpm": "11.23.0"
154
+ },
155
+ "peerDependenciesMeta": {
156
+ "esbuild": {
157
+ "optional": true
158
+ }
159
+ },
160
+ "bin": {
161
+ "react-native-roku": "./bin/react-native-roku.mjs"
162
+ },
163
+ "scripts": {
164
+ "test": "node scripts/checked-commands.mjs tests",
165
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.sdk.json",
166
+ "check:package": "node scripts/check-package.mjs",
167
+ "test:consumer": "node scripts/qualify-consumer.mjs",
168
+ "check": "node scripts/checked-commands.mjs full",
169
+ "test:sdk": "node scripts/qualify-sdk-consumer.mjs",
170
+ "test:development": "node scripts/qualify-development.mjs",
171
+ "test:metro": "node scripts/qualify-metro-consumer.mjs",
172
+ "test:metro-development": "node scripts/qualify-metro-development.mjs",
173
+ "test:fast-refresh": "node scripts/qualify-fast-refresh.mjs",
174
+ "doctor": "node scripts/doctor.mjs",
175
+ "format": "prettier --write .",
176
+ "format:check": "prettier --check .",
177
+ "check:fast": "node scripts/checked-commands.mjs fast",
178
+ "check:compatibility": "node scripts/check-compatibility.mjs",
179
+ "compatibility:refresh": "node scripts/check-compatibility.mjs --write",
180
+ "setup:repo": "node scripts/setup.mjs",
181
+ "release:prepare": "node scripts/release.mjs --prepare",
182
+ "release:check": "node scripts/release.mjs --check",
183
+ "test:navigation": "python3 benchmarks/navigation/suite.py test",
184
+ "check:independence": "node scripts/check-independence.mjs"
185
+ }
6
186
  }
@@ -0,0 +1,10 @@
1
+ export interface AnimationClock {
2
+ now(): number;
3
+ request(callback: () => void): unknown;
4
+ cancel(handle: unknown): void;
5
+ }
6
+ export const animationClock: AnimationClock = {
7
+ now: () => (typeof performance !== "undefined" ? performance.now() : Date.now()),
8
+ request: (callback) => setTimeout(callback, 16),
9
+ cancel: (handle) => clearTimeout(handle as ReturnType<typeof setTimeout>),
10
+ };
@@ -0,0 +1,163 @@
1
+ import { RokuHostError } from "../scene/sceneGraph.types";
2
+ import {
3
+ collectValues,
4
+ isAnimation,
5
+ makeMutable,
6
+ type Animatable,
7
+ type Animation,
8
+ type MutableValue,
9
+ } from "./sharedValue";
10
+
11
+ function sameAnimationShape(left: Animation, right: Animation): boolean {
12
+ if (left.kind !== right.kind) return false;
13
+ switch (left.kind) {
14
+ case "timing": {
15
+ const next = right as typeof left;
16
+ return Object.is(left.to, next.to) && left.duration === next.duration;
17
+ }
18
+ case "delay": {
19
+ const next = right as typeof left;
20
+ return left.duration === next.duration && sameAnimationShape(left.animation, next.animation);
21
+ }
22
+ case "repeat": {
23
+ const next = right as typeof left;
24
+ return (
25
+ left.count === next.count &&
26
+ left.reverse === next.reverse &&
27
+ sameAnimationShape(left.animation, next.animation)
28
+ );
29
+ }
30
+ case "sequence": {
31
+ const next = right as typeof left;
32
+ return (
33
+ left.animations.length === next.animations.length &&
34
+ left.animations.every((child, index) => sameAnimationShape(child, next.animations[index]))
35
+ );
36
+ }
37
+ }
38
+ }
39
+
40
+ /** Keep one admitted clock while callbacks/easing receive committed closures.
41
+ * A changed target, duration or composition admits a new request instead. */
42
+ function animationFacade(read: () => Animation): Animation {
43
+ const initial = read();
44
+ switch (initial.kind) {
45
+ case "timing": {
46
+ const current = () => read() as typeof initial;
47
+ return {
48
+ kind: "timing",
49
+ to: initial.to,
50
+ duration: initial.duration,
51
+ easing: (progress) => current().easing(progress),
52
+ callback: (finished, value) => current().callback?.(finished, value),
53
+ };
54
+ }
55
+ case "delay":
56
+ return {
57
+ kind: "delay",
58
+ duration: initial.duration,
59
+ animation: animationFacade(() => (read() as typeof initial).animation),
60
+ };
61
+ case "repeat":
62
+ return {
63
+ kind: "repeat",
64
+ count: initial.count,
65
+ reverse: initial.reverse,
66
+ animation: animationFacade(() => (read() as typeof initial).animation),
67
+ callback: (finished) => (read() as typeof initial).callback?.(finished),
68
+ };
69
+ case "sequence":
70
+ return {
71
+ kind: "sequence",
72
+ animations: initial.animations.map((_, index) =>
73
+ animationFacade(() => (read() as typeof initial).animations[index]),
74
+ ),
75
+ };
76
+ }
77
+ }
78
+
79
+ /** Private JS mapper: React commits publish closures; actual shared reads own
80
+ * subscriptions. Render-time/retired callbacks never install mapper state. */
81
+ export function createDerivedMapper<T extends Animatable>(initial: T) {
82
+ const value = makeMutable(initial);
83
+ const subscriptions = new Map<MutableValue<unknown>, () => void>();
84
+ let active = false,
85
+ updating = false,
86
+ pending = false,
87
+ applied = false;
88
+ let updater: (() => T | Animation) | undefined;
89
+ let previous: T | Animation;
90
+ let slot: { current: Animation } | undefined;
91
+ const apply = () => {
92
+ const next = collectValues(updater!);
93
+ if (next.dependencies.has(value as MutableValue<unknown>))
94
+ throw new RokuHostError(
95
+ "C06_ANIMATION_CYCLE",
96
+ "Derived values must not depend on themselves",
97
+ );
98
+ for (const [dependency, release] of subscriptions)
99
+ if (!next.dependencies.has(dependency)) {
100
+ release();
101
+ subscriptions.delete(dependency);
102
+ }
103
+ for (const dependency of next.dependencies)
104
+ if (!subscriptions.has(dependency))
105
+ subscriptions.set(dependency, dependency.subscribe(update));
106
+ if (isAnimation(next.value)) {
107
+ if (slot && sameAnimationShape(slot.current, next.value)) {
108
+ slot.current = next.value;
109
+ previous = next.value;
110
+ return;
111
+ }
112
+ const request = { current: next.value };
113
+ slot = request;
114
+ previous = next.value;
115
+ applied = true;
116
+ value.value = animationFacade(() => request.current);
117
+ } else if (!applied || !Object.is(previous, next.value)) {
118
+ slot = undefined;
119
+ previous = next.value;
120
+ applied = true;
121
+ value.value = next.value;
122
+ }
123
+ };
124
+ function update() {
125
+ if (!active || !updater) return;
126
+ if (updating) {
127
+ pending = true;
128
+ return;
129
+ }
130
+ updating = true;
131
+ try {
132
+ let passes = 0;
133
+ do {
134
+ pending = false;
135
+ apply();
136
+ if (++passes > 100)
137
+ throw new RokuHostError("C06_ANIMATION_CYCLE", "Derived updates cannot stabilize");
138
+ } while (active && pending);
139
+ } finally {
140
+ updating = false;
141
+ }
142
+ }
143
+ return {
144
+ value,
145
+ mount() {
146
+ active = true;
147
+ return () => {
148
+ active = false;
149
+ pending = false;
150
+ for (const release of subscriptions.values()) release();
151
+ subscriptions.clear();
152
+ applied = false;
153
+ slot = undefined;
154
+ value.cancel();
155
+ };
156
+ },
157
+ commit(next: () => T | Animation) {
158
+ if (!active) return;
159
+ updater = next;
160
+ update();
161
+ },
162
+ };
163
+ }