@use-voltra/ios-client 1.4.1 → 2.0.0-rc.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 (559) hide show
  1. package/README.md +113 -0
  2. package/Voltra.podspec +28 -0
  3. package/build/commonjs/VoltraModule.js +13 -0
  4. package/build/commonjs/VoltraModule.js.map +1 -0
  5. package/build/commonjs/components/VoltraLiveActivityPreview.js +30 -0
  6. package/build/commonjs/components/VoltraLiveActivityPreview.js.map +1 -0
  7. package/build/commonjs/components/VoltraView.js +50 -0
  8. package/build/commonjs/components/VoltraView.js.map +1 -0
  9. package/build/commonjs/components/VoltraWidgetPreview.js +58 -0
  10. package/build/commonjs/components/VoltraWidgetPreview.js.map +1 -0
  11. package/build/commonjs/events.js +32 -0
  12. package/build/commonjs/events.js.map +1 -0
  13. package/build/commonjs/helpers.js +26 -0
  14. package/build/commonjs/helpers.js.map +1 -0
  15. package/build/commonjs/index.js +226 -0
  16. package/build/commonjs/index.js.map +1 -0
  17. package/build/commonjs/live-activity/api.js +168 -0
  18. package/build/commonjs/live-activity/api.js.map +1 -0
  19. package/build/commonjs/logger.js +39 -0
  20. package/build/commonjs/logger.js.map +1 -0
  21. package/build/commonjs/native/NativeVoltra.js +15 -0
  22. package/build/commonjs/native/NativeVoltra.js.map +1 -0
  23. package/build/commonjs/native/VoltraRNNativeComponent.ts +9 -0
  24. package/build/commonjs/package.json +1 -0
  25. package/build/commonjs/preload.js +54 -0
  26. package/build/commonjs/preload.js.map +1 -0
  27. package/build/commonjs/types.js +2 -0
  28. package/build/commonjs/types.js.map +1 -0
  29. package/build/commonjs/utils/assertRunningOnApple.js +16 -0
  30. package/build/commonjs/utils/assertRunningOnApple.js.map +1 -0
  31. package/build/commonjs/utils/helpers.js +19 -0
  32. package/build/commonjs/utils/helpers.js.map +1 -0
  33. package/build/commonjs/utils/index.js +28 -0
  34. package/build/commonjs/utils/index.js.map +1 -0
  35. package/build/commonjs/utils/useUpdateOnHMR.js +25 -0
  36. package/build/commonjs/utils/useUpdateOnHMR.js.map +1 -0
  37. package/build/commonjs/widgets/server-credentials.js +18 -0
  38. package/build/commonjs/widgets/server-credentials.js.map +1 -0
  39. package/build/commonjs/widgets/widget-api.js +55 -0
  40. package/build/commonjs/widgets/widget-api.js.map +1 -0
  41. package/build/module/VoltraModule.js +4 -0
  42. package/build/module/VoltraModule.js.map +1 -0
  43. package/build/module/components/VoltraLiveActivityPreview.js +25 -0
  44. package/build/module/components/VoltraLiveActivityPreview.js.map +1 -0
  45. package/build/module/components/VoltraView.js +44 -0
  46. package/build/module/components/VoltraView.js.map +1 -0
  47. package/build/module/components/VoltraWidgetPreview.js +53 -0
  48. package/build/module/components/VoltraWidgetPreview.js.map +1 -0
  49. package/build/module/events.js +28 -0
  50. package/build/module/events.js.map +1 -0
  51. package/build/module/helpers.js +21 -0
  52. package/build/module/helpers.js.map +1 -0
  53. package/build/module/index.js +17 -0
  54. package/build/module/index.js.map +1 -0
  55. package/build/module/live-activity/api.js +158 -0
  56. package/build/module/live-activity/api.js.map +1 -0
  57. package/build/module/logger.js +35 -0
  58. package/build/module/logger.js.map +1 -0
  59. package/build/module/native/NativeVoltra.js +11 -0
  60. package/build/module/native/NativeVoltra.js.map +1 -0
  61. package/build/module/native/VoltraRNNativeComponent.ts +9 -0
  62. package/build/module/package.json +1 -0
  63. package/build/module/preload.js +48 -0
  64. package/build/module/preload.js.map +1 -0
  65. package/build/module/types.js +2 -0
  66. package/build/module/types.js.map +1 -0
  67. package/build/module/utils/assertRunningOnApple.js +11 -0
  68. package/build/module/utils/assertRunningOnApple.js.map +1 -0
  69. package/build/module/utils/helpers.js +4 -0
  70. package/build/module/utils/helpers.js.map +1 -0
  71. package/build/module/utils/index.js +5 -0
  72. package/build/module/utils/index.js.map +1 -0
  73. package/build/module/utils/useUpdateOnHMR.js +20 -0
  74. package/build/module/utils/useUpdateOnHMR.js.map +1 -0
  75. package/build/module/widgets/server-credentials.js +13 -0
  76. package/build/module/widgets/server-credentials.js.map +1 -0
  77. package/build/module/widgets/widget-api.js +45 -0
  78. package/build/module/widgets/widget-api.js.map +1 -0
  79. package/build/typescript/commonjs/VoltraModule.d.ts +3 -0
  80. package/build/typescript/commonjs/VoltraModule.d.ts.map +1 -0
  81. package/build/typescript/commonjs/components/VoltraLiveActivityPreview.d.ts.map +1 -0
  82. package/build/typescript/commonjs/components/VoltraView.d.ts.map +1 -0
  83. package/build/typescript/commonjs/components/VoltraWidgetPreview.d.ts.map +1 -0
  84. package/build/typescript/commonjs/events.d.ts.map +1 -0
  85. package/build/typescript/commonjs/helpers.d.ts.map +1 -0
  86. package/build/{types → typescript/commonjs}/index.d.ts +5 -0
  87. package/build/typescript/commonjs/index.d.ts.map +1 -0
  88. package/build/typescript/commonjs/live-activity/api.d.ts.map +1 -0
  89. package/build/typescript/commonjs/logger.d.ts.map +1 -0
  90. package/build/typescript/commonjs/native/NativeVoltra.d.ts +100 -0
  91. package/build/typescript/commonjs/native/NativeVoltra.d.ts.map +1 -0
  92. package/build/typescript/commonjs/native/VoltraRNNativeComponent.d.ts +8 -0
  93. package/build/typescript/commonjs/native/VoltraRNNativeComponent.d.ts.map +1 -0
  94. package/build/typescript/commonjs/package.json +1 -0
  95. package/build/typescript/commonjs/preload.d.ts.map +1 -0
  96. package/build/typescript/commonjs/types.d.ts.map +1 -0
  97. package/build/typescript/commonjs/utils/assertRunningOnApple.d.ts.map +1 -0
  98. package/build/typescript/commonjs/utils/helpers.d.ts.map +1 -0
  99. package/build/typescript/commonjs/utils/index.d.ts.map +1 -0
  100. package/build/typescript/commonjs/utils/useUpdateOnHMR.d.ts.map +1 -0
  101. package/build/typescript/commonjs/widgets/server-credentials.d.ts.map +1 -0
  102. package/build/typescript/commonjs/widgets/widget-api.d.ts.map +1 -0
  103. package/build/typescript/module/VoltraModule.d.ts +3 -0
  104. package/build/typescript/module/VoltraModule.d.ts.map +1 -0
  105. package/build/typescript/module/components/VoltraLiveActivityPreview.d.ts +7 -0
  106. package/build/typescript/module/components/VoltraLiveActivityPreview.d.ts.map +1 -0
  107. package/build/typescript/module/components/VoltraView.d.ts +12 -0
  108. package/build/typescript/module/components/VoltraView.d.ts.map +1 -0
  109. package/build/typescript/module/components/VoltraWidgetPreview.d.ts +9 -0
  110. package/build/typescript/module/components/VoltraWidgetPreview.d.ts.map +1 -0
  111. package/build/typescript/module/events.d.ts +33 -0
  112. package/build/typescript/module/events.d.ts.map +1 -0
  113. package/build/typescript/module/helpers.d.ts +3 -0
  114. package/build/typescript/module/helpers.d.ts.map +1 -0
  115. package/build/typescript/module/index.d.ts +18 -0
  116. package/build/typescript/module/index.d.ts.map +1 -0
  117. package/build/typescript/module/live-activity/api.d.ts +35 -0
  118. package/build/typescript/module/live-activity/api.d.ts.map +1 -0
  119. package/build/typescript/module/logger.d.ts +16 -0
  120. package/build/typescript/module/logger.d.ts.map +1 -0
  121. package/build/typescript/module/native/NativeVoltra.d.ts +100 -0
  122. package/build/typescript/module/native/NativeVoltra.d.ts.map +1 -0
  123. package/build/typescript/module/native/VoltraRNNativeComponent.d.ts +8 -0
  124. package/build/typescript/module/native/VoltraRNNativeComponent.d.ts.map +1 -0
  125. package/build/typescript/module/package.json +1 -0
  126. package/build/typescript/module/preload.d.ts +6 -0
  127. package/build/typescript/module/preload.d.ts.map +1 -0
  128. package/build/typescript/module/types.d.ts +2 -0
  129. package/build/typescript/module/types.d.ts.map +1 -0
  130. package/build/typescript/module/utils/assertRunningOnApple.d.ts +2 -0
  131. package/build/typescript/module/utils/assertRunningOnApple.d.ts.map +1 -0
  132. package/build/{esm/utils/helpers.js → typescript/module/utils/helpers.d.ts} +1 -1
  133. package/build/typescript/module/utils/helpers.d.ts.map +1 -0
  134. package/build/{esm/utils/index.js → typescript/module/utils/index.d.ts} +1 -1
  135. package/build/typescript/module/utils/index.d.ts.map +1 -0
  136. package/build/typescript/module/utils/useUpdateOnHMR.d.ts +5 -0
  137. package/build/typescript/module/utils/useUpdateOnHMR.d.ts.map +1 -0
  138. package/build/typescript/module/widgets/server-credentials.d.ts +5 -0
  139. package/build/typescript/module/widgets/server-credentials.d.ts.map +1 -0
  140. package/build/typescript/module/widgets/widget-api.d.ts +11 -0
  141. package/build/typescript/module/widgets/widget-api.d.ts.map +1 -0
  142. package/expo-plugin/app.plugin.js +3 -0
  143. package/expo-plugin/build/cjs/constants.js +23 -0
  144. package/expo-plugin/build/cjs/constants.js.map +1 -0
  145. package/expo-plugin/build/cjs/index.js +51 -0
  146. package/expo-plugin/build/cjs/index.js.map +1 -0
  147. package/expo-plugin/build/cjs/ios/eas.js +28 -0
  148. package/expo-plugin/build/cjs/ios/eas.js.map +1 -0
  149. package/expo-plugin/build/cjs/ios/entitlements.js +46 -0
  150. package/expo-plugin/build/cjs/ios/entitlements.js.map +1 -0
  151. package/expo-plugin/build/cjs/ios/index.js +39 -0
  152. package/expo-plugin/build/cjs/ios/index.js.map +1 -0
  153. package/expo-plugin/build/cjs/ios/infoPlist.js +51 -0
  154. package/expo-plugin/build/cjs/ios/infoPlist.js.map +1 -0
  155. package/expo-plugin/build/cjs/ios/pushNotifications.js +22 -0
  156. package/expo-plugin/build/cjs/ios/pushNotifications.js.map +1 -0
  157. package/expo-plugin/build/cjs/ios-widget/eas.js +66 -0
  158. package/expo-plugin/build/cjs/ios-widget/eas.js.map +1 -0
  159. package/expo-plugin/build/cjs/ios-widget/files/assets.js +199 -0
  160. package/expo-plugin/build/cjs/ios-widget/files/assets.js.map +1 -0
  161. package/expo-plugin/build/cjs/ios-widget/files/entitlements.js +77 -0
  162. package/expo-plugin/build/cjs/ios-widget/files/entitlements.js.map +1 -0
  163. package/expo-plugin/build/cjs/ios-widget/files/index.js +92 -0
  164. package/expo-plugin/build/cjs/ios-widget/files/index.js.map +1 -0
  165. package/expo-plugin/build/cjs/ios-widget/files/infoPlist.js +91 -0
  166. package/expo-plugin/build/cjs/ios-widget/files/infoPlist.js.map +1 -0
  167. package/expo-plugin/build/cjs/ios-widget/files/swift.js +443 -0
  168. package/expo-plugin/build/cjs/ios-widget/files/swift.js.map +1 -0
  169. package/expo-plugin/build/cjs/ios-widget/fonts.js +151 -0
  170. package/expo-plugin/build/cjs/ios-widget/fonts.js.map +1 -0
  171. package/expo-plugin/build/cjs/ios-widget/index.js +46 -0
  172. package/expo-plugin/build/cjs/ios-widget/index.js.map +1 -0
  173. package/expo-plugin/build/cjs/ios-widget/podfile.js +41 -0
  174. package/expo-plugin/build/cjs/ios-widget/podfile.js.map +1 -0
  175. package/expo-plugin/build/cjs/ios-widget/widgetPlist.js +99 -0
  176. package/expo-plugin/build/cjs/ios-widget/widgetPlist.js.map +1 -0
  177. package/expo-plugin/build/cjs/ios-widget/xcode/buildPhases.js +247 -0
  178. package/expo-plugin/build/cjs/ios-widget/xcode/buildPhases.js.map +1 -0
  179. package/expo-plugin/build/cjs/ios-widget/xcode/configurationList.js +91 -0
  180. package/expo-plugin/build/cjs/ios-widget/xcode/configurationList.js.map +1 -0
  181. package/expo-plugin/build/cjs/ios-widget/xcode/groups.js +79 -0
  182. package/expo-plugin/build/cjs/ios-widget/xcode/groups.js.map +1 -0
  183. package/expo-plugin/build/cjs/ios-widget/xcode/index.js +155 -0
  184. package/expo-plugin/build/cjs/ios-widget/xcode/index.js.map +1 -0
  185. package/expo-plugin/build/cjs/ios-widget/xcode/mainAppSettings.js +71 -0
  186. package/expo-plugin/build/cjs/ios-widget/xcode/mainAppSettings.js.map +1 -0
  187. package/expo-plugin/build/cjs/ios-widget/xcode/productFile.js +74 -0
  188. package/expo-plugin/build/cjs/ios-widget/xcode/productFile.js.map +1 -0
  189. package/expo-plugin/build/cjs/ios-widget/xcode/target.js +113 -0
  190. package/expo-plugin/build/cjs/ios-widget/xcode/target.js.map +1 -0
  191. package/expo-plugin/build/cjs/utils/fileDiscovery.js +120 -0
  192. package/expo-plugin/build/cjs/utils/fileDiscovery.js.map +1 -0
  193. package/expo-plugin/build/cjs/utils/urlScheme.js +40 -0
  194. package/expo-plugin/build/cjs/utils/urlScheme.js.map +1 -0
  195. package/expo-plugin/build/cjs/validation.js +55 -0
  196. package/expo-plugin/build/cjs/validation.js.map +1 -0
  197. package/expo-plugin/build/esm/constants.js +20 -0
  198. package/expo-plugin/build/esm/constants.js.map +1 -0
  199. package/expo-plugin/build/esm/index.js +49 -0
  200. package/expo-plugin/build/esm/index.js.map +1 -0
  201. package/expo-plugin/build/esm/ios/eas.js +24 -0
  202. package/expo-plugin/build/esm/ios/eas.js.map +1 -0
  203. package/expo-plugin/build/esm/ios/entitlements.js +42 -0
  204. package/expo-plugin/build/esm/ios/entitlements.js.map +1 -0
  205. package/expo-plugin/build/esm/ios/index.js +34 -0
  206. package/expo-plugin/build/esm/ios/index.js.map +1 -0
  207. package/expo-plugin/build/esm/ios/infoPlist.js +47 -0
  208. package/expo-plugin/build/esm/ios/infoPlist.js.map +1 -0
  209. package/expo-plugin/build/esm/ios/pushNotifications.js +18 -0
  210. package/expo-plugin/build/esm/ios/pushNotifications.js.map +1 -0
  211. package/expo-plugin/build/esm/ios-widget/eas.js +62 -0
  212. package/expo-plugin/build/esm/ios-widget/eas.js.map +1 -0
  213. package/expo-plugin/build/esm/ios-widget/files/assets.js +163 -0
  214. package/expo-plugin/build/esm/ios-widget/files/assets.js.map +1 -0
  215. package/expo-plugin/build/esm/ios-widget/files/entitlements.js +37 -0
  216. package/expo-plugin/build/esm/ios-widget/files/entitlements.js.map +1 -0
  217. package/expo-plugin/build/esm/ios-widget/files/index.js +55 -0
  218. package/expo-plugin/build/esm/ios-widget/files/index.js.map +1 -0
  219. package/expo-plugin/build/esm/ios-widget/files/infoPlist.js +55 -0
  220. package/expo-plugin/build/esm/ios-widget/files/infoPlist.js.map +1 -0
  221. package/expo-plugin/build/esm/ios-widget/files/swift.js +403 -0
  222. package/expo-plugin/build/esm/ios-widget/files/swift.js.map +1 -0
  223. package/expo-plugin/build/esm/ios-widget/fonts.js +111 -0
  224. package/expo-plugin/build/esm/ios-widget/fonts.js.map +1 -0
  225. package/expo-plugin/build/esm/ios-widget/index.js +42 -0
  226. package/expo-plugin/build/esm/ios-widget/index.js.map +1 -0
  227. package/expo-plugin/build/esm/ios-widget/podfile.js +37 -0
  228. package/expo-plugin/build/esm/ios-widget/podfile.js.map +1 -0
  229. package/expo-plugin/build/esm/ios-widget/widgetPlist.js +92 -0
  230. package/expo-plugin/build/esm/ios-widget/widgetPlist.js.map +1 -0
  231. package/expo-plugin/build/esm/ios-widget/xcode/buildPhases.js +210 -0
  232. package/expo-plugin/build/esm/ios-widget/xcode/buildPhases.js.map +1 -0
  233. package/expo-plugin/build/esm/ios-widget/xcode/configurationList.js +87 -0
  234. package/expo-plugin/build/esm/ios-widget/xcode/configurationList.js.map +1 -0
  235. package/expo-plugin/build/esm/ios-widget/xcode/groups.js +75 -0
  236. package/expo-plugin/build/esm/ios-widget/xcode/groups.js.map +1 -0
  237. package/expo-plugin/build/esm/ios-widget/xcode/index.js +118 -0
  238. package/expo-plugin/build/esm/ios-widget/xcode/index.js.map +1 -0
  239. package/expo-plugin/build/esm/ios-widget/xcode/mainAppSettings.js +68 -0
  240. package/expo-plugin/build/esm/ios-widget/xcode/mainAppSettings.js.map +1 -0
  241. package/expo-plugin/build/esm/ios-widget/xcode/productFile.js +70 -0
  242. package/expo-plugin/build/esm/ios-widget/xcode/productFile.js.map +1 -0
  243. package/expo-plugin/build/esm/ios-widget/xcode/target.js +108 -0
  244. package/expo-plugin/build/esm/ios-widget/xcode/target.js.map +1 -0
  245. package/expo-plugin/build/esm/utils/fileDiscovery.js +83 -0
  246. package/expo-plugin/build/esm/utils/fileDiscovery.js.map +1 -0
  247. package/expo-plugin/build/esm/utils/urlScheme.js +37 -0
  248. package/expo-plugin/build/esm/utils/urlScheme.js.map +1 -0
  249. package/expo-plugin/build/esm/validation.js +51 -0
  250. package/expo-plugin/build/esm/validation.js.map +1 -0
  251. package/expo-plugin/build/types/constants.d.ts +13 -0
  252. package/expo-plugin/build/types/constants.d.ts.map +1 -0
  253. package/expo-plugin/build/types/index.d.ts +10 -0
  254. package/expo-plugin/build/types/index.d.ts.map +1 -0
  255. package/expo-plugin/build/types/ios/eas.d.ts +12 -0
  256. package/expo-plugin/build/types/ios/eas.d.ts.map +1 -0
  257. package/expo-plugin/build/types/ios/entitlements.d.ts +14 -0
  258. package/expo-plugin/build/types/ios/entitlements.d.ts.map +1 -0
  259. package/expo-plugin/build/types/ios/index.d.ts +19 -0
  260. package/expo-plugin/build/types/ios/index.d.ts.map +1 -0
  261. package/expo-plugin/build/types/ios/infoPlist.d.ts +21 -0
  262. package/expo-plugin/build/types/ios/infoPlist.d.ts.map +1 -0
  263. package/expo-plugin/build/types/ios/pushNotifications.d.ts +10 -0
  264. package/expo-plugin/build/types/ios/pushNotifications.d.ts.map +1 -0
  265. package/expo-plugin/build/types/ios-widget/eas.d.ts +15 -0
  266. package/expo-plugin/build/types/ios-widget/eas.d.ts.map +1 -0
  267. package/expo-plugin/build/types/ios-widget/files/assets.d.ts +13 -0
  268. package/expo-plugin/build/types/ios-widget/files/assets.d.ts.map +1 -0
  269. package/expo-plugin/build/types/ios-widget/files/entitlements.d.ts +17 -0
  270. package/expo-plugin/build/types/ios-widget/files/entitlements.d.ts.map +1 -0
  271. package/expo-plugin/build/types/ios-widget/files/index.d.ts +24 -0
  272. package/expo-plugin/build/types/ios-widget/files/index.d.ts.map +1 -0
  273. package/expo-plugin/build/types/ios-widget/files/infoPlist.d.ts +10 -0
  274. package/expo-plugin/build/types/ios-widget/files/infoPlist.d.ts.map +1 -0
  275. package/expo-plugin/build/types/ios-widget/files/swift.d.ts +24 -0
  276. package/expo-plugin/build/types/ios-widget/files/swift.d.ts.map +1 -0
  277. package/expo-plugin/build/types/ios-widget/fonts.d.ts +22 -0
  278. package/expo-plugin/build/types/ios-widget/fonts.d.ts.map +1 -0
  279. package/expo-plugin/build/types/ios-widget/index.d.ts +31 -0
  280. package/expo-plugin/build/types/ios-widget/index.d.ts.map +1 -0
  281. package/expo-plugin/build/types/ios-widget/podfile.d.ts +9 -0
  282. package/expo-plugin/build/types/ios-widget/podfile.d.ts.map +1 -0
  283. package/expo-plugin/build/types/ios-widget/widgetPlist.d.ts +20 -0
  284. package/expo-plugin/build/types/ios-widget/widgetPlist.d.ts.map +1 -0
  285. package/expo-plugin/build/types/ios-widget/xcode/buildPhases.d.ts +25 -0
  286. package/expo-plugin/build/types/ios-widget/xcode/buildPhases.d.ts.map +1 -0
  287. package/expo-plugin/build/types/ios-widget/xcode/configurationList.d.ts +20 -0
  288. package/expo-plugin/build/types/ios-widget/xcode/configurationList.d.ts.map +1 -0
  289. package/expo-plugin/build/types/ios-widget/xcode/groups.d.ts +15 -0
  290. package/expo-plugin/build/types/ios-widget/xcode/groups.d.ts.map +1 -0
  291. package/expo-plugin/build/types/ios-widget/xcode/index.d.ts +20 -0
  292. package/expo-plugin/build/types/ios-widget/xcode/index.d.ts.map +1 -0
  293. package/expo-plugin/build/types/ios-widget/xcode/mainAppSettings.d.ts +15 -0
  294. package/expo-plugin/build/types/ios-widget/xcode/mainAppSettings.d.ts.map +1 -0
  295. package/expo-plugin/build/types/ios-widget/xcode/productFile.d.ts +14 -0
  296. package/expo-plugin/build/types/ios-widget/xcode/productFile.d.ts.map +1 -0
  297. package/expo-plugin/build/types/ios-widget/xcode/target.d.ts +42 -0
  298. package/expo-plugin/build/types/ios-widget/xcode/target.d.ts.map +1 -0
  299. package/expo-plugin/build/types/types.d.ts +74 -0
  300. package/expo-plugin/build/types/types.d.ts.map +1 -0
  301. package/expo-plugin/build/types/utils/fileDiscovery.d.ts +15 -0
  302. package/expo-plugin/build/types/utils/fileDiscovery.d.ts.map +1 -0
  303. package/expo-plugin/build/types/utils/urlScheme.d.ts +10 -0
  304. package/expo-plugin/build/types/utils/urlScheme.d.ts.map +1 -0
  305. package/expo-plugin/build/types/validation.d.ts +4 -0
  306. package/expo-plugin/build/types/validation.d.ts.map +1 -0
  307. package/expo-plugin/jest.config.js +18 -0
  308. package/expo-plugin/src/constants.ts +25 -0
  309. package/expo-plugin/src/index.ts +72 -0
  310. package/expo-plugin/src/ios/eas.ts +33 -0
  311. package/expo-plugin/src/ios/entitlements.ts +59 -0
  312. package/expo-plugin/src/ios/index.ts +47 -0
  313. package/expo-plugin/src/ios/infoPlist.ts +63 -0
  314. package/expo-plugin/src/ios/pushNotifications.ts +22 -0
  315. package/expo-plugin/src/ios-widget/eas.ts +79 -0
  316. package/expo-plugin/src/ios-widget/files/assets.ts +201 -0
  317. package/expo-plugin/src/ios-widget/files/entitlements.ts +48 -0
  318. package/expo-plugin/src/ios-widget/files/index.ts +74 -0
  319. package/expo-plugin/src/ios-widget/files/infoPlist.ts +57 -0
  320. package/expo-plugin/src/ios-widget/files/swift.node.test.ts +22 -0
  321. package/expo-plugin/src/ios-widget/files/swift.ts +476 -0
  322. package/expo-plugin/src/ios-widget/fonts.ts +132 -0
  323. package/expo-plugin/src/ios-widget/index.ts +73 -0
  324. package/expo-plugin/src/ios-widget/podfile.ts +44 -0
  325. package/expo-plugin/src/ios-widget/widgetPlist.ts +115 -0
  326. package/expo-plugin/src/ios-widget/xcode/buildPhases.ts +301 -0
  327. package/expo-plugin/src/ios-widget/xcode/configurationList.ts +127 -0
  328. package/expo-plugin/src/ios-widget/xcode/groups.ts +101 -0
  329. package/expo-plugin/src/ios-widget/xcode/index.ts +149 -0
  330. package/expo-plugin/src/ios-widget/xcode/mainAppSettings.ts +95 -0
  331. package/expo-plugin/src/ios-widget/xcode/productFile.ts +91 -0
  332. package/expo-plugin/src/ios-widget/xcode/target.ts +148 -0
  333. package/expo-plugin/src/types.ts +89 -0
  334. package/expo-plugin/src/utils/fileDiscovery.ts +96 -0
  335. package/expo-plugin/src/utils/urlScheme.ts +45 -0
  336. package/expo-plugin/src/validation.node.test.ts +19 -0
  337. package/expo-plugin/src/validation.ts +63 -0
  338. package/expo-plugin/tsconfig.base.json +17 -0
  339. package/expo-plugin/tsconfig.cjs.json +9 -0
  340. package/expo-plugin/tsconfig.esm.json +9 -0
  341. package/expo-plugin/tsconfig.jest.json +8 -0
  342. package/expo-plugin/tsconfig.typecheck.json +12 -0
  343. package/expo-plugin/tsconfig.types.json +10 -0
  344. package/ios/Package.swift +68 -0
  345. package/ios/Tests/JSGradientParserTests.swift +201 -0
  346. package/ios/Tests/VoltraSharedTests/SmokeTests.swift +8 -0
  347. package/ios/VoltraWidget.podspec +30 -0
  348. package/ios/app/NativeVoltra.h +5 -0
  349. package/ios/app/NativeVoltra.mm +211 -0
  350. package/ios/app/VoltraActivity.swift +5 -0
  351. package/ios/app/VoltraImagePreload.swift +154 -0
  352. package/ios/app/VoltraLiveActivityManager.swift +228 -0
  353. package/ios/app/VoltraLiveActivityService.swift +306 -0
  354. package/ios/app/VoltraModule.swift +215 -0
  355. package/ios/app/VoltraModuleImpl.swift +331 -0
  356. package/ios/app/VoltraOptions.swift +27 -0
  357. package/ios/app/VoltraViewComponentView.h +10 -0
  358. package/ios/app/VoltraViewComponentView.mm +67 -0
  359. package/ios/app/VoltraViewRoot.swift +63 -0
  360. package/ios/app/VoltraWidgetService.swift +154 -0
  361. package/ios/shared/BrotliCompression.swift +81 -0
  362. package/ios/shared/ComponentTypeID.swift +117 -0
  363. package/ios/shared/Data+hexString.swift +8 -0
  364. package/ios/shared/Date+toTimerInterval.swift +25 -0
  365. package/ios/shared/JSONValue.swift +128 -0
  366. package/ios/shared/ShortNames.swift +180 -0
  367. package/ios/shared/VoltraAttributes.swift +58 -0
  368. package/ios/shared/VoltraConfig.swift +18 -0
  369. package/ios/shared/VoltraConstants.swift +45 -0
  370. package/ios/shared/VoltraElement.swift +153 -0
  371. package/ios/shared/VoltraEvent.swift +72 -0
  372. package/ios/shared/VoltraEventBus.swift +80 -0
  373. package/ios/shared/VoltraImageStore.swift +119 -0
  374. package/ios/shared/VoltraInitialStateLocale.swift +54 -0
  375. package/ios/shared/VoltraInteractionIntent.swift +39 -0
  376. package/ios/shared/VoltraKeychainHelper.swift +178 -0
  377. package/ios/shared/VoltraLiveActivityPayload.swift +113 -0
  378. package/ios/shared/VoltraLogger.swift +30 -0
  379. package/ios/shared/VoltraNode.swift +194 -0
  380. package/ios/shared/VoltraPayloadMigrator.swift +63 -0
  381. package/ios/shared/VoltraPersistentEventQueue.swift +67 -0
  382. package/ios/shared/VoltraRefreshIntent.swift +29 -0
  383. package/ios/shared/VoltraRegion.swift +37 -0
  384. package/ios/shared/VoltraWidgetDefaults.swift +114 -0
  385. package/ios/shared/VoltraWidgetServerFetcher.swift +166 -0
  386. package/ios/target/VoltraHomeWidget.swift +508 -0
  387. package/ios/target/VoltraWidget.swift +158 -0
  388. package/ios/ui/Extensions/View.modifiers.swift +28 -0
  389. package/ios/ui/Extensions/VoltraNode+Parameters.swift +18 -0
  390. package/ios/ui/Generated/Parameters/.generated +8 -0
  391. package/ios/ui/Generated/Parameters/ButtonParameters.swift +15 -0
  392. package/ios/ui/Generated/Parameters/ChartParameters.swift +33 -0
  393. package/ios/ui/Generated/Parameters/CircularProgressViewParameters.swift +59 -0
  394. package/ios/ui/Generated/Parameters/ComponentParameters.swift +12 -0
  395. package/ios/ui/Generated/Parameters/DividerParameters.swift +12 -0
  396. package/ios/ui/Generated/Parameters/GaugeParameters.swift +54 -0
  397. package/ios/ui/Generated/Parameters/GlassContainerParameters.swift +15 -0
  398. package/ios/ui/Generated/Parameters/GroupBoxParameters.swift +12 -0
  399. package/ios/ui/Generated/Parameters/HStackParameters.swift +34 -0
  400. package/ios/ui/Generated/Parameters/ImageParameters.swift +29 -0
  401. package/ios/ui/Generated/Parameters/LabelParameters.swift +18 -0
  402. package/ios/ui/Generated/Parameters/LinearGradientParameters.swift +27 -0
  403. package/ios/ui/Generated/Parameters/LinearProgressViewParameters.swift +64 -0
  404. package/ios/ui/Generated/Parameters/LinkParameters.swift +15 -0
  405. package/ios/ui/Generated/Parameters/MaskParameters.swift +12 -0
  406. package/ios/ui/Generated/Parameters/SpacerParameters.swift +15 -0
  407. package/ios/ui/Generated/Parameters/SymbolParameters.swift +59 -0
  408. package/ios/ui/Generated/Parameters/TextParameters.swift +18 -0
  409. package/ios/ui/Generated/Parameters/TimerParameters.swift +54 -0
  410. package/ios/ui/Generated/Parameters/ToggleParameters.swift +24 -0
  411. package/ios/ui/Generated/Parameters/VStackParameters.swift +34 -0
  412. package/ios/ui/Generated/Parameters/ViewParameters.swift +12 -0
  413. package/ios/ui/Generated/Parameters/ZStackParameters.swift +15 -0
  414. package/ios/ui/Helpers/VoltraDeepLinkResolver.swift +43 -0
  415. package/ios/ui/Helpers/VoltraProgressDriver.swift +52 -0
  416. package/ios/ui/Layout/FlexContainerHelper.swift +114 -0
  417. package/ios/ui/Layout/VoltraFlexStackLayout.swift +417 -0
  418. package/ios/ui/Protocols/VoltraView.swift +29 -0
  419. package/ios/ui/Style/BackgroundValue.swift +27 -0
  420. package/ios/ui/Style/CompositeStyle.swift +81 -0
  421. package/ios/ui/Style/DecorationStyle.swift +207 -0
  422. package/ios/ui/Style/FlexEnvironment.swift +35 -0
  423. package/ios/ui/Style/FontVariant.swift +4 -0
  424. package/ios/ui/Style/GlassEffect.swift +6 -0
  425. package/ios/ui/Style/JSColorParser.swift +517 -0
  426. package/ios/ui/Style/JSGradientParser.swift +674 -0
  427. package/ios/ui/Style/JSStyleParser.swift +223 -0
  428. package/ios/ui/Style/LayoutStyle.swift +184 -0
  429. package/ios/ui/Style/Overflow.swift +4 -0
  430. package/ios/ui/Style/RenderingStyle.swift +33 -0
  431. package/ios/ui/Style/StyleConverter.swift +202 -0
  432. package/ios/ui/Style/TextDecoration.swift +6 -0
  433. package/ios/ui/Style/TextStyle.swift +50 -0
  434. package/ios/ui/Style/View+applyStyle.swift +38 -0
  435. package/ios/ui/Views/VoltraButton.swift +57 -0
  436. package/ios/ui/Views/VoltraChart.swift +840 -0
  437. package/ios/ui/Views/VoltraCircularProgressView.swift +103 -0
  438. package/ios/ui/Views/VoltraDivider.swift +16 -0
  439. package/ios/ui/Views/VoltraFlexView.swift +33 -0
  440. package/ios/ui/Views/VoltraGauge.swift +65 -0
  441. package/ios/ui/Views/VoltraGlassContainer.swift +29 -0
  442. package/ios/ui/Views/VoltraGroupBox.swift +26 -0
  443. package/ios/ui/Views/VoltraHStack.swift +70 -0
  444. package/ios/ui/Views/VoltraImage.swift +109 -0
  445. package/ios/ui/Views/VoltraLabel.swift +24 -0
  446. package/ios/ui/Views/VoltraLinearGradient.swift +115 -0
  447. package/ios/ui/Views/VoltraLinearProgressView.swift +118 -0
  448. package/ios/ui/Views/VoltraLink.swift +25 -0
  449. package/ios/ui/Views/VoltraMask.swift +23 -0
  450. package/ios/ui/Views/VoltraSpacer.swift +16 -0
  451. package/ios/ui/Views/VoltraSymbol.swift +160 -0
  452. package/ios/ui/Views/VoltraText.swift +87 -0
  453. package/ios/ui/Views/VoltraTimer.swift +131 -0
  454. package/ios/ui/Views/VoltraToggle.swift +39 -0
  455. package/ios/ui/Views/VoltraVStack.swift +68 -0
  456. package/ios/ui/Views/VoltraZStack.swift +33 -0
  457. package/ios/ui/Voltra.swift +86 -0
  458. package/package.json +91 -18
  459. package/build/cjs/VoltraModule.js +0 -6
  460. package/build/cjs/VoltraModule.js.map +0 -1
  461. package/build/cjs/components/VoltraLiveActivityPreview.js +0 -20
  462. package/build/cjs/components/VoltraLiveActivityPreview.js.map +0 -1
  463. package/build/cjs/components/VoltraView.js +0 -37
  464. package/build/cjs/components/VoltraView.js.map +0 -1
  465. package/build/cjs/components/VoltraWidgetPreview.js +0 -26
  466. package/build/cjs/components/VoltraWidgetPreview.js.map +0 -1
  467. package/build/cjs/events.js +0 -19
  468. package/build/cjs/events.js.map +0 -1
  469. package/build/cjs/helpers.js +0 -30
  470. package/build/cjs/helpers.js.map +0 -1
  471. package/build/cjs/index.js +0 -49
  472. package/build/cjs/index.js.map +0 -1
  473. package/build/cjs/live-activity/api.js +0 -158
  474. package/build/cjs/live-activity/api.js.map +0 -1
  475. package/build/cjs/logger.js +0 -36
  476. package/build/cjs/logger.js.map +0 -1
  477. package/build/cjs/preload.js +0 -54
  478. package/build/cjs/preload.js.map +0 -1
  479. package/build/cjs/utils/assertRunningOnApple.js +0 -13
  480. package/build/cjs/utils/assertRunningOnApple.js.map +0 -1
  481. package/build/cjs/utils/helpers.js +0 -7
  482. package/build/cjs/utils/helpers.js.map +0 -1
  483. package/build/cjs/utils/index.js +0 -19
  484. package/build/cjs/utils/index.js.map +0 -1
  485. package/build/cjs/utils/useUpdateOnHMR.js +0 -22
  486. package/build/cjs/utils/useUpdateOnHMR.js.map +0 -1
  487. package/build/cjs/widgets/server-credentials.js +0 -18
  488. package/build/cjs/widgets/server-credentials.js.map +0 -1
  489. package/build/cjs/widgets/widget-api.js +0 -59
  490. package/build/cjs/widgets/widget-api.js.map +0 -1
  491. package/build/esm/VoltraModule.js +0 -4
  492. package/build/esm/VoltraModule.js.map +0 -1
  493. package/build/esm/components/VoltraLiveActivityPreview.js +0 -17
  494. package/build/esm/components/VoltraLiveActivityPreview.js.map +0 -1
  495. package/build/esm/components/VoltraView.js +0 -34
  496. package/build/esm/components/VoltraView.js.map +0 -1
  497. package/build/esm/components/VoltraWidgetPreview.js +0 -23
  498. package/build/esm/components/VoltraWidgetPreview.js.map +0 -1
  499. package/build/esm/events.js +0 -13
  500. package/build/esm/events.js.map +0 -1
  501. package/build/esm/helpers.js +0 -23
  502. package/build/esm/helpers.js.map +0 -1
  503. package/build/esm/index.js +0 -10
  504. package/build/esm/index.js.map +0 -1
  505. package/build/esm/live-activity/api.js +0 -146
  506. package/build/esm/live-activity/api.js.map +0 -1
  507. package/build/esm/logger.js +0 -33
  508. package/build/esm/logger.js.map +0 -1
  509. package/build/esm/preload.js +0 -46
  510. package/build/esm/preload.js.map +0 -1
  511. package/build/esm/utils/assertRunningOnApple.js +0 -9
  512. package/build/esm/utils/assertRunningOnApple.js.map +0 -1
  513. package/build/esm/utils/helpers.js.map +0 -1
  514. package/build/esm/utils/index.js.map +0 -1
  515. package/build/esm/utils/useUpdateOnHMR.js +0 -18
  516. package/build/esm/utils/useUpdateOnHMR.js.map +0 -1
  517. package/build/esm/widgets/server-credentials.js +0 -11
  518. package/build/esm/widgets/server-credentials.js.map +0 -1
  519. package/build/esm/widgets/widget-api.js +0 -47
  520. package/build/esm/widgets/widget-api.js.map +0 -1
  521. package/build/types/VoltraModule.d.ts +0 -44
  522. package/build/types/VoltraModule.d.ts.map +0 -1
  523. package/build/types/components/VoltraLiveActivityPreview.d.ts.map +0 -1
  524. package/build/types/components/VoltraView.d.ts.map +0 -1
  525. package/build/types/components/VoltraWidgetPreview.d.ts.map +0 -1
  526. package/build/types/events.d.ts.map +0 -1
  527. package/build/types/helpers.d.ts.map +0 -1
  528. package/build/types/index.d.ts.map +0 -1
  529. package/build/types/live-activity/api.d.ts.map +0 -1
  530. package/build/types/logger.d.ts.map +0 -1
  531. package/build/types/preload.d.ts.map +0 -1
  532. package/build/types/types.d.ts.map +0 -1
  533. package/build/types/utils/assertRunningOnApple.d.ts.map +0 -1
  534. package/build/types/utils/helpers.d.ts.map +0 -1
  535. package/build/types/utils/index.d.ts.map +0 -1
  536. package/build/types/utils/useUpdateOnHMR.d.ts.map +0 -1
  537. package/build/types/widgets/server-credentials.d.ts.map +0 -1
  538. package/build/types/widgets/widget-api.d.ts.map +0 -1
  539. /package/build/{types → typescript/commonjs}/components/VoltraLiveActivityPreview.d.ts +0 -0
  540. /package/build/{types → typescript/commonjs}/components/VoltraView.d.ts +0 -0
  541. /package/build/{types → typescript/commonjs}/components/VoltraWidgetPreview.d.ts +0 -0
  542. /package/build/{types → typescript/commonjs}/events.d.ts +0 -0
  543. /package/build/{types → typescript/commonjs}/helpers.d.ts +0 -0
  544. /package/build/{types → typescript/commonjs}/live-activity/api.d.ts +0 -0
  545. /package/build/{types → typescript/commonjs}/logger.d.ts +0 -0
  546. /package/build/{types → typescript/commonjs}/preload.d.ts +0 -0
  547. /package/build/{types → typescript/commonjs}/types.d.ts +0 -0
  548. /package/build/{types → typescript/commonjs}/utils/assertRunningOnApple.d.ts +0 -0
  549. /package/build/{types → typescript/commonjs}/utils/helpers.d.ts +0 -0
  550. /package/build/{types → typescript/commonjs}/utils/index.d.ts +0 -0
  551. /package/build/{types → typescript/commonjs}/utils/useUpdateOnHMR.d.ts +0 -0
  552. /package/build/{types → typescript/commonjs}/widgets/server-credentials.d.ts +0 -0
  553. /package/build/{types → typescript/commonjs}/widgets/widget-api.d.ts +0 -0
  554. /package/{build → expo-plugin/build}/cjs/package.json +0 -0
  555. /package/{build → expo-plugin/build}/cjs/types.js +0 -0
  556. /package/{build → expo-plugin/build}/cjs/types.js.map +0 -0
  557. /package/{build → expo-plugin/build}/esm/package.json +0 -0
  558. /package/{build → expo-plugin/build}/esm/types.js +0 -0
  559. /package/{build → expo-plugin/build}/esm/types.js.map +0 -0
