@pi-spi/app 1.5.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -30
- package/example/App.tsx +27 -24
- package/lib/module/core/assets.js +0 -7
- package/lib/module/core/assets.js.map +1 -1
- package/lib/module/core/di.js +17 -8
- package/lib/module/core/di.js.map +1 -1
- package/lib/module/core/pi_spi_custom_theme.js +22 -10
- package/lib/module/core/pi_spi_custom_theme.js.map +1 -1
- package/lib/module/core/pi_spi_sdk_config.js +22 -8
- package/lib/module/core/pi_spi_sdk_config.js.map +1 -1
- package/lib/module/core/theme.js +345 -225
- package/lib/module/core/theme.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/l10n/app_localizations.js.map +1 -1
- package/lib/module/l10n/app_localizations_en.js +26 -1
- package/lib/module/l10n/app_localizations_en.js.map +1 -1
- package/lib/module/l10n/app_localizations_fr.js +26 -1
- package/lib/module/l10n/app_localizations_fr.js.map +1 -1
- package/lib/module/l10n/app_localizations_pt.js +26 -1
- package/lib/module/l10n/app_localizations_pt.js.map +1 -1
- package/lib/module/modules/alias/presentation/pages/alias_delete_btn_widget.js +15 -19
- package/lib/module/modules/alias/presentation/pages/alias_delete_btn_widget.js.map +1 -1
- package/lib/module/modules/alias/presentation/pages/alias_page_claim.js +4 -11
- package/lib/module/modules/alias/presentation/pages/alias_page_claim.js.map +1 -1
- package/lib/module/modules/compte/presentation/pages/compte_details_widget.js +6 -7
- package/lib/module/modules/compte/presentation/pages/compte_details_widget.js.map +1 -1
- package/lib/module/modules/config/domain/models/config_keys.js +3 -1
- package/lib/module/modules/config/domain/models/config_keys.js.map +1 -1
- package/lib/module/modules/config/domain/services/config_service.js +31 -2
- package/lib/module/modules/config/domain/services/config_service.js.map +1 -1
- package/lib/module/modules/home/presentation/pages/home_tab_compte.js +0 -1
- package/lib/module/modules/home/presentation/pages/home_tab_compte.js.map +1 -1
- package/lib/module/modules/home/presentation/pages/home_tab_compte_more_menu.js +38 -37
- package/lib/module/modules/home/presentation/pages/home_tab_compte_more_menu.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/compte/profile_compte_page.js +25 -11
- package/lib/module/modules/profile/presentation/pages/compte/profile_compte_page.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page.js +14 -20
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications.js +109 -103
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications_son.js +55 -72
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications_son.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_qrcode.js +31 -45
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_qrcode.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_theme.js +175 -203
- package/lib/module/modules/profile/presentation/pages/parametre/profile_parametre_page_theme.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_app_bar.js +26 -0
- package/lib/module/modules/profile/presentation/pages/profile_app_bar.js.map +1 -0
- package/lib/module/modules/profile/presentation/pages/profile_menu.js +144 -34
- package/lib/module/modules/profile/presentation/pages/profile_menu.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page.js +95 -63
- package/lib/module/modules/profile/presentation/pages/profile_page.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_avatar.js +97 -45
- package/lib/module/modules/profile/presentation/pages/profile_page_avatar.js.map +1 -1
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts.js +9 -8
- package/lib/module/modules/profile/presentation/pages/profile_page_contacts.js.map +1 -1
- package/lib/module/modules/search/presentation/pages/search_fonctionnalites.js +26 -2
- package/lib/module/modules/search/presentation/pages/search_fonctionnalites.js.map +1 -1
- package/lib/module/modules/search/presentation/pages/search_page.js +0 -1
- package/lib/module/modules/search/presentation/pages/search_page.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_recu.js +3 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_details/transaction_details_page_recu.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page.js +4 -11
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.js +13 -10
- package/lib/module/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_search/transaction_search_page_filters.js +5 -4
- package/lib/module/modules/transactions/presentation/pages/transaction_search/transaction_search_page_filters.js.map +1 -1
- package/lib/module/modules/transactions/presentation/pages/transaction_split/transaction_split_page_repartition.js +2 -2
- package/lib/module/modules/transactions/presentation/pages/transaction_split/transaction_split_page_repartition.js.map +1 -1
- package/lib/module/pi_spi_sdk_entry.js +7 -2
- package/lib/module/pi_spi_sdk_entry.js.map +1 -1
- package/lib/module/shared/utils/color.js +15 -0
- package/lib/module/shared/utils/color.js.map +1 -0
- package/lib/module/shared/widgets/custom_progressbar.js +3 -2
- package/lib/module/shared/widgets/custom_progressbar.js.map +1 -1
- package/lib/module/shared/widgets/error_card_widget.js +70 -0
- package/lib/module/shared/widgets/error_card_widget.js.map +1 -0
- package/lib/module/shared/widgets/selection.js +136 -0
- package/lib/module/shared/widgets/selection.js.map +1 -0
- package/lib/typescript/src/core/assets.d.ts +0 -7
- package/lib/typescript/src/core/assets.d.ts.map +1 -1
- package/lib/typescript/src/core/di.d.ts.map +1 -1
- package/lib/typescript/src/core/pi_spi_custom_theme.d.ts +17 -8
- package/lib/typescript/src/core/pi_spi_custom_theme.d.ts.map +1 -1
- package/lib/typescript/src/core/pi_spi_sdk_config.d.ts +22 -8
- package/lib/typescript/src/core/pi_spi_sdk_config.d.ts.map +1 -1
- package/lib/typescript/src/core/theme.d.ts +123 -53
- package/lib/typescript/src/core/theme.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations.d.ts +50 -0
- package/lib/typescript/src/l10n/app_localizations.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_en.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_fr.d.ts.map +1 -1
- package/lib/typescript/src/l10n/app_localizations_pt.d.ts.map +1 -1
- package/lib/typescript/src/modules/alias/presentation/pages/alias_delete_btn_widget.d.ts.map +1 -1
- package/lib/typescript/src/modules/alias/presentation/pages/alias_page_claim.d.ts.map +1 -1
- package/lib/typescript/src/modules/compte/presentation/pages/compte_details_widget.d.ts.map +1 -1
- package/lib/typescript/src/modules/config/domain/models/config_keys.d.ts +3 -1
- package/lib/typescript/src/modules/config/domain/models/config_keys.d.ts.map +1 -1
- package/lib/typescript/src/modules/config/domain/services/config_service.d.ts +7 -0
- package/lib/typescript/src/modules/config/domain/services/config_service.d.ts.map +1 -1
- package/lib/typescript/src/modules/home/presentation/pages/home_tab_compte_more_menu.d.ts +2 -0
- package/lib/typescript/src/modules/home/presentation/pages/home_tab_compte_more_menu.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/compte/profile_compte_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications_son.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page_qrcode.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page_theme.d.ts +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/parametre/profile_parametre_page_theme.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_app_bar.d.ts +5 -0
- package/lib/typescript/src/modules/profile/presentation/pages/profile_app_bar.d.ts.map +1 -0
- package/lib/typescript/src/modules/profile/presentation/pages/profile_menu.d.ts +31 -4
- package/lib/typescript/src/modules/profile/presentation/pages/profile_menu.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page.d.ts +4 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_avatar.d.ts +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_avatar.d.ts.map +1 -1
- package/lib/typescript/src/modules/profile/presentation/pages/profile_page_contacts.d.ts.map +1 -1
- package/lib/typescript/src/modules/search/presentation/pages/search_fonctionnalites.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page.d.ts.map +1 -1
- package/lib/typescript/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.d.ts.map +1 -1
- package/lib/typescript/src/shared/utils/color.d.ts +7 -0
- package/lib/typescript/src/shared/utils/color.d.ts.map +1 -0
- package/lib/typescript/src/shared/widgets/custom_progressbar.d.ts.map +1 -1
- package/lib/typescript/src/shared/widgets/error_card_widget.d.ts +11 -0
- package/lib/typescript/src/shared/widgets/error_card_widget.d.ts.map +1 -0
- package/lib/typescript/src/shared/widgets/selection.d.ts +21 -0
- package/lib/typescript/src/shared/widgets/selection.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/core/assets.ts +0 -7
- package/src/core/di.ts +13 -8
- package/src/core/pi_spi_custom_theme.ts +22 -15
- package/src/core/pi_spi_sdk_config.ts +27 -9
- package/src/core/theme.ts +381 -269
- package/src/index.ts +1 -1
- package/src/l10n/app_localizations.ts +50 -0
- package/src/l10n/app_localizations_en.ts +25 -0
- package/src/l10n/app_localizations_fr.ts +25 -0
- package/src/l10n/app_localizations_pt.ts +25 -0
- package/src/modules/alias/presentation/pages/alias_delete_btn_widget.tsx +13 -12
- package/src/modules/alias/presentation/pages/alias_page_claim.tsx +5 -4
- package/src/modules/compte/presentation/pages/compte_details_widget.tsx +3 -4
- package/src/modules/config/domain/models/config_keys.ts +3 -1
- package/src/modules/config/domain/services/config_service.ts +31 -2
- package/src/modules/home/presentation/pages/home_tab_compte.tsx +1 -1
- package/src/modules/home/presentation/pages/home_tab_compte_more_menu.tsx +34 -42
- package/src/modules/profile/presentation/pages/compte/profile_compte_page.tsx +15 -7
- package/src/modules/profile/presentation/pages/parametre/profile_parametre_page.tsx +12 -17
- package/src/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications.tsx +89 -68
- package/src/modules/profile/presentation/pages/parametre/profile_parametre_page_notifications_son.tsx +84 -54
- package/src/modules/profile/presentation/pages/parametre/profile_parametre_page_qrcode.tsx +28 -24
- package/src/modules/profile/presentation/pages/parametre/profile_parametre_page_theme.tsx +121 -131
- package/src/modules/profile/presentation/pages/profile_app_bar.tsx +21 -0
- package/src/modules/profile/presentation/pages/profile_menu.tsx +126 -33
- package/src/modules/profile/presentation/pages/profile_page.tsx +90 -66
- package/src/modules/profile/presentation/pages/profile_page_avatar.tsx +69 -28
- package/src/modules/profile/presentation/pages/profile_page_contacts.tsx +5 -4
- package/src/modules/search/presentation/pages/search_fonctionnalites.ts +40 -7
- package/src/modules/search/presentation/pages/search_page.tsx +1 -1
- package/src/modules/transactions/presentation/pages/transaction_details/transaction_details_page_recu.tsx +3 -1
- package/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page.tsx +2 -4
- package/src/modules/transactions/presentation/pages/transaction_rtp/transaction_rtp_page_actions.tsx +13 -6
- package/src/modules/transactions/presentation/pages/transaction_search/transaction_search_page_filters.tsx +4 -4
- package/src/modules/transactions/presentation/pages/transaction_split/transaction_split_page_repartition.tsx +2 -2
- package/src/pi_spi_sdk_entry.tsx +9 -2
- package/src/shared/utils/color.ts +14 -0
- package/src/shared/widgets/custom_progressbar.tsx +3 -2
- package/src/shared/widgets/error_card_widget.tsx +58 -0
- package/src/shared/widgets/selection.tsx +98 -0
- package/assets/images/theme_light_blue.jpeg +0 -0
- package/assets/images/theme_light_green.jpeg +0 -0
- package/assets/images/theme_light_orange.jpeg +0 -0
- package/assets/images/theme_light_pink.jpeg +0 -0
- package/assets/images/theme_light_purple.jpeg +0 -0
- package/assets/images/theme_light_red.jpeg +0 -0
- package/assets/images/theme_light_yellow.jpeg +0 -0
package/lib/module/core/theme.js
CHANGED
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
4
|
import { Appearance } from 'react-native';
|
|
5
|
-
/**
|
|
5
|
+
/** Thème d'affichage du SDK : celui du téléphone, clair ou sombre. La valeur de chaque membre est sa codification (persistée dans les préférences). */
|
|
6
6
|
export let Themes = /*#__PURE__*/function (Themes) {
|
|
7
7
|
Themes["system"] = "System";
|
|
8
8
|
Themes["light"] = "lightTheme";
|
|
9
9
|
Themes["dark"] = "darkTheme";
|
|
10
|
-
Themes["yellow"] = "yellowTheme";
|
|
11
|
-
Themes["green"] = "greenTheme";
|
|
12
|
-
Themes["blue"] = "blueTheme";
|
|
13
|
-
Themes["red"] = "redTheme";
|
|
14
|
-
Themes["orange"] = "orangeTheme";
|
|
15
|
-
Themes["purple"] = "purpleTheme";
|
|
16
|
-
Themes["pink"] = "pinkTheme";
|
|
17
10
|
return Themes;
|
|
18
11
|
}({});
|
|
19
12
|
|
|
@@ -25,7 +18,7 @@ export let Themes = /*#__PURE__*/function (Themes) {
|
|
|
25
18
|
}
|
|
26
19
|
_Themes.fromCode = fromCode;
|
|
27
20
|
function list() {
|
|
28
|
-
return [Themes.system, Themes.light, Themes.dark
|
|
21
|
+
return [Themes.system, Themes.light, Themes.dark];
|
|
29
22
|
}
|
|
30
23
|
_Themes.list = list;
|
|
31
24
|
function label(theme, traductions) {
|
|
@@ -34,33 +27,143 @@ export let Themes = /*#__PURE__*/function (Themes) {
|
|
|
34
27
|
return traductions.appSettingPageMenuThemeLight;
|
|
35
28
|
case Themes.dark:
|
|
36
29
|
return traductions.appSettingPageMenuThemeDark;
|
|
37
|
-
case Themes.yellow:
|
|
38
|
-
return traductions.appSettingPageMenuThemeYellow;
|
|
39
|
-
case Themes.green:
|
|
40
|
-
return traductions.appSettingPageMenuThemeGreen;
|
|
41
|
-
case Themes.blue:
|
|
42
|
-
return traductions.appSettingPageMenuThemeBlue;
|
|
43
|
-
case Themes.red:
|
|
44
|
-
return traductions.appSettingPageMenuThemeRed;
|
|
45
|
-
case Themes.orange:
|
|
46
|
-
return traductions.appSettingPageMenuThemeOrange;
|
|
47
|
-
case Themes.purple:
|
|
48
|
-
return traductions.appSettingPageMenuThemePurple;
|
|
49
|
-
case Themes.pink:
|
|
50
|
-
return traductions.appSettingPageMenuThemePink;
|
|
51
30
|
default:
|
|
52
31
|
return traductions.appSettingPageMenuThemeDefault;
|
|
53
32
|
}
|
|
54
33
|
}
|
|
55
34
|
_Themes.label = label;
|
|
56
35
|
})(Themes || (Themes = {}));
|
|
36
|
+
/** Teintes d'une couleur d'accentuation pour un thème clair ou sombre. */
|
|
37
|
+
/**
|
|
38
|
+
* Couleur d'accentuation, indépendante du thème clair ou sombre. Chaque
|
|
39
|
+
* couleur a une teinte pour le clair et une, plus lumineuse, pour le
|
|
40
|
+
* sombre ; contrastes vérifiés (texte ≥ 4,5:1, bouton ≥ 3:1).
|
|
41
|
+
*/
|
|
42
|
+
export let Accents = /*#__PURE__*/function (Accents) {
|
|
43
|
+
Accents["pispi"] = "pispi";
|
|
44
|
+
Accents["vert"] = "vert";
|
|
45
|
+
Accents["bleu"] = "bleu";
|
|
46
|
+
Accents["rouge"] = "rouge";
|
|
47
|
+
Accents["orange"] = "orange";
|
|
48
|
+
Accents["violet"] = "violet";
|
|
49
|
+
Accents["rose"] = "rose";
|
|
50
|
+
Accents["turquoise"] = "turquoise";
|
|
51
|
+
Accents["terracotta"] = "terracotta";
|
|
52
|
+
Accents["bordeaux"] = "bordeaux";
|
|
53
|
+
Accents["ardoise"] = "ardoise";
|
|
54
|
+
return Accents;
|
|
55
|
+
}({});
|
|
56
|
+
const teintes = (accent, surAccent, appui, texte, conteneur, surConteneur, tertiaire) => ({
|
|
57
|
+
accent,
|
|
58
|
+
surAccent,
|
|
59
|
+
appui,
|
|
60
|
+
texte,
|
|
61
|
+
conteneur,
|
|
62
|
+
surConteneur,
|
|
63
|
+
tertiaire
|
|
64
|
+
});
|
|
65
|
+
const ACCENTS = {
|
|
66
|
+
[Accents.pispi]: {
|
|
67
|
+
clair: teintes('#F2A900', '#000000', '#E1A009', '#9A6B00', '#F9EBC2', '#000000', '#FFD573'),
|
|
68
|
+
sombre: teintes('#F2A900', '#1B1916', '#D99A06', '#F2A900', '#4A3B1C', '#FFDE9A', '#4A3B1C')
|
|
69
|
+
},
|
|
70
|
+
[Accents.vert]: {
|
|
71
|
+
clair: teintes('#43A047', '#000000', '#388E3C', '#2E7D32', '#D9F2D6', '#1B4D1E', '#A5D6A7'),
|
|
72
|
+
sombre: teintes('#66BB6A', '#1B1916', '#57A85B', '#66BB6A', '#1F3A20', '#B4E6B1', '#1F3A20')
|
|
73
|
+
},
|
|
74
|
+
[Accents.bleu]: {
|
|
75
|
+
clair: teintes('#3B63DB', '#FFFFFF', '#3254BA', '#3B63DB', '#DCE4FB', '#1C3378', '#7390E6'),
|
|
76
|
+
sombre: teintes('#7B9BFF', '#1B1916', '#6A88E6', '#7B9BFF', '#1F2A4D', '#C7D3FF', '#1F2A4D')
|
|
77
|
+
},
|
|
78
|
+
[Accents.rouge]: {
|
|
79
|
+
clair: teintes('#C62828', '#FFFFFF', '#A82222', '#C62828', '#F9D3D3', '#6E1414', '#E57373'),
|
|
80
|
+
sombre: teintes('#EF6F6C', '#1B1916', '#D96260', '#EF6F6C', '#4A1F1E', '#FFC9C7', '#4A1F1E')
|
|
81
|
+
},
|
|
82
|
+
[Accents.orange]: {
|
|
83
|
+
clair: teintes('#EF6C00', '#000000', '#D45F00', '#B85300', '#FFE0B2', '#6B3300', '#FFB74D'),
|
|
84
|
+
sombre: teintes('#FF9A3D', '#1B1916', '#E6893A', '#FF9A3D', '#4A2E14', '#FFD3A8', '#4A2E14')
|
|
85
|
+
},
|
|
86
|
+
[Accents.violet]: {
|
|
87
|
+
clair: teintes('#6A1B9A', '#FFFFFF', '#5A1783', '#6A1B9A', '#EBD7F3', '#3D0E5A', '#BA68C8'),
|
|
88
|
+
sombre: teintes('#C08BE0', '#1B1916', '#AD7BCB', '#C08BE0', '#37224A', '#EAD2FA', '#37224A')
|
|
89
|
+
},
|
|
90
|
+
[Accents.rose]: {
|
|
91
|
+
clair: teintes('#AD1457', '#FFFFFF', '#93114A', '#AD1457', '#F8D3E1', '#5E0B2F', '#F06292'),
|
|
92
|
+
sombre: teintes('#F06C9B', '#1B1916', '#D85F8A', '#F06C9B', '#4A1E30', '#FFC8DB', '#4A1E30')
|
|
93
|
+
},
|
|
94
|
+
[Accents.turquoise]: {
|
|
95
|
+
clair: teintes('#00897B', '#000000', '#00796B', '#00796B', '#D2EEEB', '#004D45', '#80CBC4'),
|
|
96
|
+
sombre: teintes('#4DB6AC', '#1B1916', '#42A39A', '#4DB6AC', '#173A37', '#B2E8E2', '#173A37')
|
|
97
|
+
},
|
|
98
|
+
[Accents.terracotta]: {
|
|
99
|
+
clair: teintes('#C2562E', '#000000', '#A8461F', '#A8461F', '#F8DDD2', '#6B2A12', '#F4A585'),
|
|
100
|
+
sombre: teintes('#F08A62', '#1B1916', '#D97A55', '#F08A62', '#4A2A1E', '#FFD2C0', '#4A2A1E')
|
|
101
|
+
},
|
|
102
|
+
[Accents.bordeaux]: {
|
|
103
|
+
clair: teintes('#8E2440', '#FFFFFF', '#761E35', '#8E2440', '#F3D3DC', '#4F1022', '#D98EA2'),
|
|
104
|
+
sombre: teintes('#E57A95', '#1B1916', '#CE6D85', '#E57A95', '#47212B', '#FFCCD9', '#47212B')
|
|
105
|
+
},
|
|
106
|
+
[Accents.ardoise]: {
|
|
107
|
+
clair: teintes('#546E7A', '#FFFFFF', '#455A64', '#546E7A', '#DDE5E9', '#263238', '#B0BEC5'),
|
|
108
|
+
sombre: teintes('#90A4AE', '#1B1916', '#7F929B', '#90A4AE', '#2C3438', '#D6E2E8', '#2C3438')
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
113
|
+
(function (_Accents) {
|
|
114
|
+
const parDefaut = _Accents.parDefaut = Accents.pispi;
|
|
115
|
+
function fromCode(code) {
|
|
116
|
+
if (code == null) return parDefaut;
|
|
117
|
+
return list().includes(code) ? code : parDefaut;
|
|
118
|
+
}
|
|
119
|
+
_Accents.fromCode = fromCode;
|
|
120
|
+
function list() {
|
|
121
|
+
return [Accents.pispi, Accents.vert, Accents.bleu, Accents.rouge, Accents.orange, Accents.violet, Accents.rose, Accents.turquoise, Accents.terracotta, Accents.bordeaux, Accents.ardoise];
|
|
122
|
+
}
|
|
123
|
+
_Accents.list = list;
|
|
124
|
+
function clair(accent) {
|
|
125
|
+
return ACCENTS[accent].clair;
|
|
126
|
+
}
|
|
127
|
+
_Accents.clair = clair;
|
|
128
|
+
function sombre(accent) {
|
|
129
|
+
return ACCENTS[accent].sombre;
|
|
130
|
+
}
|
|
131
|
+
_Accents.sombre = sombre;
|
|
132
|
+
function label(accent, traductions) {
|
|
133
|
+
switch (accent) {
|
|
134
|
+
case Accents.vert:
|
|
135
|
+
return traductions.appSettingPageAccentVert;
|
|
136
|
+
case Accents.bleu:
|
|
137
|
+
return traductions.appSettingPageAccentBleu;
|
|
138
|
+
case Accents.rouge:
|
|
139
|
+
return traductions.appSettingPageAccentRouge;
|
|
140
|
+
case Accents.orange:
|
|
141
|
+
return traductions.appSettingPageAccentOrange;
|
|
142
|
+
case Accents.violet:
|
|
143
|
+
return traductions.appSettingPageAccentViolet;
|
|
144
|
+
case Accents.rose:
|
|
145
|
+
return traductions.appSettingPageAccentRose;
|
|
146
|
+
case Accents.turquoise:
|
|
147
|
+
return traductions.appSettingPageAccentTurquoise;
|
|
148
|
+
case Accents.terracotta:
|
|
149
|
+
return traductions.appSettingPageAccentTerracotta;
|
|
150
|
+
case Accents.bordeaux:
|
|
151
|
+
return traductions.appSettingPageAccentBordeaux;
|
|
152
|
+
case Accents.ardoise:
|
|
153
|
+
return traductions.appSettingPageAccentArdoise;
|
|
154
|
+
default:
|
|
155
|
+
// Couleur de base de PI-SPI, proposée comme « Défaut »
|
|
156
|
+
return traductions.appSettingPageAccentDefaut;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
_Accents.label = label;
|
|
160
|
+
})(Accents || (Accents = {}));
|
|
57
161
|
/** Styles de texte, mêmes noms que le `TextTheme` Material des écrans Flutter. */
|
|
58
162
|
/**
|
|
59
163
|
* Équivalent React Native du `ThemeData` Material des thèmes Flutter du
|
|
60
164
|
* SDK : uniquement les propriétés réellement utilisées par ses écrans.
|
|
61
165
|
* Accessible dans les composants via {@link useTheme} (≈ `Theme.of(context)`).
|
|
62
166
|
*/
|
|
63
|
-
/** Valeurs qui varient d'un thème à l'autre (le reste est commun, comme dans theme.dart). */
|
|
64
167
|
const fontSize = (size, weight, height) => ({
|
|
65
168
|
fontSize: size,
|
|
66
169
|
fontWeight: weight,
|
|
@@ -84,20 +187,53 @@ export class Themer {
|
|
|
84
187
|
/** Couleur jaune */
|
|
85
188
|
static amberColor = '#F2A900';
|
|
86
189
|
|
|
87
|
-
|
|
88
|
-
static
|
|
190
|
+
// Nuances neutres du thème clair (du plus clair au plus foncé)
|
|
191
|
+
static neural01Light = '#E6E4E2';
|
|
192
|
+
static neural02Light = '#BDBDBB';
|
|
193
|
+
static neural03Light = '#8B887E';
|
|
194
|
+
static neural04Light = '#615D52';
|
|
195
|
+
static neural05Light = '#5C5451';
|
|
196
|
+
|
|
197
|
+
// Les mêmes nuances en thème sombre, inversées : 01 reste la nuance
|
|
198
|
+
// discrète (traits, fonds), 03 et 04 les textes secondaires
|
|
199
|
+
static neural01Dark = '#4A453E';
|
|
200
|
+
static neural02Dark = '#6F6A60';
|
|
201
|
+
static neural03Dark = '#A8A297';
|
|
202
|
+
static neural04Dark = '#BDB7AC';
|
|
203
|
+
static neural05Dark = '#C4BDB2';
|
|
204
|
+
|
|
205
|
+
/** Luminosité du thème affiché, mise à jour par {@link suivreLuminosite} */
|
|
206
|
+
static luminosite = 'light';
|
|
207
|
+
|
|
208
|
+
/** À appeler avec la luminosité du thème affiché : adapte les couleurs neutres ci-dessous. */
|
|
209
|
+
static suivreLuminosite(luminosite) {
|
|
210
|
+
Themer.luminosite = luminosite;
|
|
211
|
+
}
|
|
89
212
|
|
|
90
|
-
/** Couleur neural
|
|
91
|
-
static
|
|
213
|
+
/** Couleur neural 01 : traits et fonds discrets */
|
|
214
|
+
static get neural01Color() {
|
|
215
|
+
return Themer.luminosite === 'dark' ? Themer.neural01Dark : Themer.neural01Light;
|
|
216
|
+
}
|
|
92
217
|
|
|
93
|
-
/** Couleur neural
|
|
94
|
-
static
|
|
218
|
+
/** Couleur neural 02 : textes désactivés, indications */
|
|
219
|
+
static get neural02Color() {
|
|
220
|
+
return Themer.luminosite === 'dark' ? Themer.neural02Dark : Themer.neural02Light;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** Couleur neural 03 : textes secondaires */
|
|
224
|
+
static get neural03Color() {
|
|
225
|
+
return Themer.luminosite === 'dark' ? Themer.neural03Dark : Themer.neural03Light;
|
|
226
|
+
}
|
|
95
227
|
|
|
96
|
-
/** Couleur neural 04 */
|
|
97
|
-
static neural04Color
|
|
228
|
+
/** Couleur neural 04 : textes secondaires plus marqués */
|
|
229
|
+
static get neural04Color() {
|
|
230
|
+
return Themer.luminosite === 'dark' ? Themer.neural04Dark : Themer.neural04Light;
|
|
231
|
+
}
|
|
98
232
|
|
|
99
233
|
/** Couleur neural 05 */
|
|
100
|
-
static neural05Color
|
|
234
|
+
static get neural05Color() {
|
|
235
|
+
return Themer.luminosite === 'dark' ? Themer.neural05Dark : Themer.neural05Light;
|
|
236
|
+
}
|
|
101
237
|
|
|
102
238
|
/** Primary */
|
|
103
239
|
static primary = '#F2A900';
|
|
@@ -125,43 +261,55 @@ export class Themer {
|
|
|
125
261
|
static btnNormalHeight = 56;
|
|
126
262
|
/** primary small btn height */
|
|
127
263
|
static btnSmallHeight = 38;
|
|
128
|
-
|
|
264
|
+
|
|
265
|
+
// Thème sombre « soft » : fonds brun-gris chauds qui s'éclaircissent avec
|
|
266
|
+
// l'élévation (page < feuille < carte < champ), texte blanc cassé
|
|
267
|
+
static darkBackground = '#1B1916';
|
|
268
|
+
static darkSurface = '#24211E';
|
|
269
|
+
static darkCard = '#2C2925';
|
|
270
|
+
static darkInput = '#35312C';
|
|
271
|
+
static darkOutline = '#4A453E';
|
|
272
|
+
static darkText = '#ECE8E1';
|
|
273
|
+
static darkTextSecondary = '#A8A297';
|
|
274
|
+
static darkTextDisabled = '#6F6A60';
|
|
275
|
+
|
|
276
|
+
/** Thème clair ou sombre teinté par la couleur d'accentuation [a]. */
|
|
277
|
+
static build(dark, a) {
|
|
129
278
|
const T = Themer;
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
const card = dark ? '#23211D' : '#FAF8F6';
|
|
279
|
+
const textColor = dark ? T.darkText : T.blackColor;
|
|
280
|
+
const surface = dark ? T.darkSurface : T.whiteColor;
|
|
281
|
+
const card = dark ? T.darkCard : '#FAF8F6';
|
|
282
|
+
const background = dark ? T.darkBackground : T.whiteColor;
|
|
135
283
|
const text = style => ({
|
|
136
284
|
color: textColor,
|
|
137
285
|
...style
|
|
138
286
|
});
|
|
139
287
|
return {
|
|
140
288
|
brightness: dark ? 'dark' : 'light',
|
|
141
|
-
primaryColor:
|
|
142
|
-
primaryColorDark:
|
|
143
|
-
secondaryHeaderColor:
|
|
289
|
+
primaryColor: a.accent,
|
|
290
|
+
primaryColorDark: a.texte,
|
|
291
|
+
secondaryHeaderColor: a.conteneur,
|
|
144
292
|
cardColor: card,
|
|
145
|
-
scaffoldBackgroundColor:
|
|
146
|
-
dialogSurfaceTintColor: dark ?
|
|
293
|
+
scaffoldBackgroundColor: background,
|
|
294
|
+
dialogSurfaceTintColor: dark ? T.darkSurface : T.whiteColor,
|
|
147
295
|
colorScheme: {
|
|
148
296
|
brightness: dark ? 'dark' : 'light',
|
|
149
|
-
primary:
|
|
150
|
-
onPrimary:
|
|
151
|
-
secondary:
|
|
152
|
-
onSecondary:
|
|
153
|
-
tertiary:
|
|
154
|
-
onTertiary:
|
|
297
|
+
primary: a.accent,
|
|
298
|
+
onPrimary: a.surAccent,
|
|
299
|
+
secondary: a.conteneur,
|
|
300
|
+
onSecondary: a.surConteneur,
|
|
301
|
+
tertiary: a.tertiaire,
|
|
302
|
+
onTertiary: dark ? a.surConteneur : T.blackColor,
|
|
155
303
|
error: T.systemErrorColor,
|
|
156
|
-
onError:
|
|
304
|
+
onError: dark ? T.darkBackground : T.blackColor,
|
|
157
305
|
surface,
|
|
158
|
-
onSurface:
|
|
306
|
+
onSurface: textColor
|
|
159
307
|
},
|
|
160
308
|
appBarTheme: {
|
|
161
|
-
backgroundColor:
|
|
309
|
+
backgroundColor: background,
|
|
162
310
|
foregroundColor: textColor
|
|
163
311
|
},
|
|
164
|
-
primaryIconColor:
|
|
312
|
+
primaryIconColor: a.accent,
|
|
165
313
|
textTheme: {
|
|
166
314
|
titleLarge: text(fontSize(32, '600')),
|
|
167
315
|
titleMedium: text(fontSize(32, '400')),
|
|
@@ -176,7 +324,7 @@ export class Themer {
|
|
|
176
324
|
displayMedium: text(fontSize(13, '500')),
|
|
177
325
|
displaySmall: {
|
|
178
326
|
...text(fontSize(13, '400', 1.4)),
|
|
179
|
-
color: T.
|
|
327
|
+
color: dark ? T.darkTextSecondary : T.neural04Light
|
|
180
328
|
},
|
|
181
329
|
labelLarge: text(fontSize(12, '400')),
|
|
182
330
|
labelMedium: text(fontSize(11, '400'))
|
|
@@ -192,21 +340,21 @@ export class Themer {
|
|
|
192
340
|
inputDecorationTheme: {
|
|
193
341
|
paddingHorizontal: 16,
|
|
194
342
|
paddingVertical: 5,
|
|
195
|
-
fillColor: dark ?
|
|
343
|
+
fillColor: dark ? T.darkInput : '#FAF8F6',
|
|
196
344
|
borderRadius: 10,
|
|
197
|
-
focusedBorderColor:
|
|
345
|
+
focusedBorderColor: a.accent,
|
|
198
346
|
errorBorderColor: T.systemErrorColor,
|
|
199
347
|
floatingLabelStyle: {
|
|
200
|
-
color: dark ?
|
|
348
|
+
color: dark ? T.darkTextSecondary : T.neural04Light,
|
|
201
349
|
fontSize: 13,
|
|
202
350
|
fontWeight: '400'
|
|
203
351
|
},
|
|
204
352
|
labelStyle: {
|
|
205
|
-
color: dark ?
|
|
353
|
+
color: dark ? T.darkTextSecondary : T.neural03Light,
|
|
206
354
|
fontSize: 17
|
|
207
355
|
},
|
|
208
356
|
hintStyle: {
|
|
209
|
-
color: dark ?
|
|
357
|
+
color: dark ? T.darkTextDisabled : T.neural02Light,
|
|
210
358
|
fontSize: 17
|
|
211
359
|
},
|
|
212
360
|
errorStyle: {
|
|
@@ -214,27 +362,27 @@ export class Themer {
|
|
|
214
362
|
fontSize: 12
|
|
215
363
|
},
|
|
216
364
|
errorMaxLines: 3,
|
|
217
|
-
suffixIconColor: dark ?
|
|
365
|
+
suffixIconColor: dark ? T.darkTextSecondary : '#8B887E'
|
|
218
366
|
},
|
|
219
367
|
elevatedButtonTheme: {
|
|
220
|
-
backgroundColor:
|
|
221
|
-
pressedBackgroundColor:
|
|
222
|
-
disabledBackgroundColor: dark ?
|
|
223
|
-
foregroundColor:
|
|
224
|
-
disabledForegroundColor: dark ?
|
|
368
|
+
backgroundColor: a.accent,
|
|
369
|
+
pressedBackgroundColor: a.appui,
|
|
370
|
+
disabledBackgroundColor: dark ? T.darkCard : '#F5F5F1',
|
|
371
|
+
foregroundColor: a.surAccent,
|
|
372
|
+
disabledForegroundColor: dark ? T.darkTextDisabled : T.neural03Light,
|
|
225
373
|
minHeight: T.btnNormalHeight,
|
|
226
374
|
borderRadius: 20,
|
|
227
375
|
textStyle: {
|
|
228
|
-
color:
|
|
376
|
+
color: a.surAccent,
|
|
229
377
|
fontSize: 17,
|
|
230
378
|
fontWeight: '600'
|
|
231
379
|
}
|
|
232
380
|
},
|
|
233
381
|
textButtonTheme: {
|
|
234
|
-
foregroundColor:
|
|
235
|
-
overlayColor:
|
|
382
|
+
foregroundColor: a.texte,
|
|
383
|
+
overlayColor: dark ? `${a.accent}1F` : a.conteneur,
|
|
236
384
|
textStyle: {
|
|
237
|
-
color:
|
|
385
|
+
color: a.texte,
|
|
238
386
|
fontSize: 17,
|
|
239
387
|
fontWeight: '400'
|
|
240
388
|
},
|
|
@@ -242,17 +390,17 @@ export class Themer {
|
|
|
242
390
|
minHeight: 26
|
|
243
391
|
},
|
|
244
392
|
switchTheme: {
|
|
245
|
-
thumbColor: dark ?
|
|
246
|
-
activeTrackColor:
|
|
247
|
-
inactiveTrackColor: dark ? T.
|
|
393
|
+
thumbColor: dark ? T.darkTextSecondary : T.whiteColor,
|
|
394
|
+
activeTrackColor: a.accent,
|
|
395
|
+
inactiveTrackColor: dark ? T.darkOutline : T.neural01Light
|
|
248
396
|
},
|
|
249
397
|
filledButtonTheme: {
|
|
250
|
-
foregroundColor:
|
|
251
|
-
disabledForegroundColor: dark ?
|
|
398
|
+
foregroundColor: a.surAccent,
|
|
399
|
+
disabledForegroundColor: dark ? T.darkTextDisabled : T.neural03Light,
|
|
252
400
|
minHeight: T.btnNormalHeight,
|
|
253
401
|
borderRadius: 20,
|
|
254
402
|
textStyle: {
|
|
255
|
-
color:
|
|
403
|
+
color: a.surAccent,
|
|
256
404
|
fontSize: 17,
|
|
257
405
|
fontWeight: '600'
|
|
258
406
|
}
|
|
@@ -263,8 +411,8 @@ export class Themer {
|
|
|
263
411
|
},
|
|
264
412
|
checkboxTheme: {
|
|
265
413
|
borderRadius: 6,
|
|
266
|
-
checkColor:
|
|
267
|
-
borderColor: T.
|
|
414
|
+
checkColor: a.surAccent,
|
|
415
|
+
borderColor: dark ? T.darkTextDisabled : T.neural02Light,
|
|
268
416
|
borderWidth: 2
|
|
269
417
|
},
|
|
270
418
|
chipTheme: {
|
|
@@ -278,165 +426,130 @@ export class Themer {
|
|
|
278
426
|
};
|
|
279
427
|
}
|
|
280
428
|
|
|
281
|
-
/**
|
|
282
|
-
static
|
|
283
|
-
dark: false,
|
|
284
|
-
primaryColor: Themer.primary,
|
|
285
|
-
primaryColorDark: Themer.primaryDark,
|
|
286
|
-
secondaryHeaderColor: Themer.primaryLight,
|
|
287
|
-
schemePrimary: Themer.primary,
|
|
288
|
-
schemeOnPrimary: Themer.blackColor,
|
|
289
|
-
schemeSecondary: Themer.primaryLight,
|
|
290
|
-
schemeTertiary: Themer.primaryStroke,
|
|
291
|
-
iconColor: Themer.primary,
|
|
292
|
-
focusedBorderColor: Themer.primary,
|
|
293
|
-
buttonPressed: '#E1A009',
|
|
294
|
-
buttonBackground: Themer.primary,
|
|
295
|
-
buttonForeground: Themer.blackColor,
|
|
296
|
-
textButtonColor: Themer.primaryDark,
|
|
297
|
-
textButtonOverlay: Themer.primaryLight,
|
|
298
|
-
switchActiveTrack: Themer.primary
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
/** Code enregistré comme thème préféré quand l'hôte fournit un thème personnalisé (`PiSpiAppConfig.customTheme`). */
|
|
302
|
-
static customThemeCode = 'customTheme';
|
|
303
|
-
|
|
304
|
-
/** Thème personnalisé de l'hôte, construit à l'ouverture du SDK (voir `Di.init`) ; `null` sans thème personnalisé. */
|
|
305
|
-
static customTheme = null;
|
|
429
|
+
/** Thèmes déjà construits, par luminosité et couleur d'accentuation */
|
|
430
|
+
static themes = new Map();
|
|
306
431
|
|
|
307
|
-
/**
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
432
|
+
/** Thème clair teinté par la couleur d'accentuation [accent] */
|
|
433
|
+
static clair(accent) {
|
|
434
|
+
const a = Accents.fromCode(accent);
|
|
435
|
+
const cle = `clair-${a}`;
|
|
436
|
+
if (!Themer.themes.has(cle)) Themer.themes.set(cle, Themer.build(false, Accents.clair(a)));
|
|
437
|
+
return Themer.themes.get(cle);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Thème sombre teinté par la couleur d'accentuation [accent] */
|
|
441
|
+
static sombre(accent) {
|
|
442
|
+
const a = Accents.fromCode(accent);
|
|
443
|
+
const cle = `sombre-${a}`;
|
|
444
|
+
if (!Themer.themes.has(cle)) Themer.themes.set(cle, Themer.build(true, Accents.sombre(a)));
|
|
445
|
+
return Themer.themes.get(cle);
|
|
320
446
|
}
|
|
321
447
|
|
|
322
|
-
/**
|
|
323
|
-
static
|
|
448
|
+
/** Code enregistré comme couleur d'accentuation quand l'hôte fournit un thème personnalisé (`PiSpiAppConfig.customTheme`). */
|
|
449
|
+
static customAccentCode = 'application';
|
|
450
|
+
|
|
451
|
+
/** Teintes de la couleur de l'hôte (claire puis sombre), définies à l'ouverture du SDK (voir `Di.init`) ; `null` sans thème personnalisé. */
|
|
452
|
+
static customAccent = null;
|
|
453
|
+
|
|
454
|
+
/** Thème complet fourni par l'hôte (`PiSpiCustomTheme.themeData`) : il remplace alors les thèmes clair et sombre du SDK. */
|
|
455
|
+
static customThemeData = null;
|
|
456
|
+
|
|
457
|
+
/** L'hôte a fourni un thème personnalisé */
|
|
458
|
+
static get hasCustomTheme() {
|
|
459
|
+
return Themer.customAccent != null || Themer.customThemeData != null;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Teintes claire et sombre dérivées des couleurs de l'hôte : texte posé
|
|
464
|
+
* sur la couleur en noir ou blanc selon son contraste, teinte plus
|
|
465
|
+
* lumineuse en sombre.
|
|
466
|
+
*/
|
|
467
|
+
static teintesDepuis(primary, secondary, tertiary, pressed) {
|
|
468
|
+
const sur = (fond, fonce) => contrast(fonce, fond) >= contrast(Themer.whiteColor, fond) ? fonce : Themer.whiteColor;
|
|
469
|
+
// Lien lisible sur fond blanc (4,5:1), sinon couleur assombrie
|
|
470
|
+
let texte = primary;
|
|
471
|
+
for (let i = 1; i <= 6 && contrast(texte, Themer.whiteColor) < 4.5; i++) {
|
|
472
|
+
texte = lerpColor(primary, Themer.blackColor, i * 0.1);
|
|
473
|
+
}
|
|
474
|
+
const clair = {
|
|
475
|
+
accent: primary,
|
|
476
|
+
surAccent: sur(primary, Themer.blackColor),
|
|
477
|
+
appui: pressed ?? lerpColor(primary, Themer.blackColor, 0.2),
|
|
478
|
+
texte,
|
|
479
|
+
conteneur: secondary ?? lerpColor(primary, Themer.whiteColor, 0.75),
|
|
480
|
+
surConteneur: Themer.blackColor,
|
|
481
|
+
tertiaire: tertiary ?? lerpColor(primary, Themer.whiteColor, 0.4)
|
|
482
|
+
};
|
|
483
|
+
// En sombre : couleur éclaircie jusqu'à 3:1 sur le fond
|
|
484
|
+
let fonce = primary;
|
|
485
|
+
for (let i = 1; i <= 6 && contrast(fonce, Themer.darkBackground) < 3; i++) {
|
|
486
|
+
fonce = lerpColor(primary, Themer.whiteColor, i * 0.1);
|
|
487
|
+
}
|
|
488
|
+
const conteneur = lerpColor(Themer.darkBackground, primary, 0.3);
|
|
489
|
+
const sombre = {
|
|
490
|
+
accent: fonce,
|
|
491
|
+
surAccent: sur(fonce, Themer.darkBackground),
|
|
492
|
+
appui: lerpColor(fonce, Themer.blackColor, 0.1),
|
|
493
|
+
texte: fonce,
|
|
494
|
+
conteneur,
|
|
495
|
+
surConteneur: lerpColor(fonce, Themer.whiteColor, 0.6),
|
|
496
|
+
tertiaire: conteneur
|
|
497
|
+
};
|
|
324
498
|
return {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
primaryColorDark: main,
|
|
328
|
-
secondaryHeaderColor: secondary,
|
|
329
|
-
schemePrimary: main,
|
|
330
|
-
schemeSecondary: secondary,
|
|
331
|
-
schemeTertiary: tertiary,
|
|
332
|
-
iconColor: main,
|
|
333
|
-
focusedBorderColor: main,
|
|
334
|
-
buttonPressed: main,
|
|
335
|
-
buttonBackground: main,
|
|
336
|
-
textButtonColor: main,
|
|
337
|
-
textButtonOverlay: main,
|
|
338
|
-
switchActiveTrack: main,
|
|
339
|
-
...options
|
|
499
|
+
clair,
|
|
500
|
+
sombre
|
|
340
501
|
};
|
|
341
502
|
}
|
|
342
503
|
|
|
343
|
-
/**
|
|
344
|
-
static
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
static darkTheme = Themer.build({
|
|
348
|
-
...Themer.defaultSpec,
|
|
349
|
-
dark: true,
|
|
350
|
-
secondaryHeaderColor: Themer.primaryStroke,
|
|
351
|
-
schemeOnPrimary: Themer.whiteColor,
|
|
352
|
-
schemeSecondary: Themer.primaryStroke,
|
|
353
|
-
buttonForeground: Themer.whiteColor
|
|
354
|
-
});
|
|
504
|
+
/** Thème construit sur les teintes [a] (clair, ou sombre si [dark]) */
|
|
505
|
+
static depuisTeintes(a, dark = false) {
|
|
506
|
+
return Themer.build(dark, a);
|
|
507
|
+
}
|
|
355
508
|
|
|
356
|
-
/**
|
|
357
|
-
static
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
textButtonColor: '#7FC077',
|
|
372
|
-
textButtonOverlay: '#7FC077'
|
|
373
|
-
}));
|
|
374
|
-
|
|
375
|
-
/** Light Red theme data */
|
|
376
|
-
static lightRedTheme = Themer.build(Themer.coloredSpec('#C62828', '#F9CFCF', '#E57373', {
|
|
377
|
-
schemeOnPrimary: Themer.whiteColor,
|
|
378
|
-
buttonPressed: '#B71C1C',
|
|
379
|
-
buttonForeground: Themer.whiteColor
|
|
380
|
-
}));
|
|
381
|
-
|
|
382
|
-
/** Light Orange theme data */
|
|
383
|
-
static lightOrangeTheme = Themer.build(Themer.coloredSpec('#EF6C00', '#FFE0B2', '#FFB74D', {
|
|
384
|
-
schemeOnPrimary: Themer.whiteColor,
|
|
385
|
-
buttonPressed: '#E65100',
|
|
386
|
-
buttonForeground: Themer.whiteColor
|
|
387
|
-
}));
|
|
388
|
-
|
|
389
|
-
/** Light Purple theme data */
|
|
390
|
-
static lightPurpleTheme = Themer.build(Themer.coloredSpec('#6A1B9A', '#E1BEE7', '#BA68C8', {
|
|
391
|
-
schemeOnPrimary: Themer.whiteColor,
|
|
392
|
-
buttonPressed: '#4A148C',
|
|
393
|
-
buttonForeground: Themer.whiteColor
|
|
394
|
-
}));
|
|
395
|
-
|
|
396
|
-
/** Light Pink theme data */
|
|
397
|
-
static lightPinkTheme = Themer.build(Themer.coloredSpec('#AD1457', '#F8BBD0', '#F06292', {
|
|
398
|
-
schemeOnPrimary: Themer.whiteColor,
|
|
399
|
-
buttonPressed: '#880E4F',
|
|
400
|
-
buttonForeground: Themer.whiteColor
|
|
401
|
-
}));
|
|
509
|
+
/** Libellé de la couleur d'accentuation [code], y compris celle de l'hôte */
|
|
510
|
+
static accentLabel(traductions, code) {
|
|
511
|
+
if (code === Themer.customAccentCode && Themer.hasCustomTheme) return traductions.appSettingPageMenuThemeCustom;
|
|
512
|
+
return Accents.label(Accents.fromCode(code), traductions);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/** Thème clair avec la couleur PI-SPI */
|
|
516
|
+
static get lightTheme() {
|
|
517
|
+
return Themer.clair();
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** Thème sombre avec la couleur PI-SPI */
|
|
521
|
+
static get darkTheme() {
|
|
522
|
+
return Themer.sombre();
|
|
523
|
+
}
|
|
402
524
|
|
|
403
525
|
/**
|
|
404
|
-
*
|
|
405
|
-
* [
|
|
406
|
-
* ponctuellement via
|
|
526
|
+
* Thème à afficher : [code] (système, clair ou sombre) teinté par la
|
|
527
|
+
* couleur d'accentuation [accent]. Pour `Themes.system`, [systemScheme]
|
|
528
|
+
* (ex. `useColorScheme()`) prime sur la valeur lue ponctuellement via
|
|
529
|
+
* `Appearance`.
|
|
407
530
|
*/
|
|
408
|
-
static get(code, systemScheme) {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
case Themes.dark:
|
|
415
|
-
return Themer.darkTheme;
|
|
416
|
-
case Themes.yellow:
|
|
417
|
-
return Themer.lightYellowTheme;
|
|
418
|
-
case Themes.green:
|
|
419
|
-
return Themer.lightGreenTheme;
|
|
420
|
-
case Themes.blue:
|
|
421
|
-
return Themer.lightBlueTheme;
|
|
422
|
-
case Themes.red:
|
|
423
|
-
return Themer.lightRedTheme;
|
|
424
|
-
case Themes.orange:
|
|
425
|
-
return Themer.lightOrangeTheme;
|
|
426
|
-
case Themes.purple:
|
|
427
|
-
return Themer.lightPurpleTheme;
|
|
428
|
-
case Themes.pink:
|
|
429
|
-
return Themer.lightPinkTheme;
|
|
430
|
-
// Système
|
|
431
|
-
case Themes.system:
|
|
432
|
-
{
|
|
433
|
-
const brightness = systemScheme === 'light' || systemScheme === 'dark' ? systemScheme : Appearance.getColorScheme();
|
|
434
|
-
return brightness === 'dark' ? Themer.darkTheme : Themer.lightTheme;
|
|
435
|
-
}
|
|
436
|
-
// Default theme
|
|
437
|
-
default:
|
|
438
|
-
return Themer.lightTheme;
|
|
531
|
+
static get(code, accent, systemScheme) {
|
|
532
|
+
const theme = Themes.fromCode(code);
|
|
533
|
+
let dark = theme === Themes.dark;
|
|
534
|
+
if (theme === Themes.system) {
|
|
535
|
+
const brightness = systemScheme === 'light' || systemScheme === 'dark' ? systemScheme : Appearance.getColorScheme();
|
|
536
|
+
dark = brightness === 'dark';
|
|
439
537
|
}
|
|
538
|
+
// Thème complet ou couleur du thème personnalisé de l'hôte
|
|
539
|
+
if (accent === Themer.customAccentCode && Themer.customThemeData != null) return Themer.customThemeData;
|
|
540
|
+
const perso = Themer.customAccent;
|
|
541
|
+
if (accent === Themer.customAccentCode && perso != null) {
|
|
542
|
+
const cle = `${dark ? 'sombre' : 'clair'}-${Themer.customAccentCode}`;
|
|
543
|
+
if (!Themer.themes.has(cle)) Themer.themes.set(cle, Themer.build(dark, dark ? perso.sombre : perso.clair));
|
|
544
|
+
return Themer.themes.get(cle);
|
|
545
|
+
}
|
|
546
|
+
return dark ? Themer.sombre(accent) : Themer.clair(accent);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/** Oublie les thèmes construits avec la couleur de l'hôte (nouvelle ouverture du SDK) */
|
|
550
|
+
static resetCustomThemes() {
|
|
551
|
+
Themer.themes.delete(`clair-${Themer.customAccentCode}`);
|
|
552
|
+
Themer.themes.delete(`sombre-${Themer.customAccentCode}`);
|
|
440
553
|
}
|
|
441
554
|
}
|
|
442
555
|
export const ThemeContext = /*#__PURE__*/createContext(Themer.lightTheme);
|
|
@@ -473,4 +586,11 @@ export function relativeLuminance(hex) {
|
|
|
473
586
|
});
|
|
474
587
|
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
475
588
|
}
|
|
589
|
+
|
|
590
|
+
/** Ratio de contraste WCAG entre deux couleurs */
|
|
591
|
+
export function contrast(a, b) {
|
|
592
|
+
const la = relativeLuminance(a);
|
|
593
|
+
const lb = relativeLuminance(b);
|
|
594
|
+
return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
|
|
595
|
+
}
|
|
476
596
|
//# sourceMappingURL=theme.js.map
|