expo-targets 0.1.0

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 (231) hide show
  1. package/.eslintrc.js +2 -0
  2. package/README.md +244 -0
  3. package/android/build.gradle +22 -0
  4. package/android/src/main/java/expo/modules/targets/ExpoTargetsLogger.kt +98 -0
  5. package/android/src/main/java/expo/modules/targets/ExpoTargetsReceiver.kt +136 -0
  6. package/android/src/main/java/expo/modules/targets/ExpoTargetsRemoteViewsProvider.kt +72 -0
  7. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetProvider.kt +47 -0
  8. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetSync.kt +78 -0
  9. package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetUpdateReceiver.kt +30 -0
  10. package/android/src/main/java/expo/modules/targets/extension/ExpoTargetsExtensionModule.kt +27 -0
  11. package/android/src/main/java/expo/modules/targets/messages/ExpoTargetsMessagesModule.kt +40 -0
  12. package/android/src/main/java/expo/modules/targets/storage/ExpoTargetsStorageModule.kt +119 -0
  13. package/app.plugin.js +1 -0
  14. package/build/metro/src/index.d.ts +2 -0
  15. package/build/metro/src/index.d.ts.map +1 -0
  16. package/build/metro/src/index.js +6 -0
  17. package/build/metro/src/index.js.map +1 -0
  18. package/build/metro/src/withTargetsMetro.d.ts +6 -0
  19. package/build/metro/src/withTargetsMetro.d.ts.map +1 -0
  20. package/build/metro/src/withTargetsMetro.js +171 -0
  21. package/build/metro/src/withTargetsMetro.js.map +1 -0
  22. package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts +7 -0
  23. package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts.map +1 -0
  24. package/build/plugin/src/android/config-plugins/withAndroidColors.js +56 -0
  25. package/build/plugin/src/android/config-plugins/withAndroidColors.js.map +1 -0
  26. package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts +7 -0
  27. package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts.map +1 -0
  28. package/build/plugin/src/android/config-plugins/withAndroidManifest.js +70 -0
  29. package/build/plugin/src/android/config-plugins/withAndroidManifest.js.map +1 -0
  30. package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts +7 -0
  31. package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts.map +1 -0
  32. package/build/plugin/src/android/config-plugins/withAndroidModule.js +41 -0
  33. package/build/plugin/src/android/config-plugins/withAndroidModule.js.map +1 -0
  34. package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts +7 -0
  35. package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts.map +1 -0
  36. package/build/plugin/src/android/config-plugins/withAndroidResources.js +75 -0
  37. package/build/plugin/src/android/config-plugins/withAndroidResources.js.map +1 -0
  38. package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts +28 -0
  39. package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts.map +1 -0
  40. package/build/plugin/src/android/config-plugins/withAndroidTarget.js +28 -0
  41. package/build/plugin/src/android/config-plugins/withAndroidTarget.js.map +1 -0
  42. package/build/plugin/src/android/config-plugins/withGradleModule.d.ts +7 -0
  43. package/build/plugin/src/android/config-plugins/withGradleModule.d.ts.map +1 -0
  44. package/build/plugin/src/android/config-plugins/withGradleModule.js +86 -0
  45. package/build/plugin/src/android/config-plugins/withGradleModule.js.map +1 -0
  46. package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts +7 -0
  47. package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts.map +1 -0
  48. package/build/plugin/src/android/config-plugins/withGradleSettings.js +23 -0
  49. package/build/plugin/src/android/config-plugins/withGradleSettings.js.map +1 -0
  50. package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts +7 -0
  51. package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts.map +1 -0
  52. package/build/plugin/src/android/withAndroidAppBuildGradle.js +31 -0
  53. package/build/plugin/src/android/withAndroidAppBuildGradle.js.map +1 -0
  54. package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts +3 -0
  55. package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts.map +1 -0
  56. package/build/plugin/src/android/withAndroidKotlinGradleProperty.js +24 -0
  57. package/build/plugin/src/android/withAndroidKotlinGradleProperty.js.map +1 -0
  58. package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts +3 -0
  59. package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts.map +1 -0
  60. package/build/plugin/src/android/withAndroidProjectKotlinVersion.js +27 -0
  61. package/build/plugin/src/android/withAndroidProjectKotlinVersion.js.map +1 -0
  62. package/build/plugin/src/android/withAndroidTarget.d.ts +10 -0
  63. package/build/plugin/src/android/withAndroidTarget.d.ts.map +1 -0
  64. package/build/plugin/src/android/withAndroidTarget.js +22 -0
  65. package/build/plugin/src/android/withAndroidTarget.js.map +1 -0
  66. package/build/plugin/src/android/withAndroidWidget.d.ts +13 -0
  67. package/build/plugin/src/android/withAndroidWidget.d.ts.map +1 -0
  68. package/build/plugin/src/android/withAndroidWidget.js +564 -0
  69. package/build/plugin/src/android/withAndroidWidget.js.map +1 -0
  70. package/build/plugin/src/config.d.ts +141 -0
  71. package/build/plugin/src/config.d.ts.map +1 -0
  72. package/build/plugin/src/config.js +54 -0
  73. package/build/plugin/src/config.js.map +1 -0
  74. package/build/plugin/src/index.d.ts +9 -0
  75. package/build/plugin/src/index.d.ts.map +1 -0
  76. package/build/plugin/src/index.js +11 -0
  77. package/build/plugin/src/index.js.map +1 -0
  78. package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts +11 -0
  79. package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts.map +1 -0
  80. package/build/plugin/src/ios/config-plugins/withEntitlements.js +49 -0
  81. package/build/plugin/src/ios/config-plugins/withEntitlements.js.map +1 -0
  82. package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts +17 -0
  83. package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
  84. package/build/plugin/src/ios/config-plugins/withIOSTarget.js +152 -0
  85. package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -0
  86. package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts +8 -0
  87. package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts.map +1 -0
  88. package/build/plugin/src/ios/config-plugins/withIosColorset.js +25 -0
  89. package/build/plugin/src/ios/config-plugins/withIosColorset.js.map +1 -0
  90. package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts +8 -0
  91. package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
  92. package/build/plugin/src/ios/config-plugins/withIosStickerPack.js +52 -0
  93. package/build/plugin/src/ios/config-plugins/withIosStickerPack.js.map +1 -0
  94. package/build/plugin/src/ios/config-plugins/withPodfile.d.ts +12 -0
  95. package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -0
  96. package/build/plugin/src/ios/config-plugins/withPodfile.js +162 -0
  97. package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -0
  98. package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts +15 -0
  99. package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
  100. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +646 -0
  101. package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -0
  102. package/build/plugin/src/ios/target.d.ts +41 -0
  103. package/build/plugin/src/ios/target.d.ts.map +1 -0
  104. package/build/plugin/src/ios/target.js +574 -0
  105. package/build/plugin/src/ios/target.js.map +1 -0
  106. package/build/plugin/src/ios/utils/asset.d.ts +60 -0
  107. package/build/plugin/src/ios/utils/asset.d.ts.map +1 -0
  108. package/build/plugin/src/ios/utils/asset.js +375 -0
  109. package/build/plugin/src/ios/utils/asset.js.map +1 -0
  110. package/build/plugin/src/ios/utils/file.d.ts +33 -0
  111. package/build/plugin/src/ios/utils/file.d.ts.map +1 -0
  112. package/build/plugin/src/ios/utils/file.js +88 -0
  113. package/build/plugin/src/ios/utils/file.js.map +1 -0
  114. package/build/plugin/src/ios/utils/index.d.ts +12 -0
  115. package/build/plugin/src/ios/utils/index.d.ts.map +1 -0
  116. package/build/plugin/src/ios/utils/index.js +38 -0
  117. package/build/plugin/src/ios/utils/index.js.map +1 -0
  118. package/build/plugin/src/ios/utils/paths.d.ts +128 -0
  119. package/build/plugin/src/ios/utils/paths.d.ts.map +1 -0
  120. package/build/plugin/src/ios/utils/paths.js +141 -0
  121. package/build/plugin/src/ios/utils/paths.js.map +1 -0
  122. package/build/plugin/src/ios/utils/plist.d.ts +29 -0
  123. package/build/plugin/src/ios/utils/plist.d.ts.map +1 -0
  124. package/build/plugin/src/ios/utils/plist.js +114 -0
  125. package/build/plugin/src/ios/utils/plist.js.map +1 -0
  126. package/build/plugin/src/ios/utils/podfile.d.ts +82 -0
  127. package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -0
  128. package/build/plugin/src/ios/utils/podfile.js +408 -0
  129. package/build/plugin/src/ios/utils/podfile.js.map +1 -0
  130. package/build/plugin/src/ios/utils/reactNativeSwift.d.ts +11 -0
  131. package/build/plugin/src/ios/utils/reactNativeSwift.d.ts.map +1 -0
  132. package/build/plugin/src/ios/utils/reactNativeSwift.js +263 -0
  133. package/build/plugin/src/ios/utils/reactNativeSwift.js.map +1 -0
  134. package/build/plugin/src/ios/utils/xcode.d.ts +185 -0
  135. package/build/plugin/src/ios/utils/xcode.d.ts.map +1 -0
  136. package/build/plugin/src/ios/utils/xcode.js +706 -0
  137. package/build/plugin/src/ios/utils/xcode.js.map +1 -0
  138. package/build/plugin/src/logger.d.ts +10 -0
  139. package/build/plugin/src/logger.d.ts.map +1 -0
  140. package/build/plugin/src/logger.js +62 -0
  141. package/build/plugin/src/logger.js.map +1 -0
  142. package/build/plugin/src/parseTargetConfig.d.ts +3 -0
  143. package/build/plugin/src/parseTargetConfig.d.ts.map +1 -0
  144. package/build/plugin/src/parseTargetConfig.js +113 -0
  145. package/build/plugin/src/parseTargetConfig.js.map +1 -0
  146. package/build/plugin/src/withTargetsDir.d.ts +6 -0
  147. package/build/plugin/src/withTargetsDir.d.ts.map +1 -0
  148. package/build/plugin/src/withTargetsDir.js +90 -0
  149. package/build/plugin/src/withTargetsDir.js.map +1 -0
  150. package/build/src/Target.d.ts +43 -0
  151. package/build/src/Target.d.ts.map +1 -0
  152. package/build/src/Target.js +128 -0
  153. package/build/src/Target.js.map +1 -0
  154. package/build/src/index.d.ts +9 -0
  155. package/build/src/index.d.ts.map +1 -0
  156. package/build/src/index.js +27 -0
  157. package/build/src/index.js.map +1 -0
  158. package/build/src/modules/extension/index.d.ts +18 -0
  159. package/build/src/modules/extension/index.d.ts.map +1 -0
  160. package/build/src/modules/extension/index.js +44 -0
  161. package/build/src/modules/extension/index.js.map +1 -0
  162. package/build/src/modules/messages/index.d.ts +40 -0
  163. package/build/src/modules/messages/index.d.ts.map +1 -0
  164. package/build/src/modules/messages/index.js +94 -0
  165. package/build/src/modules/messages/index.js.map +1 -0
  166. package/build/src/modules/storage/index.d.ts +16 -0
  167. package/build/src/modules/storage/index.d.ts.map +1 -0
  168. package/build/src/modules/storage/index.js +122 -0
  169. package/build/src/modules/storage/index.js.map +1 -0
  170. package/expo-module.config.json +17 -0
  171. package/ios/ExpoTargetsExtension.podspec +23 -0
  172. package/ios/ExpoTargetsExtensionModule.swift +181 -0
  173. package/ios/ExpoTargetsMessages.podspec +23 -0
  174. package/ios/ExpoTargetsMessagesModule.swift +267 -0
  175. package/ios/ExpoTargetsStorage.podspec +23 -0
  176. package/ios/ExpoTargetsStorageModule.swift +91 -0
  177. package/ios/Tests/.swiftlint.yml +52 -0
  178. package/ios/Tests/Helpers/MockExtensionContext.swift +58 -0
  179. package/ios/Tests/Helpers/MockUserDefaults.swift +70 -0
  180. package/ios/Tests/Helpers/MockWidgetCenter.swift +71 -0
  181. package/ios/Tests/Helpers/TestHelpers.swift +90 -0
  182. package/ios/Tests/Integration/TargetIntegrationTests.swift +478 -0
  183. package/ios/Tests/Main/AllTests.swift +80 -0
  184. package/ios/Tests/Package.swift +66 -0
  185. package/ios/Tests/Performance/StoragePerformanceTests.swift +461 -0
  186. package/ios/Tests/Unit/Extension/ExpoTargetsExtensionModuleTests.swift +501 -0
  187. package/ios/Tests/Unit/Storage/ExpoTargetsStorageModuleTests.swift +578 -0
  188. package/ios/Tests/Unit/Template/ShareExtensionTemplateTests.swift +421 -0
  189. package/ios/Tests/XCTestPlan.xctestplan +87 -0
  190. package/metro/src/index.ts +1 -0
  191. package/metro/src/withTargetsMetro.ts +247 -0
  192. package/metro/tsconfig.build.json +9 -0
  193. package/package.json +74 -0
  194. package/plugin/src/android/withAndroidAppBuildGradle.ts +34 -0
  195. package/plugin/src/android/withAndroidTarget.ts +26 -0
  196. package/plugin/src/android/withAndroidWidget.ts +778 -0
  197. package/plugin/src/config.ts +255 -0
  198. package/plugin/src/index.ts +19 -0
  199. package/plugin/src/ios/config-plugins/withEntitlements.ts +69 -0
  200. package/plugin/src/ios/config-plugins/withIOSTarget.ts +179 -0
  201. package/plugin/src/ios/config-plugins/withIosColorset.ts +29 -0
  202. package/plugin/src/ios/config-plugins/withIosStickerPack.ts +65 -0
  203. package/plugin/src/ios/config-plugins/withPodfile.ts +238 -0
  204. package/plugin/src/ios/config-plugins/withXcodeChanges.ts +891 -0
  205. package/plugin/src/ios/target.ts +668 -0
  206. package/plugin/src/ios/templates/MessagesViewController.swift +120 -0
  207. package/plugin/src/ios/templates/ReactNativeViewController.swift +240 -0
  208. package/plugin/src/ios/templates/action-extension-data.swift +106 -0
  209. package/plugin/src/ios/templates/clip-extension-data.swift +28 -0
  210. package/plugin/src/ios/templates/messages-extension-data.swift +28 -0
  211. package/plugin/src/ios/templates/share-extension-data.swift +113 -0
  212. package/plugin/src/ios/utils/asset.ts +490 -0
  213. package/plugin/src/ios/utils/file.ts +80 -0
  214. package/plugin/src/ios/utils/index.ts +12 -0
  215. package/plugin/src/ios/utils/paths.ts +253 -0
  216. package/plugin/src/ios/utils/plist.ts +101 -0
  217. package/plugin/src/ios/utils/podfile.ts +534 -0
  218. package/plugin/src/ios/utils/reactNativeSwift.ts +283 -0
  219. package/plugin/src/ios/utils/xcode.ts +989 -0
  220. package/plugin/src/logger.ts +63 -0
  221. package/plugin/src/parseTargetConfig.ts +115 -0
  222. package/plugin/src/types/normalize-colors.d.ts +3 -0
  223. package/plugin/src/withTargetsDir.ts +120 -0
  224. package/plugin/tsconfig.build.json +9 -0
  225. package/plugin/tsconfig.json +9 -0
  226. package/src/Target.ts +239 -0
  227. package/src/index.ts +52 -0
  228. package/src/modules/extension/index.ts +54 -0
  229. package/src/modules/messages/index.ts +124 -0
  230. package/src/modules/storage/index.ts +126 -0
  231. package/tsconfig.json +8 -0
