@africanies/angular-web-sdk 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/README.md +46 -0
  2. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +215 -0
  3. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
  4. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/package.json +35 -0
  5. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/tailwind-preset.cjs +245 -0
  6. package/.nx/cache/12276756491762927325/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +157 -0
  7. package/.nx/cache/17491371155400585077/dist/libs/africanies-core/README.md +85 -0
  8. package/.nx/cache/17491371155400585077/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4546 -0
  9. package/.nx/cache/17491371155400585077/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
  10. package/.nx/cache/17491371155400585077/dist/libs/africanies-core/package.json +31 -0
  11. package/.nx/cache/17491371155400585077/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2740 -0
  12. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/README.md +68 -0
  13. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
  14. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
  15. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
  16. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
  17. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +19291 -0
  18. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
  19. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/package.json +35 -0
  20. package/.nx/cache/3314955264390318442/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5483 -0
  21. package/.nx/cache/run.json +38 -38
  22. package/.nx/cache/terminalOutputs/12276756491762927325 +21 -0
  23. package/.nx/cache/terminalOutputs/17491371155400585077 +21 -0
  24. package/.nx/cache/terminalOutputs/3017748574492080228 +28 -0
  25. package/.nx/cache/terminalOutputs/3314955264390318442 +21 -0
  26. package/.nx/cache/terminalOutputs/8648260256613557249 +173 -0
  27. package/.nx/cache/terminalOutputs/9408529484792607601 +6 -0
  28. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
  29. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
  30. package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
  31. package/.nx/workspace-data/d/daemon.log +1659 -0
  32. package/.nx/workspace-data/d/server-process.json +2 -2
  33. package/.nx/workspace-data/file-map.json +3578 -3529
  34. package/.nx/workspace-data/nx_files.nxt +0 -0
  35. package/.nx/workspace-data/project-graph.json +5 -5
  36. package/.nx/workspace-data/source-maps.json +0 -80
  37. package/apps/playground/src/app/snippets/action-menu.snippets.ts +1 -0
  38. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +1 -1
  39. package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
  40. package/dist/libs/africanies-core/package.json +3 -3
  41. package/dist/libs/africanies-theme/package.json +3 -3
  42. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +318 -115
  43. package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
  44. package/dist/libs/africanies-ui/package.json +5 -5
  45. package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +92 -19
  46. package/libs/africanies-core/package.json +3 -3
  47. package/libs/africanies-core/src/lib/payment-method/payment-method.mapper.spec.ts +15 -0
  48. package/libs/africanies-core/src/lib/payment-method/payment-method.mapper.ts +1 -2
  49. package/libs/africanies-theme/package.json +3 -3
  50. package/libs/africanies-ui/package.json +5 -5
  51. package/libs/africanies-ui/src/index.ts +6 -0
  52. package/libs/africanies-ui/src/lib/accordion/accordion.component.ts +135 -0
  53. package/libs/africanies-ui/src/lib/accordion/index.ts +7 -0
  54. package/libs/africanies-ui/src/lib/action-menu/action-menu.component.ts +84 -17
  55. package/libs/africanies-ui/src/lib/action-menu/menu-item.ts +19 -2
  56. package/libs/africanies-ui/src/lib/modules/africanies-feedback.module.ts +3 -1
  57. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ # @africanies/africanies-theme
