yuyeon 0.3.1-rc.5 → 0.3.1
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/dist/yuyeon.js +1512 -1572
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/abstract/items.js +20 -0
- package/lib/abstract/items.js.map +1 -0
- package/lib/components/alert/YAlert.js +83 -0
- package/lib/components/alert/YAlert.js.map +1 -0
- package/lib/components/alert/index.js +2 -0
- package/lib/components/alert/index.js.map +1 -0
- package/lib/components/app/YApp.js +21 -0
- package/lib/components/app/YApp.js.map +1 -0
- package/lib/components/app/index.js +2 -0
- package/lib/components/app/index.js.map +1 -0
- package/lib/components/badge/YBadge.js +83 -0
- package/lib/components/badge/YBadge.js.map +1 -0
- package/lib/components/badge/index.js +2 -0
- package/lib/components/badge/index.js.map +1 -0
- package/lib/components/bench/YBench.js +43 -0
- package/lib/components/bench/YBench.js.map +1 -0
- package/lib/components/bench/index.js +2 -0
- package/lib/components/bench/index.js.map +1 -0
- package/lib/components/button/YButton.js +169 -0
- package/lib/components/button/YButton.js.map +1 -0
- package/lib/components/button/index.js +2 -0
- package/lib/components/button/index.js.map +1 -0
- package/lib/components/card/YCard.js +28 -0
- package/lib/components/card/YCard.js.map +1 -0
- package/lib/components/card/YCardBody.js +11 -0
- package/lib/components/card/YCardBody.js.map +1 -0
- package/lib/components/card/YCardFooter.js +11 -0
- package/lib/components/card/YCardFooter.js.map +1 -0
- package/lib/components/card/YCardHeader.js +11 -0
- package/lib/components/card/YCardHeader.js.map +1 -0
- package/lib/components/card/index.js +5 -0
- package/lib/components/card/index.js.map +1 -0
- package/lib/components/checkbox/YCheckbox.js +160 -0
- package/lib/components/checkbox/YCheckbox.js.map +1 -0
- package/lib/components/checkbox/YInputCheckbox.js +114 -0
- package/lib/components/checkbox/YInputCheckbox.js.map +1 -0
- package/lib/components/checkbox/index.js +4 -0
- package/lib/components/checkbox/index.js.map +1 -0
- package/lib/components/chip/YChip.js +39 -0
- package/lib/components/chip/YChip.js.map +1 -0
- package/lib/components/chip/index.js +2 -0
- package/lib/components/chip/index.js.map +1 -0
- package/lib/components/date-picker/YDateCalendar.js +243 -0
- package/lib/components/date-picker/YDateCalendar.js.map +1 -0
- package/lib/components/date-picker/YDatePicker.js +132 -0
- package/lib/components/date-picker/YDatePicker.js.map +1 -0
- package/lib/components/date-picker/YDatePickerControl.js +107 -0
- package/lib/components/date-picker/YDatePickerControl.js.map +1 -0
- package/lib/components/date-picker/YMonthPicker.js +64 -0
- package/lib/components/date-picker/YMonthPicker.js.map +1 -0
- package/lib/components/date-picker/YYearPicker.js +87 -0
- package/lib/components/date-picker/YYearPicker.js.map +1 -0
- package/lib/components/date-picker/index.js +4 -0
- package/lib/components/date-picker/index.js.map +1 -0
- package/lib/components/default-provider/YDefaultProvider.js +2 -0
- package/lib/components/default-provider/YDefaultProvider.js.map +1 -0
- package/lib/components/default-provider/index.js +2 -0
- package/lib/components/default-provider/index.js.map +1 -0
- package/lib/components/dialog/YDialog.js +213 -0
- package/lib/components/dialog/YDialog.js.map +1 -0
- package/lib/components/dialog/index.js +2 -0
- package/lib/components/dialog/index.js.map +1 -0
- package/lib/components/divider/YDivider.js +20 -0
- package/lib/components/divider/YDivider.js.map +1 -0
- package/lib/components/divider/index.js +2 -0
- package/lib/components/divider/index.js.map +1 -0
- package/lib/components/draggable/YDraggable.js +95 -0
- package/lib/components/draggable/YDraggable.js.map +1 -0
- package/lib/components/dropdown/YDropdown.js +109 -0
- package/lib/components/dropdown/YDropdown.js.map +1 -0
- package/lib/components/dropdown/index.js +2 -0
- package/lib/components/dropdown/index.js.map +1 -0
- package/lib/components/field-input/YFieldInput.js +229 -0
- package/lib/components/field-input/YFieldInput.js.map +1 -0
- package/lib/components/field-input/index.js +2 -0
- package/lib/components/field-input/index.js.map +1 -0
- package/lib/components/form/YForm.js +65 -0
- package/lib/components/form/YForm.js.map +1 -0
- package/lib/components/form/index.js +2 -0
- package/lib/components/form/index.js.map +1 -0
- package/lib/components/hover/YHover.js +54 -0
- package/lib/components/hover/YHover.js.map +1 -0
- package/lib/components/hover/index.js +2 -0
- package/lib/components/hover/index.js.map +1 -0
- package/lib/components/icon/YIcon.js +63 -0
- package/lib/components/icon/YIcon.js.map +1 -0
- package/lib/components/icon/index.js +2 -0
- package/lib/components/icon/index.js.map +1 -0
- package/lib/components/icons/YIconCheckbox.js +32 -0
- package/lib/components/icons/YIconCheckbox.js.map +1 -0
- package/lib/components/icons/YIconClear.js +16 -0
- package/lib/components/icons/YIconClear.js.map +1 -0
- package/lib/components/icons/YIconDropdown.js +16 -0
- package/lib/components/icons/YIconDropdown.js.map +1 -0
- package/lib/components/icons/YIconExpand.js +20 -0
- package/lib/components/icons/YIconExpand.js.map +1 -0
- package/lib/components/icons/YIconPageControl.js +32 -0
- package/lib/components/icons/YIconPageControl.js.map +1 -0
- package/lib/components/icons/YIconSort.js +45 -0
- package/lib/components/icons/YIconSort.js.map +1 -0
- package/lib/components/icons/index.js +32 -0
- package/lib/components/icons/index.js.map +1 -0
- package/lib/components/img/YImg.js +173 -0
- package/lib/components/img/YImg.js.map +1 -0
- package/lib/components/img/index.js +2 -0
- package/lib/components/img/index.js.map +1 -0
- package/lib/components/index.js +39 -0
- package/lib/components/index.js.map +1 -0
- package/lib/components/input/YInput.js +258 -0
- package/lib/components/input/YInput.js.map +1 -0
- package/lib/components/input/index.js +2 -0
- package/lib/components/input/index.js.map +1 -0
- package/lib/components/ip-field/YIpv4Field.js +297 -0
- package/lib/components/ip-field/YIpv4Field.js.map +1 -0
- package/lib/components/ip-field/index.js +2 -0
- package/lib/components/ip-field/index.js.map +1 -0
- package/lib/components/layer/YLayer.js +326 -0
- package/lib/components/layer/YLayer.js.map +1 -0
- package/lib/components/layer/active-delay.js +28 -0
- package/lib/components/layer/active-delay.js.map +1 -0
- package/lib/components/layer/active-stack.js +52 -0
- package/lib/components/layer/active-stack.js.map +1 -0
- package/lib/components/layer/base.js +87 -0
- package/lib/components/layer/base.js.map +1 -0
- package/lib/components/layer/content.js +22 -0
- package/lib/components/layer/content.js.map +1 -0
- package/lib/components/layer/index.js +2 -0
- package/lib/components/layer/index.js.map +1 -0
- package/lib/components/layer/scroll-strategies.js +132 -0
- package/lib/components/layer/scroll-strategies.js.map +1 -0
- package/lib/components/list/YList.js +55 -0
- package/lib/components/list/YList.js.map +1 -0
- package/lib/components/list/YListItem.js +59 -0
- package/lib/components/list/YListItem.js.map +1 -0
- package/lib/components/list/index.js +3 -0
- package/lib/components/list/index.js.map +1 -0
- package/lib/components/loading/YSpinnerRing.js +25 -0
- package/lib/components/loading/YSpinnerRing.js.map +1 -0
- package/lib/components/loading/index.js +2 -0
- package/lib/components/loading/index.js.map +1 -0
- package/lib/components/menu/YMenu.js +211 -0
- package/lib/components/menu/YMenu.js.map +1 -0
- package/lib/components/menu/index.js +2 -0
- package/lib/components/menu/index.js.map +1 -0
- package/lib/components/navigation/YNavigation.js +18 -0
- package/lib/components/navigation/YNavigation.js.map +1 -0
- package/lib/components/navigation/index.js +2 -0
- package/lib/components/navigation/index.js.map +1 -0
- package/lib/components/pagination/YPagination.js +288 -0
- package/lib/components/pagination/YPagination.js.map +1 -0
- package/lib/components/pagination/index.js +2 -0
- package/lib/components/pagination/index.js.map +1 -0
- package/lib/components/panel/YDividePanel.js +90 -0
- package/lib/components/panel/YDividePanel.js.map +1 -0
- package/lib/components/panel/index.js +2 -0
- package/lib/components/panel/index.js.map +1 -0
- package/lib/components/plate/YPlate.js +28 -0
- package/lib/components/plate/YPlate.js.map +1 -0
- package/lib/components/plate/index.js +2 -0
- package/lib/components/plate/index.js.map +1 -0
- package/lib/components/progress-bar/YProgressBar.js +117 -0
- package/lib/components/progress-bar/YProgressBar.js.map +1 -0
- package/lib/components/progress-bar/index.js +2 -0
- package/lib/components/progress-bar/index.js.map +1 -0
- package/lib/components/progress-ring/YProgressRing.js +128 -0
- package/lib/components/progress-ring/YProgressRing.js.map +1 -0
- package/lib/components/progress-ring/index.js +2 -0
- package/lib/components/progress-ring/index.js.map +1 -0
- package/lib/components/select/YSelect.js +344 -0
- package/lib/components/select/YSelect.js.map +1 -0
- package/lib/components/select/index.js +2 -0
- package/lib/components/select/index.js.map +1 -0
- package/lib/components/slider/YSlider.js +26 -0
- package/lib/components/slider/YSlider.js.map +1 -0
- package/lib/components/slider/index.js +2 -0
- package/lib/components/slider/index.js.map +1 -0
- package/lib/components/snackbar/YSnackbar.js +209 -0
- package/lib/components/snackbar/YSnackbar.js.map +1 -0
- package/lib/components/snackbar/index.js +2 -0
- package/lib/components/snackbar/index.js.map +1 -0
- package/lib/components/switch/YSwitch.js +184 -0
- package/lib/components/switch/YSwitch.js.map +1 -0
- package/lib/components/switch/index.js +2 -0
- package/lib/components/switch/index.js.map +1 -0
- package/lib/components/tab/YTab.js +64 -0
- package/lib/components/tab/YTab.js.map +1 -0
- package/lib/components/tab/YTabs.js +86 -0
- package/lib/components/tab/YTabs.js.map +1 -0
- package/lib/components/tab/index.js +4 -0
- package/lib/components/tab/index.js.map +1 -0
- package/lib/components/tab/shared.js +2 -0
- package/lib/components/tab/shared.js.map +1 -0
- package/lib/components/tab/types.js +2 -0
- package/lib/components/tab/types.js.map +1 -0
- package/lib/components/table/YDataTable.js +182 -0
- package/lib/components/table/YDataTable.js.map +1 -0
- package/lib/components/table/YDataTableBody.js +131 -0
- package/lib/components/table/YDataTableBody.js.map +1 -0
- package/lib/components/table/YDataTableCell.js +78 -0
- package/lib/components/table/YDataTableCell.js.map +1 -0
- package/lib/components/table/YDataTableControl.js +46 -0
- package/lib/components/table/YDataTableControl.js.map +1 -0
- package/lib/components/table/YDataTableHead.js +172 -0
- package/lib/components/table/YDataTableHead.js.map +1 -0
- package/lib/components/table/YDataTableLayer.js +29 -0
- package/lib/components/table/YDataTableLayer.js.map +1 -0
- package/lib/components/table/YDataTableRow.js +150 -0
- package/lib/components/table/YDataTableRow.js.map +1 -0
- package/lib/components/table/YDataTableServer.js +173 -0
- package/lib/components/table/YDataTableServer.js.map +1 -0
- package/lib/components/table/YTable.js +77 -0
- package/lib/components/table/YTable.js.map +1 -0
- package/lib/components/table/composibles/header.js +127 -0
- package/lib/components/table/composibles/header.js.map +1 -0
- package/lib/components/table/composibles/items.js +52 -0
- package/lib/components/table/composibles/items.js.map +1 -0
- package/lib/components/table/composibles/measure.js +39 -0
- package/lib/components/table/composibles/measure.js.map +1 -0
- package/lib/components/table/composibles/options.js +33 -0
- package/lib/components/table/composibles/options.js.map +1 -0
- package/lib/components/table/composibles/pagination.js +99 -0
- package/lib/components/table/composibles/pagination.js.map +1 -0
- package/lib/components/table/composibles/selection.js +196 -0
- package/lib/components/table/composibles/selection.js.map +1 -0
- package/lib/components/table/composibles/sorted-items.js +50 -0
- package/lib/components/table/composibles/sorted-items.js.map +1 -0
- package/lib/components/table/composibles/sorting.js +73 -0
- package/lib/components/table/composibles/sorting.js.map +1 -0
- package/lib/components/table/index.js +9 -0
- package/lib/components/table/index.js.map +1 -0
- package/lib/components/table/types/common.js +2 -0
- package/lib/components/table/types/common.js.map +1 -0
- package/lib/components/table/types/header.js +2 -0
- package/lib/components/table/types/header.js.map +1 -0
- package/lib/components/table/types/index.js +2 -0
- package/lib/components/table/types/index.js.map +1 -0
- package/lib/components/table/types/item.js +2 -0
- package/lib/components/table/types/item.js.map +1 -0
- package/lib/components/table/types/row.js +2 -0
- package/lib/components/table/types/row.js.map +1 -0
- package/lib/components/text-ellipsis/YTextEllipsis.js +66 -0
- package/lib/components/text-ellipsis/YTextEllipsis.js.map +1 -0
- package/lib/components/text-ellipsis/index.js +2 -0
- package/lib/components/text-ellipsis/index.js.map +1 -0
- package/lib/components/text-highlighter/YTextHighlighter.js +95 -0
- package/lib/components/text-highlighter/YTextHighlighter.js.map +1 -0
- package/lib/components/text-highlighter/index.js +2 -0
- package/lib/components/text-highlighter/index.js.map +1 -0
- package/lib/components/text-interpolation/YTi.js +47 -0
- package/lib/components/text-interpolation/YTi.js.map +1 -0
- package/lib/components/text-interpolation/index.js +2 -0
- package/lib/components/text-interpolation/index.js.map +1 -0
- package/lib/components/textarea/YTextarea.js +157 -0
- package/lib/components/textarea/YTextarea.js.map +1 -0
- package/lib/components/textarea/index.js +2 -0
- package/lib/components/textarea/index.js.map +1 -0
- package/lib/components/toggle-button/YToggleButton.js +2 -0
- package/lib/components/toggle-button/YToggleButton.js.map +1 -0
- package/lib/components/toggle-button/index.js +2 -0
- package/lib/components/toggle-button/index.js.map +1 -0
- package/lib/components/tooltip/YTooltip.js +157 -0
- package/lib/components/tooltip/YTooltip.js.map +1 -0
- package/lib/components/tooltip/index.js +2 -0
- package/lib/components/tooltip/index.js.map +1 -0
- package/lib/components/transitions/expand-transition.js +109 -0
- package/lib/components/transitions/expand-transition.js.map +1 -0
- package/lib/components/transitions/index.js +4 -0
- package/lib/components/transitions/index.js.map +1 -0
- package/lib/components/tree-view/YTreeView.js +289 -0
- package/lib/components/tree-view/YTreeView.js.map +1 -0
- package/lib/components/tree-view/YTreeViewNode.js +250 -0
- package/lib/components/tree-view/YTreeViewNode.js.map +1 -0
- package/lib/components/tree-view/index.js +3 -0
- package/lib/components/tree-view/index.js.map +1 -0
- package/lib/components/tree-view/tree-view.js +179 -0
- package/lib/components/tree-view/tree-view.js.map +1 -0
- package/lib/components/tree-view/types.js +2 -0
- package/lib/components/tree-view/types.js.map +1 -0
- package/lib/components/tree-view/util.js +40 -0
- package/lib/components/tree-view/util.js.map +1 -0
- package/lib/composables/choice-link.js +13 -0
- package/lib/composables/choice-link.js.map +1 -0
- package/lib/composables/choice.js +187 -0
- package/lib/composables/choice.js.map +1 -0
- package/lib/composables/communication.js +55 -0
- package/lib/composables/communication.js.map +1 -0
- package/lib/composables/component.js +8 -0
- package/lib/composables/component.js.map +1 -0
- package/lib/composables/coordinate/arrangement.js +14 -0
- package/lib/composables/coordinate/arrangement.js.map +1 -0
- package/lib/composables/coordinate/index.js +67 -0
- package/lib/composables/coordinate/index.js.map +1 -0
- package/lib/composables/coordinate/levitation.js +315 -0
- package/lib/composables/coordinate/levitation.js.map +1 -0
- package/lib/composables/coordinate/types.js +2 -0
- package/lib/composables/coordinate/types.js.map +1 -0
- package/lib/composables/coordinate/utils/point.js +55 -0
- package/lib/composables/coordinate/utils/point.js.map +1 -0
- package/lib/composables/date/factory.js +12 -0
- package/lib/composables/date/factory.js.map +1 -0
- package/lib/composables/date/index.js +20 -0
- package/lib/composables/date/index.js.map +1 -0
- package/lib/composables/date/setting.js +11 -0
- package/lib/composables/date/setting.js.map +1 -0
- package/lib/composables/date/types.js +2 -0
- package/lib/composables/date/types.js.map +1 -0
- package/lib/composables/defaults/index.js +99 -0
- package/lib/composables/defaults/index.js.map +1 -0
- package/lib/composables/defaults/share.js +2 -0
- package/lib/composables/defaults/share.js.map +1 -0
- package/lib/composables/defaults/types.js +2 -0
- package/lib/composables/defaults/types.js.map +1 -0
- package/lib/composables/dimension.js +26 -0
- package/lib/composables/dimension.js.map +1 -0
- package/lib/composables/focus.js +29 -0
- package/lib/composables/focus.js.map +1 -0
- package/lib/composables/form.js +100 -0
- package/lib/composables/form.js.map +1 -0
- package/lib/composables/i18n/index.js +30 -0
- package/lib/composables/i18n/index.js.map +1 -0
- package/lib/composables/i18n/locale.js +5 -0
- package/lib/composables/i18n/locale.js.map +1 -0
- package/lib/composables/i18n/rtl.js +34 -0
- package/lib/composables/i18n/rtl.js.map +1 -0
- package/lib/composables/i18n/share.js +2 -0
- package/lib/composables/i18n/share.js.map +1 -0
- package/lib/composables/icon.js +164 -0
- package/lib/composables/icon.js.map +1 -0
- package/lib/composables/index.js +11 -0
- package/lib/composables/index.js.map +1 -0
- package/lib/composables/layer-group.js +66 -0
- package/lib/composables/layer-group.js.map +1 -0
- package/lib/composables/layout.js +13 -0
- package/lib/composables/layout.js.map +1 -0
- package/lib/composables/list-items.js +66 -0
- package/lib/composables/list-items.js.map +1 -0
- package/lib/composables/progress.js +26 -0
- package/lib/composables/progress.js.map +1 -0
- package/lib/composables/ref.js +13 -0
- package/lib/composables/ref.js.map +1 -0
- package/lib/composables/resize-observer.js +33 -0
- package/lib/composables/resize-observer.js.map +1 -0
- package/lib/composables/scope.js +26 -0
- package/lib/composables/scope.js.map +1 -0
- package/lib/composables/style-color.js +37 -0
- package/lib/composables/style-color.js.map +1 -0
- package/lib/composables/theme/factory.js +47 -0
- package/lib/composables/theme/factory.js.map +1 -0
- package/lib/composables/theme/helper.js +14 -0
- package/lib/composables/theme/helper.js.map +1 -0
- package/lib/composables/theme/index.js +187 -0
- package/lib/composables/theme/index.js.map +1 -0
- package/lib/composables/theme/setting.js +112 -0
- package/lib/composables/theme/setting.js.map +1 -0
- package/lib/composables/theme/types.js +2 -0
- package/lib/composables/theme/types.js.map +1 -0
- package/lib/composables/timing.js +102 -0
- package/lib/composables/timing.js.map +1 -0
- package/lib/composables/transition.js +51 -0
- package/lib/composables/transition.js.map +1 -0
- package/lib/composables/validation.js +126 -0
- package/lib/composables/validation.js.map +1 -0
- package/lib/composables/vue-router.js +32 -0
- package/lib/composables/vue-router.js.map +1 -0
- package/lib/directives/complement-click/index.js +78 -0
- package/lib/directives/complement-click/index.js.map +1 -0
- package/lib/directives/plate-wave/index.js +100 -0
- package/lib/directives/plate-wave/index.js.map +1 -0
- package/lib/directives/theme-class.js +24 -0
- package/lib/directives/theme-class.js.map +1 -0
- package/lib/etc/index.js +6 -0
- package/lib/etc/index.js.map +1 -0
- package/lib/i18n/built-in.js +77 -0
- package/lib/i18n/built-in.js.map +1 -0
- package/lib/i18n/config.js +82 -0
- package/lib/i18n/config.js.map +1 -0
- package/lib/i18n/types.js +2 -0
- package/lib/i18n/types.js.map +1 -0
- package/lib/index.js +103 -0
- package/lib/index.js.map +1 -0
- package/lib/locales/en.js +6 -0
- package/lib/locales/en.js.map +1 -0
- package/lib/locales/index.js +3 -0
- package/lib/locales/index.js.map +1 -0
- package/lib/locales/ko.js +6 -0
- package/lib/locales/ko.js.map +1 -0
- package/lib/mixins/di.js +19 -0
- package/lib/mixins/di.js.map +1 -0
- package/lib/mixins/rebind-attrs.js +37 -0
- package/lib/mixins/rebind-attrs.js.map +1 -0
- package/lib/types/index.js +2 -0
- package/lib/types/index.js.map +1 -0
- package/lib/util/anchor.js +53 -0
- package/lib/util/anchor.js.map +1 -0
- package/lib/util/array.js +13 -0
- package/lib/util/array.js.map +1 -0
- package/lib/util/collection.js +10 -0
- package/lib/util/collection.js.map +1 -0
- package/lib/util/color/apca.js +201 -0
- package/lib/util/color/apca.js.map +1 -0
- package/lib/util/color/const.js +6 -0
- package/lib/util/color/const.js.map +1 -0
- package/lib/util/color/contrast/contrast.js +149 -0
- package/lib/util/color/contrast/contrast.js.map +1 -0
- package/lib/util/color/conversion.js +310 -0
- package/lib/util/color/conversion.js.map +1 -0
- package/lib/util/color/hct/cam16.js +349 -0
- package/lib/util/color/hct/cam16.js.map +1 -0
- package/lib/util/color/hct/hct-solver.js +389 -0
- package/lib/util/color/hct/hct-solver.js.map +1 -0
- package/lib/util/color/hct/hct.js +153 -0
- package/lib/util/color/hct/hct.js.map +1 -0
- package/lib/util/color/hct/viewing-conditions.js +110 -0
- package/lib/util/color/hct/viewing-conditions.js.map +1 -0
- package/lib/util/color/index.js +40 -0
- package/lib/util/color/index.js.map +1 -0
- package/lib/util/color/palettes/core-palette.js +99 -0
- package/lib/util/color/palettes/core-palette.js.map +1 -0
- package/lib/util/color/palettes/tonal-palette.js +112 -0
- package/lib/util/color/palettes/tonal-palette.js.map +1 -0
- package/lib/util/color/types.js +2 -0
- package/lib/util/color/types.js.map +1 -0
- package/lib/util/color/utils/math-utils.js +139 -0
- package/lib/util/color/utils/math-utils.js.map +1 -0
- package/lib/util/common.js +107 -0
- package/lib/util/common.js.map +1 -0
- package/lib/util/component/component.js +26 -0
- package/lib/util/component/component.js.map +1 -0
- package/lib/util/component/index.js +65 -0
- package/lib/util/component/index.js.map +1 -0
- package/lib/util/component/inject-self.js +10 -0
- package/lib/util/component/inject-self.js.map +1 -0
- package/lib/util/component/props.js +41 -0
- package/lib/util/component/props.js.map +1 -0
- package/lib/util/component/types.js +2 -0
- package/lib/util/component/types.js.map +1 -0
- package/lib/util/date/adapters/yuyeon-date-adapter.js +111 -0
- package/lib/util/date/adapters/yuyeon-date-adapter.js.map +1 -0
- package/lib/util/date/built-in.js +416 -0
- package/lib/util/date/built-in.js.map +1 -0
- package/lib/util/date/index.js +4 -0
- package/lib/util/date/index.js.map +1 -0
- package/lib/util/date/types.js +2 -0
- package/lib/util/date/types.js.map +1 -0
- package/lib/util/debounce.js +114 -0
- package/lib/util/debounce.js.map +1 -0
- package/lib/util/dom.js +23 -0
- package/lib/util/dom.js.map +1 -0
- package/lib/util/environments.js +8 -0
- package/lib/util/environments.js.map +1 -0
- package/lib/util/frame-scheduler.js +29 -0
- package/lib/util/frame-scheduler.js.map +1 -0
- package/lib/util/index.js +17 -0
- package/lib/util/index.js.map +1 -0
- package/lib/util/reactivity.js +19 -0
- package/lib/util/reactivity.js.map +1 -0
- package/lib/util/rect.js +39 -0
- package/lib/util/rect.js.map +1 -0
- package/lib/util/scroll.js +28 -0
- package/lib/util/scroll.js.map +1 -0
- package/lib/util/string.js +69 -0
- package/lib/util/string.js.map +1 -0
- package/lib/util/ui.js +60 -0
- package/lib/util/ui.js.map +1 -0
- package/lib/util/validation.js +5 -0
- package/lib/util/validation.js.map +1 -0
- package/package.json +12 -12
- package/types/components/dropdown/YDropdown.d.ts +4 -4
- package/types/components/select/YSelect.d.ts +107 -5630
- package/types/components/tooltip/YTooltip.d.ts +292 -3501
- package/lib/abstract/items.mjs +0 -20
- package/lib/abstract/items.mjs.map +0 -1
- package/lib/components/alert/YAlert.mjs +0 -83
- package/lib/components/alert/YAlert.mjs.map +0 -1
- package/lib/components/alert/index.mjs +0 -2
- package/lib/components/alert/index.mjs.map +0 -1
- package/lib/components/app/YApp.mjs +0 -21
- package/lib/components/app/YApp.mjs.map +0 -1
- package/lib/components/app/index.mjs +0 -2
- package/lib/components/app/index.mjs.map +0 -1
- package/lib/components/badge/YBadge.mjs +0 -83
- package/lib/components/badge/YBadge.mjs.map +0 -1
- package/lib/components/badge/index.mjs +0 -2
- package/lib/components/badge/index.mjs.map +0 -1
- package/lib/components/bench/YBench.mjs +0 -43
- package/lib/components/bench/YBench.mjs.map +0 -1
- package/lib/components/bench/index.mjs +0 -2
- package/lib/components/bench/index.mjs.map +0 -1
- package/lib/components/button/YButton.mjs +0 -169
- package/lib/components/button/YButton.mjs.map +0 -1
- package/lib/components/button/index.mjs +0 -2
- package/lib/components/button/index.mjs.map +0 -1
- package/lib/components/card/YCard.mjs +0 -28
- package/lib/components/card/YCard.mjs.map +0 -1
- package/lib/components/card/YCardBody.mjs +0 -11
- package/lib/components/card/YCardBody.mjs.map +0 -1
- package/lib/components/card/YCardFooter.mjs +0 -11
- package/lib/components/card/YCardFooter.mjs.map +0 -1
- package/lib/components/card/YCardHeader.mjs +0 -11
- package/lib/components/card/YCardHeader.mjs.map +0 -1
- package/lib/components/card/index.mjs +0 -5
- package/lib/components/card/index.mjs.map +0 -1
- package/lib/components/checkbox/YCheckbox.mjs +0 -160
- package/lib/components/checkbox/YCheckbox.mjs.map +0 -1
- package/lib/components/checkbox/YInputCheckbox.mjs +0 -114
- package/lib/components/checkbox/YInputCheckbox.mjs.map +0 -1
- package/lib/components/checkbox/index.mjs +0 -4
- package/lib/components/checkbox/index.mjs.map +0 -1
- package/lib/components/chip/YChip.mjs +0 -39
- package/lib/components/chip/YChip.mjs.map +0 -1
- package/lib/components/chip/index.mjs +0 -2
- package/lib/components/chip/index.mjs.map +0 -1
- package/lib/components/date-picker/YDateCalendar.mjs +0 -243
- package/lib/components/date-picker/YDateCalendar.mjs.map +0 -1
- package/lib/components/date-picker/YDatePicker.mjs +0 -132
- package/lib/components/date-picker/YDatePicker.mjs.map +0 -1
- package/lib/components/date-picker/YDatePickerControl.mjs +0 -107
- package/lib/components/date-picker/YDatePickerControl.mjs.map +0 -1
- package/lib/components/date-picker/YMonthPicker.mjs +0 -64
- package/lib/components/date-picker/YMonthPicker.mjs.map +0 -1
- package/lib/components/date-picker/YYearPicker.mjs +0 -87
- package/lib/components/date-picker/YYearPicker.mjs.map +0 -1
- package/lib/components/date-picker/index.mjs +0 -4
- package/lib/components/date-picker/index.mjs.map +0 -1
- package/lib/components/default-provider/YDefaultProvider.mjs +0 -2
- package/lib/components/default-provider/YDefaultProvider.mjs.map +0 -1
- package/lib/components/default-provider/index.mjs +0 -2
- package/lib/components/default-provider/index.mjs.map +0 -1
- package/lib/components/dialog/YDialog.mjs +0 -213
- package/lib/components/dialog/YDialog.mjs.map +0 -1
- package/lib/components/dialog/index.mjs +0 -2
- package/lib/components/dialog/index.mjs.map +0 -1
- package/lib/components/divider/YDivider.mjs +0 -20
- package/lib/components/divider/YDivider.mjs.map +0 -1
- package/lib/components/divider/index.mjs +0 -2
- package/lib/components/divider/index.mjs.map +0 -1
- package/lib/components/draggable/YDraggable.mjs +0 -95
- package/lib/components/draggable/YDraggable.mjs.map +0 -1
- package/lib/components/dropdown/YDropdown.mjs +0 -109
- package/lib/components/dropdown/YDropdown.mjs.map +0 -1
- package/lib/components/dropdown/index.mjs +0 -2
- package/lib/components/dropdown/index.mjs.map +0 -1
- package/lib/components/field-input/YFieldInput.mjs +0 -229
- package/lib/components/field-input/YFieldInput.mjs.map +0 -1
- package/lib/components/field-input/index.mjs +0 -2
- package/lib/components/field-input/index.mjs.map +0 -1
- package/lib/components/form/YForm.mjs +0 -65
- package/lib/components/form/YForm.mjs.map +0 -1
- package/lib/components/form/index.mjs +0 -2
- package/lib/components/form/index.mjs.map +0 -1
- package/lib/components/hover/YHover.mjs +0 -54
- package/lib/components/hover/YHover.mjs.map +0 -1
- package/lib/components/hover/index.mjs +0 -2
- package/lib/components/hover/index.mjs.map +0 -1
- package/lib/components/icon/YIcon.mjs +0 -63
- package/lib/components/icon/YIcon.mjs.map +0 -1
- package/lib/components/icon/index.mjs +0 -2
- package/lib/components/icon/index.mjs.map +0 -1
- package/lib/components/icon/poly.mjs +0 -57
- package/lib/components/icon/poly.mjs.map +0 -1
- package/lib/components/icons/YIconCheckbox.mjs +0 -32
- package/lib/components/icons/YIconCheckbox.mjs.map +0 -1
- package/lib/components/icons/YIconClear.mjs +0 -16
- package/lib/components/icons/YIconClear.mjs.map +0 -1
- package/lib/components/icons/YIconDropdown.mjs +0 -16
- package/lib/components/icons/YIconDropdown.mjs.map +0 -1
- package/lib/components/icons/YIconExpand.mjs +0 -20
- package/lib/components/icons/YIconExpand.mjs.map +0 -1
- package/lib/components/icons/YIconPageControl.mjs +0 -32
- package/lib/components/icons/YIconPageControl.mjs.map +0 -1
- package/lib/components/icons/YIconSort.mjs +0 -45
- package/lib/components/icons/YIconSort.mjs.map +0 -1
- package/lib/components/icons/index.mjs +0 -32
- package/lib/components/icons/index.mjs.map +0 -1
- package/lib/components/img/YImg.mjs +0 -173
- package/lib/components/img/YImg.mjs.map +0 -1
- package/lib/components/img/index.mjs +0 -2
- package/lib/components/img/index.mjs.map +0 -1
- package/lib/components/index.mjs +0 -39
- package/lib/components/index.mjs.map +0 -1
- package/lib/components/input/YInput.mjs +0 -258
- package/lib/components/input/YInput.mjs.map +0 -1
- package/lib/components/input/index.mjs +0 -2
- package/lib/components/input/index.mjs.map +0 -1
- package/lib/components/ip-field/YIpv4Field.mjs +0 -297
- package/lib/components/ip-field/YIpv4Field.mjs.map +0 -1
- package/lib/components/ip-field/index.mjs +0 -2
- package/lib/components/ip-field/index.mjs.map +0 -1
- package/lib/components/layer/YLayer.mjs +0 -326
- package/lib/components/layer/YLayer.mjs.map +0 -1
- package/lib/components/layer/active-delay.mjs +0 -28
- package/lib/components/layer/active-delay.mjs.map +0 -1
- package/lib/components/layer/active-stack.mjs +0 -52
- package/lib/components/layer/active-stack.mjs.map +0 -1
- package/lib/components/layer/base.mjs +0 -87
- package/lib/components/layer/base.mjs.map +0 -1
- package/lib/components/layer/content.mjs +0 -22
- package/lib/components/layer/content.mjs.map +0 -1
- package/lib/components/layer/index.mjs +0 -2
- package/lib/components/layer/index.mjs.map +0 -1
- package/lib/components/layer/scroll-strategies.mjs +0 -132
- package/lib/components/layer/scroll-strategies.mjs.map +0 -1
- package/lib/components/list/YList.mjs +0 -55
- package/lib/components/list/YList.mjs.map +0 -1
- package/lib/components/list/YListItem.mjs +0 -59
- package/lib/components/list/YListItem.mjs.map +0 -1
- package/lib/components/list/index.mjs +0 -3
- package/lib/components/list/index.mjs.map +0 -1
- package/lib/components/loading/YSpinnerRing.mjs +0 -25
- package/lib/components/loading/YSpinnerRing.mjs.map +0 -1
- package/lib/components/loading/index.mjs +0 -2
- package/lib/components/loading/index.mjs.map +0 -1
- package/lib/components/menu/YMenu.mjs +0 -211
- package/lib/components/menu/YMenu.mjs.map +0 -1
- package/lib/components/menu/index.mjs +0 -2
- package/lib/components/menu/index.mjs.map +0 -1
- package/lib/components/navigation/YNavigation.mjs +0 -18
- package/lib/components/navigation/YNavigation.mjs.map +0 -1
- package/lib/components/navigation/index.mjs +0 -2
- package/lib/components/navigation/index.mjs.map +0 -1
- package/lib/components/pagination/YPagination.mjs +0 -288
- package/lib/components/pagination/YPagination.mjs.map +0 -1
- package/lib/components/pagination/index.mjs +0 -2
- package/lib/components/pagination/index.mjs.map +0 -1
- package/lib/components/panel/YDividePanel.mjs +0 -90
- package/lib/components/panel/YDividePanel.mjs.map +0 -1
- package/lib/components/panel/index.mjs +0 -2
- package/lib/components/panel/index.mjs.map +0 -1
- package/lib/components/plate/YPlate.mjs +0 -28
- package/lib/components/plate/YPlate.mjs.map +0 -1
- package/lib/components/plate/index.mjs +0 -2
- package/lib/components/plate/index.mjs.map +0 -1
- package/lib/components/progress-bar/YProgressBar.mjs +0 -117
- package/lib/components/progress-bar/YProgressBar.mjs.map +0 -1
- package/lib/components/progress-bar/index.mjs +0 -2
- package/lib/components/progress-bar/index.mjs.map +0 -1
- package/lib/components/progress-ring/YProgressRing.mjs +0 -128
- package/lib/components/progress-ring/YProgressRing.mjs.map +0 -1
- package/lib/components/progress-ring/index.mjs +0 -2
- package/lib/components/progress-ring/index.mjs.map +0 -1
- package/lib/components/select/YSelect.mjs +0 -344
- package/lib/components/select/YSelect.mjs.map +0 -1
- package/lib/components/select/index.mjs +0 -2
- package/lib/components/select/index.mjs.map +0 -1
- package/lib/components/slider/YSlider.mjs +0 -26
- package/lib/components/slider/YSlider.mjs.map +0 -1
- package/lib/components/slider/index.mjs +0 -2
- package/lib/components/slider/index.mjs.map +0 -1
- package/lib/components/snackbar/YSnackbar.mjs +0 -209
- package/lib/components/snackbar/YSnackbar.mjs.map +0 -1
- package/lib/components/snackbar/index.mjs +0 -2
- package/lib/components/snackbar/index.mjs.map +0 -1
- package/lib/components/switch/YSwitch.mjs +0 -184
- package/lib/components/switch/YSwitch.mjs.map +0 -1
- package/lib/components/switch/index.mjs +0 -2
- package/lib/components/switch/index.mjs.map +0 -1
- package/lib/components/tab/YTab.mjs +0 -64
- package/lib/components/tab/YTab.mjs.map +0 -1
- package/lib/components/tab/YTabs.mjs +0 -86
- package/lib/components/tab/YTabs.mjs.map +0 -1
- package/lib/components/tab/index.mjs +0 -4
- package/lib/components/tab/index.mjs.map +0 -1
- package/lib/components/tab/shared.mjs +0 -2
- package/lib/components/tab/shared.mjs.map +0 -1
- package/lib/components/tab/types.mjs +0 -2
- package/lib/components/tab/types.mjs.map +0 -1
- package/lib/components/table/YDataTable.mjs +0 -182
- package/lib/components/table/YDataTable.mjs.map +0 -1
- package/lib/components/table/YDataTableBody.mjs +0 -131
- package/lib/components/table/YDataTableBody.mjs.map +0 -1
- package/lib/components/table/YDataTableCell.mjs +0 -78
- package/lib/components/table/YDataTableCell.mjs.map +0 -1
- package/lib/components/table/YDataTableControl.mjs +0 -46
- package/lib/components/table/YDataTableControl.mjs.map +0 -1
- package/lib/components/table/YDataTableHead.mjs +0 -172
- package/lib/components/table/YDataTableHead.mjs.map +0 -1
- package/lib/components/table/YDataTableLayer.mjs +0 -29
- package/lib/components/table/YDataTableLayer.mjs.map +0 -1
- package/lib/components/table/YDataTableRow.mjs +0 -150
- package/lib/components/table/YDataTableRow.mjs.map +0 -1
- package/lib/components/table/YDataTableServer.mjs +0 -173
- package/lib/components/table/YDataTableServer.mjs.map +0 -1
- package/lib/components/table/YTable.mjs +0 -77
- package/lib/components/table/YTable.mjs.map +0 -1
- package/lib/components/table/composibles/header.mjs +0 -127
- package/lib/components/table/composibles/header.mjs.map +0 -1
- package/lib/components/table/composibles/items.mjs +0 -52
- package/lib/components/table/composibles/items.mjs.map +0 -1
- package/lib/components/table/composibles/measure.mjs +0 -39
- package/lib/components/table/composibles/measure.mjs.map +0 -1
- package/lib/components/table/composibles/options.mjs +0 -33
- package/lib/components/table/composibles/options.mjs.map +0 -1
- package/lib/components/table/composibles/pagination.mjs +0 -99
- package/lib/components/table/composibles/pagination.mjs.map +0 -1
- package/lib/components/table/composibles/selection.mjs +0 -196
- package/lib/components/table/composibles/selection.mjs.map +0 -1
- package/lib/components/table/composibles/sorted-items.mjs +0 -50
- package/lib/components/table/composibles/sorted-items.mjs.map +0 -1
- package/lib/components/table/composibles/sorting.mjs +0 -73
- package/lib/components/table/composibles/sorting.mjs.map +0 -1
- package/lib/components/table/index.mjs +0 -9
- package/lib/components/table/index.mjs.map +0 -1
- package/lib/components/table/types/common.mjs +0 -2
- package/lib/components/table/types/common.mjs.map +0 -1
- package/lib/components/table/types/header.mjs +0 -2
- package/lib/components/table/types/header.mjs.map +0 -1
- package/lib/components/table/types/index.mjs +0 -2
- package/lib/components/table/types/index.mjs.map +0 -1
- package/lib/components/table/types/item.mjs +0 -2
- package/lib/components/table/types/item.mjs.map +0 -1
- package/lib/components/table/types/row.mjs +0 -2
- package/lib/components/table/types/row.mjs.map +0 -1
- package/lib/components/text-ellipsis/YTextEllipsis.mjs +0 -66
- package/lib/components/text-ellipsis/YTextEllipsis.mjs.map +0 -1
- package/lib/components/text-ellipsis/index.mjs +0 -2
- package/lib/components/text-ellipsis/index.mjs.map +0 -1
- package/lib/components/text-highlighter/YTextHighlighter.mjs +0 -95
- package/lib/components/text-highlighter/YTextHighlighter.mjs.map +0 -1
- package/lib/components/text-highlighter/index.mjs +0 -2
- package/lib/components/text-highlighter/index.mjs.map +0 -1
- package/lib/components/text-interpolation/YTi.mjs +0 -47
- package/lib/components/text-interpolation/YTi.mjs.map +0 -1
- package/lib/components/text-interpolation/index.mjs +0 -2
- package/lib/components/text-interpolation/index.mjs.map +0 -1
- package/lib/components/textarea/YTextarea.mjs +0 -157
- package/lib/components/textarea/YTextarea.mjs.map +0 -1
- package/lib/components/textarea/index.mjs +0 -2
- package/lib/components/textarea/index.mjs.map +0 -1
- package/lib/components/toggle-button/YToggleButton.mjs +0 -2
- package/lib/components/toggle-button/YToggleButton.mjs.map +0 -1
- package/lib/components/toggle-button/index.mjs +0 -2
- package/lib/components/toggle-button/index.mjs.map +0 -1
- package/lib/components/tooltip/YTooltip.mjs +0 -156
- package/lib/components/tooltip/YTooltip.mjs.map +0 -1
- package/lib/components/tooltip/index.mjs +0 -2
- package/lib/components/tooltip/index.mjs.map +0 -1
- package/lib/components/transitions/expand-transition.mjs +0 -109
- package/lib/components/transitions/expand-transition.mjs.map +0 -1
- package/lib/components/transitions/index.mjs +0 -4
- package/lib/components/transitions/index.mjs.map +0 -1
- package/lib/components/tree-view/YTreeView.mjs +0 -289
- package/lib/components/tree-view/YTreeView.mjs.map +0 -1
- package/lib/components/tree-view/YTreeViewNode.mjs +0 -250
- package/lib/components/tree-view/YTreeViewNode.mjs.map +0 -1
- package/lib/components/tree-view/index.mjs +0 -3
- package/lib/components/tree-view/index.mjs.map +0 -1
- package/lib/components/tree-view/tree-view.mjs +0 -179
- package/lib/components/tree-view/tree-view.mjs.map +0 -1
- package/lib/components/tree-view/types.mjs +0 -2
- package/lib/components/tree-view/types.mjs.map +0 -1
- package/lib/components/tree-view/util.mjs +0 -40
- package/lib/components/tree-view/util.mjs.map +0 -1
- package/lib/composables/choice-link.mjs +0 -13
- package/lib/composables/choice-link.mjs.map +0 -1
- package/lib/composables/choice.mjs +0 -187
- package/lib/composables/choice.mjs.map +0 -1
- package/lib/composables/communication.mjs +0 -55
- package/lib/composables/communication.mjs.map +0 -1
- package/lib/composables/component.mjs +0 -8
- package/lib/composables/component.mjs.map +0 -1
- package/lib/composables/coordinate/arrangement.mjs +0 -14
- package/lib/composables/coordinate/arrangement.mjs.map +0 -1
- package/lib/composables/coordinate/index.mjs +0 -67
- package/lib/composables/coordinate/index.mjs.map +0 -1
- package/lib/composables/coordinate/levitation.mjs +0 -315
- package/lib/composables/coordinate/levitation.mjs.map +0 -1
- package/lib/composables/coordinate/types.mjs +0 -2
- package/lib/composables/coordinate/types.mjs.map +0 -1
- package/lib/composables/coordinate/utils/point.mjs +0 -55
- package/lib/composables/coordinate/utils/point.mjs.map +0 -1
- package/lib/composables/date/factory.mjs +0 -12
- package/lib/composables/date/factory.mjs.map +0 -1
- package/lib/composables/date/index.mjs +0 -20
- package/lib/composables/date/index.mjs.map +0 -1
- package/lib/composables/date/setting.mjs +0 -11
- package/lib/composables/date/setting.mjs.map +0 -1
- package/lib/composables/date/types.mjs +0 -2
- package/lib/composables/date/types.mjs.map +0 -1
- package/lib/composables/defaults/index.mjs +0 -99
- package/lib/composables/defaults/index.mjs.map +0 -1
- package/lib/composables/defaults/share.mjs +0 -2
- package/lib/composables/defaults/share.mjs.map +0 -1
- package/lib/composables/defaults/types.mjs +0 -2
- package/lib/composables/defaults/types.mjs.map +0 -1
- package/lib/composables/dimension.mjs +0 -26
- package/lib/composables/dimension.mjs.map +0 -1
- package/lib/composables/focus.mjs +0 -29
- package/lib/composables/focus.mjs.map +0 -1
- package/lib/composables/form.mjs +0 -100
- package/lib/composables/form.mjs.map +0 -1
- package/lib/composables/group.mjs +0 -194
- package/lib/composables/group.mjs.map +0 -1
- package/lib/composables/i18n/index.mjs +0 -30
- package/lib/composables/i18n/index.mjs.map +0 -1
- package/lib/composables/i18n/locale.mjs +0 -5
- package/lib/composables/i18n/locale.mjs.map +0 -1
- package/lib/composables/i18n/rtl.mjs +0 -34
- package/lib/composables/i18n/rtl.mjs.map +0 -1
- package/lib/composables/i18n/share.mjs +0 -2
- package/lib/composables/i18n/share.mjs.map +0 -1
- package/lib/composables/icon.mjs +0 -164
- package/lib/composables/icon.mjs.map +0 -1
- package/lib/composables/index.mjs +0 -11
- package/lib/composables/index.mjs.map +0 -1
- package/lib/composables/layer-group.mjs +0 -66
- package/lib/composables/layer-group.mjs.map +0 -1
- package/lib/composables/layout.mjs +0 -13
- package/lib/composables/layout.mjs.map +0 -1
- package/lib/composables/list-items.mjs +0 -66
- package/lib/composables/list-items.mjs.map +0 -1
- package/lib/composables/progress.mjs +0 -26
- package/lib/composables/progress.mjs.map +0 -1
- package/lib/composables/ref.mjs +0 -13
- package/lib/composables/ref.mjs.map +0 -1
- package/lib/composables/resize-observer.mjs +0 -33
- package/lib/composables/resize-observer.mjs.map +0 -1
- package/lib/composables/scope.mjs +0 -26
- package/lib/composables/scope.mjs.map +0 -1
- package/lib/composables/style-color.mjs +0 -37
- package/lib/composables/style-color.mjs.map +0 -1
- package/lib/composables/theme/factory.mjs +0 -47
- package/lib/composables/theme/factory.mjs.map +0 -1
- package/lib/composables/theme/helper.mjs +0 -14
- package/lib/composables/theme/helper.mjs.map +0 -1
- package/lib/composables/theme/index.mjs +0 -187
- package/lib/composables/theme/index.mjs.map +0 -1
- package/lib/composables/theme/setting.mjs +0 -112
- package/lib/composables/theme/setting.mjs.map +0 -1
- package/lib/composables/theme/types.mjs +0 -2
- package/lib/composables/theme/types.mjs.map +0 -1
- package/lib/composables/timing.mjs +0 -102
- package/lib/composables/timing.mjs.map +0 -1
- package/lib/composables/transition.mjs +0 -51
- package/lib/composables/transition.mjs.map +0 -1
- package/lib/composables/validation.mjs +0 -126
- package/lib/composables/validation.mjs.map +0 -1
- package/lib/composables/vue-router.mjs +0 -32
- package/lib/composables/vue-router.mjs.map +0 -1
- package/lib/directives/complement-click/index.mjs +0 -78
- package/lib/directives/complement-click/index.mjs.map +0 -1
- package/lib/directives/plate-wave/index.mjs +0 -100
- package/lib/directives/plate-wave/index.mjs.map +0 -1
- package/lib/directives/theme-class.mjs +0 -24
- package/lib/directives/theme-class.mjs.map +0 -1
- package/lib/etc/index.mjs +0 -6
- package/lib/etc/index.mjs.map +0 -1
- package/lib/i18n/built-in.mjs +0 -77
- package/lib/i18n/built-in.mjs.map +0 -1
- package/lib/i18n/config.mjs +0 -82
- package/lib/i18n/config.mjs.map +0 -1
- package/lib/i18n/types.mjs +0 -2
- package/lib/i18n/types.mjs.map +0 -1
- package/lib/index.mjs +0 -103
- package/lib/index.mjs.map +0 -1
- package/lib/locales/en.mjs +0 -6
- package/lib/locales/en.mjs.map +0 -1
- package/lib/locales/index.mjs +0 -3
- package/lib/locales/index.mjs.map +0 -1
- package/lib/locales/ko.mjs +0 -6
- package/lib/locales/ko.mjs.map +0 -1
- package/lib/mixins/di.mjs +0 -19
- package/lib/mixins/di.mjs.map +0 -1
- package/lib/mixins/rebind-attrs.mjs +0 -37
- package/lib/mixins/rebind-attrs.mjs.map +0 -1
- package/lib/types/index.mjs +0 -2
- package/lib/types/index.mjs.map +0 -1
- package/lib/util/anchor.mjs +0 -53
- package/lib/util/anchor.mjs.map +0 -1
- package/lib/util/array.mjs +0 -13
- package/lib/util/array.mjs.map +0 -1
- package/lib/util/collection.mjs +0 -10
- package/lib/util/collection.mjs.map +0 -1
- package/lib/util/color/apca.mjs +0 -201
- package/lib/util/color/apca.mjs.map +0 -1
- package/lib/util/color/const.mjs +0 -6
- package/lib/util/color/const.mjs.map +0 -1
- package/lib/util/color/contrast/contrast.mjs +0 -149
- package/lib/util/color/contrast/contrast.mjs.map +0 -1
- package/lib/util/color/conversion.mjs +0 -310
- package/lib/util/color/conversion.mjs.map +0 -1
- package/lib/util/color/hct/cam16.mjs +0 -349
- package/lib/util/color/hct/cam16.mjs.map +0 -1
- package/lib/util/color/hct/hct-solver.mjs +0 -389
- package/lib/util/color/hct/hct-solver.mjs.map +0 -1
- package/lib/util/color/hct/hct.mjs +0 -153
- package/lib/util/color/hct/hct.mjs.map +0 -1
- package/lib/util/color/hct/viewing-conditions.mjs +0 -110
- package/lib/util/color/hct/viewing-conditions.mjs.map +0 -1
- package/lib/util/color/index.mjs +0 -40
- package/lib/util/color/index.mjs.map +0 -1
- package/lib/util/color/palettes/core-palette.mjs +0 -99
- package/lib/util/color/palettes/core-palette.mjs.map +0 -1
- package/lib/util/color/palettes/tonal-palette.mjs +0 -112
- package/lib/util/color/palettes/tonal-palette.mjs.map +0 -1
- package/lib/util/color/types.mjs +0 -2
- package/lib/util/color/types.mjs.map +0 -1
- package/lib/util/color/utils/math-utils.mjs +0 -139
- package/lib/util/color/utils/math-utils.mjs.map +0 -1
- package/lib/util/common.mjs +0 -107
- package/lib/util/common.mjs.map +0 -1
- package/lib/util/component/component.mjs +0 -26
- package/lib/util/component/component.mjs.map +0 -1
- package/lib/util/component/index.mjs +0 -65
- package/lib/util/component/index.mjs.map +0 -1
- package/lib/util/component/inject-self.mjs +0 -10
- package/lib/util/component/inject-self.mjs.map +0 -1
- package/lib/util/component/props.mjs +0 -41
- package/lib/util/component/props.mjs.map +0 -1
- package/lib/util/component/types.mjs +0 -2
- package/lib/util/component/types.mjs.map +0 -1
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs +0 -111
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs.map +0 -1
- package/lib/util/date/built-in.mjs +0 -416
- package/lib/util/date/built-in.mjs.map +0 -1
- package/lib/util/date/index.mjs +0 -4
- package/lib/util/date/index.mjs.map +0 -1
- package/lib/util/date/types.mjs +0 -2
- package/lib/util/date/types.mjs.map +0 -1
- package/lib/util/debounce.mjs +0 -114
- package/lib/util/debounce.mjs.map +0 -1
- package/lib/util/dom.mjs +0 -23
- package/lib/util/dom.mjs.map +0 -1
- package/lib/util/environments.mjs +0 -8
- package/lib/util/environments.mjs.map +0 -1
- package/lib/util/frame-scheduler.mjs +0 -29
- package/lib/util/frame-scheduler.mjs.map +0 -1
- package/lib/util/index.mjs +0 -17
- package/lib/util/index.mjs.map +0 -1
- package/lib/util/parser.mjs +0 -31
- package/lib/util/parser.mjs.map +0 -1
- package/lib/util/reactivity.mjs +0 -19
- package/lib/util/reactivity.mjs.map +0 -1
- package/lib/util/rect.mjs +0 -39
- package/lib/util/rect.mjs.map +0 -1
- package/lib/util/scroll.mjs +0 -28
- package/lib/util/scroll.mjs.map +0 -1
- package/lib/util/string.mjs +0 -69
- package/lib/util/string.mjs.map +0 -1
- package/lib/util/ui.mjs +0 -60
- package/lib/util/ui.mjs.map +0 -1
- package/lib/util/validation.mjs +0 -5
- package/lib/util/validation.mjs.map +0 -1
- package/lib/util/vue-component/index.mjs +0 -63
- package/lib/util/vue-component/index.mjs.map +0 -1
- package/lib/util/vue-component/props.mjs +0 -37
- package/lib/util/vue-component/props.mjs.map +0 -1
- package/lib/util/vue-component/types.mjs +0 -2
- package/lib/util/vue-component/types.mjs.map +0 -1
- package/lib/util/vue-component.mjs +0 -102
- package/lib/util/vue-component.mjs.map +0 -1
- package/types/components/table/pagination.d.ts +0 -78
- package/types/util/color/hct/hct_solver.d.ts +0 -146
- package/types/util/color/hct/viewing_conditions.d.ts +0 -74
- package/types/util/color/palettes/tonal_palette.d.ts +0 -55
- package/types/util/color/utils/math_utils.d.ts +0 -82
- package/types/util/parser.d.ts +0 -4
- package/types/util/vue-component/index.d.ts +0 -10
- package/types/util/vue-component/props.d.ts +0 -31
- package/types/util/vue-component/types.d.ts +0 -4
- package/types/util/vue-component.d.ts +0 -39
- /package/types/util/{Rect.d.ts → rect.d.ts} +0 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2021 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
import { whitePointD65, yFromLstar } from "../conversion.js";
|
|
21
|
+
import * as math from "../utils/math-utils.js";
|
|
22
|
+
/**
|
|
23
|
+
* In traditional color spaces, a color can be identified solely by the
|
|
24
|
+
* observer's measurement of the color. Color appearance models such as CAM16
|
|
25
|
+
* also use information about the environment where the color was
|
|
26
|
+
* observed, known as the viewing conditions.
|
|
27
|
+
*
|
|
28
|
+
* For example, white under the traditional assumption of a midday sun white
|
|
29
|
+
* point is accurately measured as a slightly chromatic blue by CAM16. (roughly,
|
|
30
|
+
* hue 203, chroma 3, lightness 100)
|
|
31
|
+
*
|
|
32
|
+
* This class caches intermediate values of the CAM16 conversion process that
|
|
33
|
+
* depend only on viewing conditions, enabling speed ups.
|
|
34
|
+
*/
|
|
35
|
+
export class ViewingConditions {
|
|
36
|
+
/**
|
|
37
|
+
* Create ViewingConditions from a simple, physically relevant, set of
|
|
38
|
+
* parameters.
|
|
39
|
+
*
|
|
40
|
+
* @param whitePoint White point, measured in the XYZ color space.
|
|
41
|
+
* default = D65, or sunny day afternoon
|
|
42
|
+
* @param adaptingLuminance The luminance of the adapting field. Informally,
|
|
43
|
+
* how bright it is in the room where the color is viewed. Can be
|
|
44
|
+
* calculated from lux by multiplying lux by 0.0586. default = 11.72,
|
|
45
|
+
* or 200 lux.
|
|
46
|
+
* @param backgroundLstar The lightness of the area surrounding the color.
|
|
47
|
+
* measured by L* in L*a*b*. default = 50.0
|
|
48
|
+
* @param surround A general description of the lighting surrounding the
|
|
49
|
+
* color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a
|
|
50
|
+
* dimly light room, like watching TV at home at night. 2.0 means there
|
|
51
|
+
* is no difference between the lighting on the color and around it.
|
|
52
|
+
* default = 2.0
|
|
53
|
+
* @param discountingIlluminant Whether the eye accounts for the tint of the
|
|
54
|
+
* ambient lighting, such as knowing an apple is still red in green light.
|
|
55
|
+
* default = false, the eye does not perform this process on
|
|
56
|
+
* self-luminous objects like displays.
|
|
57
|
+
*/
|
|
58
|
+
static make() {
|
|
59
|
+
let whitePoint = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : whitePointD65();
|
|
60
|
+
let adaptingLuminance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200.0 / Math.PI * yFromLstar(50.0) / 100.0;
|
|
61
|
+
let backgroundLstar = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50.0;
|
|
62
|
+
let surround = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 2.0;
|
|
63
|
+
let discountingIlluminant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
64
|
+
const xyz = whitePoint;
|
|
65
|
+
const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;
|
|
66
|
+
const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;
|
|
67
|
+
const bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;
|
|
68
|
+
const f = 0.8 + surround / 10.0;
|
|
69
|
+
const c = f >= 0.9 ? math.lerp(0.59, 0.69, (f - 0.9) * 10.0) : math.lerp(0.525, 0.59, (f - 0.8) * 10.0);
|
|
70
|
+
let d = discountingIlluminant ? 1.0 : f * (1.0 - 1.0 / 3.6 * Math.exp((-adaptingLuminance - 42.0) / 92.0));
|
|
71
|
+
d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;
|
|
72
|
+
const nc = f;
|
|
73
|
+
const rgbD = [d * (100.0 / rW) + 1.0 - d, d * (100.0 / gW) + 1.0 - d, d * (100.0 / bW) + 1.0 - d];
|
|
74
|
+
const k = 1.0 / (5.0 * adaptingLuminance + 1.0);
|
|
75
|
+
const k4 = k * k * k * k;
|
|
76
|
+
const k4F = 1.0 - k4;
|
|
77
|
+
const fl = k4 * adaptingLuminance + 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);
|
|
78
|
+
const n = yFromLstar(backgroundLstar) / whitePoint[1];
|
|
79
|
+
const z = 1.48 + Math.sqrt(n);
|
|
80
|
+
const nbb = 0.725 / Math.pow(n, 0.2);
|
|
81
|
+
const ncb = nbb;
|
|
82
|
+
const rgbAFactors = [Math.pow(fl * rgbD[0] * rW / 100.0, 0.42), Math.pow(fl * rgbD[1] * gW / 100.0, 0.42), Math.pow(fl * rgbD[2] * bW / 100.0, 0.42)];
|
|
83
|
+
const rgbA = [400.0 * rgbAFactors[0] / (rgbAFactors[0] + 27.13), 400.0 * rgbAFactors[1] / (rgbAFactors[1] + 27.13), 400.0 * rgbAFactors[2] / (rgbAFactors[2] + 27.13)];
|
|
84
|
+
const aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;
|
|
85
|
+
return new ViewingConditions(n, aw, nbb, ncb, c, nc, rgbD, fl, Math.pow(fl, 0.25), z);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Parameters are intermediate values of the CAM16 conversion process. Their
|
|
90
|
+
* names are shorthand for technical color science terminology, this class
|
|
91
|
+
* would not benefit from documenting them individually. A brief overview
|
|
92
|
+
* is available in the CAM16 specification, and a complete overview requires
|
|
93
|
+
* a color science textbook, such as Fairchild's Color Appearance Models.
|
|
94
|
+
*/
|
|
95
|
+
constructor(n, aw, nbb, ncb, c, nc, rgbD, fl, fLRoot, z) {
|
|
96
|
+
this.n = n;
|
|
97
|
+
this.aw = aw;
|
|
98
|
+
this.nbb = nbb;
|
|
99
|
+
this.ncb = ncb;
|
|
100
|
+
this.c = c;
|
|
101
|
+
this.nc = nc;
|
|
102
|
+
this.rgbD = rgbD;
|
|
103
|
+
this.fl = fl;
|
|
104
|
+
this.fLRoot = fLRoot;
|
|
105
|
+
this.z = z;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/** sRGB-like viewing conditions. */
|
|
109
|
+
_defineProperty(ViewingConditions, "DEFAULT", ViewingConditions.make());
|
|
110
|
+
//# sourceMappingURL=viewing-conditions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewing-conditions.js","names":["whitePointD65","yFromLstar","math","ViewingConditions","make","whitePoint","arguments","length","undefined","adaptingLuminance","Math","PI","backgroundLstar","surround","discountingIlluminant","xyz","rW","gW","bW","f","c","lerp","d","exp","nc","rgbD","k","k4","k4F","fl","cbrt","n","z","sqrt","nbb","pow","ncb","rgbAFactors","rgbA","aw","constructor","fLRoot","_defineProperty"],"sources":["../../../../src/util/color/hct/viewing-conditions.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { whitePointD65, yFromLstar } from '../conversion';\nimport * as math from '../utils/math-utils';\n\n/**\n * In traditional color spaces, a color can be identified solely by the\n * observer's measurement of the color. Color appearance models such as CAM16\n * also use information about the environment where the color was\n * observed, known as the viewing conditions.\n *\n * For example, white under the traditional assumption of a midday sun white\n * point is accurately measured as a slightly chromatic blue by CAM16. (roughly,\n * hue 203, chroma 3, lightness 100)\n *\n * This class caches intermediate values of the CAM16 conversion process that\n * depend only on viewing conditions, enabling speed ups.\n */\nexport class ViewingConditions {\n /** sRGB-like viewing conditions. */\n static DEFAULT = ViewingConditions.make();\n\n /**\n * Create ViewingConditions from a simple, physically relevant, set of\n * parameters.\n *\n * @param whitePoint White point, measured in the XYZ color space.\n * default = D65, or sunny day afternoon\n * @param adaptingLuminance The luminance of the adapting field. Informally,\n * how bright it is in the room where the color is viewed. Can be\n * calculated from lux by multiplying lux by 0.0586. default = 11.72,\n * or 200 lux.\n * @param backgroundLstar The lightness of the area surrounding the color.\n * measured by L* in L*a*b*. default = 50.0\n * @param surround A general description of the lighting surrounding the\n * color. 0 is pitch dark, like watching a movie in a theater. 1.0 is a\n * dimly light room, like watching TV at home at night. 2.0 means there\n * is no difference between the lighting on the color and around it.\n * default = 2.0\n * @param discountingIlluminant Whether the eye accounts for the tint of the\n * ambient lighting, such as knowing an apple is still red in green light.\n * default = false, the eye does not perform this process on\n * self-luminous objects like displays.\n */\n static make(\n whitePoint = whitePointD65(),\n adaptingLuminance = ((200.0 / Math.PI) * yFromLstar(50.0)) / 100.0,\n backgroundLstar = 50.0,\n surround = 2.0,\n discountingIlluminant = false,\n ): ViewingConditions {\n const xyz = whitePoint;\n const rW = xyz[0] * 0.401288 + xyz[1] * 0.650173 + xyz[2] * -0.051461;\n const gW = xyz[0] * -0.250268 + xyz[1] * 1.204414 + xyz[2] * 0.045854;\n const bW = xyz[0] * -0.002079 + xyz[1] * 0.048952 + xyz[2] * 0.953127;\n const f = 0.8 + surround / 10.0;\n const c =\n f >= 0.9\n ? math.lerp(0.59, 0.69, (f - 0.9) * 10.0)\n : math.lerp(0.525, 0.59, (f - 0.8) * 10.0);\n let d = discountingIlluminant\n ? 1.0\n : f * (1.0 - (1.0 / 3.6) * Math.exp((-adaptingLuminance - 42.0) / 92.0));\n d = d > 1.0 ? 1.0 : d < 0.0 ? 0.0 : d;\n const nc = f;\n const rgbD = [\n d * (100.0 / rW) + 1.0 - d,\n d * (100.0 / gW) + 1.0 - d,\n d * (100.0 / bW) + 1.0 - d,\n ];\n const k = 1.0 / (5.0 * adaptingLuminance + 1.0);\n const k4 = k * k * k * k;\n const k4F = 1.0 - k4;\n const fl =\n k4 * adaptingLuminance +\n 0.1 * k4F * k4F * Math.cbrt(5.0 * adaptingLuminance);\n const n = yFromLstar(backgroundLstar) / whitePoint[1];\n const z = 1.48 + Math.sqrt(n);\n const nbb = 0.725 / Math.pow(n, 0.2);\n const ncb = nbb;\n const rgbAFactors = [\n Math.pow((fl * rgbD[0] * rW) / 100.0, 0.42),\n Math.pow((fl * rgbD[1] * gW) / 100.0, 0.42),\n Math.pow((fl * rgbD[2] * bW) / 100.0, 0.42),\n ];\n const rgbA = [\n (400.0 * rgbAFactors[0]) / (rgbAFactors[0] + 27.13),\n (400.0 * rgbAFactors[1]) / (rgbAFactors[1] + 27.13),\n (400.0 * rgbAFactors[2]) / (rgbAFactors[2] + 27.13),\n ];\n const aw = (2.0 * rgbA[0] + rgbA[1] + 0.05 * rgbA[2]) * nbb;\n return new ViewingConditions(\n n,\n aw,\n nbb,\n ncb,\n c,\n nc,\n rgbD,\n fl,\n Math.pow(fl, 0.25),\n z,\n );\n }\n\n /**\n * Parameters are intermediate values of the CAM16 conversion process. Their\n * names are shorthand for technical color science terminology, this class\n * would not benefit from documenting them individually. A brief overview\n * is available in the CAM16 specification, and a complete overview requires\n * a color science textbook, such as Fairchild's Color Appearance Models.\n */\n private constructor(\n public n: number,\n public aw: number,\n public nbb: number,\n public ncb: number,\n public c: number,\n public nc: number,\n public rgbD: number[],\n public fl: number,\n public fLRoot: number,\n public z: number,\n ) {}\n}\n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D,IAAI,CAAC,CAAC,CAAC,GAAGA,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAGA,IAAI,CAAC,CAAC,CAAC,IAAIJ,GAAG;IAC3D,OAAO,IAAI/B,iBAAiB,CAC1B4B,CAAC,EACDQ,EAAE,EACFL,GAAG,EACHE,GAAG,EACHhB,CAAC,EACDI,EAAE,EACFC,IAAI,EACJI,EAAE,EACFnB,IAAI,CAACyB,GAAG,CAACN,EAAE,EAAE,IAAI,CAAC,EAClBG,CACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;EACUQ,WAAWA,CACVT,CAAS,EACTQ,EAAU,EACVL,GAAW,EACXE,GAAW,EACXhB,CAAS,EACTI,EAAU,EACVC,IAAc,EACdI,EAAU,EACVY,MAAc,EACdT,CAAS,EAChB;IAAA,KAVOD,CAAS,GAATA,CAAS;IAAA,KACTQ,EAAU,GAAVA,EAAU;IAAA,KACVL,GAAW,GAAXA,GAAW;IAAA,KACXE,GAAW,GAAXA,GAAW;IAAA,KACXhB,CAAS,GAATA,CAAS;IAAA,KACTI,EAAU,GAAVA,EAAU;IAAA,KACVC,IAAc,GAAdA,IAAc;IAAA,KACdI,EAAU,GAAVA,EAAU;IAAA,KACVY,MAAc,GAAdA,MAAc;IAAA,KACdT,CAAS,GAATA,CAAS;EACf;AACL;AAzGE;AAAAU,eAAA,CADWvC,iBAAiB,aAEXA,iBAAiB,CAACC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* yuyeon
|
|
3
|
+
* Apache-2.0 license (Copyright 2023 yeonyew)
|
|
4
|
+
*
|
|
5
|
+
* Used Libs
|
|
6
|
+
* - material-color-utilities
|
|
7
|
+
* Apache-2.0 license (Copyright 2021 Google LLC)
|
|
8
|
+
* https://github.com/material-foundation/material-color-utilities
|
|
9
|
+
*
|
|
10
|
+
* - Vuetify
|
|
11
|
+
* MIT license (Copyright (c) 2016-2023 John Jeremy Leider)
|
|
12
|
+
* https://github.com/vuetifyjs/vuetify
|
|
13
|
+
* */
|
|
14
|
+
import { HEX_COLOR_REGEX, RGBA_REGEX } from "./const.js";
|
|
15
|
+
import { rgbFromHex } from "./../index.js";
|
|
16
|
+
export function isColorValue(value) {
|
|
17
|
+
return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);
|
|
18
|
+
}
|
|
19
|
+
export function colorRgb(color) {
|
|
20
|
+
if (color?.startsWith('#')) {
|
|
21
|
+
return rgbFromHex(color)?.join(',') || '';
|
|
22
|
+
}
|
|
23
|
+
const RGBA_REGEX = /rgb(a?)\((?<v>.*)\)/;
|
|
24
|
+
if (RGBA_REGEX.test(color)) {
|
|
25
|
+
const value = RGBA_REGEX.exec(color)?.[2] || '';
|
|
26
|
+
if (value) {
|
|
27
|
+
const valueArray = value.trim().split(',');
|
|
28
|
+
valueArray.splice(3, 1);
|
|
29
|
+
return valueArray.join(',');
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
export function isTextColorIsLight(r, g, b) {
|
|
35
|
+
const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
36
|
+
return luminance < 0.5;
|
|
37
|
+
}
|
|
38
|
+
export * from "./const.js";
|
|
39
|
+
export * from "./conversion.js";
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["HEX_COLOR_REGEX","RGBA_REGEX","rgbFromHex","isColorValue","value","test","colorRgb","color","startsWith","join","exec","valueArray","trim","split","splice","isTextColorIsLight","r","g","b","luminance"],"sources":["../../../src/util/color/index.ts"],"sourcesContent":["/*\r\n* yuyeon\r\n* Apache-2.0 license (Copyright 2023 yeonyew)\r\n*\r\n* Used Libs\r\n* - material-color-utilities\r\n* Apache-2.0 license (Copyright 2021 Google LLC)\r\n* https://github.com/material-foundation/material-color-utilities\r\n*\r\n* - Vuetify\r\n* MIT license (Copyright (c) 2016-2023 John Jeremy Leider)\r\n* https://github.com/vuetifyjs/vuetify\r\n* */\r\n\r\nimport { HEX_COLOR_REGEX, RGBA_REGEX } from \"./const\";\r\nimport { rgbFromHex } from '@/util';\r\n\r\nexport function isColorValue(value: string): boolean {\r\n return RGBA_REGEX.test(value) || HEX_COLOR_REGEX.test(value);\r\n}\r\n\r\nexport function colorRgb(color: string): string {\r\n if (color?.startsWith('#')) {\r\n return rgbFromHex(color)?.join(',') || '';\r\n }\r\n const RGBA_REGEX = /rgb(a?)\\((?<v>.*)\\)/;\r\n if (RGBA_REGEX.test(color)) {\r\n const value = RGBA_REGEX.exec(color)?.[2] || '';\r\n if (value) {\r\n const valueArray = value.trim().split(',');\r\n valueArray.splice(3, 1);\r\n return valueArray.join(',');\r\n }\r\n }\r\n return '';\r\n}\r\n\r\nexport function isTextColorIsLight(r: number, g: number, b: number): boolean {\r\n const luminance = 1 - (0.299 * r + 0.587 * g + 0.114 * b) / 255;\r\n return luminance < 0.5;\r\n}\r\n\r\nexport * from './const';\r\nexport * from \"./conversion\";\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA,SAcSA,eAAe,EAAEC,UAAU;AAAA,SAC3BC,UAAU;AAEnB,OAAO,SAASC,YAAYA,CAACC,KAAa,EAAW;EACnD,OAAOH,UAAU,CAACI,IAAI,CAACD,KAAK,CAAC,IAAIJ,eAAe,CAACK,IAAI,CAACD,KAAK,CAAC;AAC9D;AAEA,OAAO,SAASE,QAAQA,CAACC,KAAa,EAAU;EAC9C,IAAIA,KAAK,EAAEC,UAAU,CAAC,GAAG,CAAC,EAAE;IAC1B,OAAON,UAAU,CAACK,KAAK,CAAC,EAAEE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE;EAC3C;EACA,MAAMR,UAAU,GAAG,qBAAqB;EACxC,IAAIA,UAAU,CAACI,IAAI,CAACE,KAAK,CAAC,EAAE;IAC1B,MAAMH,KAAK,GAAGH,UAAU,CAACS,IAAI,CAACH,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;IAC/C,IAAIH,KAAK,EAAE;MACT,MAAMO,UAAU,GAAGP,KAAK,CAACQ,IAAI,CAAC,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC;MAC1CF,UAAU,CAACG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;MACvB,OAAOH,UAAU,CAACF,IAAI,CAAC,GAAG,CAAC;IAC7B;EACF;EACA,OAAO,EAAE;AACX;AAEA,OAAO,SAASM,kBAAkBA,CAACC,CAAS,EAAEC,CAAS,EAAEC,CAAS,EAAW;EAC3E,MAAMC,SAAS,GAAG,CAAC,GAAG,CAAC,KAAK,GAAGH,CAAC,GAAG,KAAK,GAAGC,CAAC,GAAG,KAAK,GAAGC,CAAC,IAAI,GAAG;EAC/D,OAAOC,SAAS,GAAG,GAAG;AACxB;AAAC;AAAA"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { Hct } from "../hct/hct.js";
|
|
18
|
+
import { TonalPalette } from "./tonal-palette.js";
|
|
19
|
+
/**
|
|
20
|
+
* Set of colors to generate a [CorePalette] from
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* An intermediate concept between the key color for a UI theme, and a full
|
|
24
|
+
* color scheme. 5 sets of tones are generated, all except one use the same hue
|
|
25
|
+
* as the key color, and all vary in chroma.
|
|
26
|
+
*/
|
|
27
|
+
export class CorePalette {
|
|
28
|
+
/**
|
|
29
|
+
* @param argb ARGB representation of a color
|
|
30
|
+
*/
|
|
31
|
+
static of(argb) {
|
|
32
|
+
return new CorePalette(argb, false);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param argb ARGB representation of a color
|
|
37
|
+
*/
|
|
38
|
+
static contentOf(argb) {
|
|
39
|
+
return new CorePalette(argb, true);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Create a [CorePalette] from a set of colors
|
|
44
|
+
*/
|
|
45
|
+
static fromColors(colors) {
|
|
46
|
+
return CorePalette.createPaletteFromColors(false, colors);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Create a content [CorePalette] from a set of colors
|
|
51
|
+
*/
|
|
52
|
+
static contentFromColors(colors) {
|
|
53
|
+
return CorePalette.createPaletteFromColors(true, colors);
|
|
54
|
+
}
|
|
55
|
+
static createPaletteFromColors(content, colors) {
|
|
56
|
+
const palette = new CorePalette(colors.primary, content);
|
|
57
|
+
if (colors.secondary) {
|
|
58
|
+
const p = new CorePalette(colors.secondary, content);
|
|
59
|
+
palette.a2 = p.a1;
|
|
60
|
+
}
|
|
61
|
+
if (colors.tertiary) {
|
|
62
|
+
const p = new CorePalette(colors.tertiary, content);
|
|
63
|
+
palette.a3 = p.a1;
|
|
64
|
+
}
|
|
65
|
+
if (colors.error) {
|
|
66
|
+
const p = new CorePalette(colors.error, content);
|
|
67
|
+
palette.error = p.a1;
|
|
68
|
+
}
|
|
69
|
+
if (colors.neutral) {
|
|
70
|
+
const p = new CorePalette(colors.neutral, content);
|
|
71
|
+
palette.n1 = p.n1;
|
|
72
|
+
}
|
|
73
|
+
if (colors.neutralVariant) {
|
|
74
|
+
const p = new CorePalette(colors.neutralVariant, content);
|
|
75
|
+
palette.n2 = p.n2;
|
|
76
|
+
}
|
|
77
|
+
return palette;
|
|
78
|
+
}
|
|
79
|
+
constructor(argb, isContent) {
|
|
80
|
+
const hct = Hct.fromInt(argb);
|
|
81
|
+
const hue = hct.hue;
|
|
82
|
+
const chroma = hct.chroma;
|
|
83
|
+
if (isContent) {
|
|
84
|
+
this.a1 = TonalPalette.fromHueAndChroma(hue, chroma);
|
|
85
|
+
this.a2 = TonalPalette.fromHueAndChroma(hue, chroma / 3);
|
|
86
|
+
this.a3 = TonalPalette.fromHueAndChroma(hue + 60, chroma / 2);
|
|
87
|
+
this.n1 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 12, 4));
|
|
88
|
+
this.n2 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 6, 8));
|
|
89
|
+
} else {
|
|
90
|
+
this.a1 = TonalPalette.fromHueAndChroma(hue, Math.max(48, chroma));
|
|
91
|
+
this.a2 = TonalPalette.fromHueAndChroma(hue, 16);
|
|
92
|
+
this.a3 = TonalPalette.fromHueAndChroma(hue + 60, 24);
|
|
93
|
+
this.n1 = TonalPalette.fromHueAndChroma(hue, 4);
|
|
94
|
+
this.n2 = TonalPalette.fromHueAndChroma(hue, 8);
|
|
95
|
+
}
|
|
96
|
+
this.error = TonalPalette.fromHueAndChroma(25, 84);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=core-palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core-palette.js","names":["Hct","TonalPalette","CorePalette","of","argb","contentOf","fromColors","colors","createPaletteFromColors","contentFromColors","content","palette","primary","secondary","p","a2","a1","tertiary","a3","error","neutral","n1","neutralVariant","n2","constructor","isContent","hct","fromInt","hue","chroma","fromHueAndChroma","Math","min","max"],"sources":["../../../../src/util/color/palettes/core-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\nimport { TonalPalette } from './tonal-palette';\n\n/**\n * Set of colors to generate a [CorePalette] from\n */\nexport interface CorePaletteColors {\n primary: number;\n secondary?: number;\n tertiary?: number;\n neutral?: number;\n neutralVariant?: number;\n error?: number;\n}\n\n/**\n * An intermediate concept between the key color for a UI theme, and a full\n * color scheme. 5 sets of tones are generated, all except one use the same hue\n * as the key color, and all vary in chroma.\n */\nexport class CorePalette {\n a1: TonalPalette;\n a2: TonalPalette;\n a3: TonalPalette;\n n1: TonalPalette;\n n2: TonalPalette;\n error: TonalPalette;\n\n /**\n * @param argb ARGB representation of a color\n */\n static of(argb: number): CorePalette {\n return new CorePalette(argb, false);\n }\n\n /**\n * @param argb ARGB representation of a color\n */\n static contentOf(argb: number): CorePalette {\n return new CorePalette(argb, true);\n }\n\n /**\n * Create a [CorePalette] from a set of colors\n */\n static fromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(false, colors);\n }\n\n /**\n * Create a content [CorePalette] from a set of colors\n */\n static contentFromColors(colors: CorePaletteColors): CorePalette {\n return CorePalette.createPaletteFromColors(true, colors);\n }\n\n private static createPaletteFromColors(\n content: boolean,\n colors: CorePaletteColors,\n ) {\n const palette = new CorePalette(colors.primary, content);\n if (colors.secondary) {\n const p = new CorePalette(colors.secondary, content);\n palette.a2 = p.a1;\n }\n if (colors.tertiary) {\n const p = new CorePalette(colors.tertiary, content);\n palette.a3 = p.a1;\n }\n if (colors.error) {\n const p = new CorePalette(colors.error, content);\n palette.error = p.a1;\n }\n if (colors.neutral) {\n const p = new CorePalette(colors.neutral, content);\n palette.n1 = p.n1;\n }\n if (colors.neutralVariant) {\n const p = new CorePalette(colors.neutralVariant, content);\n palette.n2 = p.n2;\n }\n return palette;\n }\n\n private constructor(argb: number, isContent: boolean) {\n const hct = Hct.fromInt(argb);\n const hue = hct.hue;\n const chroma = hct.chroma;\n if (isContent) {\n this.a1 = TonalPalette.fromHueAndChroma(hue, chroma);\n this.a2 = TonalPalette.fromHueAndChroma(hue, chroma / 3);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, chroma / 2);\n this.n1 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 12, 4));\n this.n2 = TonalPalette.fromHueAndChroma(hue, Math.min(chroma / 6, 8));\n } else {\n this.a1 = TonalPalette.fromHueAndChroma(hue, Math.max(48, chroma));\n this.a2 = TonalPalette.fromHueAndChroma(hue, 16);\n this.a3 = TonalPalette.fromHueAndChroma(hue + 60, 24);\n this.n1 = TonalPalette.fromHueAndChroma(hue, 4);\n this.n2 = TonalPalette.fromHueAndChroma(hue, 8);\n }\n this.error = TonalPalette.fromHueAndChroma(25, 84);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAAA,SACHC,YAAY;AAErB;AACA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,CAAC;EAQvB;AACF;AACA;EACE,OAAOC,EAAEA,CAACC,IAAY,EAAe;IACnC,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAE,KAAK,CAAC;EACrC;;EAEA;AACF;AACA;EACE,OAAOC,SAASA,CAACD,IAAY,EAAe;IAC1C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAE,IAAI,CAAC;EACpC;;EAEA;AACF;AACA;EACE,OAAOE,UAAUA,CAACC,MAAyB,EAAe;IACxD,OAAOL,WAAW,CAACM,uBAAuB,CAA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B,YAAY,CAAC6B,gBAAgB,CAACF,GAAG,EAAE,CAAC,CAAC;IACjD;IACA,IAAI,CAACT,KAAK,GAAGlB,YAAY,CAAC6B,gBAAgB,CAAC,EAAE,EAAE,EAAE,CAAC;EACpD;AACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2021 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
import { Hct } from "../hct/hct.js";
|
|
21
|
+
/**
|
|
22
|
+
* A convenience class for retrieving colors that are constant in hue and
|
|
23
|
+
* chroma, but vary in tone.
|
|
24
|
+
*/
|
|
25
|
+
export class TonalPalette {
|
|
26
|
+
/**
|
|
27
|
+
* @param argb ARGB representation of a color
|
|
28
|
+
* @return Tones matching that color's hue and chroma.
|
|
29
|
+
*/
|
|
30
|
+
static fromInt(argb) {
|
|
31
|
+
const hct = Hct.fromInt(argb);
|
|
32
|
+
return TonalPalette.fromHct(hct);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param hct Hct
|
|
37
|
+
* @return Tones matching that color's hue and chroma.
|
|
38
|
+
*/
|
|
39
|
+
static fromHct(hct) {
|
|
40
|
+
return new TonalPalette(hct.hue, hct.chroma, hct);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param hue HCT hue
|
|
45
|
+
* @param chroma HCT chroma
|
|
46
|
+
* @return Tones matching hue and chroma.
|
|
47
|
+
*/
|
|
48
|
+
static fromHueAndChroma(hue, chroma) {
|
|
49
|
+
return new TonalPalette(hue, chroma, TonalPalette.createKeyColor(hue, chroma));
|
|
50
|
+
}
|
|
51
|
+
constructor(hue, chroma, keyColor) {
|
|
52
|
+
_defineProperty(this, "cache", new Map());
|
|
53
|
+
this.hue = hue;
|
|
54
|
+
this.chroma = chroma;
|
|
55
|
+
this.keyColor = keyColor;
|
|
56
|
+
}
|
|
57
|
+
static createKeyColor(hue, chroma) {
|
|
58
|
+
const startTone = 50.0;
|
|
59
|
+
let smallestDeltaHct = Hct.from(hue, chroma, startTone);
|
|
60
|
+
let smallestDelta = Math.abs(smallestDeltaHct.chroma - chroma);
|
|
61
|
+
// Starting from T50, check T+/-delta to see if they match the requested
|
|
62
|
+
// chroma.
|
|
63
|
+
//
|
|
64
|
+
// Starts from T50 because T50 has the most chroma available, on
|
|
65
|
+
// average. Thus it is most likely to have a direct answer and minimize
|
|
66
|
+
// iteration.
|
|
67
|
+
for (let delta = 1.0; delta < 50.0; delta += 1.0) {
|
|
68
|
+
// Termination condition rounding instead of minimizing delta to avoid
|
|
69
|
+
// case where requested chroma is 16.51, and the closest chroma is 16.49.
|
|
70
|
+
// Error is minimized, but when rounded and displayed, requested chroma
|
|
71
|
+
// is 17, key color's chroma is 16.
|
|
72
|
+
if (Math.round(chroma) === Math.round(smallestDeltaHct.chroma)) {
|
|
73
|
+
return smallestDeltaHct;
|
|
74
|
+
}
|
|
75
|
+
const hctAdd = Hct.from(hue, chroma, startTone + delta);
|
|
76
|
+
const hctAddDelta = Math.abs(hctAdd.chroma - chroma);
|
|
77
|
+
if (hctAddDelta < smallestDelta) {
|
|
78
|
+
smallestDelta = hctAddDelta;
|
|
79
|
+
smallestDeltaHct = hctAdd;
|
|
80
|
+
}
|
|
81
|
+
const hctSubtract = Hct.from(hue, chroma, startTone - delta);
|
|
82
|
+
const hctSubtractDelta = Math.abs(hctSubtract.chroma - chroma);
|
|
83
|
+
if (hctSubtractDelta < smallestDelta) {
|
|
84
|
+
smallestDelta = hctSubtractDelta;
|
|
85
|
+
smallestDeltaHct = hctSubtract;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return smallestDeltaHct;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param tone HCT tone, measured from 0 to 100.
|
|
93
|
+
* @return ARGB representation of a color with that tone.
|
|
94
|
+
*/
|
|
95
|
+
tone(tone) {
|
|
96
|
+
let argb = this.cache.get(tone);
|
|
97
|
+
if (argb === undefined) {
|
|
98
|
+
argb = Hct.from(this.hue, this.chroma, tone).toInt();
|
|
99
|
+
this.cache.set(tone, argb);
|
|
100
|
+
}
|
|
101
|
+
return argb;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @param tone HCT tone.
|
|
106
|
+
* @return HCT representation of a color with that tone.
|
|
107
|
+
*/
|
|
108
|
+
getHct(tone) {
|
|
109
|
+
return Hct.fromInt(this.tone(tone));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=tonal-palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tonal-palette.js","names":["Hct","TonalPalette","fromInt","argb","hct","fromHct","hue","chroma","fromHueAndChroma","createKeyColor","constructor","keyColor","_defineProperty","Map","startTone","smallestDeltaHct","from","smallestDelta","Math","abs","delta","round","hctAdd","hctAddDelta","hctSubtract","hctSubtractDelta","tone","cache","get","undefined","toInt","set","getHct"],"sources":["../../../../src/util/color/palettes/tonal-palette.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2021 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Hct } from '../hct/hct';\n\n/**\n * A convenience class for retrieving colors that are constant in hue and\n * chroma, but vary in tone.\n */\nexport class TonalPalette {\n private readonly cache = new Map<number, number>();\n\n /**\n * @param argb ARGB representation of a color\n * @return Tones matching that color's hue and chroma.\n */\n static fromInt(argb: number): TonalPalette {\n const hct = Hct.fromInt(argb);\n return TonalPalette.fromHct(hct);\n }\n\n /**\n * @param hct Hct\n * @return Tones matching that color's hue and chroma.\n */\n static fromHct(hct: Hct) {\n return new TonalPalette(hct.hue, hct.chroma, hct);\n }\n\n /**\n * @param hue HCT hue\n * @param chroma HCT chroma\n * @return Tones matching hue and chroma.\n */\n static fromHueAndChroma(hue: number, chroma: number): TonalPalette {\n return new TonalPalette(\n hue,\n chroma,\n TonalPalette.createKeyColor(hue, chroma),\n );\n }\n\n private constructor(\n readonly hue: number,\n readonly chroma: number,\n readonly keyColor: Hct,\n ) {}\n\n private static createKeyColor(hue: number, chroma: number): Hct {\n const startTone = 50.0;\n let smallestDeltaHct = Hct.from(hue, chroma, startTone);\n let smallestDelta = Math.abs(smallestDeltaHct.chroma - chroma);\n // Starting from T50, check T+/-delta to see if they match the requested\n // chroma.\n //\n // Starts from T50 because T50 has the most chroma available, on\n // average. Thus it is most likely to have a direct answer and minimize\n // iteration.\n for (let delta = 1.0; delta < 50.0; delta += 1.0) {\n // Termination condition rounding instead of minimizing delta to avoid\n // case where requested chroma is 16.51, and the closest chroma is 16.49.\n // Error is minimized, but when rounded and displayed, requested chroma\n // is 17, key color's chroma is 16.\n if (Math.round(chroma) === Math.round(smallestDeltaHct.chroma)) {\n return smallestDeltaHct;\n }\n\n const hctAdd = Hct.from(hue, chroma, startTone + delta);\n const hctAddDelta = Math.abs(hctAdd.chroma - chroma);\n if (hctAddDelta < smallestDelta) {\n smallestDelta = hctAddDelta;\n smallestDeltaHct = hctAdd;\n }\n\n const hctSubtract = Hct.from(hue, chroma, startTone - delta);\n const hctSubtractDelta = Math.abs(hctSubtract.chroma - chroma);\n if (hctSubtractDelta < smallestDelta) {\n smallestDelta = hctSubtractDelta;\n smallestDeltaHct = hctSubtract;\n }\n }\n\n return smallestDeltaHct;\n }\n\n /**\n * @param tone HCT tone, measured from 0 to 100.\n * @return ARGB representation of a color with that tone.\n */\n tone(tone: number): number {\n let argb = this.cache.get(tone);\n if (argb === undefined) {\n argb = Hct.from(this.hue, this.chroma, tone).toInt();\n this.cache.set(tone, argb);\n }\n return argb;\n }\n\n /**\n * @param tone HCT tone.\n * @return HCT representation of a color with that tone.\n */\n getHct(tone: number): Hct {\n return Hct.fromInt(this.tone(tone));\n }\n}\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAfA,SAgBSA,GAAG;AAEZ;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,CAAC;EAGxB;AACF;AACA;AACA;EACE,OAAOC,OAAOA,CAACC,IAAY,EAAgB;IACzC,MAAMC,GAAG,GAAGJ,GAAG,CAACE,OAAO,CAACC,IAAI,CAAC;IAC7B,OAAOF,YAAY,CAACI,OAAO,CAACD,GAAG,CAAC;EAClC;;EAEA;AACF;AACA;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AGL,IAAI,CAACC,GAAG,CAACG,MAAM,CAACf,MAAM,GAAGA,MAAM,CAAC;MACpD,IAAIgB,WAAW,GAAGN,aAAa,EAAE;QAC/BA,aAAa,GAAGM,WAAW;QAC3BR,gBAAgB,GAAGO,MAAM;MAC3B;MAEA,MAAME,WAAW,GAAGxB,GAAG,CAACgB,IAAI,CAACV,GAAG,EAAEC,MAAM,EAAEO,SAAS,GAAGM,KAAK,CAAC;MAC5D,MAAMK,gBAAgB,GAAGP,IAAI,CAACC,GAAG,CAACK,WAAW,CAACjB,MAAM,GAAGA,MAAM,CAAC;MAC9D,IAAIkB,gBAAgB,GAAGR,aAAa,EAAE;QACpCA,aAAa,GAAGQ,gBAAgB;QAChCV,gBAAgB,GAAGS,WAAW;MAChC;IACF;IAEA,OAAOT,gBAAgB;EACzB;;EAEA;AACF;AACA;AACA;EACEW,IAAIA,CAACA,IAAY,EAAU;IACzB,IAAIvB,IAAI,GAAG,IAAI,CAACwB,KAAK,CAACC,GAAG,CAACF,IAAI,CAAC;IAC/B,IAAIvB,IAAI,KAAK0B,SAAS,EAAE;MACtB1B,IAAI,GAAGH,GAAG,CAACgB,IAAI,CAAC,IAAI,CAACV,GAAG,EAAE,IAAI,CAACC,MAAM,EAAEmB,IAAI,CAAC,CAACI,KAAK,CAAC,CAAC;MACpD,IAAI,CAACH,KAAK,CAACI,GAAG,CAACL,IAAI,EAAEvB,IAAI,CAAC;IAC5B;IACA,OAAOA,IAAI;EACb;;EAEA;AACF;AACA;AACA;EACE6B,MAAMA,CAACN,IAAY,EAAO;IACxB,OAAO1B,GAAG,CAACE,OAAO,CAAC,IAAI,CAACwB,IAAI,CAACA,IAAI,CAAC,CAAC;EACrC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/util/color/types.ts"],"sourcesContent":["/**\r\n * RGBA component\r\n *\r\n * @param r Red value should be between 0-255\r\n * @param g Green value should be between 0-255\r\n * @param b Blue value should be between 0-255\r\n * @param a Alpha value should be between 0-255\r\n */\r\nexport interface Rgba {\r\n r: number;\r\n g: number;\r\n b: number;\r\n a: number;\r\n}\r\n"],"mappings":""}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Utility methods for mathematical operations.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The signum function.
|
|
24
|
+
*
|
|
25
|
+
* @return 1 if num > 0, -1 if num < 0, and 0 if num = 0
|
|
26
|
+
*/
|
|
27
|
+
export function signum(num) {
|
|
28
|
+
if (num < 0) {
|
|
29
|
+
return -1;
|
|
30
|
+
} else if (num === 0) {
|
|
31
|
+
return 0;
|
|
32
|
+
} else {
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The linear interpolation function.
|
|
39
|
+
*
|
|
40
|
+
* @return start if amount = 0 and stop if amount = 1
|
|
41
|
+
*/
|
|
42
|
+
export function lerp(start, stop, amount) {
|
|
43
|
+
return (1.0 - amount) * start + amount * stop;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Clamps an integer between two integers.
|
|
48
|
+
*
|
|
49
|
+
* @return input when min <= input <= max, and either min or max
|
|
50
|
+
* otherwise.
|
|
51
|
+
*/
|
|
52
|
+
export function clampInt(min, max, input) {
|
|
53
|
+
if (input < min) {
|
|
54
|
+
return min;
|
|
55
|
+
} else if (input > max) {
|
|
56
|
+
return max;
|
|
57
|
+
}
|
|
58
|
+
return input;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Clamps an integer between two floating-point numbers.
|
|
63
|
+
*
|
|
64
|
+
* @return input when min <= input <= max, and either min or max
|
|
65
|
+
* otherwise.
|
|
66
|
+
*/
|
|
67
|
+
export function clampDouble(min, max, input) {
|
|
68
|
+
if (input < min) {
|
|
69
|
+
return min;
|
|
70
|
+
} else if (input > max) {
|
|
71
|
+
return max;
|
|
72
|
+
}
|
|
73
|
+
return input;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Sanitizes a degree measure as an integer.
|
|
78
|
+
*
|
|
79
|
+
* @return a degree measure between 0 (inclusive) and 360
|
|
80
|
+
* (exclusive).
|
|
81
|
+
*/
|
|
82
|
+
export function sanitizeDegreesInt(degrees) {
|
|
83
|
+
degrees = degrees % 360;
|
|
84
|
+
if (degrees < 0) {
|
|
85
|
+
degrees = degrees + 360;
|
|
86
|
+
}
|
|
87
|
+
return degrees;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Sanitizes a degree measure as a floating-point number.
|
|
92
|
+
*
|
|
93
|
+
* @return a degree measure between 0.0 (inclusive) and 360.0
|
|
94
|
+
* (exclusive).
|
|
95
|
+
*/
|
|
96
|
+
export function sanitizeDegreesDouble(degrees) {
|
|
97
|
+
degrees = degrees % 360.0;
|
|
98
|
+
if (degrees < 0) {
|
|
99
|
+
degrees = degrees + 360.0;
|
|
100
|
+
}
|
|
101
|
+
return degrees;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Sign of direction change needed to travel from one angle to
|
|
106
|
+
* another.
|
|
107
|
+
*
|
|
108
|
+
* For angles that are 180 degrees apart from each other, both
|
|
109
|
+
* directions have the same travel distance, so either direction is
|
|
110
|
+
* shortest. The value 1.0 is returned in this case.
|
|
111
|
+
*
|
|
112
|
+
* @param from The angle travel starts from, in degrees.
|
|
113
|
+
* @param to The angle travel ends at, in degrees.
|
|
114
|
+
* @return -1 if decreasing from leads to the shortest travel
|
|
115
|
+
* distance, 1 if increasing from leads to the shortest travel
|
|
116
|
+
* distance.
|
|
117
|
+
*/
|
|
118
|
+
export function rotationDirection(from, to) {
|
|
119
|
+
const increasingDifference = sanitizeDegreesDouble(to - from);
|
|
120
|
+
return increasingDifference <= 180.0 ? 1.0 : -1.0;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Distance of two points on a circle, represented using degrees.
|
|
125
|
+
*/
|
|
126
|
+
export function differenceDegrees(a, b) {
|
|
127
|
+
return 180.0 - Math.abs(Math.abs(a - b) - 180.0);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Multiplies a 1x3 row vector with a 3x3 matrix.
|
|
132
|
+
*/
|
|
133
|
+
export function matrixMultiply(row, matrix) {
|
|
134
|
+
const a = row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];
|
|
135
|
+
const b = row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];
|
|
136
|
+
const c = row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];
|
|
137
|
+
return [a, b, c];
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=math-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"math-utils.js","names":["signum","num","lerp","start","stop","amount","clampInt","min","max","input","clampDouble","sanitizeDegreesInt","degrees","sanitizeDegreesDouble","rotationDirection","from","to","increasingDifference","differenceDegrees","a","b","Math","abs","matrixMultiply","row","matrix","c"],"sources":["../../../../src/util/color/utils/math-utils.ts"],"sourcesContent":["/**\r\n * @license\r\n * Copyright 2021 Google LLC\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Utility methods for mathematical operations.\r\n */\r\n\r\n/**\r\n * The signum function.\r\n *\r\n * @return 1 if num > 0, -1 if num < 0, and 0 if num = 0\r\n */\r\nexport function signum(num: number): number {\r\n if (num < 0) {\r\n return -1;\r\n } else if (num === 0) {\r\n return 0;\r\n } else {\r\n return 1;\r\n }\r\n}\r\n\r\n/**\r\n * The linear interpolation function.\r\n *\r\n * @return start if amount = 0 and stop if amount = 1\r\n */\r\nexport function lerp(start: number, stop: number, amount: number): number {\r\n return (1.0 - amount) * start + amount * stop;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two integers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampInt(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Clamps an integer between two floating-point numbers.\r\n *\r\n * @return input when min <= input <= max, and either min or max\r\n * otherwise.\r\n */\r\nexport function clampDouble(min: number, max: number, input: number): number {\r\n if (input < min) {\r\n return min;\r\n } else if (input > max) {\r\n return max;\r\n }\r\n\r\n return input;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as an integer.\r\n *\r\n * @return a degree measure between 0 (inclusive) and 360\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesInt(degrees: number): number {\r\n degrees = degrees % 360;\r\n if (degrees < 0) {\r\n degrees = degrees + 360;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sanitizes a degree measure as a floating-point number.\r\n *\r\n * @return a degree measure between 0.0 (inclusive) and 360.0\r\n * (exclusive).\r\n */\r\nexport function sanitizeDegreesDouble(degrees: number): number {\r\n degrees = degrees % 360.0;\r\n if (degrees < 0) {\r\n degrees = degrees + 360.0;\r\n }\r\n return degrees;\r\n}\r\n\r\n/**\r\n * Sign of direction change needed to travel from one angle to\r\n * another.\r\n *\r\n * For angles that are 180 degrees apart from each other, both\r\n * directions have the same travel distance, so either direction is\r\n * shortest. The value 1.0 is returned in this case.\r\n *\r\n * @param from The angle travel starts from, in degrees.\r\n * @param to The angle travel ends at, in degrees.\r\n * @return -1 if decreasing from leads to the shortest travel\r\n * distance, 1 if increasing from leads to the shortest travel\r\n * distance.\r\n */\r\nexport function rotationDirection(from: number, to: number): number {\r\n const increasingDifference = sanitizeDegreesDouble(to - from);\r\n return increasingDifference <= 180.0 ? 1.0 : -1.0;\r\n}\r\n\r\n/**\r\n * Distance of two points on a circle, represented using degrees.\r\n */\r\nexport function differenceDegrees(a: number, b: number): number {\r\n return 180.0 - Math.abs(Math.abs(a - b) - 180.0);\r\n}\r\n\r\n/**\r\n * Multiplies a 1x3 row vector with a 3x3 matrix.\r\n */\r\nexport function matrixMultiply(row: number[], matrix: number[][]): number[] {\r\n const a =\r\n row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2];\r\n const b =\r\n row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2];\r\n const c =\r\n row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2];\r\n return [a, b, c];\r\n}\r\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA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