@@ -0,0 +1,778 @@
1
+ import {
2
+ ConfigPlugin,
3
+ AndroidConfig,
4
+ withAndroidManifest,
5
+ withDangerousMod,
6
+ withStringsXml,
7
+ withAppBuildGradle,
8
+ withProjectBuildGradle,
9
+ } from '@expo/config-plugins';
10
+ import * as fs from 'fs';
11
+ import * as path from 'path';
12
+
13
+ import type { TargetConfig, AndroidTargetConfig, Color } from '../config';
14
+
15
+ /**
16
+ * Sanitize widget name for Android resource names.
17
+ * Android resource names can only contain lowercase a-z, 0-9, or underscore.
18
+ */
19
+ function sanitizeResourceName(name: string): string {
20
+ return name.toLowerCase().replace(/[^a-z0-9_]/g, '_');
21
+ }
22
+
23
+ interface WidgetProps {
24
+ name: string;
25
+ displayName?: string;
26
+ type: string;
27
+ platforms: string[];
28
+ android?: AndroidTargetConfig;
29
+ directory: string;
30
+ }
31
+
32
+ export const withAndroidWidget: ConfigPlugin<WidgetProps> = (config, props) => {
33
+ const androidConfig = props.android || {};
34
+ const widgetType = androidConfig.widgetType || 'glance';
35
+
36
+ if (widgetType === 'glance') {
37
+ // 1. Add Compose Compiler Plugin to root build.gradle (required for Kotlin 2.0+)
38
+ config = withProjectBuildGradle(config, (buildGradleConfig) => {
39
+ addComposeCompilerPlugin(buildGradleConfig);
40
+ return buildGradleConfig;
41
+ });
42
+
43
+ // 2. Apply Compose plugin and configure in app build.gradle
44
+ config = withAppBuildGradle(config, (buildGradleConfig) => {
45
+ applyComposePlugin(buildGradleConfig);
46
+ enableComposeFeatures(buildGradleConfig);
47
+ addGlanceDependencies(buildGradleConfig);
48
+ addWidgetSourceSets(buildGradleConfig, config, props);
49
+ return buildGradleConfig;
50
+ });
51
+ } else {
52
+ // RemoteViews: Skip Compose, add minimal deps
53
+ config = withAppBuildGradle(config, (buildGradleConfig) => {
54
+ addRemoteViewsDependencies(buildGradleConfig);
55
+ addWidgetSourceSets(buildGradleConfig, config, props);
56
+ return buildGradleConfig;
57
+ });
58
+ }
59
+
60
+ // 3. Register ExpoTargetsReceiver in manifest (for refresh functionality)
61
+ config = withAndroidManifest(config, (manifestConfig) => {
62
+ const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(
63
+ manifestConfig.modResults
64
+ );
65
+ addExpoTargetsReceiver(mainApplication, config);
66
+ addWidgetReceiver(mainApplication, config, props);
67
+ return manifestConfig;
68
+ });
69
+
70
+ // 4. Add description string if provided
71
+ if (androidConfig?.description) {
72
+ const description = androidConfig.description;
73
+ config = withStringsXml(config, (stringsConfig) => {
74
+ stringsConfig.modResults = AndroidConfig.Strings.setStringItem(
75
+ [
76
+ {
77
+ $: {
78
+ name: `widget_${sanitizeResourceName(props.name)}_description`,
79
+ translatable: 'false',
80
+ },
81
+ _: description.replace(/'/g, "\\'"),
82
+ },
83
+ ],
84
+ stringsConfig.modResults
85
+ );
86
+ return stringsConfig;
87
+ });
88
+ }
89
+
90
+ // 5. Generate widget resources (XML, colors, default layout if needed)
91
+ config = withDangerousMod(config, [
92
+ 'android',
93
+ (dangerousConfig) => {
94
+ const platformRoot = dangerousConfig.modRequest.platformProjectRoot;
95
+ generateWidgetResources(platformRoot, config, props);
96
+ generateDefaultLayoutIfNeeded(platformRoot, props, androidConfig);
97
+ if (androidConfig.colors) {
98
+ generateColorResources(platformRoot, props, androidConfig.colors);
99
+ }
100
+ return dangerousConfig;
101
+ },
102
+ ]);
103
+
104
+ return config;
105
+ };
106
+
107
+ function addComposeCompilerPlugin(buildGradleConfig: any) {
108
+ const { modResults } = buildGradleConfig;
109
+ let contents = modResults.contents;
110
+
111
+ // Check if Compose Compiler Plugin already added
112
+ if (contents.includes('compose-compiler-gradle-plugin')) {
113
+ return;
114
+ }
115
+
116
+ // Find buildscript dependencies block and add Compose Compiler Plugin
117
+ const dependenciesMatch = contents.match(
118
+ /(dependencies\s*\{[^}]*classpath\([^)]*kotlin-gradle-plugin[^)]*\))/
119
+ );
120
+ if (dependenciesMatch) {
121
+ const composePlugin = `\n classpath('org.jetbrains.kotlin:compose-compiler-gradle-plugin')`;
122
+ contents = contents.replace(
123
+ dependenciesMatch[1],
124
+ dependenciesMatch[1] + composePlugin
125
+ );
126
+ modResults.contents = contents;
127
+ }
128
+ }
129
+
130
+ function applyComposePlugin(buildGradleConfig: any) {
131
+ const { modResults } = buildGradleConfig;
132
+ let contents = modResults.contents;
133
+
134
+ // Check if Compose plugin already applied
135
+ if (contents.includes('org.jetbrains.kotlin.plugin.compose')) {
136
+ return;
137
+ }
138
+
139
+ // Find the kotlin.android plugin line and add compose plugin after it
140
+ const kotlinPluginMatch = contents.match(
141
+ /(apply plugin:\s*["']org\.jetbrains\.kotlin\.android["'])/
142
+ );
143
+ if (kotlinPluginMatch) {
144
+ contents = contents.replace(
145
+ kotlinPluginMatch[1],
146
+ `${kotlinPluginMatch[1]}\napply plugin: "org.jetbrains.kotlin.plugin.compose"`
147
+ );
148
+ modResults.contents = contents;
149
+ }
150
+ }
151
+
152
+ function addExpoTargetsReceiver(mainApplication: any, config: any) {
153
+ const packageName = config.android?.package;
154
+ if (!packageName)
155
+ throw new Error('Android package name not found in app.json');
156
+
157
+ mainApplication.receiver = mainApplication.receiver || [];
158
+
159
+ const receiverName = 'expo.modules.targets.ExpoTargetsReceiver';
160
+ const alreadyAdded = mainApplication.receiver.some(
161
+ (r: any) => r.$['android:name'] === receiverName
162
+ );
163
+
164
+ if (alreadyAdded) return;
165
+
166
+ mainApplication.receiver.push({
167
+ $: {
168
+ 'android:name': receiverName,
169
+ 'android:exported': 'false',
170
+ },
171
+ 'intent-filter': [
172
+ {
173
+ action: [
174
+ { $: { 'android:name': 'expo.modules.targets.WIDGET_EVENT' } },
175
+ ],
176
+ },
177
+ ],
178
+ });
179
+ }
180
+
181
+ function enableComposeFeatures(buildGradleConfig: any) {
182
+ const { modResults } = buildGradleConfig;
183
+ let contents = modResults.contents;
184
+
185
+ // Check if Compose already enabled
186
+ if (contents.includes('buildFeatures') && contents.includes('compose')) {
187
+ return;
188
+ }
189
+
190
+ // Find android block and add buildFeatures
191
+ // With Kotlin 2.0+, we use the Compose Compiler Plugin, so no composeOptions needed
192
+ const androidBlockMatch = contents.match(/(android\s*\{[\s\S]*?)(^\})/m);
193
+ if (androidBlockMatch) {
194
+ const buildFeaturesBlock = `
195
+ buildFeatures {
196
+ compose true
197
+ }
198
+
199
+ kotlin {
200
+ jvmToolchain(17)
201
+ }
202
+ `;
203
+ // Insert before the closing brace of android block
204
+ contents = contents.replace(
205
+ androidBlockMatch[0],
206
+ androidBlockMatch[1] + buildFeaturesBlock + '\n}'
207
+ );
208
+ modResults.contents = contents;
209
+ }
210
+ }
211
+
212
+ function addGlanceDependencies(buildGradleConfig: any) {
213
+ const { modResults } = buildGradleConfig;
214
+ let contents = modResults.contents;
215
+
216
+ // Check if Glance dependencies already added
217
+ if (contents.includes('androidx.glance:glance-appwidget')) {
218
+ return;
219
+ }
220
+
221
+ // Find dependencies block and add Compose BOM + Glance dependencies
222
+ const dependenciesMatch = contents.match(/dependencies\s*\{/);
223
+ if (dependenciesMatch) {
224
+ const glanceDeps = `
225
+ // Compose BOM - ensures all Compose libraries are compatible
226
+ // Using latest stable BOM which is tested with Kotlin 2.1.x
227
+ def composeBom = platform('androidx.compose:compose-bom:2025.01.00')
228
+ implementation composeBom
229
+ androidTestImplementation composeBom
230
+
231
+ // Compose dependencies (versions managed by BOM)
232
+ implementation 'androidx.compose.ui:ui'
233
+ implementation 'androidx.compose.runtime:runtime'
234
+ implementation 'androidx.compose.foundation:foundation'
235
+ implementation 'androidx.compose.material3:material3'
236
+
237
+ // Glance dependencies for widgets (added by expo-targets)
238
+ // Using latest stable 1.1.1 which works with Compose BOM
239
+ implementation 'androidx.glance:glance-appwidget:1.1.1'
240
+ implementation 'androidx.glance:glance-material3:1.1.1'
241
+
242
+ // Kotlinx serialization
243
+ implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'`;
244
+
245
+ contents = contents.replace(/(dependencies\s*\{)/, `$1${glanceDeps}`);
246
+
247
+ modResults.contents = contents;
248
+ }
249
+ }
250
+
251
+ function addRemoteViewsDependencies(buildGradleConfig: any) {
252
+ const { modResults } = buildGradleConfig;
253
+ let contents = modResults.contents;
254
+
255
+ // Check if RemoteViews dependencies already added
256
+ if (contents.includes('expo-targets-remoteviews')) {
257
+ return;
258
+ }
259
+
260
+ // Find dependencies block and add minimal dependencies for RemoteViews widgets
261
+ const dependenciesMatch = contents.match(/dependencies\s*\{/);
262
+ if (dependenciesMatch) {
263
+ const remoteViewsDeps = `
264
+ // RemoteViews widget support (added by expo-targets)
265
+ implementation 'androidx.appcompat:appcompat:1.6.1'
266
+ implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'
267
+ // expo-targets-remoteviews marker`;
268
+
269
+ contents = contents.replace(/(dependencies\s*\{)/, `$1${remoteViewsDeps}`);
270
+
271
+ modResults.contents = contents;
272
+ }
273
+ }
274
+
275
+ function addWidgetReceiver(
276
+ mainApplication: any,
277
+ config: any,
278
+ props: WidgetProps
279
+ ) {
280
+ const packageName = config.android?.package;
281
+ if (!packageName)
282
+ throw new Error('Android package name not found in app.json');
283
+
284
+ const widgetType = props.android?.widgetType || 'glance';
285
+ const widgetNameLower = sanitizeResourceName(props.name);
286
+ const widgetNamePascal =
287
+ props.name.charAt(0).toUpperCase() +
288
+ props.name
289
+ .slice(1)
290
+ .replace(/[-_]([a-z])/g, (_, letter) => letter.toUpperCase());
291
+
292
+ if (widgetType === 'remoteviews') {
293
+ // Register AppWidgetProvider (user's class)
294
+ const providerClassName = `${packageName}.widget.${widgetNameLower}.${widgetNamePascal}Provider`;
295
+ registerAppWidgetProvider(mainApplication, providerClassName, props);
296
+ } else {
297
+ // Existing Glance registration
298
+ registerGlanceReceiver(
299
+ mainApplication,
300
+ packageName,
301
+ props,
302
+ widgetNameLower,
303
+ widgetNamePascal
304
+ );
305
+ registerUpdateReceiver(
306
+ mainApplication,
307
+ packageName,
308
+ props,
309
+ widgetNameLower,
310
+ widgetNamePascal
311
+ );
312
+ }
313
+ }
314
+
315
+ function registerGlanceReceiver(
316
+ mainApplication: any,
317
+ packageName: string,
318
+ props: WidgetProps,
319
+ widgetNameLower: string,
320
+ widgetNamePascal: string
321
+ ) {
322
+ mainApplication.receiver = mainApplication.receiver || [];
323
+
324
+ // Widget receiver class name pattern: {package}.widget.{widgetname}.{WidgetName}WidgetReceiver
325
+ // Users should follow the convention: package {package}.widget.{widgetname}
326
+ // with class {WidgetName}WidgetReceiver extending GlanceAppWidgetReceiver
327
+ const widgetClassName = `${packageName}.widget.${widgetNameLower}.${widgetNamePascal}WidgetReceiver`;
328
+
329
+ const alreadyAdded = mainApplication.receiver.some(
330
+ (r: any) => r.$['android:name'] === widgetClassName
331
+ );
332
+
333
+ if (alreadyAdded) return;
334
+
335
+ mainApplication.receiver.push({
336
+ $: {
337
+ 'android:name': widgetClassName,
338
+ 'android:exported': 'true',
339
+ 'android:label': props.displayName || props.name,
340
+ },
341
+ 'intent-filter': [
342
+ {
343
+ action: [
344
+ {
345
+ $: { 'android:name': 'android.appwidget.action.APPWIDGET_UPDATE' },
346
+ },
347
+ ],
348
+ },
349
+ ],
350
+ 'meta-data': [
351
+ {
352
+ $: {
353
+ 'android:name': 'android.appwidget.provider',
354
+ 'android:resource': `@xml/widgetprovider_${widgetNameLower}`,
355
+ },
356
+ },
357
+ ],
358
+ });
359
+ }
360
+
361
+ function registerUpdateReceiver(
362
+ mainApplication: any,
363
+ packageName: string,
364
+ props: WidgetProps,
365
+ widgetNameLower: string,
366
+ widgetNamePascal: string
367
+ ) {
368
+ mainApplication.receiver = mainApplication.receiver || [];
369
+
370
+ // Also register the UpdateReceiver for direct Glance updates
371
+ // Pattern: {package}.widget.{widgetname}.{WidgetName}UpdateReceiver
372
+ const updateReceiverClassName = `${packageName}.widget.${widgetNameLower}.${widgetNamePascal}UpdateReceiver`;
373
+
374
+ const updateReceiverAdded = mainApplication.receiver.some(
375
+ (r: any) => r.$['android:name'] === updateReceiverClassName
376
+ );
377
+
378
+ if (!updateReceiverAdded) {
379
+ mainApplication.receiver.push({
380
+ $: {
381
+ 'android:name': updateReceiverClassName,
382
+ 'android:exported': 'false',
383
+ },
384
+ 'intent-filter': [
385
+ {
386
+ action: [
387
+ {
388
+ $: { 'android:name': 'expo.modules.targets.UPDATE_WIDGET' },
389
+ },
390
+ ],
391
+ },
392
+ ],
393
+ });
394
+ }
395
+ }
396
+
397
+ function registerAppWidgetProvider(
398
+ mainApplication: any,
399
+ providerClassName: string,
400
+ props: WidgetProps
401
+ ) {
402
+ mainApplication.receiver = mainApplication.receiver || [];
403
+
404
+ const widgetNameLower = sanitizeResourceName(props.name);
405
+ const alreadyAdded = mainApplication.receiver.some(
406
+ (r: any) => r.$['android:name'] === providerClassName
407
+ );
408
+
409
+ if (alreadyAdded) return;
410
+
411
+ mainApplication.receiver.push({
412
+ $: {
413
+ 'android:name': providerClassName,
414
+ 'android:exported': 'true',
415
+ 'android:label': props.displayName || props.name,
416
+ },
417
+ 'intent-filter': [
418
+ {
419
+ action: [
420
+ {
421
+ $: { 'android:name': 'android.appwidget.action.APPWIDGET_UPDATE' },
422
+ },
423
+ // Add expo-targets refresh action so provider can receive update broadcasts
424
+ {
425
+ $: { 'android:name': 'expo.modules.targets.WIDGET_EVENT' },
426
+ },
427
+ ],
428
+ },
429
+ ],
430
+ 'meta-data': [
431
+ {
432
+ $: {
433
+ 'android:name': 'android.appwidget.provider',
434
+ 'android:resource': `@xml/widgetprovider_${widgetNameLower}`,
435
+ },
436
+ },
437
+ ],
438
+ });
439
+ }
440
+
441
+ function addWidgetSourceSets(
442
+ buildGradleConfig: any,
443
+ config: any,
444
+ props: WidgetProps
445
+ ) {
446
+ const projectRoot = config._internal?.projectRoot || process.cwd();
447
+ const widgetAndroidDir = path.join(projectRoot, props.directory, 'android');
448
+
449
+ // Only add sourceSets if widget android directory exists
450
+ if (!fs.existsSync(widgetAndroidDir)) {
451
+ return;
452
+ }
453
+
454
+ const { modResults } = buildGradleConfig;
455
+ let contents = modResults.contents;
456
+
457
+ // Calculate relative path from app/build.gradle to widget directory
458
+ // app/build.gradle is at android/app/build.gradle
459
+ // widget is at targets/{name}/android
460
+ // Relative path: ../../targets/{name}/android
461
+ // platformProjectRoot is typically {projectRoot}/android
462
+ const platformProjectRoot = path.join(projectRoot, 'android');
463
+ const relativePath = path
464
+ .relative(path.join(platformProjectRoot, 'app'), widgetAndroidDir)
465
+ .replace(/\\/g, '/');
466
+
467
+ // Check if sourceSets already exists
468
+ const sourceSetsRegex = /android\s*\{[^}]*sourceSets\s*\{/s;
469
+ const hasSourceSets = sourceSetsRegex.test(contents);
470
+
471
+ // Check if this widget's sourceSet is already added
472
+ const widgetSourceSetPattern = new RegExp(
473
+ `java\\.srcDirs\\s*\\+=\\s*\\['${relativePath.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}'\\]`,
474
+ 's'
475
+ );
476
+
477
+ if (widgetSourceSetPattern.test(contents)) {
478
+ return; // Already added
479
+ }
480
+
481
+ if (hasSourceSets) {
482
+ // Add to existing sourceSets block
483
+ const sourceSetsMatch = contents.match(
484
+ /sourceSets\s*\{[^}]*main\s*\{[^}]*\}/s
485
+ );
486
+ if (sourceSetsMatch) {
487
+ // Find the main block and add our sourceSets
488
+ const mainBlockMatch = contents.match(
489
+ /sourceSets\s*\{[^}]*main\s*\{([^}]*)\}/s
490
+ );
491
+ if (mainBlockMatch) {
492
+ const mainBlockContent = mainBlockMatch[1];
493
+ // Check if java.srcDirs already exists
494
+ if (mainBlockContent.includes('java.srcDirs')) {
495
+ // Append to existing java.srcDirs
496
+ contents = contents.replace(
497
+ /(sourceSets\s*\{[^}]*main\s*\{[^}]*java\.srcDirs\s*\+=\s*\[)([^\]]*)(\])/s,
498
+ (
499
+ match: string,
500
+ prefix: string,
501
+ existingDirs: string,
502
+ suffix: string
503
+ ) => {
504
+ // Check if our path is already in the array
505
+ if (existingDirs.includes(`'${relativePath}'`)) {
506
+ return match;
507
+ }
508
+ return `${prefix}${existingDirs}, '${relativePath}'${suffix}`;
509
+ }
510
+ );
511
+ } else {
512
+ // Add java.srcDirs block
513
+ contents = contents.replace(
514
+ /(sourceSets\s*\{[^}]*main\s*\{)([^}]*)(\})/s,
515
+ `$1$2 java.srcDirs += ['${relativePath}']\n res.srcDirs += ['${relativePath}/res']\n$3`
516
+ );
517
+ }
518
+
519
+ // Handle res.srcDirs similarly
520
+ // Add both res/ (for generated resources) and layouts/ (for user-provided layouts)
521
+ const layoutsPath = `${relativePath}/layouts`;
522
+ const resPath = `${relativePath}/res`;
523
+ const layoutsDir = path.join(
524
+ projectRoot,
525
+ props.directory,
526
+ 'android/layouts'
527
+ );
528
+ const hasUserLayouts = fs.existsSync(layoutsDir);
529
+
530
+ if (mainBlockContent.includes('res.srcDirs')) {
531
+ contents = contents.replace(
532
+ /(sourceSets\s*\{[^}]*main\s*\{[^}]*res\.srcDirs\s*\+=\s*\[)([^\]]*)(\])/s,
533
+ (
534
+ match: string,
535
+ prefix: string,
536
+ existingDirs: string,
537
+ suffix: string
538
+ ) => {
539
+ let updated = existingDirs;
540
+ // Add res/ if not present
541
+ if (!existingDirs.includes(`'${resPath}'`)) {
542
+ updated = updated ? `${updated}, '${resPath}'` : `'${resPath}'`;
543
+ }
544
+ // Add layouts/ if it exists and not already present
545
+ if (
546
+ hasUserLayouts &&
547
+ !existingDirs.includes(`'${layoutsPath}'`)
548
+ ) {
549
+ updated = updated
550
+ ? `${updated}, '${layoutsPath}'`
551
+ : `'${layoutsPath}'`;
552
+ }
553
+ if (updated === existingDirs) {
554
+ return match;
555
+ }
556
+ return `${prefix}${updated}${suffix}`;
557
+ }
558
+ );
559
+ } else if (!mainBlockContent.includes('res.srcDirs')) {
560
+ // Add res.srcDirs if java.srcDirs was just added
561
+ const resDirs = hasUserLayouts
562
+ ? `['${resPath}', '${layoutsPath}']`
563
+ : `['${resPath}']`;
564
+ contents = contents.replace(
565
+ /(java\.srcDirs\s*\+=\s*\[[^\]]*\])/,
566
+ `$1\n res.srcDirs += ${resDirs}`
567
+ );
568
+ }
569
+ }
570
+ }
571
+ } else {
572
+ // Create new sourceSets block
573
+ const androidBlockMatch = contents.match(/(android\s*\{)/);
574
+ if (androidBlockMatch) {
575
+ const layoutsDir = path.join(
576
+ projectRoot,
577
+ props.directory,
578
+ 'android/layouts'
579
+ );
580
+ const resDirs = fs.existsSync(layoutsDir)
581
+ ? `['${relativePath}/res', '${relativePath}/layouts']`
582
+ : `['${relativePath}/res']`;
583
+ contents = contents.replace(
584
+ /(android\s*\{)/,
585
+ `$1\n sourceSets {\n main {\n java.srcDirs += ['${relativePath}']\n res.srcDirs += ${resDirs}\n }\n }`
586
+ );
587
+ }
588
+ }
589
+
590
+ modResults.contents = contents;
591
+ }
592
+
593
+ function generateWidgetResources(
594
+ platformRoot: string,
595
+ config: any,
596
+ props: WidgetProps
597
+ ) {
598
+ const androidConfig = props.android || {};
599
+ // Generate in target's android/res directory (referenced via sourceSets)
600
+ const projectRoot = platformRoot.replace(/\/android$/, '');
601
+ const xmlDir = path.join(projectRoot, props.directory, 'android/res/xml');
602
+ fs.mkdirSync(xmlDir, { recursive: true });
603
+
604
+ // Extract configuration with defaults
605
+ const minWidth = androidConfig.minWidth || '180dp';
606
+ const minHeight = androidConfig.minHeight || '110dp';
607
+ const resizeMode = androidConfig.resizeMode || 'horizontal|vertical';
608
+ const updatePeriodMillis = androidConfig.updatePeriodMillis || 0;
609
+ const widgetCategory = androidConfig.widgetCategory || 'home_screen';
610
+ const layoutName =
611
+ androidConfig.initialLayout || `widget_${sanitizeResourceName(props.name)}`;
612
+
613
+ // Build XML with required attributes
614
+ let widgetInfo = `<?xml version="1.0" encoding="utf-8"?>
615
+ <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
616
+ android:minWidth="${minWidth}"
617
+ android:minHeight="${minHeight}"
618
+ android:resizeMode="${resizeMode}"
619
+ android:updatePeriodMillis="${updatePeriodMillis}"
620
+ android:widgetCategory="${widgetCategory}"
621
+ android:initialLayout="@layout/${layoutName}"`;
622
+
623
+ // Add preview image if configured
624
+ // Note: Glance widgets need static preview images since previewLayout doesn't work with Compose
625
+ if (androidConfig.previewImage) {
626
+ const previewImageName =
627
+ typeof androidConfig.previewImage === 'string'
628
+ ? androidConfig.previewImage
629
+ : `${sanitizeResourceName(props.name)}_preview`;
630
+ widgetInfo += `\n android:previewImage="@drawable/${previewImageName}"`;
631
+ }
632
+
633
+ if (androidConfig.description) {
634
+ widgetInfo += `\n android:description="@string/widget_${sanitizeResourceName(props.name)}_description"`;
635
+ }
636
+
637
+ if (androidConfig.maxResizeWidth) {
638
+ widgetInfo += `\n android:maxResizeWidth="${androidConfig.maxResizeWidth}"`;
639
+ }
640
+
641
+ if (androidConfig.maxResizeHeight) {
642
+ widgetInfo += `\n android:maxResizeHeight="${androidConfig.maxResizeHeight}"`;
643
+ }
644
+
645
+ if (androidConfig.targetCellWidth) {
646
+ widgetInfo += `\n android:targetCellWidth="${androidConfig.targetCellWidth}"`;
647
+ }
648
+
649
+ if (androidConfig.targetCellHeight) {
650
+ widgetInfo += `\n android:targetCellHeight="${androidConfig.targetCellHeight}"`;
651
+ }
652
+
653
+ widgetInfo += `>\n</appwidget-provider>`;
654
+
655
+ fs.writeFileSync(
656
+ path.join(xmlDir, `widgetprovider_${sanitizeResourceName(props.name)}.xml`),
657
+ widgetInfo
658
+ );
659
+ }
660
+
661
+ function generateDefaultLayoutIfNeeded(
662
+ platformRoot: string,
663
+ props: WidgetProps,
664
+ androidConfig: AndroidTargetConfig
665
+ ) {
666
+ // Only generate default layout if initialLayout is not specified
667
+ // (meaning user hasn't provided their own layout)
668
+ if (androidConfig.initialLayout) {
669
+ return; // User provided their own layout
670
+ }
671
+
672
+ const projectRoot = platformRoot.replace(/\/android$/, '');
673
+ const layoutName = `widget_${sanitizeResourceName(props.name)}`;
674
+
675
+ // Check if user has provided layout in layouts/ directory
676
+ const userLayoutsDir = path.join(
677
+ projectRoot,
678
+ props.directory,
679
+ 'android/layouts/layout'
680
+ );
681
+ const userLayoutPath = path.join(userLayoutsDir, `${layoutName}.xml`);
682
+
683
+ // If user has layout in layouts/, don't generate one in res/ and remove any existing one
684
+ if (fs.existsSync(userLayoutPath)) {
685
+ // User has layout in layouts/, remove any conflicting file in res/ to avoid duplicates
686
+ const targetLayoutDir = path.join(
687
+ projectRoot,
688
+ props.directory,
689
+ 'android/res/layout'
690
+ );
691
+ const conflictingLayoutPath = path.join(
692
+ targetLayoutDir,
693
+ `${layoutName}.xml`
694
+ );
695
+ if (fs.existsSync(conflictingLayoutPath)) {
696
+ fs.unlinkSync(conflictingLayoutPath);
697
+ }
698
+ return; // User has layout in layouts/, skip generating in res/
699
+ }
700
+
701
+ // Generate in target's android/res directory (referenced via sourceSets)
702
+ const targetLayoutDir = path.join(
703
+ projectRoot,
704
+ props.directory,
705
+ 'android/res/layout'
706
+ );
707
+ fs.mkdirSync(targetLayoutDir, { recursive: true });
708
+
709
+ const layoutPath = path.join(targetLayoutDir, `${layoutName}.xml`);
710
+
711
+ // Only create if it doesn't exist (user might have their own)
712
+ if (!fs.existsSync(layoutPath)) {
713
+ // Minimal layout required by Android for widget initialization
714
+ // This is just a placeholder - Glance widgets will replace it with Compose UI
715
+ const layoutContent = `<?xml version="1.0" encoding="utf-8"?>
716
+ <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
717
+ android:layout_width="match_parent"
718
+ android:layout_height="match_parent"
719
+ android:background="@android:color/transparent">
720
+ </FrameLayout>`;
721
+
722
+ fs.writeFileSync(layoutPath, layoutContent);
723
+ }
724
+ }
725
+
726
+ function generateColorResources(
727
+ platformRoot: string,
728
+ props: WidgetProps,
729
+ colors: Record<string, string | Color>
730
+ ) {
731
+ // Generate in target's android/res directory (referenced via sourceSets)
732
+ const projectRoot = platformRoot.replace(/\/android$/, '');
733
+ const targetResDir = path.join(projectRoot, props.directory, 'android/res');
734
+ const valuesDir = path.join(targetResDir, 'values');
735
+ const valuesNightDir = path.join(targetResDir, 'values-night');
736
+
737
+ fs.mkdirSync(valuesDir, { recursive: true });
738
+ fs.mkdirSync(valuesNightDir, { recursive: true });
739
+
740
+ const lightColors: string[] = [];
741
+ const darkColors: string[] = [];
742
+ const widgetPrefix = `${sanitizeResourceName(props.name)}_`;
743
+
744
+ // Prefix color names with widget name to avoid conflicts between widgets
745
+ Object.entries(colors).forEach(([name, value]) => {
746
+ const prefixedName = `${widgetPrefix}${name}`;
747
+ if (typeof value === 'string') {
748
+ lightColors.push(` <color name="${prefixedName}">${value}</color>`);
749
+ darkColors.push(` <color name="${prefixedName}">${value}</color>`);
750
+ } else if (value.light || value.dark) {
751
+ lightColors.push(
752
+ ` <color name="${prefixedName}">${value.light || '#000000'}</color>`
753
+ );
754
+ darkColors.push(
755
+ ` <color name="${prefixedName}">${value.dark || value.light || '#FFFFFF'}</color>`
756
+ );
757
+ }
758
+ });
759
+
760
+ const lightXml = `<?xml version="1.0" encoding="utf-8"?>
761
+ <resources>
762
+ ${lightColors.join('\n')}
763
+ </resources>`;
764
+
765
+ const darkXml = `<?xml version="1.0" encoding="utf-8"?>
766
+ <resources>
767
+ ${darkColors.join('\n')}
768
+ </resources>`;
769
+
770
+ fs.writeFileSync(
771
+ path.join(valuesDir, `colors_${sanitizeResourceName(props.name)}.xml`),
772
+ lightXml
773
+ );
774
+ fs.writeFileSync(
775
+ path.join(valuesNightDir, `colors_${sanitizeResourceName(props.name)}.xml`),
776
+ darkXml
777
+ );
778
+ }