2
+
3
+ AFRICANIES design tokens (Tailwind preset), light/dark {@link ThemeService}, and shipping-mode accent helpers ({@link ModeColorService}).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @africanies/africanies-theme @africanies/africanies-storage @africanies/africanies-core
9
+ ```
10
+
11
+ ## Tailwind
12
+
13
+ ```js
14
+ // tailwind.config.js
15
+ module.exports = {
16
+ presets: [require('@africanies/africanies-theme/tailwind-preset')],
17
+ content: [
18
+ './src/**/*.{html,ts}',
19
+ './node_modules/@africanies/africanies-ui/**/*.{js,mjs}',
20
+ ],
21
+ };
22
+ ```
23
+
24
+ > The preset file is published as `tailwind-preset.cjs` (package is ESM) but resolved via the `./tailwind-preset` export above.
25
+
26
+ See [THEME.md](./THEME.md) for the full palette, provisional typography scale, and legacy `$border-gray` mapping notes.
27
+
28
+ ## ThemeService
29
+
30
+ ```ts
31
+ import { inject, provideAppInitializer } from '@angular/core';
32
+ import { ThemeService } from '@africanies/africanies-theme';
33
+
34
+ provideAppInitializer(() => {
35
+ inject(ThemeService);
36
+ });
37
+ ```
38
+
39
+ ## ModeColorService
40
+
41
+ ```ts
42
+ const modeColor = inject(ModeColorService);
43
+ const { text, bg, bgSubtle } = modeColor.classes();
44
+ ```
45
+
46
+ Class strings are literals so Tailwind does not purge them.
@@ -0,0 +1,215 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, computed, Injectable, signal } from '@angular/core';
3
+ import { ShippingModeService } from '@africanies/africanies-core';
4
+ import { DOCUMENT } from '@angular/common';
5
+ import { STORAGE_TOKEN, AFRICANIES_THEME_KEY } from '@africanies/africanies-storage';
6
+
7
+ /**
8
+ * Tailwind safelist side-effect for shipping-mode color utilities.
9
+ *
10
+ * WHY this file exists: JIT/content scanning only keeps class names that appear
11
+ * as *literal strings* in scanned sources. {@link ModeColorService} already
12
+ * returns these literals, but keeping a dedicated comment list makes the
13
+ * contract obvious for consumers who configure `safelist` or purge plugins.
14
+ *
15
+ * Do not rename these strings without updating ModeColorService and THEME.md.
16
+ *
17
+ * SFN (export / green):
18
+ * text-export bg-export bg-export-subtle bg-export-light border-export
19
+ * hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15
20
+ *
21
+ * STN (import / orange):
22
+ * text-import bg-import bg-import-subtle bg-import-light border-import
23
+ * hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15
24
+ */
25
+ const MODE_COLOR_SAFELIST = [
26
+ 'text-export',
27
+ 'bg-export',
28
+ 'bg-export-subtle',
29
+ 'bg-export-light',
30
+ 'border-export',
31
+ 'hover:bg-export-light',
32
+ 'hover:bg-export-subtle',
33
+ 'dark:bg-export/15',
34
+ 'dark:hover:bg-export/15',
35
+ 'text-import',
36
+ 'bg-import',
37
+ 'bg-import-subtle',
38
+ 'bg-import-light',
39
+ 'border-import',
40
+ 'hover:bg-import-light',
41
+ 'hover:bg-import-subtle',
42
+ 'dark:bg-import/15',
43
+ 'dark:hover:bg-import/15',
44
+ ];
45
+
46
+ /**
47
+ * Maps {@link ShippingModeService} to mode-accent Tailwind classes.
48
+ *
49
+ * - **SFN** → export green is primary
50
+ * - **STN** → import orange is primary
51
+ *
52
+ * WHY literal class strings: Tailwind's scanner cannot see dynamically built
53
+ * names like `` `text-${token}` ``. Returning full literals (`text-export`, …)
54
+ * keeps utilities in the compiled CSS. See {@link MODE_COLOR_SAFELIST}.
55
+ *
56
+ * @example
57
+ * ```html
58
+ * @let colors = modeColor.classes();
59
+ * <button type="button" [class]="colors.primary">Save</button>
60
+ * <span [class]="colors.text">Mode accent</span>
61
+ * ```
62
+ */
63
+ class ModeColorService {
64
+ shippingMode = inject(ShippingModeService);
65
+ /**
66
+ * Mode-dependent utility classes. Recomputes when shipping mode changes.
67
+ */
68
+ classes = computed(() => {
69
+ // Literal strings required for Tailwind content detection — do not interpolate.
70
+ if (this.shippingMode.mode() === 'sfn') {
71
+ return {
72
+ text: 'text-export',
73
+ bg: 'bg-export',
74
+ bgSubtle: 'bg-export-subtle',
75
+ border: 'border-export',
76
+ primary: 'bg-export text-white border-transparent hover:bg-export-light',
77
+ ghostPrimary: 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:hover:bg-export/15',
78
+ soft: 'bg-export-subtle dark:bg-export/15',
79
+ softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',
80
+ };
81
+ }
82
+ return {
83
+ text: 'text-import',
84
+ bg: 'bg-import',
85
+ bgSubtle: 'bg-import-subtle',
86
+ border: 'border-import',
87
+ primary: 'bg-import text-white border-transparent hover:bg-import-light',
88
+ ghostPrimary: 'bg-transparent text-import border-transparent hover:bg-import-subtle dark:hover:bg-import/15',
89
+ soft: 'bg-import-subtle dark:bg-import/15',
90
+ softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',
91
+ };
92
+ }, /* @ts-ignore */
93
+ ...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
94
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ModeColorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
95
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ModeColorService, providedIn: 'root' });
96
+ }
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ModeColorService, decorators: [{
98
+ type: Injectable,
99
+ args: [{ providedIn: 'root' }]
100
+ }] });
101
+
102
+ /**
103
+ * Application light/dark theme preference.
104
+ *
105
+ * WHY signals (not BehaviorSubject): theme is synchronous UI state read from
106
+ * templates and other services; a signal avoids RxJS subscription boilerplate
107
+ * and matches Angular 22 change detection. Persistence goes through
108
+ * {@link STORAGE_TOKEN} so tests can swap storage without touching `localStorage`.
109
+ *
110
+ * Applies the Tailwind `darkMode: 'class'` contract by toggling `dark` on
111
+ * `document.documentElement`, and sets `color-scheme` so native UI (date
112
+ * pickers, scrollbars, form controls) matches the app theme — class-based
113
+ * dark mode alone does not restyle browser chrome.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * // app.config.ts
118
+ * import { inject, provideAppInitializer } from '@angular/core';
119
+ * import { ThemeService } from '@africanies/africanies-theme';
120
+ *
121
+ * export const appConfig = {
122
+ * providers: [
123
+ * provideAppInitializer(() => {
124
+ * inject(ThemeService); // applies stored / system theme once
125
+ * }),
126
+ * ],
127
+ * };
128
+ *
129
+ * // In a component
130
+ * const theme = inject(ThemeService);
131
+ * theme.toggle();
132
+ * theme.setTheme('dark');
133
+ * const current = theme.theme(); // 'light' | 'dark'
134
+ * ```
135
+ */
136
+ class ThemeService {
137
+ storage = inject(STORAGE_TOKEN);
138
+ document = inject(DOCUMENT);
139
+ /**
140
+ * Current theme. Prefer reading via `theme()` in templates / computed values
141
+ * rather than caching the string, so dark-class consumers stay in sync.
142
+ */
143
+ theme = signal(this.resolveInitialTheme(), /* @ts-ignore */
144
+ ...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
145
+ constructor() {
146
+ this.applyToDocument(this.theme());
147
+ }
148
+ /**
149
+ * Sets and persists the theme, updating the `dark` class and `color-scheme`
150
+ * on `<html>`.
151
+ *
152
+ * @param theme - Absolute preference to store.
153
+ */
154
+ setTheme(theme) {
155
+ this.theme.set(theme);
156
+ this.applyToDocument(theme);
157
+ try {
158
+ this.storage.set(AFRICANIES_THEME_KEY, theme);
159
+ }
160
+ catch {
161
+ // Persistence failure must not block the in-session visual toggle —
162
+ // private browsing / quota issues are transient for theme preference.
163
+ }
164
+ }
165
+ /**
166
+ * Flips between light and dark.
167
+ *
168
+ * @returns The theme after the toggle.
169
+ */
170
+ toggle() {
171
+ const next = this.theme() === 'light' ? 'dark' : 'light';
172
+ this.setTheme(next);
173
+ return next;
174
+ }
175
+ resolveInitialTheme() {
176
+ try {
177
+ const stored = this.storage.get(AFRICANIES_THEME_KEY);
178
+ if (stored === 'light' || stored === 'dark') {
179
+ return stored;
180
+ }
181
+ }
182
+ catch {
183
+ // Fall through to system preference when storage is unavailable.
184
+ }
185
+ return this.prefersDark() ? 'dark' : 'light';
186
+ }
187
+ prefersDark() {
188
+ const win = this.document.defaultView;
189
+ return !!win?.matchMedia?.('(prefers-color-scheme: dark)').matches;
190
+ }
191
+ applyToDocument(theme) {
192
+ const root = this.document.documentElement;
193
+ if (theme === 'dark') {
194
+ root.classList.add('dark');
195
+ }
196
+ else {
197
+ root.classList.remove('dark');
198
+ }
199
+ // Native date/time pickers follow `color-scheme`, not Tailwind's `dark` class.
200
+ root.style.colorScheme = theme;
201
+ }
202
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
203
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, providedIn: 'root' });
204
+ }
205
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: ThemeService, decorators: [{
206
+ type: Injectable,
207
+ args: [{ providedIn: 'root' }]
208
+ }], ctorParameters: () => [] });
209
+
210
+ /**
211
+ * Generated bundle index. Do not edit.
212
+ */
213
+
214
+ export { MODE_COLOR_SAFELIST, ModeColorService, ThemeService };
215
+ //# sourceMappingURL=africanies-africanies-theme.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"africanies-africanies-theme.mjs","sources":["../../../../libs/africanies-theme/src/lib/mode-color.safelist.ts","../../../../libs/africanies-theme/src/lib/mode-color.service.ts","../../../../libs/africanies-theme/src/lib/theme.service.ts","../../../../libs/africanies-theme/src/africanies-africanies-theme.ts"],"sourcesContent":["/**\n * Tailwind safelist side-effect for shipping-mode color utilities.\n *\n * WHY this file exists: JIT/content scanning only keeps class names that appear\n * as *literal strings* in scanned sources. {@link ModeColorService} already\n * returns these literals, but keeping a dedicated comment list makes the\n * contract obvious for consumers who configure `safelist` or purge plugins.\n *\n * Do not rename these strings without updating ModeColorService and THEME.md.\n *\n * SFN (export / green):\n * text-export bg-export bg-export-subtle bg-export-light border-export\n * hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15\n *\n * STN (import / orange):\n * text-import bg-import bg-import-subtle bg-import-light border-import\n * hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15\n */\nexport const MODE_COLOR_SAFELIST = [\n 'text-export',\n 'bg-export',\n 'bg-export-subtle',\n 'bg-export-light',\n 'border-export',\n 'hover:bg-export-light',\n 'hover:bg-export-subtle',\n 'dark:bg-export/15',\n 'dark:hover:bg-export/15',\n 'text-import',\n 'bg-import',\n 'bg-import-subtle',\n 'bg-import-light',\n 'border-import',\n 'hover:bg-import-light',\n 'hover:bg-import-subtle',\n 'dark:bg-import/15',\n 'dark:hover:bg-import/15',\n] as const;\n","import { computed, inject, Injectable } from '@angular/core';\n\nimport { ShippingModeService } from '@africanies/africanies-core';\n\n/**\n * Tailwind class bundle for the active shipping mode (SFN export / STN import).\n *\n * Use these for **primary** product chrome: CTAs, selected controls, progress,\n * and accent text. Semantic colors (danger / warning) stay mode-independent.\n */\nexport interface ModeColorClasses {\n /** Text color utility, e.g. `text-export`. */\n text: string;\n /** Solid background utility, e.g. `bg-export`. */\n bg: string;\n /** Soft background utility, e.g. `bg-export-subtle`. */\n bgSubtle: string;\n /** Border matching the mode accent, e.g. `border-export`. */\n border: string;\n /**\n * Filled primary CTA — `variant=\"primary\"` on buttons.\n * Includes hover utility as a literal so Tailwind keeps it.\n */\n primary: string;\n /**\n * Transparent / text-only CTA — `variant=\"ghost-primary\"` on buttons.\n * Mode accent text + soft hover fill.\n */\n ghostPrimary: string;\n /**\n * Soft highlight for selected / active rows (works in dark mode).\n */\n soft: string;\n /**\n * Soft hover highlight for menus and lists.\n */\n softHover: string;\n}\n\n/**\n * Maps {@link ShippingModeService} to mode-accent Tailwind classes.\n *\n * - **SFN** → export green is primary\n * - **STN** → import orange is primary\n *\n * WHY literal class strings: Tailwind's scanner cannot see dynamically built\n * names like `` `text-${token}` ``. Returning full literals (`text-export`, …)\n * keeps utilities in the compiled CSS. See {@link MODE_COLOR_SAFELIST}.\n *\n * @example\n * ```html\n * @let colors = modeColor.classes();\n * <button type=\"button\" [class]=\"colors.primary\">Save</button>\n * <span [class]=\"colors.text\">Mode accent</span>\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ModeColorService {\n private readonly shippingMode = inject(ShippingModeService);\n\n /**\n * Mode-dependent utility classes. Recomputes when shipping mode changes.\n */\n readonly classes = computed<ModeColorClasses>(() => {\n // Literal strings required for Tailwind content detection — do not interpolate.\n if (this.shippingMode.mode() === 'sfn') {\n return {\n text: 'text-export',\n bg: 'bg-export',\n bgSubtle: 'bg-export-subtle',\n border: 'border-export',\n primary:\n 'bg-export text-white border-transparent hover:bg-export-light',\n ghostPrimary:\n 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:hover:bg-export/15',\n soft: 'bg-export-subtle dark:bg-export/15',\n softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',\n };\n }\n return {\n text: 'text-import',\n bg: 'bg-import',\n bgSubtle: 'bg-import-subtle',\n border: 'border-import',\n primary:\n 'bg-import text-white border-transparent hover:bg-import-light',\n ghostPrimary:\n 'bg-transparent text-import border-transparent hover:bg-import-subtle dark:hover:bg-import/15',\n soft: 'bg-import-subtle dark:bg-import/15',\n softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',\n };\n });\n}\n","import { DOCUMENT } from '@angular/common';\nimport { inject, Injectable, signal } from '@angular/core';\n\nimport { AFRICANIES_THEME_KEY, STORAGE_TOKEN } from '@africanies/africanies-storage';\n\nimport type { Theme } from './theme.types';\n\n/**\n * Application light/dark theme preference.\n *\n * WHY signals (not BehaviorSubject): theme is synchronous UI state read from\n * templates and other services; a signal avoids RxJS subscription boilerplate\n * and matches Angular 22 change detection. Persistence goes through\n * {@link STORAGE_TOKEN} so tests can swap storage without touching `localStorage`.\n *\n * Applies the Tailwind `darkMode: 'class'` contract by toggling `dark` on\n * `document.documentElement`, and sets `color-scheme` so native UI (date\n * pickers, scrollbars, form controls) matches the app theme — class-based\n * dark mode alone does not restyle browser chrome.\n *\n * @example\n * ```ts\n * // app.config.ts\n * import { inject, provideAppInitializer } from '@angular/core';\n * import { ThemeService } from '@africanies/africanies-theme';\n *\n * export const appConfig = {\n * providers: [\n * provideAppInitializer(() => {\n * inject(ThemeService); // applies stored / system theme once\n * }),\n * ],\n * };\n *\n * // In a component\n * const theme = inject(ThemeService);\n * theme.toggle();\n * theme.setTheme('dark');\n * const current = theme.theme(); // 'light' | 'dark'\n * ```\n */\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private readonly storage = inject(STORAGE_TOKEN);\n private readonly document = inject(DOCUMENT);\n\n /**\n * Current theme. Prefer reading via `theme()` in templates / computed values\n * rather than caching the string, so dark-class consumers stay in sync.\n */\n readonly theme = signal<Theme>(this.resolveInitialTheme());\n\n constructor() {\n this.applyToDocument(this.theme());\n }\n\n /**\n * Sets and persists the theme, updating the `dark` class and `color-scheme`\n * on `<html>`.\n *\n * @param theme - Absolute preference to store.\n */\n setTheme(theme: Theme): void {\n this.theme.set(theme);\n this.applyToDocument(theme);\n try {\n this.storage.set(AFRICANIES_THEME_KEY, theme);\n } catch {\n // Persistence failure must not block the in-session visual toggle —\n // private browsing / quota issues are transient for theme preference.\n }\n }\n\n /**\n * Flips between light and dark.\n *\n * @returns The theme after the toggle.\n */\n toggle(): Theme {\n const next: Theme = this.theme() === 'light' ? 'dark' : 'light';\n this.setTheme(next);\n return next;\n }\n\n private resolveInitialTheme(): Theme {\n try {\n const stored = this.storage.get<Theme>(AFRICANIES_THEME_KEY);\n if (stored === 'light' || stored === 'dark') {\n return stored;\n }\n } catch {\n // Fall through to system preference when storage is unavailable.\n }\n return this.prefersDark() ? 'dark' : 'light';\n }\n\n private prefersDark(): boolean {\n const win = this.document.defaultView;\n return !!win?.matchMedia?.('(prefers-color-scheme: dark)').matches;\n }\n\n private applyToDocument(theme: Theme): void {\n const root = this.document.documentElement;\n if (theme === 'dark') {\n root.classList.add('dark');\n } else {\n root.classList.remove('dark');\n }\n // Native date/time pickers follow `color-scheme`, not Tailwind's `dark` class.\n root.style.colorScheme = theme;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;AAiBG;AACI,MAAM,mBAAmB,GAAG;IACjC,aAAa;IACb,WAAW;IACX,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,uBAAuB;IACvB,wBAAwB;IACxB,mBAAmB;IACnB,yBAAyB;IACzB,aAAa;IACb,WAAW;IACX,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;IACf,uBAAuB;IACvB,wBAAwB;IACxB,mBAAmB;IACnB,yBAAyB;;;ACG3B;;;;;;;;;;;;;;;;AAgBG;MAEU,gBAAgB,CAAA;AACV,IAAA,YAAY,GAAG,MAAM,CAAC,mBAAmB,CAAC;AAE3D;;AAEG;AACM,IAAA,OAAO,GAAG,QAAQ,CAAmB,MAAK;;QAEjD,IAAI,IAAI,CAAC,YAAY,CAAC,I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CAAC,MAAM,CAAC;QAC5B;aAAO;AACL,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC;QAC/B;;AAEA,QAAA,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK;IAChC;uGApEW,YAAY,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAZ,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA;;2FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACzClC;;AAEG;;;;"}
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@africanies/africanies-theme",
3
+ "version": "0.0.2",
4
+ "peerDependencies": {
5
+ "@angular/common": "^22.0.0",
6
+ "@angular/core": "^22.0.0",
7
+ "@africanies/africanies-core": ">=0.0.2 <0.1.0",
8
+ "@africanies/africanies-storage": ">=0.0.1 <0.1.0"
9
+ },
10
+ "sideEffects": false,
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "exports": {
15
+ "./tailwind-preset": "./tailwind-preset.cjs",
16
+ "./package.json": {
17
+ "default": "./package.json"
18
+ },
19
+ ".": {
20
+ "types": "./types/africanies-africanies-theme.d.ts",
21
+ "default": "./fesm2022/africanies-africanies-theme.mjs"
22
+ }
23
+ },
24
+ "files": [
25
+ "**/*",
26
+ "tailwind-preset.cjs",
27
+ "THEME.md"
28
+ ],
29
+ "module": "fesm2022/africanies-africanies-theme.mjs",
30
+ "typings": "types/africanies-africanies-theme.d.ts",
31
+ "type": "module",
32
+ "dependencies": {
33
+ "tslib": "^2.3.0"
34
+ }
35
+ }
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Shared Tailwind preset for AFRICANIES product UIs.
3
+ *
4
+ * WHY a preset (not only CSS variables): consuming apps and `@africanies/africanies-ui`
5
+ * already use Tailwind utility classes. Shipping the palette as a preset keeps
6
+ * class names (`text-export`, `bg-import-subtle`, …) consistent and scannable
7
+ * by Tailwind's content detection across packages.
8
+ *
9
+ * Shipped as `.cjs` because ng-packagr publishes this package with
10
+ * `"type": "module"` — a `.js` CommonJS file would break
11
+ * `require('@africanies/africanies-theme/tailwind-preset')`.
12
+ *
13
+ * Consumer setup (see THEME.md):
14
+ * presets: [require('@africanies/africanies-theme/tailwind-preset')]
15
+ * content: app sources + ./node_modules/@africanies/africanies-ui (js/mjs)
16
+ *
17
+ * Also injects base autofill overrides so Chrome/Safari do not paint a
18
+ * yellow/blue fill over AFRICANIES form shells (`bg-white` / `dark:bg-ink-950`),
19
+ * and a pointer cursor on interactive controls.
20
+ *
21
+ * @type {import('tailwindcss').Config}
22
+ */
23
+
24
+ /**
25
+ * Pointer cursor on clickable controls.
26
+ *
27
+ * WHY base CSS (not only `cursor-pointer` utilities): browsers use
28
+ * `cursor: default` on `button`, and Tailwind v4 content detection often
29
+ * skips pnpm-linked `@africanies/africanies-ui` bundles so the utility is never emitted.
30
+ *
31
+ * @param {import('tailwindcss/types/config').PluginAPI} api
32
+ */
33
+ function africaniesInteractiveCursorPlugin({ addBase }) {
34
+ addBase({
35
+ [[
36
+ 'a[href]',
37
+ 'button:not(:disabled):not([aria-disabled="true"])',
38
+ 'summary',
39
+ 'label[for]',
40
+ 'select:not(:disabled)',
41
+ 'input[type="button"]:not(:disabled)',
42
+ 'input[type="submit"]:not(:disabled)',
43
+ 'input[type="reset"]:not(:disabled)',
44
+ 'input[type="checkbox"]:not(:disabled)',
45
+ 'input[type="radio"]:not(:disabled)',
46
+ 'input[type="file"]:not(:disabled)',
47
+ '[role="button"]:not([aria-disabled="true"])',
48
+ '[role="link"]:not([aria-disabled="true"])',
49
+ '[role="menuitem"]:not([aria-disabled="true"])',
50
+ '[role="option"]:not([aria-disabled="true"])',
51
+ '[role="tab"]:not([aria-disabled="true"])',
52
+ '[role="checkbox"]:not([aria-disabled="true"])',
53
+ '[role="radio"]:not([aria-disabled="true"])',
54
+ '[role="switch"]:not([aria-disabled="true"])',
55
+ ].join(', ')]: {
56
+ cursor: 'pointer',
57
+ },
58
+ ':disabled, [aria-disabled="true"]': {
59
+ cursor: 'not-allowed',
60
+ },
61
+ });
62
+ }
63
+
64
+ /**
65
+ * Neutralize browser autofill chrome so fields keep AFRICANIES tokens.
66
+ *
67
+ * WHY inset box-shadow (not `background-color`): WebKit ignores background
68
+ * on `:-webkit-autofill`. A large inset shadow matches the field shell
69
+ * (`white` / `ink-950`) and `-webkit-text-fill-color` keeps body text on
70
+ * `ink` / white. `.dark` matches `ThemeService` (`class` on `<html>`).
71
+ *
72
+ * @param {import('tailwindcss/types/config').PluginAPI} api
73
+ */
74
+ function africaniesAutofillPlugin({ addBase }) {
75
+ const autofillSelectors = [
76
+ 'input:-webkit-autofill',
77
+ 'input:-webkit-autofill:hover',
78
+ 'input:-webkit-autofill:focus',
79
+ 'input:-webkit-autofill:active',
80
+ 'textarea:-webkit-autofill',
81
+ 'textarea:-webkit-autofill:hover',
82
+ 'textarea:-webkit-autofill:focus',
83
+ 'textarea:-webkit-autofill:active',
84
+ ].join(', ');
85
+
86
+ addBase({
87
+ [autofillSelectors]: {
88
+ WebkitTextFillColor: '#212529',
89
+ caretColor: '#212529',
90
+ boxShadow: '0 0 0 1000px #ffffff inset',
91
+ transition: 'background-color 99999s ease-in-out 0s',
92
+ },
93
+ [`.dark ${autofillSelectors}`]: {
94
+ WebkitTextFillColor: '#ffffff',
95
+ caretColor: '#ffffff',
96
+ boxShadow: '0 0 0 1000px #272729 inset',
97
+ },
98
+ });
99
+ }
100
+
101
+ /**
102
+ * Always emit spinner motion.
103
+ *
104
+ * WHY: Tailwind v4 content detection often skips pnpm-linked `@africanies/africanies-ui`
105
+ * bundles, so `animate-spin` on button loading never lands in consumer CSS.
106
+ *
107
+ * @param {import('tailwindcss/types/config').PluginAPI} api
108
+ */
109
+ function africaniesSpinPlugin({ addBase }) {
110
+ addBase({
111
+ '@keyframes africanies-spin': {
112
+ to: { transform: 'rotate(360deg)' },
113
+ },
114
+ '.animate-spin': {
115
+ animation: 'africanies-spin 1s linear infinite',
116
+ },
117
+ });
118
+ }
119
+
120
+ /**
121
+ * Keep toasts above dialogs, drawers, and other CDK overlays.
122
+ *
123
+ * WHY: CDK sets `z-index: 1000` on overlay wrappers, panes, and backdrops.
124
+ * This covers overlays outside the popover top layer; inside it, ToastService
125
+ * re-shows the toast popover to stay in front.
126
+ *
127
+ * @param {import('tailwindcss/types/config').PluginAPI} api
128
+ */
129
+ function africaniesOverlayStackPlugin({ addBase }) {
130
+ addBase({
131
+ '.cdk-global-overlay-wrapper.africanies-toast-overlay, .cdk-overlay-pane.africanies-toast-panel':
132
+ {
133
+ zIndex: '1100',
134
+ },
135
+ });
136
+ }
137
+
138
+ /**
139
+ * Keep overlay scrollbars off close buttons and other end-aligned chrome.
140
+ *
141
+ * WHY: modal/drawer panes used to scroll themselves. Overlay (and some
142
+ * classic) scrollbars paint in the padding box and cover a top-right close
143
+ * control. The pane stays `overflow: hidden`; the hosted component scrolls
144
+ * with `scrollbar-gutter: stable` so the track is reserved even before
145
+ * content overflows. Dialogs that split header/body can set `overflow-hidden`
146
+ * on the host (a utility, so it wins this base rule) and put
147
+ * `.africanies-overlay-scroll` on the body.
148
+ *
149
+ * @param {import('tailwindcss/types/config').PluginAPI} api
150
+ */
151
+ function africaniesOverlayScrollPlugin({ addBase }) {
152
+ addBase({
153
+ '.africanies-modal-panel, .africanies-drawer-panel': {
154
+ overflow: 'hidden',
155
+ overscrollBehavior: 'contain',
156
+ },
157
+ '.africanies-modal-panel > *, .africanies-drawer-panel > *': {
158
+ minHeight: 0,
159
+ overflowX: 'hidden',
160
+ overflowY: 'auto',
161
+ overscrollBehavior: 'contain',
162
+ scrollbarGutter: 'stable',
163
+ },
164
+ '.africanies-drawer-panel > *': {
165
+ height: '100%',
166
+ },
167
+ '.africanies-overlay-scroll': {
168
+ overscrollBehavior: 'contain',
169
+ scrollbarGutter: 'stable',
170
+ },
171
+ });
172
+ }
173
+
174
+ module.exports = {
175
+ darkMode: 'class',
176
+ plugins: [
177
+ africaniesInteractiveCursorPlugin,
178
+ africaniesSpinPlugin,
179
+ africaniesOverlayStackPlugin,
180
+ africaniesOverlayScrollPlugin,
181
+ africaniesAutofillPlugin,
182
+ ],
183
+ theme: {
184
+ extend: {
185
+ colors: {
186
+ black: '#000000',
187
+ white: '#ffffff',
188
+ ink: {
189
+ DEFAULT: '#212529',
190
+ blue: '#192a3e',
191
+ brand: '#1c2b3f',
192
+ 950: '#272729',
193
+ },
194
+ neutral: {
195
+ 300: '#c9d5e1',
196
+ 400: '#a9b5cb',
197
+ 600: '#667185',
198
+ },
199
+ border: {
200
+ // Light chrome on white — match form field borders (`neutral-300`).
201
+ // Previous `#f0f2f5` was too close to white and washed out.
202
+ DEFAULT: '#c9d5e1',
203
+ },
204
+ background: {
205
+ welcome: '#f9fafb',
206
+ },
207
+ export: {
208
+ DEFAULT: '#1cbd5d',
209
+ light: '#24dc6d',
210
+ subtle: '#e4fff3',
211
+ tint: '#f2fff8',
212
+ },
213
+ import: {
214
+ DEFAULT: '#f08829',
215
+ light: '#ffa95b',
216
+ subtle: '#fffcef',
217
+ },
218
+ danger: {
219
+ DEFAULT: '#ff001c',
220
+ dark: '#b41433',
221
+ strong: '#C00B19',
222
+ subtle: '#FFF2F2',
223
+ },
224
+ warning: {
225
+ DEFAULT: '#DBB316',
226
+ dark: '#EF8833',
227
+ subtle: '#FFF6E6',
228
+ },
229
+ },
230
+ fontFamily: {
231
+ sans: ['Arial', 'sans-serif'],
232
+ },
233
+ fontSize: {
234
+ // PROVISIONAL — see THEME.md; sizes may tighten after design QA.
235
+ 'heading-1': ['2.5rem', { lineHeight: 1.2, fontWeight: 700 }],
236
+ 'heading-2': ['2rem', { lineHeight: 1.25, fontWeight: 700 }],
237
+ 'heading-3': ['1.5rem', { lineHeight: 1.3, fontWeight: 600 }],
238
+ 'body-lg': ['1.125rem', { lineHeight: 1.5, fontWeight: 400 }],
239
+ body: ['1rem', { lineHeight: 1.5, fontWeight: 400 }],
240
+ 'body-sm': ['0.875rem', { lineHeight: 1.4, fontWeight: 400 }],
241
+ caption: ['0.75rem', { lineHeight: 1.3, fontWeight: 400 }],
242
+ },
243
+ },
244
+ },
245
+ };