react-native-persona 2.7.0 → 2.7.2
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/RNPersonaInquiry2.podspec +2 -2
- package/android/build.gradle +8 -12
- package/android/gradle.properties +0 -1
- package/android/src/main/java/com/withpersona/sdk2/reactnative/PersonaInquiryModule2.java +7 -0
- package/ios/PersonaInquiry2.swift +10 -3
- package/lib/commonjs/fields.js +9 -44
- package/lib/commonjs/fields.js.map +1 -1
- package/lib/commonjs/index.js +73 -206
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js +48 -83
- package/lib/commonjs/persona-tool/AndroidResourcePrinter.js.map +1 -1
- package/lib/commonjs/persona-tool/Config.js +3 -20
- package/lib/commonjs/persona-tool/Config.js.map +1 -1
- package/lib/commonjs/persona-tool/Theme.js +12 -36
- package/lib/commonjs/persona-tool/Theme.js.map +1 -1
- package/lib/commonjs/persona-tool/index.js +0 -10
- package/lib/commonjs/persona-tool/index.js.map +1 -1
- package/lib/commonjs/persona-tool/prompts.js +0 -6
- package/lib/commonjs/persona-tool/prompts.js.map +1 -1
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js +2 -27
- package/lib/commonjs/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js +0 -10
- package/lib/commonjs/persona-tool/tools/IosThemeInstructions.js.map +1 -1
- package/lib/commonjs/util.js +0 -6
- package/lib/commonjs/util.js.map +1 -1
- package/lib/commonjs/versions.js +0 -5
- package/lib/commonjs/versions.js.map +1 -1
- package/lib/module/fields.js +9 -43
- package/lib/module/fields.js.map +1 -1
- package/lib/module/index.js +70 -177
- package/lib/module/index.js.map +1 -1
- package/lib/module/persona-tool/AndroidResourcePrinter.js +48 -82
- package/lib/module/persona-tool/AndroidResourcePrinter.js.map +1 -1
- package/lib/module/persona-tool/Config.js +3 -15
- package/lib/module/persona-tool/Config.js.map +1 -1
- package/lib/module/persona-tool/Theme.js +10 -28
- package/lib/module/persona-tool/Theme.js.map +1 -1
- package/lib/module/persona-tool/index.js +0 -5
- package/lib/module/persona-tool/index.js.map +1 -1
- package/lib/module/persona-tool/prompts.js.map +1 -1
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js +2 -8
- package/lib/module/persona-tool/tools/AndroidThemeGenerator.js.map +1 -1
- package/lib/module/persona-tool/tools/IosThemeInstructions.js +0 -5
- package/lib/module/persona-tool/tools/IosThemeInstructions.js.map +1 -1
- package/lib/module/util.js +0 -5
- package/lib/module/util.js.map +1 -1
- package/lib/module/versions.js +0 -1
- package/lib/module/versions.js.map +1 -1
- package/lib/typescript/fields.d.ts +2 -2
- package/lib/typescript/index.d.ts +14 -8
- package/lib/typescript/persona-tool/Theme.d.ts +3 -3
- package/package.json +2 -2
- package/src/index.ts +20 -0
|
@@ -1 +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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,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;;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"]}
|
|
1
|
+
{"version":3,"names":["create","createXml","AndroidResourcePrinter","constructor","theme","_defineProperty","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"],"sources":["AndroidResourcePrinter.ts"],"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"],"mappings":";;;AAAA,SAASA,MAAM,IAAIC,SAAS,QAAQ,aAAa;AAIjD,MAAMC,sBAAsB,CAAC;EAS3BC,WAAWA,CAACC,KAAyB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,wBAJP,EAAE;IAAAA,eAAA,qBACL,EAAE;IAAAA,eAAA,yBACE,EAAE;IAGjC,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACE,IAAI,GAAGL,SAAS,CAAC;MAAEM,OAAO,EAAE;IAAM,CAAC,CAAC,CAACC,GAAG,CAAC,WAAW,CAAC;IAC1D,IAAI,CAACC,cAAc,GAAGR,SAAS,CAAC;MAAEM,OAAO,EAAE;IAAM,CAAC,CAAC,CAACC,GAAG,CAAC,UAAU,EAAE;MAClE,eAAe,EAAE;IACnB,CAAC,CAAC;IACF,IAAI,CAACE,WAAW,GAAGT,SAAS,CAAC;MAAEM,OAAO,EAAE;IAAM,CAAC,CAAC,CAACC,GAAG,CAAC,UAAU,EAAE;MAC/D,eA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C,CAAC,CAAC,CAChEW,GAAG,CAAC,IAAI,CAACzC,KAAK,CAAC2D,4BAAsC,CAAC,CACtDlD,EAAE,CAAC,CAAC,CACJgC,GAAG,CAAC,GAAG,CAAC;IACb,CAAC,CAAC;EACJ;EAEQf,oBAAoBA,CAAA,EAAG;IAC7B,IACE,CAAC,IAAI,CAAC1B,KAAK,CAAC0B,oBAAoB,IAChC,CAAC,IAAI,CAAC1B,KAAK,CAAC4D,2BAA2B,EAEvC;IAEF,IAAI,CAAC5B,UAAU,CAACQ,IAAI,CAAC,MAAM;MACzB,IAAI,CAACtC,IAAI,GAAG,IAAI,CAACA,IAAI,CAClBE,GAAG,CAAC,MAAM,EAAE;QAAE0B,IAAI,EAAE;MAAgC,CAAC,CAAC,CACtDW,GAAG,CAAC,IAAI,CAACzC,KAAK,CAAC0B,oBAA8B,CAAC,CAC9CjB,EAAE,CAAC,CAAC,CACJgC,GAAG,CAAC,GAAG,CAAC;MAEX,IAAI,CAACvC,IAAI,GAAG,IAAI,CAACA,IAAI,CAClBE,GAAG,CAAC,MAAM,EAAE;QAAE0B,IAAI,EAAE;MAAyC,CAAC,CAAC,CAC/DW,GAAG,CAAC,IAAI,CAACzC,KAAK,CAAC4D,2BAAqC,CAAC,CACrDnD,EAAE,CAAC,CAAC,CACJgC,GAAG,CAAC,GAAG,CAAC;IACb,CAAC,CAAC;EACJ;AACF;AAEA,eAAe3C,sBAAsB"}
|
|
@@ -1,27 +1,23 @@
|
|
|
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
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { cosmiconfig } from 'cosmiconfig';
|
|
4
5
|
import chalk from 'chalk';
|
|
5
6
|
import { ANDROID_THEME_CONFIG_KEY, IOS_THEME_CONFIG_KEY } from './Theme';
|
|
6
|
-
|
|
7
7
|
class Configuration {
|
|
8
8
|
constructor() {
|
|
9
9
|
_defineProperty(this, "config", void 0);
|
|
10
10
|
}
|
|
11
|
-
|
|
12
11
|
async loadConfig() {
|
|
13
12
|
if (this.config) return this.config;
|
|
14
|
-
|
|
15
13
|
try {
|
|
16
14
|
const explorer = cosmiconfig('persona', {
|
|
17
15
|
packageProp: 'persona'
|
|
18
16
|
});
|
|
19
17
|
const result = await explorer.search();
|
|
20
|
-
|
|
21
18
|
if (result == null) {
|
|
22
19
|
return null;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
21
|
this.config = result.config;
|
|
26
22
|
return this.config;
|
|
27
23
|
} catch (e) {
|
|
@@ -29,21 +25,16 @@ class Configuration {
|
|
|
29
25
|
process.exit(1);
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
async get() {
|
|
34
29
|
let config = await this.loadConfig();
|
|
35
30
|
const androidThemeLines = [];
|
|
36
|
-
|
|
37
31
|
for (const key in ANDROID_THEME_CONFIG_KEY) {
|
|
38
32
|
androidThemeLines.push(` "${key}": null`);
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
const iosThemeLines = [];
|
|
42
|
-
|
|
43
35
|
for (const key in IOS_THEME_CONFIG_KEY) {
|
|
44
36
|
iosThemeLines.push(` "${key}": null`);
|
|
45
37
|
}
|
|
46
|
-
|
|
47
38
|
if (config == null) {
|
|
48
39
|
console.log(`
|
|
49
40
|
Missing configuration.
|
|
@@ -72,11 +63,8 @@ and re-run this tool :).
|
|
|
72
63
|
`);
|
|
73
64
|
process.exit(1);
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
return config;
|
|
77
67
|
}
|
|
78
|
-
|
|
79
68
|
}
|
|
80
|
-
|
|
81
69
|
export default new Configuration();
|
|
82
70
|
//# sourceMappingURL=Config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["cosmiconfig","chalk","ANDROID_THEME_CONFIG_KEY","IOS_THEME_CONFIG_KEY","Configuration","constructor","_defineProperty","loadConfig","config","explorer","packageProp","result","search","e","console","error","process","exit","get","androidThemeLines","key","push","iosThemeLines","log","yellow","join"],"sources":["Config.ts"],"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"],"mappings":";;;AAAA,SAASA,WAAW,QAAQ,aAAa;AACzC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,wBAAwB,EAAEC,oBAAoB,QAAQ,SAAS;AAOxE,MAAMC,aAAa,CAAC;EAAAC,YAAA;IAAAC,eAAA;EAAA;EAGlB,MAAMC,UAAUA,CAAA,EAA6C;IAC3D,IAAI,IAAI,CAACC,MAAM,EAAE,OAAO,IAAI,CAACA,MAAM;IAEnC,IAAI;MACF,MAAMC,QAAQ,GAAGT,WAAW,CAAC,SAAS,EAAE;QAAEU,WAAW,EAAE;MAAU,CAAC,CAAC;MACnE,MAAMC,MAAM,GAAG,MAAMF,QAAQ,CAACG,MAAM,CAAC,CAAC;MACtC,IAAID,MAAM,IAAI,IAAI,EAAE;QAClB,OAAO,IAAI;MACb;MAEA,IAAI,CAACH,MAAM,GAAGG,MAAM,CAACH,MAAM;MAE3B,OAAO,IAAI,CAACA,MAAM;IACpB,CAAC,CAAC,OAAOK,CAAC,EAAE;MACVC,OAAO,CAACC,KAAK,CAACF,CAAC,CAAC;MAChBG,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB;EACF;EAEA,MAAMC,GAAGA,CAAA,EAA0B;IACjC,IAAIV,MAAM,GAAG,MAAM,IAAI,CAACD,UAAU,CAAC,CAAC;IAEpC,MAAMY,iBAAiB,GAAG,EAAE;IAC5B,KAAK,MAAMC,GAAG,IAAIlB,wBAAwB,EAAE;MAC1CiB,iBAAiB,CAACE,IAAI,CAAE,UAASD,GAAI,SAAQ,CAAC;IAChD;IAEA,MAAME,aAAa,GAAG,EAAE;IACxB,KAAK,MAAMF,GAAG,IAAIjB,oBAAoB,EAAE;MACtCmB,aAAa,CAACD,IAAI,CAAE,UAASD,GAAI,SAAQ,CAAC;IAC5C;IAEA,IAAIZ,MAAM,IAAI,IAAI,EAAE;MAClBM,OAAO,CAACS,GAAG,CACR;AACT;AACA;AACA,2DAA2DtB,KAAK,CAACuB,MAAM,CAC7D,SACF,CAAE;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,GACSL,iBAAiB,CAACM,IAAI,CAAC,KAAK,CAAC,GAC5B;AACX;AACA;AACA,CAAC,GACSH,aAAa,CAACG,IAAI,CAAC,KAAK,CAAC,GACxB;AACX;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CACM,CAAC;MACDT,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;IACjB;IAEA,OAAOT,MAAM;EACf;AACF;AAEA,eAAe,IAAIJ,aAAa,CAAC,CAAC"}
|
|
@@ -2,9 +2,7 @@ import Table from 'cli-table';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import Config from './Config';
|
|
4
4
|
const COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;
|
|
5
|
-
export let ANDROID_THEME_CONFIG_KEY
|
|
6
|
-
|
|
7
|
-
(function (ANDROID_THEME_CONFIG_KEY) {
|
|
5
|
+
export let ANDROID_THEME_CONFIG_KEY = /*#__PURE__*/function (ANDROID_THEME_CONFIG_KEY) {
|
|
8
6
|
ANDROID_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
|
|
9
7
|
ANDROID_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
|
|
10
8
|
ANDROID_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
|
|
@@ -33,11 +31,9 @@ export let ANDROID_THEME_CONFIG_KEY;
|
|
|
33
31
|
ANDROID_THEME_CONFIG_KEY["loadingAnimationWidthPercent"] = "loadingAnimationWidthPercent";
|
|
34
32
|
ANDROID_THEME_CONFIG_KEY["selfieAnimationAsset"] = "selfieAnimationAsset";
|
|
35
33
|
ANDROID_THEME_CONFIG_KEY["selfieAnimationWidthPercent"] = "selfieAnimationWidthPercent";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export let IOS_THEME_CONFIG_KEY
|
|
39
|
-
|
|
40
|
-
(function (IOS_THEME_CONFIG_KEY) {
|
|
34
|
+
return ANDROID_THEME_CONFIG_KEY;
|
|
35
|
+
}({});
|
|
36
|
+
export let IOS_THEME_CONFIG_KEY = /*#__PURE__*/function (IOS_THEME_CONFIG_KEY) {
|
|
41
37
|
IOS_THEME_CONFIG_KEY["backgroundColor"] = "backgroundColor";
|
|
42
38
|
IOS_THEME_CONFIG_KEY["primaryColor"] = "primaryColor";
|
|
43
39
|
IOS_THEME_CONFIG_KEY["darkPrimaryColor"] = "darkPrimaryColor";
|
|
@@ -102,8 +98,8 @@ export let IOS_THEME_CONFIG_KEY;
|
|
|
102
98
|
IOS_THEME_CONFIG_KEY["selfieAnimationAssetName"] = "selfieAnimationAssetName";
|
|
103
99
|
IOS_THEME_CONFIG_KEY["selfieAnimationAssetWidth"] = "selfieAnimationAssetWidth";
|
|
104
100
|
IOS_THEME_CONFIG_KEY["selfieAnimationAssetHeight"] = "selfieAnimationAssetHeight";
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
return IOS_THEME_CONFIG_KEY;
|
|
102
|
+
}({});
|
|
107
103
|
class Theme {
|
|
108
104
|
async print() {
|
|
109
105
|
let platform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'android';
|
|
@@ -124,11 +120,9 @@ class Theme {
|
|
|
124
120
|
});
|
|
125
121
|
console.log('Specified theme values:');
|
|
126
122
|
const keyEnum = platform === 'android' ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;
|
|
127
|
-
|
|
128
123
|
for (const key in keyEnum) {
|
|
129
124
|
let override = themeConfig[key];
|
|
130
125
|
let colorOverride = key.includes('Color') || key.includes('color');
|
|
131
|
-
|
|
132
126
|
if (override) {
|
|
133
127
|
if (colorOverride) {
|
|
134
128
|
override = normalizeColor(override, key);
|
|
@@ -136,7 +130,6 @@ class Theme {
|
|
|
136
130
|
override = override.toString();
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
|
-
|
|
140
133
|
if (key.includes('Font')) {
|
|
141
134
|
if (platform == 'android') {
|
|
142
135
|
usesCustomFontAndroid = true;
|
|
@@ -144,53 +137,42 @@ class Theme {
|
|
|
144
137
|
usesCustomFontIos = true;
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
|
-
|
|
148
140
|
let row;
|
|
149
141
|
row = [key, override ? valueColor(colorOverride, override) : chalk.yellow('unspecified'), key.includes('Font') ? chalk.cyan('Fonts that are not built-in need to be installed.') : ''];
|
|
150
142
|
table.push(row);
|
|
151
143
|
}
|
|
152
|
-
|
|
153
144
|
console.log(table.toString());
|
|
154
|
-
|
|
155
145
|
if (usesCustomFontAndroid) {
|
|
156
146
|
console.log(chalk.yellow(' NOTE') + ': A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml');
|
|
157
147
|
}
|
|
158
|
-
|
|
159
148
|
if (usesCustomFontIos) {
|
|
160
149
|
console.log(chalk.yellow(' NOTE') + ': A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app');
|
|
161
|
-
}
|
|
162
|
-
|
|
150
|
+
}
|
|
163
151
|
|
|
152
|
+
// Add newline for spacing
|
|
164
153
|
console.log('');
|
|
165
154
|
}
|
|
155
|
+
}
|
|
166
156
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
157
|
+
// set default print color for non-color overrides
|
|
170
158
|
function valueColor(isColorOverride, override) {
|
|
171
159
|
return isColorOverride ? chalk.hex(override)(override) : chalk.magentaBright(override);
|
|
172
160
|
}
|
|
173
|
-
|
|
174
161
|
function normalizeColor(colorHex, themeKey) {
|
|
175
162
|
let hex = colorHex;
|
|
176
|
-
|
|
177
163
|
if (colorHex[0] === '#') {
|
|
178
164
|
hex = colorHex.slice(1);
|
|
179
165
|
}
|
|
180
|
-
|
|
181
166
|
if (!COLOR_REGEX.test(hex)) {
|
|
182
167
|
if (themeKey) {
|
|
183
168
|
console.error(`Received a color value of ${chalk.yellow(colorHex)} for ${chalk.red(themeKey)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk.bgHex('#FFFFFF').hex('#7E66B7')('#290087')}`);
|
|
184
169
|
} else {
|
|
185
170
|
console.error(`Received a color value of ${chalk.yellow(colorHex)}.\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk.bgHex('#FFFFFF').hex('#7E66B7')('#290087')}`);
|
|
186
171
|
}
|
|
187
|
-
|
|
188
172
|
console.log('');
|
|
189
173
|
process.exit(1);
|
|
190
174
|
}
|
|
191
|
-
|
|
192
175
|
return colorHex;
|
|
193
176
|
}
|
|
194
|
-
|
|
195
177
|
export default new Theme();
|
|
196
178
|
//# sourceMappingURL=Theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Theme.ts"],"names":["Table","chalk","Config","COLOR_REGEX","ANDROID_THEME_CONFIG_KEY","IOS_THEME_CONFIG_KEY","Theme","print","platform","config","get","themeConfig","androidTheme","iosTheme","usesCustomFontAndroid","usesCustomFontIos","head","table","chars","console","log","keyEnum","key","override","colorOverride","includes","normalizeColor","toString","row","valueColor","yellow","cyan","push","isColorOverride","hex","magentaBright","colorHex","themeKey","slice","test","error","red","bgHex","process","exit"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,WAAlB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AAEA,OAAOC,MAAP,MAAmB,UAAnB;AAEA,MAAMC,WAAW,GAAG,kBAApB;AAEA,WAAYC,wBAAZ;;WAAYA,wB;AAAAA,EAAAA,wB;AAAAA,EAAAA,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esContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\n\nimport Config from './Config';\n\nconst COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;\n\nexport enum ANDROID_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n\n // formLabelTextColor = \"formLabelTextColor\",\n // formLabelTextFont = \"formLabelTextFont\",\n\n textFieldTextColor = 'textFieldTextColor',\n textFieldTextFont = 'textFieldTextFont',\n\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n // buttonTextAlignment = \"buttonTextAlignment\",\n buttonCornerRadius = 'buttonCornerRadius',\n buttonFont = 'buttonFont',\n progressColor = 'progressColor',\n successAsset = 'successAsset',\n failAsset = 'failAsset',\n loadingAnimationAsset = 'loadingAnimationAsset',\n loadingAnimationWidthPercent = 'loadingAnimationWidthPercent',\n selfieAnimationAsset = 'selfieAnimationAsset',\n selfieAnimationWidthPercent = 'selfieAnimationWidthPercent',\n}\n\nexport enum IOS_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n errorColor = 'errorColor',\n errorTextFont = 'errorTextFont',\n overlayBackgroundColor = 'overlayBackgroundColor',\n titleTextAlignment = 'titleTextAlignment',\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n cardTitleTextFont = 'cardTitleTextFont',\n bodyTextAlignment = 'bodyTextAlignment',\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n formLabelTextColor = 'formLabelTextColor',\n formLabelTextFont = 'formLabelTextFont',\n textFieldTextColor = 'textFieldTextColor',\n textFieldBackgroundColor = 'textFieldBackgroundColor',\n textFieldBorderColor = 'textFieldBorderColor',\n textFieldCornerRadius = 'textFieldCornerRadius',\n textFieldFont = 'textFieldFont',\n textFieldPlaceholderFont = 'textFieldPlaceholderFont',\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n buttonTextAlignment = 'buttonTextAlignment',\n buttonImageTintColor = 'buttonImageTintColor',\n buttonCornerRadius = 'buttonCornerRadius',\n buttonBorderWidth = 'buttonBorderWidth',\n buttonBorderColor = 'buttonBorderColor',\n buttonFont = 'buttonFont',\n buttonSecondaryBackgroundColor = 'buttonSecondaryBackgroundColor',\n buttonSecondaryDisabledBackgroundColor = 'buttonSecondaryDisabledBackgroundColor',\n buttonSecondaryTouchedBackgroundColor = 'buttonSecondaryTouchedBackgroundColor',\n buttonSecondaryTextColor = 'buttonSecondaryTextColor',\n buttonSecondaryDisabledTextColor = 'buttonSecondaryDisabledTextColor',\n buttonSecondaryTextAlignment = 'buttonSecondaryTextAlignment',\n buttonSecondaryImageTintColor = 'buttonSecondaryImageTintColor',\n buttonSecondaryCornerRadius = 'buttonSecondaryCornerRadius',\n buttonSecondaryBorderWidth = 'buttonSecondaryBorderWidth',\n buttonSecondaryBorderColor = 'buttonSecondaryBorderColor',\n buttonSecondaryFont = 'buttonSecondaryFont',\n selectedCellBackgroundColor = 'selectedCellBackgroundColor',\n closeButtonTintColor = 'closeButtonTintColor',\n cancelButtonBackgroundColor = 'cancelButtonBackgroundColor',\n cancelButtonTextColor = 'cancelButtonTextColor',\n cancelButtonAlternateBackgroundColor = 'cancelButtonAlternateBackgroundColor',\n cancelButtonAlternateTextColor = 'cancelButtonAlternateTextColor',\n processingLabelsTextAlignment = 'processingLabelsTextAlignment',\n loadingAnimationAssetName = 'loadingAnimationAssetName',\n loadingAnimationAssetWidth = 'loadingAnimationAssetWidth',\n loadingAnimationAssetHeight = 'loadingAnimationAssetHeight',\n processingAnimationAssetName = 'processingAnimationAssetName',\n processingAnimationAssetWidth = 'processingAnimationAssetWidth',\n processingAnimationAssetHeight = 'processingAnimationAssetHeight',\n selfieAnimationAssetName = 'selfieAnimationAssetName',\n selfieAnimationAssetWidth = 'selfieAnimationAssetWidth',\n selfieAnimationAssetHeight = 'selfieAnimationAssetHeight',\n}\n\nexport type AndroidThemeObject = {\n [key in ANDROID_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type IosThemeObject = {\n [key in IOS_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type ThemeObject = AndroidThemeObject | IosThemeObject;\n\nclass Theme {\n async print(platform: string = 'android') {\n const config = await Config.get();\n const themeConfig =\n platform === 'android' ? config.androidTheme : config.iosTheme;\n let usesCustomFontAndroid = false;\n let usesCustomFontIos = false;\n\n const head =\n platform === 'android'\n ? ['Style Item', 'Value', 'Note']\n : ['Style Item', 'Value', 'Note'];\n\n const table = new Table({\n head,\n // prettier-ignore\n chars: { 'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n console.log('Specified theme values:');\n const keyEnum =\n platform === 'android' ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;\n for (const key in keyEnum) {\n let override =\n themeConfig[key as ANDROID_THEME_CONFIG_KEY | IOS_THEME_CONFIG_KEY];\n let colorOverride = key.includes('Color') || key.includes('color');\n\n if (override) {\n if (colorOverride) {\n override = normalizeColor(override, key);\n } else {\n override = override.toString();\n }\n }\n\n if (key.includes('Font')) {\n if (platform == 'android') {\n usesCustomFontAndroid = true;\n } else {\n usesCustomFontIos = true;\n }\n }\n\n let row;\n\n row = [\n key,\n override\n ? valueColor(colorOverride, override)\n : chalk.yellow('unspecified'),\n key.includes('Font')\n ? chalk.cyan('Fonts that are not built-in need to be installed.')\n : '',\n ];\n\n table.push(row);\n }\n\n console.log(table.toString());\n\n if (usesCustomFontAndroid) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml'\n );\n }\n\n if (usesCustomFontIos) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app'\n );\n }\n\n // Add newline for spacing\n console.log('');\n }\n}\n\n// set default print color for non-color overrides\nfunction valueColor(isColorOverride: boolean, override: string) {\n return isColorOverride\n ? chalk.hex(override)(override)\n : chalk.magentaBright(override);\n}\n\nfunction normalizeColor(colorHex: string, themeKey: string) {\n let hex = colorHex;\n if (colorHex[0] === '#') {\n hex = colorHex.slice(1);\n }\n\n if (!COLOR_REGEX.test(hex)) {\n if (themeKey) {\n console.error(\n `Received a color value of ${chalk.yellow(colorHex)} for ${chalk.red(\n themeKey\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n } else {\n console.error(\n `Received a color value of ${chalk.yellow(\n colorHex\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n }\n console.log('');\n process.exit(1);\n }\n\n return colorHex;\n}\n\nexport default new Theme();\n"]}
|
|
1
|
+
{"version":3,"names":["Table","chalk","Config","COLOR_REGEX","ANDROID_THEME_CONFIG_KEY","IOS_THEME_CONFIG_KEY","Theme","print","platform","arguments","length","undefined","config","get","themeConfig","androidTheme","iosTheme","usesCustomFontAndroid","usesCustomFontIos","head","table","chars","console","log","keyEnum","key","override","colorOverride","includes","normalizeColor","toString","row","valueColor","yellow","cyan","push","isColorOverride","hex","magentaBright","colorHex","themeKey","slice","test","error","red","bgHex","process","exit"],"sources":["Theme.ts"],"sourcesContent":["import Table from 'cli-table';\nimport chalk from 'chalk';\n\nimport Config from './Config';\n\nconst COLOR_REGEX = /^[a-zA-Z0-9]{6}$/;\n\nexport enum ANDROID_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n\n // formLabelTextColor = \"formLabelTextColor\",\n // formLabelTextFont = \"formLabelTextFont\",\n\n textFieldTextColor = 'textFieldTextColor',\n textFieldTextFont = 'textFieldTextFont',\n\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n // buttonTextAlignment = \"buttonTextAlignment\",\n buttonCornerRadius = 'buttonCornerRadius',\n buttonFont = 'buttonFont',\n progressColor = 'progressColor',\n successAsset = 'successAsset',\n failAsset = 'failAsset',\n loadingAnimationAsset = 'loadingAnimationAsset',\n loadingAnimationWidthPercent = 'loadingAnimationWidthPercent',\n selfieAnimationAsset = 'selfieAnimationAsset',\n selfieAnimationWidthPercent = 'selfieAnimationWidthPercent',\n}\n\nexport enum IOS_THEME_CONFIG_KEY {\n backgroundColor = 'backgroundColor',\n primaryColor = 'primaryColor',\n darkPrimaryColor = 'darkPrimaryColor',\n accentColor = 'accentColor',\n errorColor = 'errorColor',\n errorTextFont = 'errorTextFont',\n overlayBackgroundColor = 'overlayBackgroundColor',\n titleTextAlignment = 'titleTextAlignment',\n titleTextColor = 'titleTextColor',\n titleTextFont = 'titleTextFont',\n cardTitleTextFont = 'cardTitleTextFont',\n bodyTextAlignment = 'bodyTextAlignment',\n bodyTextColor = 'bodyTextColor',\n bodyTextFont = 'bodyTextFont',\n footnoteTextColor = 'footnoteTextColor',\n footnoteTextFont = 'footnoteTextFont',\n formLabelTextColor = 'formLabelTextColor',\n formLabelTextFont = 'formLabelTextFont',\n textFieldTextColor = 'textFieldTextColor',\n textFieldBackgroundColor = 'textFieldBackgroundColor',\n textFieldBorderColor = 'textFieldBorderColor',\n textFieldCornerRadius = 'textFieldCornerRadius',\n textFieldFont = 'textFieldFont',\n textFieldPlaceholderFont = 'textFieldPlaceholderFont',\n pickerTextColor = 'pickerTextColor',\n pickerTextFont = 'pickerTextFont',\n buttonBackgroundColor = 'buttonBackgroundColor',\n buttonDisabledBackgroundColor = 'buttonDisabledBackgroundColor',\n buttonTouchedBackgroundColor = 'buttonTouchedBackgroundColor',\n buttonTextColor = 'buttonTextColor',\n buttonDisabledTextColor = 'buttonDisabledTextColor',\n buttonTextAlignment = 'buttonTextAlignment',\n buttonImageTintColor = 'buttonImageTintColor',\n buttonCornerRadius = 'buttonCornerRadius',\n buttonBorderWidth = 'buttonBorderWidth',\n buttonBorderColor = 'buttonBorderColor',\n buttonFont = 'buttonFont',\n buttonSecondaryBackgroundColor = 'buttonSecondaryBackgroundColor',\n buttonSecondaryDisabledBackgroundColor = 'buttonSecondaryDisabledBackgroundColor',\n buttonSecondaryTouchedBackgroundColor = 'buttonSecondaryTouchedBackgroundColor',\n buttonSecondaryTextColor = 'buttonSecondaryTextColor',\n buttonSecondaryDisabledTextColor = 'buttonSecondaryDisabledTextColor',\n buttonSecondaryTextAlignment = 'buttonSecondaryTextAlignment',\n buttonSecondaryImageTintColor = 'buttonSecondaryImageTintColor',\n buttonSecondaryCornerRadius = 'buttonSecondaryCornerRadius',\n buttonSecondaryBorderWidth = 'buttonSecondaryBorderWidth',\n buttonSecondaryBorderColor = 'buttonSecondaryBorderColor',\n buttonSecondaryFont = 'buttonSecondaryFont',\n selectedCellBackgroundColor = 'selectedCellBackgroundColor',\n closeButtonTintColor = 'closeButtonTintColor',\n cancelButtonBackgroundColor = 'cancelButtonBackgroundColor',\n cancelButtonTextColor = 'cancelButtonTextColor',\n cancelButtonAlternateBackgroundColor = 'cancelButtonAlternateBackgroundColor',\n cancelButtonAlternateTextColor = 'cancelButtonAlternateTextColor',\n processingLabelsTextAlignment = 'processingLabelsTextAlignment',\n loadingAnimationAssetName = 'loadingAnimationAssetName',\n loadingAnimationAssetWidth = 'loadingAnimationAssetWidth',\n loadingAnimationAssetHeight = 'loadingAnimationAssetHeight',\n processingAnimationAssetName = 'processingAnimationAssetName',\n processingAnimationAssetWidth = 'processingAnimationAssetWidth',\n processingAnimationAssetHeight = 'processingAnimationAssetHeight',\n selfieAnimationAssetName = 'selfieAnimationAssetName',\n selfieAnimationAssetWidth = 'selfieAnimationAssetWidth',\n selfieAnimationAssetHeight = 'selfieAnimationAssetHeight',\n}\n\nexport type AndroidThemeObject = {\n [key in ANDROID_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type IosThemeObject = {\n [key in IOS_THEME_CONFIG_KEY]: string | null | undefined;\n};\n\nexport type ThemeObject = AndroidThemeObject | IosThemeObject;\n\nclass Theme {\n async print(platform: string = 'android') {\n const config = await Config.get();\n const themeConfig =\n platform === 'android' ? config.androidTheme : config.iosTheme;\n let usesCustomFontAndroid = false;\n let usesCustomFontIos = false;\n\n const head =\n platform === 'android'\n ? ['Style Item', 'Value', 'Note']\n : ['Style Item', 'Value', 'Note'];\n\n const table = new Table({\n head,\n // prettier-ignore\n chars: { 'mid': '', 'left-mid': '', 'mid-mid': '', 'right-mid': '' },\n });\n\n console.log('Specified theme values:');\n const keyEnum =\n platform === 'android' ? ANDROID_THEME_CONFIG_KEY : IOS_THEME_CONFIG_KEY;\n for (const key in keyEnum) {\n let override =\n themeConfig[key as ANDROID_THEME_CONFIG_KEY | IOS_THEME_CONFIG_KEY];\n let colorOverride = key.includes('Color') || key.includes('color');\n\n if (override) {\n if (colorOverride) {\n override = normalizeColor(override, key);\n } else {\n override = override.toString();\n }\n }\n\n if (key.includes('Font')) {\n if (platform == 'android') {\n usesCustomFontAndroid = true;\n } else {\n usesCustomFontIos = true;\n }\n }\n\n let row;\n\n row = [\n key,\n override\n ? valueColor(colorOverride, override)\n : chalk.yellow('unspecified'),\n key.includes('Font')\n ? chalk.cyan('Fonts that are not built-in need to be installed.')\n : '',\n ];\n\n table.push(row);\n }\n\n console.log(table.toString());\n\n if (usesCustomFontAndroid) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in to the Android platform (https://github.com/react-native-training/react-native-fonts#android), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.android.com/guide/topics/ui/look-and-feel/fonts-in-xml'\n );\n }\n\n if (usesCustomFontIos) {\n console.log(\n chalk.yellow(' NOTE') +\n ': A font customization was made. If the font is not built-in iOS (https://github.com/react-native-training/react-native-ios), then the font(s) must first be installed. A guide to install a font can be found here: https://developer.apple.com/documentation/uikit/text_display_and_fonts/adding_a_custom_font_to_your_app'\n );\n }\n\n // Add newline for spacing\n console.log('');\n }\n}\n\n// set default print color for non-color overrides\nfunction valueColor(isColorOverride: boolean, override: string) {\n return isColorOverride\n ? chalk.hex(override)(override)\n : chalk.magentaBright(override);\n}\n\nfunction normalizeColor(colorHex: string, themeKey: string) {\n let hex = colorHex;\n if (colorHex[0] === '#') {\n hex = colorHex.slice(1);\n }\n\n if (!COLOR_REGEX.test(hex)) {\n if (themeKey) {\n console.error(\n `Received a color value of ${chalk.yellow(colorHex)} for ${chalk.red(\n themeKey\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n } else {\n console.error(\n `Received a color value of ${chalk.yellow(\n colorHex\n )}.\\nFormat must follow standard 6 character hexadecimal color code. Eg. ${chalk\n .bgHex('#FFFFFF')\n .hex('#7E66B7')('#290087')}`\n );\n }\n console.log('');\n process.exit(1);\n }\n\n return colorHex;\n}\n\nexport default new Theme();\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,WAAW;AAC7B,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,UAAU;AAE7B,MAAMC,WAAW,GAAG,kBAAkB;AAEtC,WAAYC,wBAAwB,0BAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAxBA,wBAAwB;EAAA,OAAxBA,wBAAwB;AAAA;AAyCpC,WAAYC,oBAAoB,0BAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,oBAAoB;EAApBA,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EJ,QACF,CAAE,0EAAyEvC,KAAK,CAC7E4C,KAAK,CAAC,SAAS,CAAC,CAChBR,GAAG,CAAC,SAAS,CAAC,CAAC,SAAS,CAAE,EAC/B,CAAC;IACH,CAAC,MAAM;MACLf,OAAO,CAACqB,KAAK,CACV,6BAA4B1C,KAAK,CAACgC,MAAM,CACvCM,QACF,CAAE,0EAAyEtC,KAAK,CAC7E4C,KAAK,CAAC,SAAS,CAAC,CAChBR,GAAG,CAAC,SAAS,CAAC,CAAC,SAAS,CAAE,EAC/B,CAAC;IACH;IACAf,OAAO,CAACC,GAAG,CAAC,EAAE,CAAC;IACfuB,OAAO,CAACC,IAAI,CAAC,CAAC,CAAC;EACjB;EAEA,OAAOR,QAAQ;AACjB;AAEA,eAAe,IAAIjC,KAAK,CAAC,CAAC"}
|
|
@@ -7,27 +7,22 @@ console.log('============================================');
|
|
|
7
7
|
console.log('Persona React Native SDK customization tool.');
|
|
8
8
|
console.log('============================================');
|
|
9
9
|
console.log('');
|
|
10
|
-
|
|
11
10
|
const run = async () => {
|
|
12
11
|
// Run this once to print warning messages if it's not configured.
|
|
13
12
|
await Config.get();
|
|
14
13
|
const {
|
|
15
14
|
choice
|
|
16
15
|
} = await whatWouldYouLikePrompt();
|
|
17
|
-
|
|
18
16
|
switch (choice) {
|
|
19
17
|
case TOOL_CHOICE.AndroidTheme:
|
|
20
18
|
await AndroidThemeGenerator.run();
|
|
21
19
|
break;
|
|
22
|
-
|
|
23
20
|
case TOOL_CHOICE.iosTheme:
|
|
24
21
|
await IosThemeInstructions.run();
|
|
25
22
|
break;
|
|
26
|
-
|
|
27
23
|
default:
|
|
28
24
|
return;
|
|
29
25
|
}
|
|
30
26
|
};
|
|
31
|
-
|
|
32
27
|
run();
|
|
33
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["Config","TOOL_CHOICE","whatWouldYouLikePrompt","AndroidThemeGenerator","IosThemeInstructions","console","log","run","get","choice","AndroidTheme","iosTheme"],"sources":["index.ts"],"sourcesContent":["import Config from './Config';\nimport { TOOL_CHOICE, whatWouldYouLikePrompt } from './prompts';\nimport AndroidThemeGenerator from './tools/AndroidThemeGenerator';\nimport IosThemeInstructions from './tools/IosThemeInstructions';\n\nconsole.log('');\nconsole.log('============================================');\nconsole.log('Persona React Native SDK customization tool.');\nconsole.log('============================================');\nconsole.log('');\n\nconst run = async () => {\n // Run this once to print warning messages if it's not configured.\n await Config.get();\n\n const { choice } = await whatWouldYouLikePrompt();\n\n switch (choice) {\n case TOOL_CHOICE.AndroidTheme:\n await AndroidThemeGenerator.run();\n break;\n case TOOL_CHOICE.iosTheme:\n await IosThemeInstructions.run();\n break;\n default:\n return;\n }\n};\n\nrun();\n"],"mappings":"AAAA,OAAOA,MAAM,MAAM,UAAU;AAC7B,SAASC,WAAW,EAAEC,sBAAsB,QAAQ,WAAW;AAC/D,OAAOC,qBAAqB,MAAM,+BAA+B;AACjE,OAAOC,oBAAoB,MAAM,8BAA8B;AAE/DC,OAAO,CAACC,GAAG,CAAC,EAAE,CAAC;AACfD,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;AAC3DD,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;AAC3DD,OAAO,CAACC,GAAG,CAAC,8CAA8C,CAAC;AAC3DD,OAAO,CAACC,GAAG,CAAC,EAAE,CAAC;AAEf,MAAMC,GAAG,GAAG,MAAAA,CAAA,KAAY;EACtB;EACA,MAAMP,MAAM,CAACQ,GAAG,CAAC,CAAC;EAElB,MAAM;IAAEC;EAAO,CAAC,GAAG,MAAMP,sBAAsB,CAAC,CAAC;EAEjD,QAAQO,MAAM;IACZ,KAAKR,WAAW,CAACS,YAAY;MAC3B,MAAMP,qBAAqB,CAACI,GAAG,CAAC,CAAC;MACjC;IACF,KAAKN,WAAW,CAACU,QAAQ;MACvB,MAAMP,oBAAoB,CAACG,GAAG,CAAC,CAAC;MAChC;IACF;MACE;EACJ;AACF,CAAC;AAEDA,GAAG,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["inquirer","TOOL_CHOICE","AndroidTheme","iosTheme","whatWouldYouLikePrompt","questions","name","type","choices","message","prompt","confirmThemeValues","confirmResourceFiles"],"sources":["prompts.ts"],"sourcesContent":["import inquirer, { QuestionCollection } from 'inquirer';\n\nexport const TOOL_CHOICE = {\n AndroidTheme: 'Update Android theme',\n iosTheme: 'Update iOS theme',\n};\nexport async function whatWouldYouLikePrompt() {\n const questions = {\n name: 'choice',\n type: 'list',\n choices: [TOOL_CHOICE.AndroidTheme, TOOL_CHOICE.iosTheme],\n message: 'What would you like to do?',\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n\nexport async function confirmThemeValues() {\n const questions = {\n name: 'isConfirmed',\n type: 'confirm',\n message: 'Do these values look right?',\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n\nexport async function confirmResourceFiles() {\n const questions = {\n name: 'isConfirmed',\n type: 'confirm',\n message: `Continue?`,\n } as QuestionCollection;\n\n return inquirer.prompt(questions);\n}\n"],"mappings":"AAAA,OAAOA,QAAQ,MAA8B,UAAU;AAEvD,OAAO,MAAMC,WAAW,GAAG;EACzBC,YAAY,EAAE,sBAAsB;EACpCC,QAAQ,EAAE;AACZ,CAAC;AACD,OAAO,eAAeC,sBAAsBA,CAAA,EAAG;EAC7C,MAAMC,SAAS,GAAG;IAChBC,IAAI,EAAE,QAAQ;IACdC,IAAI,EAAE,MAAM;IACZC,OAAO,EAAE,CAACP,WAAW,CAACC,YAAY,EAAED,WAAW,CAACE,QAAQ,CAAC;IACzDM,OAAO,EAAE;EACX,CAAuB;EAEvB,OAAOT,QAAQ,CAACU,MAAM,CAACL,SAAS,CAAC;AACnC;AAEA,OAAO,eAAeM,kBAAkBA,CAAA,EAAG;EACzC,MAAMN,SAAS,GAAG;IAChBC,IAAI,EAAE,aAAa;IACnBC,IAAI,EAAE,SAAS;IACfE,OAAO,EAAE;EACX,CAAuB;EAEvB,OAAOT,QAAQ,CAACU,MAAM,CAACL,SAAS,CAAC;AACnC;AAEA,OAAO,eAAeO,oBAAoBA,CAAA,EAAG;EAC3C,MAAMP,SAAS,GAAG;IAChBC,IAAI,EAAE,aAAa;IACnBC,IAAI,EAAE,SAAS;IACfE,OAAO,EAAG;EACZ,CAAuB;EAEvB,OAAOT,QAAQ,CAACU,MAAM,CAACL,SAAS,CAAC;AACnC"}
|
|
@@ -8,19 +8,16 @@ import Configuration from '../Config';
|
|
|
8
8
|
const ANDROID_STYLES_RESOURCE_PATH = './android/app/src/main/res/values/styles_persona.xml';
|
|
9
9
|
const ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH = './android/app/src/main/res/drawable/rn_persona_button.xml';
|
|
10
10
|
const ANDROID_BUTTON_COLOR_RESOURCE_PATH = './android/app/src/main/res/color/rn_persona_button.xml';
|
|
11
|
-
|
|
12
11
|
class ThemeGenerator {
|
|
13
12
|
async run() {
|
|
14
13
|
await Theme.print();
|
|
15
14
|
const {
|
|
16
15
|
isConfirmed: themeValuesConfirmed
|
|
17
16
|
} = await confirmThemeValues();
|
|
18
|
-
|
|
19
17
|
if (!themeValuesConfirmed) {
|
|
20
18
|
console.log(chalk.yellow('\nPlease adjust the values in package.json.\n'));
|
|
21
19
|
return;
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
console.log(`\n${chalk.yellow('Creating an Android Resource files for your project at:')}\n
|
|
25
22
|
- ${ANDROID_STYLES_RESOURCE_PATH}
|
|
26
23
|
- ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}
|
|
@@ -36,12 +33,11 @@ class ThemeGenerator {
|
|
|
36
33
|
let {
|
|
37
34
|
isConfirmed: confirmed
|
|
38
35
|
} = await confirmResourceFiles();
|
|
39
|
-
|
|
40
36
|
if (!confirmed) {
|
|
41
37
|
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
|
|
38
|
+
}
|
|
44
39
|
|
|
40
|
+
// Add a line after confirmation
|
|
45
41
|
console.log('');
|
|
46
42
|
fs.mkdirSync(path.dirname(ANDROID_STYLES_RESOURCE_PATH), {
|
|
47
43
|
recursive: true
|
|
@@ -65,8 +61,6 @@ class ThemeGenerator {
|
|
|
65
61
|
}));
|
|
66
62
|
console.log(`${chalk.green('Saved an Android color file at path:')} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`);
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
}
|
|
70
|
-
|
|
71
65
|
export default new ThemeGenerator();
|
|
72
66
|
//# sourceMappingURL=AndroidThemeGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"names":["fs","chalk","path","Theme","confirmThemeValues","confirmResourceFiles","AndroidResourcePrinter","Configuration","ANDROID_STYLES_RESOURCE_PATH","ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH","ANDROID_BUTTON_COLOR_RESOURCE_PATH","ThemeGenerator","run","print","isConfirmed","themeValuesConfirmed","console","log","yellow","config","get","theme","androidTheme","style","buttonDrawable","buttonColor","process","confirmed","exit","mkdirSync","dirname","recursive","writeFileSync","end","prettyPrint","green"],"sources":["AndroidThemeGenerator.ts"],"sourcesContent":["import fs from 'fs';\nimport chalk from 'chalk';\nimport path from 'path';\n\nimport Theme, { AndroidThemeObject } from '../Theme';\nimport { confirmThemeValues, confirmResourceFiles } from '../prompts';\nimport AndroidResourcePrinter from '../AndroidResourcePrinter';\nimport Configuration from '../Config';\n\nconst ANDROID_STYLES_RESOURCE_PATH =\n './android/app/src/main/res/values/styles_persona.xml';\nconst ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH =\n './android/app/src/main/res/drawable/rn_persona_button.xml';\nconst ANDROID_BUTTON_COLOR_RESOURCE_PATH =\n './android/app/src/main/res/color/rn_persona_button.xml';\n\nclass ThemeGenerator {\n async run() {\n await Theme.print();\n\n const { isConfirmed: themeValuesConfirmed } = await confirmThemeValues();\n\n if (!themeValuesConfirmed) {\n console.log(\n chalk.yellow('\\nPlease adjust the values in package.json.\\n')\n );\n return;\n }\n\n console.log(\n `\\n${chalk.yellow(\n 'Creating an Android Resource files for your project at:'\n )}\\n\n - ${ANDROID_STYLES_RESOURCE_PATH}\n - ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}\n - ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}\\n`\n );\n console.log(\n 'Building your application with this resource file themes your Persona Inquiry flow.\\n'\n );\n\n const config = await Configuration.get();\n const theme = config.androidTheme as AndroidThemeObject;\n\n const { style, buttonDrawable, buttonColor } = new AndroidResourcePrinter(\n theme\n ).process();\n\n let { isConfirmed: confirmed } = await confirmResourceFiles();\n\n if (!confirmed) {\n process.exit(1);\n }\n\n // Add a line after confirmation\n console.log('');\n\n fs.mkdirSync(path.dirname(ANDROID_STYLES_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_STYLES_RESOURCE_PATH,\n style.end({ prettyPrint: true })\n );\n\n console.log(\n `${chalk.green(\n 'Saved an Android style file at path:'\n )} ${ANDROID_STYLES_RESOURCE_PATH}.`\n );\n\n fs.mkdirSync(path.dirname(ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH,\n buttonDrawable.end({ prettyPrint: true })\n );\n console.log(\n `${chalk.green(\n 'Saved an Android drawable file at path:'\n )} ${ANDROID_BUTTON_DRAWABLE_RESOURCE_PATH}.`\n );\n\n fs.mkdirSync(path.dirname(ANDROID_BUTTON_COLOR_RESOURCE_PATH), {\n recursive: true,\n });\n fs.writeFileSync(\n ANDROID_BUTTON_COLOR_RESOURCE_PATH,\n buttonColor.end({ prettyPrint: true })\n );\n console.log(\n `${chalk.green(\n 'Saved an Android color file at path:'\n )} ${ANDROID_BUTTON_COLOR_RESOURCE_PATH}.`\n );\n }\n}\n\n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