react-native-persona 2.2.0 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +149 -2
  3. package/RNPersonaInquiry2.podspec +1 -1
  4. package/android/build.gradle +1 -2
  5. package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +8 -2
  6. package/bin/persona-tool +1 -2
  7. package/ios/PersonaInquiry2.swift +4 -0
  8. package/lib/commonjs/index.js +66 -4
  9. package/lib/commonjs/index.js.map +1 -1
  10. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +497 -0
  11. package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -0
  12. package/lib/commonjs/persona-tool/Config.js +95 -0
  13. package/lib/commonjs/persona-tool/Config.js.map +1 -0
  14. package/lib/commonjs/persona-tool/Theme.js +199 -0
  15. package/lib/commonjs/persona-tool/Theme.js.map +1 -0
  16. package/lib/commonjs/persona-tool/index.js +41 -0
  17. package/lib/commonjs/persona-tool/index.js.map +1 -0
  18. package/lib/commonjs/persona-tool/prompts.js +48 -0
  19. package/lib/commonjs/persona-tool/prompts.js.map +1 -0
  20. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +99 -0
  21. package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  22. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +50 -0
  23. package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  24. package/lib/commonjs/versions.js +25 -0
  25. package/lib/commonjs/versions.js.map +1 -0
  26. package/lib/module/index.js +58 -3
  27. package/lib/module/index.js.map +1 -1
  28. package/lib/module/persona-tool/AndroidResourcePrinter.js +489 -0
  29. package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -0
  30. package/lib/module/persona-tool/Config.js +82 -0
  31. package/lib/module/persona-tool/Config.js.map +1 -0
  32. package/lib/module/persona-tool/Theme.js +183 -0
  33. package/lib/module/persona-tool/Theme.js.map +1 -0
  34. package/lib/module/persona-tool/index.js +33 -0
  35. package/lib/module/persona-tool/index.js.map +1 -0
  36. package/lib/module/persona-tool/prompts.js +31 -0
  37. package/lib/module/persona-tool/prompts.js.map +1 -0
  38. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +72 -0
  39. package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
  40. package/lib/module/persona-tool/tools/IosThemeInstructions.js +37 -0
  41. package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -0
  42. package/lib/module/versions.js +14 -0
  43. package/lib/module/versions.js.map +1 -0
  44. package/lib/typescript/{src/fields.d.ts → fields.d.ts} +0 -0
  45. package/lib/typescript/{src/index.d.ts → index.d.ts} +50 -0
  46. package/lib/typescript/{persona-tools/lib → persona-tool}/AndroidResourcePrinter.d.ts +2 -2
  47. package/lib/typescript/{persona-tools → persona-tool}/Config.d.ts +0 -0
  48. package/lib/typescript/{persona-tools → persona-tool}/Theme.d.ts +0 -0
  49. package/lib/typescript/{persona-tools → persona-tool}/index.d.ts +0 -0
  50. package/lib/typescript/{persona-tools/lib → persona-tool}/prompts.d.ts +1 -1
  51. package/lib/typescript/{persona-tools → persona-tool}/tools/AndroidThemeGenerator.d.ts +0 -0
  52. package/lib/typescript/{persona-tools → persona-tool}/tools/IosThemeInstructions.d.ts +0 -0
  53. package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
  54. package/lib/typescript/versions.d.ts +6 -0
  55. package/package.json +4 -5
  56. package/src/index.ts +65 -3
  57. package/{persona-tools/lib → src/persona-tool}/AndroidResourcePrinter.ts +182 -182
  58. package/{persona-tools → src/persona-tool}/Config.ts +0 -0
  59. package/{persona-tools → src/persona-tool}/Theme.ts +0 -0
  60. package/{persona-tools → src/persona-tool}/index.ts +1 -1
  61. package/{persona-tools/lib → src/persona-tool}/prompts.ts +11 -11
  62. package/{persona-tools → src/persona-tool}/tools/AndroidThemeGenerator.ts +2 -2
  63. package/{persona-tools → src/persona-tool}/tools/IosThemeInstructions.ts +1 -1
  64. package/src/versions.ts +12 -0
