@itwin/itwinui-react 3.13.4 → 3.14.0
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/CHANGELOG.md +45 -0
- package/DEV-cjs/core/Alert/Alert.js +125 -72
- package/DEV-cjs/core/Avatar/Avatar.js +70 -44
- package/DEV-cjs/core/AvatarGroup/AvatarGroup.js +71 -34
- package/DEV-cjs/core/Backdrop/Backdrop.js +26 -22
- package/DEV-cjs/core/Badge/Badge.js +49 -42
- package/DEV-cjs/core/Breadcrumbs/Breadcrumbs.js +164 -85
- package/DEV-cjs/core/ButtonGroup/ButtonGroup.js +141 -79
- package/DEV-cjs/core/Buttons/Button.js +95 -49
- package/DEV-cjs/core/Buttons/DropdownButton.js +53 -35
- package/DEV-cjs/core/Buttons/IconButton.js +77 -41
- package/DEV-cjs/core/Buttons/IdeasButton.js +30 -26
- package/DEV-cjs/core/Buttons/SplitButton.js +90 -56
- package/DEV-cjs/core/Carousel/Carousel.js +77 -67
- package/DEV-cjs/core/Carousel/CarouselContext.js +10 -10
- package/DEV-cjs/core/Carousel/CarouselDot.js +31 -27
- package/DEV-cjs/core/Carousel/CarouselDotsList.js +148 -113
- package/DEV-cjs/core/Carousel/CarouselNavigation.js +98 -69
- package/DEV-cjs/core/Carousel/CarouselSlide.js +51 -42
- package/DEV-cjs/core/Carousel/CarouselSlider.js +68 -61
- package/DEV-cjs/core/Checkbox/Checkbox.js +96 -54
- package/DEV-cjs/core/ColorPicker/ColorBuilder.js +274 -228
- package/DEV-cjs/core/ColorPicker/ColorInputPanel.js +398 -366
- package/DEV-cjs/core/ColorPicker/ColorPalette.js +56 -36
- package/DEV-cjs/core/ColorPicker/ColorPicker.js +88 -69
- package/DEV-cjs/core/ColorPicker/ColorPickerContext.js +22 -18
- package/DEV-cjs/core/ColorPicker/ColorSwatch.js +50 -33
- package/DEV-cjs/core/ComboBox/ComboBox.js +395 -294
- package/DEV-cjs/core/ComboBox/ComboBox.types-test.js +87 -80
- package/DEV-cjs/core/ComboBox/ComboBoxEndIcon.js +36 -27
- package/DEV-cjs/core/ComboBox/ComboBoxInput.js +190 -128
- package/DEV-cjs/core/ComboBox/ComboBoxInputContainer.js +40 -28
- package/DEV-cjs/core/ComboBox/ComboBoxMenu.js +132 -93
- package/DEV-cjs/core/ComboBox/ComboBoxMenuItem.js +75 -34
- package/DEV-cjs/core/ComboBox/ComboBoxMultipleContainer.js +18 -18
- package/DEV-cjs/core/ComboBox/helpers.js +15 -14
- package/DEV-cjs/core/DatePicker/DatePicker.js +556 -353
- package/DEV-cjs/core/Dialog/Dialog.js +86 -58
- package/DEV-cjs/core/Dialog/DialogBackdrop.js +52 -39
- package/DEV-cjs/core/Dialog/DialogButtonBar.js +9 -9
- package/DEV-cjs/core/Dialog/DialogContent.js +9 -9
- package/DEV-cjs/core/Dialog/DialogContext.js +16 -15
- package/DEV-cjs/core/Dialog/DialogDragContext.js +20 -19
- package/DEV-cjs/core/Dialog/DialogMain.js +174 -122
- package/DEV-cjs/core/Dialog/DialogTitleBar.js +68 -33
- package/DEV-cjs/core/Dialog/DialogTitleBarTitle.js +9 -9
- package/DEV-cjs/core/Divider/Divider.js +22 -22
- package/DEV-cjs/core/DropdownMenu/DropdownMenu.js +63 -37
- package/DEV-cjs/core/ExpandableBlock/ExpandableBlock.js +195 -125
- package/DEV-cjs/core/Fieldset/Fieldset.js +34 -23
- package/DEV-cjs/core/FileUpload/FileEmptyCard.js +43 -24
- package/DEV-cjs/core/FileUpload/FileUpload.js +94 -57
- package/DEV-cjs/core/FileUpload/FileUploadCard.js +181 -124
- package/DEV-cjs/core/FileUpload/FileUploadTemplate.js +63 -35
- package/DEV-cjs/core/Flex/Flex.js +78 -77
- package/DEV-cjs/core/Footer/Footer.js +119 -85
- package/DEV-cjs/core/Footer/FooterItem.js +9 -9
- package/DEV-cjs/core/Footer/FooterList.js +9 -9
- package/DEV-cjs/core/Footer/FooterSeparator.js +10 -10
- package/DEV-cjs/core/Header/Header.js +86 -44
- package/DEV-cjs/core/Header/HeaderBasicButton.js +30 -20
- package/DEV-cjs/core/Header/HeaderBreadcrumbs.js +59 -36
- package/DEV-cjs/core/Header/HeaderButton.js +90 -46
- package/DEV-cjs/core/Header/HeaderDropdownButton.js +55 -44
- package/DEV-cjs/core/Header/HeaderLogo.js +53 -30
- package/DEV-cjs/core/Header/HeaderSplitButton.js +72 -44
- package/DEV-cjs/core/Icon/Icon.js +41 -35
- package/DEV-cjs/core/InformationPanel/InformationPanel.js +97 -62
- package/DEV-cjs/core/InformationPanel/InformationPanelBody.js +9 -9
- package/DEV-cjs/core/InformationPanel/InformationPanelContent.js +30 -22
- package/DEV-cjs/core/InformationPanel/InformationPanelHeader.js +51 -32
- package/DEV-cjs/core/InformationPanel/InformationPanelWrapper.js +12 -10
- package/DEV-cjs/core/Input/Input.js +26 -26
- package/DEV-cjs/core/InputGrid/InputGrid.js +151 -117
- package/DEV-cjs/core/InputGroup/InputGroup.js +85 -48
- package/DEV-cjs/core/InputWithDecorations/InputWithDecorations.js +60 -44
- package/DEV-cjs/core/Label/Label.js +40 -25
- package/DEV-cjs/core/LabeledInput/LabeledInput.js +86 -42
- package/DEV-cjs/core/LabeledSelect/LabeledSelect.js +71 -39
- package/DEV-cjs/core/LabeledSelect/LabeledSelect.types-test.js +100 -81
- package/DEV-cjs/core/LabeledTextarea/LabeledTextarea.js +19 -17
- package/DEV-cjs/core/LinkAction/LinkAction.js +27 -26
- package/DEV-cjs/core/List/List.js +11 -11
- package/DEV-cjs/core/List/ListItem.js +42 -34
- package/DEV-cjs/core/Menu/Menu.js +213 -127
- package/DEV-cjs/core/Menu/MenuDivider.js +11 -11
- package/DEV-cjs/core/Menu/MenuExtraContent.js +10 -10
- package/DEV-cjs/core/Menu/MenuItem.js +139 -76
- package/DEV-cjs/core/Menu/MenuItemSkeleton.js +65 -40
- package/DEV-cjs/core/Modal/Modal.js +54 -31
- package/DEV-cjs/core/Modal/ModalButtonBar.js +9 -9
- package/DEV-cjs/core/Modal/ModalContent.js +9 -9
- package/DEV-cjs/core/NonIdealState/ErrorPage.js +208 -127
- package/DEV-cjs/core/NonIdealState/NonIdealState.js +84 -35
- package/DEV-cjs/core/NotificationMarker/NotificationMarker.js +39 -25
- package/DEV-cjs/core/Overlay/Overlay.js +55 -41
- package/DEV-cjs/core/Popover/Popover.js +302 -193
- package/DEV-cjs/core/ProgressIndicators/ProgressLinear.js +70 -33
- package/DEV-cjs/core/ProgressIndicators/ProgressRadial.js +67 -40
- package/DEV-cjs/core/Radio/Radio.js +66 -38
- package/DEV-cjs/core/RadioTiles/RadioTile.js +88 -43
- package/DEV-cjs/core/RadioTiles/RadioTileGroup.js +29 -21
- package/DEV-cjs/core/SearchBox/SearchBox.js +203 -130
- package/DEV-cjs/core/Select/Select.js +457 -274
- package/DEV-cjs/core/Select/Select.types-test.js +112 -87
- package/DEV-cjs/core/Select/SelectTag.js +32 -24
- package/DEV-cjs/core/Select/SelectTagContainer.js +38 -25
- package/DEV-cjs/core/SideNavigation/SideNavigation.js +132 -64
- package/DEV-cjs/core/SideNavigation/SidenavButton.js +55 -33
- package/DEV-cjs/core/SideNavigation/SidenavSubmenu.js +33 -22
- package/DEV-cjs/core/SideNavigation/SidenavSubmenuHeader.js +41 -24
- package/DEV-cjs/core/SkipToContentLink/SkipToContentLink.js +28 -21
- package/DEV-cjs/core/Slider/Slider.js +352 -259
- package/DEV-cjs/core/Slider/Thumb.js +111 -98
- package/DEV-cjs/core/Slider/Track.js +93 -61
- package/DEV-cjs/core/StatusMessage/StatusMessage.js +46 -27
- package/DEV-cjs/core/Stepper/Stepper.js +86 -44
- package/DEV-cjs/core/Stepper/StepperStep.js +113 -59
- package/DEV-cjs/core/Stepper/WorkflowDiagram.js +37 -29
- package/DEV-cjs/core/Stepper/WorkflowDiagramStep.js +48 -28
- package/DEV-cjs/core/Surface/Surface.js +98 -76
- package/DEV-cjs/core/Table/ColumnHeader.js +194 -0
- package/DEV-cjs/core/Table/SubRowExpander.js +45 -34
- package/DEV-cjs/core/Table/Table.js +687 -510
- package/DEV-cjs/core/Table/TableCell.js +104 -61
- package/DEV-cjs/core/Table/TablePaginator.js +314 -178
- package/DEV-cjs/core/Table/TableRowMemoized.js +183 -90
- package/DEV-cjs/core/Table/actionHandlers/expandHandler.js +18 -18
- package/DEV-cjs/core/Table/actionHandlers/filterHandler.js +31 -23
- package/DEV-cjs/core/Table/actionHandlers/index.js +32 -31
- package/DEV-cjs/core/Table/actionHandlers/resizeHandler.js +26 -25
- package/DEV-cjs/core/Table/actionHandlers/selectHandler.js +124 -88
- package/DEV-cjs/core/Table/cells/DefaultCell.js +93 -44
- package/DEV-cjs/core/Table/cells/EditableCell.js +85 -63
- package/DEV-cjs/core/Table/cells/index.js +15 -14
- package/DEV-cjs/core/Table/columns/actionColumn.js +100 -78
- package/DEV-cjs/core/Table/columns/expanderColumn.js +56 -49
- package/DEV-cjs/core/Table/columns/index.js +25 -24
- package/DEV-cjs/core/Table/columns/selectionColumn.js +79 -58
- package/DEV-cjs/core/Table/filters/BaseFilter.js +31 -25
- package/DEV-cjs/core/Table/filters/DateRangeFilter/DatePickerInput.js +108 -72
- package/DEV-cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +115 -91
- package/DEV-cjs/core/Table/filters/FilterButtonBar.js +56 -33
- package/DEV-cjs/core/Table/filters/FilterToggle.js +71 -54
- package/DEV-cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +56 -60
- package/DEV-cjs/core/Table/filters/TextFilter/TextFilter.js +38 -36
- package/DEV-cjs/core/Table/filters/customFilterFunctions.js +26 -20
- package/DEV-cjs/core/Table/filters/defaultFilterFunctions.js +119 -77
- package/DEV-cjs/core/Table/filters/index.js +23 -22
- package/DEV-cjs/core/Table/filters/tableFilters.js +28 -25
- package/DEV-cjs/core/Table/filters/types.js +3 -3
- package/DEV-cjs/core/Table/hooks/index.js +39 -38
- package/DEV-cjs/core/Table/hooks/useColumnDragAndDrop.js +118 -101
- package/DEV-cjs/core/Table/hooks/useExpanderCell.js +39 -29
- package/DEV-cjs/core/Table/hooks/useResizeColumns.js +346 -248
- package/DEV-cjs/core/Table/hooks/useScrollToRow.js +42 -38
- package/DEV-cjs/core/Table/hooks/useSelectionCell.js +26 -19
- package/DEV-cjs/core/Table/hooks/useStickyColumns.js +55 -47
- package/DEV-cjs/core/Table/hooks/useSubRowFiltering.js +89 -86
- package/DEV-cjs/core/Table/hooks/useSubRowSelection.js +39 -39
- package/DEV-cjs/core/Table/index.js +42 -41
- package/DEV-cjs/core/Table/utils.js +66 -64
- package/DEV-cjs/core/Tabs/Tabs.js +388 -260
- package/DEV-cjs/core/Tag/Tag.js +80 -42
- package/DEV-cjs/core/Tag/TagContainer.js +31 -23
- package/DEV-cjs/core/Textarea/Textarea.js +19 -17
- package/DEV-cjs/core/ThemeProvider/ThemeContext.js +10 -10
- package/DEV-cjs/core/ThemeProvider/ThemeProvider.js +276 -172
- package/DEV-cjs/core/Tile/Tile.js +310 -173
- package/DEV-cjs/core/TimePicker/TimePicker.js +451 -263
- package/DEV-cjs/core/Toast/Toast.js +226 -157
- package/DEV-cjs/core/Toast/Toaster.js +142 -118
- package/DEV-cjs/core/ToggleSwitch/ToggleSwitch.js +76 -42
- package/DEV-cjs/core/Tooltip/Tooltip.js +221 -170
- package/DEV-cjs/core/TransferList/TransferList.js +171 -132
- package/DEV-cjs/core/Tree/Tree.js +226 -180
- package/DEV-cjs/core/Tree/TreeContext.js +20 -18
- package/DEV-cjs/core/Tree/TreeNode.js +254 -143
- package/DEV-cjs/core/Tree/TreeNodeExpander.js +40 -31
- package/DEV-cjs/core/Typography/Anchor.js +41 -27
- package/DEV-cjs/core/Typography/Blockquote.js +26 -21
- package/DEV-cjs/core/Typography/Code.js +9 -9
- package/DEV-cjs/core/Typography/Kbd.js +43 -38
- package/DEV-cjs/core/Typography/Text.js +45 -31
- package/DEV-cjs/core/VisuallyHidden/VisuallyHidden.js +47 -30
- package/DEV-cjs/index.js +475 -474
- package/DEV-cjs/package.json +1 -0
- package/DEV-cjs/react-table/react-table.js +3 -3
- package/DEV-cjs/react-table/react-table.types-test.js +628 -476
- package/DEV-cjs/styles.js +17 -1
- package/DEV-cjs/utils/color/ColorValue.js +429 -323
- package/DEV-cjs/utils/color/index.js +5 -5
- package/DEV-cjs/utils/components/AutoclearingHiddenLiveRegion.js +31 -26
- package/DEV-cjs/utils/components/Box.js +9 -9
- package/DEV-cjs/utils/components/ButtonBase.js +41 -35
- package/DEV-cjs/utils/components/FieldsetBase.js +9 -9
- package/DEV-cjs/utils/components/FocusTrap.js +48 -45
- package/DEV-cjs/utils/components/InputContainer.js +67 -34
- package/DEV-cjs/utils/components/InputFlexContainer.js +63 -49
- package/DEV-cjs/utils/components/InputWithIcon.js +9 -9
- package/DEV-cjs/utils/components/LineClamp.js +33 -24
- package/DEV-cjs/utils/components/MiddleTextTruncation.js +37 -33
- package/DEV-cjs/utils/components/Portal.js +35 -32
- package/DEV-cjs/utils/components/Resizer.js +221 -185
- package/DEV-cjs/utils/components/ShadowRoot.js +85 -69
- package/DEV-cjs/utils/components/WithCSSTransition.js +57 -50
- package/DEV-cjs/utils/components/index.js +18 -18
- package/DEV-cjs/utils/functions/colors.js +37 -35
- package/DEV-cjs/utils/functions/date.js +15 -15
- package/DEV-cjs/utils/functions/dev.js +25 -19
- package/DEV-cjs/utils/functions/dom.js +39 -39
- package/DEV-cjs/utils/functions/focusable.js +81 -63
- package/DEV-cjs/utils/functions/import.js +28 -22
- package/DEV-cjs/utils/functions/index.js +14 -14
- package/DEV-cjs/utils/functions/numbers.js +26 -24
- package/DEV-cjs/utils/functions/polymorphic.js +56 -43
- package/DEV-cjs/utils/functions/react.js +25 -23
- package/DEV-cjs/utils/functions/supports.js +11 -10
- package/DEV-cjs/utils/hooks/index.js +20 -20
- package/DEV-cjs/utils/hooks/useContainerWidth.js +31 -26
- package/DEV-cjs/utils/hooks/useControlledState.js +28 -27
- package/DEV-cjs/utils/hooks/useDragAndDrop.js +112 -88
- package/DEV-cjs/utils/hooks/useEventListener.js +23 -28
- package/DEV-cjs/utils/hooks/useGlobals.js +46 -40
- package/DEV-cjs/utils/hooks/useId.js +17 -17
- package/DEV-cjs/utils/hooks/useIntersection.js +38 -38
- package/DEV-cjs/utils/hooks/useIsClient.js +16 -16
- package/DEV-cjs/utils/hooks/useIsomorphicLayoutEffect.js +12 -11
- package/DEV-cjs/utils/hooks/useLatestRef.js +16 -18
- package/DEV-cjs/utils/hooks/useMediaQuery.js +32 -23
- package/DEV-cjs/utils/hooks/useMergedRefs.js +25 -23
- package/DEV-cjs/utils/hooks/useOverflow.js +68 -72
- package/DEV-cjs/utils/hooks/useResizeObserver.js +31 -33
- package/DEV-cjs/utils/hooks/useSafeContext.js +15 -14
- package/DEV-cjs/utils/hooks/useSyncExternalStore.js +37 -40
- package/DEV-cjs/utils/hooks/useVirtualScroll.js +42 -40
- package/DEV-cjs/utils/icons/StatusIconMap.js +34 -30
- package/DEV-cjs/utils/icons/Svg.js +12 -12
- package/DEV-cjs/utils/icons/SvgCalendar.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretDownSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretRightSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCaretUpSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgCheckmark.js +19 -14
- package/DEV-cjs/utils/icons/SvgCheckmarkSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronLeft.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronLeftDouble.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRight.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRightDouble.js +19 -14
- package/DEV-cjs/utils/icons/SvgChevronRightSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgClose.js +19 -14
- package/DEV-cjs/utils/icons/SvgCloseSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgColumnManager.js +19 -14
- package/DEV-cjs/utils/icons/SvgDocument.js +19 -14
- package/DEV-cjs/utils/icons/SvgFilter.js +19 -14
- package/DEV-cjs/utils/icons/SvgFilterHollow.js +19 -14
- package/DEV-cjs/utils/icons/SvgImportantSmall.js +19 -14
- package/DEV-cjs/utils/icons/SvgInfoCircular.js +19 -14
- package/DEV-cjs/utils/icons/SvgMore.js +19 -14
- package/DEV-cjs/utils/icons/SvgMoreVertical.js +19 -14
- package/DEV-cjs/utils/icons/SvgNew.js +19 -14
- package/DEV-cjs/utils/icons/SvgSearch.js +19 -14
- package/DEV-cjs/utils/icons/SvgSmileyHappy.js +19 -14
- package/DEV-cjs/utils/icons/SvgSortDown.js +19 -14
- package/DEV-cjs/utils/icons/SvgSortUp.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusError.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusSuccess.js +19 -14
- package/DEV-cjs/utils/icons/SvgStatusWarning.js +19 -14
- package/DEV-cjs/utils/icons/SvgSwap.js +19 -14
- package/DEV-cjs/utils/icons/SvgUpload.js +19 -14
- package/DEV-cjs/utils/icons/index.js +36 -36
- package/DEV-cjs/utils/index.js +12 -12
- package/DEV-cjs/utils/meta.js +11 -11
- package/DEV-cjs/utils/props.js +3 -3
- package/DEV-cjs/utils/providers/HydrationProvider.js +47 -35
- package/DEV-cjs/utils/providers/ScopeProvider.js +55 -53
- package/DEV-cjs/utils/providers/index.js +6 -6
- package/DEV-cjs/utils/types.js +3 -3
- package/DEV-esm/core/Alert/Alert.js +112 -57
- package/DEV-esm/core/Avatar/Avatar.js +45 -26
- package/DEV-esm/core/AvatarGroup/AvatarGroup.js +58 -21
- package/DEV-esm/core/Backdrop/Backdrop.js +13 -9
- package/DEV-esm/core/Badge/Badge.js +34 -29
- package/DEV-esm/core/Breadcrumbs/Breadcrumbs.js +150 -71
- package/DEV-esm/core/ButtonGroup/ButtonGroup.js +127 -62
- package/DEV-esm/core/Buttons/Button.js +71 -34
- package/DEV-esm/core/Buttons/DropdownButton.js +38 -20
- package/DEV-esm/core/Buttons/IconButton.js +54 -25
- package/DEV-esm/core/Buttons/IdeasButton.js +16 -12
- package/DEV-esm/core/Buttons/SplitButton.js +80 -41
- package/DEV-esm/core/Carousel/Carousel.js +58 -48
- package/DEV-esm/core/Carousel/CarouselDot.js +18 -14
- package/DEV-esm/core/Carousel/CarouselDotsList.js +134 -98
- package/DEV-esm/core/Carousel/CarouselNavigation.js +82 -53
- package/DEV-esm/core/Carousel/CarouselSlide.js +40 -29
- package/DEV-esm/core/Carousel/CarouselSlider.js +59 -48
- package/DEV-esm/core/Checkbox/Checkbox.js +79 -40
- package/DEV-esm/core/ColorPicker/ColorBuilder.js +263 -214
- package/DEV-esm/core/ColorPicker/ColorInputPanel.js +382 -350
- package/DEV-esm/core/ColorPicker/ColorPalette.js +37 -20
- package/DEV-esm/core/ColorPicker/ColorPicker.js +69 -51
- package/DEV-esm/core/ColorPicker/ColorPickerContext.js +7 -4
- package/DEV-esm/core/ColorPicker/ColorSwatch.js +29 -18
- package/DEV-esm/core/ComboBox/ComboBox.js +382 -274
- package/DEV-esm/core/ComboBox/ComboBox.types-test.js +82 -75
- package/DEV-esm/core/ComboBox/ComboBoxEndIcon.js +22 -13
- package/DEV-esm/core/ComboBox/ComboBoxInput.js +170 -114
- package/DEV-esm/core/ComboBox/ComboBoxInputContainer.js +29 -11
- package/DEV-esm/core/ComboBox/ComboBoxMenu.js +121 -79
- package/DEV-esm/core/ComboBox/ComboBoxMenuItem.js +65 -22
- package/DEV-esm/core/ComboBox/ComboBoxMultipleContainer.js +7 -7
- package/DEV-esm/core/DatePicker/DatePicker.js +527 -335
- package/DEV-esm/core/Dialog/Dialog.js +66 -38
- package/DEV-esm/core/Dialog/DialogBackdrop.js +37 -24
- package/DEV-esm/core/Dialog/DialogContext.js +1 -1
- package/DEV-esm/core/Dialog/DialogDragContext.js +5 -5
- package/DEV-esm/core/Dialog/DialogMain.js +166 -106
- package/DEV-esm/core/Dialog/DialogTitleBar.js +43 -15
- package/DEV-esm/core/Divider/Divider.js +9 -9
- package/DEV-esm/core/DropdownMenu/DropdownMenu.js +50 -24
- package/DEV-esm/core/ExpandableBlock/ExpandableBlock.js +177 -110
- package/DEV-esm/core/Fieldset/Fieldset.js +21 -10
- package/DEV-esm/core/FileUpload/FileEmptyCard.js +25 -10
- package/DEV-esm/core/FileUpload/FileUpload.js +66 -44
- package/DEV-esm/core/FileUpload/FileUploadCard.js +163 -105
- package/DEV-esm/core/FileUpload/FileUploadTemplate.js +46 -21
- package/DEV-esm/core/Flex/Flex.js +65 -64
- package/DEV-esm/core/Footer/Footer.js +96 -64
- package/DEV-esm/core/Footer/FooterSeparator.js +1 -1
- package/DEV-esm/core/Header/Header.js +71 -29
- package/DEV-esm/core/Header/HeaderBasicButton.js +14 -7
- package/DEV-esm/core/Header/HeaderBreadcrumbs.js +39 -23
- package/DEV-esm/core/Header/HeaderButton.js +70 -32
- package/DEV-esm/core/Header/HeaderDropdownButton.js +41 -29
- package/DEV-esm/core/Header/HeaderLogo.js +40 -17
- package/DEV-esm/core/Header/HeaderSplitButton.js +60 -30
- package/DEV-esm/core/Icon/Icon.js +28 -22
- package/DEV-esm/core/InformationPanel/InformationPanel.js +84 -49
- package/DEV-esm/core/InformationPanel/InformationPanelContent.js +18 -8
- package/DEV-esm/core/InformationPanel/InformationPanelHeader.js +37 -16
- package/DEV-esm/core/InformationPanel/InformationPanelWrapper.js +3 -1
- package/DEV-esm/core/Input/Input.js +13 -13
- package/DEV-esm/core/InputGrid/InputGrid.js +128 -98
- package/DEV-esm/core/InputGroup/InputGroup.js +66 -32
- package/DEV-esm/core/InputWithDecorations/InputWithDecorations.js +59 -34
- package/DEV-esm/core/Label/Label.js +27 -12
- package/DEV-esm/core/LabeledInput/LabeledInput.js +65 -24
- package/DEV-esm/core/LabeledSelect/LabeledSelect.js +57 -25
- package/DEV-esm/core/LabeledSelect/LabeledSelect.types-test.js +95 -76
- package/DEV-esm/core/LabeledTextarea/LabeledTextarea.js +8 -6
- package/DEV-esm/core/LinkAction/LinkAction.js +8 -8
- package/DEV-esm/core/List/List.js +2 -2
- package/DEV-esm/core/List/ListItem.js +28 -20
- package/DEV-esm/core/Menu/Menu.js +207 -111
- package/DEV-esm/core/Menu/MenuDivider.js +2 -2
- package/DEV-esm/core/Menu/MenuExtraContent.js +1 -1
- package/DEV-esm/core/Menu/MenuItem.js +129 -62
- package/DEV-esm/core/Menu/MenuItemSkeleton.js +47 -26
- package/DEV-esm/core/Modal/Modal.js +43 -20
- package/DEV-esm/core/NonIdealState/ErrorPage.js +159 -114
- package/DEV-esm/core/NonIdealState/NonIdealState.js +65 -22
- package/DEV-esm/core/NotificationMarker/NotificationMarker.js +26 -12
- package/DEV-esm/core/Overlay/Overlay.js +44 -30
- package/DEV-esm/core/Popover/Popover.js +306 -172
- package/DEV-esm/core/ProgressIndicators/ProgressLinear.js +52 -19
- package/DEV-esm/core/ProgressIndicators/ProgressRadial.js +52 -27
- package/DEV-esm/core/Radio/Radio.js +50 -25
- package/DEV-esm/core/RadioTiles/RadioTile.js +63 -30
- package/DEV-esm/core/RadioTiles/RadioTileGroup.js +17 -9
- package/DEV-esm/core/SearchBox/SearchBox.js +200 -118
- package/DEV-esm/core/Select/Select.js +434 -256
- package/DEV-esm/core/Select/Select.types-test.js +107 -82
- package/DEV-esm/core/Select/SelectTag.js +19 -11
- package/DEV-esm/core/Select/SelectTagContainer.js +21 -11
- package/DEV-esm/core/SideNavigation/SideNavigation.js +103 -46
- package/DEV-esm/core/SideNavigation/SidenavButton.js +39 -18
- package/DEV-esm/core/SideNavigation/SidenavSubmenu.js +17 -9
- package/DEV-esm/core/SideNavigation/SidenavSubmenuHeader.js +25 -11
- package/DEV-esm/core/SkipToContentLink/SkipToContentLink.js +12 -8
- package/DEV-esm/core/Slider/Slider.js +317 -244
- package/DEV-esm/core/Slider/Thumb.js +97 -84
- package/DEV-esm/core/Slider/Track.js +77 -48
- package/DEV-esm/core/StatusMessage/StatusMessage.js +32 -13
- package/DEV-esm/core/Stepper/Stepper.js +69 -30
- package/DEV-esm/core/Stepper/StepperStep.js +93 -45
- package/DEV-esm/core/Stepper/WorkflowDiagram.js +23 -15
- package/DEV-esm/core/Stepper/WorkflowDiagramStep.js +28 -14
- package/DEV-esm/core/Surface/Surface.js +85 -63
- package/DEV-esm/core/Table/ColumnHeader.js +188 -0
- package/DEV-esm/core/Table/SubRowExpander.js +33 -22
- package/DEV-esm/core/Table/Table.js +694 -490
- package/DEV-esm/core/Table/TableCell.js +80 -44
- package/DEV-esm/core/Table/TablePaginator.js +305 -161
- package/DEV-esm/core/Table/TableRowMemoized.js +167 -73
- package/DEV-esm/core/Table/actionHandlers/expandHandler.js +10 -10
- package/DEV-esm/core/Table/actionHandlers/filterHandler.js +23 -15
- package/DEV-esm/core/Table/actionHandlers/index.js +5 -1
- package/DEV-esm/core/Table/actionHandlers/resizeHandler.js +14 -14
- package/DEV-esm/core/Table/actionHandlers/selectHandler.js +108 -73
- package/DEV-esm/core/Table/cells/DefaultCell.js +79 -30
- package/DEV-esm/core/Table/cells/EditableCell.js +70 -50
- package/DEV-esm/core/Table/columns/actionColumn.js +81 -59
- package/DEV-esm/core/Table/columns/expanderColumn.js +38 -32
- package/DEV-esm/core/Table/columns/selectionColumn.js +62 -42
- package/DEV-esm/core/Table/filters/BaseFilter.js +16 -13
- package/DEV-esm/core/Table/filters/DateRangeFilter/DatePickerInput.js +92 -56
- package/DEV-esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +101 -77
- package/DEV-esm/core/Table/filters/FilterButtonBar.js +42 -19
- package/DEV-esm/core/Table/filters/FilterToggle.js +58 -40
- package/DEV-esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +42 -46
- package/DEV-esm/core/Table/filters/TextFilter/TextFilter.js +24 -22
- package/DEV-esm/core/Table/filters/customFilterFunctions.js +18 -12
- package/DEV-esm/core/Table/filters/defaultFilterFunctions.js +111 -69
- package/DEV-esm/core/Table/filters/tableFilters.js +15 -12
- package/DEV-esm/core/Table/filters/types.js +1 -1
- package/DEV-esm/core/Table/hooks/useColumnDragAndDrop.js +100 -91
- package/DEV-esm/core/Table/hooks/useExpanderCell.js +26 -18
- package/DEV-esm/core/Table/hooks/useResizeColumns.js +333 -238
- package/DEV-esm/core/Table/hooks/useScrollToRow.js +32 -28
- package/DEV-esm/core/Table/hooks/useSelectionCell.js +17 -10
- package/DEV-esm/core/Table/hooks/useStickyColumns.js +46 -38
- package/DEV-esm/core/Table/hooks/useSubRowFiltering.js +78 -75
- package/DEV-esm/core/Table/hooks/useSubRowSelection.js +29 -29
- package/DEV-esm/core/Table/index.js +5 -1
- package/DEV-esm/core/Table/utils.js +45 -44
- package/DEV-esm/core/Tabs/Tabs.js +372 -243
- package/DEV-esm/core/Tag/Tag.js +55 -27
- package/DEV-esm/core/Tag/TagContainer.js +18 -10
- package/DEV-esm/core/Textarea/Textarea.js +8 -6
- package/DEV-esm/core/ThemeProvider/ThemeProvider.js +258 -155
- package/DEV-esm/core/Tile/Tile.js +286 -157
- package/DEV-esm/core/TimePicker/TimePicker.js +438 -250
- package/DEV-esm/core/Toast/Toast.js +199 -138
- package/DEV-esm/core/Toast/Toaster.js +114 -94
- package/DEV-esm/core/ToggleSwitch/ToggleSwitch.js +60 -29
- package/DEV-esm/core/Tooltip/Tooltip.js +229 -159
- package/DEV-esm/core/TransferList/TransferList.js +146 -112
- package/DEV-esm/core/Tree/Tree.js +226 -175
- package/DEV-esm/core/Tree/TreeContext.js +5 -4
- package/DEV-esm/core/Tree/TreeNode.js +226 -129
- package/DEV-esm/core/Tree/TreeNodeExpander.js +24 -16
- package/DEV-esm/core/Typography/Anchor.js +22 -12
- package/DEV-esm/core/Typography/Blockquote.js +13 -8
- package/DEV-esm/core/Typography/Kbd.js +25 -21
- package/DEV-esm/core/Typography/Text.js +27 -14
- package/DEV-esm/core/VisuallyHidden/VisuallyHidden.js +34 -17
- package/DEV-esm/index.js +21 -3
- package/DEV-esm/react-table/react-table.js +1 -1
- package/DEV-esm/react-table/react-table.types-test.js +635 -471
- package/DEV-esm/styles.js +7 -10
- package/DEV-esm/utils/color/ColorValue.js +406 -304
- package/DEV-esm/utils/components/AutoclearingHiddenLiveRegion.js +16 -14
- package/DEV-esm/utils/components/ButtonBase.js +27 -21
- package/DEV-esm/utils/components/FocusTrap.js +36 -33
- package/DEV-esm/utils/components/InputContainer.js +52 -19
- package/DEV-esm/utils/components/InputFlexContainer.js +31 -27
- package/DEV-esm/utils/components/LineClamp.js +21 -12
- package/DEV-esm/utils/components/MiddleTextTruncation.js +26 -22
- package/DEV-esm/utils/components/Portal.js +11 -11
- package/DEV-esm/utils/components/Resizer.js +215 -175
- package/DEV-esm/utils/components/ShadowRoot.js +72 -56
- package/DEV-esm/utils/components/WithCSSTransition.js +45 -38
- package/DEV-esm/utils/functions/colors.js +21 -20
- package/DEV-esm/utils/functions/date.js +7 -7
- package/DEV-esm/utils/functions/dev.js +12 -7
- package/DEV-esm/utils/functions/dom.js +18 -18
- package/DEV-esm/utils/functions/focusable.js +62 -45
- package/DEV-esm/utils/functions/import.js +20 -14
- package/DEV-esm/utils/functions/numbers.js +11 -9
- package/DEV-esm/utils/functions/polymorphic.js +42 -29
- package/DEV-esm/utils/functions/react.js +14 -12
- package/DEV-esm/utils/functions/supports.js +2 -1
- package/DEV-esm/utils/hooks/useContainerWidth.js +14 -14
- package/DEV-esm/utils/hooks/useControlledState.js +18 -17
- package/DEV-esm/utils/hooks/useDragAndDrop.js +100 -76
- package/DEV-esm/utils/hooks/useEventListener.js +13 -18
- package/DEV-esm/utils/hooks/useGlobals.js +29 -24
- package/DEV-esm/utils/hooks/useId.js +5 -6
- package/DEV-esm/utils/hooks/useIntersection.js +27 -27
- package/DEV-esm/utils/hooks/useIsClient.js +6 -6
- package/DEV-esm/utils/hooks/useIsomorphicLayoutEffect.js +2 -1
- package/DEV-esm/utils/hooks/useLatestRef.js +6 -8
- package/DEV-esm/utils/hooks/useMediaQuery.js +17 -12
- package/DEV-esm/utils/hooks/useMergedRefs.js +10 -9
- package/DEV-esm/utils/hooks/useOverflow.js +57 -59
- package/DEV-esm/utils/hooks/useResizeObserver.js +20 -22
- package/DEV-esm/utils/hooks/useSafeContext.js +5 -4
- package/DEV-esm/utils/hooks/useSyncExternalStore.js +27 -30
- package/DEV-esm/utils/hooks/useVirtualScroll.js +31 -29
- package/DEV-esm/utils/icons/StatusIconMap.js +20 -16
- package/DEV-esm/utils/icons/Svg.js +3 -3
- package/DEV-esm/utils/icons/SvgCalendar.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretDownSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretRightSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCaretUpSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgCheckmark.js +8 -3
- package/DEV-esm/utils/icons/SvgCheckmarkSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronLeft.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronLeftDouble.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRight.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRightDouble.js +8 -3
- package/DEV-esm/utils/icons/SvgChevronRightSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgClose.js +8 -3
- package/DEV-esm/utils/icons/SvgCloseSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgColumnManager.js +8 -3
- package/DEV-esm/utils/icons/SvgDocument.js +8 -3
- package/DEV-esm/utils/icons/SvgFilter.js +8 -3
- package/DEV-esm/utils/icons/SvgFilterHollow.js +8 -3
- package/DEV-esm/utils/icons/SvgImportantSmall.js +8 -3
- package/DEV-esm/utils/icons/SvgInfoCircular.js +8 -3
- package/DEV-esm/utils/icons/SvgMore.js +8 -3
- package/DEV-esm/utils/icons/SvgMoreVertical.js +8 -3
- package/DEV-esm/utils/icons/SvgNew.js +8 -3
- package/DEV-esm/utils/icons/SvgSearch.js +8 -3
- package/DEV-esm/utils/icons/SvgSmileyHappy.js +8 -3
- package/DEV-esm/utils/icons/SvgSortDown.js +8 -3
- package/DEV-esm/utils/icons/SvgSortUp.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusError.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusSuccess.js +8 -3
- package/DEV-esm/utils/icons/SvgStatusWarning.js +8 -3
- package/DEV-esm/utils/icons/SvgSwap.js +8 -3
- package/DEV-esm/utils/icons/SvgUpload.js +8 -3
- package/DEV-esm/utils/meta.js +2 -2
- package/DEV-esm/utils/props.js +1 -1
- package/DEV-esm/utils/providers/HydrationProvider.js +31 -20
- package/DEV-esm/utils/providers/ScopeProvider.js +36 -35
- package/DEV-esm/utils/types.js +1 -1
- package/cjs/core/Buttons/IconButton.d.ts +4 -0
- package/cjs/core/Buttons/IconButton.js +3 -1
- package/cjs/core/Carousel/Carousel.d.ts +4 -2
- package/cjs/core/Carousel/CarouselNavigation.d.ts +4 -2
- package/cjs/core/ComboBox/ComboBox.js +5 -0
- package/cjs/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/cjs/core/List/List.d.ts +1 -1
- package/cjs/core/List/List.js +1 -1
- package/cjs/core/List/ListItem.d.ts +4 -4
- package/cjs/core/List/ListItem.js +4 -6
- package/cjs/core/Menu/Menu.js +6 -0
- package/cjs/core/Menu/MenuDivider.d.ts +1 -1
- package/cjs/core/Menu/MenuDivider.js +1 -1
- package/cjs/core/Overlay/Overlay.d.ts +2 -2
- package/cjs/core/Overlay/Overlay.js +2 -2
- package/cjs/core/Popover/Popover.d.ts +8 -1
- package/cjs/core/Popover/Popover.js +40 -9
- package/cjs/core/Select/Select.js +5 -0
- package/cjs/core/Table/ColumnHeader.d.ts +19 -0
- package/cjs/core/Table/ColumnHeader.js +194 -0
- package/cjs/core/Table/Table.js +37 -190
- package/cjs/core/Table/filters/BaseFilter.d.ts +2 -9
- package/cjs/core/Table/filters/BaseFilter.js +17 -15
- package/cjs/core/Table/filters/DateRangeFilter/DateRangeFilter.js +3 -8
- package/cjs/core/Table/filters/FilterButtonBar.d.ts +4 -2
- package/cjs/core/Table/filters/FilterButtonBar.js +1 -0
- package/cjs/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +3 -9
- package/cjs/core/Table/filters/TextFilter/TextFilter.js +4 -7
- package/cjs/core/Table/filters/index.d.ts +0 -1
- package/cjs/core/Table/index.d.ts +1 -1
- package/cjs/core/ThemeProvider/ThemeProvider.d.ts +0 -4
- package/cjs/core/ThemeProvider/ThemeProvider.js +66 -49
- package/cjs/core/Tile/Tile.d.ts +10 -9
- package/cjs/core/Tile/Tile.js +8 -8
- package/cjs/core/Toast/Toaster.d.ts +3 -2
- package/cjs/core/Toast/Toaster.js +2 -1
- package/cjs/core/Tooltip/Tooltip.js +22 -7
- package/cjs/core/TransferList/TransferList.d.ts +5 -5
- package/cjs/core/TransferList/TransferList.js +2 -2
- package/cjs/styles.js +1 -1
- package/cjs/utils/functions/polymorphic.d.ts +3 -7
- package/cjs/utils/functions/polymorphic.js +8 -5
- package/esm/core/Buttons/IconButton.d.ts +4 -0
- package/esm/core/Buttons/IconButton.js +4 -2
- package/esm/core/Carousel/Carousel.d.ts +4 -2
- package/esm/core/Carousel/CarouselNavigation.d.ts +4 -2
- package/esm/core/ComboBox/ComboBox.js +5 -0
- package/esm/core/InputWithDecorations/InputWithDecorations.d.ts +1 -1
- package/esm/core/List/List.d.ts +1 -1
- package/esm/core/List/List.js +1 -1
- package/esm/core/List/ListItem.d.ts +4 -4
- package/esm/core/List/ListItem.js +4 -4
- package/esm/core/Menu/Menu.js +6 -0
- package/esm/core/Menu/MenuDivider.d.ts +1 -1
- package/esm/core/Menu/MenuDivider.js +1 -1
- package/esm/core/Overlay/Overlay.d.ts +2 -2
- package/esm/core/Overlay/Overlay.js +2 -2
- package/esm/core/Popover/Popover.d.ts +8 -1
- package/esm/core/Popover/Popover.js +40 -9
- package/esm/core/Select/Select.js +5 -0
- package/esm/core/Table/ColumnHeader.d.ts +19 -0
- package/esm/core/Table/ColumnHeader.js +188 -0
- package/esm/core/Table/Table.js +19 -177
- package/esm/core/Table/filters/BaseFilter.d.ts +2 -9
- package/esm/core/Table/filters/BaseFilter.js +15 -16
- package/esm/core/Table/filters/DateRangeFilter/DateRangeFilter.js +3 -8
- package/esm/core/Table/filters/FilterButtonBar.d.ts +4 -2
- package/esm/core/Table/filters/FilterButtonBar.js +1 -0
- package/esm/core/Table/filters/NumberRangeFilter/NumberRangeFilter.js +3 -9
- package/esm/core/Table/filters/TextFilter/TextFilter.js +4 -7
- package/esm/core/Table/filters/index.d.ts +0 -1
- package/esm/core/Table/index.d.ts +1 -1
- package/esm/core/ThemeProvider/ThemeProvider.d.ts +0 -4
- package/esm/core/ThemeProvider/ThemeProvider.js +65 -44
- package/esm/core/Tile/Tile.d.ts +10 -9
- package/esm/core/Tile/Tile.js +8 -8
- package/esm/core/Toast/Toaster.d.ts +3 -2
- package/esm/core/Toast/Toaster.js +2 -1
- package/esm/core/Tooltip/Tooltip.js +22 -8
- package/esm/core/TransferList/TransferList.d.ts +5 -5
- package/esm/core/TransferList/TransferList.js +2 -2
- package/esm/styles.js +1 -1
- package/esm/utils/functions/polymorphic.d.ts +3 -7
- package/esm/utils/functions/polymorphic.js +8 -5
- package/package.json +3 -3
- package/styles.css +22 -14
|
@@ -1,343 +1,449 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports,
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, '__esModule', {
|
|
3
|
+
value: true,
|
|
4
4
|
});
|
|
5
5
|
function _export(target, all) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
for (var name in all)
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name],
|
|
9
10
|
});
|
|
10
11
|
}
|
|
11
12
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
ColorValue: function () {
|
|
14
|
+
return ColorValue;
|
|
15
|
+
},
|
|
16
|
+
isHslColor: function () {
|
|
17
|
+
return isHslColor;
|
|
18
|
+
},
|
|
19
|
+
isHsvColor: function () {
|
|
20
|
+
return isHsvColor;
|
|
21
|
+
},
|
|
22
|
+
isRgbColor: function () {
|
|
23
|
+
return isRgbColor;
|
|
24
|
+
},
|
|
24
25
|
});
|
|
25
|
-
const _define_property = require(
|
|
26
|
-
const _numbers = require(
|
|
26
|
+
const _define_property = require('@swc/helpers/_/_define_property');
|
|
27
|
+
const _numbers = require('../functions/numbers.js');
|
|
27
28
|
const scratchBytes = new Uint8Array(4);
|
|
28
29
|
const scratchUInt32 = new Uint32Array(scratchBytes.buffer);
|
|
29
|
-
const isRgbColor = (value)=>
|
|
30
|
-
|
|
31
|
-
const
|
|
30
|
+
const isRgbColor = (value) =>
|
|
31
|
+
'string' != typeof value && 'r' in value && 'g' in value && 'b' in value;
|
|
32
|
+
const isHslColor = (value) =>
|
|
33
|
+
'string' != typeof value && 'h' in value && 's' in value && 'l' in value;
|
|
34
|
+
const isHsvColor = (value) =>
|
|
35
|
+
'string' != typeof value && 'h' in value && 's' in value && 'v' in value;
|
|
32
36
|
class ColorValue {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
37
|
+
static create(val) {
|
|
38
|
+
if (!val) return ColorValue.fromTbgr(0);
|
|
39
|
+
if (isRgbColor(val)) return ColorValue.fromRGB(val);
|
|
40
|
+
if (isHslColor(val)) return ColorValue.fromHSL(val);
|
|
41
|
+
if (isHsvColor(val)) return ColorValue.fromHSV(val);
|
|
42
|
+
if ('string' == typeof val)
|
|
43
|
+
return ColorValue.fromString(val, ColorValue.fromTbgr(0));
|
|
44
|
+
return ColorValue.fromTbgr(0);
|
|
45
|
+
}
|
|
46
|
+
toTbgr() {
|
|
47
|
+
return this._tbgr;
|
|
48
|
+
}
|
|
49
|
+
static fromTbgr(tbgr) {
|
|
50
|
+
return new ColorValue(tbgr);
|
|
51
|
+
}
|
|
52
|
+
static fromRgbt(red, green, blue, transparency) {
|
|
53
|
+
return this.fromTbgr(
|
|
54
|
+
this.computeTbgrFromComponents(red, green, blue, transparency),
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
static computeTbgrFromComponents(red, green, blue, transparency) {
|
|
58
|
+
scratchBytes[0] = red;
|
|
59
|
+
scratchBytes[1] = green;
|
|
60
|
+
scratchBytes[2] = blue;
|
|
61
|
+
scratchBytes[3] = transparency || 0;
|
|
62
|
+
return scratchUInt32[0];
|
|
63
|
+
}
|
|
64
|
+
static fromString(val, defaultColorIfNotParsed) {
|
|
65
|
+
let [tbgr, hue] = this.computeTbgrFromString(
|
|
66
|
+
val,
|
|
67
|
+
defaultColorIfNotParsed?.toTbgr(),
|
|
68
|
+
);
|
|
69
|
+
return new ColorValue(tbgr, hue);
|
|
70
|
+
}
|
|
71
|
+
static fromHSL(hsl) {
|
|
72
|
+
let alpha = hsl.a ?? 1;
|
|
73
|
+
return new ColorValue(
|
|
74
|
+
this.computeTbgrFromHSL(
|
|
75
|
+
hsl.h / 360,
|
|
76
|
+
hsl.s / 100,
|
|
77
|
+
hsl.l / 100,
|
|
78
|
+
Math.round((1 - alpha) * 255),
|
|
79
|
+
),
|
|
80
|
+
hsl.h,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
static fromRGB(rgb) {
|
|
84
|
+
let alpha = rgb.a ?? 1;
|
|
85
|
+
return ColorValue.fromRgbt(
|
|
86
|
+
rgb.r,
|
|
87
|
+
rgb.g,
|
|
88
|
+
rgb.b,
|
|
89
|
+
Math.round((1 - alpha) * 255),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
static fromHSV(hsv) {
|
|
93
|
+
let alpha = hsv.a ?? 1;
|
|
94
|
+
let transparency = Math.round((1 - alpha) * 255);
|
|
95
|
+
if (!hsv.s || -1 === hsv.h) {
|
|
96
|
+
let white = 0xff & Math.floor((255.0 * hsv.v) / 100.0 + 0.5 + 3.0e-14);
|
|
97
|
+
return ColorValue.fromRgbt(white, white, white, 0);
|
|
60
98
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
99
|
+
let dhue = hsv.h,
|
|
100
|
+
dsaturation = hsv.s,
|
|
101
|
+
dvalue = hsv.v;
|
|
102
|
+
if (360 === dhue) dhue = 0.0;
|
|
103
|
+
dhue /= 60;
|
|
104
|
+
let hueIntpart = Math.floor(dhue);
|
|
105
|
+
let hueFractpart = dhue - hueIntpart;
|
|
106
|
+
dvalue /= 100;
|
|
107
|
+
dsaturation /= 100;
|
|
108
|
+
let p = 0xff & Math.floor(dvalue * (1.0 - dsaturation) * 255.0 + 0.5);
|
|
109
|
+
let q =
|
|
110
|
+
0xff &
|
|
111
|
+
Math.floor(dvalue * (1.0 - dsaturation * hueFractpart) * 255.0 + 0.5);
|
|
112
|
+
let t =
|
|
113
|
+
0xff &
|
|
114
|
+
Math.floor(
|
|
115
|
+
dvalue * (1.0 - dsaturation * (1.0 - hueFractpart)) * 255.0 + 0.5,
|
|
116
|
+
);
|
|
117
|
+
let v = 0xff & Math.floor(255 * dvalue + 0.5);
|
|
118
|
+
let r = 0,
|
|
119
|
+
b = 0,
|
|
120
|
+
g = 0;
|
|
121
|
+
switch (hueIntpart) {
|
|
122
|
+
case 0:
|
|
123
|
+
r = v;
|
|
124
|
+
g = t;
|
|
125
|
+
b = p;
|
|
126
|
+
break;
|
|
127
|
+
case 1:
|
|
128
|
+
(r = q), (g = v);
|
|
129
|
+
b = p;
|
|
130
|
+
break;
|
|
131
|
+
case 2:
|
|
132
|
+
(r = p), (g = v);
|
|
133
|
+
b = t;
|
|
134
|
+
break;
|
|
135
|
+
case 3:
|
|
136
|
+
(r = p), (g = q);
|
|
137
|
+
b = v;
|
|
138
|
+
break;
|
|
139
|
+
case 4:
|
|
140
|
+
(r = t), (g = p);
|
|
141
|
+
b = v;
|
|
142
|
+
break;
|
|
143
|
+
case 5:
|
|
144
|
+
(r = v), (g = p);
|
|
145
|
+
b = q;
|
|
146
|
+
break;
|
|
64
147
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
let
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
let v =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
break;
|
|
110
|
-
case 5:
|
|
111
|
-
r = v, g = p;
|
|
112
|
-
b = q;
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
return new ColorValue(ColorValue.computeTbgrFromComponents(r, g, b, transparency), hsv.h);
|
|
116
|
-
}
|
|
117
|
-
static computeTbgrFromString(val, defaultColorIfNotParsed) {
|
|
118
|
-
val = val.toLowerCase();
|
|
119
|
-
let m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(val);
|
|
120
|
-
if (m) {
|
|
121
|
-
let color;
|
|
122
|
-
let name = m[1];
|
|
123
|
-
let components = m[2];
|
|
124
|
-
let hasPercent = (str)=>'%' === str[str.length - 1];
|
|
125
|
-
let floatOrPercent = (str)=>{
|
|
126
|
-
let v = parseFloat(str);
|
|
127
|
-
return 255 * (0, _numbers.getBoundedValue)(hasPercent(str) ? v / 100 : v, 0, 1);
|
|
128
|
-
};
|
|
129
|
-
let intOrPercent = (str)=>{
|
|
130
|
-
let v = hasPercent(str) ? parseFloat(str) / 100 * 255 : parseInt(str, 10);
|
|
131
|
-
return (0, _numbers.getBoundedValue)(v, 0, 255);
|
|
132
|
-
};
|
|
133
|
-
switch(name){
|
|
134
|
-
case 'rgb':
|
|
135
|
-
case 'rgba':
|
|
136
|
-
color = /^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
|
|
137
|
-
if (color) return [
|
|
138
|
-
this.computeTbgrFromComponents(intOrPercent(color[1]), intOrPercent(color[2]), intOrPercent(color[3]), 'string' == typeof color[4] ? 255 - floatOrPercent(color[4]) : 0),
|
|
139
|
-
void 0
|
|
140
|
-
];
|
|
141
|
-
break;
|
|
142
|
-
case 'hsl':
|
|
143
|
-
case 'hsla':
|
|
144
|
-
color = /^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components);
|
|
145
|
-
if (color) {
|
|
146
|
-
let h = parseFloat(color[1]);
|
|
147
|
-
let s = parseInt(color[2], 10) / 100;
|
|
148
|
-
let l = parseInt(color[3], 10) / 100;
|
|
149
|
-
let t = 'string' == typeof color[4] ? 255 - floatOrPercent(color[4]) : 0;
|
|
150
|
-
return [
|
|
151
|
-
this.computeTbgrFromHSL(h / 360, s, l, t),
|
|
152
|
-
h
|
|
153
|
-
];
|
|
154
|
-
}
|
|
155
|
-
break;
|
|
156
|
-
}
|
|
157
|
-
} else if (m = /^\#([A-Fa-f\d]+)$/.exec(val)) {
|
|
158
|
-
let hex = m[1];
|
|
159
|
-
let size = hex.length;
|
|
160
|
-
if (3 === size) return [
|
|
161
|
-
this.computeTbgrFromComponents(parseInt(hex.charAt(0) + hex.charAt(0), 16), parseInt(hex.charAt(1) + hex.charAt(1), 16), parseInt(hex.charAt(2) + hex.charAt(2), 16), 0),
|
|
162
|
-
void 0
|
|
163
|
-
];
|
|
164
|
-
if (6 === size) return [
|
|
165
|
-
this.computeTbgrFromComponents(parseInt(hex.charAt(0) + hex.charAt(1), 16), parseInt(hex.charAt(2) + hex.charAt(3), 16), parseInt(hex.charAt(4) + hex.charAt(5), 16), 0),
|
|
166
|
-
void 0
|
|
148
|
+
return new ColorValue(
|
|
149
|
+
ColorValue.computeTbgrFromComponents(r, g, b, transparency),
|
|
150
|
+
hsv.h,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
static computeTbgrFromString(val, defaultColorIfNotParsed) {
|
|
154
|
+
val = val.toLowerCase();
|
|
155
|
+
let m = /^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(val);
|
|
156
|
+
if (m) {
|
|
157
|
+
let color;
|
|
158
|
+
let name = m[1];
|
|
159
|
+
let components = m[2];
|
|
160
|
+
let hasPercent = (str) => '%' === str[str.length - 1];
|
|
161
|
+
let floatOrPercent = (str) => {
|
|
162
|
+
let v = parseFloat(str);
|
|
163
|
+
return (
|
|
164
|
+
255 *
|
|
165
|
+
(0, _numbers.getBoundedValue)(hasPercent(str) ? v / 100 : v, 0, 1)
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
let intOrPercent = (str) => {
|
|
169
|
+
let v = hasPercent(str)
|
|
170
|
+
? (parseFloat(str) / 100) * 255
|
|
171
|
+
: parseInt(str, 10);
|
|
172
|
+
return (0, _numbers.getBoundedValue)(v, 0, 255);
|
|
173
|
+
};
|
|
174
|
+
switch (name) {
|
|
175
|
+
case 'rgb':
|
|
176
|
+
case 'rgba':
|
|
177
|
+
color =
|
|
178
|
+
/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
|
|
179
|
+
components,
|
|
180
|
+
);
|
|
181
|
+
if (color)
|
|
182
|
+
return [
|
|
183
|
+
this.computeTbgrFromComponents(
|
|
184
|
+
intOrPercent(color[1]),
|
|
185
|
+
intOrPercent(color[2]),
|
|
186
|
+
intOrPercent(color[3]),
|
|
187
|
+
'string' == typeof color[4]
|
|
188
|
+
? 255 - floatOrPercent(color[4])
|
|
189
|
+
: 0,
|
|
190
|
+
),
|
|
191
|
+
void 0,
|
|
167
192
|
];
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
193
|
+
break;
|
|
194
|
+
case 'hsl':
|
|
195
|
+
case 'hsla':
|
|
196
|
+
color =
|
|
197
|
+
/^(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(
|
|
198
|
+
components,
|
|
199
|
+
);
|
|
200
|
+
if (color) {
|
|
201
|
+
let h = parseFloat(color[1]);
|
|
202
|
+
let s = parseInt(color[2], 10) / 100;
|
|
203
|
+
let l = parseInt(color[3], 10) / 100;
|
|
204
|
+
let t =
|
|
205
|
+
'string' == typeof color[4] ? 255 - floatOrPercent(color[4]) : 0;
|
|
206
|
+
return [this.computeTbgrFromHSL(h / 360, s, l, t), h];
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
} else if ((m = /^\#([A-Fa-f\d]+)$/.exec(val))) {
|
|
211
|
+
let hex = m[1];
|
|
212
|
+
let size = hex.length;
|
|
213
|
+
if (3 === size)
|
|
214
|
+
return [
|
|
215
|
+
this.computeTbgrFromComponents(
|
|
216
|
+
parseInt(hex.charAt(0) + hex.charAt(0), 16),
|
|
217
|
+
parseInt(hex.charAt(1) + hex.charAt(1), 16),
|
|
218
|
+
parseInt(hex.charAt(2) + hex.charAt(2), 16),
|
|
219
|
+
0,
|
|
220
|
+
),
|
|
221
|
+
void 0,
|
|
222
|
+
];
|
|
223
|
+
if (6 === size)
|
|
224
|
+
return [
|
|
225
|
+
this.computeTbgrFromComponents(
|
|
226
|
+
parseInt(hex.charAt(0) + hex.charAt(1), 16),
|
|
227
|
+
parseInt(hex.charAt(2) + hex.charAt(3), 16),
|
|
228
|
+
parseInt(hex.charAt(4) + hex.charAt(5), 16),
|
|
229
|
+
0,
|
|
230
|
+
),
|
|
231
|
+
void 0,
|
|
232
|
+
];
|
|
233
|
+
if (8 === size)
|
|
234
|
+
return [
|
|
235
|
+
this.computeTbgrFromComponents(
|
|
236
|
+
parseInt(hex.charAt(0) + hex.charAt(1), 16),
|
|
237
|
+
parseInt(hex.charAt(2) + hex.charAt(3), 16),
|
|
238
|
+
parseInt(hex.charAt(4) + hex.charAt(5), 16),
|
|
239
|
+
255 - parseInt(hex.charAt(6) + hex.charAt(7), 16),
|
|
240
|
+
),
|
|
241
|
+
void 0,
|
|
176
242
|
];
|
|
177
|
-
throw new Error('unable to parse string into ColorValue');
|
|
178
|
-
}
|
|
179
|
-
static getColors(tbgr) {
|
|
180
|
-
scratchUInt32[0] = tbgr;
|
|
181
|
-
return {
|
|
182
|
-
b: scratchBytes[2],
|
|
183
|
-
g: scratchBytes[1],
|
|
184
|
-
r: scratchBytes[0],
|
|
185
|
-
t: scratchBytes[3]
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
getRgb(includeAlpha) {
|
|
189
|
-
scratchUInt32[0] = this._tbgr;
|
|
190
|
-
if (includeAlpha) return (scratchBytes[0] << 24) + (scratchBytes[1] << 16) + (scratchBytes[2] << 8) + (255 - scratchBytes[3]);
|
|
191
|
-
return (scratchBytes[0] << 16) + (scratchBytes[1] << 8) + scratchBytes[2];
|
|
192
|
-
}
|
|
193
|
-
getAlpha() {
|
|
194
|
-
return ColorValue.getAlpha(this._tbgr);
|
|
195
|
-
}
|
|
196
|
-
static getAlpha(tbgr) {
|
|
197
|
-
scratchUInt32[0] = tbgr;
|
|
198
|
-
return 255 - scratchBytes[3];
|
|
199
|
-
}
|
|
200
|
-
toHexString(includeAlpha) {
|
|
201
|
-
if (includeAlpha) {
|
|
202
|
-
let value = this.getRgb(includeAlpha);
|
|
203
|
-
if (value < 0) value = 0xffffffff + value + 1;
|
|
204
|
-
return `#${`00000000${value.toString(16)}`.slice(-8)}`;
|
|
205
|
-
}
|
|
206
|
-
return `#${`000000${this.getRgb().toString(16)}`.slice(-6)}`;
|
|
207
|
-
}
|
|
208
|
-
static computeTbgrFromHSL(h, s, l, transparency = 0) {
|
|
209
|
-
let torgb = (p1, q1, t)=>{
|
|
210
|
-
if (t < 0) t += 1;
|
|
211
|
-
if (t > 1) t -= 1;
|
|
212
|
-
if (t < 1 / 6) return p1 + (q1 - p1) * 6 * t;
|
|
213
|
-
if (t < 0.5) return q1;
|
|
214
|
-
if (t < 2 / 3) return p1 + (q1 - p1) * 6 * (2 / 3 - t);
|
|
215
|
-
return p1;
|
|
216
|
-
};
|
|
217
|
-
let hue2rgb = (p1, q1, t)=>Math.round(255 * torgb(p1, q1, t));
|
|
218
|
-
let modulo = (n, m)=>(n % m + m) % m;
|
|
219
|
-
h = modulo(h, 1);
|
|
220
|
-
s = (0, _numbers.getBoundedValue)(s, 0, 1);
|
|
221
|
-
l = (0, _numbers.getBoundedValue)(l, 0, 1);
|
|
222
|
-
if (0 === s) {
|
|
223
|
-
l *= 255;
|
|
224
|
-
return this.computeTbgrFromComponents(l, l, l, transparency);
|
|
225
|
-
}
|
|
226
|
-
let p = l <= 0.5 ? l * (1 + s) : l + s - l * s;
|
|
227
|
-
let q = 2 * l - p;
|
|
228
|
-
return this.computeTbgrFromComponents(hue2rgb(q, p, h + 1 / 3), hue2rgb(q, p, h), hue2rgb(q, p, h - 1 / 3), transparency);
|
|
229
|
-
}
|
|
230
|
-
toHslColor() {
|
|
231
|
-
return {
|
|
232
|
-
...ColorValue.toHsl(this._tbgr),
|
|
233
|
-
...void 0 != this._hue && {
|
|
234
|
-
h: this._hue
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
static toHsl(tbgr) {
|
|
239
|
-
let { r, g, b } = ColorValue.getColors(tbgr);
|
|
240
|
-
let red = r / 255;
|
|
241
|
-
let green = g / 255;
|
|
242
|
-
let blue = b / 255;
|
|
243
|
-
let cMin = Math.min(red, green, blue);
|
|
244
|
-
let cMax = Math.max(red, green, blue);
|
|
245
|
-
let delta = cMax - cMin;
|
|
246
|
-
let hue = 0;
|
|
247
|
-
let saturation = 0;
|
|
248
|
-
hue = 0 === delta ? 0 : red === cMax ? (green - blue) / delta % 6 : green === cMax ? (blue - red) / delta + 2 : (red - green) / delta + 4;
|
|
249
|
-
hue = Math.round(60 * hue);
|
|
250
|
-
if (hue < 0) hue += 360;
|
|
251
|
-
let lightness = (cMax + cMin) / 2;
|
|
252
|
-
saturation = 0 === delta ? 0 : delta / (1 - Math.abs(2 * lightness - 1));
|
|
253
|
-
saturation = Number((100 * saturation).toFixed(1));
|
|
254
|
-
lightness = Number((100 * lightness).toFixed(1));
|
|
255
|
-
return {
|
|
256
|
-
h: hue,
|
|
257
|
-
s: saturation,
|
|
258
|
-
l: lightness,
|
|
259
|
-
a: this.getAlpha(tbgr) / 255
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
toRgbColor() {
|
|
263
|
-
let { r, g, b } = ColorValue.getColors(this._tbgr);
|
|
264
|
-
return {
|
|
265
|
-
r,
|
|
266
|
-
g,
|
|
267
|
-
b,
|
|
268
|
-
a: this.getAlpha() / 255
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
toHsvColor() {
|
|
272
|
-
return {
|
|
273
|
-
...ColorValue.toHsv(this._tbgr),
|
|
274
|
-
...void 0 != this._hue && {
|
|
275
|
-
h: this._hue
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
static toHsv(tbgr) {
|
|
280
|
-
let { r, g, b } = ColorValue.getColors(tbgr);
|
|
281
|
-
let red = r / 255;
|
|
282
|
-
let green = g / 255;
|
|
283
|
-
let blue = b / 255;
|
|
284
|
-
let cMin = Math.min(red, green, blue);
|
|
285
|
-
let cMax = Math.max(red, green, blue);
|
|
286
|
-
let delta = cMax - cMin;
|
|
287
|
-
let hue = 0;
|
|
288
|
-
hue = 0 === delta ? 0 : red === cMax ? (green - blue) / delta % 6 : green === cMax ? (blue - red) / delta + 2 : (red - green) / delta + 4;
|
|
289
|
-
hue = Math.round(60 * hue);
|
|
290
|
-
if (hue < 0) hue += 360;
|
|
291
|
-
let brightness = cMax;
|
|
292
|
-
let saturation = 0 === cMax ? 0 : delta / cMax;
|
|
293
|
-
saturation = Number((100 * saturation).toFixed(1));
|
|
294
|
-
brightness = Number((100 * brightness).toFixed(1));
|
|
295
|
-
return {
|
|
296
|
-
h: hue,
|
|
297
|
-
s: saturation,
|
|
298
|
-
v: brightness,
|
|
299
|
-
a: this.getAlpha(tbgr) / 255
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
equals(other) {
|
|
303
|
-
return this._tbgr === other._tbgr;
|
|
304
243
|
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
244
|
+
if (defaultColorIfNotParsed) return [defaultColorIfNotParsed, void 0];
|
|
245
|
+
throw new Error('unable to parse string into ColorValue');
|
|
246
|
+
}
|
|
247
|
+
static getColors(tbgr) {
|
|
248
|
+
scratchUInt32[0] = tbgr;
|
|
249
|
+
return {
|
|
250
|
+
b: scratchBytes[2],
|
|
251
|
+
g: scratchBytes[1],
|
|
252
|
+
r: scratchBytes[0],
|
|
253
|
+
t: scratchBytes[3],
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
getRgb(includeAlpha) {
|
|
257
|
+
scratchUInt32[0] = this._tbgr;
|
|
258
|
+
if (includeAlpha)
|
|
259
|
+
return (
|
|
260
|
+
(scratchBytes[0] << 24) +
|
|
261
|
+
(scratchBytes[1] << 16) +
|
|
262
|
+
(scratchBytes[2] << 8) +
|
|
263
|
+
(255 - scratchBytes[3])
|
|
264
|
+
);
|
|
265
|
+
return (scratchBytes[0] << 16) + (scratchBytes[1] << 8) + scratchBytes[2];
|
|
266
|
+
}
|
|
267
|
+
getAlpha() {
|
|
268
|
+
return ColorValue.getAlpha(this._tbgr);
|
|
269
|
+
}
|
|
270
|
+
static getAlpha(tbgr) {
|
|
271
|
+
scratchUInt32[0] = tbgr;
|
|
272
|
+
return 255 - scratchBytes[3];
|
|
273
|
+
}
|
|
274
|
+
toHexString(includeAlpha) {
|
|
275
|
+
if (includeAlpha) {
|
|
276
|
+
let value = this.getRgb(includeAlpha);
|
|
277
|
+
if (value < 0) value = 0xffffffff + value + 1;
|
|
278
|
+
return `#${`00000000${value.toString(16)}`.slice(-8)}`;
|
|
308
279
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
280
|
+
return `#${`000000${this.getRgb().toString(16)}`.slice(-6)}`;
|
|
281
|
+
}
|
|
282
|
+
static computeTbgrFromHSL(h, s, l, transparency = 0) {
|
|
283
|
+
let torgb = (p1, q1, t) => {
|
|
284
|
+
if (t < 0) t += 1;
|
|
285
|
+
if (t > 1) t -= 1;
|
|
286
|
+
if (t < 1 / 6) return p1 + (q1 - p1) * 6 * t;
|
|
287
|
+
if (t < 0.5) return q1;
|
|
288
|
+
if (t < 2 / 3) return p1 + (q1 - p1) * 6 * (2 / 3 - t);
|
|
289
|
+
return p1;
|
|
290
|
+
};
|
|
291
|
+
let hue2rgb = (p1, q1, t) => Math.round(255 * torgb(p1, q1, t));
|
|
292
|
+
let modulo = (n, m) => ((n % m) + m) % m;
|
|
293
|
+
h = modulo(h, 1);
|
|
294
|
+
s = (0, _numbers.getBoundedValue)(s, 0, 1);
|
|
295
|
+
l = (0, _numbers.getBoundedValue)(l, 0, 1);
|
|
296
|
+
if (0 === s) {
|
|
297
|
+
l *= 255;
|
|
298
|
+
return this.computeTbgrFromComponents(l, l, l, transparency);
|
|
317
299
|
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
300
|
+
let p = l <= 0.5 ? l * (1 + s) : l + s - l * s;
|
|
301
|
+
let q = 2 * l - p;
|
|
302
|
+
return this.computeTbgrFromComponents(
|
|
303
|
+
hue2rgb(q, p, h + 1 / 3),
|
|
304
|
+
hue2rgb(q, p, h),
|
|
305
|
+
hue2rgb(q, p, h - 1 / 3),
|
|
306
|
+
transparency,
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
toHslColor() {
|
|
310
|
+
return {
|
|
311
|
+
...ColorValue.toHsl(this._tbgr),
|
|
312
|
+
...(void 0 != this._hue && {
|
|
313
|
+
h: this._hue,
|
|
314
|
+
}),
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
static toHsl(tbgr) {
|
|
318
|
+
let { r, g, b } = ColorValue.getColors(tbgr);
|
|
319
|
+
let red = r / 255;
|
|
320
|
+
let green = g / 255;
|
|
321
|
+
let blue = b / 255;
|
|
322
|
+
let cMin = Math.min(red, green, blue);
|
|
323
|
+
let cMax = Math.max(red, green, blue);
|
|
324
|
+
let delta = cMax - cMin;
|
|
325
|
+
let hue = 0;
|
|
326
|
+
let saturation = 0;
|
|
327
|
+
hue =
|
|
328
|
+
0 === delta
|
|
329
|
+
? 0
|
|
330
|
+
: red === cMax
|
|
331
|
+
? ((green - blue) / delta) % 6
|
|
332
|
+
: green === cMax
|
|
333
|
+
? (blue - red) / delta + 2
|
|
334
|
+
: (red - green) / delta + 4;
|
|
335
|
+
hue = Math.round(60 * hue);
|
|
336
|
+
if (hue < 0) hue += 360;
|
|
337
|
+
let lightness = (cMax + cMin) / 2;
|
|
338
|
+
saturation = 0 === delta ? 0 : delta / (1 - Math.abs(2 * lightness - 1));
|
|
339
|
+
saturation = Number((100 * saturation).toFixed(1));
|
|
340
|
+
lightness = Number((100 * lightness).toFixed(1));
|
|
341
|
+
return {
|
|
342
|
+
h: hue,
|
|
343
|
+
s: saturation,
|
|
344
|
+
l: lightness,
|
|
345
|
+
a: this.getAlpha(tbgr) / 255,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
toRgbColor() {
|
|
349
|
+
let { r, g, b } = ColorValue.getColors(this._tbgr);
|
|
350
|
+
return {
|
|
351
|
+
r,
|
|
352
|
+
g,
|
|
353
|
+
b,
|
|
354
|
+
a: this.getAlpha() / 255,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
toHsvColor() {
|
|
358
|
+
return {
|
|
359
|
+
...ColorValue.toHsv(this._tbgr),
|
|
360
|
+
...(void 0 != this._hue && {
|
|
361
|
+
h: this._hue,
|
|
362
|
+
}),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
static toHsv(tbgr) {
|
|
366
|
+
let { r, g, b } = ColorValue.getColors(tbgr);
|
|
367
|
+
let red = r / 255;
|
|
368
|
+
let green = g / 255;
|
|
369
|
+
let blue = b / 255;
|
|
370
|
+
let cMin = Math.min(red, green, blue);
|
|
371
|
+
let cMax = Math.max(red, green, blue);
|
|
372
|
+
let delta = cMax - cMin;
|
|
373
|
+
let hue = 0;
|
|
374
|
+
hue =
|
|
375
|
+
0 === delta
|
|
376
|
+
? 0
|
|
377
|
+
: red === cMax
|
|
378
|
+
? ((green - blue) / delta) % 6
|
|
379
|
+
: green === cMax
|
|
380
|
+
? (blue - red) / delta + 2
|
|
381
|
+
: (red - green) / delta + 4;
|
|
382
|
+
hue = Math.round(60 * hue);
|
|
383
|
+
if (hue < 0) hue += 360;
|
|
384
|
+
let brightness = cMax;
|
|
385
|
+
let saturation = 0 === cMax ? 0 : delta / cMax;
|
|
386
|
+
saturation = Number((100 * saturation).toFixed(1));
|
|
387
|
+
brightness = Number((100 * brightness).toFixed(1));
|
|
388
|
+
return {
|
|
389
|
+
h: hue,
|
|
390
|
+
s: saturation,
|
|
391
|
+
v: brightness,
|
|
392
|
+
a: this.getAlpha(tbgr) / 255,
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
equals(other) {
|
|
396
|
+
return this._tbgr === other._tbgr;
|
|
397
|
+
}
|
|
398
|
+
static getFormattedColorNumber(value, precision = 1) {
|
|
399
|
+
if (0 === precision) Math.round(value).toString();
|
|
400
|
+
return Number(value.toFixed(precision)).toString();
|
|
401
|
+
}
|
|
402
|
+
toRgbString(includeAlpha) {
|
|
403
|
+
let rgb = this.toRgbColor();
|
|
404
|
+
let rgbString = `${rgb.r}, ${rgb.g}, ${rgb.b}`;
|
|
405
|
+
if (includeAlpha) {
|
|
406
|
+
let alpha = rgb.a ?? 1;
|
|
407
|
+
return `rgba(${rgbString}, ${ColorValue.getFormattedColorNumber(
|
|
408
|
+
alpha,
|
|
409
|
+
2,
|
|
410
|
+
)})`;
|
|
326
411
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
412
|
+
return `rgb(${rgbString})`;
|
|
413
|
+
}
|
|
414
|
+
toHslString(includeAlpha) {
|
|
415
|
+
let hsl = this.toHslColor();
|
|
416
|
+
let hslString = `${ColorValue.getFormattedColorNumber(
|
|
417
|
+
this._hue ?? hsl.h,
|
|
418
|
+
)}, ${ColorValue.getFormattedColorNumber(
|
|
419
|
+
hsl.s,
|
|
420
|
+
)}%, ${ColorValue.getFormattedColorNumber(hsl.l)}%`;
|
|
421
|
+
if (includeAlpha) {
|
|
422
|
+
let alpha = hsl.a ?? 1;
|
|
423
|
+
return `hsla(${hslString}, ${ColorValue.getFormattedColorNumber(
|
|
424
|
+
alpha,
|
|
425
|
+
2,
|
|
426
|
+
)})`;
|
|
335
427
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
428
|
+
return `hsl(${hslString})`;
|
|
429
|
+
}
|
|
430
|
+
toHsvString(includeAlpha) {
|
|
431
|
+
let hsv = this.toHsvColor();
|
|
432
|
+
let hsvString = `${this._hue ?? hsv.h}, ${hsv.s}%, ${hsv.v}%`;
|
|
433
|
+
if (includeAlpha) {
|
|
434
|
+
let alpha = hsv.a ?? 1;
|
|
435
|
+
return `hsva(${hsvString}, ${ColorValue.getFormattedColorNumber(
|
|
436
|
+
alpha,
|
|
437
|
+
2,
|
|
438
|
+
)})`;
|
|
342
439
|
}
|
|
440
|
+
return `hsv(${hsvString})`;
|
|
441
|
+
}
|
|
442
|
+
constructor(tbgr, hue) {
|
|
443
|
+
_define_property._(this, '_tbgr', void 0);
|
|
444
|
+
_define_property._(this, '_hue', void 0);
|
|
445
|
+
scratchUInt32[0] = tbgr;
|
|
446
|
+
this._tbgr = scratchUInt32[0];
|
|
447
|
+
this._hue = hue;
|
|
448
|
+
}
|
|
343
449
|
}
|