@@ -0,0 +1,22 @@
1
+ import { __test__ } from './swift'
2
+
3
+ describe('generateInitialStatesSwift', () => {
4
+ it('embeds the locale helper into generated initial states Swift', () => {
5
+ const swift = __test__.generateInitialStatesSwift(
6
+ new Map([
7
+ [
8
+ 'weather',
9
+ new Map([
10
+ ['en-US', '{"ok":true}'],
11
+ ['pl', '{"ok":false}'],
12
+ ]),
13
+ ],
14
+ ])
15
+ )
16
+
17
+ expect(swift).toContain('private enum VoltraGeneratedInitialStateLocale')
18
+ expect(swift).toContain('VoltraGeneratedInitialStateLocale.preferredLanguageTags()')
19
+ expect(swift).toContain('VoltraGeneratedInitialStateLocale.pickJson(from: perLocale, preferredLanguages: tags)')
20
+ expect(swift).not.toContain('VoltraInitialStateLocale.preferredLanguageTags()')
21
+ })
22
+ })
@@ -0,0 +1,476 @@
1
+ import dedent from 'dedent'
2
+ import * as fs from 'fs'
3
+ import * as path from 'path'
4
+
5
+ import {
6
+ isWidgetLocalizedMap,
7
+ logger,
8
+ prerenderWidgetState,
9
+ widgetLabelEnglish,
10
+ type PrerenderedWidgetStates,
11
+ type WidgetLabel,
12
+ } from '@use-voltra/expo-plugin'
13
+
14
+ import { DEFAULT_WIDGET_FAMILIES, WIDGET_FAMILY_MAP } from '../../constants'
15
+ import type { IOSWidgetConfig } from '../../types'
16
+ import { VOLTRA_WIDGET_STRINGS_BASENAME } from '../../utils/fileDiscovery'
17
+
18
+ export interface GenerateSwiftFilesOptions {
19
+ targetPath: string
20
+ projectRoot: string
21
+ widgets?: IOSWidgetConfig[]
22
+ }
23
+
24
+ type RenderWidgetToString = (variants: unknown) => string
25
+
26
+ // ============================================================================
27
+ // Main Function
28
+ // ============================================================================
29
+
30
+ /**
31
+ * Generates all Swift files for the widget extension.
32
+ *
33
+ * This creates:
34
+ * - VoltraWidgetInitialStates.swift (pre-rendered widget states)
35
+ * - VoltraWidgetBundle.swift (widget bundle definition)
36
+ */
37
+ export async function generateSwiftFiles(options: GenerateSwiftFilesOptions): Promise<void> {
38
+ const { targetPath, projectRoot, widgets } = options
39
+
40
+ // Dynamic import keeps the plugin CommonJS-compatible while resolving the current package entry.
41
+ const serverModuleId = '@use-voltra/ios/server'
42
+ const { renderWidgetToString } = (await import(serverModuleId)) as {
43
+ renderWidgetToString: RenderWidgetToString
44
+ }
45
+
46
+ // Prerender widget initial states if any widgets have initialStatePath configured
47
+ const prerenderedStates = await prerenderWidgetState(widgets || [], projectRoot, renderWidgetToString)
48
+
49
+ syncVoltraWidgetGalleryStrings(targetPath, widgets)
50
+
51
+ // Generate the initial states Swift file
52
+ const initialStatesContent = generateInitialStatesSwift(prerenderedStates)
53
+ const initialStatesPath = path.join(targetPath, 'VoltraWidgetInitialStates.swift')
54
+ fs.writeFileSync(initialStatesPath, initialStatesContent)
55
+
56
+ logger.info(
57
+ `Generated VoltraWidgetInitialStates.swift with ${prerenderedStates.size} widget(s) (localized initial states where configured)`
58
+ )
59
+
60
+ // Generate the widget bundle Swift file
61
+ const widgetBundleContent =
62
+ widgets && widgets.length > 0 ? generateWidgetBundleSwift(widgets) : generateDefaultWidgetBundleSwift()
63
+
64
+ const widgetBundlePath = path.join(targetPath, 'VoltraWidgetBundle.swift')
65
+ fs.writeFileSync(widgetBundlePath, widgetBundleContent)
66
+
67
+ logger.info(`Generated VoltraWidgetBundle.swift with ${widgets?.length ?? 0} home screen widgets`)
68
+ }
69
+
70
+ const GENERATED_INITIAL_STATE_LOCALE_HELPER = dedent`
71
+ private enum VoltraGeneratedInitialStateLocale {
72
+ static func pickJson(from perLocale: [String: String], preferredLanguages: [String]) -> String? {
73
+ let entries = perLocale.filter { !$0.value.isEmpty }
74
+ if entries.isEmpty {
75
+ return nil
76
+ }
77
+
78
+ func normalize(_ tag: String) -> String {
79
+ tag.trimmingCharacters(in: .whitespacesAndNewlines)
80
+ .lowercased()
81
+ .replacingOccurrences(of: "_", with: "-")
82
+ }
83
+
84
+ var byNorm: [String: String] = [:]
85
+ for (k, v) in entries {
86
+ byNorm[normalize(k)] = v
87
+ }
88
+
89
+ for pref in preferredLanguages {
90
+ let n = normalize(pref)
91
+ if let direct = byNorm[n] {
92
+ return direct
93
+ }
94
+ let lang = n.split(separator: "-").first.map(String.init) ?? n
95
+ for (key, val) in entries {
96
+ let kn = normalize(key)
97
+ let keyLang = kn.split(separator: "-").first.map(String.init) ?? kn
98
+ if keyLang == lang {
99
+ return val
100
+ }
101
+ }
102
+ }
103
+
104
+ if let en = byNorm["en"] {
105
+ return en
106
+ }
107
+ if let englishFamily = entries.keys.sorted().first(where: {
108
+ let normalized = normalize($0)
109
+ return normalized == "en" || normalized.hasPrefix("en-")
110
+ }) {
111
+ return entries[englishFamily]
112
+ }
113
+ if let def = byNorm["__default"] {
114
+ return def
115
+ }
116
+
117
+ let sorted = entries.keys.sorted()
118
+ guard let firstKey = sorted.first else {
119
+ return nil
120
+ }
121
+ return entries[firstKey]
122
+ }
123
+
124
+ static func preferredLanguageTags() -> [String] {
125
+ Locale.preferredLanguages
126
+ }
127
+ }
128
+ `
129
+
130
+ // ============================================================================
131
+ // Widget gallery localization: *.lproj/VoltraWidgets.strings + LocalizedStringResource
132
+ //
133
+ // We use classic .strings tables (not .xcstrings): the `xcode` npm library assigns
134
+ // unknown lastKnownFileType to .xcstrings, so Xcode may not treat them as string tables
135
+ // and lookups fall back to English defaultValue.
136
+ //
137
+ // LocalizedStringResource is still appropriate for extensions (deferred resolution).
138
+ // https://developer.apple.com/documentation/foundation/localizedstringresource
139
+ // ============================================================================
140
+
141
+ function escapeForSwiftStringLiteral(s: string): string {
142
+ return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\n/g, '\\n').replace(/\r/g, '\\r')
143
+ }
144
+
145
+ function escapeDotStringsValue(s: string): string {
146
+ return escapeForSwiftStringLiteral(s)
147
+ }
148
+
149
+ function collectGalleryStringsByLocale(widgets: IOSWidgetConfig[]): Map<string, Record<string, string>> {
150
+ const byLocale = new Map<string, Record<string, string>>()
151
+
152
+ const add = (locale: string, key: string, value: string) => {
153
+ let bucket = byLocale.get(locale)
154
+ if (!bucket) {
155
+ bucket = {}
156
+ byLocale.set(locale, bucket)
157
+ }
158
+ bucket[key] = value
159
+ }
160
+
161
+ for (const w of widgets) {
162
+ if (isWidgetLocalizedMap(w.displayName)) {
163
+ const key = `voltra_widget_${w.id}_displayName`
164
+ for (const [locale, val] of Object.entries(w.displayName)) {
165
+ if (typeof val === 'string' && val.trim()) {
166
+ add(locale, key, val)
167
+ }
168
+ }
169
+ }
170
+ if (isWidgetLocalizedMap(w.description)) {
171
+ const key = `voltra_widget_${w.id}_description`
172
+ for (const [locale, val] of Object.entries(w.description)) {
173
+ if (typeof val === 'string' && val.trim()) {
174
+ add(locale, key, val)
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ return byLocale
181
+ }
182
+
183
+ function formatVoltraWidgetsStringsFile(entries: Record<string, string>): string {
184
+ const sortedKeys = Object.keys(entries).sort()
185
+ const lines = sortedKeys.map((k) => `"${k}" = "${escapeDotStringsValue(entries[k]!)}";`)
186
+ return `/* Voltra widget gallery strings (auto-generated) */\n${lines.join('\n')}\n`
187
+ }
188
+
189
+ /** Remove generated gallery strings and obsolete string catalog before rewriting. */
190
+ function clearVoltraWidgetGalleryStringArtifacts(targetPath: string): void {
191
+ const catalogPath = path.join(targetPath, 'VoltraWidgets.xcstrings')
192
+ if (fs.existsSync(catalogPath)) {
193
+ fs.unlinkSync(catalogPath)
194
+ }
195
+
196
+ if (!fs.existsSync(targetPath)) {
197
+ return
198
+ }
199
+
200
+ for (const entry of fs.readdirSync(targetPath)) {
201
+ if (!entry.endsWith('.lproj')) {
202
+ continue
203
+ }
204
+ const stringsPath = path.join(targetPath, entry, VOLTRA_WIDGET_STRINGS_BASENAME)
205
+ if (fs.existsSync(stringsPath)) {
206
+ fs.unlinkSync(stringsPath)
207
+ }
208
+ const dirPath = path.join(targetPath, entry)
209
+ try {
210
+ if (fs.existsSync(dirPath) && fs.readdirSync(dirPath).length === 0) {
211
+ fs.rmdirSync(dirPath)
212
+ }
213
+ } catch {
214
+ /* ignore */
215
+ }
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Writes `<locale>.lproj/VoltraWidgets.strings` for locale-map gallery labels.
221
+ */
222
+ function syncVoltraWidgetGalleryStrings(targetPath: string, widgets: IOSWidgetConfig[] | undefined): void {
223
+ const list = widgets ?? []
224
+ clearVoltraWidgetGalleryStringArtifacts(targetPath)
225
+
226
+ if (list.length === 0) {
227
+ return
228
+ }
229
+
230
+ const byLocale = collectGalleryStringsByLocale(list)
231
+ if (byLocale.size === 0) {
232
+ return
233
+ }
234
+
235
+ for (const [locale, kv] of byLocale) {
236
+ const lproj = path.join(targetPath, `${locale}.lproj`)
237
+ fs.mkdirSync(lproj, { recursive: true })
238
+ fs.writeFileSync(path.join(lproj, VOLTRA_WIDGET_STRINGS_BASENAME), formatVoltraWidgetsStringsFile(kv), 'utf8')
239
+ }
240
+ }
241
+
242
+ function widgetUsesGalleryLocalization(widget: IOSWidgetConfig): boolean {
243
+ return isWidgetLocalizedMap(widget.displayName) || isWidgetLocalizedMap(widget.description)
244
+ }
245
+
246
+ /**
247
+ * Widget gallery title / description: deferred lookup via LocalizedStringResource when using a locale map
248
+ * (recommended for extensions); plain Text for single-string config.
249
+ */
250
+ function iosWidgetGalleryLabelSwiftExpr(
251
+ widgetId: string,
252
+ field: 'displayName' | 'description',
253
+ label: WidgetLabel
254
+ ): string {
255
+ if (!isWidgetLocalizedMap(label)) {
256
+ return `Text("${escapeForSwiftStringLiteral(label)}")`
257
+ }
258
+
259
+ const key = `voltra_widget_${widgetId}_${field}`
260
+ const defaultEnglish = escapeForSwiftStringLiteral(widgetLabelEnglish(label))
261
+
262
+ return `Text(LocalizedStringResource("${key}", defaultValue: String.LocalizationValue("${defaultEnglish}"), table: "VoltraWidgets"))`
263
+ }
264
+
265
+ /**
266
+ * Generates Swift code for a single widget struct
267
+ */
268
+ function generateWidgetStruct(widget: IOSWidgetConfig): string {
269
+ const families = widget.supportedFamilies ?? DEFAULT_WIDGET_FAMILIES
270
+ const familiesSwift = families.map((f) => WIDGET_FAMILY_MAP[f]).join(', ')
271
+
272
+ // Sanitize the widget id for use as a Swift identifier
273
+ const structName = `VoltraWidget_${widget.id}`
274
+
275
+ const displayNameExpr = iosWidgetGalleryLabelSwiftExpr(widget.id, 'displayName', widget.displayName)
276
+ const descriptionExpr = iosWidgetGalleryLabelSwiftExpr(widget.id, 'description', widget.description)
277
+
278
+ return dedent`
279
+ public struct ${structName}: Widget {
280
+ private let widgetId = "${widget.id}"
281
+
282
+ public init() {}
283
+
284
+ public var body: some WidgetConfiguration {
285
+ StaticConfiguration(
286
+ kind: "Voltra_Widget_${widget.id}",
287
+ provider: VoltraHomeWidgetProvider(
288
+ widgetId: widgetId,
289
+ initialState: VoltraWidgetInitialStates.getInitialState(for: widgetId)
290
+ )
291
+ ) { entry in
292
+ VoltraHomeWidgetView(entry: entry)
293
+ }
294
+ .configurationDisplayName(${displayNameExpr})
295
+ .description(${descriptionExpr})
296
+ .supportedFamilies([${familiesSwift}])
297
+ .contentMarginsDisabled()
298
+ }
299
+ }
300
+ `
301
+ }
302
+
303
+ /**
304
+ * Generates the VoltraWidgetBundle.swift file content with configured widgets
305
+ */
306
+ function generateWidgetBundleSwift(widgets: IOSWidgetConfig[]): string {
307
+ // Generate widget structs
308
+ const widgetStructs = widgets.map(generateWidgetStruct).join('\n\n')
309
+
310
+ // Generate widget bundle body entries
311
+ const widgetInstances = widgets.map((w) => `VoltraWidget_${w.id}()`).join('\n ')
312
+
313
+ const needsFoundation = widgets.some(widgetUsesGalleryLocalization)
314
+ const foundationImport = needsFoundation ? 'import Foundation\n' : ''
315
+
316
+ return dedent`
317
+ //
318
+ // VoltraWidgetBundle.swift
319
+ //
320
+ // Auto-generated by Voltra config plugin.
321
+ // This file defines which Voltra widgets are available in your app.
322
+ //
323
+
324
+ ${foundationImport}import SwiftUI
325
+ import WidgetKit
326
+ import VoltraWidget
327
+
328
+ @main
329
+ struct VoltraWidgetBundle: WidgetBundle {
330
+ var body: some Widget {
331
+ // Live Activity (with Watch/CarPlay support)
332
+ VoltraWidget()
333
+
334
+ // Home Screen Widgets
335
+ ${widgetInstances}
336
+ }
337
+ }
338
+
339
+ // MARK: - Home Screen Widget Definitions
340
+
341
+ ${widgetStructs}
342
+ `
343
+ }
344
+
345
+ /**
346
+ * Generates the VoltraWidgetBundle.swift file content when no widgets are configured
347
+ * (only Live Activities)
348
+ */
349
+ function generateDefaultWidgetBundleSwift(): string {
350
+ return dedent`
351
+ //
352
+ // VoltraWidgetBundle.swift
353
+ //
354
+ // This file defines which Voltra widgets are available in your app.
355
+ // You can customize which widgets to include by adding or removing them below.
356
+ //
357
+
358
+ import SwiftUI
359
+ import WidgetKit
360
+ import VoltraWidget // Import Voltra widgets
361
+
362
+ @main
363
+ struct VoltraWidgetBundle: WidgetBundle {
364
+ var body: some Widget {
365
+ // Live Activity (with Watch/CarPlay support)
366
+ VoltraWidget()
367
+ }
368
+ }
369
+ `
370
+ }
371
+
372
+ // ============================================================================
373
+ // Initial States
374
+ // ============================================================================
375
+
376
+ /**
377
+ * Generates Swift code that bundles pre-rendered widget initial states (per locale when configured).
378
+ */
379
+ function generateInitialStatesSwift(prerenderedStates: PrerenderedWidgetStates): string {
380
+ if (prerenderedStates.size === 0) {
381
+ return generateEmptyInitialStatesSwift()
382
+ }
383
+
384
+ const widgetEntries = Array.from(prerenderedStates.entries())
385
+ .map(([widgetId, perLocale]) => {
386
+ const localeEntries = Array.from(perLocale.entries())
387
+ .map(([localeKey, json]) => {
388
+ const delimiter = getSwiftRawStringDelimiter(json)
389
+ return `"${escapeForSwiftStringLiteral(localeKey)}": ${delimiter}"${json}"${delimiter}`
390
+ })
391
+ .join(',\n ')
392
+ return `"${widgetId}": [\n ${localeEntries}\n ]`
393
+ })
394
+ .join(',\n ')
395
+
396
+ return dedent`
397
+ //
398
+ // VoltraWidgetInitialStates.swift
399
+ //
400
+ // Auto-generated by Voltra config plugin.
401
+ // Contains pre-rendered initial states for home screen widgets.
402
+ //
403
+
404
+ import Foundation
405
+
406
+ ${GENERATED_INITIAL_STATE_LOCALE_HELPER}
407
+
408
+ public enum VoltraWidgetInitialStates {
409
+ private static let bundledLocalizedStates: [String: [String: String]] = [
410
+ ${widgetEntries}
411
+ ]
412
+
413
+ /// Get the bundled initial state JSON for a widget, matching the device locale when multiple locales were built.
414
+ /// Returns nil if no initial state was configured for the widget.
415
+ public static func getInitialState(for widgetId: String) -> Data? {
416
+ guard let perLocale = bundledLocalizedStates[widgetId] else { return nil }
417
+ let tags = VoltraGeneratedInitialStateLocale.preferredLanguageTags()
418
+ guard let jsonString = VoltraGeneratedInitialStateLocale.pickJson(from: perLocale, preferredLanguages: tags) else {
419
+ return nil
420
+ }
421
+ return jsonString.data(using: .utf8)
422
+ }
423
+ }
424
+ `
425
+ }
426
+
427
+ /**
428
+ * Generates empty Swift code when no widgets have initial states configured.
429
+ */
430
+ function generateEmptyInitialStatesSwift(): string {
431
+ return dedent`
432
+ //
433
+ // VoltraWidgetInitialStates.swift
434
+ //
435
+ // Auto-generated by Voltra config plugin.
436
+ // No widget initial states configured.
437
+ //
438
+
439
+ import Foundation
440
+
441
+ public enum VoltraWidgetInitialStates {
442
+ /// Get the bundled initial state JSON for a widget.
443
+ /// Always returns nil since no initial states are configured.
444
+ public static func getInitialState(for widgetId: String) -> Data? {
445
+ return nil
446
+ }
447
+ }
448
+ `
449
+ }
450
+
451
+ /**
452
+ * Determines the appropriate Swift raw string delimiter for a given string.
453
+ * Counts the maximum consecutive '#' characters after a '"' in the content
454
+ * and returns a delimiter with one more '#' than that maximum.
455
+ *
456
+ * For example:
457
+ * - Content has no '"#' → returns '#'
458
+ * - Content has '"#' (1 hash) → returns '##'
459
+ * - Content has '"##' (2 hashes) → returns '###'
460
+ */
461
+ function getSwiftRawStringDelimiter(str: string): string {
462
+ // Find all sequences of '#' that follow a '"'
463
+ const matches = str.match(/"#+/g)
464
+
465
+ if (!matches) {
466
+ return '#'
467
+ }
468
+
469
+ // Find the maximum number of consecutive '#' after a '"'
470
+ const maxHashes = Math.max(...matches.map((m) => m.length - 1)) // -1 to exclude the '"'
471
+ return '#'.repeat(maxHashes + 1)
472
+ }
473
+
474
+ export const __test__ = {
475
+ generateInitialStatesSwift,
476
+ }
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Font configuration for Live Activity extension.
3
+ *
4
+ * This code is adapted from expo-font to support custom fonts in Live Activities.
5
+ * @see https://github.com/expo/expo/tree/main/packages/expo-font/plugin
6
+ *
7
+ * I would love to reuse the existing expo-font infrastructure, but it's not that easy to do. I'll most likely revisit it later.
8
+ */
9
+
10
+ import { type ConfigPlugin, type InfoPlist, IOSConfig, withDangerousMod, withXcodeProject } from '@expo/config-plugins'
11
+ import plist from '@expo/plist'
12
+ import type { ExpoConfig } from 'expo/config'
13
+ import { readFileSync, writeFileSync } from 'fs'
14
+ import * as path from 'path'
15
+
16
+ import { logger } from '@use-voltra/expo-plugin'
17
+ import { resolveFontPaths } from '@use-voltra/expo-plugin'
18
+
19
+ /**
20
+ * Plugin that adds custom fonts to the Live Activity extension.
21
+ *
22
+ * @param config - The Expo config
23
+ * @param fonts - Array of font file paths or directories
24
+ * @param targetName - Name of the Live Activity extension target
25
+ * @returns Modified config
26
+ */
27
+ export const withFonts: ConfigPlugin<{ fonts: string[]; targetName: string }> = (config, { fonts, targetName }) => {
28
+ if (!fonts || fonts.length === 0) {
29
+ return config
30
+ }
31
+
32
+ config = addFontsToTarget(config, fonts, targetName)
33
+ config = addFontsToPlist(config, fonts, targetName)
34
+ return config
35
+ }
36
+
37
+ /**
38
+ * Adds font files to the Live Activity extension target.
39
+ * This ensures fonts are bundled with the extension and accessible at runtime.
40
+ */
41
+ function addFontsToTarget(config: ExpoConfig, fonts: string[], targetName: string) {
42
+ return withXcodeProject(config, async (config) => {
43
+ if (config.modRequest.introspect) {
44
+ return config
45
+ }
46
+
47
+ const resolvedFonts = await resolveFontPaths(fonts, config.modRequest.projectRoot)
48
+ const project = config.modResults
49
+ const platformProjectRoot = config.modRequest.platformProjectRoot
50
+ const targetUuid = project.findTargetKey(targetName)
51
+
52
+ if (targetUuid == null) {
53
+ throw new Error(`Target ${targetName} not found in Xcode project. Report this issue to the Voltra team.`)
54
+ }
55
+
56
+ IOSConfig.XcodeUtils.ensureGroupRecursively(project, 'VoltraResources')
57
+
58
+ for (const font of resolvedFonts) {
59
+ const fontPath = path.relative(platformProjectRoot, font)
60
+
61
+ IOSConfig.XcodeUtils.addResourceFileToGroup({
62
+ filepath: fontPath,
63
+ groupName: 'VoltraResources',
64
+ project,
65
+ isBuildFile: true,
66
+ verbose: true,
67
+ targetUuid,
68
+ })
69
+
70
+ logger.info(`Added font file: ${path.basename(font)}`)
71
+ }
72
+
73
+ return config
74
+ })
75
+ }
76
+
77
+ /**
78
+ * Adds font filenames to the Live Activity extension's Info.plist UIAppFonts array.
79
+ * This makes iOS aware of the custom fonts and allows them to be used in SwiftUI.
80
+ */
81
+ function addFontsToPlist(config: ExpoConfig, fonts: string[], targetName: string) {
82
+ return withDangerousMod(config, [
83
+ 'ios',
84
+ async (config) => {
85
+ if (config.modRequest.introspect) {
86
+ return config
87
+ }
88
+
89
+ const resolvedFonts = await resolveFontPaths(fonts, config.modRequest.projectRoot)
90
+ const platformProjectRoot = config.modRequest.platformProjectRoot
91
+
92
+ // Read the Live Activity extension's Info.plist directly
93
+ const targetPath = path.join(platformProjectRoot, targetName)
94
+ const infoPlistPath = path.join(targetPath, 'Info.plist')
95
+
96
+ try {
97
+ const plistContent = plist.parse(readFileSync(infoPlistPath, 'utf8')) as InfoPlist
98
+
99
+ // Get existing fonts or initialize empty array
100
+ const existingFonts = getUIAppFonts(plistContent)
101
+
102
+ // Add new fonts
103
+ const fontList = resolvedFonts.map((font) => path.basename(font))
104
+ const allFonts = [...existingFonts, ...fontList]
105
+ plistContent.UIAppFonts = Array.from(new Set(allFonts))
106
+
107
+ // Write back to file
108
+ writeFileSync(infoPlistPath, plist.build(plistContent))
109
+
110
+ logger.info(`Added ${fontList.length} font(s) to ${targetName} Info.plist`)
111
+ } catch (error) {
112
+ logger.warn(`Could not update Info.plist for fonts: ${error}`)
113
+ }
114
+
115
+ return config
116
+ },
117
+ ])
118
+ }
119
+
120
+ /**
121
+ * Retrieves existing UIAppFonts from Info.plist.
122
+ *
123
+ * @param infoPlist - Info.plist object
124
+ * @returns Array of font filenames
125
+ */
126
+ function getUIAppFonts(infoPlist: InfoPlist): string[] {
127
+ const fonts = infoPlist['UIAppFonts']
128
+ if (fonts != null && Array.isArray(fonts) && fonts.every((font) => typeof font === 'string')) {
129
+ return fonts as string[]
130
+ }
131
+ return []
132
+ }
@@ -0,0 +1,73 @@
1
+ import { ConfigPlugin, withPlugins } from '@expo/config-plugins'
2
+
3
+ import type { IOSWidgetConfig } from '../types'
4
+ import { configureEasBuild } from './eas'
5
+ import { generateWidgetExtensionFiles } from './files'
6
+ import { withFonts } from './fonts'
7
+ import { configurePodfile } from './podfile'
8
+ import { configureWidgetExtensionPlist } from './widgetPlist'
9
+ import { configureXcodeProject } from './xcode'
10
+
11
+ export interface WithIOSProps {
12
+ targetName: string
13
+ bundleIdentifier: string
14
+ deploymentTarget: string
15
+ widgets?: IOSWidgetConfig[]
16
+ groupIdentifier?: string
17
+ keychainGroup?: string
18
+ fonts?: string[]
19
+ version: string
20
+ buildNumber: string
21
+ }
22
+
23
+ /**
24
+ * Main iOS configuration plugin.
25
+ *
26
+ * This orchestrates all iOS-related configuration in the correct order:
27
+ * 1. Add custom fonts (if provided)
28
+ * 2. Configure Xcode project (targets, build phases, groups)
29
+ * 3. Configure Podfile for widget extension
30
+ * 4. Configure main app Info.plist (URL schemes)
31
+ * 5. Configure EAS build settings
32
+ * 6. Generate widget extension files (Swift, assets, plist, entitlements)
33
+ *
34
+ * NOTE: Expo mods execute in REVERSE registration order. Plugins that depend
35
+ * on modifications from other plugins must be registered BEFORE their dependencies.
36
+ * For example, fonts plugin needs the target created by configureXcodeProject,
37
+ * so fonts must be registered before configureXcodeProject.
38
+ */
39
+ export const withIOS: ConfigPlugin<WithIOSProps> = (config, props) => {
40
+ const {
41
+ targetName,
42
+ bundleIdentifier,
43
+ deploymentTarget,
44
+ widgets,
45
+ groupIdentifier,
46
+ keychainGroup,
47
+ fonts,
48
+ version,
49
+ buildNumber,
50
+ } = props
51
+
52
+ const plugins: [ConfigPlugin<any>, any][] = [
53
+ // 1. Add custom fonts if provided
54
+ ...(fonts && fonts.length > 0 ? [[withFonts, { fonts, targetName }] as [ConfigPlugin<any>, any]] : []),
55
+
56
+ // 2. Configure Xcode project (creates the target - must run before fonts mod executes)
57
+ [configureXcodeProject, { targetName, bundleIdentifier, deploymentTarget }],
58
+
59
+ // 3. Configure Podfile for widget extension target
60
+ [configurePodfile, { targetName }],
61
+
62
+ // 4. Configure main app Info.plist (URL schemes, widget extension plist)
63
+ [configureWidgetExtensionPlist, { targetName, groupIdentifier, widgets, keychainGroup }],
64
+
65
+ // 5. Configure EAS build settings
66
+ [configureEasBuild, { targetName, bundleIdentifier, groupIdentifier }],
67
+
68
+ // 6. Generate widget extension files (dangerous mod should run before plist patchers)
69
+ [generateWidgetExtensionFiles, { targetName, widgets, groupIdentifier, keychainGroup, version, buildNumber }],
70
+ ]
71
+
72
+ return withPlugins(config, plugins)
73
+ }