solara 0.4.0 → 0.6.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 (60) hide show
  1. checksums.yaml +4 -4
  2. data/solara/lib/.DS_Store +0 -0
  3. data/solara/lib/core/.DS_Store +0 -0
  4. data/solara/lib/core/brands/brand_onboarder.rb +1 -1
  5. data/solara/lib/core/brands/brand_switcher.rb +92 -1
  6. data/solara/lib/core/dashboard/brand/BrandDetail.js +34 -2
  7. data/solara/lib/core/dashboard/brand/BrandDetailController.js +27 -234
  8. data/solara/lib/core/dashboard/brand/BrandDetailModel.js +14 -5
  9. data/solara/lib/core/dashboard/brand/BrandDetailView.js +16 -200
  10. data/solara/lib/core/dashboard/brand/SectionsFormManager.js +293 -0
  11. data/solara/lib/core/dashboard/brand/brand.html +223 -174
  12. data/solara/lib/core/dashboard/brand/source/BrandLocalSource.js +2 -5
  13. data/solara/lib/core/dashboard/brand/source/BrandRemoteSource.js +36 -133
  14. data/solara/lib/core/dashboard/brands/Brands.js +31 -0
  15. data/solara/lib/core/dashboard/brands/BrandsController.js +0 -5
  16. data/solara/lib/core/dashboard/brands/BrandsView.js +2 -2
  17. data/solara/lib/core/dashboard/brands/brands.html +71 -52
  18. data/solara/lib/core/dashboard/component/AliasesBottomSheet.js +6 -6
  19. data/solara/lib/core/dashboard/component/BrandOptionsBottomSheet.js +4 -4
  20. data/solara/lib/core/dashboard/component/ConfirmationDialog.js +15 -10
  21. data/solara/lib/core/dashboard/component/EditJsonSheet.js +160 -0
  22. data/solara/lib/core/dashboard/component/MessageBottomSheet.js +5 -5
  23. data/solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js +9 -3
  24. data/solara/lib/core/dashboard/handler/base_handler.rb +1 -0
  25. data/solara/lib/core/dashboard/handler/edit_section_handler.rb +1 -5
  26. data/solara/lib/core/dashboard/handler/onboard_brand_handler.rb +0 -15
  27. data/solara/lib/core/doctor/schema/brand_configurations.json +0 -8
  28. data/solara/lib/core/doctor/schema/platform/global/resources_manifest.json +30 -0
  29. data/solara/lib/core/doctor/schema/platform/json_manifest.json +39 -0
  30. data/solara/lib/core/doctor/validator/template/android_template_validation_config.yml +35 -1
  31. data/solara/lib/core/doctor/validator/template/flutter_template_validation_config.yml +30 -1
  32. data/solara/lib/core/doctor/validator/template/ios_template_validation_config.yml +35 -1
  33. data/solara/lib/core/doctor/validator/template/template_validator.rb +9 -9
  34. data/solara/lib/core/scripts/brand_config_manager.rb +1 -1
  35. data/solara/lib/core/scripts/brand_configurations_manager.rb +41 -0
  36. data/solara/lib/core/scripts/code_generator.rb +342 -118
  37. data/solara/lib/core/scripts/file_manager.rb +11 -15
  38. data/solara/lib/core/scripts/file_path.rb +21 -1
  39. data/solara/lib/core/scripts/gitignore_manager.rb +12 -6
  40. data/solara/lib/core/scripts/json_manifest_processor.rb +136 -0
  41. data/solara/lib/core/scripts/platform/ios/infoplist_string_catalog_manager.rb +11 -1
  42. data/solara/lib/core/scripts/resource_manifest_processor.rb +151 -0
  43. data/solara/lib/core/scripts/solara_status_manager.rb +1 -1
  44. data/solara/lib/core/scripts/theme_generator.rb +21 -242
  45. data/solara/lib/core/solara_configurator.rb +1 -1
  46. data/solara/lib/core/template/brands/global/resources_manifest.json +10 -0
  47. data/solara/lib/core/template/brands/json/Json-Manifest.md +59 -0
  48. data/solara/lib/core/template/brands/json/json_manifest.json +16 -0
  49. data/solara/lib/core/template/brands/shared/theme.json +213 -29
  50. data/solara/lib/core/template/config/android_template_config.json +50 -0
  51. data/solara/lib/core/template/config/flutter_template_config.json +35 -0
  52. data/solara/lib/core/template/config/ios_template_config.json +50 -0
  53. data/solara/lib/core/template/configurations.json +46 -0
  54. data/solara/lib/core/template/project_template_generator.rb +2 -0
  55. data/solara/lib/solara/version.rb +1 -1
  56. data/solara/lib/solara.rb +19 -0
  57. data/solara/lib/solara_manager.rb +21 -13
  58. metadata +13 -4
  59. data/solara/lib/core/dashboard/component/AddFieldSheet.js +0 -175
  60. data/solara/lib/core/dashboard/handler/brand_configurations_manager.rb +0 -73
