@sapphire-ion/framework 0.30.26 → 0.30.28
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/build.ps1 +39 -0
- package/ng-package.json +10 -0
- package/package.json +37 -41
- package/src/lib/classes/comparison/comparison-operator.ts +17 -0
- package/src/lib/classes/comparison/comparison-value-type.ts +34 -0
- package/src/lib/classes/comparison/comparison.ts +45 -0
- package/src/lib/classes/comparison/properties/bool-property.ts +16 -0
- package/src/lib/classes/comparison/properties/date-property.ts +28 -0
- package/src/lib/classes/comparison/properties/datetime-property.ts +28 -0
- package/src/lib/classes/comparison/properties/decimal-property.ts +28 -0
- package/src/lib/classes/comparison/properties/enum-property.ts +28 -0
- package/src/lib/classes/comparison/properties/implicit-property.ts +13 -0
- package/src/lib/classes/comparison/properties/int-property.ts +28 -0
- package/src/lib/classes/comparison/properties/long-property.ts +28 -0
- package/src/lib/classes/comparison/properties/string-property.ts +16 -0
- package/src/lib/classes/comparison/properties/time-property.ts +28 -0
- package/{lib/classes/credentials.d.ts → src/lib/classes/credentials.ts} +5 -5
- package/src/lib/classes/environment.ts +35 -0
- package/src/lib/classes/filters/view-filtros.ts +18 -0
- package/src/lib/classes/infinite-scroll.ts +112 -0
- package/src/lib/classes/inputs/table-field-form-builder.ts +12 -0
- package/src/lib/classes/inputs/table-field.ts +58 -0
- package/src/lib/classes/page-option.ts +8 -0
- package/src/lib/classes/routes/default-routing-factory.ts +24 -0
- package/src/lib/classes/routes/id-preloader-configuration.ts +21 -0
- package/src/lib/classes/routes/route-data.ts +9 -0
- package/{themes → src/lib}/compiled-styles.scss +2338 -2338
- package/src/lib/components/_inputs_new/classes/input-control-base.ts +85 -0
- package/src/lib/components/_inputs_new/classes/input-provider-factory.ts +16 -0
- package/src/lib/components/_inputs_new/input-string/input-string.component.html +4 -0
- package/src/lib/components/_inputs_new/input-string/input-string.component.ts +15 -0
- package/src/lib/components/_inputs_new/inputs.module.ts +16 -0
- package/src/lib/components/carousel/carousel-image/carousel-image.component.html +4 -0
- package/src/lib/components/carousel/carousel-image/carousel-image.component.ts +15 -0
- package/src/lib/components/carousel/carousel-item/carousel-item.component.html +3 -0
- package/src/lib/components/carousel/carousel-item/carousel-item.component.ts +14 -0
- package/src/lib/components/carousel/carousel.component.html +22 -0
- package/src/lib/components/carousel/carousel.component.ts +83 -0
- package/src/lib/components/carousel/carousel.module.ts +20 -0
- package/src/lib/components/carousel/i-carousel-item.component.ts +8 -0
- package/src/lib/components/content-block/content-block.component.html +6 -0
- package/src/lib/components/content-block/content-block.component.ts +25 -0
- package/src/lib/components/default/default-list/abstract-list.ts +56 -0
- package/src/lib/components/default/default-list/default-list.component.html +60 -0
- package/src/lib/components/default/default-list/default-list.component.ts +71 -0
- package/src/lib/components/default/default-list/header-list/header-list.component.html +32 -0
- package/src/lib/components/default/default-list/header-list/header-list.component.ts +85 -0
- package/src/lib/components/default/default-list/list.ts +121 -0
- package/src/lib/components/default/default-pagination/default-pagination.component.html +52 -0
- package/src/lib/components/default/default-pagination/default-pagination.component.ts +118 -0
- package/src/lib/components/default/default-table/default-table.component.html +105 -0
- package/src/lib/components/default/default-table/default-table.component.ts +197 -0
- package/src/lib/components/default/default-table/th-filter/th-filter.component.html +61 -0
- package/src/lib/components/default/default-table/th-filter/th-filter.component.ts +178 -0
- package/src/lib/components/default/default-view/abstract-view.ts +25 -0
- package/src/lib/components/default/default-view/default-view.component.html +81 -0
- package/src/lib/components/default/default-view/default-view.component.ts +34 -0
- package/src/lib/components/default/default-view/header-view/header-view.component.html +64 -0
- package/src/lib/components/default/default-view/header-view/header-view.component.ts +54 -0
- package/src/lib/components/default/default-view/view.ts +171 -0
- package/src/lib/components/default/default.module.ts +55 -0
- package/src/lib/components/default-page/default.page.html +53 -0
- package/src/lib/components/default-page/default.page.ts +77 -0
- package/src/lib/components/drag-drop-file/drag-drop-file.directive.ts +44 -0
- package/src/lib/components/drag-drop-file/drag-drop-file.module.ts +21 -0
- package/src/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.html +5 -0
- package/src/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.ts +17 -0
- package/src/lib/components/drawer/default-drawer-end/default-drawer-end.component.html +12 -0
- package/src/lib/components/drawer/default-drawer-end/default-drawer-end.component.ts +35 -0
- package/src/lib/components/drawer/drawer-group/drawer-group.component.html +61 -0
- package/src/lib/components/drawer/drawer-group/drawer-group.component.ts +44 -0
- package/src/lib/components/drawer/drawer.component.html +56 -0
- package/src/lib/components/drawer/drawer.component.ts +119 -0
- package/src/lib/components/drawer/menu.ts +20 -0
- package/src/lib/components/filter/filter.component.html +31 -0
- package/src/lib/components/filter/filter.component.ts +133 -0
- package/src/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.html +35 -0
- package/src/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.ts +19 -0
- package/src/lib/components/image/image.component.html +17 -0
- package/src/lib/components/image/image.component.ts +95 -0
- package/src/lib/components/info-popover/info-popover.component.html +23 -0
- package/src/lib/components/info-popover/info-popover.component.ts +75 -0
- package/src/lib/components/inputs/custom-input.ts +67 -0
- package/src/lib/components/inputs/custom-signal-input.ts +70 -0
- package/src/lib/components/inputs/input-bool/input-bool.component.html +18 -0
- package/src/lib/components/inputs/input-bool/input-bool.component.ts +36 -0
- package/src/lib/components/inputs/input-bool/input-bool.configuration.ts +14 -0
- package/src/lib/components/inputs/input-color/input-color.component.html +132 -0
- package/src/lib/components/inputs/input-color/input-color.component.ts +561 -0
- package/{lib/components/inputs/input-configuration.d.ts → src/lib/components/inputs/input-configuration.ts} +18 -8
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.html +26 -0
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.ts +78 -0
- package/src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.ts +4 -0
- package/src/lib/components/inputs/input-date/input-date.component.html +40 -0
- package/src/lib/components/inputs/input-date/input-date.component.ts +98 -0
- package/src/lib/components/inputs/input-date/input-date.configuration.ts +6 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.component.html +24 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.component.ts +296 -0
- package/src/lib/components/inputs/input-decimal/input-decimal.configuration.ts +42 -0
- package/src/lib/components/inputs/input-default-configurations.ts +15 -0
- package/src/lib/components/inputs/input-file/download-button/download-button.component.html +56 -0
- package/src/lib/components/inputs/input-file/download-button/download-button.component.ts +85 -0
- package/src/lib/components/inputs/input-file/input-file.component.html +101 -0
- package/src/lib/components/inputs/input-file/input-file.component.ts +120 -0
- package/src/lib/components/inputs/input-file/input-file.configuration.ts +8 -0
- package/src/lib/components/inputs/input-loading/input-loading.component.html +3 -0
- package/src/lib/components/inputs/input-loading/input-loading.component.ts +13 -0
- package/src/lib/components/inputs/input-provider-factory.ts +15 -0
- package/src/lib/components/inputs/input-select/ISelect.ts +26 -0
- package/src/lib/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.html +16 -0
- package/src/lib/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.ts +38 -0
- package/src/lib/components/inputs/input-select/input-select-option/input-select-option.component.html +15 -0
- package/src/lib/components/inputs/input-select/input-select-option/input-select-option.component.ts +47 -0
- package/src/lib/components/inputs/input-select/input-select-template.directive.ts +8 -0
- package/src/lib/components/inputs/input-select/input-select.component.html +66 -0
- package/src/lib/components/inputs/input-select/input-select.component.ts +323 -0
- package/src/lib/components/inputs/input-select/input.select.configuration.ts +188 -0
- package/src/lib/components/inputs/input-string/input-string.component.html +22 -0
- package/src/lib/components/inputs/input-string/input-string.component.ts +36 -0
- package/src/lib/components/inputs/input-string/input-string.configuration.ts +18 -0
- package/src/lib/components/inputs/input-textarea/input-textarea.component.html +25 -0
- package/src/lib/components/inputs/input-textarea/input-textarea.component.ts +35 -0
- package/src/lib/components/inputs/input-type.ts +16 -0
- package/src/lib/components/inputs/input-validators.ts +76 -0
- package/src/lib/components/inputs/inputs.module.ts +64 -0
- package/src/lib/components/loading/loading.component.html +28 -0
- package/src/lib/components/loading/loading.component.ts +29 -0
- package/src/lib/components/login/login-admin/login-admin.component.html +28 -0
- package/src/lib/components/login/login-admin/login-admin.component.ts +51 -0
- package/src/lib/components/login/login.component.html +104 -0
- package/src/lib/components/login/login.component.ts +97 -0
- package/src/lib/components/main-content/main-content.component.html +61 -0
- package/src/lib/components/main-content/main-content.component.ts +55 -0
- package/src/lib/components/stepper/step/step.component.html +11 -0
- package/src/lib/components/stepper/step/step.component.ts +44 -0
- package/src/lib/components/stepper/stepper.component.html +3 -0
- package/src/lib/components/stepper/stepper.component.ts +36 -0
- package/src/lib/components/stepper/stepper.module.ts +15 -0
- package/src/lib/components/tabs/tab/tab.component.html +8 -0
- package/src/lib/components/tabs/tab/tab.component.scss +0 -0
- package/src/lib/components/tabs/tab/tab.component.ts +28 -0
- package/src/lib/components/tabs/tabs/tabs.component.html +14 -0
- package/src/lib/components/tabs/tabs/tabs.component.ts +42 -0
- package/src/lib/components/tabs/tabs.module.ts +15 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.html +8 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.scss +0 -0
- package/src/lib/components/text-tooltip/text-tooltip.component.ts +45 -0
- package/src/lib/components/tooltip/tooltip.component.html +53 -0
- package/src/lib/components/tooltip/tooltip.component.ts +16 -0
- package/src/lib/core.module.ts +26 -0
- package/src/lib/directives/ng-var.directive.ts +26 -0
- package/src/lib/guards/auth.guard.ts +19 -0
- package/src/lib/guards/error.interceptor.ts +107 -0
- package/src/lib/guards/token.interceptor.ts +28 -0
- package/src/lib/index.ts +175 -0
- package/src/lib/pipes/secure.pipe.ts +39 -0
- package/src/lib/services/auth.service.ts +150 -0
- package/src/lib/services/crypto.service.ts +164 -0
- package/src/lib/services/environment.service.ts +17 -0
- package/src/lib/services/generics.service.ts +85 -0
- package/src/lib/services/route/route.cache.service.ts +17 -0
- package/src/lib/services/route/route.provider.service.ts +49 -0
- package/src/lib/services/usuario.service.ts +44 -0
- package/src/lib/services/utils.service.ts +161 -0
- package/src/lib/services/web/api-url-provider.service.ts +48 -0
- package/src/lib/services/web/http.ativo.service.ts +52 -0
- package/src/lib/services/web/http.service.ts +184 -0
- package/src/lib/services/web/storage.service.ts +131 -0
- package/{themes → src/lib}/styles/core.styles.scss +4 -0
- package/src/public-api.ts +5 -0
- package/tailwind.config.js +27 -0
- package/tsconfig.lib.json +29 -0
- package/tsconfig.lib.prod.json +23 -0
- package/tsconfig.spec.json +27 -0
- package/esm2022/lib/classes/comparison/comparison-operator.mjs +0 -18
- package/esm2022/lib/classes/comparison/comparison-value-type.mjs +0 -25
- package/esm2022/lib/classes/comparison/comparison.mjs +0 -41
- package/esm2022/lib/classes/comparison/properties/bool-property.mjs +0 -15
- package/esm2022/lib/classes/comparison/properties/date-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/datetime-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/decimal-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/enum-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/implicit-property.mjs +0 -12
- package/esm2022/lib/classes/comparison/properties/int-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/long-property.mjs +0 -27
- package/esm2022/lib/classes/comparison/properties/string-property.mjs +0 -15
- package/esm2022/lib/classes/comparison/properties/time-property.mjs +0 -27
- package/esm2022/lib/classes/credentials.mjs +0 -2
- package/esm2022/lib/classes/environment.mjs +0 -32
- package/esm2022/lib/classes/filters/view-filtros.mjs +0 -18
- package/esm2022/lib/classes/infinite-scroll.mjs +0 -90
- package/esm2022/lib/classes/inputs/table-field-form-builder.mjs +0 -10
- package/esm2022/lib/classes/inputs/table-field.mjs +0 -69
- package/esm2022/lib/classes/page-option.mjs +0 -2
- package/esm2022/lib/classes/routes/default-routing-factory.mjs +0 -23
- package/esm2022/lib/classes/routes/id-preloader-configuration.mjs +0 -22
- package/esm2022/lib/classes/routes/route-data.mjs +0 -9
- package/esm2022/lib/components/carousel/carousel-image/carousel-image.component.mjs +0 -18
- package/esm2022/lib/components/carousel/carousel-item/carousel-item.component.mjs +0 -15
- package/esm2022/lib/components/carousel/carousel.component.mjs +0 -79
- package/esm2022/lib/components/carousel/carousel.module.mjs +0 -31
- package/esm2022/lib/components/carousel/i-carousel-item.component.mjs +0 -16
- package/esm2022/lib/components/content-block/content-block.component.mjs +0 -27
- package/esm2022/lib/components/default/default-list/abstract-list.mjs +0 -49
- package/esm2022/lib/components/default/default-list/default-list.component.mjs +0 -99
- package/esm2022/lib/components/default/default-list/header-list/header-list.component.mjs +0 -98
- package/esm2022/lib/components/default/default-list/list.mjs +0 -110
- package/esm2022/lib/components/default/default-pagination/default-pagination.component.mjs +0 -123
- package/esm2022/lib/components/default/default-table/default-table.component.mjs +0 -222
- package/esm2022/lib/components/default/default-table/th-filter/th-filter.component.mjs +0 -186
- package/esm2022/lib/components/default/default-view/abstract-view.mjs +0 -22
- package/esm2022/lib/components/default/default-view/default-view.component.mjs +0 -51
- package/esm2022/lib/components/default/default-view/header-view/header-view.component.mjs +0 -75
- package/esm2022/lib/components/default/default-view/view.mjs +0 -175
- package/esm2022/lib/components/default/default.module.mjs +0 -87
- package/esm2022/lib/components/default-page/default.page.mjs +0 -73
- package/esm2022/lib/components/drag-drop-file/drag-drop-file.directive.mjs +0 -60
- package/esm2022/lib/components/drag-drop-file/drag-drop-file.module.mjs +0 -31
- package/esm2022/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.mjs +0 -15
- package/esm2022/lib/components/drawer/default-drawer-end/default-drawer-end.component.mjs +0 -34
- package/esm2022/lib/components/drawer/drawer-group/drawer-group.component.mjs +0 -49
- package/esm2022/lib/components/drawer/drawer.component.mjs +0 -117
- package/esm2022/lib/components/drawer/menu.mjs +0 -15
- package/esm2022/lib/components/filter/filter.component.mjs +0 -127
- package/esm2022/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.mjs +0 -17
- package/esm2022/lib/components/image/image.component.mjs +0 -91
- package/esm2022/lib/components/info-popover/info-popover.component.mjs +0 -91
- package/esm2022/lib/components/inputs/custom-input.mjs +0 -77
- package/esm2022/lib/components/inputs/custom-signal-input.mjs +0 -74
- package/esm2022/lib/components/inputs/input-bool/input-bool.component.mjs +0 -43
- package/esm2022/lib/components/inputs/input-bool/input-bool.configuration.mjs +0 -16
- package/esm2022/lib/components/inputs/input-color/input-color.component.mjs +0 -487
- package/esm2022/lib/components/inputs/input-configuration.mjs +0 -2
- package/esm2022/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.mjs +0 -93
- package/esm2022/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.mjs +0 -6
- package/esm2022/lib/components/inputs/input-date/input-date.component.mjs +0 -122
- package/esm2022/lib/components/inputs/input-date/input-date.configuration.mjs +0 -8
- package/esm2022/lib/components/inputs/input-decimal/input-decimal.component.mjs +0 -269
- package/esm2022/lib/components/inputs/input-decimal/input-decimal.configuration.mjs +0 -45
- package/esm2022/lib/components/inputs/input-default-configurations.mjs +0 -14
- package/esm2022/lib/components/inputs/input-file/download-button/download-button.component.mjs +0 -91
- package/esm2022/lib/components/inputs/input-file/input-file.component.mjs +0 -131
- package/esm2022/lib/components/inputs/input-file/input-file.configuration.mjs +0 -11
- package/esm2022/lib/components/inputs/input-loading/input-loading.component.mjs +0 -16
- package/esm2022/lib/components/inputs/input-provider-factory.mjs +0 -15
- package/esm2022/lib/components/inputs/input-select/ISelect.mjs +0 -11
- package/esm2022/lib/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.mjs +0 -42
- package/esm2022/lib/components/inputs/input-select/input-select-option/input-select-option.component.mjs +0 -46
- package/esm2022/lib/components/inputs/input-select/input-select-template.directive.mjs +0 -16
- package/esm2022/lib/components/inputs/input-select/input-select.component.mjs +0 -322
- package/esm2022/lib/components/inputs/input-select/input.select.configuration.mjs +0 -164
- package/esm2022/lib/components/inputs/input-string/input-string.component.mjs +0 -50
- package/esm2022/lib/components/inputs/input-string/input-string.configuration.mjs +0 -18
- package/esm2022/lib/components/inputs/input-textarea/input-textarea.component.mjs +0 -47
- package/esm2022/lib/components/inputs/input-type.mjs +0 -18
- package/esm2022/lib/components/inputs/input-validators.mjs +0 -90
- package/esm2022/lib/components/inputs/inputs.module.mjs +0 -105
- package/esm2022/lib/components/loading/loading.component.mjs +0 -34
- package/esm2022/lib/components/login/login-admin/login-admin.component.mjs +0 -52
- package/esm2022/lib/components/login/login.component.mjs +0 -102
- package/esm2022/lib/components/main-content/main-content.component.mjs +0 -62
- package/esm2022/lib/components/stepper/step/step.component.mjs +0 -43
- package/esm2022/lib/components/stepper/stepper.component.mjs +0 -36
- package/esm2022/lib/components/stepper/stepper.module.mjs +0 -25
- package/esm2022/lib/components/tabs/tab/tab.component.mjs +0 -41
- package/esm2022/lib/components/tabs/tabs/tabs.component.mjs +0 -56
- package/esm2022/lib/components/tabs/tabs.module.mjs +0 -22
- package/esm2022/lib/components/text-tooltip/text-tooltip.component.mjs +0 -51
- package/esm2022/lib/components/tooltip/tooltip.component.mjs +0 -21
- package/esm2022/lib/core.module.mjs +0 -29
- package/esm2022/lib/directives/ng-var.directive.mjs +0 -29
- package/esm2022/lib/guards/auth.guard.mjs +0 -26
- package/esm2022/lib/guards/error.interceptor.mjs +0 -106
- package/esm2022/lib/guards/token.interceptor.mjs +0 -25
- package/esm2022/lib/index.mjs +0 -173
- package/esm2022/lib/pipes/secure.pipe.mjs +0 -42
- package/esm2022/lib/services/auth.service.mjs +0 -146
- package/esm2022/lib/services/environment.service.mjs +0 -26
- package/esm2022/lib/services/generics.service.mjs +0 -84
- package/esm2022/lib/services/route/route.cache.service.mjs +0 -15
- package/esm2022/lib/services/route/route.provider.service.mjs +0 -42
- package/esm2022/lib/services/usuario.service.mjs +0 -49
- package/esm2022/lib/services/utils.service.mjs +0 -149
- package/esm2022/lib/services/web/api-url-provider.service.mjs +0 -29
- package/esm2022/lib/services/web/http.ativo.service.mjs +0 -55
- package/esm2022/lib/services/web/http.service.mjs +0 -169
- package/esm2022/lib/services/web/storage.service.mjs +0 -128
- package/esm2022/public-api.mjs +0 -5
- package/esm2022/sapphire-ion-framework.mjs +0 -5
- package/fesm2022/sapphire-ion-framework.mjs +0 -6237
- package/fesm2022/sapphire-ion-framework.mjs.map +0 -1
- package/index.d.ts +0 -5
- package/lib/classes/comparison/comparison-operator.d.ts +0 -9
- package/lib/classes/comparison/comparison-value-type.d.ts +0 -23
- package/lib/classes/comparison/comparison.d.ts +0 -25
- package/lib/classes/comparison/properties/bool-property.d.ts +0 -7
- package/lib/classes/comparison/properties/date-property.d.ts +0 -11
- package/lib/classes/comparison/properties/datetime-property.d.ts +0 -11
- package/lib/classes/comparison/properties/decimal-property.d.ts +0 -11
- package/lib/classes/comparison/properties/enum-property.d.ts +0 -11
- package/lib/classes/comparison/properties/implicit-property.d.ts +0 -6
- package/lib/classes/comparison/properties/int-property.d.ts +0 -11
- package/lib/classes/comparison/properties/long-property.d.ts +0 -11
- package/lib/classes/comparison/properties/string-property.d.ts +0 -7
- package/lib/classes/comparison/properties/time-property.d.ts +0 -11
- package/lib/classes/environment.d.ts +0 -13
- package/lib/classes/filters/view-filtros.d.ts +0 -10
- package/lib/classes/infinite-scroll.d.ts +0 -26
- package/lib/classes/inputs/table-field-form-builder.d.ts +0 -5
- package/lib/classes/inputs/table-field.d.ts +0 -20
- package/lib/classes/page-option.d.ts +0 -7
- package/lib/classes/routes/default-routing-factory.d.ts +0 -8
- package/lib/classes/routes/id-preloader-configuration.d.ts +0 -28
- package/lib/classes/routes/route-data.d.ts +0 -5
- package/lib/components/carousel/carousel-image/carousel-image.component.d.ts +0 -10
- package/lib/components/carousel/carousel-item/carousel-item.component.d.ts +0 -9
- package/lib/components/carousel/carousel.component.d.ts +0 -32
- package/lib/components/carousel/carousel.module.d.ts +0 -12
- package/lib/components/carousel/i-carousel-item.component.d.ts +0 -9
- package/lib/components/content-block/content-block.component.d.ts +0 -15
- package/lib/components/default/default-list/abstract-list.d.ts +0 -21
- package/lib/components/default/default-list/default-list.component.d.ts +0 -44
- package/lib/components/default/default-list/header-list/header-list.component.d.ts +0 -45
- package/lib/components/default/default-list/list.d.ts +0 -38
- package/lib/components/default/default-pagination/default-pagination.component.d.ts +0 -36
- package/lib/components/default/default-table/default-table.component.d.ts +0 -72
- package/lib/components/default/default-table/th-filter/th-filter.component.d.ts +0 -20
- package/lib/components/default/default-view/abstract-view.d.ts +0 -18
- package/lib/components/default/default-view/default-view.component.d.ts +0 -26
- package/lib/components/default/default-view/header-view/header-view.component.d.ts +0 -26
- package/lib/components/default/default-view/view.d.ts +0 -56
- package/lib/components/default/default.module.d.ts +0 -28
- package/lib/components/default-page/default.page.d.ts +0 -35
- package/lib/components/drag-drop-file/drag-drop-file.directive.d.ts +0 -14
- package/lib/components/drag-drop-file/drag-drop-file.module.d.ts +0 -10
- package/lib/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.d.ts +0 -9
- package/lib/components/drawer/default-drawer-end/default-drawer-end.component.d.ts +0 -13
- package/lib/components/drawer/drawer-group/drawer-group.component.d.ts +0 -22
- package/lib/components/drawer/drawer.component.d.ts +0 -23
- package/lib/components/drawer/menu.d.ts +0 -9
- package/lib/components/filter/filter.component.d.ts +0 -29
- package/lib/components/http-responses-pages/forbidden-403/forbidden-403.component.d.ts +0 -8
- package/lib/components/image/image.component.d.ts +0 -23
- package/lib/components/info-popover/info-popover.component.d.ts +0 -15
- package/lib/components/inputs/custom-input.d.ts +0 -36
- package/lib/components/inputs/custom-signal-input.d.ts +0 -38
- package/lib/components/inputs/input-bool/input-bool.component.d.ts +0 -19
- package/lib/components/inputs/input-bool/input-bool.configuration.d.ts +0 -17
- package/lib/components/inputs/input-color/input-color.component.d.ts +0 -80
- package/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.d.ts +0 -24
- package/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.configuration.d.ts +0 -5
- package/lib/components/inputs/input-date/input-date.component.d.ts +0 -30
- package/lib/components/inputs/input-date/input-date.configuration.d.ts +0 -7
- package/lib/components/inputs/input-decimal/input-decimal.component.d.ts +0 -41
- package/lib/components/inputs/input-decimal/input-decimal.configuration.d.ts +0 -25
- package/lib/components/inputs/input-default-configurations.d.ts +0 -13
- package/lib/components/inputs/input-file/download-button/download-button.component.d.ts +0 -36
- package/lib/components/inputs/input-file/input-file.component.d.ts +0 -39
- package/lib/components/inputs/input-file/input-file.configuration.d.ts +0 -11
- package/lib/components/inputs/input-loading/input-loading.component.d.ts +0 -7
- package/lib/components/inputs/input-provider-factory.d.ts +0 -4
- package/lib/components/inputs/input-select/ISelect.d.ts +0 -21
- package/lib/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.d.ts +0 -18
- package/lib/components/inputs/input-select/input-select-option/input-select-option.component.d.ts +0 -24
- package/lib/components/inputs/input-select/input-select-template.directive.d.ts +0 -8
- package/lib/components/inputs/input-select/input-select.component.d.ts +0 -66
- package/lib/components/inputs/input-select/input.select.configuration.d.ts +0 -87
- package/lib/components/inputs/input-string/input-string.component.d.ts +0 -19
- package/lib/components/inputs/input-string/input-string.configuration.d.ts +0 -14
- package/lib/components/inputs/input-textarea/input-textarea.component.d.ts +0 -18
- package/lib/components/inputs/input-type.d.ts +0 -16
- package/lib/components/inputs/input-validators.d.ts +0 -19
- package/lib/components/inputs/inputs.module.d.ts +0 -29
- package/lib/components/loading/loading.component.d.ts +0 -18
- package/lib/components/login/login-admin/login-admin.component.d.ts +0 -20
- package/lib/components/login/login.component.d.ts +0 -29
- package/lib/components/main-content/main-content.component.d.ts +0 -17
- package/lib/components/stepper/step/step.component.d.ts +0 -15
- package/lib/components/stepper/stepper.component.d.ts +0 -17
- package/lib/components/stepper/stepper.module.d.ts +0 -10
- package/lib/components/tabs/tab/tab.component.d.ts +0 -19
- package/lib/components/tabs/tabs/tabs.component.d.ts +0 -18
- package/lib/components/tabs/tabs.module.d.ts +0 -12
- package/lib/components/text-tooltip/text-tooltip.component.d.ts +0 -16
- package/lib/components/tooltip/tooltip.component.d.ts +0 -7
- package/lib/core.module.d.ts +0 -11
- package/lib/directives/ng-var.directive.d.ts +0 -12
- package/lib/guards/auth.guard.d.ts +0 -11
- package/lib/guards/error.interceptor.d.ts +0 -32
- package/lib/guards/token.interceptor.d.ts +0 -11
- package/lib/index.d.ts +0 -109
- package/lib/pipes/secure.pipe.d.ts +0 -15
- package/lib/services/auth.service.d.ts +0 -47
- package/lib/services/environment.service.d.ts +0 -10
- package/lib/services/generics.service.d.ts +0 -22
- package/lib/services/route/route.cache.service.d.ts +0 -7
- package/lib/services/route/route.provider.service.d.ts +0 -13
- package/lib/services/usuario.service.d.ts +0 -21
- package/lib/services/utils.service.d.ts +0 -36
- package/lib/services/web/api-url-provider.service.d.ts +0 -13
- package/lib/services/web/http.ativo.service.d.ts +0 -31
- package/lib/services/web/http.service.d.ts +0 -50
- package/lib/services/web/storage.service.d.ts +0 -25
- package/public-api.d.ts +0 -1
- /package/{themes → src/lib}/components/_inputs_new/input-string/input-string.component.scss +0 -0
- /package/{themes → src/lib}/components/_inputs_new/inputs.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel-image/carousel-image.component.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel-item/carousel-item.component.scss +0 -0
- /package/{themes → src/lib}/components/carousel/carousel.component.scss +0 -0
- /package/{themes → src/lib}/components/content-block/content-block.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-list/default-list.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-list/header-list/header-list.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-pagination/default-pagination.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-table/default-table.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-table/th-filter/th-filter.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-view/default-view.component.scss +0 -0
- /package/{themes → src/lib}/components/default/default-view/header-view/header-view.component.scss +0 -0
- /package/{themes → src/lib}/components/default-page/default.page.scss +0 -0
- /package/{themes → src/lib}/components/drag-drop-file/drag-drop-overlay/drag-drop-overlay.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/default-drawer-end/default-drawer-end.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/drawer-group/drawer-group.component.scss +0 -0
- /package/{themes → src/lib}/components/drawer/drawer.component.scss +0 -0
- /package/{themes → src/lib}/components/filter/filter.component.scss +0 -0
- /package/{themes → src/lib}/components/http-responses-pages/forbidden-403/forbidden-403.component.scss +0 -0
- /package/{themes → src/lib}/components/image/image.component.scss +0 -0
- /package/{themes → src/lib}/components/info-popover/info-popover.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-bool/input-bool.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-color/input-color.component.scss +0 -0
- /package/{themes/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.scss → src/lib/components/inputs/input-color/input-color.configuration.ts} +0 -0
- /package/{themes/components/inputs/input-loading/input-loading.component.scss → src/lib/components/inputs/input-cpf-cnpj/input-cpf-cnpj.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/input-date/input-date.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-decimal/input-decimal.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-file/download-button/download-button.component.scss +0 -0
- /package/{themes → src/lib}/components/inputs/input-file/input-file.component.scss +0 -0
- /package/{themes/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.scss → src/lib/components/inputs/input-loading/input-bool.configuration.ts} +0 -0
- /package/{themes/components/inputs/input-select/input-select-option/input-select-option.component.scss → src/lib/components/inputs/input-loading/input-loading.component.scss} +0 -0
- /package/{themes/components/inputs/input-string/input-string.component.scss → src/lib/components/inputs/input-select/input-select-internal-option/input-select-internal-option.component.scss} +0 -0
- /package/{themes/components/inputs/input-textarea/input-textarea.component.scss → src/lib/components/inputs/input-select/input-select-option/input-select-option.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/input-select/input-select.component.scss +0 -0
- /package/{themes/components/loading/loading.component.scss → src/lib/components/inputs/input-string/input-string.component.scss} +0 -0
- /package/{themes/components/stepper/stepper.component.scss → src/lib/components/inputs/input-textarea/input-textarea.component.scss} +0 -0
- /package/{themes → src/lib}/components/inputs/inputs.scss +0 -0
- /package/{themes/components/tabs/tab/tab.component.scss → src/lib/components/loading/loading.component.scss} +0 -0
- /package/{themes → src/lib}/components/login/login-admin/login-admin.component.scss +0 -0
- /package/{themes → src/lib}/components/login/login.component.scss +0 -0
- /package/{themes → src/lib}/components/main-content/main-content.component.scss +0 -0
- /package/{themes → src/lib}/components/stepper/step/step.component.scss +0 -0
- /package/{themes/components/text-tooltip/text-tooltip.component.scss → src/lib/components/stepper/stepper.component.scss} +0 -0
- /package/{themes → src/lib}/components/tabs/tabs/tabs.component.scss +0 -0
- /package/{themes → src/lib}/components/tooltip/tooltip.component.scss +0 -0
- /package/{themes → src/lib}/styles/components.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-action-sheet.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-alert.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-button.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-card.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-content.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-datetime.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-item.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-list.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-modal.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-popover.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-progress-bar.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-searchbar.scss +0 -0
- /package/{themes → src/lib}/styles/ionic/ion-toast.scss +0 -0
- /package/{themes → src/lib}/styles/ionic.scss +0 -0
- /package/{themes → src/lib}/styles/login-default.scss +0 -0
- /package/{themes → src/lib}/styles/mixins.scss +0 -0
- /package/{themes → src/lib}/styles/styles.scss +0 -0
- /package/{themes → src/lib}/styles/translucid.scss +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<div class="flex relative overflow-hidden">
|
|
2
|
+
<ion-card class="focus-within:on-focus ion-card-input !rounded-r-none" [disabled]="loading || disabled"
|
|
3
|
+
[ngClass]="{
|
|
4
|
+
'invalid' : invalid,
|
|
5
|
+
'submitted': submitted,
|
|
6
|
+
'disabled': disabled,
|
|
7
|
+
}"
|
|
8
|
+
>
|
|
9
|
+
<ion-card-content>
|
|
10
|
+
<div class="flex">
|
|
11
|
+
<ion-item class="w-full" [ngClass]="{'submitted': submitted, 'invalid': invalid, 'required': required}" lines="none">
|
|
12
|
+
<ion-input (ionBlur)="blur.emit(model)" [maxlength]="9" labelPlacement="stacked" [(ngModel)]="model">
|
|
13
|
+
@if (label) {
|
|
14
|
+
<ion-text id="label" [ngClass]="{'required': required}" slot="label"> {{label}} </ion-text>
|
|
15
|
+
}
|
|
16
|
+
</ion-input>
|
|
17
|
+
</ion-item>
|
|
18
|
+
</div>
|
|
19
|
+
</ion-card-content>
|
|
20
|
+
</ion-card>
|
|
21
|
+
<div class="w-12 shrink-0" >
|
|
22
|
+
<ion-button (click)="Present($event)" [disabled]="loading || disabled" class="m-0 h-full w-full rounded-r-2xl on-hover [--border-radius:0rem_1rem_1rem_0rem]" style="--border-width: 1px 1px 2px 1px;" size="small" color="medium" fill="outline">
|
|
23
|
+
<ion-icon class="fill-rainbow" slot="icon-only" name="color-palette"></ion-icon>
|
|
24
|
+
</ion-button>
|
|
25
|
+
</div>
|
|
26
|
+
<input-loading [loading]="loading"></input-loading>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<ion-popover #popover [keepContentsMounted]="true">
|
|
30
|
+
<ng-template>
|
|
31
|
+
<ion-card class="m-0">
|
|
32
|
+
<ion-card-content class="p-0 relative">
|
|
33
|
+
<loading [type]="3" [loading]="rendering" text=""></loading>
|
|
34
|
+
<div class="size-full p-3 flex gap-2">
|
|
35
|
+
<div class="h-[12.5rem] flex flex-col gap-1 w-44">
|
|
36
|
+
<div class="w-full h-32 relative">
|
|
37
|
+
<canvas #canvas width="176" height="128" class="size-full rounded-sm translucid-border"></canvas>
|
|
38
|
+
|
|
39
|
+
<div class="color-indicator quick-transition" [style.left.%]="indicatorX" [style.top.%]="indicatorY"></div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="w-full flex shrink-0">
|
|
43
|
+
<div class="w-full grid grid-cols-5 gap-1">
|
|
44
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#000000FF' }"></ng-container>
|
|
45
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#3880ffff' }"></ng-container>
|
|
46
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#2dd36fff' }"></ng-container>
|
|
47
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#ffc409ff' }"></ng-container>
|
|
48
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#eb445aff' }"></ng-container>
|
|
49
|
+
|
|
50
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#FFFFFFFF' }"></ng-container>
|
|
51
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#59168bFF' }"></ng-container>
|
|
52
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#c6005cFF' }"></ng-container>
|
|
53
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#fb2c36FF' }"></ng-container>
|
|
54
|
+
<ng-container *ngTemplateOutlet="templateColor; context: { $implicit: '#314158FF' }"></ng-container>
|
|
55
|
+
|
|
56
|
+
<ng-template #templateColor let-color>
|
|
57
|
+
<div class="size-8 rounded translucid-border cursor-pointer" (click)="setColorFromHex(color, true, true)" [style]="{ 'background': color }"></div>
|
|
58
|
+
</ng-template>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="h-[12.5rem] flex flex-col gap-2 w-44">
|
|
63
|
+
<div class="w-full relative">
|
|
64
|
+
<canvas #hueSlider class="w-full rounded h-[22px]" width="176" height="22"></canvas>
|
|
65
|
+
<div class="indicator quick-transition" [style.left.%]="hslColor.h / 3.6"></div>
|
|
66
|
+
</div>
|
|
67
|
+
<div class="w-full relative">
|
|
68
|
+
<canvas #alphaSlider class="w-full rounded h-[22px]" width="176" height="22"></canvas>
|
|
69
|
+
<div class="indicator quick-transition" [style.left.%]="alpha"></div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<div class="flex flex-col gap-1">
|
|
73
|
+
<div class="flex items-center justify-center w-full h-fit gap-1 overflow-hidden">
|
|
74
|
+
<div class="size-10 relative z-10 shrink-0 flex items-center justify-center">
|
|
75
|
+
<div class="size-full z-10 rounded translucid-border absolute left-0 top-0" [style.background]="getRgbaString()"></div>
|
|
76
|
+
<ion-icon class="z-0 opacity-50" color="dark" name="color-fill"></ion-icon>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="h-full shrink text-sm flex flex-col items-start justify-center">
|
|
80
|
+
<ion-text>Hex</ion-text>
|
|
81
|
+
<input [value]="model" (change)="setColorFromHex($event.target['value'])" class="w-full"/>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<ion-button (click)="CopyToClipboard()" class="aspect-square" style="--border-radius: .25rem" size="small">
|
|
85
|
+
<ion-icon slot="icon-only" name="clipboard"></ion-icon>
|
|
86
|
+
</ion-button>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div class="w-full flex gap-1 overflow-hidden text-sm">
|
|
90
|
+
<div class="w-full shrink">
|
|
91
|
+
<ion-text>R</ion-text>
|
|
92
|
+
<input [(ngModel)]="rgbColor.r" (change)="updateSelectedColor(); updateIndicatorPositions(); this.drawColorGradient()" type="number" class="w-full"/>
|
|
93
|
+
</div>
|
|
94
|
+
<div class="w-full shrink">
|
|
95
|
+
<ion-text>G</ion-text>
|
|
96
|
+
<input [(ngModel)]="rgbColor.g" (change)="updateSelectedColor(); updateIndicatorPositions()" type="number" class="w-full"/>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="w-full shrink">
|
|
99
|
+
<ion-text>B</ion-text>
|
|
100
|
+
<input [(ngModel)]="rgbColor.b" (change)="updateSelectedColor(); updateIndicatorPositions()" type="number" class="w-full"/>
|
|
101
|
+
</div>
|
|
102
|
+
<div class="w-full shrink">
|
|
103
|
+
<ion-text>A</ion-text>
|
|
104
|
+
<input [(ngModel)]="alpha" class="w-full"/>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div class="w-full flex gap-1 overflow-hidden text-sm">
|
|
109
|
+
<div class="w-full shrink">
|
|
110
|
+
<ion-text>H</ion-text>
|
|
111
|
+
<input [(ngModel)]="hslColor.h" (change)="updateSelectedColor(); updateIndicatorPositions(); this.drawColorGradient()" type="number" class="w-full"/>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="w-full shrink">
|
|
114
|
+
<ion-text>L</ion-text>
|
|
115
|
+
<input [(ngModel)]="hslColor.l" (change)="updateSelectedColor(); updateIndicatorPositions()" type="number" class="w-full"/>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="w-full shrink">
|
|
118
|
+
<ion-text>S</ion-text>
|
|
119
|
+
<input [(ngModel)]="hslColor.s" (change)="updateSelectedColor(); updateIndicatorPositions()" type="number" class="w-full"/>
|
|
120
|
+
</div>
|
|
121
|
+
<div class="w-full shrink">
|
|
122
|
+
<ion-text>A</ion-text>
|
|
123
|
+
<input [(ngModel)]="alpha" type="number" class="w-full"/>
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</div>
|
|
129
|
+
</ion-card-content>
|
|
130
|
+
</ion-card>
|
|
131
|
+
</ng-template>
|
|
132
|
+
</ion-popover>
|
|
@@ -0,0 +1,561 @@
|
|
|
1
|
+
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
|
2
|
+
import { Clipboard } from '@capacitor/clipboard';
|
|
3
|
+
import { IonPopover } from '@ionic/angular';
|
|
4
|
+
|
|
5
|
+
import { InputProviderFactory } from '../input-provider-factory';
|
|
6
|
+
import { CustomSignalInput } from '../custom-signal-input';
|
|
7
|
+
import { GenericService } from '../../../services/generics.service';
|
|
8
|
+
|
|
9
|
+
type RGB = { r: number, g: number, b: number };
|
|
10
|
+
type HSL = { h: number, l: number, s: number };
|
|
11
|
+
|
|
12
|
+
@Component({
|
|
13
|
+
selector: 'input-color',
|
|
14
|
+
templateUrl: './input-color.component.html',
|
|
15
|
+
styleUrls: ['./input-color.component.scss', '../inputs.scss'],
|
|
16
|
+
providers: InputProviderFactory.GetProvider(InputColorComponent)
|
|
17
|
+
})
|
|
18
|
+
export class InputColorComponent extends CustomSignalInput<string> implements OnInit {
|
|
19
|
+
|
|
20
|
+
constructor(
|
|
21
|
+
private genericService: GenericService
|
|
22
|
+
) { super(); }
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@ViewChild('canvas' ) canvas: ElementRef<HTMLCanvasElement>;
|
|
26
|
+
@ViewChild("hueSlider" ) hueSlider: ElementRef<HTMLCanvasElement>
|
|
27
|
+
@ViewChild("alphaSlider") alphaSlider: ElementRef<HTMLCanvasElement>
|
|
28
|
+
|
|
29
|
+
override writeValue(value: string){ this.setModel(value, true) }
|
|
30
|
+
override get model(): string { return this._model; }
|
|
31
|
+
override set model(value: string) { this.setModel(value); this.propagateChange(this._model); }
|
|
32
|
+
|
|
33
|
+
setModel(value: string, redraw: boolean = false){
|
|
34
|
+
if(value){
|
|
35
|
+
this.setColorFromHex(value, false);
|
|
36
|
+
if(this.canvasCtx && redraw){
|
|
37
|
+
this.updateSelectedColor();
|
|
38
|
+
this.updateIndicatorPositions();
|
|
39
|
+
this.drawColorGradient()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@ViewChild(IonPopover) Popover: IonPopover;
|
|
45
|
+
rendering: boolean = true;
|
|
46
|
+
async Present($event){
|
|
47
|
+
this.rendering = true;
|
|
48
|
+
await this.Popover.present($event);
|
|
49
|
+
|
|
50
|
+
this.initCanvas()
|
|
51
|
+
this.initHueSlider()
|
|
52
|
+
this.initAlphaSlider()
|
|
53
|
+
this.drawColorGradient()
|
|
54
|
+
this.drawHueSlider()
|
|
55
|
+
this.drawAlphaSlider()
|
|
56
|
+
this.rendering = false;
|
|
57
|
+
}
|
|
58
|
+
private canvasCtx: CanvasRenderingContext2D;
|
|
59
|
+
private canvasWidth: number = 0;
|
|
60
|
+
private canvasHeight: number = 0;
|
|
61
|
+
|
|
62
|
+
private hueCtx: CanvasRenderingContext2D;
|
|
63
|
+
private hueSliderWidth: number = 0;
|
|
64
|
+
private hueSliderHeight: number = 0;
|
|
65
|
+
|
|
66
|
+
private alphaCtx: CanvasRenderingContext2D;
|
|
67
|
+
private alphaSliderWidth: number = 0;
|
|
68
|
+
private alphaSliderHeight: number = 0;
|
|
69
|
+
|
|
70
|
+
private isDragging = false
|
|
71
|
+
private isHueDragging = false
|
|
72
|
+
private isAlphaDragging = false
|
|
73
|
+
|
|
74
|
+
rgbColor : RGB = { r: 255, g: 0, b: 0 };
|
|
75
|
+
hslColor : HSL = { h: 0, s: 100, l: 50 };
|
|
76
|
+
alpha : number = 0
|
|
77
|
+
|
|
78
|
+
indicatorX: number = 100
|
|
79
|
+
indicatorY: number = 0
|
|
80
|
+
|
|
81
|
+
initCanvas(): void {
|
|
82
|
+
const canvas = this.canvas.nativeElement;
|
|
83
|
+
this.canvasWidth = canvas.width;
|
|
84
|
+
this.canvasHeight = canvas.height;
|
|
85
|
+
this.canvasCtx = canvas.getContext('2d');
|
|
86
|
+
|
|
87
|
+
canvas.addEventListener('mousedown' , this.startDrag.bind(this));
|
|
88
|
+
canvas.addEventListener('mousemove' , this.drag.bind(this));
|
|
89
|
+
canvas.addEventListener('mouseup' , this.endDrag.bind(this));
|
|
90
|
+
canvas.addEventListener('mouseleave', this.endDrag.bind(this));
|
|
91
|
+
|
|
92
|
+
// Touch events
|
|
93
|
+
canvas.addEventListener('touchstart', this.handleTouch.bind(this));
|
|
94
|
+
canvas.addEventListener('touchmove' , this.handleTouch.bind(this));
|
|
95
|
+
canvas.addEventListener('touchend' , this.endDrag.bind(this));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
initHueSlider(): void {
|
|
99
|
+
const hueSlider = this.hueSlider.nativeElement
|
|
100
|
+
this.hueSliderWidth = hueSlider.width;
|
|
101
|
+
this.hueSliderHeight = hueSlider.height;
|
|
102
|
+
this.hueCtx = hueSlider.getContext("2d")
|
|
103
|
+
|
|
104
|
+
hueSlider.addEventListener("mousedown" , this.startHueDrag.bind(this))
|
|
105
|
+
hueSlider.addEventListener("mousemove" , this.hueDrag.bind(this))
|
|
106
|
+
hueSlider.addEventListener("mouseup" , this.endHueDrag.bind(this))
|
|
107
|
+
hueSlider.addEventListener("mouseleave", this.endHueDrag.bind(this))
|
|
108
|
+
|
|
109
|
+
// Touch events
|
|
110
|
+
hueSlider.addEventListener("touchstart", this.handleHueTouch.bind(this))
|
|
111
|
+
hueSlider.addEventListener("touchmove" , this.handleHueTouch.bind(this))
|
|
112
|
+
hueSlider.addEventListener("touchend" , this.endHueDrag.bind(this))
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
initAlphaSlider(): void {
|
|
116
|
+
const alphaSlider = this.alphaSlider.nativeElement;
|
|
117
|
+
this.alphaSliderHeight = alphaSlider.height;
|
|
118
|
+
this.alphaSliderWidth = alphaSlider.width;
|
|
119
|
+
|
|
120
|
+
this.alphaCtx = alphaSlider.getContext("2d")
|
|
121
|
+
|
|
122
|
+
alphaSlider.addEventListener("mousedown" , this.startAlphaDrag.bind(this))
|
|
123
|
+
alphaSlider.addEventListener("mousemove" , this.alphaDrag.bind(this))
|
|
124
|
+
alphaSlider.addEventListener("mouseup" , this.endAlphaDrag.bind(this))
|
|
125
|
+
alphaSlider.addEventListener("mouseleave", this.endAlphaDrag.bind(this))
|
|
126
|
+
|
|
127
|
+
// Touch events
|
|
128
|
+
alphaSlider.addEventListener("touchstart", this.handleAlphaTouch.bind(this))
|
|
129
|
+
alphaSlider.addEventListener("touchmove" , this.handleAlphaTouch.bind(this))
|
|
130
|
+
alphaSlider.addEventListener("touchend" , this.endAlphaDrag.bind(this))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
drawColorGradient(): void {
|
|
134
|
+
const ctx = this.canvasCtx;
|
|
135
|
+
|
|
136
|
+
// Clear canvas
|
|
137
|
+
ctx.clearRect(0, 0, this.canvasWidth, this.canvasHeight)
|
|
138
|
+
|
|
139
|
+
// Draw the pure hue color at the top-right corner
|
|
140
|
+
ctx.fillStyle = `hsl(${this.hslColor.h}, 100%, 50%)`
|
|
141
|
+
ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight)
|
|
142
|
+
|
|
143
|
+
// White gradient (horizontal - saturation)
|
|
144
|
+
const whiteGradient = ctx.createLinearGradient(0, 0, this.canvasWidth, 0)
|
|
145
|
+
whiteGradient.addColorStop(0, "white")
|
|
146
|
+
whiteGradient.addColorStop(1, "rgba(255, 255, 255, 0)")
|
|
147
|
+
ctx.fillStyle = whiteGradient
|
|
148
|
+
ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight)
|
|
149
|
+
|
|
150
|
+
// Black gradient (vertical - brightness)
|
|
151
|
+
const blackGradient = ctx.createLinearGradient(0, 0, 0, this.canvasHeight)
|
|
152
|
+
blackGradient.addColorStop(0, "rgba(0, 0, 0, 0)")
|
|
153
|
+
blackGradient.addColorStop(1, "black")
|
|
154
|
+
ctx.fillStyle = blackGradient
|
|
155
|
+
ctx.fillRect(0, 0, this.canvasWidth, this.canvasHeight)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
drawHueSlider(): void {
|
|
159
|
+
const ctx = this.hueCtx
|
|
160
|
+
|
|
161
|
+
// Create hue gradient
|
|
162
|
+
const gradient = ctx.createLinearGradient(0, 0, this.hueSliderWidth, 0)
|
|
163
|
+
for (let i = 0; i <= 360; i += 60) {
|
|
164
|
+
gradient.addColorStop(i / 360, `hsl(${i}, 100%, 50%)`)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
ctx.fillStyle = gradient
|
|
168
|
+
ctx.fillRect(0, 0, this.hueSliderWidth, this.hueSliderHeight)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
drawAlphaSlider(): void {
|
|
172
|
+
const ctx = this.alphaCtx
|
|
173
|
+
const width = this.alphaSliderWidth
|
|
174
|
+
const height = this.alphaSliderHeight
|
|
175
|
+
|
|
176
|
+
// Clear canvas
|
|
177
|
+
ctx.clearRect(0, 0, width, height)
|
|
178
|
+
|
|
179
|
+
// Create checkerboard pattern for transparency
|
|
180
|
+
const squareSize = 8
|
|
181
|
+
for (let i = 0; i < width; i += squareSize) {
|
|
182
|
+
for (let j = 0; j < height; j += squareSize) {
|
|
183
|
+
const isEven = (i / squareSize + j / squareSize) % 2 === 0
|
|
184
|
+
ctx.fillStyle = isEven ? "#ffffff" : "#cccccc"
|
|
185
|
+
ctx.fillRect(i, j, squareSize, squareSize)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
// Create alpha gradient
|
|
191
|
+
const gradient = ctx.createLinearGradient(0, 0, width, 0)
|
|
192
|
+
const rgb = this.hslToRgb(this.hslColor);
|
|
193
|
+
|
|
194
|
+
gradient.addColorStop(0, `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 0)`)
|
|
195
|
+
gradient.addColorStop(1, `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, 1)`)
|
|
196
|
+
|
|
197
|
+
ctx.fillStyle = gradient
|
|
198
|
+
ctx.fillRect(0, 0, width, height)
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
startDrag(e: MouseEvent): void {
|
|
202
|
+
this.isDragging = true
|
|
203
|
+
this.handleColorSelection(e.offsetX, e.offsetY)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
drag(e: MouseEvent): void {
|
|
207
|
+
if (this.isDragging) {
|
|
208
|
+
this.handleColorSelection(e.offsetX, e.offsetY)
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
endDrag(): void {
|
|
213
|
+
this.isDragging = false
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
handleTouch(e: TouchEvent): void {
|
|
217
|
+
e.preventDefault()
|
|
218
|
+
if (e.type === "touchstart") {
|
|
219
|
+
this.isDragging = true
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (this.isDragging) {
|
|
223
|
+
const rect = this.canvas.nativeElement.getBoundingClientRect()
|
|
224
|
+
const touch = e.touches[0]
|
|
225
|
+
const x = touch.clientX - rect.left
|
|
226
|
+
const y = touch.clientY - rect.top
|
|
227
|
+
this.handleColorSelection(x, y)
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
startHueDrag(e: MouseEvent): void {
|
|
232
|
+
this.isHueDragging = true
|
|
233
|
+
this.handleHueSelection(e.offsetX)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
hueDrag(e: MouseEvent): void {
|
|
237
|
+
if (this.isHueDragging) {
|
|
238
|
+
this.handleHueSelection(e.offsetX)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
endHueDrag(): void {
|
|
243
|
+
this.isHueDragging = false
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
startAlphaDrag(e: MouseEvent): void {
|
|
247
|
+
this.isAlphaDragging = true
|
|
248
|
+
this.handleAlphaSelection(e.offsetX)
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
alphaDrag(e: MouseEvent): void {
|
|
252
|
+
if (this.isAlphaDragging) {
|
|
253
|
+
this.handleAlphaSelection(e.offsetX)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
endAlphaDrag(): void {
|
|
258
|
+
this.isAlphaDragging = false
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
handleAlphaTouch(e: TouchEvent): void {
|
|
262
|
+
e.preventDefault()
|
|
263
|
+
if (e.type === "touchstart") {
|
|
264
|
+
this.isAlphaDragging = true
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (this.isAlphaDragging) {
|
|
268
|
+
const rect = this.alphaSlider.nativeElement.getBoundingClientRect()
|
|
269
|
+
const touch = e.touches[0]
|
|
270
|
+
const x = touch.clientX - rect.left
|
|
271
|
+
this.handleAlphaSelection(x)
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
handleHueTouch(e: TouchEvent): void {
|
|
276
|
+
e.preventDefault()
|
|
277
|
+
if (e.type === "touchstart") {
|
|
278
|
+
this.isHueDragging = true
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (this.isHueDragging) {
|
|
282
|
+
const rect = this.hueSlider.nativeElement.getBoundingClientRect()
|
|
283
|
+
const touch = e.touches[0]
|
|
284
|
+
const x = touch.clientX - rect.left
|
|
285
|
+
this.handleHueSelection(x)
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
handleHueSelection(x: number): void {
|
|
290
|
+
// Constrain x to canvas bounds
|
|
291
|
+
x = Math.max(0, Math.min(x, this.hueSliderWidth))
|
|
292
|
+
|
|
293
|
+
// Calculate hue based on x position (0-360)
|
|
294
|
+
this.hslColor.h = Math.round((x / this.hueSliderWidth) * 360)
|
|
295
|
+
|
|
296
|
+
// Redraw color gradient with new hue
|
|
297
|
+
this.drawColorGradient()
|
|
298
|
+
|
|
299
|
+
// Redraw alpha slider with new color
|
|
300
|
+
this.drawAlphaSlider()
|
|
301
|
+
|
|
302
|
+
// Update selected color
|
|
303
|
+
this.updateSelectedColor(this.hslColor.s, this.hslColor.l, true)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
handleAlphaSelection(x: number): void {
|
|
307
|
+
// Constrain x to canvas bounds
|
|
308
|
+
x = Math.max(0, Math.min(x, this.alphaSliderWidth))
|
|
309
|
+
|
|
310
|
+
// Calculate alpha based on x position (0-100)
|
|
311
|
+
this.alpha = Math.round((x / this.alphaSliderWidth) * 100)
|
|
312
|
+
|
|
313
|
+
// Update selected color
|
|
314
|
+
this.updateSelectedColor(this.hslColor.s, this.hslColor.l, true)
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
handleColorSelection(x: number, y: number): void {
|
|
318
|
+
// Constrain coordinates to canvas bounds
|
|
319
|
+
x = Math.max(0, Math.min(x, this.canvasWidth))
|
|
320
|
+
y = Math.max(0, Math.min(y, this.canvasHeight))
|
|
321
|
+
|
|
322
|
+
// Store the raw position percentage for the indicator
|
|
323
|
+
this.indicatorX = (x / this.canvasWidth) * 100
|
|
324
|
+
this.indicatorY = (y / this.canvasHeight) * 100
|
|
325
|
+
|
|
326
|
+
// Calculate saturation and lightness based on position
|
|
327
|
+
this.hslColor.s = Math.round(this.indicatorX)
|
|
328
|
+
// Adjust lightness calculation:
|
|
329
|
+
// - Top of canvas (y=0) should be white (lightness=100) on the left and pure color (lightness=50) on the right
|
|
330
|
+
// - Bottom of canvas (y=height) should be black (lightness=0)
|
|
331
|
+
if (this.hslColor.s === 0) {
|
|
332
|
+
// Left edge is always white to black, regardless of y position
|
|
333
|
+
this.hslColor.l = Math.round(100 - this.indicatorY)
|
|
334
|
+
} else {
|
|
335
|
+
// For other saturation values, top is 50-100% lightness (based on saturation), bottom is 0%
|
|
336
|
+
const maxLightness = 100 - this.hslColor.s / 2
|
|
337
|
+
this.hslColor.l = Math.round(maxLightness - (this.indicatorY / 100) * maxLightness)
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// Update selected color
|
|
341
|
+
this.updateSelectedColor(this.hslColor.s, this.hslColor.l, true)
|
|
342
|
+
|
|
343
|
+
// Redraw alpha slider with new color
|
|
344
|
+
this.drawAlphaSlider()
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
updateSelectedColor(saturation: number | null = null, lightness: number | null = null, emitChanges: boolean = false): void {
|
|
348
|
+
|
|
349
|
+
// Update HSL values
|
|
350
|
+
if(saturation != null){
|
|
351
|
+
this.hslColor.s = saturation
|
|
352
|
+
}
|
|
353
|
+
if(lightness != null){
|
|
354
|
+
this.hslColor.l = lightness
|
|
355
|
+
}
|
|
356
|
+
// Convert HSL to RGB
|
|
357
|
+
const rgb = this.hslToRgb(this.hslColor);
|
|
358
|
+
|
|
359
|
+
this.rgbColor = rgb
|
|
360
|
+
|
|
361
|
+
// Convert RGB to HEX
|
|
362
|
+
const hex = this.rgbToHex(rgb, this.alpha / 100);
|
|
363
|
+
if(emitChanges){ this.model = hex }else{ this._model = hex }
|
|
364
|
+
|
|
365
|
+
// Emit color change event
|
|
366
|
+
// this.colorChange.emit(this.selectedColor)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
updateIndicatorPositions(): void {
|
|
370
|
+
// Set X position directly from saturation (0-100)
|
|
371
|
+
this.indicatorX = this.hslColor.s;
|
|
372
|
+
|
|
373
|
+
// Set Y position based on lightness
|
|
374
|
+
// When lightness is 50, Y should be 0 (top)
|
|
375
|
+
// When lightness is 0, Y should be 100 (bottom)
|
|
376
|
+
this.indicatorY = (50 - this.hslColor.l) * 2;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
hslToRgb(hsl: HSL): RGB {
|
|
380
|
+
var h = hsl.h / 360;
|
|
381
|
+
var s = hsl.s / 100;
|
|
382
|
+
var l = hsl.l / 100;
|
|
383
|
+
|
|
384
|
+
let r: number, g: number, b: number
|
|
385
|
+
|
|
386
|
+
if (s === 0) {
|
|
387
|
+
r = g = b = l // achromatic
|
|
388
|
+
} else {
|
|
389
|
+
const hue2rgb = (p: number, q: number, t: number) => {
|
|
390
|
+
if (t < 0) t += 1
|
|
391
|
+
if (t > 1) t -= 1
|
|
392
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t
|
|
393
|
+
if (t < 1 / 2) return q
|
|
394
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
|
|
395
|
+
return p
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const q = l < 0.5 ? l * (1 + s) : l + s - l * s
|
|
399
|
+
const p = 2 * l - q
|
|
400
|
+
|
|
401
|
+
r = hue2rgb(p, q, h + 1 / 3)
|
|
402
|
+
g = hue2rgb(p, q, h)
|
|
403
|
+
b = hue2rgb(p, q, h - 1 / 3)
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return {
|
|
407
|
+
r: Math.round(r * 255),
|
|
408
|
+
g: Math.round(g * 255),
|
|
409
|
+
b: Math.round(b * 255),
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
setColorFromHex(hexColor: string, updateCanvas: boolean = true, emitChanges: boolean = false): void {
|
|
414
|
+
// Remove # if present
|
|
415
|
+
hexColor = hexColor.replace(/^#/, "")
|
|
416
|
+
|
|
417
|
+
let r: number, g: number, b: number, a = 1
|
|
418
|
+
|
|
419
|
+
// Parse hex values based on string length
|
|
420
|
+
if (hexColor.length === 3) {
|
|
421
|
+
// Short hex (#RGB)
|
|
422
|
+
r = Number.parseInt(hexColor.charAt(0) + hexColor.charAt(0), 16)
|
|
423
|
+
g = Number.parseInt(hexColor.charAt(1) + hexColor.charAt(1), 16)
|
|
424
|
+
b = Number.parseInt(hexColor.charAt(2) + hexColor.charAt(2), 16)
|
|
425
|
+
} else if (hexColor.length === 6) {
|
|
426
|
+
// Standard hex (#RRGGBB)
|
|
427
|
+
r = Number.parseInt(hexColor.substring(0, 2), 16)
|
|
428
|
+
g = Number.parseInt(hexColor.substring(2, 4), 16)
|
|
429
|
+
b = Number.parseInt(hexColor.substring(4, 6), 16)
|
|
430
|
+
} else if (hexColor.length === 8) {
|
|
431
|
+
// Hex with alpha (#RRGGBBAA)
|
|
432
|
+
r = Number.parseInt(hexColor.substring(0, 2), 16)
|
|
433
|
+
g = Number.parseInt(hexColor.substring(2, 4), 16)
|
|
434
|
+
b = Number.parseInt(hexColor.substring(4, 6), 16)
|
|
435
|
+
a = Number.parseInt(hexColor.substring(6, 8), 16) / 255
|
|
436
|
+
} else {
|
|
437
|
+
// Invalid hex, use default
|
|
438
|
+
console.error("Invalid hex color format")
|
|
439
|
+
return
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Update RGB color
|
|
443
|
+
this.rgbColor = { r, g, b }
|
|
444
|
+
|
|
445
|
+
// Convert RGB to HSL
|
|
446
|
+
this.hslColor = this.rgbToHsl(this.rgbColor)
|
|
447
|
+
|
|
448
|
+
// Update alpha
|
|
449
|
+
this.alpha = Math.round(a * 100)
|
|
450
|
+
|
|
451
|
+
// Update selected color
|
|
452
|
+
const hex = this.rgbToHex(this.rgbColor, a)
|
|
453
|
+
if(emitChanges){ this.model = hex }else{ this._model = hex }
|
|
454
|
+
|
|
455
|
+
if(updateCanvas){
|
|
456
|
+
// Calculate indicator position
|
|
457
|
+
this.updateIndicatorPosition()
|
|
458
|
+
|
|
459
|
+
// Redraw components
|
|
460
|
+
this.drawColorGradient()
|
|
461
|
+
this.drawAlphaSlider()
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
updateIndicatorPosition(): void {
|
|
466
|
+
// Set X position based on saturation (0-100%)
|
|
467
|
+
this.indicatorX = this.hslColor.s
|
|
468
|
+
|
|
469
|
+
// Calculate Y position based on lightness and saturation
|
|
470
|
+
if (this.hslColor.s == 0) {
|
|
471
|
+
// Left edge: lightness determines position
|
|
472
|
+
this.indicatorY = 100 - this.hslColor.l
|
|
473
|
+
} else {
|
|
474
|
+
// Rest of canvas: calculate based on max lightness for this saturation
|
|
475
|
+
const maxLightness = 100 - this.hslColor.s / 2
|
|
476
|
+
|
|
477
|
+
// Ensure lightness is within valid range for this saturation
|
|
478
|
+
const adjustedLightness = Math.min(this.hslColor.l, maxLightness)
|
|
479
|
+
|
|
480
|
+
// Calculate Y position (0% at top, 100% at bottom)
|
|
481
|
+
if (maxLightness == 0) {
|
|
482
|
+
this.indicatorY = 100 // Avoid division by zero
|
|
483
|
+
} else {
|
|
484
|
+
this.indicatorY = ((maxLightness - adjustedLightness) / maxLightness) * 100
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Constrain to canvas bounds
|
|
488
|
+
this.indicatorY = Math.max(0, Math.min(100, this.indicatorY))
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
rgbToHsl(rgb: RGB): HSL {
|
|
493
|
+
var r = rgb.r / 255
|
|
494
|
+
var g = rgb.g / 255
|
|
495
|
+
var b = rgb.b / 255
|
|
496
|
+
|
|
497
|
+
const max = Math.max(r, g, b)
|
|
498
|
+
const min = Math.min(r, g, b)
|
|
499
|
+
let h = 0,
|
|
500
|
+
s = 0
|
|
501
|
+
const l = (max + min) / 2
|
|
502
|
+
|
|
503
|
+
if (max !== min) {
|
|
504
|
+
const d = max - min
|
|
505
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min)
|
|
506
|
+
|
|
507
|
+
switch (max) {
|
|
508
|
+
case r:
|
|
509
|
+
h = ((g - b) / d + (g < b ? 6 : 0)) / 6
|
|
510
|
+
break
|
|
511
|
+
case g:
|
|
512
|
+
h = ((b - r) / d + 2) / 6
|
|
513
|
+
break
|
|
514
|
+
case b:
|
|
515
|
+
h = ((r - g) / d + 4) / 6
|
|
516
|
+
break
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
return {
|
|
521
|
+
h: Math.round(h * 360),
|
|
522
|
+
s: Math.round(s * 100),
|
|
523
|
+
l: Math.round(l * 100),
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
rgbToHex(rgb: RGB , a = 1): string {
|
|
528
|
+
var { r, g, b } = rgb
|
|
529
|
+
|
|
530
|
+
const alphaHex = Math.round(a * 255)
|
|
531
|
+
.toString(16)
|
|
532
|
+
.padStart(2, "0")
|
|
533
|
+
return (
|
|
534
|
+
"#" +
|
|
535
|
+
[r, g, b]
|
|
536
|
+
.map((x) => {
|
|
537
|
+
const hex = x.toString(16)
|
|
538
|
+
return hex.length === 1 ? "0" + hex : hex
|
|
539
|
+
})
|
|
540
|
+
.join("") +
|
|
541
|
+
(a < 1 ? alphaHex : "")
|
|
542
|
+
).toUpperCase();
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
getRgbaString(): string {
|
|
546
|
+
const { r, g, b } = this.rgbColor
|
|
547
|
+
const a = this.alpha / 100
|
|
548
|
+
return `rgba(${r}, ${g}, ${b}, ${a})`
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
getHslaString(): string {
|
|
552
|
+
return `hsla(${this.hslColor.h}, ${this.hslColor.s}%, ${this.hslColor.l}%, ${this.alpha / 100})`
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
async CopyToClipboard() {
|
|
556
|
+
await Clipboard.write({
|
|
557
|
+
string: this.model
|
|
558
|
+
});
|
|
559
|
+
await this.genericService.PresentToastSuccess(`${this.model} copiada para a área de transferência!`);
|
|
560
|
+
}
|
|
561
|
+
}
|