@@ -0,0 +1,497 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _xmlbuilder = require("xmlbuilder2");
9
+
10
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
+
12
+ class AndroidResourcePrinter {
13
+ constructor(theme) {
14
+ _defineProperty(this, "theme", void 0);
15
+
16
+ _defineProperty(this, "root", void 0);
17
+
18
+ _defineProperty(this, "buttonDrawable", void 0);
19
+
20
+ _defineProperty(this, "buttonColor", void 0);
21
+
22
+ _defineProperty(this, "preprintQueue", []);
23
+
24
+ _defineProperty(this, "printQueue", []);
25
+
26
+ _defineProperty(this, "postPrintQueue", []);
27
+
28
+ this.theme = theme;
29
+ this.root = (0, _xmlbuilder.create)({
30
+ version: '1.0'
31
+ }).ele('resources');
32
+ this.buttonDrawable = (0, _xmlbuilder.create)({
33
+ version: '1.0'
34
+ }).ele('selector', {
35
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
36
+ });
37
+ this.buttonColor = (0, _xmlbuilder.create)({
38
+ version: '1.0'
39
+ }).ele('selector', {
40
+ 'xmlns:android': 'http://schemas.android.com/apk/res/android'
41
+ });
42
+ }
43
+
44
+ process() {
45
+ if (!this.hasTheme()) {
46
+ this.root = this.root.up();
47
+ } else {
48
+ this.print();
49
+ }
50
+
51
+ return {
52
+ style: this.root,
53
+ buttonDrawable: this.buttonDrawable,
54
+ buttonColor: this.buttonColor
55
+ };
56
+ }
57
+
58
+ print() {
59
+ this.primaryColor();
60
+ this.accentColor();
61
+ this.darkPrimaryColor();
62
+ this.backgroundColor();
63
+ this.titleText();
64
+ this.bodyText();
65
+ this.footnoteText(); // this.formLabelText();
66
+
67
+ this.textField();
68
+ this.pickerText();
69
+ this.button();
70
+ this.progressColor();
71
+ this.successAsset();
72
+ this.failAsset();
73
+ this.loadingAnimationAsset();
74
+ this.selfieAnimationAsset();
75
+ this.preprintQueue.forEach(fn => fn()); // Precreate some style namespaces
76
+
77
+ this.root = this.root.ele('style', {
78
+ name: 'RN'
79
+ }).up();
80
+ this.root = this.root.ele('style', {
81
+ name: 'RN.Persona'
82
+ }).up();
83
+ this.root = this.root.ele('style', {
84
+ name: 'RN.Persona.Text'
85
+ }).up();
86
+ this.root = this.root.ele('style', {
87
+ name: 'Persona.Inquiry2.Theme',
88
+ parent: 'Base.Persona.Inquiry2.Theme'
89
+ });
90
+ this.printQueue.forEach(fn => fn());
91
+ this.root = this.root.up();
92
+ this.postPrintQueue.forEach(fn => fn());
93
+ }
94
+
95
+ hasTheme() {
96
+ return Object.keys(this.theme).length > 0 && Object.values(this.theme).filter(Boolean).length > 0;
97
+ }
98
+
99
+ primaryColor() {
100
+ if (!this.theme.primaryColor) return;
101
+ this.printQueue.push(() => {
102
+ this.root = this.root.ele('item', {
103
+ name: 'colorPrimary'
104
+ }).txt(this.theme.primaryColor).up().txt(' ');
105
+ });
106
+ }
107
+
108
+ accentColor() {
109
+ if (!this.theme.accentColor) return;
110
+ this.printQueue.push(() => {
111
+ this.root = this.root.ele('item', {
112
+ name: 'colorSecondary'
113
+ }).txt(this.theme.accentColor).up().txt(' ');
114
+ });
115
+ }
116
+
117
+ darkPrimaryColor() {
118
+ if (!this.theme.darkPrimaryColor) return;
119
+ this.printQueue.push(() => {
120
+ this.root = this.root.ele('item', {
121
+ name: 'colorPrimaryVariant'
122
+ }).txt(this.theme.darkPrimaryColor).up().txt(' ');
123
+ });
124
+ }
125
+
126
+ backgroundColor() {
127
+ if (!this.theme.backgroundColor) return;
128
+ this.preprintQueue.push(() => {
129
+ this.root = this.root.ele('color', {
130
+ name: 'customPersonaBackgroundColor'
131
+ }).txt(this.theme.backgroundColor).up().txt(' ');
132
+ });
133
+ this.printQueue.push(() => {
134
+ this.root = this.root.ele('item', {
135
+ name: 'android:colorBackground'
136
+ }).txt('@color/customPersonaBackgroundColor').up().txt(' ');
137
+ });
138
+ }
139
+
140
+ titleText() {
141
+ if (this.theme.titleTextColor || this.theme.titleTextFont) {
142
+ this.printQueue.push(() => {
143
+ this.root = this.root.ele('item', {
144
+ name: 'textAppearanceHeadline6'
145
+ }).txt('@style/RN.Persona.Text.Title').up();
146
+ }); // Create a text appearance
147
+
148
+ this.postPrintQueue.push(() => {
149
+ this.root = this.root.ele('style', {
150
+ name: 'RN.Persona.Text.Title',
151
+ parent: 'Persona.Inquiry2.Text.Body'
152
+ });
153
+
154
+ if (this.theme.titleTextColor) {
155
+ this.root = this.root.ele('item', {
156
+ name: 'android:textColor'
157
+ }).txt(this.theme.titleTextColor).up();
158
+ }
159
+
160
+ if (this.theme.titleTextFont) {
161
+ // TODO: Add notice about how to add a custom font that can be
162
+ // referenced here on Android
163
+ this.root = this.root.ele('item', {
164
+ name: 'android:fontFamily'
165
+ }).txt(this.theme.titleTextFont).up();
166
+ } // Default values taken from `Persona.Text.Title`
167
+ // in shared/src/main/res/values/styles.xml
168
+
169
+
170
+ this.root = this.root.ele('item', {
171
+ name: 'android:textSize'
172
+ }).txt('26sp').up().ele('item', {
173
+ name: 'android:textStyle'
174
+ }).txt('bold').up();
175
+ this.root = this.root.up();
176
+ });
177
+ } else {
178
+ this.printQueue.push(() => {
179
+ this.root = this.root.ele('item', {
180
+ name: 'textAppearanceHeadline6'
181
+ }).txt('@style/Persona.Text.Title').up();
182
+ });
183
+ }
184
+ }
185
+
186
+ bodyText() {
187
+ if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
188
+ this.printQueue.push(() => {
189
+ this.root = this.root.ele('item', {
190
+ name: 'textAppearanceSubtitle1'
191
+ }).txt('@style/RN.Persona.Text.Body').up();
192
+ }); // Create a text appearance
193
+
194
+ this.postPrintQueue.push(() => {
195
+ this.root = this.root.ele('style', {
196
+ name: 'RN.Persona.Text.Body',
197
+ parent: 'Persona.Inquiry2.Text.Body'
198
+ });
199
+
200
+ if (this.theme.bodyTextColor) {
201
+ this.root = this.root.ele('item', {
202
+ name: 'android:textColor'
203
+ }).txt(this.theme.bodyTextColor).up();
204
+ }
205
+
206
+ if (this.theme.bodyTextFont) {
207
+ // TODO: Add notice about how to add a custom font that can be
208
+ // referenced here on Android
209
+ this.root = this.root.ele('item', {
210
+ name: 'android:fontFamily'
211
+ }).txt(this.theme.bodyTextFont).up();
212
+ } // Default values taken from `Persona.Text.Body`
213
+ // in shared/src/main/res/values/styles.xml
214
+
215
+
216
+ this.root = this.root.ele('item', {
217
+ name: 'android:textSize'
218
+ }).txt('18sp').up();
219
+ this.root = this.root.up();
220
+ });
221
+ } else {
222
+ this.printQueue.push(() => {
223
+ this.root = this.root.ele('item', {
224
+ name: 'textAppearanceSubtitle1'
225
+ }).txt('@style/Persona.Inquiry2.Text.Body').up();
226
+ });
227
+ }
228
+ }
229
+
230
+ footnoteText() {
231
+ if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
232
+ this.postPrintQueue.push(() => {
233
+ var _this$theme$footnoteT;
234
+
235
+ this.root = this.root.ele('style', {
236
+ name: 'TextAppearance.AppCompat.Small'
237
+ }).ele('item', {
238
+ name: 'android:textSize'
239
+ }) // Used default value found in the Android SDK
240
+ .txt('@dimen/abc_text_size_small_material').up().ele('item', {
241
+ name: 'android:textColor'
242
+ }).txt( // Used default value found in the Android SDK
243
+ (_this$theme$footnoteT = this.theme.footnoteTextColor) !== null && _this$theme$footnoteT !== void 0 ? _this$theme$footnoteT : '?android:attr/textColorTertiary').up();
244
+
245
+ if (this.theme.footnoteTextFont) {
246
+ var _this$theme$footnoteT2;
247
+
248
+ this.root = this.root.ele('item', {
249
+ name: 'android:fontFamily'
250
+ }).txt( // Used default value found in the Android SDK
251
+ (_this$theme$footnoteT2 = this.theme.footnoteTextFont) !== null && _this$theme$footnoteT2 !== void 0 ? _this$theme$footnoteT2 : '?android:attr/textColorTertiary').up();
252
+ }
253
+
254
+ this.root = this.root.up();
255
+ });
256
+ }
257
+ }
258
+
259
+ textField() {
260
+ if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
261
+ this.printQueue.push(() => {
262
+ this.root = this.root.ele('item', {
263
+ name: 'editTextStyle'
264
+ }).txt('@style/RN.Persona.EditText').up();
265
+ });
266
+ this.postPrintQueue.push(() => {
267
+ this.root = this.root.ele('style', {
268
+ name: 'RN.Persona.EditText',
269
+ parent: 'Persona.Inquiry2.EditText'
270
+ }).ele('item', {
271
+ name: 'android:textAppearance'
272
+ }).txt('@style/RN.Persona.EditText.TextAppearance').up().ele('item', {
273
+ name: 'android:textColor'
274
+ }).txt(this.theme.textFieldTextColor).up().up();
275
+ this.root = this.root.ele('style', {
276
+ name: 'RN.Persona.EditText.TextAppearance',
277
+ parent: 'Base.TextAppearance.TextAppearance.MaterialComponents.Body1'
278
+ });
279
+
280
+ if (this.theme.textFieldTextColor) {
281
+ this.root = this.root.ele('item', {
282
+ name: 'android:textSize'
283
+ }).txt('18sp').up();
284
+ }
285
+
286
+ if (this.theme.textFieldTextFont) {
287
+ this.root = this.root.ele('item', {
288
+ name: 'android:fontFamily'
289
+ }).txt(this.theme.textFieldTextFont).up();
290
+ }
291
+
292
+ this.root = this.root.up();
293
+ });
294
+ }
295
+ }
296
+
297
+ pickerText() {
298
+ if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
299
+ this.printQueue.push(() => {
300
+ this.root = this.root.ele('item', {
301
+ name: 'spinnerStyle'
302
+ }).txt('@style/RN.Persona.Spinner').up();
303
+ this.root = this.root.ele('item', {
304
+ name: 'spinnerDropDownItemStyle'
305
+ }).txt('@style/RN.Persona.DropDownItem.Spinner').up();
306
+ });
307
+ this.postPrintQueue.push(() => {
308
+ var _this$theme$pickerTex, _this$theme$pickerTex2;
309
+
310
+ // Build Rn.Persona.Spinner
311
+ this.root = this.root.ele('style', {
312
+ name: 'RN.Persona.Spinner',
313
+ parent: 'Persona.Inquiry2.Spinner'
314
+ }).ele('item', {
315
+ name: 'android:textColor'
316
+ }).txt((_this$theme$pickerTex = this.theme.pickerTextColor) !== null && _this$theme$pickerTex !== void 0 ? _this$theme$pickerTex : '?android:attr/textColorPrimary').up().ele('item', {
317
+ name: 'android:textAppearance'
318
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.DropDownItem.Spinner
319
+
320
+ this.root = this.root.ele('style', {
321
+ name: 'RN.Persona.DropDownItem.Spinner',
322
+ parent: 'Persona.Inquiry2.Spinner'
323
+ }).ele('item', {
324
+ name: 'android:textColor'
325
+ }).txt((_this$theme$pickerTex2 = this.theme.pickerTextColor) !== null && _this$theme$pickerTex2 !== void 0 ? _this$theme$pickerTex2 : '?android:attr/textColorPrimary').up().ele('item', {
326
+ name: 'android:textAppearance'
327
+ }).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.Text.Spinner
328
+
329
+ this.root = this.root.ele('style', {
330
+ name: 'RN.Persona.Text.Spinner'
331
+ });
332
+
333
+ if (this.theme.pickerTextColor) {
334
+ this.root = this.root.ele('item', {
335
+ name: 'android:textColor'
336
+ }).txt(this.theme.pickerTextColor).up();
337
+ }
338
+
339
+ if (this.theme.pickerTextFont) {
340
+ // TODO: Add notice about how to add a custom font that can be
341
+ // referenced here on Android
342
+ this.root = this.root.ele('item', {
343
+ name: 'android:fontFamily'
344
+ }).txt(this.theme.pickerTextFont).up();
345
+ }
346
+
347
+ this.root = this.root.up();
348
+ });
349
+ }
350
+ }
351
+
352
+ button() {
353
+ if (this.theme.buttonBackgroundColor || this.theme.buttonDisabledBackgroundColor || this.theme.buttonTouchedBackgroundColor || this.theme.buttonTextColor || this.theme.buttonDisabledTextColor || this.theme.buttonCornerRadius || this.theme.buttonFont) {
354
+ this.printQueue.push(() => {
355
+ this.root = this.root.ele('item', {
356
+ name: 'buttonStyle'
357
+ }).txt('@style/RN.Persona.Button').up();
358
+ });
359
+ this.postPrintQueue.push(() => {
360
+ var _this$theme$buttonTou, _this$theme$buttonBac, _this$theme$buttonDis, _this$theme$buttonTex, _this$theme$buttonTex2;
361
+
362
+ this.root = this.root.ele('style', {
363
+ name: 'RN.Persona.Button',
364
+ parent: 'Persona.Inquiry2.Button'
365
+ }) // Taken from
366
+ // appcompat's res/values/values.xml
367
+ .ele('item', {
368
+ name: 'android:minHeight'
369
+ }).txt('48dip').up() // Taken from
370
+ // appcompat's res/values/values.xml
371
+ .ele('item', {
372
+ name: 'android:minWidth'
373
+ }).txt('88dip').up() // Taken from
374
+ // persona-android's shared/src/main/res/values/styles.xml
375
+ .ele('item', {
376
+ name: 'android:textSize'
377
+ }).txt('18sp').up().ele('item', {
378
+ name: 'android:background'
379
+ }).txt('@drawable/rn_persona_button').up().ele('item', {
380
+ name: 'android:textColor'
381
+ }).txt('@color/rn_persona_button').up().up(); // Disabled
382
+
383
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
384
+ 'android:state_enabled': 'false'
385
+ }).ele('shape', {
386
+ 'android:shape': 'rectangle'
387
+ }).ele('corners', {
388
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
389
+ }).up().ele('padding', {
390
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
391
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
392
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
393
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
394
+ }).up().ele('solid', {
395
+ 'android:color': this.theme.buttonDisabledBackgroundColor ? this.theme.buttonDisabledBackgroundColor : '?attr/colorPrimaryVariant'
396
+ }).up().up().up(); // touched
397
+
398
+ this.buttonDrawable = this.buttonDrawable.ele('item', {
399
+ 'android:state_pressed': 'true'
400
+ }).ele('shape', {
401
+ 'android:shape': 'rectangle'
402
+ }).ele('corners', {
403
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
404
+ }).up().ele('solid', {
405
+ 'android:color': (_this$theme$buttonTou = this.theme.buttonTouchedBackgroundColor) !== null && _this$theme$buttonTou !== void 0 ? _this$theme$buttonTou : '?attr/colorPrimaryVariant'
406
+ }).up().ele('padding', {
407
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
408
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
409
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
410
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
411
+ }).up().up().up();
412
+ this.buttonDrawable = this.buttonDrawable.ele('item').ele('shape', {
413
+ 'android:shape': 'rectangle'
414
+ }).ele('corners', {
415
+ 'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
416
+ }).up().ele('solid', {
417
+ 'android:color': (_this$theme$buttonBac = this.theme.buttonBackgroundColor) !== null && _this$theme$buttonBac !== void 0 ? _this$theme$buttonBac : '?attr/colorPrimary'
418
+ }).up().ele('padding', {
419
+ 'android:left': '@dimen/abc_button_padding_horizontal_material',
420
+ 'android:top': '@dimen/abc_button_padding_vertical_material',
421
+ 'android:right': '@dimen/abc_button_padding_horizontal_material',
422
+ 'android:bottom': '@dimen/abc_button_padding_vertical_material'
423
+ }).up().up().up(); // Finish button drawable
424
+
425
+ this.buttonDrawable = this.buttonDrawable.up();
426
+ this.buttonColor = this.buttonColor.ele('item', {
427
+ 'android:state_enabled': 'false',
428
+ 'android:color': (_this$theme$buttonDis = this.theme.buttonDisabledTextColor) !== null && _this$theme$buttonDis !== void 0 ? _this$theme$buttonDis : '@android:color/darker_gray'
429
+ }).up().ele('item', {
430
+ 'android:state_pressed': 'true',
431
+ 'android:color': (_this$theme$buttonTex = this.theme.buttonTextColor) !== null && _this$theme$buttonTex !== void 0 ? _this$theme$buttonTex : '@android:color/white'
432
+ }).up().ele('item', {
433
+ 'android:color': (_this$theme$buttonTex2 = this.theme.buttonTextColor) !== null && _this$theme$buttonTex2 !== void 0 ? _this$theme$buttonTex2 : '@android:color/white'
434
+ }).up();
435
+ this.buttonColor = this.buttonColor.up();
436
+ this.root = this.root.up();
437
+ });
438
+ }
439
+ }
440
+
441
+ progressColor() {
442
+ if (this.theme.progressColor) {
443
+ this.printQueue.push(() => {
444
+ this.root = this.root.ele('item', {
445
+ name: 'colorControlActivated'
446
+ }).txt(this.theme.progressColor).up();
447
+ });
448
+ }
449
+ }
450
+
451
+ successAsset() {
452
+ if (!this.theme.successAsset) return;
453
+ this.printQueue.push(() => {
454
+ this.root = this.root.ele('item', {
455
+ name: 'personaInquiryCompleteImage'
456
+ }).txt(this.theme.successAsset).up().txt(' ');
457
+ });
458
+ }
459
+
460
+ failAsset() {
461
+ if (!this.theme.failAsset) return;
462
+ this.printQueue.push(() => {
463
+ this.root = this.root.ele('item', {
464
+ name: 'personaInquiryFailImage'
465
+ }).txt(this.theme.failAsset).up().txt(' ');
466
+ });
467
+ }
468
+
469
+ loadingAnimationAsset() {
470
+ if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
471
+ this.printQueue.push(() => {
472
+ this.root = this.root.ele('item', {
473
+ name: 'personaInquiryLoadingLottieRaw'
474
+ }).txt(this.theme.loadingAnimationAsset).up().txt(' ');
475
+ this.root = this.root.ele('item', {
476
+ name: 'personaInquiryLoadingLottieWidthPercent'
477
+ }).txt(this.theme.loadingAnimationWidthPercent).up().txt(' ');
478
+ });
479
+ }
480
+
481
+ selfieAnimationAsset() {
482
+ if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent) return;
483
+ this.printQueue.push(() => {
484
+ this.root = this.root.ele('item', {
485
+ name: 'personaInquirySelfieLottieRaw'
486
+ }).txt(this.theme.selfieAnimationAsset).up().txt(' ');
487
+ this.root = this.root.ele('item', {
488
+ name: 'personaInquirySelfieLottieWidthPercent'
489
+ }).txt(this.theme.selfieAnimationWidthPercent).up().txt(' ');
490
+ });
491
+ }
492
+
493
+ }
494
+
495
+ var _default = AndroidResourcePrinter;
496
+ exports.default = _default;
497
+ //# sourceMappingURL=AndroidResourcePrinter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["AndroidResourcePrinter.ts"],"names":["AndroidResourcePrinter","constructor","theme","root","version","ele","buttonDrawable","buttonColor","process","hasTheme","up","print","style","primaryColor","accentColor","darkPrimaryColor","backgroundColor","titleText","bodyText","footnoteText","textField","pickerText","button","progressColor","successAsset","failAsset","loadingAnimationAsset","selfieAnimationAsset","preprintQueue","forEach","fn","name","parent","printQueue","postPrintQueue","Object","keys","length","values","filter","Boolean","push","txt","titleTextColor","titleTextFont","bodyTextColor","bodyTextFont","footnoteTextColor","footnoteTextFont","textFieldTextColor","textFieldTextFont","pickerTextColor","pickerTextFont","buttonBackgroundColor","buttonDisabledBackgroundColor","buttonTouchedBackgroundColor","buttonTextColor","buttonDisabledTextColor","buttonCornerRadius","buttonFont","loadingAnimationWidthPercent","selfieAnimationWidthPercent"],"mappings":";;;;;;;AAAA;;;;AAIA,MAAMA,sBAAN,CAA6B;AAS3BC,EAAAA,WAAW,CAACC,KAAD,EAA4B;AAAA;;AAAA;;AAAA;;AAAA;;AAAA,2CAJP,EAIO;;AAAA,wCAHV,EAGU;;AAAA,4CAFN,EAEM;;AACrC,SAAKA,KAAL,GAAaA,KAAb;AACA,SAAKC,IAAL,GAAY,wBAAU;AAAEC,MAAAA,OAAO,EAAE;AAAX,KAAV,EAA8BC,GAA9B,CAAkC,WAAlC,CAAZ;AACA,SAAKC,cAAL,GAAsB,wBAAU;AAAEF,MAAAA,OAAO,EAAE;AAAX,KAAV,EAA8BC,GAA9B,CAAkC,UAAlC,EAA8C;AAClE,uBAAiB;AADiD,KAA9C,CAAtB;AAGA,SAAKE,WAAL,GAAmB,wBAAU;AAAEH,MAAAA,OAAO,EAAE;AAAX,KAAV,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AAE0B,QAAAA,IAAI,EAAE;AAAR,OADH,EAETW,GAFS,CAEL,KAAKxC,KAAL,CAAWwB,qBAFN,EAGThB,EAHS,GAITgC,GAJS,CAIL,GAJK,CAAZ;AAMA,WAAKvC,IAAL,GAAY,KAAKA,IAAL,CACTE,GADS,CACL,MADK,EACG;AAAE0B,QAAAA,IAAI,EAAE;AAAR,OADH,EAETW,GAFS,CAEL,KAAKxC,KAAL,CAAW0D,4BAFN,EAGTlD,EAHS,GAITgC,GAJS,CAIL,GAJK,CAAZ;AAKD,KAZD;AAaD;;AAEOf,EAAAA,oBAAoB,GAAG;AAC7B,QACE,CAAC,KAAKzB,KAAL,CAAWyB,oBAAZ,IACA,CAAC,KAAKzB,KAAL,CAAW2D,2BAFd,EAIE;AAEF,SAAK5B,UAAL,CAAgBQ,IAAhB,CAAqB,MAAM;AACzB,WAAKtC,IAAL,GAAY,KAAKA,IAAL,CACTE,GADS,CACL,MADK,EACG;AAAE0B,QAAAA,IAAI,EAAE;AAAR,OADH,EAETW,GAFS,CAEL,KAAKxC,KAAL,CAAWyB,oBAFN,EAGTjB,EAHS,GAITgC,GAJS,CAIL,GAJK,CAAZ;AAMA,WAAKvC,IAAL,GAAY,KAAKA,IAAL,CACTE,GADS,CACL,MADK,EACG;AAAE0B,QAAAA,IAAI,EAAE;AAAR,OADH,EAETW,GAFS,CAEL,KAAKxC,KAAL,CAAW2D,2BAFN,EAGTnD,EAHS,GAITgC,GAJS,CAIL,GAJK,CAAZ;AAKD,KAZD;AAaD;;AApoB0B;;eAuoBd1C,sB","sourcesContent":["import { create as createXml } from 'xmlbuilder2';\nimport type { AndroidThemeObject } from './Theme';\nimport type { XMLBuilder } from 'xmlbuilder2/lib/interfaces';\n\nclass AndroidResourcePrinter {\n theme: AndroidThemeObject;\n root: XMLBuilder;\n buttonDrawable: XMLBuilder;\n buttonColor: XMLBuilder;\n preprintQueue: (() => void)[] = [];\n printQueue: (() => void)[] = [];\n postPrintQueue: (() => void)[] = [];\n\n constructor(theme: AndroidThemeObject) {\n this.theme = theme;\n this.root = createXml({ version: '1.0' }).ele('resources');\n this.buttonDrawable = createXml({ version: '1.0' }).ele('selector', {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n });\n this.buttonColor = createXml({ version: '1.0' }).ele('selector', {\n 'xmlns:android': 'http://schemas.android.com/apk/res/android',\n });\n }\n\n process() {\n if (!this.hasTheme()) {\n this.root = this.root.up();\n } else {\n this.print();\n }\n\n return {\n style: this.root,\n buttonDrawable: this.buttonDrawable,\n buttonColor: this.buttonColor,\n };\n }\n\n private print() {\n this.primaryColor();\n this.accentColor();\n this.darkPrimaryColor();\n this.backgroundColor();\n this.titleText();\n this.bodyText();\n this.footnoteText();\n // this.formLabelText();\n this.textField();\n this.pickerText();\n this.button();\n this.progressColor();\n this.successAsset();\n this.failAsset();\n this.loadingAnimationAsset();\n this.selfieAnimationAsset();\n\n this.preprintQueue.forEach((fn) => fn());\n\n // Precreate some style namespaces\n this.root = this.root\n .ele('style', {\n name: 'RN',\n })\n .up();\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona',\n })\n .up();\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona.Text',\n })\n .up();\n this.root = this.root.ele('style', {\n name: 'Persona.Inquiry2.Theme',\n parent: 'Base.Persona.Inquiry2.Theme',\n });\n this.printQueue.forEach((fn) => fn());\n this.root = this.root.up();\n this.postPrintQueue.forEach((fn) => fn());\n }\n\n private hasTheme(): boolean {\n return (\n Object.keys(this.theme).length > 0 &&\n Object.values(this.theme).filter(Boolean).length > 0\n );\n }\n\n private primaryColor() {\n if (!this.theme.primaryColor) return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'colorPrimary' })\n .txt(this.theme.primaryColor as string)\n .up()\n .txt(' ');\n });\n }\n\n private accentColor() {\n if (!this.theme.accentColor) return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'colorSecondary' })\n .txt(this.theme.accentColor as string)\n .up()\n .txt(' ');\n });\n }\n\n private darkPrimaryColor() {\n if (!this.theme.darkPrimaryColor) return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'colorPrimaryVariant' })\n .txt(this.theme.darkPrimaryColor as string)\n .up()\n .txt(' ');\n });\n }\n\n private backgroundColor() {\n if (!this.theme.backgroundColor) return;\n\n this.preprintQueue.push(() => {\n this.root = this.root\n .ele('color', { name: 'customPersonaBackgroundColor' })\n .txt(this.theme.backgroundColor as string)\n .up()\n .txt(' ');\n });\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'android:colorBackground' })\n .txt('@color/customPersonaBackgroundColor')\n .up()\n .txt(' ');\n });\n }\n\n private titleText() {\n if (this.theme.titleTextColor || this.theme.titleTextFont) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'textAppearanceHeadline6' })\n .txt('@style/RN.Persona.Text.Title')\n .up();\n });\n\n // Create a text appearance\n this.postPrintQueue.push(() => {\n this.root = this.root.ele('style', {\n name: 'RN.Persona.Text.Title',\n parent: 'Persona.Inquiry2.Text.Body',\n });\n\n if (this.theme.titleTextColor) {\n this.root = this.root\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.titleTextColor as string)\n .up();\n }\n\n if (this.theme.titleTextFont) {\n // TODO: Add notice about how to add a custom font that can be\n // referenced here on Android\n this.root = this.root\n .ele('item', { name: 'android:fontFamily' })\n .txt(this.theme.titleTextFont as string)\n .up();\n }\n\n // Default values taken from `Persona.Text.Title`\n // in shared/src/main/res/values/styles.xml\n this.root = this.root\n .ele('item', { name: 'android:textSize' })\n .txt('26sp')\n .up()\n .ele('item', { name: 'android:textStyle' })\n .txt('bold')\n .up();\n\n this.root = this.root.up();\n });\n } else {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'textAppearanceHeadline6' })\n .txt('@style/Persona.Text.Title')\n .up();\n });\n }\n }\n\n private bodyText() {\n if (this.theme.bodyTextColor || this.theme.bodyTextFont) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'textAppearanceSubtitle1' })\n .txt('@style/RN.Persona.Text.Body')\n .up();\n });\n\n // Create a text appearance\n this.postPrintQueue.push(() => {\n this.root = this.root.ele('style', {\n name: 'RN.Persona.Text.Body',\n parent: 'Persona.Inquiry2.Text.Body',\n });\n\n if (this.theme.bodyTextColor) {\n this.root = this.root\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.bodyTextColor as string)\n .up();\n }\n\n if (this.theme.bodyTextFont) {\n // TODO: Add notice about how to add a custom font that can be\n // referenced here on Android\n this.root = this.root\n .ele('item', { name: 'android:fontFamily' })\n .txt(this.theme.bodyTextFont as string)\n .up();\n }\n\n // Default values taken from `Persona.Text.Body`\n // in shared/src/main/res/values/styles.xml\n this.root = this.root\n .ele('item', { name: 'android:textSize' })\n .txt('18sp')\n .up();\n\n this.root = this.root.up();\n });\n } else {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'textAppearanceSubtitle1' })\n .txt('@style/Persona.Inquiry2.Text.Body')\n .up();\n });\n }\n }\n\n private footnoteText() {\n if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {\n this.postPrintQueue.push(() => {\n this.root = this.root\n .ele('style', { name: 'TextAppearance.AppCompat.Small' })\n .ele('item', { name: 'android:textSize' })\n // Used default value found in the Android SDK\n .txt('@dimen/abc_text_size_small_material')\n .up()\n .ele('item', { name: 'android:textColor' })\n .txt(\n // Used default value found in the Android SDK\n this.theme.footnoteTextColor ?? '?android:attr/textColorTertiary'\n )\n .up();\n\n if (this.theme.footnoteTextFont) {\n this.root = this.root\n .ele('item', { name: 'android:fontFamily' })\n .txt(\n // Used default value found in the Android SDK\n this.theme.footnoteTextFont ?? '?android:attr/textColorTertiary'\n )\n .up();\n }\n\n this.root = this.root.up();\n });\n }\n }\n private textField() {\n if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'editTextStyle' })\n .txt('@style/RN.Persona.EditText')\n .up();\n });\n\n this.postPrintQueue.push(() => {\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona.EditText',\n parent: 'Persona.Inquiry2.EditText',\n })\n .ele('item', { name: 'android:textAppearance' })\n .txt('@style/RN.Persona.EditText.TextAppearance')\n .up()\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.textFieldTextColor as string)\n .up()\n .up();\n\n this.root = this.root.ele('style', {\n name: 'RN.Persona.EditText.TextAppearance',\n parent: 'Base.TextAppearance.TextAppearance.MaterialComponents.Body1',\n });\n\n if (this.theme.textFieldTextColor) {\n this.root = this.root\n .ele('item', { name: 'android:textSize' })\n .txt('18sp')\n .up();\n }\n\n if (this.theme.textFieldTextFont) {\n this.root = this.root\n .ele('item', { name: 'android:fontFamily' })\n .txt(this.theme.textFieldTextFont as string)\n .up();\n }\n\n this.root = this.root.up();\n });\n }\n }\n\n private pickerText() {\n if (this.theme.pickerTextColor || this.theme.pickerTextFont) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'spinnerStyle' })\n .txt('@style/RN.Persona.Spinner')\n .up();\n\n this.root = this.root\n .ele('item', { name: 'spinnerDropDownItemStyle' })\n .txt('@style/RN.Persona.DropDownItem.Spinner')\n .up();\n });\n\n this.postPrintQueue.push(() => {\n // Build Rn.Persona.Spinner\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona.Spinner',\n parent: 'Persona.Inquiry2.Spinner',\n })\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.pickerTextColor ?? '?android:attr/textColorPrimary')\n .up()\n .ele('item', { name: 'android:textAppearance' })\n .txt(\n this.theme.pickerTextFont\n ? '@style/RN.Persona.Text.Spinner'\n : '@style/Persona.Inquiry2.Text.Body'\n )\n .up()\n .up();\n\n // Build RN.Persona.DropDownItem.Spinner\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona.DropDownItem.Spinner',\n parent: 'Persona.Inquiry2.Spinner',\n })\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.pickerTextColor ?? '?android:attr/textColorPrimary')\n .up()\n .ele('item', { name: 'android:textAppearance' })\n .txt(\n this.theme.pickerTextFont\n ? '@style/RN.Persona.Text.Spinner'\n : '@style/Persona.Inquiry2.Text.Body'\n )\n .up()\n .up();\n\n // Build RN.Persona.Text.Spinner\n this.root = this.root.ele('style', {\n name: 'RN.Persona.Text.Spinner',\n });\n\n if (this.theme.pickerTextColor) {\n this.root = this.root\n .ele('item', { name: 'android:textColor' })\n .txt(this.theme.pickerTextColor as string)\n .up();\n }\n\n if (this.theme.pickerTextFont) {\n // TODO: Add notice about how to add a custom font that can be\n // referenced here on Android\n this.root = this.root\n .ele('item', { name: 'android:fontFamily' })\n .txt(this.theme.pickerTextFont as string)\n .up();\n }\n\n this.root = this.root.up();\n });\n }\n }\n\n private button() {\n if (\n this.theme.buttonBackgroundColor ||\n this.theme.buttonDisabledBackgroundColor ||\n this.theme.buttonTouchedBackgroundColor ||\n this.theme.buttonTextColor ||\n this.theme.buttonDisabledTextColor ||\n this.theme.buttonCornerRadius ||\n this.theme.buttonFont\n ) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'buttonStyle' })\n .txt('@style/RN.Persona.Button')\n .up();\n });\n\n this.postPrintQueue.push(() => {\n this.root = this.root\n .ele('style', {\n name: 'RN.Persona.Button',\n parent: 'Persona.Inquiry2.Button',\n })\n // Taken from\n // appcompat's res/values/values.xml\n .ele('item', {\n name: 'android:minHeight',\n })\n .txt('48dip')\n .up()\n // Taken from\n // appcompat's res/values/values.xml\n .ele('item', {\n name: 'android:minWidth',\n })\n .txt('88dip')\n .up()\n // Taken from\n // persona-android's shared/src/main/res/values/styles.xml\n .ele('item', {\n name: 'android:textSize',\n })\n .txt('18sp')\n .up()\n .ele('item', {\n name: 'android:background',\n })\n .txt('@drawable/rn_persona_button')\n .up()\n .ele('item', {\n name: 'android:textColor',\n })\n .txt('@color/rn_persona_button')\n .up()\n .up();\n\n // Disabled\n this.buttonDrawable = this.buttonDrawable\n .ele('item', {\n 'android:state_enabled': 'false',\n })\n .ele('shape', { 'android:shape': 'rectangle' })\n .ele('corners', {\n 'android:radius': this.theme.buttonCornerRadius\n ? `${this.theme.buttonCornerRadius}dp`\n : '@dimen/abc_control_corner_material',\n })\n .up()\n .ele('padding', {\n 'android:left': '@dimen/abc_button_padding_horizontal_material',\n 'android:top': '@dimen/abc_button_padding_vertical_material',\n 'android:right': '@dimen/abc_button_padding_horizontal_material',\n 'android:bottom': '@dimen/abc_button_padding_vertical_material',\n })\n .up()\n .ele('solid', {\n 'android:color': this.theme.buttonDisabledBackgroundColor\n ? this.theme.buttonDisabledBackgroundColor\n : '?attr/colorPrimaryVariant',\n })\n .up()\n .up()\n .up();\n\n // touched\n this.buttonDrawable = this.buttonDrawable\n .ele('item', {\n 'android:state_pressed': 'true',\n })\n .ele('shape', { 'android:shape': 'rectangle' })\n .ele('corners', {\n 'android:radius': this.theme.buttonCornerRadius\n ? `${this.theme.buttonCornerRadius}dp`\n : '@dimen/abc_control_corner_material',\n })\n .up()\n .ele('solid', {\n 'android:color':\n this.theme.buttonTouchedBackgroundColor ??\n '?attr/colorPrimaryVariant',\n })\n .up()\n .ele('padding', {\n 'android:left': '@dimen/abc_button_padding_horizontal_material',\n 'android:top': '@dimen/abc_button_padding_vertical_material',\n 'android:right': '@dimen/abc_button_padding_horizontal_material',\n 'android:bottom': '@dimen/abc_button_padding_vertical_material',\n })\n .up()\n .up()\n .up();\n\n this.buttonDrawable = this.buttonDrawable\n .ele('item')\n .ele('shape', { 'android:shape': 'rectangle' })\n .ele('corners', {\n 'android:radius': this.theme.buttonCornerRadius\n ? `${this.theme.buttonCornerRadius}dp`\n : '@dimen/abc_control_corner_material',\n })\n .up()\n .ele('solid', {\n 'android:color':\n this.theme.buttonBackgroundColor ?? '?attr/colorPrimary',\n })\n .up()\n .ele('padding', {\n 'android:left': '@dimen/abc_button_padding_horizontal_material',\n 'android:top': '@dimen/abc_button_padding_vertical_material',\n 'android:right': '@dimen/abc_button_padding_horizontal_material',\n 'android:bottom': '@dimen/abc_button_padding_vertical_material',\n })\n .up()\n .up()\n .up();\n\n // Finish button drawable\n this.buttonDrawable = this.buttonDrawable.up();\n\n this.buttonColor = this.buttonColor\n .ele('item', {\n 'android:state_enabled': 'false',\n 'android:color':\n this.theme.buttonDisabledTextColor ??\n '@android:color/darker_gray',\n })\n .up()\n .ele('item', {\n 'android:state_pressed': 'true',\n 'android:color':\n this.theme.buttonTextColor ?? '@android:color/white',\n })\n .up()\n .ele('item', {\n 'android:color':\n this.theme.buttonTextColor ?? '@android:color/white',\n })\n .up();\n\n this.buttonColor = this.buttonColor.up();\n\n this.root = this.root.up();\n });\n }\n }\n\n private progressColor() {\n if (this.theme.progressColor) {\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'colorControlActivated' })\n .txt(this.theme.progressColor as string)\n .up();\n });\n }\n }\n\n private successAsset() {\n if (!this.theme.successAsset) return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'personaInquiryCompleteImage' })\n .txt(this.theme.successAsset as string)\n .up()\n .txt(' ');\n });\n }\n\n private failAsset() {\n if (!this.theme.failAsset) return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'personaInquiryFailImage' })\n .txt(this.theme.failAsset as string)\n .up()\n .txt(' ');\n });\n }\n\n private loadingAnimationAsset() {\n if (\n !this.theme.loadingAnimationAsset ||\n !this.theme.loadingAnimationWidthPercent\n )\n return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'personaInquiryLoadingLottieRaw' })\n .txt(this.theme.loadingAnimationAsset as string)\n .up()\n .txt(' ');\n\n this.root = this.root\n .ele('item', { name: 'personaInquiryLoadingLottieWidthPercent' })\n .txt(this.theme.loadingAnimationWidthPercent as string)\n .up()\n .txt(' ');\n });\n }\n\n private selfieAnimationAsset() {\n if (\n !this.theme.selfieAnimationAsset ||\n !this.theme.selfieAnimationWidthPercent\n )\n return;\n\n this.printQueue.push(() => {\n this.root = this.root\n .ele('item', { name: 'personaInquirySelfieLottieRaw' })\n .txt(this.theme.selfieAnimationAsset as string)\n .up()\n .txt(' ');\n\n this.root = this.root\n .ele('item', { name: 'personaInquirySelfieLottieWidthPercent' })\n .txt(this.theme.selfieAnimationWidthPercent as string)\n .up()\n .txt(' ');\n });\n }\n}\n\nexport default AndroidResourcePrinter;\n"]}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _cosmiconfig = require("cosmiconfig");
9
+
10
+ var _chalk = _interopRequireDefault(require("chalk"));
11
+
12
+ var _Theme = require("./Theme");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+
18
+ class Configuration {
19
+ constructor() {
20
+ _defineProperty(this, "config", void 0);
21
+ }
22
+
23
+ async loadConfig() {
24
+ if (this.config) return this.config;
25
+
26
+ try {
27
+ const explorer = (0, _cosmiconfig.cosmiconfig)('persona', {
28
+ packageProp: 'persona'
29
+ });
30
+ const result = await explorer.search();
31
+
32
+ if (result == null) {
33
+ return null;
34
+ }
35
+
36
+ this.config = result.config;
37
+ return this.config;
38
+ } catch (e) {
39
+ console.error(e);
40
+ process.exit(1);
41
+ }
42
+ }
43
+
44
+ async get() {
45
+ let config = await this.loadConfig();
46
+ const androidThemeLines = [];
47
+
48
+ for (const key in _Theme.ANDROID_THEME_CONFIG_KEY) {
49
+ androidThemeLines.push(` "${key}": null`);
50
+ }
51
+
52
+ const iosThemeLines = [];
53
+
54
+ for (const key in _Theme.IOS_THEME_CONFIG_KEY) {
55
+ iosThemeLines.push(` "${key}": null`);
56
+ }
57
+
58
+ if (config == null) {
59
+ console.log(`
60
+ Missing configuration.
61
+
62
+ In order to use this tool, it must be configured using a ${_chalk.default.yellow('persona')} object within
63
+ your package.json.
64
+
65
+ To get started, paste the following configuration into your package.json
66
+
67
+ {
68
+ ...
69
+
70
+ "persona": {
71
+ "androidTheme": {
72
+ ` + androidThemeLines.join(',\n') + `
73
+ },
74
+ "iosTheme": {
75
+ ` + iosThemeLines.join(',\n') + `
76
+ }
77
+ }
78
+
79
+ ...
80
+ }
81
+
82
+ and re-run this tool :).
83
+ `);
84
+ process.exit(1);
85
+ }
86
+
87
+ return config;
88
+ }
89
+
90
+ }
91
+
92
+ var _default = new Configuration();
93
+
94
+ exports.default = _default;
95
+ //# sourceMappingURL=Config.js.map