@@ -64,6 +64,41 @@
64
64
  "source": "shared/brand_config.json",
65
65
  "target": "shared/brand_config.json",
66
66
  "condition": "true"
67
+ },
68
+ {
69
+ "source": "json/",
70
+ "target": "flutter/json/",
71
+ "condition": "true"
72
+ },
73
+ {
74
+ "source": "json/json_manifest.json",
75
+ "target": "flutter/json/",
76
+ "condition": "true"
77
+ },
78
+ {
79
+ "source": "json/Json-Manifest.md",
80
+ "target": "flutter/json/",
81
+ "condition": "true"
82
+ },
83
+ {
84
+ "source": "json/",
85
+ "target": "../../global/json",
86
+ "condition": "true"
87
+ },
88
+ {
89
+ "source": "json/json_manifest.json",
90
+ "target": "../../global/json",
91
+ "condition": "true"
92
+ },
93
+ {
94
+ "source": "json/Json-Manifest.md",
95
+ "target": "../../global/json",
96
+ "condition": "true"
97
+ },
98
+ {
99
+ "source": "global/resources_manifest.json",
100
+ "target": "../../global/resources_manifest.json",
101
+ "condition": "true"
67
102
  }
68
103
  ],
69
104
  "variables": {
@@ -59,6 +59,56 @@
59
59
  "source": "shared/brand_config.json",
60
60
  "target": "shared/brand_config.json",
61
61
  "condition": "true"
62
+ },
63
+ {
64
+ "source": "json/",
65
+ "target": "android/json/",
66
+ "condition": "true"
67
+ },
68
+ {
69
+ "source": "json/",
70
+ "target": "ios/json/",
71
+ "condition": "true"
72
+ },
73
+ {
74
+ "source": "json/json_manifest.json",
75
+ "target": "android/json/",
76
+ "condition": "true"
77
+ },
78
+ {
79
+ "source": "json/json_manifest.json",
80
+ "target": "ios/json/",
81
+ "condition": "true"
82
+ },
83
+ {
84
+ "source": "json/Json-Manifest.md",
85
+ "target": "android/json/",
86
+ "condition": "true"
87
+ },
88
+ {
89
+ "source": "json/Json-Manifest.md",
90
+ "target": "ios/json/",
91
+ "condition": "true"
92
+ },
93
+ {
94
+ "source": "json/",
95
+ "target": "../../global/json",
96
+ "condition": "true"
97
+ },
98
+ {
99
+ "source": "json/json_manifest.json",
100
+ "target": "../../global/json",
101
+ "condition": "true"
102
+ },
103
+ {
104
+ "source": "json/Json-Manifest.md",
105
+ "target": "../../global/json",
106
+ "condition": "true"
107
+ },
108
+ {
109
+ "source": "global/resources_manifest.json",
110
+ "target": "../../global/resources_manifest.json",
111
+ "condition": "true"
62
112
  }
63
113
  ],
