@africanies/angular-web-sdk 0.1.11 → 0.1.13
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/.nx/cache/{13466509747676776487 → 13293303228070520113}/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +66 -1
- package/.nx/cache/13293303228070520113/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/{13466509747676776487 → 13293303228070520113}/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +6 -1
- package/.nx/cache/{6673686859704879504 → 13387631073062967069}/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +31 -13
- package/.nx/cache/13387631073062967069/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/{6673686859704879504 → 13387631073062967069}/dist/libs/africanies-theme/tailwind-preset.cjs +85 -17
- package/.nx/cache/{6673686859704879504 → 13387631073062967069}/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +7 -3
- package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/README.md +31 -0
- package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +249 -0
- package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +1 -0
- package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/package.json +26 -0
- package/.nx/cache/16704640000606796352/dist/libs/africanies-storage/types/africanies-africanies-storage.d.ts +210 -0
- package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +2998 -1122
- package/.nx/cache/2427575433215940812/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{14995846848874973576 → 2427575433215940812}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +450 -140
- package/.nx/cache/{6664915487114632770 → 7730350229628359718}/dist/libs/africanies-icons/assets/icons.sprite.svg +7 -0
- package/.nx/cache/{6664915487114632770 → 7730350229628359718}/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +7 -0
- package/.nx/cache/7730350229628359718/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -0
- package/.nx/cache/{6664915487114632770 → 7730350229628359718}/dist/libs/africanies-icons/types/africanies-africanies-icons.d.ts +2 -2
- package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +2572 -962
- package/.nx/cache/7821397806208783174/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/{14876618240301288353 → 7821397806208783174}/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +460 -147
- package/.nx/cache/run.json +35 -35
- package/.nx/cache/terminalOutputs/10603154579345867998 +397 -0
- package/.nx/cache/terminalOutputs/12354163057083828162 +80 -0
- package/.nx/cache/terminalOutputs/{9040451482998546630 → 13293303228070520113} +1 -1
- package/.nx/cache/terminalOutputs/{6673686859704879504 → 13387631073062967069} +1 -1
- package/.nx/cache/terminalOutputs/{14061940909886036014 → 14876351543379349919} +46 -43
- package/.nx/cache/terminalOutputs/15336883221450327589 +21 -0
- package/.nx/cache/terminalOutputs/16208231681037145050 +87 -0
- package/.nx/cache/terminalOutputs/{13466509747676776487 → 16704640000606796352} +6 -6
- package/.nx/cache/terminalOutputs/1811006905937373707 +74 -0
- package/.nx/cache/terminalOutputs/2005781115771702035 +8 -0
- package/.nx/cache/terminalOutputs/2360743690449633551 +21 -0
- package/.nx/cache/terminalOutputs/{14876618240301288353 → 2427575433215940812} +2 -2
- package/.nx/cache/terminalOutputs/2981230413857865352 +8 -0
- package/.nx/cache/terminalOutputs/3243550283886864639 +8 -0
- package/.nx/cache/terminalOutputs/3380188914363501109 +231 -0
- package/.nx/cache/terminalOutputs/3699068646900552690 +8 -0
- package/.nx/cache/terminalOutputs/5175669339257931410 +8 -0
- package/.nx/cache/terminalOutputs/6040230831125637867 +8 -0
- package/.nx/cache/terminalOutputs/7730350229628359718 +21 -0
- package/.nx/cache/terminalOutputs/{14995846848874973576 → 7821397806208783174} +2 -2
- package/.nx/cache/terminalOutputs/8098730470212963224 +87 -0
- package/.nx/cache/terminalOutputs/8928690901537686687 +21 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +4176 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +2995 -2989
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -2
- package/apps/playground/src/app/pages/forms-page.ts +70 -14
- package/apps/playground/src/app/snippets/forms.snippets.ts +41 -6
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +60 -0
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs +6 -0
- package/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +1 -1
- package/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs +6 -0
- package/dist/libs/africanies-storage/fesm2022/africanies-africanies-storage.mjs.map +1 -1
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +6 -0
- package/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -1
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +1323 -85
- package/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -1
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +201 -15
- package/libs/africanies-core/src/lib/auth/auth-token.service.ts +3 -0
- package/libs/africanies-core/src/lib/auth/auth.service.ts +3 -0
- package/libs/africanies-core/src/lib/country/country.service.ts +3 -0
- package/libs/africanies-core/src/lib/currency/currency.service.ts +3 -0
- package/libs/africanies-core/src/lib/document/document.service.ts +3 -0
- package/libs/africanies-core/src/lib/file/file.service.ts +3 -0
- package/libs/africanies-core/src/lib/filters/filter-options.resolver.ts +3 -0
- package/libs/africanies-core/src/lib/http/api-client.ts +3 -0
- package/libs/africanies-core/src/lib/mode/mode-config.service.ts +3 -0
- package/libs/africanies-core/src/lib/notification/notification.service.ts +3 -0
- package/libs/africanies-core/src/lib/overlay/route-overlay.service.ts +3 -0
- package/libs/africanies-core/src/lib/payment-method/payment-method.service.ts +3 -0
- package/libs/africanies-core/src/lib/plan/plan.service.ts +3 -0
- package/libs/africanies-core/src/lib/product/product.service.ts +3 -0
- package/libs/africanies-core/src/lib/service/service.service.ts +3 -0
- package/libs/africanies-core/src/lib/shipment-method/shipment-method.service.ts +3 -0
- package/libs/africanies-core/src/lib/shipping/shipping-mode.service.ts +3 -0
- package/libs/africanies-core/src/lib/user/user.service.ts +3 -0
- package/libs/africanies-core/src/lib/warehouse/warehouse.service.ts +3 -0
- package/libs/africanies-core/src/lib/zone/zone.service.ts +3 -0
- package/libs/africanies-icons/src/lib/africanies-icon.component.ts +3 -0
- package/libs/africanies-icons/src/lib/icon-registry.service.ts +3 -0
- package/libs/africanies-storage/src/lib/local-storage.service.ts +3 -0
- package/libs/africanies-storage/src/lib/session-storage.service.ts +3 -0
- package/libs/africanies-theme/src/lib/mode-color.service.ts +3 -0
- package/libs/africanies-theme/src/lib/theme.service.ts +3 -0
- package/libs/africanies-ui/src/index.ts +18 -0
- package/libs/africanies-ui/src/lib/accordion/accordion.component.ts +3 -0
- package/libs/africanies-ui/src/lib/action-menu/action-menu-trigger.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/action-menu/action-menu.component.ts +3 -0
- package/libs/africanies-ui/src/lib/alert/alert.component.ts +3 -0
- package/libs/africanies-ui/src/lib/avatar/avatar-menu.component.ts +3 -0
- package/libs/africanies-ui/src/lib/avatar/avatar.component.ts +3 -0
- package/libs/africanies-ui/src/lib/brand/brand-logo.component.ts +3 -0
- package/libs/africanies-ui/src/lib/button/button.component.ts +3 -0
- package/libs/africanies-ui/src/lib/carrier/carrier-logo.component.ts +3 -0
- package/libs/africanies-ui/src/lib/chip/chip.component.ts +3 -0
- package/libs/africanies-ui/src/lib/content-stack/content-stack.component.ts +3 -0
- package/libs/africanies-ui/src/lib/copy-button/copy-button.component.ts +3 -0
- package/libs/africanies-ui/src/lib/feedback/async-state.component.ts +3 -0
- package/libs/africanies-ui/src/lib/feedback/empty-state.component.ts +3 -0
- package/libs/africanies-ui/src/lib/feedback/error-indicator.component.ts +3 -0
- package/libs/africanies-ui/src/lib/feedback/error-state.component.ts +3 -0
- package/libs/africanies-ui/src/lib/feedback/loading-state.component.ts +3 -0
- package/libs/africanies-ui/src/lib/filters/filter-drawer.panel.ts +3 -0
- package/libs/africanies-ui/src/lib/filters/filter-drawer.service.ts +3 -0
- package/libs/africanies-ui/src/lib/filters/filter-query.service.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/address-input/address-input.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/address-input/google-places.service.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/checkbox/checkbox.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/date-picker/date-picker.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/file-upload/camera-capture.dialog.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/file-upload/file-preview.dialog.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/file-upload/file-upload.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/index.ts +20 -0
- package/libs/africanies-ui/src/lib/forms/number-input/number-input.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/otp-input/otp-input.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/index.ts +21 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/phone-codes.ts +264 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/phone-input.component.ts +480 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/phone-input.types.ts +35 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/phone-input.utils.spec.ts +81 -0
- package/libs/africanies-ui/src/lib/forms/phone-input/phone-input.utils.ts +275 -0
- package/libs/africanies-ui/src/lib/forms/radio/radio.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/search-combobox/search-combobox.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/select/select.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/text-input/text-input.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/textarea/textarea.component.ts +3 -0
- package/libs/africanies-ui/src/lib/forms/toggle/toggle.component.ts +3 -0
- package/libs/africanies-ui/src/lib/image/image.component.ts +3 -0
- package/libs/africanies-ui/src/lib/info-popover/info-popover-content.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/info-popover/info-popover-trigger.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/info-popover/info-popover.component.ts +3 -0
- package/libs/africanies-ui/src/lib/layout/app-shell-content-header.component.ts +3 -0
- package/libs/africanies-ui/src/lib/layout/app-shell-header-slot.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/layout/app-shell-header.component.ts +9 -0
- package/libs/africanies-ui/src/lib/layout/app-shell.component.ts +3 -0
- package/libs/africanies-ui/src/lib/layout/header-weather.spec.ts +62 -94
- package/libs/africanies-ui/src/lib/layout/header-weather.ts +54 -61
- package/libs/africanies-ui/src/lib/layout/page-header.component.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-actions.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-feedback.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-forms.module.ts +5 -0
- package/libs/africanies-ui/src/lib/modules/africanies-info-popover.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-navigation.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-stepper.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-table.module.ts +3 -0
- package/libs/africanies-ui/src/lib/modules/africanies-tooltip.module.ts +3 -0
- package/libs/africanies-ui/src/lib/navigation/breadcrumb/breadcrumb.component.ts +3 -0
- package/libs/africanies-ui/src/lib/navigation/segment/segment.component.ts +5 -1
- package/libs/africanies-ui/src/lib/navigation/shipping-mode-switch/shipping-mode-switch.component.ts +3 -0
- package/libs/africanies-ui/src/lib/navigation/side-nav/africanies-side-nav.component.ts +3 -0
- package/libs/africanies-ui/src/lib/navigation/tabs/tab-def.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/navigation/tabs/tabs.component.ts +3 -0
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.panel.ts +3 -0
- package/libs/africanies-ui/src/lib/notifications/notification-drawer.service.ts +3 -0
- package/libs/africanies-ui/src/lib/overlay/confirm-dialog.component.ts +3 -0
- package/libs/africanies-ui/src/lib/overlay/confirm.service.ts +3 -0
- package/libs/africanies-ui/src/lib/overlay/drawer.service.ts +3 -0
- package/libs/africanies-ui/src/lib/overlay/modal.service.ts +3 -0
- package/libs/africanies-ui/src/lib/overlay/overlay-frame.component.ts +9 -0
- package/libs/africanies-ui/src/lib/pagination/pagination.component.ts +3 -0
- package/libs/africanies-ui/src/lib/stepper/step-def.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/stepper/stepper.component.ts +3 -0
- package/libs/africanies-ui/src/lib/table/cell-def.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/table/header-cell-def.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/table/row-detail-def.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/table/table.component.ts +3 -0
- package/libs/africanies-ui/src/lib/toast/toast-host.component.ts +4 -1
- package/libs/africanies-ui/src/lib/toast/toast-item.component.ts +3 -0
- package/libs/africanies-ui/src/lib/toast/toast.service.ts +3 -0
- package/libs/africanies-ui/src/lib/tooltip/tooltip-trigger.directive.ts +3 -0
- package/libs/africanies-ui/src/lib/tooltip/tooltip.component.ts +3 -0
- package/package.json +1 -1
- package/.nx/cache/13466509747676776487/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/14416694322692463866/dist/libs/africanies-models/README.md +0 -60
- package/.nx/cache/14416694322692463866/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs +0 -599
- package/.nx/cache/14416694322692463866/dist/libs/africanies-models/fesm2022/africanies-africanies-models.mjs.map +0 -1
- package/.nx/cache/14416694322692463866/dist/libs/africanies-models/package.json +0 -23
- package/.nx/cache/14416694322692463866/dist/libs/africanies-models/types/africanies-africanies-models.d.ts +0 -1452
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/14995846848874973576/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +0 -1
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +0 -221
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/tailwind-preset.cjs +0 -253
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +0 -166
- package/.nx/cache/6664915487114632770/dist/libs/africanies-icons/fesm2022/africanies-africanies-icons.mjs.map +0 -1
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/README.md +0 -46
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +0 -1
- package/.nx/cache/6673686859704879504/dist/libs/africanies-theme/package.json +0 -35
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/README.md +0 -85
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +0 -4511
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +0 -1
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/package.json +0 -31
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +0 -2741
- package/.nx/cache/terminalOutputs/13555699813138069787 +0 -6
- package/.nx/cache/terminalOutputs/14416694322692463866 +0 -108
- package/.nx/cache/terminalOutputs/1446890025183346611 +0 -32
- package/.nx/cache/terminalOutputs/17394769338046050914 +0 -8
- package/.nx/cache/terminalOutputs/17626862048742598274 +0 -21
- package/.nx/cache/terminalOutputs/6337357866566791975 +0 -6
- package/.nx/cache/terminalOutputs/6664915487114632770 +0 -44
- package/.nx/cache/terminalOutputs/783228502946611950 +0 -19
- package/.nx/cache/terminalOutputs/7978448102466861029 +0 -32
- /package/.nx/cache/{13466509747676776487 → 13293303228070520113}/dist/libs/africanies-core/README.md +0 -0
- /package/.nx/cache/{13466509747676776487 → 13293303228070520113}/dist/libs/africanies-core/package.json +0 -0
- /package/.nx/cache/{17626862048742598274 → 13387631073062967069}/dist/libs/africanies-theme/README.md +0 -0
- /package/.nx/cache/{17626862048742598274 → 13387631073062967069}/dist/libs/africanies-theme/package.json +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{14876618240301288353 → 2427575433215940812}/dist/libs/africanies-ui/package.json +0 -0
- /package/.nx/cache/{6664915487114632770 → 7730350229628359718}/dist/libs/africanies-icons/README.md +0 -0
- /package/.nx/cache/{6664915487114632770 → 7730350229628359718}/dist/libs/africanies-icons/package.json +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/README.md +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/assets/carriers/dhl.svg +0 -0
- /package/.nx/cache/{14995846848874973576 → 7821397806208783174}/dist/libs/africanies-ui/package.json +0 -0
|
@@ -2241,7 +2241,10 @@ declare class NotificationService {
|
|
|
2241
2241
|
static ɵprov: i0.ɵɵInjectableDeclaration<NotificationService>;
|
|
2242
2242
|
}
|
|
2243
2243
|
|
|
2244
|
-
/**
|
|
2244
|
+
/**
|
|
2245
|
+
* Signed export downloads and other hosts that must not be rewritten in-app.
|
|
2246
|
+
* @param link
|
|
2247
|
+
*/
|
|
2245
2248
|
declare function isNotificationExternalLink(link: string): boolean;
|
|
2246
2249
|
/**
|
|
2247
2250
|
* Rewrite a notification href for the active {@link ShippingMode}.
|
|
@@ -2250,6 +2253,8 @@ declare function isNotificationExternalLink(link: string): boolean;
|
|
|
2250
2253
|
* - Legacy portal hosts become relative `/portal/...` paths with query preserved.
|
|
2251
2254
|
* - When the notification already includes `shipment_app`, it is kept as-is.
|
|
2252
2255
|
* - Otherwise classic host / `shipment_app` rewriting applies for portal URLs.
|
|
2256
|
+
* @param link
|
|
2257
|
+
* @param mode
|
|
2253
2258
|
*/
|
|
2254
2259
|
declare function resolveNotificationLinkForMode(link: string | null | undefined, mode: ShippingMode): string;
|
|
2255
2260
|
|
|
@@ -15,38 +15,50 @@ import { STORAGE_TOKEN, AFRICANIES_THEME_KEY } from '@africanies/africanies-stor
|
|
|
15
15
|
* Do not rename these strings without updating ModeColorService and THEME.md.
|
|
16
16
|
*
|
|
17
17
|
* SFN (export / green):
|
|
18
|
+
* text-export-strong bg-export-strong hover:bg-export-hover border-export-strong
|
|
18
19
|
* text-export bg-export bg-export-subtle bg-export-light border-export
|
|
19
20
|
* hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15
|
|
20
|
-
* dark:bg-[color-mix(in_srgb,#
|
|
21
|
+
* dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)] dark:bg-export dark:text-export dark:border-export
|
|
21
22
|
*
|
|
22
23
|
* STN (import / orange):
|
|
24
|
+
* text-import-strong bg-import-strong hover:bg-import-hover border-import-strong
|
|
23
25
|
* text-import bg-import bg-import-subtle bg-import-light border-import
|
|
24
26
|
* hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15
|
|
25
27
|
* dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)] dark:bg-import dark:text-import dark:border-import
|
|
26
28
|
*/
|
|
27
29
|
const MODE_COLOR_SAFELIST = [
|
|
28
30
|
'text-export',
|
|
31
|
+
'text-export-strong',
|
|
29
32
|
'bg-export',
|
|
33
|
+
'bg-export-strong',
|
|
30
34
|
'bg-export-subtle',
|
|
31
35
|
'bg-export-light',
|
|
32
36
|
'border-export',
|
|
37
|
+
'border-export-strong',
|
|
38
|
+
'hover:bg-export-hover',
|
|
33
39
|
'hover:bg-export-light',
|
|
34
40
|
'hover:bg-export-subtle',
|
|
35
41
|
'dark:bg-export/15',
|
|
36
42
|
'dark:hover:bg-export/15',
|
|
37
|
-
'dark:bg-
|
|
43
|
+
'dark:hover:bg-export-light',
|
|
44
|
+
'dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)]',
|
|
38
45
|
'dark:bg-export',
|
|
39
46
|
'dark:text-export',
|
|
40
47
|
'dark:border-export',
|
|
41
48
|
'text-import',
|
|
49
|
+
'text-import-strong',
|
|
42
50
|
'bg-import',
|
|
51
|
+
'bg-import-strong',
|
|
43
52
|
'bg-import-subtle',
|
|
44
53
|
'bg-import-light',
|
|
45
54
|
'border-import',
|
|
55
|
+
'border-import-strong',
|
|
56
|
+
'hover:bg-import-hover',
|
|
46
57
|
'hover:bg-import-light',
|
|
47
58
|
'hover:bg-import-subtle',
|
|
48
59
|
'dark:bg-import/15',
|
|
49
60
|
'dark:hover:bg-import/15',
|
|
61
|
+
'dark:hover:bg-import-light',
|
|
50
62
|
'dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',
|
|
51
63
|
'dark:bg-import',
|
|
52
64
|
'dark:text-import',
|
|
@@ -70,6 +82,9 @@ const MODE_COLOR_SAFELIST = [
|
|
|
70
82
|
* <span [class]="colors.text">Mode accent</span>
|
|
71
83
|
* ```
|
|
72
84
|
*/
|
|
85
|
+
/**
|
|
86
|
+
* Maps {@link ShippingModeService} to mode-accent Tailwind classes.
|
|
87
|
+
*/
|
|
73
88
|
class ModeColorService {
|
|
74
89
|
shippingMode = inject(ShippingModeService);
|
|
75
90
|
/**
|
|
@@ -79,31 +94,31 @@ class ModeColorService {
|
|
|
79
94
|
// Literal strings required for Tailwind content detection — do not interpolate.
|
|
80
95
|
if (this.shippingMode.mode() === 'sfn') {
|
|
81
96
|
return {
|
|
82
|
-
text: 'text-export',
|
|
97
|
+
text: 'text-export dark:text-export',
|
|
83
98
|
bg: 'bg-export',
|
|
84
99
|
bgSubtle: 'bg-export-subtle',
|
|
85
100
|
border: 'border-export',
|
|
86
|
-
primary: 'bg-export text-white border-transparent hover:bg-export-light',
|
|
87
|
-
ghostPrimary: 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:hover:bg-export/15',
|
|
101
|
+
primary: 'bg-export text-white border-transparent hover:bg-export-strong dark:bg-export dark:hover:bg-export-light',
|
|
102
|
+
ghostPrimary: 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:text-export dark:hover:bg-export/15',
|
|
88
103
|
soft: 'bg-export-subtle dark:bg-export/15',
|
|
89
|
-
softSolid: 'bg-export-subtle dark:bg-[color-mix(in_srgb,#
|
|
104
|
+
softSolid: 'bg-export-subtle dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)]',
|
|
90
105
|
softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',
|
|
91
|
-
activeFill: 'bg-export text-white border-transparent dark:bg-export dark:text-white',
|
|
92
|
-
stroked: 'bg-
|
|
106
|
+
activeFill: 'bg-export text-white border-transparent hover:bg-export-strong dark:bg-export dark:text-white dark:hover:bg-export-light',
|
|
107
|
+
stroked: 'bg-surface text-export border-export hover:bg-export-subtle dark:bg-ink-950 dark:text-export dark:border-export dark:hover:bg-export/15',
|
|
93
108
|
};
|
|
94
109
|
}
|
|
95
110
|
return {
|
|
96
|
-
text: 'text-import',
|
|
111
|
+
text: 'text-import-strong dark:text-import',
|
|
97
112
|
bg: 'bg-import',
|
|
98
113
|
bgSubtle: 'bg-import-subtle',
|
|
99
114
|
border: 'border-import',
|
|
100
|
-
primary: 'bg-import text-white border-transparent hover:bg-import-light',
|
|
101
|
-
ghostPrimary: 'bg-transparent text-import border-transparent hover:bg-import-subtle dark:hover:bg-import/15',
|
|
115
|
+
primary: 'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:hover:bg-import-light',
|
|
116
|
+
ghostPrimary: 'bg-transparent text-import-strong border-transparent hover:bg-import-subtle dark:text-import dark:hover:bg-import/15',
|
|
102
117
|
soft: 'bg-import-subtle dark:bg-import/15',
|
|
103
118
|
softSolid: 'bg-import-subtle dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',
|
|
104
119
|
softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',
|
|
105
|
-
activeFill: 'bg-import text-white border-transparent dark:bg-import dark:text-white',
|
|
106
|
-
stroked: 'bg-
|
|
120
|
+
activeFill: 'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:text-white dark:hover:bg-import-light',
|
|
121
|
+
stroked: 'bg-surface text-import-strong border-import-strong hover:bg-import-subtle dark:bg-ink-950 dark:text-import dark:border-import dark:hover:bg-import/15',
|
|
107
122
|
};
|
|
108
123
|
}, /* @ts-ignore */
|
|
109
124
|
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
@@ -149,6 +164,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImpor
|
|
|
149
164
|
* const current = theme.theme(); // 'light' | 'dark'
|
|
150
165
|
* ```
|
|
151
166
|
*/
|
|
167
|
+
/**
|
|
168
|
+
* Application light/dark theme preference.
|
|
169
|
+
*/
|
|
152
170
|
class ThemeService {
|
|
153
171
|
storage = inject(STORAGE_TOKEN);
|
|
154
172
|
document = inject(DOCUMENT);
|
|
@@ -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-strong bg-export-strong hover:bg-export-hover border-export-strong\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 * dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)] dark:bg-export dark:text-export dark:border-export\n *\n * STN (import / orange):\n * text-import-strong bg-import-strong hover:bg-import-hover border-import-strong\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 * dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)] dark:bg-import dark:text-import dark:border-import\n */\nexport const MODE_COLOR_SAFELIST = [\n 'text-export',\n 'text-export-strong',\n 'bg-export',\n 'bg-export-strong',\n 'bg-export-subtle',\n 'bg-export-light',\n 'border-export',\n 'border-export-strong',\n 'hover:bg-export-hover',\n 'hover:bg-export-light',\n 'hover:bg-export-subtle',\n 'dark:bg-export/15',\n 'dark:hover:bg-export/15',\n 'dark:hover:bg-export-light',\n 'dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)]',\n 'dark:bg-export',\n 'dark:text-export',\n 'dark:border-export',\n 'text-import',\n 'text-import-strong',\n 'bg-import',\n 'bg-import-strong',\n 'bg-import-subtle',\n 'bg-import-light',\n 'border-import',\n 'border-import-strong',\n 'hover:bg-import-hover',\n 'hover:bg-import-light',\n 'hover:bg-import-subtle',\n 'dark:bg-import/15',\n 'dark:hover:bg-import/15',\n 'dark:hover:bg-import-light',\n 'dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',\n 'dark:bg-import',\n 'dark:text-import',\n 'dark:border-import',\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 /**\n * Accessible accent text — mode brand color in light and dark.\n */\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 * Dark uses a translucent tint — fine over solid surfaces, not for\n * sticky overlays (see {@link softSolid}).\n */\n soft: string;\n /**\n * Opaque soft fill — same tint as {@link soft}, but dark mode mixes into\n * ink so scrolled content cannot show through (sticky table headers/cells).\n */\n softSolid: string;\n /**\n * Soft hover highlight for menus and lists.\n */\n softHover: string;\n /**\n * Active nav leaf / collapsed rail — solid mode fill + white text.\n */\n activeFill: string;\n /**\n * Stroked secondary CTA — white fill, mode border + text (portal `.btn-stroked`).\n */\n stroked: 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' })\n/**\n * Maps {@link ShippingModeService} to mode-accent Tailwind classes.\n */\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 dark: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-strong dark:bg-export dark:hover:bg-export-light',\n ghostPrimary:\n 'bg-transparent text-export border-transparent hover:bg-export-subtle dark:text-export dark:hover:bg-export/15',\n soft: 'bg-export-subtle dark:bg-export/15',\n softSolid:\n 'bg-export-subtle dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)]',\n softHover: 'hover:bg-export-subtle dark:hover:bg-export/15',\n activeFill:\n 'bg-export text-white border-transparent hover:bg-export-strong dark:bg-export dark:text-white dark:hover:bg-export-light',\n stroked:\n 'bg-surface text-export border-export hover:bg-export-subtle dark:bg-ink-950 dark:text-export dark:border-export dark:hover:bg-export/15',\n };\n }\n return {\n text: 'text-import-strong dark:text-import',\n bg: 'bg-import',\n bgSubtle: 'bg-import-subtle',\n border: 'border-import',\n primary:\n 'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:hover:bg-import-light',\n ghostPrimary:\n 'bg-transparent text-import-strong border-transparent hover:bg-import-subtle dark:text-import dark:hover:bg-import/15',\n soft: 'bg-import-subtle dark:bg-import/15',\n softSolid:\n 'bg-import-subtle dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]',\n softHover: 'hover:bg-import-subtle dark:hover:bg-import/15',\n activeFill:\n 'bg-import-strong text-white border-transparent hover:bg-import-hover dark:bg-import dark:text-white dark:hover:bg-import-light',\n stroked:\n 'bg-surface text-import-strong border-import-strong hover:bg-import-subtle dark:bg-ink-950 dark:text-import dark:border-import 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' })\n/**\n * Application light/dark theme preference.\n */\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":"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"}
|
|
@@ -92,8 +92,8 @@ function africaniesAutofillPlugin({ addBase }) {
|
|
|
92
92
|
const rules = {};
|
|
93
93
|
for (const selector of autofillSelectors) {
|
|
94
94
|
rules[selector] = {
|
|
95
|
-
WebkitTextFillColor: '#
|
|
96
|
-
caretColor: '#
|
|
95
|
+
WebkitTextFillColor: '#172033',
|
|
96
|
+
caretColor: '#172033',
|
|
97
97
|
boxShadow: '0 0 0 1000px #ffffff inset',
|
|
98
98
|
transition: 'background-color 99999s ease-in-out 0s',
|
|
99
99
|
};
|
|
@@ -143,6 +143,36 @@ function africaniesOverlayStackPlugin({ addBase }) {
|
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Shared elevated card shell so list/detail pages keep one light-theme recipe.
|
|
148
|
+
*
|
|
149
|
+
* @param {import('tailwindcss/types/config').PluginAPI} api
|
|
150
|
+
*/
|
|
151
|
+
function africaniesSurfacePlugin({ addComponents }) {
|
|
152
|
+
addComponents({
|
|
153
|
+
'.africanies-card': {
|
|
154
|
+
borderRadius: '0.75rem',
|
|
155
|
+
borderWidth: '1px',
|
|
156
|
+
borderStyle: 'solid',
|
|
157
|
+
borderColor: '#dde3ea',
|
|
158
|
+
backgroundColor: '#ffffff',
|
|
159
|
+
padding: '1.25rem',
|
|
160
|
+
color: '#172033',
|
|
161
|
+
boxShadow:
|
|
162
|
+
'0 1px 2px rgb(23 32 51 / 0.04), 0 1px 3px rgb(23 32 51 / 0.06)',
|
|
163
|
+
'@media (min-width: 640px)': {
|
|
164
|
+
padding: '1.5rem',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
'.dark .africanies-card': {
|
|
168
|
+
borderColor: 'rgba(255, 255, 255, 0.1)',
|
|
169
|
+
backgroundColor: '#272729',
|
|
170
|
+
color: '#ffffff',
|
|
171
|
+
boxShadow: 'none',
|
|
172
|
+
},
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
146
176
|
/**
|
|
147
177
|
* Keep overlay scrollbars off close buttons and other end-aligned chrome.
|
|
148
178
|
*
|
|
@@ -186,6 +216,7 @@ module.exports = {
|
|
|
186
216
|
africaniesSpinPlugin,
|
|
187
217
|
africaniesOverlayStackPlugin,
|
|
188
218
|
africaniesOverlayScrollPlugin,
|
|
219
|
+
africaniesSurfacePlugin,
|
|
189
220
|
africaniesAutofillPlugin,
|
|
190
221
|
],
|
|
191
222
|
theme: {
|
|
@@ -193,56 +224,83 @@ module.exports = {
|
|
|
193
224
|
colors: {
|
|
194
225
|
black: '#000000',
|
|
195
226
|
white: '#ffffff',
|
|
227
|
+
surface: {
|
|
228
|
+
DEFAULT: '#ffffff',
|
|
229
|
+
subtle: '#f8fafc',
|
|
230
|
+
hover: '#e9eef5',
|
|
231
|
+
sunken: '#eef2f6',
|
|
232
|
+
},
|
|
196
233
|
ink: {
|
|
197
|
-
//
|
|
198
|
-
DEFAULT: '#
|
|
234
|
+
// High-contrast cool navy for light-theme body and heading text.
|
|
235
|
+
DEFAULT: '#172033',
|
|
199
236
|
blue: '#192a3e',
|
|
200
|
-
brand: '#
|
|
237
|
+
brand: '#172033',
|
|
201
238
|
// Previous ink DEFAULT — dark elevated cards / panels (`dark:bg-ink-surface`).
|
|
202
239
|
surface: '#212529',
|
|
203
240
|
950: '#272729',
|
|
204
241
|
},
|
|
205
242
|
neutral: {
|
|
243
|
+
50: '#f8fafc',
|
|
244
|
+
100: '#eef2f6',
|
|
245
|
+
200: '#dde3ea',
|
|
206
246
|
300: '#c9d5e1',
|
|
247
|
+
// Keep 300/400 stable: they are the established dark-theme foregrounds.
|
|
207
248
|
400: '#a9b5cb',
|
|
208
|
-
|
|
249
|
+
500: '#667185',
|
|
250
|
+
600: '#526071',
|
|
251
|
+
700: '#3e4a59',
|
|
252
|
+
800: '#2c3644',
|
|
253
|
+
900: '#172033',
|
|
209
254
|
},
|
|
210
255
|
border: {
|
|
211
|
-
//
|
|
212
|
-
DEFAULT: '#
|
|
213
|
-
|
|
214
|
-
strong: '#e0e6f0',
|
|
256
|
+
// Quiet card/divider chrome. Controls use the stronger `control` token.
|
|
257
|
+
DEFAULT: '#dde3ea',
|
|
258
|
+
strong: '#c4cdd8',
|
|
215
259
|
},
|
|
260
|
+
// 3.1:1 against white: visible enough for meaningful control boundaries.
|
|
261
|
+
control: '#8793a3',
|
|
262
|
+
focus: '#175cd3',
|
|
216
263
|
background: {
|
|
217
|
-
//
|
|
218
|
-
chrome: '#
|
|
264
|
+
// Cooler canvas and a clearer inset level beneath white surfaces.
|
|
265
|
+
chrome: '#f4f6f8',
|
|
219
266
|
// Nested wells inside white cards.
|
|
220
|
-
well: '#
|
|
267
|
+
well: '#eef2f6',
|
|
221
268
|
// Auth / welcome / soft hover.
|
|
222
|
-
welcome: '#
|
|
269
|
+
welcome: '#f8fafc',
|
|
270
|
+
hover: '#e9eef5',
|
|
223
271
|
},
|
|
224
272
|
export: {
|
|
225
|
-
DEFAULT: '#
|
|
273
|
+
DEFAULT: '#26bd5d',
|
|
226
274
|
light: '#24dc6d',
|
|
227
275
|
subtle: '#e4fff3',
|
|
228
276
|
tint: '#f2fff8',
|
|
277
|
+
// Accessible normal-text / white-text-control foreground (5.43:1).
|
|
278
|
+
strong: '#0b7a3e',
|
|
279
|
+
hover: '#096833',
|
|
229
280
|
},
|
|
230
281
|
import: {
|
|
231
282
|
DEFAULT: '#f08829',
|
|
232
283
|
light: '#ffa95b',
|
|
233
284
|
subtle: '#fffcef',
|
|
285
|
+
// Brand orange (same as DEFAULT) — portal STN primary.
|
|
286
|
+
strong: '#f08829',
|
|
287
|
+
hover: '#7f3e09',
|
|
234
288
|
},
|
|
235
289
|
danger: {
|
|
236
290
|
DEFAULT: '#ff001c',
|
|
237
|
-
dark: '#
|
|
291
|
+
dark: '#b4233c',
|
|
238
292
|
strong: '#C00B19',
|
|
239
293
|
subtle: '#FFF2F2',
|
|
240
294
|
},
|
|
241
295
|
warning: {
|
|
242
296
|
DEFAULT: '#DBB316',
|
|
243
|
-
dark: '#
|
|
297
|
+
dark: '#8a5a00',
|
|
244
298
|
subtle: '#FFF6E6',
|
|
245
299
|
},
|
|
300
|
+
info: {
|
|
301
|
+
DEFAULT: '#175cd3',
|
|
302
|
+
subtle: '#eff6ff',
|
|
303
|
+
},
|
|
246
304
|
},
|
|
247
305
|
fontFamily: {
|
|
248
306
|
sans: ['Inter', 'system-ui', 'sans-serif'],
|
|
@@ -257,6 +315,16 @@ module.exports = {
|
|
|
257
315
|
'body-sm': ['0.875rem', { lineHeight: 1.4, fontWeight: 400 }],
|
|
258
316
|
caption: ['0.75rem', { lineHeight: 1.3, fontWeight: 400 }],
|
|
259
317
|
},
|
|
318
|
+
borderRadius: {
|
|
319
|
+
control: '0.5rem',
|
|
320
|
+
panel: '0.75rem',
|
|
321
|
+
},
|
|
322
|
+
boxShadow: {
|
|
323
|
+
card:
|
|
324
|
+
'0 1px 2px rgb(23 32 51 / 0.04), 0 1px 3px rgb(23 32 51 / 0.06)',
|
|
325
|
+
floating:
|
|
326
|
+
'0 12px 32px rgb(23 32 51 / 0.12), 0 2px 8px rgb(23 32 51 / 0.06)',
|
|
327
|
+
},
|
|
260
328
|
},
|
|
261
329
|
},
|
|
262
330
|
};
|
|
@@ -11,16 +11,18 @@ import * as i0 from '@angular/core';
|
|
|
11
11
|
* Do not rename these strings without updating ModeColorService and THEME.md.
|
|
12
12
|
*
|
|
13
13
|
* SFN (export / green):
|
|
14
|
+
* text-export-strong bg-export-strong hover:bg-export-hover border-export-strong
|
|
14
15
|
* text-export bg-export bg-export-subtle bg-export-light border-export
|
|
15
16
|
* hover:bg-export-light hover:bg-export-subtle dark:bg-export/15 dark:hover:bg-export/15
|
|
16
|
-
* dark:bg-[color-mix(in_srgb,#
|
|
17
|
+
* dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)] dark:bg-export dark:text-export dark:border-export
|
|
17
18
|
*
|
|
18
19
|
* STN (import / orange):
|
|
20
|
+
* text-import-strong bg-import-strong hover:bg-import-hover border-import-strong
|
|
19
21
|
* text-import bg-import bg-import-subtle bg-import-light border-import
|
|
20
22
|
* hover:bg-import-light hover:bg-import-subtle dark:bg-import/15 dark:hover:bg-import/15
|
|
21
23
|
* dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)] dark:bg-import dark:text-import dark:border-import
|
|
22
24
|
*/
|
|
23
|
-
declare const MODE_COLOR_SAFELIST: readonly ["text-export", "bg-export", "bg-export-subtle", "bg-export-light", "border-export", "hover:bg-export-light", "hover:bg-export-subtle", "dark:bg-export/15", "dark:hover:bg-export/15", "dark:bg-[color-mix(in_srgb,#
|
|
25
|
+
declare const MODE_COLOR_SAFELIST: readonly ["text-export", "text-export-strong", "bg-export", "bg-export-strong", "bg-export-subtle", "bg-export-light", "border-export", "border-export-strong", "hover:bg-export-hover", "hover:bg-export-light", "hover:bg-export-subtle", "dark:bg-export/15", "dark:hover:bg-export/15", "dark:hover:bg-export-light", "dark:bg-[color-mix(in_srgb,#26bd5d_15%,#212529)]", "dark:bg-export", "dark:text-export", "dark:border-export", "text-import", "text-import-strong", "bg-import", "bg-import-strong", "bg-import-subtle", "bg-import-light", "border-import", "border-import-strong", "hover:bg-import-hover", "hover:bg-import-light", "hover:bg-import-subtle", "dark:bg-import/15", "dark:hover:bg-import/15", "dark:hover:bg-import-light", "dark:bg-[color-mix(in_srgb,#f08829_15%,#212529)]", "dark:bg-import", "dark:text-import", "dark:border-import"];
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Tailwind class bundle for the active shipping mode (SFN export / STN import).
|
|
@@ -29,7 +31,9 @@ declare const MODE_COLOR_SAFELIST: readonly ["text-export", "bg-export", "bg-exp
|
|
|
29
31
|
* and accent text. Semantic colors (danger / warning) stay mode-independent.
|
|
30
32
|
*/
|
|
31
33
|
interface ModeColorClasses {
|
|
32
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Accessible accent text — mode brand color in light and dark.
|
|
36
|
+
*/
|
|
33
37
|
text: string;
|
|
34
38
|
/** Solid background utility, e.g. `bg-export`. */
|
|
35
39
|
bg: string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# @africanies/africanies-storage
|
|
2
|
+
|
|
3
|
+
Injectable browser storage for the AFRICANIES Web SDK. Provides a swappable
|
|
4
|
+
`StorageService` behind `STORAGE_TOKEN`, with `localStorage` (default) and
|
|
5
|
+
`sessionStorage` implementations plus `provideLocalStorage()` /
|
|
6
|
+
`provideSessionStorage()` helpers.
|
|
7
|
+
|
|
8
|
+
Shipping mode (`ShippingModeService` in `@africanies/africanies-core`) always persists
|
|
9
|
+
via `SessionStorageService` directly so each browser tab can use a different
|
|
10
|
+
STN/SFN mode. Theme and auth token use `STORAGE_TOKEN` (localStorage by default).
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import {
|
|
16
|
+
STORAGE_TOKEN,
|
|
17
|
+
provideLocalStorage,
|
|
18
|
+
AFRICANIES_THEME_KEY,
|
|
19
|
+
} from '@africanies/africanies-storage';
|
|
20
|
+
|
|
21
|
+
// app.config.ts
|
|
22
|
+
providers: [provideLocalStorage()];
|
|
23
|
+
|
|
24
|
+
// elsewhere
|
|
25
|
+
const storage = inject(STORAGE_TOKEN);
|
|
26
|
+
storage.set(AFRICANIES_THEME_KEY, 'dark');
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Tests
|
|
30
|
+
|
|
31
|
+
Run `nx test africanies-storage`.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injectable, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Browser key-value persistence abstraction used by theme, shipping mode,
|
|
6
|
+
* and auth token flows.
|
|
7
|
+
*
|
|
8
|
+
* Implementations JSON-serialize values so callers work with typed objects
|
|
9
|
+
* rather than raw strings. Prefer injecting via {@link STORAGE_TOKEN} so
|
|
10
|
+
* tests can swap in an in-memory fake.
|
|
11
|
+
*/
|
|
12
|
+
class StorageService {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* JSON helpers over the Web Storage API.
|
|
17
|
+
*
|
|
18
|
+
* Kept internal so Local/Session services stay thin; failure modes are
|
|
19
|
+
* documented on {@link StorageService} for consumers.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @param store - `localStorage` or `sessionStorage`.
|
|
23
|
+
* @param key - Key to read.
|
|
24
|
+
* @returns Parsed value, or `null` when missing/empty.
|
|
25
|
+
*/
|
|
26
|
+
function readJson(store, key) {
|
|
27
|
+
const raw = store.getItem(key);
|
|
28
|
+
if (raw === null || raw === '') {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
return JSON.parse(raw);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param store - `localStorage` or `sessionStorage`.
|
|
35
|
+
* @param key - Key to write.
|
|
36
|
+
* @param value - JSON-serializable value.
|
|
37
|
+
*/
|
|
38
|
+
function writeJson(store, key, value) {
|
|
39
|
+
store.setItem(key, JSON.stringify(value));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* `localStorage`-backed {@link StorageService}.
|
|
44
|
+
*
|
|
45
|
+
* Default root implementation behind {@link STORAGE_TOKEN}. Values survive
|
|
46
|
+
* browser restarts for the origin.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const storage = inject(LocalStorageService);
|
|
51
|
+
* try {
|
|
52
|
+
* storage.set('user', { id: 1 });
|
|
53
|
+
* } catch (err) {
|
|
54
|
+
* // QuotaExceededError or private-browsing denial
|
|
55
|
+
* console.warn('persist failed', err);
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* `localStorage`-backed {@link StorageService}.
|
|
61
|
+
*/
|
|
62
|
+
class LocalStorageService extends StorageService {
|
|
63
|
+
/**
|
|
64
|
+
* @inheritdoc
|
|
65
|
+
* @throws {DOMException} Quota exceeded or storage disabled in private browsing.
|
|
66
|
+
* @throws {SyntaxError} Stored value is not valid JSON.
|
|
67
|
+
*/
|
|
68
|
+
get(key) {
|
|
69
|
+
return readJson(localStorage, key);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* @inheritdoc
|
|
73
|
+
* @throws {DOMException} Quota exceeded or storage disabled in private browsing.
|
|
74
|
+
* @throws {TypeError} Value is not JSON-serializable.
|
|
75
|
+
*/
|
|
76
|
+
set(key, value) {
|
|
77
|
+
writeJson(localStorage, key, value);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* @inheritdoc
|
|
81
|
+
* @throws {DOMException} When storage is inaccessible.
|
|
82
|
+
*/
|
|
83
|
+
remove(key) {
|
|
84
|
+
localStorage.removeItem(key);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @inheritdoc
|
|
88
|
+
* @throws {DOMException} When storage is inaccessible.
|
|
89
|
+
*/
|
|
90
|
+
clear() {
|
|
91
|
+
localStorage.clear();
|
|
92
|
+
}
|
|
93
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
94
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, providedIn: 'root' });
|
|
95
|
+
}
|
|
96
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: LocalStorageService, decorators: [{
|
|
97
|
+
type: Injectable,
|
|
98
|
+
args: [{ providedIn: 'root' }]
|
|
99
|
+
}] });
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* `sessionStorage`-backed {@link StorageService}.
|
|
103
|
+
*
|
|
104
|
+
* Scope is limited to the current tab/window lifetime — use when values must
|
|
105
|
+
* not outlive the session (e.g. ephemeral UI flags). Register via
|
|
106
|
+
* {@link provideSessionStorage} to bind {@link STORAGE_TOKEN} to this class.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* // app.config.ts
|
|
111
|
+
* providers: [provideSessionStorage()]
|
|
112
|
+
*
|
|
113
|
+
* // elsewhere
|
|
114
|
+
* const storage = inject(STORAGE_TOKEN);
|
|
115
|
+
* try {
|
|
116
|
+
* storage.set('wizard.step', 2);
|
|
117
|
+
* } catch (err) {
|
|
118
|
+
* // QuotaExceededError or private-browsing denial
|
|
119
|
+
* }
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
/**
|
|
123
|
+
* `sessionStorage`-backed {@link StorageService}.
|
|
124
|
+
*/
|
|
125
|
+
class SessionStorageService extends StorageService {
|
|
126
|
+
/**
|
|
127
|
+
* @inheritdoc
|
|
128
|
+
* @throws {DOMException} Quota exceeded or storage disabled in private browsing.
|
|
129
|
+
* @throws {SyntaxError} Stored value is not valid JSON.
|
|
130
|
+
*/
|
|
131
|
+
get(key) {
|
|
132
|
+
return readJson(sessionStorage, key);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @inheritdoc
|
|
136
|
+
* @throws {DOMException} Quota exceeded or storage disabled in private browsing.
|
|
137
|
+
* @throws {TypeError} Value is not JSON-serializable.
|
|
138
|
+
*/
|
|
139
|
+
set(key, value) {
|
|
140
|
+
writeJson(sessionStorage, key, value);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @inheritdoc
|
|
144
|
+
* @throws {DOMException} When storage is inaccessible.
|
|
145
|
+
*/
|
|
146
|
+
remove(key) {
|
|
147
|
+
sessionStorage.removeItem(key);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* @inheritdoc
|
|
151
|
+
* @throws {DOMException} When storage is inaccessible.
|
|
152
|
+
*/
|
|
153
|
+
clear() {
|
|
154
|
+
sessionStorage.clear();
|
|
155
|
+
}
|
|
156
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, deps: null, target: i0.ɵɵFactoryTarget.Injectable });
|
|
157
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, providedIn: 'root' });
|
|
158
|
+
}
|
|
159
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.8", ngImport: i0, type: SessionStorageService, decorators: [{
|
|
160
|
+
type: Injectable,
|
|
161
|
+
args: [{ providedIn: 'root' }]
|
|
162
|
+
}] });
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* DI token for the active {@link StorageService} implementation.
|
|
166
|
+
*
|
|
167
|
+
* Defaults to {@link LocalStorageService} via `providedIn: 'root'`. Override
|
|
168
|
+
* in tests or at bootstrap with {@link provideSessionStorage} /
|
|
169
|
+
* {@link provideLocalStorage}.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* const storage = inject(STORAGE_TOKEN);
|
|
174
|
+
* storage.set('prefs', { dense: true });
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
const STORAGE_TOKEN = new InjectionToken('AFRICANIES_STORAGE', {
|
|
178
|
+
providedIn: 'root',
|
|
179
|
+
factory: () => inject(LocalStorageService),
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Explicitly binds {@link STORAGE_TOKEN} to {@link LocalStorageService}.
|
|
184
|
+
*
|
|
185
|
+
* Redundant with the token's root factory, but useful when an app previously
|
|
186
|
+
* registered session storage and needs to switch back, or for clarity in
|
|
187
|
+
* `app.config.ts`.
|
|
188
|
+
*
|
|
189
|
+
* @returns Environment providers wiring `STORAGE_TOKEN` → localStorage.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* bootstrapApplication(App, {
|
|
194
|
+
* providers: [provideLocalStorage()],
|
|
195
|
+
* });
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
function provideLocalStorage() {
|
|
199
|
+
return makeEnvironmentProviders([
|
|
200
|
+
LocalStorageService,
|
|
201
|
+
{ provide: STORAGE_TOKEN, useExisting: LocalStorageService },
|
|
202
|
+
]);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Binds {@link STORAGE_TOKEN} to {@link SessionStorageService}.
|
|
206
|
+
*
|
|
207
|
+
* Prefer this when SDK consumers (theme, auth token) should persist only
|
|
208
|
+
* for the current tab rather than across sessions.
|
|
209
|
+
*
|
|
210
|
+
* Shipping mode always uses {@link SessionStorageService} directly and is
|
|
211
|
+
* unaffected by this override.
|
|
212
|
+
*
|
|
213
|
+
* @returns Environment providers wiring `STORAGE_TOKEN` → sessionStorage.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* bootstrapApplication(App, {
|
|
218
|
+
* providers: [provideSessionStorage()],
|
|
219
|
+
* });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
function provideSessionStorage() {
|
|
223
|
+
return makeEnvironmentProviders([
|
|
224
|
+
SessionStorageService,
|
|
225
|
+
{ provide: STORAGE_TOKEN, useExisting: SessionStorageService },
|
|
226
|
+
]);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Well-known local/session storage keys used across AFRICANIES SDK packages.
|
|
231
|
+
*
|
|
232
|
+
* Centralizing these avoids typos between theme, shipping-mode, and
|
|
233
|
+
* auth persistence layers that all go through {@link StorageService}.
|
|
234
|
+
*/
|
|
235
|
+
/** Persisted UI theme preference (`'light' | 'dark'` or equivalent). */
|
|
236
|
+
const AFRICANIES_THEME_KEY = 'africanies.theme';
|
|
237
|
+
/** Tab-scoped shipping mode (`'stn' | 'sfn'`) — {@link SessionStorageService}. */
|
|
238
|
+
const AFRICANIES_SHIPPING_MODE_KEY = 'africanies.shippingMode';
|
|
239
|
+
/** Cached public mode-config payload (mapped {@link ModeConfigDataModel}). */
|
|
240
|
+
const AFRICANIES_MODE_CONFIG_KEY = 'africanies.modeConfig';
|
|
241
|
+
/** Persisted bearer access token for authenticated SDK HTTP calls. */
|
|
242
|
+
const AFRICANIES_ACCESS_TOKEN_KEY = 'africanies.accessToken';
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Generated bundle index. Do not edit.
|
|
246
|
+
*/
|
|
247
|
+
|
|
248
|
+
export { AFRICANIES_ACCESS_TOKEN_KEY, AFRICANIES_MODE_CONFIG_KEY, AFRICANIES_SHIPPING_MODE_KEY, AFRICANIES_THEME_KEY, LocalStorageService, STORAGE_TOKEN, SessionStorageService, StorageService, provideLocalStorage, provideSessionStorage };
|
|
249
|
+
//# sourceMappingURL=africanies-africanies-storage.mjs.map
|