@ojiepermana/angular 21.3.0 → 21.3.4
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 +76 -12
- package/component/accordion/package.json +4 -0
- package/component/alert/package.json +4 -0
- package/component/alert-dialog/package.json +4 -0
- package/component/aspect-ratio/package.json +4 -0
- package/component/avatar/package.json +4 -0
- package/component/badge/package.json +4 -0
- package/component/breadcrumb/package.json +4 -0
- package/component/button/package.json +4 -0
- package/component/button-group/package.json +4 -0
- package/component/calendar/package.json +4 -0
- package/component/card/package.json +4 -0
- package/component/carousel/package.json +4 -0
- package/component/chart/area/package.json +4 -0
- package/component/chart/bar/package.json +4 -0
- package/component/chart/line/package.json +4 -0
- package/component/chart/package.json +4 -0
- package/component/chart/pie/package.json +4 -0
- package/component/chart/radar/package.json +4 -0
- package/component/chart/radial/package.json +4 -0
- package/component/chart/scatter/package.json +4 -0
- package/component/checkbox/package.json +4 -0
- package/component/collapsible/package.json +4 -0
- package/component/combobox/package.json +4 -0
- package/component/command/package.json +4 -0
- package/component/context-menu/package.json +4 -0
- package/component/date-picker/package.json +4 -0
- package/component/dialog/package.json +4 -0
- package/component/drawer/package.json +4 -0
- package/component/dropdown-menu/package.json +4 -0
- package/component/form/package.json +4 -0
- package/component/input/package.json +4 -0
- package/component/input-group/package.json +4 -0
- package/component/item/package.json +4 -0
- package/component/label/package.json +4 -0
- package/component/pagination/package.json +4 -0
- package/component/popover/package.json +4 -0
- package/component/progress/package.json +4 -0
- package/component/radio/package.json +4 -0
- package/component/scroll-area/package.json +4 -0
- package/component/select/package.json +4 -0
- package/component/separator/package.json +4 -0
- package/component/sheet/package.json +4 -0
- package/component/skeleton/package.json +4 -0
- package/component/slider/package.json +4 -0
- package/component/switch/package.json +4 -0
- package/component/table/package.json +4 -0
- package/component/tabs/package.json +4 -0
- package/component/textarea/package.json +4 -0
- package/component/toast/package.json +4 -0
- package/component/tooltip/package.json +4 -0
- package/component/utils/package.json +4 -0
- package/fesm2022/{ojiepermana-angular-ui-component-accordion.mjs → ojiepermana-angular-component-accordion.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-accordion.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-alert-dialog.mjs → ojiepermana-angular-component-alert-dialog.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-alert.mjs → ojiepermana-angular-component-alert.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-alert.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-aspect-ratio.mjs → ojiepermana-angular-component-aspect-ratio.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-avatar.mjs → ojiepermana-angular-component-avatar.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-avatar.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-badge.mjs → ojiepermana-angular-component-badge.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-badge.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-breadcrumb.mjs → ojiepermana-angular-component-breadcrumb.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-button-group.mjs → ojiepermana-angular-component-button-group.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-button-group.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-button.mjs → ojiepermana-angular-component-button.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-button.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-calendar.mjs → ojiepermana-angular-component-calendar.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-calendar.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-card.mjs → ojiepermana-angular-component-card.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-card.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-carousel.mjs → ojiepermana-angular-component-carousel.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-carousel.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-area.mjs → ojiepermana-angular-component-chart-area.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-area.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-bar.mjs → ojiepermana-angular-component-chart-bar.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-bar.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-line.mjs → ojiepermana-angular-component-chart-line.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-line.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-pie.mjs → ojiepermana-angular-component-chart-pie.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-pie.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-radar.mjs → ojiepermana-angular-component-chart-radar.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-radar.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-radial.mjs → ojiepermana-angular-component-chart-radial.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-radial.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart-scatter.mjs → ojiepermana-angular-component-chart-scatter.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart-scatter.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-chart.mjs → ojiepermana-angular-component-chart.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-chart.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-checkbox.mjs → ojiepermana-angular-component-checkbox.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-collapsible.mjs → ojiepermana-angular-component-collapsible.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-combobox.mjs → ojiepermana-angular-component-combobox.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-combobox.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-command.mjs → ojiepermana-angular-component-command.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-command.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-context-menu.mjs → ojiepermana-angular-component-context-menu.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-date-picker.mjs → ojiepermana-angular-component-date-picker.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-dialog.mjs → ojiepermana-angular-component-dialog.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-dialog.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-drawer.mjs → ojiepermana-angular-component-drawer.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-drawer.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-dropdown-menu.mjs → ojiepermana-angular-component-dropdown-menu.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-form.mjs → ojiepermana-angular-component-form.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-form.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-input-group.mjs → ojiepermana-angular-component-input-group.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-input-group.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-input.mjs → ojiepermana-angular-component-input.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-input.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-item.mjs → ojiepermana-angular-component-item.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-item.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-label.mjs → ojiepermana-angular-component-label.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-label.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-pagination.mjs → ojiepermana-angular-component-pagination.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-pagination.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-popover.mjs → ojiepermana-angular-component-popover.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-popover.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-progress.mjs → ojiepermana-angular-component-progress.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-progress.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-radio.mjs → ojiepermana-angular-component-radio.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-radio.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-scroll-area.mjs → ojiepermana-angular-component-scroll-area.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-select.mjs → ojiepermana-angular-component-select.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-select.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-separator.mjs → ojiepermana-angular-component-separator.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-separator.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-sheet.mjs → ojiepermana-angular-component-sheet.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-sheet.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-skeleton.mjs → ojiepermana-angular-component-skeleton.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-slider.mjs → ojiepermana-angular-component-slider.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-slider.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-switch.mjs → ojiepermana-angular-component-switch.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-switch.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-table.mjs → ojiepermana-angular-component-table.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-table.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-tabs.mjs → ojiepermana-angular-component-tabs.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-tabs.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-textarea.mjs → ojiepermana-angular-component-textarea.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-textarea.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-toast.mjs → ojiepermana-angular-component-toast.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-toast.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-tooltip.mjs → ojiepermana-angular-component-tooltip.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs.map +1 -0
- package/fesm2022/{ojiepermana-angular-ui-component-utils.mjs → ojiepermana-angular-component-utils.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-component-utils.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-generator-api.mjs +2 -1
- package/fesm2022/ojiepermana-angular-generator-api.mjs.map +1 -1
- package/fesm2022/{ojiepermana-angular-layout-theme.mjs → ojiepermana-angular-layout-component.mjs} +1 -1
- package/fesm2022/ojiepermana-angular-layout-component.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-empty.mjs +49 -0
- package/fesm2022/ojiepermana-angular-layout-empty.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-horizontal.mjs +119 -0
- package/fesm2022/ojiepermana-angular-layout-horizontal.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-provider.mjs +21 -0
- package/fesm2022/ojiepermana-angular-layout-provider.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-services.mjs +114 -0
- package/fesm2022/ojiepermana-angular-layout-services.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-shell.mjs +48 -0
- package/fesm2022/ojiepermana-angular-layout-shell.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-token-directive.mjs +27 -0
- package/fesm2022/ojiepermana-angular-layout-token-directive.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-token.mjs +33 -0
- package/fesm2022/ojiepermana-angular-layout-token.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout-vertical.mjs +113 -0
- package/fesm2022/ojiepermana-angular-layout-vertical.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-layout.mjs +140 -137
- package/fesm2022/ojiepermana-angular-layout.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular-navigation-demo-data.mjs +334 -0
- package/fesm2022/ojiepermana-angular-navigation-demo-data.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular-navigation-item.mjs +548 -0
- package/fesm2022/ojiepermana-angular-navigation-item.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +204 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-navigation-sidebar.mjs +373 -0
- package/fesm2022/ojiepermana-angular-navigation-sidebar.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-navigation-topbar.mjs +433 -0
- package/fesm2022/ojiepermana-angular-navigation-topbar.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +4 -0
- package/fesm2022/ojiepermana-angular-navigation-types.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-theme-provider.mjs +35 -0
- package/fesm2022/ojiepermana-angular-theme-provider.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-theme-services.mjs +286 -0
- package/fesm2022/ojiepermana-angular-theme-services.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-theme-token.mjs +56 -0
- package/fesm2022/ojiepermana-angular-theme-token.mjs.map +1 -0
- package/fesm2022/ojiepermana-angular-theme.mjs +31 -56
- package/fesm2022/ojiepermana-angular-theme.mjs.map +1 -1
- package/fesm2022/ojiepermana-angular.mjs +3 -4
- package/fesm2022/ojiepermana-angular.mjs.map +1 -1
- package/generator/api/README.md +25 -19
- package/generator/api/bin/schematics/init/index.js +4 -2
- package/generator/api/bin/src/config/schema.js +2 -1
- package/generator/api/bin/src/emit/navigation.js +1 -1
- package/generator/api/bin/src/layout/per-domain.js +7 -3
- package/generator/api/bin/src/writer/index.js +45 -3
- package/generator/api/sdk.config.example.json +4 -2
- package/layout/component/package.json +4 -0
- package/layout/empty/package.json +4 -0
- package/layout/horizontal/package.json +4 -0
- package/layout/provider/package.json +4 -0
- package/layout/services/package.json +4 -0
- package/layout/shell/package.json +4 -0
- package/layout/token/directive/package.json +4 -0
- package/layout/token/package.json +4 -0
- package/layout/vertical/package.json +4 -0
- package/navigation/demo-data/package.json +4 -0
- package/navigation/icon/package.json +4 -0
- package/navigation/item/package.json +4 -0
- package/navigation/service/package.json +4 -0
- package/navigation/sidebar/package.json +4 -0
- package/navigation/topbar/package.json +4 -0
- package/navigation/types/package.json +4 -0
- package/package.json +196 -128
- package/theme/README.md +67 -0
- package/theme/provider/package.json +4 -0
- package/theme/services/package.json +4 -0
- package/theme/styles/index.css +12 -7
- package/theme/token/package.json +4 -0
- package/types/{ojiepermana-angular-ui-component-chart.d.ts → ojiepermana-angular-component-chart.d.ts} +15 -15
- package/types/ojiepermana-angular-generator-api.d.ts +2 -1
- package/types/ojiepermana-angular-layout-empty.d.ts +22 -0
- package/types/ojiepermana-angular-layout-horizontal.d.ts +36 -0
- package/types/ojiepermana-angular-layout-provider.d.ts +6 -0
- package/types/ojiepermana-angular-layout-services.d.ts +25 -0
- package/types/ojiepermana-angular-layout-shell.d.ts +8 -0
- package/types/ojiepermana-angular-layout-token-directive.d.ts +13 -0
- package/types/ojiepermana-angular-layout-token.d.ts +36 -0
- package/types/ojiepermana-angular-layout-vertical.d.ts +38 -0
- package/types/ojiepermana-angular-layout.d.ts +26 -25
- package/types/ojiepermana-angular-navigation-demo-data.d.ts +5 -0
- package/types/ojiepermana-angular-navigation-item.d.ts +54 -0
- package/types/ojiepermana-angular-navigation-service.d.ts +77 -0
- package/types/ojiepermana-angular-navigation-sidebar.d.ts +75 -0
- package/types/ojiepermana-angular-navigation-topbar.d.ts +54 -0
- package/types/ojiepermana-angular-navigation-types.d.ts +129 -0
- package/types/ojiepermana-angular-theme-provider.d.ts +11 -0
- package/types/ojiepermana-angular-theme-services.d.ts +55 -0
- package/types/ojiepermana-angular-theme-token.d.ts +57 -0
- package/types/ojiepermana-angular-theme.d.ts +11 -66
- package/fesm2022/ojiepermana-angular-layout-theme.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-navigation.mjs +0 -2317
- package/fesm2022/ojiepermana-angular-navigation.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-accordion.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-alert-dialog.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-alert.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-aspect-ratio.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-avatar.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-badge.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-breadcrumb.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-button-group.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-button.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-calendar.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-card.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-carousel.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-area.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-bar.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-line.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-pie.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-radar.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-radial.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart-scatter.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-chart.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-checkbox.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-collapsible.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-combobox.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-command.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-context-menu.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-date-picker.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-dialog.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-drawer.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-dropdown-menu.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-form.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-input-group.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-input.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-item.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-label.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-pagination.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-popover.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-progress.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-radio.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-scroll-area.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-select.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-separator.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-sheet.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-skeleton.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-slider.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-switch.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-table.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-tabs.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-textarea.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-toast.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-tooltip.mjs.map +0 -1
- package/fesm2022/ojiepermana-angular-ui-component-utils.mjs.map +0 -1
- package/layout/theme/package.json +0 -4
- package/navigation/package.json +0 -4
- package/navigation-icon/package.json +0 -4
- package/types/ojiepermana-angular-navigation.d.ts +0 -375
- package/ui/component/accordion/package.json +0 -4
- package/ui/component/alert/package.json +0 -4
- package/ui/component/alert-dialog/package.json +0 -4
- package/ui/component/aspect-ratio/package.json +0 -4
- package/ui/component/avatar/package.json +0 -4
- package/ui/component/badge/package.json +0 -4
- package/ui/component/breadcrumb/package.json +0 -4
- package/ui/component/button/package.json +0 -4
- package/ui/component/button-group/package.json +0 -4
- package/ui/component/calendar/package.json +0 -4
- package/ui/component/card/package.json +0 -4
- package/ui/component/carousel/package.json +0 -4
- package/ui/component/chart/area/package.json +0 -4
- package/ui/component/chart/bar/package.json +0 -4
- package/ui/component/chart/line/package.json +0 -4
- package/ui/component/chart/package.json +0 -4
- package/ui/component/chart/pie/package.json +0 -4
- package/ui/component/chart/radar/package.json +0 -4
- package/ui/component/chart/radial/package.json +0 -4
- package/ui/component/chart/scatter/package.json +0 -4
- package/ui/component/checkbox/package.json +0 -4
- package/ui/component/collapsible/package.json +0 -4
- package/ui/component/combobox/package.json +0 -4
- package/ui/component/command/package.json +0 -4
- package/ui/component/context-menu/package.json +0 -4
- package/ui/component/date-picker/package.json +0 -4
- package/ui/component/dialog/package.json +0 -4
- package/ui/component/drawer/package.json +0 -4
- package/ui/component/dropdown-menu/package.json +0 -4
- package/ui/component/form/package.json +0 -4
- package/ui/component/input/package.json +0 -4
- package/ui/component/input-group/package.json +0 -4
- package/ui/component/item/package.json +0 -4
- package/ui/component/label/package.json +0 -4
- package/ui/component/pagination/package.json +0 -4
- package/ui/component/popover/package.json +0 -4
- package/ui/component/progress/package.json +0 -4
- package/ui/component/radio/package.json +0 -4
- package/ui/component/scroll-area/package.json +0 -4
- package/ui/component/select/package.json +0 -4
- package/ui/component/separator/package.json +0 -4
- package/ui/component/sheet/package.json +0 -4
- package/ui/component/skeleton/package.json +0 -4
- package/ui/component/slider/package.json +0 -4
- package/ui/component/switch/package.json +0 -4
- package/ui/component/table/package.json +0 -4
- package/ui/component/tabs/package.json +0 -4
- package/ui/component/textarea/package.json +0 -4
- package/ui/component/toast/package.json +0 -4
- package/ui/component/tooltip/package.json +0 -4
- package/ui/component/utils/package.json +0 -4
- /package/{ui/component → component}/chart/README.md +0 -0
- /package/theme/styles/{themes/library/_components.css → foundation/components.css} +0 -0
- /package/theme/styles/{themes/library/_layers.css → foundation/layers.css} +0 -0
- /package/theme/styles/{themes/library/_tokens.css → foundation/tokens.css} +0 -0
- /package/theme/styles/{themes/library/_material-overrides.css → integrations/material.css} +0 -0
- /package/theme/styles/{themes → integrations}/tailwind.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/amber.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/base.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/blue.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/cyan.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/emerald.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/fuchsia.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/green.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/index.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/indigo.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/lime.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/orange.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/pink.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/purple.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/red.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/rose.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/sky.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/teal.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/violet.css +0 -0
- /package/theme/styles/{themes/library → variants}/color/yellow.css +0 -0
- /package/theme/styles/{themes → variants}/mode/dark.css +0 -0
- /package/theme/styles/{themes → variants}/mode/index.css +0 -0
- /package/theme/styles/{themes → variants}/mode/light.css +0 -0
- /package/theme/styles/{themes/library → variants}/style/brutal.css +0 -0
- /package/theme/styles/{themes/library → variants}/style/default.css +0 -0
- /package/theme/styles/{themes/library → variants}/style/index.css +0 -0
- /package/theme/styles/{themes/library → variants}/style/sharp.css +0 -0
- /package/theme/styles/{themes/library → variants}/style/soft.css +0 -0
- /package/types/{ojiepermana-angular-ui-component-accordion.d.ts → ojiepermana-angular-component-accordion.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-alert-dialog.d.ts → ojiepermana-angular-component-alert-dialog.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-alert.d.ts → ojiepermana-angular-component-alert.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-aspect-ratio.d.ts → ojiepermana-angular-component-aspect-ratio.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-avatar.d.ts → ojiepermana-angular-component-avatar.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-badge.d.ts → ojiepermana-angular-component-badge.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-breadcrumb.d.ts → ojiepermana-angular-component-breadcrumb.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-button-group.d.ts → ojiepermana-angular-component-button-group.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-button.d.ts → ojiepermana-angular-component-button.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-calendar.d.ts → ojiepermana-angular-component-calendar.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-card.d.ts → ojiepermana-angular-component-card.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-carousel.d.ts → ojiepermana-angular-component-carousel.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-area.d.ts → ojiepermana-angular-component-chart-area.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-bar.d.ts → ojiepermana-angular-component-chart-bar.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-line.d.ts → ojiepermana-angular-component-chart-line.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-pie.d.ts → ojiepermana-angular-component-chart-pie.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-radar.d.ts → ojiepermana-angular-component-chart-radar.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-radial.d.ts → ojiepermana-angular-component-chart-radial.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-chart-scatter.d.ts → ojiepermana-angular-component-chart-scatter.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-checkbox.d.ts → ojiepermana-angular-component-checkbox.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-collapsible.d.ts → ojiepermana-angular-component-collapsible.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-combobox.d.ts → ojiepermana-angular-component-combobox.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-command.d.ts → ojiepermana-angular-component-command.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-context-menu.d.ts → ojiepermana-angular-component-context-menu.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-date-picker.d.ts → ojiepermana-angular-component-date-picker.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-dialog.d.ts → ojiepermana-angular-component-dialog.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-drawer.d.ts → ojiepermana-angular-component-drawer.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-dropdown-menu.d.ts → ojiepermana-angular-component-dropdown-menu.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-form.d.ts → ojiepermana-angular-component-form.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-input-group.d.ts → ojiepermana-angular-component-input-group.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-input.d.ts → ojiepermana-angular-component-input.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-item.d.ts → ojiepermana-angular-component-item.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-label.d.ts → ojiepermana-angular-component-label.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-pagination.d.ts → ojiepermana-angular-component-pagination.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-popover.d.ts → ojiepermana-angular-component-popover.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-progress.d.ts → ojiepermana-angular-component-progress.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-radio.d.ts → ojiepermana-angular-component-radio.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-scroll-area.d.ts → ojiepermana-angular-component-scroll-area.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-select.d.ts → ojiepermana-angular-component-select.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-separator.d.ts → ojiepermana-angular-component-separator.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-sheet.d.ts → ojiepermana-angular-component-sheet.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-skeleton.d.ts → ojiepermana-angular-component-skeleton.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-slider.d.ts → ojiepermana-angular-component-slider.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-switch.d.ts → ojiepermana-angular-component-switch.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-table.d.ts → ojiepermana-angular-component-table.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-tabs.d.ts → ojiepermana-angular-component-tabs.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-textarea.d.ts → ojiepermana-angular-component-textarea.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-toast.d.ts → ojiepermana-angular-component-toast.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-tooltip.d.ts → ojiepermana-angular-component-tooltip.d.ts} +0 -0
- /package/types/{ojiepermana-angular-ui-component-utils.d.ts → ojiepermana-angular-component-utils.d.ts} +0 -0
- /package/types/{ojiepermana-angular-layout-theme.d.ts → ojiepermana-angular-layout-component.d.ts} +0 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, DestroyRef, signal, computed, effect, Injectable } from '@angular/core';
|
|
4
|
+
import { isThemeColor, MATERIAL_THEME_CONFIG, isColorScheme, DEFAULT_MATERIAL_THEME_CONFIG, isThemeBrand, isThemeStyle } from '@ojiepermana/angular/theme/token';
|
|
5
|
+
|
|
6
|
+
class ThemeService {
|
|
7
|
+
document = inject(DOCUMENT);
|
|
8
|
+
destroyRef = inject(DestroyRef);
|
|
9
|
+
config = this.resolveConfig();
|
|
10
|
+
initialBrand = this.readPersistedBrand() ?? this.config.defaultBrand;
|
|
11
|
+
_modePreference = signal(this.readPersistedMode() ?? this.config.defaultMode, ...(ngDevMode ? [{ debugName: "_modePreference" }] : /* istanbul ignore next */ []));
|
|
12
|
+
_brand = signal(this.initialBrand, ...(ngDevMode ? [{ debugName: "_brand" }] : /* istanbul ignore next */ []));
|
|
13
|
+
_color = signal(this.initialBrand ? this.config.defaultColor : (this.readPersistedColor() ?? this.config.defaultColor), ...(ngDevMode ? [{ debugName: "_color" }] : /* istanbul ignore next */ []));
|
|
14
|
+
_style = signal(this.initialBrand ? this.config.defaultStyle : (this.readPersistedStyle() ?? this.config.defaultStyle), ...(ngDevMode ? [{ debugName: "_style" }] : /* istanbul ignore next */ []));
|
|
15
|
+
_systemPrefersDark = signal(this.prefersDark(), ...(ngDevMode ? [{ debugName: "_systemPrefersDark" }] : /* istanbul ignore next */ []));
|
|
16
|
+
scheme = this._modePreference.asReadonly();
|
|
17
|
+
brand = this._brand.asReadonly();
|
|
18
|
+
color = this._color.asReadonly();
|
|
19
|
+
theme = this._color.asReadonly();
|
|
20
|
+
style = this._style.asReadonly();
|
|
21
|
+
mode = computed(() => this.resolveMode(this._modePreference()), ...(ngDevMode ? [{ debugName: "mode" }] : /* istanbul ignore next */ []));
|
|
22
|
+
snapshot = computed(() => ({
|
|
23
|
+
mode: this.mode(),
|
|
24
|
+
brand: this._brand(),
|
|
25
|
+
color: this._color(),
|
|
26
|
+
style: this._style(),
|
|
27
|
+
}), ...(ngDevMode ? [{ debugName: "snapshot" }] : /* istanbul ignore next */ []));
|
|
28
|
+
isDark = computed(() => this.mode() === 'dark', ...(ngDevMode ? [{ debugName: "isDark" }] : /* istanbul ignore next */ []));
|
|
29
|
+
constructor() {
|
|
30
|
+
this.watchSystemScheme();
|
|
31
|
+
effect(() => {
|
|
32
|
+
const root = this.document.documentElement;
|
|
33
|
+
const mode = this.mode();
|
|
34
|
+
const brand = this._brand();
|
|
35
|
+
const color = this._color();
|
|
36
|
+
const style = this._style();
|
|
37
|
+
root.dataset['mode'] = mode;
|
|
38
|
+
root.dataset['theme'] = brand ?? color;
|
|
39
|
+
root.classList.toggle('dark', mode === 'dark');
|
|
40
|
+
this.persistMode(this._modePreference());
|
|
41
|
+
if (brand) {
|
|
42
|
+
root.setAttribute('theme-brand', brand);
|
|
43
|
+
root.removeAttribute('theme-color');
|
|
44
|
+
root.removeAttribute('theme-style');
|
|
45
|
+
delete root.dataset['color'];
|
|
46
|
+
delete root.dataset['style'];
|
|
47
|
+
this.persistBrand(brand);
|
|
48
|
+
this.clearPersistedColor();
|
|
49
|
+
this.clearPersistedStyle();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
root.removeAttribute('theme-brand');
|
|
53
|
+
root.setAttribute('theme-color', color);
|
|
54
|
+
root.setAttribute('theme-style', style);
|
|
55
|
+
root.dataset['color'] = color;
|
|
56
|
+
root.dataset['style'] = style;
|
|
57
|
+
this.clearPersistedBrand();
|
|
58
|
+
this.persistColor(color);
|
|
59
|
+
this.persistStyle(style);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
setMode(mode) {
|
|
63
|
+
this._modePreference.set(mode);
|
|
64
|
+
}
|
|
65
|
+
setScheme(scheme) {
|
|
66
|
+
this._modePreference.set(scheme);
|
|
67
|
+
}
|
|
68
|
+
setBrand(brand) {
|
|
69
|
+
this._brand.set(brand);
|
|
70
|
+
this._color.set(this.config.defaultColor);
|
|
71
|
+
this._style.set(this.config.defaultStyle);
|
|
72
|
+
}
|
|
73
|
+
setColor(color) {
|
|
74
|
+
if (this._brand()) {
|
|
75
|
+
this._brand.set(null);
|
|
76
|
+
}
|
|
77
|
+
this._color.set(color);
|
|
78
|
+
}
|
|
79
|
+
setTheme(theme) {
|
|
80
|
+
if (isThemeColor(theme)) {
|
|
81
|
+
this.setColor(theme);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
setStyle(style) {
|
|
85
|
+
if (this._brand()) {
|
|
86
|
+
this._brand.set(null);
|
|
87
|
+
}
|
|
88
|
+
this._style.set(style);
|
|
89
|
+
}
|
|
90
|
+
setAll(config) {
|
|
91
|
+
if (config.scheme) {
|
|
92
|
+
this.setScheme(config.scheme);
|
|
93
|
+
}
|
|
94
|
+
if (config.mode) {
|
|
95
|
+
this.setMode(config.mode);
|
|
96
|
+
}
|
|
97
|
+
if (config.brand !== undefined) {
|
|
98
|
+
this.setBrand(config.brand);
|
|
99
|
+
}
|
|
100
|
+
if (config.brand === undefined || config.brand === null) {
|
|
101
|
+
if (config.color) {
|
|
102
|
+
this.setColor(config.color);
|
|
103
|
+
}
|
|
104
|
+
if (config.style) {
|
|
105
|
+
this.setStyle(config.style);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
toggleScheme() {
|
|
110
|
+
this.toggleMode();
|
|
111
|
+
}
|
|
112
|
+
toggleMode() {
|
|
113
|
+
this.setMode(this.mode() === 'dark' ? 'light' : 'dark');
|
|
114
|
+
}
|
|
115
|
+
reset() {
|
|
116
|
+
this._modePreference.set(this.config.defaultMode);
|
|
117
|
+
this._brand.set(this.config.defaultBrand);
|
|
118
|
+
this._color.set(this.config.defaultColor);
|
|
119
|
+
this._style.set(this.config.defaultStyle);
|
|
120
|
+
}
|
|
121
|
+
resolveConfig() {
|
|
122
|
+
const config = inject(MATERIAL_THEME_CONFIG, { optional: true }) ?? {};
|
|
123
|
+
const configuredMode = config.mode ?? config.defaultMode ?? config.defaultScheme;
|
|
124
|
+
const configuredBrand = config.brand ?? config['theme-brand'] ?? config.defaultBrand;
|
|
125
|
+
const configuredColor = config.color ?? config.defaultColor ?? config.defaultTheme;
|
|
126
|
+
const configuredStyle = config.style ?? config.defaultStyle;
|
|
127
|
+
const defaultMode = isColorScheme(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG.defaultMode;
|
|
128
|
+
const defaultBrand = isThemeBrand(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG.defaultBrand;
|
|
129
|
+
const defaultColor = isThemeColor(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG.defaultColor;
|
|
130
|
+
const defaultStyle = isThemeStyle(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG.defaultStyle;
|
|
131
|
+
return {
|
|
132
|
+
defaultMode,
|
|
133
|
+
defaultBrand,
|
|
134
|
+
defaultColor,
|
|
135
|
+
defaultStyle,
|
|
136
|
+
modeStorageKey: config.modeStorageKey ??
|
|
137
|
+
config.schemeStorageKey ??
|
|
138
|
+
config.storageKey ??
|
|
139
|
+
DEFAULT_MATERIAL_THEME_CONFIG.modeStorageKey,
|
|
140
|
+
brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.brandStorageKey,
|
|
141
|
+
colorStorageKey: config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.colorStorageKey,
|
|
142
|
+
styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.styleStorageKey,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
resolveMode(mode) {
|
|
146
|
+
return mode === 'system' ? (this._systemPrefersDark() ? 'dark' : 'light') : mode;
|
|
147
|
+
}
|
|
148
|
+
prefersDark() {
|
|
149
|
+
const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
150
|
+
return !!mql?.matches;
|
|
151
|
+
}
|
|
152
|
+
watchSystemScheme() {
|
|
153
|
+
const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');
|
|
154
|
+
if (!mql)
|
|
155
|
+
return;
|
|
156
|
+
const listener = (event) => {
|
|
157
|
+
this._systemPrefersDark.set(event.matches);
|
|
158
|
+
};
|
|
159
|
+
mql.addEventListener('change', listener);
|
|
160
|
+
this.destroyRef.onDestroy(() => mql.removeEventListener('change', listener));
|
|
161
|
+
}
|
|
162
|
+
readPersistedMode() {
|
|
163
|
+
const key = this.config.modeStorageKey;
|
|
164
|
+
if (!key)
|
|
165
|
+
return null;
|
|
166
|
+
try {
|
|
167
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
168
|
+
return isColorScheme(value) ? value : null;
|
|
169
|
+
}
|
|
170
|
+
catch {
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
readPersistedBrand() {
|
|
175
|
+
const key = this.config.brandStorageKey;
|
|
176
|
+
if (!key)
|
|
177
|
+
return null;
|
|
178
|
+
try {
|
|
179
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
180
|
+
return isThemeBrand(value) ? value : null;
|
|
181
|
+
}
|
|
182
|
+
catch {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
readPersistedColor() {
|
|
187
|
+
const key = this.config.colorStorageKey;
|
|
188
|
+
if (!key)
|
|
189
|
+
return null;
|
|
190
|
+
try {
|
|
191
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
192
|
+
return isThemeColor(value) ? value : null;
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
readPersistedStyle() {
|
|
199
|
+
const key = this.config.styleStorageKey;
|
|
200
|
+
if (!key)
|
|
201
|
+
return null;
|
|
202
|
+
try {
|
|
203
|
+
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
204
|
+
return isThemeStyle(value) ? value : null;
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
persistMode(mode) {
|
|
211
|
+
const key = this.config.modeStorageKey;
|
|
212
|
+
if (!key)
|
|
213
|
+
return;
|
|
214
|
+
try {
|
|
215
|
+
this.document.defaultView?.localStorage?.setItem(key, mode);
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
/* ignore */
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
persistBrand(brand) {
|
|
222
|
+
const key = this.config.brandStorageKey;
|
|
223
|
+
if (!key)
|
|
224
|
+
return;
|
|
225
|
+
try {
|
|
226
|
+
this.document.defaultView?.localStorage?.setItem(key, brand);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
/* ignore */
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
persistColor(color) {
|
|
233
|
+
const key = this.config.colorStorageKey;
|
|
234
|
+
if (!key)
|
|
235
|
+
return;
|
|
236
|
+
try {
|
|
237
|
+
this.document.defaultView?.localStorage?.setItem(key, color);
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
/* ignore */
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
persistStyle(style) {
|
|
244
|
+
const key = this.config.styleStorageKey;
|
|
245
|
+
if (!key)
|
|
246
|
+
return;
|
|
247
|
+
try {
|
|
248
|
+
this.document.defaultView?.localStorage?.setItem(key, style);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
/* ignore */
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
clearPersistedBrand() {
|
|
255
|
+
this.clearPersistedItem(this.config.brandStorageKey);
|
|
256
|
+
}
|
|
257
|
+
clearPersistedColor() {
|
|
258
|
+
this.clearPersistedItem(this.config.colorStorageKey);
|
|
259
|
+
}
|
|
260
|
+
clearPersistedStyle() {
|
|
261
|
+
this.clearPersistedItem(this.config.styleStorageKey);
|
|
262
|
+
}
|
|
263
|
+
clearPersistedItem(key) {
|
|
264
|
+
if (!key)
|
|
265
|
+
return;
|
|
266
|
+
try {
|
|
267
|
+
this.document.defaultView?.localStorage?.removeItem(key);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
/* ignore */
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
274
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ThemeService, providedIn: 'root' });
|
|
275
|
+
}
|
|
276
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImport: i0, type: ThemeService, decorators: [{
|
|
277
|
+
type: Injectable,
|
|
278
|
+
args: [{ providedIn: 'root' }]
|
|
279
|
+
}], ctorParameters: () => [] });
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* Generated bundle index. Do not edit.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
export { ThemeService };
|
|
286
|
+
//# sourceMappingURL=ojiepermana-angular-theme-services.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular-theme-services.mjs","sources":["../../../projects/angular/theme/services/src/lib/theme.service.ts","../../../projects/angular/theme/services/ojiepermana-angular-theme-services.ts"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport { DestroyRef, Injectable, computed, effect, inject, signal } from '@angular/core';\nimport {\n DEFAULT_MATERIAL_THEME_CONFIG,\n MATERIAL_THEME_CONFIG,\n type ColorScheme,\n type ResolvedMaterialThemeConfig,\n type ThemeBrand,\n type ThemeColor,\n type ThemeConfig,\n type ThemeMode,\n type ThemeStyle,\n isColorScheme,\n isThemeBrand,\n isThemeColor,\n isThemeStyle,\n} from '@ojiepermana/angular/theme/token';\n\n@Injectable({ providedIn: 'root' })\nexport class ThemeService {\n private readonly document = inject(DOCUMENT);\n private readonly destroyRef = inject(DestroyRef);\n private readonly config = this.resolveConfig();\n private readonly initialBrand = this.readPersistedBrand() ?? this.config.defaultBrand;\n\n private readonly _modePreference = signal<ColorScheme>(this.readPersistedMode() ?? this.config.defaultMode);\n private readonly _brand = signal<ThemeBrand | null>(this.initialBrand);\n private readonly _color = signal<ThemeColor>(\n this.initialBrand ? this.config.defaultColor : (this.readPersistedColor() ?? this.config.defaultColor),\n );\n private readonly _style = signal<ThemeStyle>(\n this.initialBrand ? this.config.defaultStyle : (this.readPersistedStyle() ?? this.config.defaultStyle),\n );\n private readonly _systemPrefersDark = signal<boolean>(this.prefersDark());\n\n readonly scheme = this._modePreference.asReadonly();\n readonly brand = this._brand.asReadonly();\n readonly color = this._color.asReadonly();\n readonly theme = this._color.asReadonly();\n readonly style = this._style.asReadonly();\n readonly mode = computed<ThemeMode>(() => this.resolveMode(this._modePreference()));\n readonly snapshot = computed<ThemeConfig>(() => ({\n mode: this.mode(),\n brand: this._brand(),\n color: this._color(),\n style: this._style(),\n }));\n\n readonly isDark = computed(() => this.mode() === 'dark');\n\n constructor() {\n this.watchSystemScheme();\n\n effect(() => {\n const root = this.document.documentElement;\n const mode = this.mode();\n const brand = this._brand();\n const color = this._color();\n const style = this._style();\n\n root.dataset['mode'] = mode;\n root.dataset['theme'] = brand ?? color;\n root.classList.toggle('dark', mode === 'dark');\n\n this.persistMode(this._modePreference());\n\n if (brand) {\n root.setAttribute('theme-brand', brand);\n root.removeAttribute('theme-color');\n root.removeAttribute('theme-style');\n delete root.dataset['color'];\n delete root.dataset['style'];\n\n this.persistBrand(brand);\n this.clearPersistedColor();\n this.clearPersistedStyle();\n return;\n }\n\n root.removeAttribute('theme-brand');\n root.setAttribute('theme-color', color);\n root.setAttribute('theme-style', style);\n root.dataset['color'] = color;\n root.dataset['style'] = style;\n\n this.clearPersistedBrand();\n this.persistColor(color);\n this.persistStyle(style);\n });\n }\n\n setMode(mode: ThemeMode): void {\n this._modePreference.set(mode);\n }\n\n setScheme(scheme: ColorScheme): void {\n this._modePreference.set(scheme);\n }\n\n setBrand(brand: ThemeBrand | null): void {\n this._brand.set(brand);\n this._color.set(this.config.defaultColor);\n this._style.set(this.config.defaultStyle);\n }\n\n setColor(color: ThemeColor): void {\n if (this._brand()) {\n this._brand.set(null);\n }\n this._color.set(color);\n }\n\n setTheme(theme: ThemeColor | string): void {\n if (isThemeColor(theme)) {\n this.setColor(theme);\n }\n }\n\n setStyle(style: ThemeStyle): void {\n if (this._brand()) {\n this._brand.set(null);\n }\n this._style.set(style);\n }\n\n setAll(config: Partial<ThemeConfig> & { readonly scheme?: ColorScheme }): void {\n if (config.scheme) {\n this.setScheme(config.scheme);\n }\n if (config.mode) {\n this.setMode(config.mode);\n }\n if (config.brand !== undefined) {\n this.setBrand(config.brand);\n }\n if (config.brand === undefined || config.brand === null) {\n if (config.color) {\n this.setColor(config.color);\n }\n if (config.style) {\n this.setStyle(config.style);\n }\n }\n }\n\n toggleScheme(): void {\n this.toggleMode();\n }\n\n toggleMode(): void {\n this.setMode(this.mode() === 'dark' ? 'light' : 'dark');\n }\n\n reset(): void {\n this._modePreference.set(this.config.defaultMode);\n this._brand.set(this.config.defaultBrand);\n this._color.set(this.config.defaultColor);\n this._style.set(this.config.defaultStyle);\n }\n\n private resolveConfig(): ResolvedMaterialThemeConfig {\n const config = inject(MATERIAL_THEME_CONFIG, { optional: true }) ?? {};\n const configuredMode = config.mode ?? config.defaultMode ?? config.defaultScheme;\n const configuredBrand = config.brand ?? config['theme-brand'] ?? config.defaultBrand;\n const configuredColor = config.color ?? config.defaultColor ?? config.defaultTheme;\n const configuredStyle = config.style ?? config.defaultStyle;\n\n const defaultMode = isColorScheme(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG.defaultMode;\n const defaultBrand = isThemeBrand(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG.defaultBrand;\n const defaultColor = isThemeColor(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG.defaultColor;\n const defaultStyle = isThemeStyle(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG.defaultStyle;\n\n return {\n defaultMode,\n defaultBrand,\n defaultColor,\n defaultStyle,\n modeStorageKey:\n config.modeStorageKey ??\n config.schemeStorageKey ??\n config.storageKey ??\n DEFAULT_MATERIAL_THEME_CONFIG.modeStorageKey,\n brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.brandStorageKey,\n colorStorageKey:\n config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.colorStorageKey,\n styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.styleStorageKey,\n };\n }\n\n private resolveMode(mode: ColorScheme): ThemeMode {\n return mode === 'system' ? (this._systemPrefersDark() ? 'dark' : 'light') : mode;\n }\n\n private prefersDark(): boolean {\n const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');\n return !!mql?.matches;\n }\n\n private watchSystemScheme(): void {\n const mql = this.document.defaultView?.matchMedia?.('(prefers-color-scheme: dark)');\n if (!mql) return;\n\n const listener = (event: MediaQueryListEvent): void => {\n this._systemPrefersDark.set(event.matches);\n };\n mql.addEventListener('change', listener);\n this.destroyRef.onDestroy(() => mql.removeEventListener('change', listener));\n }\n\n private readPersistedMode(): ColorScheme | null {\n const key = this.config.modeStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isColorScheme(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedBrand(): ThemeBrand | null {\n const key = this.config.brandStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeBrand(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedColor(): ThemeColor | null {\n const key = this.config.colorStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeColor(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private readPersistedStyle(): ThemeStyle | null {\n const key = this.config.styleStorageKey;\n if (!key) return null;\n try {\n const value = this.document.defaultView?.localStorage?.getItem(key);\n return isThemeStyle(value) ? value : null;\n } catch {\n return null;\n }\n }\n\n private persistMode(mode: ColorScheme): void {\n const key = this.config.modeStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, mode);\n } catch {\n /* ignore */\n }\n }\n\n private persistBrand(brand: ThemeBrand): void {\n const key = this.config.brandStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, brand);\n } catch {\n /* ignore */\n }\n }\n\n private persistColor(color: ThemeColor): void {\n const key = this.config.colorStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, color);\n } catch {\n /* ignore */\n }\n }\n\n private persistStyle(style: ThemeStyle): void {\n const key = this.config.styleStorageKey;\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.setItem(key, style);\n } catch {\n /* ignore */\n }\n }\n\n private clearPersistedBrand(): void {\n this.clearPersistedItem(this.config.brandStorageKey);\n }\n\n private clearPersistedColor(): void {\n this.clearPersistedItem(this.config.colorStorageKey);\n }\n\n private clearPersistedStyle(): void {\n this.clearPersistedItem(this.config.styleStorageKey);\n }\n\n private clearPersistedItem(key: string | null): void {\n if (!key) return;\n try {\n this.document.defaultView?.localStorage?.removeItem(key);\n } catch {\n /* ignore */\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAmBa,YAAY,CAAA;AACN,IAAA,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AAC3B,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE;IAC7B,YAAY,GAAG,IAAI,CAAC,kBAAkB,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY;AAEpE,IAAA,eAAe,GAAG,MAAM,CAAc,IAAI,CAAC,iBAAiB,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,sFAAC;AAC1F,IAAA,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,YAAY,6EAAC;AACrD,IAAA,MAAM,GAAG,MAAM,CAC9B,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,IAAI,IAAI,CAAC,kBAAk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A,kBAAkB,CAAC,GAAkB,EAAA;AAC3C,QAAA,IAAI,CAAC,GAAG;YAAE;AACV,QAAA,IAAI;YACF,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,GAAG,CAAC;QAC1D;AAAE,QAAA,MAAM;;QAER;IACF;wGArSW,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,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,YAAY,cADC,MAAM,EAAA,CAAA;;4FACnB,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;AClBlC;;AAEG;;;;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
const MODES = ['light', 'dark'];
|
|
4
|
+
const COLOR_SCHEMES = ['light', 'dark', 'system'];
|
|
5
|
+
const COLORS = [
|
|
6
|
+
'base',
|
|
7
|
+
'red',
|
|
8
|
+
'orange',
|
|
9
|
+
'amber',
|
|
10
|
+
'yellow',
|
|
11
|
+
'lime',
|
|
12
|
+
'green',
|
|
13
|
+
'emerald',
|
|
14
|
+
'teal',
|
|
15
|
+
'cyan',
|
|
16
|
+
'sky',
|
|
17
|
+
'blue',
|
|
18
|
+
'indigo',
|
|
19
|
+
'violet',
|
|
20
|
+
'purple',
|
|
21
|
+
'fuchsia',
|
|
22
|
+
'pink',
|
|
23
|
+
'rose',
|
|
24
|
+
];
|
|
25
|
+
const STYLES = ['default', 'sharp', 'brutal', 'soft'];
|
|
26
|
+
const BRANDS = ['etos'];
|
|
27
|
+
const MATERIAL_THEME_CONFIG = new InjectionToken('MATERIAL_THEME_CONFIG');
|
|
28
|
+
const DEFAULT_MATERIAL_THEME_CONFIG = {
|
|
29
|
+
defaultMode: 'light',
|
|
30
|
+
defaultBrand: null,
|
|
31
|
+
defaultColor: 'base',
|
|
32
|
+
defaultStyle: 'default',
|
|
33
|
+
modeStorageKey: 'theme-mode',
|
|
34
|
+
brandStorageKey: 'theme-brand',
|
|
35
|
+
colorStorageKey: 'theme-color',
|
|
36
|
+
styleStorageKey: 'theme-style',
|
|
37
|
+
};
|
|
38
|
+
function isColorScheme(value) {
|
|
39
|
+
return COLOR_SCHEMES.some((scheme) => scheme === value);
|
|
40
|
+
}
|
|
41
|
+
function isThemeColor(value) {
|
|
42
|
+
return COLORS.some((color) => color === value);
|
|
43
|
+
}
|
|
44
|
+
function isThemeStyle(value) {
|
|
45
|
+
return STYLES.some((style) => style === value);
|
|
46
|
+
}
|
|
47
|
+
function isThemeBrand(value) {
|
|
48
|
+
return BRANDS.some((brand) => brand === value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Generated bundle index. Do not edit.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export { BRANDS, COLORS, COLOR_SCHEMES, DEFAULT_MATERIAL_THEME_CONFIG, MATERIAL_THEME_CONFIG, MODES, STYLES, isColorScheme, isThemeBrand, isThemeColor, isThemeStyle };
|
|
56
|
+
//# sourceMappingURL=ojiepermana-angular-theme-token.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ojiepermana-angular-theme-token.mjs","sources":["../../../projects/angular/theme/token/src/lib/theme.tokens.ts","../../../projects/angular/theme/token/ojiepermana-angular-theme-token.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const MODES = ['light', 'dark'] as const;\n\nexport type ThemeMode = (typeof MODES)[number];\n\nexport const COLOR_SCHEMES = ['light', 'dark', 'system'] as const;\n\nexport type ColorScheme = (typeof COLOR_SCHEMES)[number];\n\nexport const COLORS = [\n 'base',\n 'red',\n 'orange',\n 'amber',\n 'yellow',\n 'lime',\n 'green',\n 'emerald',\n 'teal',\n 'cyan',\n 'sky',\n 'blue',\n 'indigo',\n 'violet',\n 'purple',\n 'fuchsia',\n 'pink',\n 'rose',\n] as const;\n\nexport type ThemeColor = (typeof COLORS)[number];\n\nexport const STYLES = ['default', 'sharp', 'brutal', 'soft'] as const;\n\nexport type ThemeStyle = (typeof STYLES)[number];\n\nexport const BRANDS = ['etos'] as const;\n\nexport type ThemeBrand = (typeof BRANDS)[number];\n\nexport interface ThemeConfig {\n readonly mode: ThemeMode;\n readonly brand: ThemeBrand | null;\n readonly color: ThemeColor;\n readonly style: ThemeStyle;\n}\n\nexport interface MaterialThemeConfig {\n readonly mode?: ColorScheme;\n readonly brand?: ThemeBrand | null;\n readonly 'theme-brand'?: ThemeBrand | null;\n readonly color?: ThemeColor;\n readonly style?: ThemeStyle;\n readonly defaultMode?: ColorScheme;\n readonly defaultBrand?: ThemeBrand | null;\n readonly defaultColor?: ThemeColor;\n readonly defaultStyle?: ThemeStyle;\n readonly defaultScheme?: ColorScheme;\n readonly defaultTheme?: ThemeColor | string;\n readonly storageKey?: string | null;\n readonly schemeStorageKey?: string | null;\n readonly themeStorageKey?: string | null;\n readonly modeStorageKey?: string | null;\n readonly brandStorageKey?: string | null;\n readonly colorStorageKey?: string | null;\n readonly styleStorageKey?: string | null;\n}\n\nexport interface ResolvedMaterialThemeConfig {\n readonly defaultMode: ColorScheme;\n readonly defaultBrand: ThemeBrand | null;\n readonly defaultColor: ThemeColor;\n readonly defaultStyle: ThemeStyle;\n readonly modeStorageKey: string | null;\n readonly brandStorageKey: string | null;\n readonly colorStorageKey: string | null;\n readonly styleStorageKey: string | null;\n}\n\nexport const MATERIAL_THEME_CONFIG = new InjectionToken<MaterialThemeConfig>('MATERIAL_THEME_CONFIG');\n\nexport const DEFAULT_MATERIAL_THEME_CONFIG: ResolvedMaterialThemeConfig = {\n defaultMode: 'light',\n defaultBrand: null,\n defaultColor: 'base',\n defaultStyle: 'default',\n modeStorageKey: 'theme-mode',\n brandStorageKey: 'theme-brand',\n colorStorageKey: 'theme-color',\n styleStorageKey: 'theme-style',\n};\n\nexport function isColorScheme(value: string | null | undefined): value is ColorScheme {\n return COLOR_SCHEMES.some((scheme) => scheme === value);\n}\n\nexport function isThemeColor(value: string | null | undefined): value is ThemeColor {\n return COLORS.some((color) => color === value);\n}\n\nexport function isThemeStyle(value: string | null | undefined): value is ThemeStyle {\n return STYLES.some((style) => style === value);\n}\n\nexport function isThemeBrand(value: string | null | undefined): value is ThemeBrand {\n return BRANDS.some((brand) => brand === value);\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;MAEa,KAAK,GAAG,CAAC,OAAO,EAAE,MAAM;AAI9B,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ;AAIhD,MAAM,MAAM,GAAG;IACpB,MAAM;IACN,KAAK;IACL,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,MAAM;IACN,OAAO;IACP,SAAS;IACT,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,MAAM;IACN,MAAM;;AAKD,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM;AAIpD,MAAM,MAAM,GAAG,CAAC,MAAM;MA2ChB,qBAAqB,GAAG,IAAI,cAAc,CAAsB,uBAAuB;AAE7F,MAAM,6BAA6B,GAAgC;AACxE,IAAA,WAAW,EAAE,OAAO;AACpB,IAAA,YAAY,EAAE,IAAI;AAClB,IAAA,YAAY,EAAE,MAAM;AACpB,IAAA,YAAY,EAAE,SAAS;AACvB,IAAA,cAAc,EAAE,YAAY;AAC5B,IAAA,eAAe,EAAE,aAAa;AAC9B,IAAA,eAAe,EAAE,aAAa;AAC9B,IAAA,eAAe,EAAE,aAAa;;AAG1B,SAAU,aAAa,CAAC,KAAgC,EAAA;AAC5D,IAAA,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM,KAAK,KAAK,CAAC;AACzD;AAEM,SAAU,YAAY,CAAC,KAAgC,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,CAAC;AAChD;AAEM,SAAU,YAAY,CAAC,KAAgC,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,CAAC;AAChD;AAEM,SAAU,YAAY,CAAC,KAAgC,EAAA;AAC3D,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,KAAK,KAAK,KAAK,KAAK,CAAC;AAChD;;AC3GA;;AAEG;;;;"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { InjectionToken, inject, DestroyRef, signal, computed, effect, Injectable, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';
|
|
3
3
|
import { DOCUMENT } from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { isThemeColor as isThemeColor$1, MATERIAL_THEME_CONFIG as MATERIAL_THEME_CONFIG$1, isColorScheme as isColorScheme$1, DEFAULT_MATERIAL_THEME_CONFIG as DEFAULT_MATERIAL_THEME_CONFIG$1, isThemeBrand as isThemeBrand$1, isThemeStyle as isThemeStyle$1 } from '@ojiepermana/angular/theme/token';
|
|
5
|
+
import { THEME_PANEL_THEME_PORT } from '@ojiepermana/angular/layout/component';
|
|
6
|
+
import { ThemeService as ThemeService$1 } from '@ojiepermana/angular/theme/services';
|
|
5
7
|
import { MAT_RIPPLE_GLOBAL_OPTIONS } from '@angular/material/core';
|
|
6
8
|
import { MAT_FORM_FIELD_DEFAULT_OPTIONS } from '@angular/material/form-field';
|
|
7
9
|
|
|
@@ -127,7 +129,7 @@ class ThemeService {
|
|
|
127
129
|
this._color.set(color);
|
|
128
130
|
}
|
|
129
131
|
setTheme(theme) {
|
|
130
|
-
if (isThemeColor(theme)) {
|
|
132
|
+
if (isThemeColor$1(theme)) {
|
|
131
133
|
this.setColor(theme);
|
|
132
134
|
}
|
|
133
135
|
}
|
|
@@ -169,15 +171,15 @@ class ThemeService {
|
|
|
169
171
|
this._style.set(this.config.defaultStyle);
|
|
170
172
|
}
|
|
171
173
|
resolveConfig() {
|
|
172
|
-
const config = inject(MATERIAL_THEME_CONFIG, { optional: true }) ?? {};
|
|
174
|
+
const config = inject(MATERIAL_THEME_CONFIG$1, { optional: true }) ?? {};
|
|
173
175
|
const configuredMode = config.mode ?? config.defaultMode ?? config.defaultScheme;
|
|
174
176
|
const configuredBrand = config.brand ?? config['theme-brand'] ?? config.defaultBrand;
|
|
175
177
|
const configuredColor = config.color ?? config.defaultColor ?? config.defaultTheme;
|
|
176
178
|
const configuredStyle = config.style ?? config.defaultStyle;
|
|
177
|
-
const defaultMode = isColorScheme(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG.defaultMode;
|
|
178
|
-
const defaultBrand = isThemeBrand(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG.defaultBrand;
|
|
179
|
-
const defaultColor = isThemeColor(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG.defaultColor;
|
|
180
|
-
const defaultStyle = isThemeStyle(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG.defaultStyle;
|
|
179
|
+
const defaultMode = isColorScheme$1(configuredMode) ? configuredMode : DEFAULT_MATERIAL_THEME_CONFIG$1.defaultMode;
|
|
180
|
+
const defaultBrand = isThemeBrand$1(configuredBrand) ? configuredBrand : DEFAULT_MATERIAL_THEME_CONFIG$1.defaultBrand;
|
|
181
|
+
const defaultColor = isThemeColor$1(configuredColor) ? configuredColor : DEFAULT_MATERIAL_THEME_CONFIG$1.defaultColor;
|
|
182
|
+
const defaultStyle = isThemeStyle$1(configuredStyle) ? configuredStyle : DEFAULT_MATERIAL_THEME_CONFIG$1.defaultStyle;
|
|
181
183
|
return {
|
|
182
184
|
defaultMode,
|
|
183
185
|
defaultBrand,
|
|
@@ -186,10 +188,10 @@ class ThemeService {
|
|
|
186
188
|
modeStorageKey: config.modeStorageKey ??
|
|
187
189
|
config.schemeStorageKey ??
|
|
188
190
|
config.storageKey ??
|
|
189
|
-
DEFAULT_MATERIAL_THEME_CONFIG.modeStorageKey,
|
|
190
|
-
brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.brandStorageKey,
|
|
191
|
-
colorStorageKey: config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.colorStorageKey,
|
|
192
|
-
styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG.styleStorageKey,
|
|
191
|
+
DEFAULT_MATERIAL_THEME_CONFIG$1.modeStorageKey,
|
|
192
|
+
brandStorageKey: config.brandStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG$1.brandStorageKey,
|
|
193
|
+
colorStorageKey: config.colorStorageKey ?? config.themeStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG$1.colorStorageKey,
|
|
194
|
+
styleStorageKey: config.styleStorageKey ?? DEFAULT_MATERIAL_THEME_CONFIG$1.styleStorageKey,
|
|
193
195
|
};
|
|
194
196
|
}
|
|
195
197
|
resolveMode(mode) {
|
|
@@ -215,7 +217,7 @@ class ThemeService {
|
|
|
215
217
|
return null;
|
|
216
218
|
try {
|
|
217
219
|
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
218
|
-
return isColorScheme(value) ? value : null;
|
|
220
|
+
return isColorScheme$1(value) ? value : null;
|
|
219
221
|
}
|
|
220
222
|
catch {
|
|
221
223
|
return null;
|
|
@@ -227,7 +229,7 @@ class ThemeService {
|
|
|
227
229
|
return null;
|
|
228
230
|
try {
|
|
229
231
|
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
230
|
-
return isThemeBrand(value) ? value : null;
|
|
232
|
+
return isThemeBrand$1(value) ? value : null;
|
|
231
233
|
}
|
|
232
234
|
catch {
|
|
233
235
|
return null;
|
|
@@ -239,7 +241,7 @@ class ThemeService {
|
|
|
239
241
|
return null;
|
|
240
242
|
try {
|
|
241
243
|
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
242
|
-
return isThemeColor(value) ? value : null;
|
|
244
|
+
return isThemeColor$1(value) ? value : null;
|
|
243
245
|
}
|
|
244
246
|
catch {
|
|
245
247
|
return null;
|
|
@@ -251,7 +253,7 @@ class ThemeService {
|
|
|
251
253
|
return null;
|
|
252
254
|
try {
|
|
253
255
|
const value = this.document.defaultView?.localStorage?.getItem(key);
|
|
254
|
-
return isThemeStyle(value) ? value : null;
|
|
256
|
+
return isThemeStyle$1(value) ? value : null;
|
|
255
257
|
}
|
|
256
258
|
catch {
|
|
257
259
|
return null;
|
|
@@ -328,49 +330,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
328
330
|
args: [{ providedIn: 'root' }]
|
|
329
331
|
}], ctorParameters: () => [] });
|
|
330
332
|
|
|
331
|
-
/**
|
|
332
|
-
* Bootstrap the shared theme for any `@ojiepermana/angular/*` entry point.
|
|
333
|
-
*
|
|
334
|
-
* By default wires up the theme config token and eagerly initializes `ThemeService`
|
|
335
|
-
* so root theme attributes are applied during bootstrap. Opt in
|
|
336
|
-
* to Angular Material defaults (ripple / form-field) via
|
|
337
|
-
* {@link withMaterialDefaults}.
|
|
338
|
-
* Supports shorthand `mode`, `color`, and `style` config keys.
|
|
339
|
-
*
|
|
340
|
-
* @example
|
|
341
|
-
* export const appConfig: ApplicationConfig = {
|
|
342
|
-
* providers: [
|
|
343
|
-
* provideAnimations(),
|
|
344
|
-
* provideMaterialTheme(
|
|
345
|
-
* {
|
|
346
|
-
* mode: 'system',
|
|
347
|
-
* color: 'base',
|
|
348
|
-
* style: 'soft',
|
|
349
|
-
* },
|
|
350
|
-
* withMaterialDefaults(),
|
|
351
|
-
* ),
|
|
352
|
-
* ],
|
|
353
|
-
* };
|
|
354
|
-
*/
|
|
355
333
|
function provideMaterialTheme(config = {}, ...features) {
|
|
356
334
|
return makeEnvironmentProviders([
|
|
357
|
-
{ provide: MATERIAL_THEME_CONFIG, useValue: config },
|
|
358
|
-
{ provide: THEME_PANEL_THEME_PORT, useExisting: ThemeService },
|
|
335
|
+
{ provide: MATERIAL_THEME_CONFIG$1, useValue: config },
|
|
336
|
+
{ provide: THEME_PANEL_THEME_PORT, useExisting: ThemeService$1 },
|
|
359
337
|
provideEnvironmentInitializer(() => {
|
|
360
|
-
inject(ThemeService);
|
|
338
|
+
inject(ThemeService$1);
|
|
361
339
|
}),
|
|
362
|
-
...features.flatMap((
|
|
340
|
+
...features.flatMap((feature) => feature.providers),
|
|
363
341
|
]);
|
|
364
342
|
}
|
|
365
|
-
/**
|
|
366
|
-
* Opt-in Angular Material defaults tuned for the shared theme layer:
|
|
367
|
-
*
|
|
368
|
-
* - Disables the global Material ripple.
|
|
369
|
-
* - Forces `appearance: 'outline'` + `subscriptSizing: 'dynamic'` on every
|
|
370
|
-
* `mat-form-field`.
|
|
371
|
-
*
|
|
372
|
-
* Only apply when your app actually renders Angular Material components.
|
|
373
|
-
*/
|
|
374
343
|
function withMaterialDefaults() {
|
|
375
344
|
return {
|
|
376
345
|
providers: [
|
|
@@ -386,17 +355,23 @@ function withMaterialDefaults() {
|
|
|
386
355
|
/*
|
|
387
356
|
* Public API Surface of @ojiepermana/angular/theme
|
|
388
357
|
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
* (shadcn, layout, navigation, ...).
|
|
358
|
+
* Aggregate barrel for the shared theme runtime plus the stable CSS asset
|
|
359
|
+
* surface used by every `@ojiepermana/angular/*` subpath.
|
|
392
360
|
*
|
|
393
|
-
*
|
|
361
|
+
* Runtime usage:
|
|
394
362
|
* // app.config.ts
|
|
395
363
|
* import { provideMaterialTheme } from '@ojiepermana/angular/theme';
|
|
396
364
|
*
|
|
365
|
+
* Deep runtime imports:
|
|
366
|
+
* import { ThemeService } from '@ojiepermana/angular/theme/services';
|
|
367
|
+
* import { provideMaterialTheme } from '@ojiepermana/angular/theme/provider';
|
|
368
|
+
* import { MATERIAL_THEME_CONFIG } from '@ojiepermana/angular/theme/token';
|
|
369
|
+
*
|
|
370
|
+
* CSS usage:
|
|
397
371
|
* // styles.css
|
|
398
372
|
* @import '@ojiepermana/angular/theme/styles';
|
|
399
373
|
* @import 'tailwindcss';
|
|
374
|
+
* @import '@ojiepermana/angular/theme/tailwind/theme.css';
|
|
400
375
|
*/
|
|
401
376
|
|
|
402
377
|
/**
|