64
114
  "variables": {
@@ -0,0 +1,46 @@
1
+ {
2
+ "configurations": [
3
+ {
4
+ "key": "brand_config.json",
5
+ "name": "Brand Configuration",
6
+ "filePath": "shared/brand_config.json",
7
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/shared/brand_config.json"
8
+ },
9
+ {
10
+ "key": "theme.json",
11
+ "name": "Theme Configuration",
12
+ "filePath": "shared/theme.json",
13
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/shared/theme.json"
14
+ },
15
+ {
16
+ "key": "android_config.json",
17
+ "name": "Android Configuration",
18
+ "filePath": "android/android_config.json",
19
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/android/android_config.json"
20
+ },
21
+ {
22
+ "key": "android_signing.json",
23
+ "name": "Android Signing",
24
+ "filePath": "android/android_signing.json",
25
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/android/android_signing.json"
26
+ },
27
+ {
28
+ "key": "ios_config.json",
29
+ "name": "iOS Configuration",
30
+ "filePath": "ios/ios_config.json",
31
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/ios/ios_config.json"
32
+ },
33
+ {
34
+ "key": "ios_signing.json",
35
+ "name": "iOS Signing",
36
+ "filePath": "ios/ios_signing.json",
37
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/ios/ios_signing.json"
38
+ },
39
+ {
40
+ "key": "InfoPlist.xcstrings",
41
+ "name": "InfoPlist.xcstrings",
42
+ "filePath": "ios/InfoPlist.xcstrings",
43
+ "url": "https://raw.githubusercontent.com/Solara-Kit/Solara/refs/heads/develop/solara/lib/core/template/brands/ios/InfoPlist.xcstrings"
44
+ }
45
+ ]
46
+ }
@@ -46,6 +46,8 @@ class ProjectTemplateGenerator
46
46
  end
47
47
  else
48
48
  FileUtils.mkdir_p(File.dirname(target))
49
+ return if File.exist?(target)
50
+
49
51
  if File.exist?(source) && copy_content
50
52
  FileUtils.cp(source, target)
51
53
  else
@@ -1,3 +1,3 @@
1
1
  module Solara
2
- VERSION = "0.4.0"
2
+ VERSION = "0.6.0"
3
3
  end
data/solara/lib/solara.rb CHANGED
@@ -153,6 +153,25 @@ module Solara
153
153
 
154
154
  end
155
155
 
156
+ desc "`sync", "Sync the changes of the current brand through switching."
157
+ def sync
158
+ check_project_health
159
+
160
+ current_brand = BrandsManager.instance.current_brand
161
+ unless current_brand
162
+ Solara.logger.fatal("Please switch a brand first in order to enable synchronization.")
163
+ exit 1
164
+ end
165
+ brand_key = current_brand['key']
166
+
167
+ begin
168
+ SolaraManager.new.switch(brand_key)
169
+ rescue Issue => e
170
+ Solara.logger.fatal("Switching to #{brand_key} failed.")
171
+ exit 1
172
+ end
173
+ end
174
+
156
175
  desc "dashboard -k YOUR_OPTIONAL_BRAND_KEY", "Open the dashboard for a brand if brank_key is provided."
157
176
  method_option :brand_key, :type => :string, :aliases => "-k"
158
177
  method_option :port, :type => :numeric, :aliases => "-p"
@@ -32,24 +32,32 @@ class SolaraManager
32
32
  end
33
33
 
34
34
  def onboard(brand_key, brand_name, init: false, clone_brand_key: nil, open_dashboard: true, success_message: nil)
35
- Solara.logger.header("Onboarding #{brand_key}")
35
+ begin
36
+ Solara.logger.header("Onboarding #{brand_key}")
36
37
 
37
- if !init && BrandsManager.instance.exists(brand_key)
38
- Solara.logger.fatal("Brand with key (#{brand_key}) already added to brands!")
39
- return
40
- end
38
+ if !init && BrandsManager.instance.exists(brand_key)
39
+ Solara.logger.fatal("Brand with key (#{brand_key}) already added to brands!")
40
+ return
41
+ end
42
+
43
+ BrandOnboarder.new(brand_key, brand_name, clone_brand_key: clone_brand_key).onboard
41
44
 
42
- BrandOnboarder.new(brand_key, brand_name, clone_brand_key: clone_brand_key).onboard
45
+ switch(brand_key, ignore_health_check: true)
43
46
 
44
- switch(brand_key, ignore_health_check: true)
45
47
 
46
- clone_message = clone_brand_key.nil? || clone_brand_key.empty? ? '.' : ", cloned from #{clone_brand_key}."
47
- message = success_message || "Onboarded #{brand_key} successfully#{clone_message}"
48
- Solara.logger.success(message)
48
+ clone_message = clone_brand_key.nil? || clone_brand_key.empty? ? '.' : ", cloned from #{clone_brand_key}."
49
+ message = success_message || "Onboarded #{brand_key} successfully#{clone_message}"
50
+ Solara.logger.success(message)
49
51
 
50
- if open_dashboard
51
- Solara.logger.success("Openning the dashboard for #{brand_key} to complete its details.")
52
- dashboard(brand_key)
52
+ if open_dashboard
53
+ Solara.logger.success("Openning the dashboard for #{brand_key} to complete its details.")
54
+ dashboard(brand_key)
55
+ end
56
+ rescue => e
57
+ # Rollback this brand
58
+ offboard(brand_key, confirm: false)
59
+ Solara.logger.debug("Performed rollback for (#{brand_key}).")
60
+ raise e
53
61
  end
54
62
  end
55
63
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Malek Kamel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-12 00:00:00.000000000 Z
11
+ date: 2024-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -176,6 +176,7 @@ files:
176
176
  - solara/lib/core/dashboard/brand/BrandDetailModel.js
177
177
  - solara/lib/core/dashboard/brand/BrandDetailView.js
178
178
  - solara/lib/core/dashboard/brand/InfoPlistStringCatalogManager.js
179
+ - solara/lib/core/dashboard/brand/SectionsFormManager.js
179
180
  - solara/lib/core/dashboard/brand/brand.html
180
181
  - solara/lib/core/dashboard/brand/source/BrandLocalSource.js
181
182
  - solara/lib/core/dashboard/brand/source/BrandRemoteSource.js
@@ -184,17 +185,16 @@ files:
184
185
  - solara/lib/core/dashboard/brands/BrandsModel.js
185
186
  - solara/lib/core/dashboard/brands/BrandsView.js
186
187
  - solara/lib/core/dashboard/brands/brands.html
187
- - solara/lib/core/dashboard/component/AddFieldSheet.js
188
188
  - solara/lib/core/dashboard/component/AliasesBottomSheet.js
189
189
  - solara/lib/core/dashboard/component/BrandOptionsBottomSheet.js
190
190
  - solara/lib/core/dashboard/component/ConfirmationDialog.js
191
+ - solara/lib/core/dashboard/component/EditJsonSheet.js
191
192
  - solara/lib/core/dashboard/component/MessageBottomSheet.js
192
193
  - solara/lib/core/dashboard/component/OnboardBrandBottomSheet.js
193
194
  - solara/lib/core/dashboard/dashboard_manager.rb
194
195
  - solara/lib/core/dashboard/dashboard_server.rb
195
196
  - solara/lib/core/dashboard/handler/base_handler.rb
196
197
  - solara/lib/core/dashboard/handler/brand_alisases_handler.rb
197
- - solara/lib/core/dashboard/handler/brand_configurations_manager.rb
198
198
  - solara/lib/core/dashboard/handler/brand_details_handler.rb
199
199
  - solara/lib/core/dashboard/handler/brand_icon_handler.rb
200
200
  - solara/lib/core/dashboard/handler/brands_handler.rb
@@ -221,9 +221,11 @@ files:
221
221
  - solara/lib/core/doctor/schema/brand_configurations.json
222
222
  - solara/lib/core/doctor/schema/platform/android/android_config.json
223
223
  - solara/lib/core/doctor/schema/platform/android/android_signing.json
224
+ - solara/lib/core/doctor/schema/platform/global/resources_manifest.json
224
225
  - solara/lib/core/doctor/schema/platform/ios/InfoPlist.xcstrings
225
226
  - solara/lib/core/doctor/schema/platform/ios/ios_config.json
226
227
  - solara/lib/core/doctor/schema/platform/ios/ios_signing.json
228
+ - solara/lib/core/doctor/schema/platform/json_manifest.json
227
229
  - solara/lib/core/doctor/schema/platform/shared/brand_config.json
228
230
  - solara/lib/core/doctor/schema/platform/shared/theme.json
229
231
  - solara/lib/core/doctor/validator/brand_settings_validator.rb
@@ -237,6 +239,7 @@ files:
237
239
  - solara/lib/core/doctor/validator/template/template_validator.rb
238
240
  - solara/lib/core/doctor/validator/validation_strategy.rb
239
241
  - solara/lib/core/scripts/brand_config_manager.rb
242
+ - solara/lib/core/scripts/brand_configurations_manager.rb
240
243
  - solara/lib/core/scripts/brand_exporter.rb
241
244
  - solara/lib/core/scripts/brand_importer.rb
242
245
  - solara/lib/core/scripts/brand_offboarder.rb
@@ -248,6 +251,7 @@ files:
248
251
  - solara/lib/core/scripts/folder_copier.rb
249
252
  - solara/lib/core/scripts/gitignore_manager.rb
250
253
  - solara/lib/core/scripts/interactive_file_system_validator.rb
254
+ - solara/lib/core/scripts/json_manifest_processor.rb
251
255
  - solara/lib/core/scripts/platform/android/android_manifest_switcher.rb
252
256
  - solara/lib/core/scripts/platform/android/android_strings_switcher.rb
253
257
  - solara/lib/core/scripts/platform/android/gradle_switcher.rb
@@ -261,6 +265,7 @@ files:
261
265
  - solara/lib/core/scripts/platform/ios/xcode_project_manager.rb
262
266
  - solara/lib/core/scripts/platform/ios/xcode_project_switcher.rb
263
267
  - solara/lib/core/scripts/project_settings_manager.rb
268
+ - solara/lib/core/scripts/resource_manifest_processor.rb
264
269
  - solara/lib/core/scripts/solara_logger.rb
265
270
  - solara/lib/core/scripts/solara_settings_manager.rb
266
271
  - solara/lib/core/scripts/solara_status_manager.rb
@@ -285,6 +290,7 @@ files:
285
290
  - solara/lib/core/template/brands/android/res/mipmap-xxxhdpi/ic_launcher_round.png
286
291
  - solara/lib/core/template/brands/android/res/values/strings.xml
287
292
  - solara/lib/core/template/brands/brands.json
293
+ - solara/lib/core/template/brands/global/resources_manifest.json
288
294
  - solara/lib/core/template/brands/ios/InfoPlist.xcstrings
289
295
  - solara/lib/core/template/brands/ios/ios_config.json
290
296
  - solara/lib/core/template/brands/ios/ios_signing.json
@@ -324,12 +330,15 @@ files:
324
330
  - solara/lib/core/template/brands/ios/xcassets/AppIcon.appiconset/88.png
325
331
  - solara/lib/core/template/brands/ios/xcassets/AppIcon.appiconset/92.png
326
332
  - solara/lib/core/template/brands/ios/xcassets/AppIcon.appiconset/Contents.json
333
+ - solara/lib/core/template/brands/json/Json-Manifest.md
334
+ - solara/lib/core/template/brands/json/json_manifest.json
327
335
  - solara/lib/core/template/brands/shared/.DS_Store
328
336
  - solara/lib/core/template/brands/shared/brand_config.json
329
337
  - solara/lib/core/template/brands/shared/theme.json
330
338
  - solara/lib/core/template/config/android_template_config.json
331
339
  - solara/lib/core/template/config/flutter_template_config.json
332
340
  - solara/lib/core/template/config/ios_template_config.json
341
+ - solara/lib/core/template/configurations.json
333
342
  - solara/lib/core/template/project_template_generator.rb
334
343
  - solara/lib/platform_detector.rb
335
344
  - solara/lib/solara.rb
@@ -1,175 +0,0 @@
1
- class AddFieldSheet extends HTMLElement {
2
- constructor() {
3
- super();
4
- this.onSubmit = null;
5
- this.inputType = null;
6
-
7
- this.attachShadow({mode: 'open'});
8
- this.render();
9
-
10
- this.addFieldSheet = this.shadowRoot.querySelector('#addFieldSheet');
11
- this.overlay = this.shadowRoot.getElementById('overlay');
12
-
13
- this.shadowRoot.querySelector('#addFieldForm').onsubmit = (e) => this.handleSubmit(e);
14
- this.shadowRoot.querySelector('#colorPicker').oninput = (e) => this.updateFieldValue(e);
15
- this.overlay.onclick = () => this.hideAddFieldForm();
16
- }
17
-
18
- render() {
19
- this.shadowRoot.innerHTML = `
20
- <style>
21
- .bottom-sheet {
22
- position: fixed;
23
- bottom: -100%;
24
- left: 0;
25
- right: 0;
26
- background-color: white;
27
- padding: 21px;
28
- box-shadow: 0 -3.5px 14px rgba(0, 0, 0, 0.2);
29
- transition: bottom 0.3s ease-out;
30
- z-index: 1000;
31
- border-top-left-radius: 17.5px;
32
- border-top-right-radius: 17.5px;
33
- height: 42vh;
34
- max-height: 350px;
35
- overflow-y: auto;
36
- max-width: 420px;
37
- margin: 0 auto;
38
- }
39
- .bottom-sheet.show {
40
- bottom: 0;
41
- }
42
- .bottom-sheet h3 {
43
- color: var(--primary-color);
44
- margin-top: 0;
45
- margin-bottom: 14px;
46
- font-size: 16.8px;
47
- }
48
- .overlay {
49
- display: none;
50
- position: fixed;
51
- top: 0;
52
- left: 0;
53
- right: 0;
54
- bottom: 0;
55
- background: rgba(0, 0, 0, 0.5);
56
- z-index: 999;
57
- }
58
- .show {
59
- display: block;
60
- }
61
- .form-group {
62
- margin-bottom: 14px;
63
- }
64
- .form-group label {
65
- display: block;
66
- margin-bottom: 5.6px;
67
- font-weight: bold;
68
- font-size: 11.2px;
69
- }
70
- .form-group input {
71
- width: 100%;
72
- padding: 8.4px;
73
- border: 1px solid var(--border-color);
74
- border-radius: 2.8px;
75
- font-size: 11.2px;
76
- }
77
- .add-field-button {
78
- width: 100%;
79
- padding: 10.5px;
80
- font-size: 12.6px;
81
- background-color: var(--primary-color);
82
- color: white;
83
- border: none;
84
- border-radius: 2.8px;
85
- cursor: pointer;
86
- transition: background-color 0.3s ease;
87
- }
88
- .add-field-button:hover {
89
- background-color: #3A7BC8;
90
- }
91
- .color-picker-container {
92
- display: none;
93
- margin-top: 7px;
94
- }
95
- #colorPicker {
96
- -webkit-appearance: none;
97
- border: none;
98
- width: 100%;
99
- height: 42px;
100
- cursor: pointer;
101
- border-radius: 2.8px;
102
- }
103
- #colorPicker::-webkit-color-swatch {
104
- border: none;
105
- border-radius: 2.8px;
106
- }
107
- </style>
108
-
109
- <div id="overlay" class="overlay"></div>
110
- <div class="bottom-sheet" id="addFieldSheet">
111
- <h3>Add New Field</h3>
112
- <form id="addFieldForm">
113
- <div class="form-group">
114
- <label for="fieldName">Field Name</label>
115
- <input type="text" id="fieldName" name="fieldName" required>
116
- </div>
117
- <div class="form-group">
118
- <label for="fieldValue">Field Value</label>
119
- <input type="text" id="fieldValue" name="fieldValue" required>
120
- <div class="color-picker-container">
121
- <input type="color" id="colorPicker" name="colorPicker">
122
- </div>
123
- </div>
124
- <button type="submit" class="add-field-button">Add Field</button>
125
- </form>
126
- </div>
127
- `;
128
- }
129
-
130
- show(inputType, onSubmit) {
131
- this.onSubmit = onSubmit;
132
- this.inputType = inputType;
133
- const fieldName = this.shadowRoot.querySelector('#fieldName');
134
- const fieldValue = this.shadowRoot.querySelector('#fieldValue');
135
- const colorPickerContainer = this.shadowRoot.querySelector('.color-picker-container');
136
-
137
- fieldName.value = '';
138
- fieldValue.value = '';
139
- colorPickerContainer.style.display = inputType === 'color' ? 'block' : 'none';
140
-
141
- this.addFieldSheet.style.display = 'block';
142
- this.overlay.classList.add('show');
143
- setTimeout(() => this.addFieldSheet.classList.add('show'), 10);
144
- }
145
-
146
- hideAddFieldForm() {
147
- this.addFieldSheet.classList.remove('show');
148
- this.overlay.classList.remove('show');
149
- setTimeout(() => {
150
- this.addFieldSheet.style.display = 'none';
151
- }, 300);
152
- }
153
-
154
- handleSubmit(e) {
155
- e.preventDefault();
156
- const fieldName = this.shadowRoot.querySelector('#fieldName').value;
157
- let defaultValue = this.shadowRoot.querySelector('#fieldValue').value;
158
-
159
- if (this.inputType === 'color' && !defaultValue.startsWith('#')) {
160
- defaultValue = '#' + defaultValue;
161
- }
162
-
163
- if (this.onSubmit) {
164
- this.onSubmit(fieldName, defaultValue);
165
- }
166
- this.hideAddFieldForm();
167
- }
168
-
169
- updateFieldValue(event) {
170
- const fieldValue = this.shadowRoot.querySelector('#fieldValue');
171
- fieldValue.value = event.target.value;
172
- }
173
- }
174
-
175
- customElements.define('add-field-sheet', AddFieldSheet);
@@ -1,73 +0,0 @@
1
- class BrandConfigurationsManager
2
-
3
- def initialize(brand_key)
4
- @brand_key = brand_key
5
- end
6
-
7
- def template_with_key(key)
8
- templates.select { |section| section[:key] === key }.first
9
- end
10
-
11
- def templates
12
- [
13
- {
14
- key: 'brand_config.json',
15
- name: 'Brand Configuration',
16
- input_type: 'text',
17
- path: FilePath.brand_config(@brand_key)
18
- },
19
- {
20
- key: 'theme.json',
21
- name: 'Theme Configuration',
22
- input_type: 'color',
23
- path: FilePath.brand_theme(@brand_key)
24
- },
25
- {
26
- key: 'android_config.json',
27
- name: 'Android Configuration',
28
- input_type: 'text',
29
- path: FilePath.android_brand_config(@brand_key)
30
- },
31
- {
32
- key: 'android_signing.json',
33
- name: 'Android Signing',
34
- input_type: 'text',
35
- path: FilePath.brand_signing(@brand_key, Platform::Android)
36
- },
37
- {
38
- key: 'ios_config.json',
39
- name: 'iOS Configuration',
40
- input_type: 'text',
41
- path: FilePath.ios_config(@brand_key)
42
- },
43
- {
44
- key: 'ios_signing.json',
45
- name: 'iOS Signing',
46
- input_type: 'text',
47
- path: FilePath.brand_signing(@brand_key, Platform::IOS)
48
- }
49
- ]
50
- end
51
-
52
- def create
53
- config_templates = templates
54
-
55
- config_templates.map do |template|
56
- create_config_item(
57
- template[:key],
58
- template[:name],
59
- template[:input_type],
60
- template[:path].tap { |p| File.expand_path(p) }
61
- )
62
- end
63
- end
64
-
65
- def create_config_item(key, name, input_type, path)
66
- {
67
- key: key,
68
- name: name,
69
- inputType: input_type,
70
- content: JSON.parse(File.read(path)),
71
- }
72
- end
73
- end