react-native-persona 2.2.2 → 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.
- package/CHANGELOG.md +6 -0
- package/README.md +2 -9
- package/bin/persona-tool +1 -2
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +497 -0
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -0
- package/lib/commonjs/persona-tool/Config.js +95 -0
- package/lib/commonjs/persona-tool/Config.js.map +1 -0
- package/lib/commonjs/persona-tool/Theme.js +199 -0
- package/lib/commonjs/persona-tool/Theme.js.map +1 -0
- package/lib/commonjs/persona-tool/index.js +41 -0
- package/lib/commonjs/persona-tool/index.js.map +1 -0
- package/lib/commonjs/persona-tool/prompts.js +48 -0
- package/lib/commonjs/persona-tool/prompts.js.map +1 -0
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +99 -0
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +50 -0
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -0
- package/lib/module/persona-tool/AndroidResourcePrinter.js +489 -0
- package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -0
- package/lib/module/persona-tool/Config.js +82 -0
- package/lib/module/persona-tool/Config.js.map +1 -0
- package/lib/module/persona-tool/Theme.js +183 -0
- package/lib/module/persona-tool/Theme.js.map +1 -0
- package/lib/module/persona-tool/index.js +33 -0
- package/lib/module/persona-tool/index.js.map +1 -0
- package/lib/module/persona-tool/prompts.js +31 -0
- package/lib/module/persona-tool/prompts.js.map +1 -0
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +72 -0
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -0
- package/lib/module/persona-tool/tools/IosThemeInstructions.js +37 -0
- package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -0
- package/lib/typescript/{src/fields.d.ts → fields.d.ts} +0 -0
- package/lib/typescript/{src/index.d.ts → index.d.ts} +0 -0
- package/lib/typescript/{persona-tools/lib → persona-tool}/AndroidResourcePrinter.d.ts +2 -2
- package/lib/typescript/{persona-tools → persona-tool}/Config.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/Theme.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/index.d.ts +0 -0
- package/lib/typescript/{persona-tools/lib → persona-tool}/prompts.d.ts +1 -1
- package/lib/typescript/{persona-tools → persona-tool}/tools/AndroidThemeGenerator.d.ts +0 -0
- package/lib/typescript/{persona-tools → persona-tool}/tools/IosThemeInstructions.d.ts +0 -0
- package/lib/typescript/{src/util.d.ts → util.d.ts} +0 -0
- package/lib/typescript/{src/versions.d.ts → versions.d.ts} +0 -0
- package/package.json +2 -3
- package/{persona-tools/lib → src/persona-tool}/AndroidResourcePrinter.ts +182 -182
- package/{persona-tools → src/persona-tool}/Config.ts +0 -0
- package/{persona-tools → src/persona-tool}/Theme.ts +0 -0
- package/{persona-tools → src/persona-tool}/index.ts +1 -1
- package/{persona-tools/lib → src/persona-tool}/prompts.ts +11 -11
- package/{persona-tools → src/persona-tool}/tools/AndroidThemeGenerator.ts +2 -2
- package/{persona-tools → src/persona-tool}/tools/IosThemeInstructions.ts +1 -1
|
@@ -0,0 +1,489 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
import { create as createXml } from 'xmlbuilder2';
|
|
4
|
+
|
|
5
|
+
class AndroidResourcePrinter {
|
|
6
|
+
constructor(theme) {
|
|
7
|
+
_defineProperty(this, "theme", void 0);
|
|
8
|
+
|
|
9
|
+
_defineProperty(this, "root", void 0);
|
|
10
|
+
|
|
11
|
+
_defineProperty(this, "buttonDrawable", void 0);
|
|
12
|
+
|
|
13
|
+
_defineProperty(this, "buttonColor", void 0);
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "preprintQueue", []);
|
|
16
|
+
|
|
17
|
+
_defineProperty(this, "printQueue", []);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "postPrintQueue", []);
|
|
20
|
+
|
|
21
|
+
this.theme = theme;
|
|
22
|
+
this.root = createXml({
|
|
23
|
+
version: '1.0'
|
|
24
|
+
}).ele('resources');
|
|
25
|
+
this.buttonDrawable = createXml({
|
|
26
|
+
version: '1.0'
|
|
27
|
+
}).ele('selector', {
|
|
28
|
+
'xmlns:android': 'http://schemas.android.com/apk/res/android'
|
|
29
|
+
});
|
|
30
|
+
this.buttonColor = createXml({
|
|
31
|
+
version: '1.0'
|
|
32
|
+
}).ele('selector', {
|
|
33
|
+
'xmlns:android': 'http://schemas.android.com/apk/res/android'
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
process() {
|
|
38
|
+
if (!this.hasTheme()) {
|
|
39
|
+
this.root = this.root.up();
|
|
40
|
+
} else {
|
|
41
|
+
this.print();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
style: this.root,
|
|
46
|
+
buttonDrawable: this.buttonDrawable,
|
|
47
|
+
buttonColor: this.buttonColor
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
print() {
|
|
52
|
+
this.primaryColor();
|
|
53
|
+
this.accentColor();
|
|
54
|
+
this.darkPrimaryColor();
|
|
55
|
+
this.backgroundColor();
|
|
56
|
+
this.titleText();
|
|
57
|
+
this.bodyText();
|
|
58
|
+
this.footnoteText(); // this.formLabelText();
|
|
59
|
+
|
|
60
|
+
this.textField();
|
|
61
|
+
this.pickerText();
|
|
62
|
+
this.button();
|
|
63
|
+
this.progressColor();
|
|
64
|
+
this.successAsset();
|
|
65
|
+
this.failAsset();
|
|
66
|
+
this.loadingAnimationAsset();
|
|
67
|
+
this.selfieAnimationAsset();
|
|
68
|
+
this.preprintQueue.forEach(fn => fn()); // Precreate some style namespaces
|
|
69
|
+
|
|
70
|
+
this.root = this.root.ele('style', {
|
|
71
|
+
name: 'RN'
|
|
72
|
+
}).up();
|
|
73
|
+
this.root = this.root.ele('style', {
|
|
74
|
+
name: 'RN.Persona'
|
|
75
|
+
}).up();
|
|
76
|
+
this.root = this.root.ele('style', {
|
|
77
|
+
name: 'RN.Persona.Text'
|
|
78
|
+
}).up();
|
|
79
|
+
this.root = this.root.ele('style', {
|
|
80
|
+
name: 'Persona.Inquiry2.Theme',
|
|
81
|
+
parent: 'Base.Persona.Inquiry2.Theme'
|
|
82
|
+
});
|
|
83
|
+
this.printQueue.forEach(fn => fn());
|
|
84
|
+
this.root = this.root.up();
|
|
85
|
+
this.postPrintQueue.forEach(fn => fn());
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
hasTheme() {
|
|
89
|
+
return Object.keys(this.theme).length > 0 && Object.values(this.theme).filter(Boolean).length > 0;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
primaryColor() {
|
|
93
|
+
if (!this.theme.primaryColor) return;
|
|
94
|
+
this.printQueue.push(() => {
|
|
95
|
+
this.root = this.root.ele('item', {
|
|
96
|
+
name: 'colorPrimary'
|
|
97
|
+
}).txt(this.theme.primaryColor).up().txt(' ');
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
accentColor() {
|
|
102
|
+
if (!this.theme.accentColor) return;
|
|
103
|
+
this.printQueue.push(() => {
|
|
104
|
+
this.root = this.root.ele('item', {
|
|
105
|
+
name: 'colorSecondary'
|
|
106
|
+
}).txt(this.theme.accentColor).up().txt(' ');
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
darkPrimaryColor() {
|
|
111
|
+
if (!this.theme.darkPrimaryColor) return;
|
|
112
|
+
this.printQueue.push(() => {
|
|
113
|
+
this.root = this.root.ele('item', {
|
|
114
|
+
name: 'colorPrimaryVariant'
|
|
115
|
+
}).txt(this.theme.darkPrimaryColor).up().txt(' ');
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
backgroundColor() {
|
|
120
|
+
if (!this.theme.backgroundColor) return;
|
|
121
|
+
this.preprintQueue.push(() => {
|
|
122
|
+
this.root = this.root.ele('color', {
|
|
123
|
+
name: 'customPersonaBackgroundColor'
|
|
124
|
+
}).txt(this.theme.backgroundColor).up().txt(' ');
|
|
125
|
+
});
|
|
126
|
+
this.printQueue.push(() => {
|
|
127
|
+
this.root = this.root.ele('item', {
|
|
128
|
+
name: 'android:colorBackground'
|
|
129
|
+
}).txt('@color/customPersonaBackgroundColor').up().txt(' ');
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
titleText() {
|
|
134
|
+
if (this.theme.titleTextColor || this.theme.titleTextFont) {
|
|
135
|
+
this.printQueue.push(() => {
|
|
136
|
+
this.root = this.root.ele('item', {
|
|
137
|
+
name: 'textAppearanceHeadline6'
|
|
138
|
+
}).txt('@style/RN.Persona.Text.Title').up();
|
|
139
|
+
}); // Create a text appearance
|
|
140
|
+
|
|
141
|
+
this.postPrintQueue.push(() => {
|
|
142
|
+
this.root = this.root.ele('style', {
|
|
143
|
+
name: 'RN.Persona.Text.Title',
|
|
144
|
+
parent: 'Persona.Inquiry2.Text.Body'
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (this.theme.titleTextColor) {
|
|
148
|
+
this.root = this.root.ele('item', {
|
|
149
|
+
name: 'android:textColor'
|
|
150
|
+
}).txt(this.theme.titleTextColor).up();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (this.theme.titleTextFont) {
|
|
154
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
155
|
+
// referenced here on Android
|
|
156
|
+
this.root = this.root.ele('item', {
|
|
157
|
+
name: 'android:fontFamily'
|
|
158
|
+
}).txt(this.theme.titleTextFont).up();
|
|
159
|
+
} // Default values taken from `Persona.Text.Title`
|
|
160
|
+
// in shared/src/main/res/values/styles.xml
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
this.root = this.root.ele('item', {
|
|
164
|
+
name: 'android:textSize'
|
|
165
|
+
}).txt('26sp').up().ele('item', {
|
|
166
|
+
name: 'android:textStyle'
|
|
167
|
+
}).txt('bold').up();
|
|
168
|
+
this.root = this.root.up();
|
|
169
|
+
});
|
|
170
|
+
} else {
|
|
171
|
+
this.printQueue.push(() => {
|
|
172
|
+
this.root = this.root.ele('item', {
|
|
173
|
+
name: 'textAppearanceHeadline6'
|
|
174
|
+
}).txt('@style/Persona.Text.Title').up();
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
bodyText() {
|
|
180
|
+
if (this.theme.bodyTextColor || this.theme.bodyTextFont) {
|
|
181
|
+
this.printQueue.push(() => {
|
|
182
|
+
this.root = this.root.ele('item', {
|
|
183
|
+
name: 'textAppearanceSubtitle1'
|
|
184
|
+
}).txt('@style/RN.Persona.Text.Body').up();
|
|
185
|
+
}); // Create a text appearance
|
|
186
|
+
|
|
187
|
+
this.postPrintQueue.push(() => {
|
|
188
|
+
this.root = this.root.ele('style', {
|
|
189
|
+
name: 'RN.Persona.Text.Body',
|
|
190
|
+
parent: 'Persona.Inquiry2.Text.Body'
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
if (this.theme.bodyTextColor) {
|
|
194
|
+
this.root = this.root.ele('item', {
|
|
195
|
+
name: 'android:textColor'
|
|
196
|
+
}).txt(this.theme.bodyTextColor).up();
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (this.theme.bodyTextFont) {
|
|
200
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
201
|
+
// referenced here on Android
|
|
202
|
+
this.root = this.root.ele('item', {
|
|
203
|
+
name: 'android:fontFamily'
|
|
204
|
+
}).txt(this.theme.bodyTextFont).up();
|
|
205
|
+
} // Default values taken from `Persona.Text.Body`
|
|
206
|
+
// in shared/src/main/res/values/styles.xml
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
this.root = this.root.ele('item', {
|
|
210
|
+
name: 'android:textSize'
|
|
211
|
+
}).txt('18sp').up();
|
|
212
|
+
this.root = this.root.up();
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
this.printQueue.push(() => {
|
|
216
|
+
this.root = this.root.ele('item', {
|
|
217
|
+
name: 'textAppearanceSubtitle1'
|
|
218
|
+
}).txt('@style/Persona.Inquiry2.Text.Body').up();
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
footnoteText() {
|
|
224
|
+
if (this.theme.footnoteTextColor || this.theme.footnoteTextFont) {
|
|
225
|
+
this.postPrintQueue.push(() => {
|
|
226
|
+
var _this$theme$footnoteT;
|
|
227
|
+
|
|
228
|
+
this.root = this.root.ele('style', {
|
|
229
|
+
name: 'TextAppearance.AppCompat.Small'
|
|
230
|
+
}).ele('item', {
|
|
231
|
+
name: 'android:textSize'
|
|
232
|
+
}) // Used default value found in the Android SDK
|
|
233
|
+
.txt('@dimen/abc_text_size_small_material').up().ele('item', {
|
|
234
|
+
name: 'android:textColor'
|
|
235
|
+
}).txt( // Used default value found in the Android SDK
|
|
236
|
+
(_this$theme$footnoteT = this.theme.footnoteTextColor) !== null && _this$theme$footnoteT !== void 0 ? _this$theme$footnoteT : '?android:attr/textColorTertiary').up();
|
|
237
|
+
|
|
238
|
+
if (this.theme.footnoteTextFont) {
|
|
239
|
+
var _this$theme$footnoteT2;
|
|
240
|
+
|
|
241
|
+
this.root = this.root.ele('item', {
|
|
242
|
+
name: 'android:fontFamily'
|
|
243
|
+
}).txt( // Used default value found in the Android SDK
|
|
244
|
+
(_this$theme$footnoteT2 = this.theme.footnoteTextFont) !== null && _this$theme$footnoteT2 !== void 0 ? _this$theme$footnoteT2 : '?android:attr/textColorTertiary').up();
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
this.root = this.root.up();
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
textField() {
|
|
253
|
+
if (this.theme.textFieldTextColor || this.theme.textFieldTextFont) {
|
|
254
|
+
this.printQueue.push(() => {
|
|
255
|
+
this.root = this.root.ele('item', {
|
|
256
|
+
name: 'editTextStyle'
|
|
257
|
+
}).txt('@style/RN.Persona.EditText').up();
|
|
258
|
+
});
|
|
259
|
+
this.postPrintQueue.push(() => {
|
|
260
|
+
this.root = this.root.ele('style', {
|
|
261
|
+
name: 'RN.Persona.EditText',
|
|
262
|
+
parent: 'Persona.Inquiry2.EditText'
|
|
263
|
+
}).ele('item', {
|
|
264
|
+
name: 'android:textAppearance'
|
|
265
|
+
}).txt('@style/RN.Persona.EditText.TextAppearance').up().ele('item', {
|
|
266
|
+
name: 'android:textColor'
|
|
267
|
+
}).txt(this.theme.textFieldTextColor).up().up();
|
|
268
|
+
this.root = this.root.ele('style', {
|
|
269
|
+
name: 'RN.Persona.EditText.TextAppearance',
|
|
270
|
+
parent: 'Base.TextAppearance.TextAppearance.MaterialComponents.Body1'
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
if (this.theme.textFieldTextColor) {
|
|
274
|
+
this.root = this.root.ele('item', {
|
|
275
|
+
name: 'android:textSize'
|
|
276
|
+
}).txt('18sp').up();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (this.theme.textFieldTextFont) {
|
|
280
|
+
this.root = this.root.ele('item', {
|
|
281
|
+
name: 'android:fontFamily'
|
|
282
|
+
}).txt(this.theme.textFieldTextFont).up();
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.root = this.root.up();
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
pickerText() {
|
|
291
|
+
if (this.theme.pickerTextColor || this.theme.pickerTextFont) {
|
|
292
|
+
this.printQueue.push(() => {
|
|
293
|
+
this.root = this.root.ele('item', {
|
|
294
|
+
name: 'spinnerStyle'
|
|
295
|
+
}).txt('@style/RN.Persona.Spinner').up();
|
|
296
|
+
this.root = this.root.ele('item', {
|
|
297
|
+
name: 'spinnerDropDownItemStyle'
|
|
298
|
+
}).txt('@style/RN.Persona.DropDownItem.Spinner').up();
|
|
299
|
+
});
|
|
300
|
+
this.postPrintQueue.push(() => {
|
|
301
|
+
var _this$theme$pickerTex, _this$theme$pickerTex2;
|
|
302
|
+
|
|
303
|
+
// Build Rn.Persona.Spinner
|
|
304
|
+
this.root = this.root.ele('style', {
|
|
305
|
+
name: 'RN.Persona.Spinner',
|
|
306
|
+
parent: 'Persona.Inquiry2.Spinner'
|
|
307
|
+
}).ele('item', {
|
|
308
|
+
name: 'android:textColor'
|
|
309
|
+
}).txt((_this$theme$pickerTex = this.theme.pickerTextColor) !== null && _this$theme$pickerTex !== void 0 ? _this$theme$pickerTex : '?android:attr/textColorPrimary').up().ele('item', {
|
|
310
|
+
name: 'android:textAppearance'
|
|
311
|
+
}).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.DropDownItem.Spinner
|
|
312
|
+
|
|
313
|
+
this.root = this.root.ele('style', {
|
|
314
|
+
name: 'RN.Persona.DropDownItem.Spinner',
|
|
315
|
+
parent: 'Persona.Inquiry2.Spinner'
|
|
316
|
+
}).ele('item', {
|
|
317
|
+
name: 'android:textColor'
|
|
318
|
+
}).txt((_this$theme$pickerTex2 = this.theme.pickerTextColor) !== null && _this$theme$pickerTex2 !== void 0 ? _this$theme$pickerTex2 : '?android:attr/textColorPrimary').up().ele('item', {
|
|
319
|
+
name: 'android:textAppearance'
|
|
320
|
+
}).txt(this.theme.pickerTextFont ? '@style/RN.Persona.Text.Spinner' : '@style/Persona.Inquiry2.Text.Body').up().up(); // Build RN.Persona.Text.Spinner
|
|
321
|
+
|
|
322
|
+
this.root = this.root.ele('style', {
|
|
323
|
+
name: 'RN.Persona.Text.Spinner'
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
if (this.theme.pickerTextColor) {
|
|
327
|
+
this.root = this.root.ele('item', {
|
|
328
|
+
name: 'android:textColor'
|
|
329
|
+
}).txt(this.theme.pickerTextColor).up();
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
if (this.theme.pickerTextFont) {
|
|
333
|
+
// TODO: Add notice about how to add a custom font that can be
|
|
334
|
+
// referenced here on Android
|
|
335
|
+
this.root = this.root.ele('item', {
|
|
336
|
+
name: 'android:fontFamily'
|
|
337
|
+
}).txt(this.theme.pickerTextFont).up();
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
this.root = this.root.up();
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
button() {
|
|
346
|
+
if (this.theme.buttonBackgroundColor || this.theme.buttonDisabledBackgroundColor || this.theme.buttonTouchedBackgroundColor || this.theme.buttonTextColor || this.theme.buttonDisabledTextColor || this.theme.buttonCornerRadius || this.theme.buttonFont) {
|
|
347
|
+
this.printQueue.push(() => {
|
|
348
|
+
this.root = this.root.ele('item', {
|
|
349
|
+
name: 'buttonStyle'
|
|
350
|
+
}).txt('@style/RN.Persona.Button').up();
|
|
351
|
+
});
|
|
352
|
+
this.postPrintQueue.push(() => {
|
|
353
|
+
var _this$theme$buttonTou, _this$theme$buttonBac, _this$theme$buttonDis, _this$theme$buttonTex, _this$theme$buttonTex2;
|
|
354
|
+
|
|
355
|
+
this.root = this.root.ele('style', {
|
|
356
|
+
name: 'RN.Persona.Button',
|
|
357
|
+
parent: 'Persona.Inquiry2.Button'
|
|
358
|
+
}) // Taken from
|
|
359
|
+
// appcompat's res/values/values.xml
|
|
360
|
+
.ele('item', {
|
|
361
|
+
name: 'android:minHeight'
|
|
362
|
+
}).txt('48dip').up() // Taken from
|
|
363
|
+
// appcompat's res/values/values.xml
|
|
364
|
+
.ele('item', {
|
|
365
|
+
name: 'android:minWidth'
|
|
366
|
+
}).txt('88dip').up() // Taken from
|
|
367
|
+
// persona-android's shared/src/main/res/values/styles.xml
|
|
368
|
+
.ele('item', {
|
|
369
|
+
name: 'android:textSize'
|
|
370
|
+
}).txt('18sp').up().ele('item', {
|
|
371
|
+
name: 'android:background'
|
|
372
|
+
}).txt('@drawable/rn_persona_button').up().ele('item', {
|
|
373
|
+
name: 'android:textColor'
|
|
374
|
+
}).txt('@color/rn_persona_button').up().up(); // Disabled
|
|
375
|
+
|
|
376
|
+
this.buttonDrawable = this.buttonDrawable.ele('item', {
|
|
377
|
+
'android:state_enabled': 'false'
|
|
378
|
+
}).ele('shape', {
|
|
379
|
+
'android:shape': 'rectangle'
|
|
380
|
+
}).ele('corners', {
|
|
381
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
382
|
+
}).up().ele('padding', {
|
|
383
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
384
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
385
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
386
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
387
|
+
}).up().ele('solid', {
|
|
388
|
+
'android:color': this.theme.buttonDisabledBackgroundColor ? this.theme.buttonDisabledBackgroundColor : '?attr/colorPrimaryVariant'
|
|
389
|
+
}).up().up().up(); // touched
|
|
390
|
+
|
|
391
|
+
this.buttonDrawable = this.buttonDrawable.ele('item', {
|
|
392
|
+
'android:state_pressed': 'true'
|
|
393
|
+
}).ele('shape', {
|
|
394
|
+
'android:shape': 'rectangle'
|
|
395
|
+
}).ele('corners', {
|
|
396
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
397
|
+
}).up().ele('solid', {
|
|
398
|
+
'android:color': (_this$theme$buttonTou = this.theme.buttonTouchedBackgroundColor) !== null && _this$theme$buttonTou !== void 0 ? _this$theme$buttonTou : '?attr/colorPrimaryVariant'
|
|
399
|
+
}).up().ele('padding', {
|
|
400
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
401
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
402
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
403
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
404
|
+
}).up().up().up();
|
|
405
|
+
this.buttonDrawable = this.buttonDrawable.ele('item').ele('shape', {
|
|
406
|
+
'android:shape': 'rectangle'
|
|
407
|
+
}).ele('corners', {
|
|
408
|
+
'android:radius': this.theme.buttonCornerRadius ? `${this.theme.buttonCornerRadius}dp` : '@dimen/abc_control_corner_material'
|
|
409
|
+
}).up().ele('solid', {
|
|
410
|
+
'android:color': (_this$theme$buttonBac = this.theme.buttonBackgroundColor) !== null && _this$theme$buttonBac !== void 0 ? _this$theme$buttonBac : '?attr/colorPrimary'
|
|
411
|
+
}).up().ele('padding', {
|
|
412
|
+
'android:left': '@dimen/abc_button_padding_horizontal_material',
|
|
413
|
+
'android:top': '@dimen/abc_button_padding_vertical_material',
|
|
414
|
+
'android:right': '@dimen/abc_button_padding_horizontal_material',
|
|
415
|
+
'android:bottom': '@dimen/abc_button_padding_vertical_material'
|
|
416
|
+
}).up().up().up(); // Finish button drawable
|
|
417
|
+
|
|
418
|
+
this.buttonDrawable = this.buttonDrawable.up();
|
|
419
|
+
this.buttonColor = this.buttonColor.ele('item', {
|
|
420
|
+
'android:state_enabled': 'false',
|
|
421
|
+
'android:color': (_this$theme$buttonDis = this.theme.buttonDisabledTextColor) !== null && _this$theme$buttonDis !== void 0 ? _this$theme$buttonDis : '@android:color/darker_gray'
|
|
422
|
+
}).up().ele('item', {
|
|
423
|
+
'android:state_pressed': 'true',
|
|
424
|
+
'android:color': (_this$theme$buttonTex = this.theme.buttonTextColor) !== null && _this$theme$buttonTex !== void 0 ? _this$theme$buttonTex : '@android:color/white'
|
|
425
|
+
}).up().ele('item', {
|
|
426
|
+
'android:color': (_this$theme$buttonTex2 = this.theme.buttonTextColor) !== null && _this$theme$buttonTex2 !== void 0 ? _this$theme$buttonTex2 : '@android:color/white'
|
|
427
|
+
}).up();
|
|
428
|
+
this.buttonColor = this.buttonColor.up();
|
|
429
|
+
this.root = this.root.up();
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
progressColor() {
|
|
435
|
+
if (this.theme.progressColor) {
|
|
436
|
+
this.printQueue.push(() => {
|
|
437
|
+
this.root = this.root.ele('item', {
|
|
438
|
+
name: 'colorControlActivated'
|
|
439
|
+
}).txt(this.theme.progressColor).up();
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
successAsset() {
|
|
445
|
+
if (!this.theme.successAsset) return;
|
|
446
|
+
this.printQueue.push(() => {
|
|
447
|
+
this.root = this.root.ele('item', {
|
|
448
|
+
name: 'personaInquiryCompleteImage'
|
|
449
|
+
}).txt(this.theme.successAsset).up().txt(' ');
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
failAsset() {
|
|
454
|
+
if (!this.theme.failAsset) return;
|
|
455
|
+
this.printQueue.push(() => {
|
|
456
|
+
this.root = this.root.ele('item', {
|
|
457
|
+
name: 'personaInquiryFailImage'
|
|
458
|
+
}).txt(this.theme.failAsset).up().txt(' ');
|
|
459
|
+
});
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
loadingAnimationAsset() {
|
|
463
|
+
if (!this.theme.loadingAnimationAsset || !this.theme.loadingAnimationWidthPercent) return;
|
|
464
|
+
this.printQueue.push(() => {
|
|
465
|
+
this.root = this.root.ele('item', {
|
|
466
|
+
name: 'personaInquiryLoadingLottieRaw'
|
|
467
|
+
}).txt(this.theme.loadingAnimationAsset).up().txt(' ');
|
|
468
|
+
this.root = this.root.ele('item', {
|
|
469
|
+
name: 'personaInquiryLoadingLottieWidthPercent'
|
|
470
|
+
}).txt(this.theme.loadingAnimationWidthPercent).up().txt(' ');
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
selfieAnimationAsset() {
|
|
475
|
+
if (!this.theme.selfieAnimationAsset || !this.theme.selfieAnimationWidthPercent) return;
|
|
476
|
+
this.printQueue.push(() => {
|
|
477
|
+
this.root = this.root.ele('item', {
|
|
478
|
+
name: 'personaInquirySelfieLottieRaw'
|
|
479
|
+
}).txt(this.theme.selfieAnimationAsset).up().txt(' ');
|
|
480
|
+
this.root = this.root.ele('item', {
|
|
481
|
+
name: 'personaInquirySelfieLottieWidthPercent'
|
|
482
|
+
}).txt(this.theme.selfieAnimationWidthPercent).up().txt(' ');
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export default AndroidResourcePrinter;
|
|
489
|
+
//# sourceMappingURL=AndroidResourcePrinter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["AndroidResourcePrinter.ts"],"names":["create","createXml","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,SAASA,MAAM,IAAIC,SAAnB,QAAoC,aAApC;;AAIA,MAAMC,sBAAN,CAA6B;AAS3BC,EAAAA,WAAW,CAACC,KAAD,EAA4B;AAAA;;AAAA;;AA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E,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;;AAuoB7B,eAAe1C,sBAAf","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,82 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
import { cosmiconfig } from 'cosmiconfig';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { ANDROID_THEME_CONFIG_KEY, IOS_THEME_CONFIG_KEY } from './Theme';
|
|
6
|
+
|
|
7
|
+
class Configuration {
|
|
8
|
+
constructor() {
|
|
9
|
+
_defineProperty(this, "config", void 0);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async loadConfig() {
|
|
13
|
+
if (this.config) return this.config;
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const explorer = cosmiconfig('persona', {
|
|
17
|
+
packageProp: 'persona'
|
|
18
|
+
});
|
|
19
|
+
const result = await explorer.search();
|
|
20
|
+
|
|
21
|
+
if (result == null) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
this.config = result.config;
|
|
26
|
+
return this.config;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.error(e);
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async get() {
|
|
34
|
+
let config = await this.loadConfig();
|
|
35
|
+
const androidThemeLines = [];
|
|
36
|
+
|
|
37
|
+
for (const key in ANDROID_THEME_CONFIG_KEY) {
|
|
38
|
+
androidThemeLines.push(` "${key}": null`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const iosThemeLines = [];
|
|
42
|
+
|
|
43
|
+
for (const key in IOS_THEME_CONFIG_KEY) {
|
|
44
|
+
iosThemeLines.push(` "${key}": null`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (config == null) {
|
|
48
|
+
console.log(`
|
|
49
|
+
Missing configuration.
|
|
50
|
+
|
|
51
|
+
In order to use this tool, it must be configured using a ${chalk.yellow('persona')} object within
|
|
52
|
+
your package.json.
|
|
53
|
+
|
|
54
|
+
To get started, paste the following configuration into your package.json
|
|
55
|
+
|
|
56
|
+
{
|
|
57
|
+
...
|
|
58
|
+
|
|
59
|
+
"persona": {
|
|
60
|
+
"androidTheme": {
|
|
61
|
+
` + androidThemeLines.join(',\n') + `
|
|
62
|
+
},
|
|
63
|
+
"iosTheme": {
|
|
64
|
+
` + iosThemeLines.join(',\n') + `
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
...
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
and re-run this tool :).
|
|
72
|
+
`);
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return config;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export default new Configuration();
|
|
82
|
+
//# sourceMappingURL=Config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Config.ts"],"names":["cosmiconfig","chalk","ANDROID_THEME_CONFIG_KEY","IOS_THEME_CONFIG_KEY","Configuration","loadConfig","config","explorer","packageProp","result","search","e","console","error","process","exit","get","androidThemeLines","key","push","iosThemeLines","log","yellow","join"],"mappings":";;AAAA,SAASA,WAAT,QAA4B,aAA5B;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAASC,wBAAT,EAAmCC,oBAAnC,QAA+D,SAA/D;;AAOA,MAAMC,aAAN,CAAoB;AAAA;AAAA;AAAA;;AAGF,QAAVC,UAAU,GAA6C;AAC3D,QAAI,KAAKC,MAAT,EAAiB,OAAO,KAAKA,MAAZ;;AAEjB,QAAI;AACF,YAAMC,QAAQ,GAAGP,WAAW,CAAC,SAAD,EAAY;AAAEQ,QAAAA,WAAW,EAAE;AAAf,OAAZ,CAA5B;AACA,YAAMC,MAAM,GAAG,MAAMF,QAAQ,CAACG,MAAT,EAArB;;AACA,UAAID,MAAM,IAAI,IAAd,EAAoB;AAClB,eAAO,IAAP;AACD;;AAED,WAAKH,MAAL,GAAcG,MAAM,CAACH,MAArB;AAEA,aAAO,KAAKA,MAAZ;AACD,KAVD,CAUE,OAAOK,CAAP,EAAU;AACVC,MAAAA,OAAO,CAACC,KAAR,CAAcF,CAAd;AACAG,MAAAA,OAAO,CAACC,IAAR,CAAa,CAAb;AACD;AACF;;AAEQ,QAAHC,GAAG,GAA0B;AACjC,QAAIV,MAAM,GAAG,MAAM,KAAKD,UAAL,EAAnB;AAEA,UAAMY,iBAAiB,GAAG,EAA1B;;AACA,SAAK,MAAMC,GAAX,IAAkBhB,wBAAlB,EAA4C;AAC1Ce,MAAAA,iBAAiB,CAACE,IAAlB,CAAwB,UAASD,GAAI,SAArC;AACD;;AAED,UAAME,aAAa,GAAG,EAAtB;;AACA,SAAK,MAAMF,GAAX,IAAkBf,oBAAlB,EAAwC;AACtCiB,MAAAA,aAAa,CAACD,IAAd,CAAoB,UAASD,GAAI,SAAjC;AACD;;AAED,QAAIZ,MAAM,IAAI,IAAd,EAAoB;AAClBM,MAAAA,OAAO,CAACS,GAAR,CACG;AACT;AACA;AACA,2DAA2DpB,KAAK,CAACqB,MAAN,CACjD,SADiD,CAEjD;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAfQ,GAgBEL,iBAAiB,CAACM,IAAlB,CAAuB,KAAvB,CAhBF,GAiBG;AACX;AACA;AACA,CApBQ,GAqBEH,aAAa,CAACG,IAAd,CAAmB,KAAnB,CArBF,GAsBG;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CA/BM;AAiCAT,MAAAA,OAAO,CAACC,IAAR,CAAa,CAAb;AACD;;AAED,WAAOT,MAAP;AACD;;AAzEiB;;AA4EpB,eAAe,IAAIF,aAAJ,EAAf","sourcesContent":["import { cosmiconfig } from 'cosmiconfig';\nimport chalk from 'chalk';\nimport { ANDROID_THEME_CONFIG_KEY, IOS_THEME_CONFIG_KEY } from './Theme';\n\nexport interface ConfigObject {\n androidTheme: { [key: string]: string | null | undefined };\n iosTheme: { [key: string]: string | null | undefined };\n}\n\nclass Configuration {\n config?: ConfigObject | null;\n\n async loadConfig(): Promise<ConfigObject | null | undefined> {\n if (this.config) return this.config;\n\n try {\n const explorer = cosmiconfig('persona', { packageProp: 'persona' });\n const result = await explorer.search();\n if (result == null) {\n return null;\n }\n\n this.config = result.config;\n\n return this.config;\n } catch (e) {\n console.error(e);\n process.exit(1);\n }\n }\n\n async get(): Promise<ConfigObject> {\n let config = await this.loadConfig();\n\n const androidThemeLines = [];\n for (const key in ANDROID_THEME_CONFIG_KEY) {\n androidThemeLines.push(` \"${key}\": null`);\n }\n\n const iosThemeLines = [];\n for (const key in IOS_THEME_CONFIG_KEY) {\n iosThemeLines.push(` \"${key}\": null`);\n }\n\n if (config == null) {\n console.log(\n `\nMissing configuration.\n\nIn order to use this tool, it must be configured using a ${chalk.yellow(\n 'persona'\n )} object within\nyour package.json.\n\nTo get started, paste the following configuration into your package.json\n\n{\n ...\n\n \"persona\": {\n \"androidTheme\": {\n` +\n androidThemeLines.join(',\\n') +\n `\n },\n \"iosTheme\": {\n` +\n iosThemeLines.join(',\\n') +\n `\n }\n }\n\n ...\n}\n\nand re-run this tool :).\n`\n );\n process.exit(1);\n }\n\n return config as ConfigObject;\n }\n}\n\nexport default new Configuration();\n"]}
|