@ankhorage/zora 27.11.3 → 28.1.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 +12 -0
- package/README.md +4 -3
- package/dist/features/bottom-sheet/adapters/inbound/BottomSheet.js.map +1 -1
- package/dist/features/color/ColorHexField.d.ts +1 -1
- package/dist/features/color/ColorHexField.d.ts.map +1 -1
- package/dist/features/color/ColorHexField.js +30 -4
- package/dist/features/color/ColorHexField.js.map +1 -1
- package/dist/features/color/ColorPicker.d.ts +1 -1
- package/dist/features/color/ColorPicker.d.ts.map +1 -1
- package/dist/features/color/ColorPicker.js +174 -59
- package/dist/features/color/ColorPicker.js.map +1 -1
- package/dist/features/color/ColorWheel.d.ts +1 -1
- package/dist/features/color/ColorWheel.d.ts.map +1 -1
- package/dist/features/color/ColorWheel.js +61 -117
- package/dist/features/color/ColorWheel.js.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -1
- package/dist/features/color/ColorWheelKeyboardProxy.web.js +4 -4
- package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.d.ts +1 -0
- package/dist/features/color/ColorWheelPointerProxy.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts +3 -2
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.native.js +12 -3
- package/dist/features/color/ColorWheelPointerProxy.native.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts +2 -2
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.web.js +8 -5
- package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -1
- package/dist/features/color/public.d.ts +1 -1
- package/dist/features/color/public.d.ts.map +1 -1
- package/dist/features/color/public.js.map +1 -1
- package/dist/features/color/resolveColorPickerGeometry.d.ts +31 -0
- package/dist/features/color/resolveColorPickerGeometry.d.ts.map +1 -0
- package/dist/features/color/resolveColorPickerGeometry.js +94 -0
- package/dist/features/color/resolveColorPickerGeometry.js.map +1 -0
- package/dist/features/color/utils/resolveWheelColor.d.ts +2 -2
- package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -1
- package/dist/features/color/utils/resolveWheelColor.js +2 -3
- package/dist/features/color/utils/resolveWheelColor.js.map +1 -1
- package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
- package/dist/features/form/select/composition/SelectTrigger.js +2 -2
- package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types/color.d.ts +34 -26
- package/dist/types/color.d.ts.map +1 -1
- package/dist/types/color.js.map +1 -1
- package/dist/types/select.d.ts +2 -0
- package/dist/types/select.d.ts.map +1 -1
- package/dist/types/select.js.map +1 -1
- package/package.json +6 -6
- package/src/features/bottom-sheet/adapters/inbound/BottomSheet.tsx +1 -1
- package/src/features/color/ColorHexField.tsx +67 -23
- package/src/features/color/ColorPicker.layout.test.tsx +28 -24
- package/src/features/color/ColorPicker.tsx +449 -121
- package/src/features/color/ColorWheel.tsx +124 -248
- package/src/features/color/ColorWheelKeyboardProxy.tsx +1 -0
- package/src/features/color/ColorWheelKeyboardProxy.web.tsx +4 -3
- package/src/features/color/ColorWheelPointerProxy.native.tsx +25 -3
- package/src/features/color/ColorWheelPointerProxy.tsx +1 -0
- package/src/features/color/ColorWheelPointerProxy.web.tsx +12 -5
- package/src/features/color/public.ts +0 -2
- package/src/features/color/resolveColorPickerGeometry.test.ts +43 -0
- package/src/features/color/resolveColorPickerGeometry.ts +116 -0
- package/src/features/color/utils/resolveWheelColor.ts +2 -3
- package/src/features/form/select/adapters/inbound/Select.native.tsx +1 -1
- package/src/features/form/select/composition/SelectTrigger.tsx +2 -1
- package/src/index.ts +6 -2
- package/src/types/color.ts +34 -22
- package/src/types/select.ts +2 -0
- package/web-dist/chunks/{Accordion-h2nd5y0z.js → Accordion-01bsg7zt.js} +5 -5
- package/web-dist/chunks/{Accordion-6nrpdbmb.js → Accordion-01zvarrn.js} +8 -9
- package/web-dist/chunks/{Accordion-pmfdf08d.js → Accordion-0dj1r7w3.js} +1 -1
- package/web-dist/chunks/{Accordion-3zw817fr.js → Accordion-0xaq2k2h.js} +8 -8
- package/web-dist/chunks/{Accordion-gezcm372.js → Accordion-15sxxjym.js} +4 -5
- package/web-dist/chunks/{Accordion-eq27a9ms.js → Accordion-1fz55hk4.js} +1 -1
- package/web-dist/chunks/{Accordion-j0zhpq4s.js → Accordion-22cda3h5.js} +7 -8
- package/web-dist/chunks/{Accordion-jd26f516.js → Accordion-27yg9ktv.js} +3 -3
- package/web-dist/chunks/{Accordion-f60g73bp.js → Accordion-34b3rwbc.js} +6 -8
- package/web-dist/chunks/{Accordion-1etqb3cj.js → Accordion-3zzzw7a8.js} +2 -2
- package/web-dist/chunks/Accordion-46n609yq.js +253 -0
- package/web-dist/chunks/{Accordion-3jkeydhb.js → Accordion-4zb6dcys.js} +4 -7
- package/web-dist/chunks/{Accordion-dfq04q82.js → Accordion-5cjhz94e.js} +5 -5
- package/web-dist/chunks/{Accordion-49w9bc2f.js → Accordion-5mga7hty.js} +2 -2
- package/web-dist/chunks/{Accordion-kcx57mk5.js → Accordion-76b0qz8y.js} +24 -22
- package/web-dist/chunks/{Accordion-vewhx028.js → Accordion-78tknqmc.js} +4 -4
- package/web-dist/chunks/{Accordion-5vs1k81g.js → Accordion-7bd6zq4s.js} +9 -9
- package/web-dist/chunks/{Accordion-phtyg3k4.js → Accordion-8c4w7366.js} +5 -5
- package/web-dist/chunks/{Accordion-vk2v1zwv.js → Accordion-8t6vh482.js} +3 -4
- package/web-dist/chunks/{Accordion-an5prgty.js → Accordion-9d38cgqj.js} +88 -92
- package/web-dist/chunks/{Accordion-1mxnyexh.js → Accordion-9k7ktksc.js} +212 -215
- package/web-dist/chunks/{Accordion-aws0caav.js → Accordion-afpjg1d6.js} +3 -4
- package/web-dist/chunks/{Accordion-c3nna2bz.js → Accordion-b1y5mjac.js} +1 -1
- package/web-dist/chunks/{Accordion-eak89n4n.js → Accordion-b8w0f8s0.js} +6 -7
- package/web-dist/chunks/{Accordion-ne91vwkd.js → Accordion-bexwrnfh.js} +3 -4
- package/web-dist/chunks/Accordion-chdbfcm6.js +93 -0
- package/web-dist/chunks/{Accordion-6yv4beha.js → Accordion-d405whfb.js} +2 -2
- package/web-dist/chunks/{Accordion-xb174981.js → Accordion-de8srt4x.js} +8 -8
- package/web-dist/chunks/{Accordion-e3r3573t.js → Accordion-epv5yhch.js} +3 -3
- package/web-dist/chunks/{Accordion-g451f3g9.js → Accordion-f4919ghm.js} +4 -4
- package/web-dist/chunks/{Accordion-qhn8z92r.js → Accordion-f8a49gy8.js} +19 -22
- package/web-dist/chunks/{Accordion-3s7zeagv.js → Accordion-fdzyyqe9.js} +1 -1
- package/web-dist/chunks/Accordion-gnxmybxx.js +1331 -0
- package/web-dist/chunks/{Accordion-z8ryq8cb.js → Accordion-h1q243zq.js} +13 -11
- package/web-dist/chunks/{Accordion-dtt4qkrb.js → Accordion-h63c9k9k.js} +1 -1
- package/web-dist/chunks/{Accordion-rzf52xq8.js → Accordion-hdyzyw8q.js} +3 -3
- package/web-dist/chunks/{Accordion-3wkd5x2q.js → Accordion-htvmkx8s.js} +118 -118
- package/web-dist/chunks/{Accordion-0kr0h68p.js → Accordion-jmxe6kw0.js} +9 -11
- package/web-dist/chunks/{Accordion-705yrq6w.js → Accordion-kcm6jcpp.js} +2 -3
- package/web-dist/chunks/{Accordion-fcczvwgg.js → Accordion-mrstcjcm.js} +1 -0
- package/web-dist/chunks/{Accordion-p29kmwh9.js → Accordion-mx7nkg85.js} +1 -1
- package/web-dist/chunks/{Accordion-x0p3wxfp.js → Accordion-pdjhezmz.js} +2 -2
- package/web-dist/chunks/{Accordion-8g9c7890.js → Accordion-q046ws5p.js} +6 -6
- package/web-dist/chunks/{Accordion-jbwey4za.js → Accordion-q11svb96.js} +19 -19
- package/web-dist/chunks/{Accordion-bd6q61s1.js → Accordion-qkkeyr18.js} +6 -8
- package/web-dist/chunks/{Accordion-q1tdazgq.js → Accordion-qrt9xz0h.js} +7 -8
- package/web-dist/chunks/{Accordion-h0e95qxp.js → Accordion-qsppnx7g.js} +10 -11
- package/web-dist/chunks/{Accordion-neg1cgeh.js → Accordion-rhjddvkh.js} +1 -2
- package/web-dist/chunks/{Accordion-ysmzrvhn.js → Accordion-rtamzg9j.js} +47 -28
- package/web-dist/chunks/{Accordion-xwstve3k.js → Accordion-sfvqf4fz.js} +134 -132
- package/web-dist/chunks/{Accordion-9c63jn3m.js → Accordion-sh79sr5g.js} +5 -5
- package/web-dist/chunks/{Accordion-4g54je0w.js → Accordion-t9n4ey2r.js} +5 -3
- package/web-dist/chunks/{Accordion-e5jr9ahb.js → Accordion-tk8zf9ff.js} +3 -3
- package/web-dist/chunks/{Accordion-zypyr9xw.js → Accordion-tnyqv1xv.js} +296 -305
- package/web-dist/chunks/{Accordion-c0a7mhq3.js → Accordion-v6vhyv31.js} +95 -165
- package/web-dist/chunks/{Accordion-6m3k4avp.js → Accordion-vkqqktc5.js} +3 -3
- package/web-dist/chunks/{Accordion-z4qakakw.js → Accordion-vzq344av.js} +2 -3
- package/web-dist/chunks/{Accordion-pcj256bc.js → Accordion-wb9pmykz.js} +5 -6
- package/web-dist/chunks/{Accordion-x7ynjdv7.js → Accordion-ww4f12ty.js} +1 -1
- package/web-dist/chunks/{Accordion-zx8gmww4.js → Accordion-xb9zhdhp.js} +42 -45
- package/web-dist/chunks/{Accordion-3ecnh8d0.js → Accordion-xfkg7dcw.js} +4 -5
- package/web-dist/chunks/{Accordion-6ec4gxv2.js → Accordion-xzaa9s7f.js} +12 -23
- package/web-dist/chunks/{Accordion-vnrqvfca.js → Accordion-yrac5a7m.js} +1 -1
- package/web-dist/chunks/{zip-reader-f0yphjb9.js → zip-reader-5xrcmjr8.js} +1 -1
- package/web-dist/components/accordion/Accordion.js +11 -11
- package/web-dist/components/accordion-item/AccordionItem.js +11 -11
- package/web-dist/components/activity-indicator/ActivityIndicator.js +4 -4
- package/web-dist/components/app-bar/AppBar.js +18 -18
- package/web-dist/components/app-header/AppHeader.js +18 -18
- package/web-dist/components/app-shell/AppShell.js +5 -5
- package/web-dist/components/auth-screen/AuthScreen.js +21 -21
- package/web-dist/components/avatar/Avatar.js +11 -11
- package/web-dist/components/avatar-group/AvatarGroup.js +11 -11
- package/web-dist/components/badge/Badge.js +6 -6
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +19 -19
- package/web-dist/components/bottom-sheet/BottomSheet.js +10 -7
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +10 -7
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +10 -7
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +10 -7
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +10 -7
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +10 -7
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +13 -13
- package/web-dist/components/button/Button.js +11 -11
- package/web-dist/components/button-group/ButtonGroup.js +11 -11
- package/web-dist/components/calendar/Calendar.js +14 -14
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -19
- package/web-dist/components/card/Card.js +18 -18
- package/web-dist/components/card-back/CardBack.js +5 -5
- package/web-dist/components/card-hand/CardHand.js +5 -5
- package/web-dist/components/carousel/Carousel.js +2 -2
- package/web-dist/components/chat-list-item/ChatListItem.js +15 -15
- package/web-dist/components/checkbox/Checkbox.js +11 -11
- package/web-dist/components/checkbox-group/CheckboxGroup.js +11 -11
- package/web-dist/components/chess-board/ChessBoard.js +6 -6
- package/web-dist/components/chip/Chip.js +12 -12
- package/web-dist/components/chip-group/ChipGroup.js +12 -12
- package/web-dist/components/collection-editor/CollectionEditor.js +18 -18
- package/web-dist/components/color-hue-scale/ColorHueScale.js +28 -17
- package/web-dist/components/color-picker/ColorPicker.d.ts +2 -2
- package/web-dist/components/color-picker/ColorPicker.js +28 -17
- package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +34 -45
- package/web-dist/components/color-picker/index.d.ts +1 -1
- package/web-dist/components/color-tone/ColorTone.js +28 -17
- package/web-dist/components/color-wheel/ColorWheel.d.ts +1 -1
- package/web-dist/components/color-wheel/ColorWheel.js +28 -17
- package/web-dist/components/color-wheel/ColorWheel.types-0.d.ts +10 -0
- package/web-dist/components/content-rail/ContentRail.js +12 -12
- package/web-dist/components/data-table/DataTable.js +26 -26
- package/web-dist/components/date-picker/DatePicker.js +20 -20
- package/web-dist/components/dialog/Dialog.js +11 -11
- package/web-dist/components/divider/Divider.js +5 -5
- package/web-dist/components/empty-state/EmptyState.js +19 -19
- package/web-dist/components/explorer/Explorer.js +13 -13
- package/web-dist/components/field/Field.js +11 -11
- package/web-dist/components/file-explorer/FileExplorer.js +13 -13
- package/web-dist/components/flat-list/FlatList.js +12 -12
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +21 -21
- package/web-dist/components/form/Form.js +15 -15
- package/web-dist/components/form-actions/FormActions.js +15 -15
- package/web-dist/components/form-error/FormError.js +15 -15
- package/web-dist/components/game/Game.js +7 -6
- package/web-dist/components/game-entity/GameEntity.js +7 -6
- package/web-dist/components/game-field/GameField.js +7 -6
- package/web-dist/components/game-input-zone/GameInputZone.js +7 -6
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +7 -6
- package/web-dist/components/game-overlay/GameOverlay.js +7 -6
- package/web-dist/components/gradient/Gradient.js +6 -6
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +6 -6
- package/web-dist/components/graph-view/GraphView.js +2 -2
- package/web-dist/components/grid/Grid.js +5 -5
- package/web-dist/components/grid-interactions/GridInteractions.js +1 -1
- package/web-dist/components/grid-line-overlay/GridLineOverlay.js +5 -5
- package/web-dist/components/grid-ruler/GridRuler.js +5 -5
- package/web-dist/components/grid-view/GridView.js +1 -1
- package/web-dist/components/heading/Heading.js +6 -6
- package/web-dist/components/hero/Hero.js +18 -18
- package/web-dist/components/icon/Icon.js +5 -5
- package/web-dist/components/icon-button/IconButton.js +11 -11
- package/web-dist/components/image/Image.js +9 -9
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +4 -4
- package/web-dist/components/list/List.js +12 -12
- package/web-dist/components/list-item/ListItem.js +12 -12
- package/web-dist/components/list-section/ListSection.js +12 -12
- package/web-dist/components/master-detail/MasterDetail.js +5 -5
- package/web-dist/components/matrix-grid/MatrixGrid.js +9 -9
- package/web-dist/components/media-card/MediaCard.js +18 -18
- package/web-dist/components/media-explorer/MediaExplorer.js +13 -13
- package/web-dist/components/message-bubble/MessageBubble.js +15 -15
- package/web-dist/components/metric-card/MetricCard.js +18 -18
- package/web-dist/components/missing-element/MissingElement.js +10 -10
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -21
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -21
- package/web-dist/components/opening-book/OpeningBook.js +6 -6
- package/web-dist/components/otp-form/OtpForm.js +21 -21
- package/web-dist/components/pagination/Pagination.js +12 -12
- package/web-dist/components/palette-item/PaletteItem.js +18 -18
- package/web-dist/components/playing-card/PlayingCard.js +5 -5
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +5 -5
- package/web-dist/components/popover-menu/PopoverMenu.js +13 -13
- package/web-dist/components/post-card/PostCard.js +18 -18
- package/web-dist/components/product-card/ProductCard.js +18 -18
- package/web-dist/components/progress/Progress.js +9 -9
- package/web-dist/components/progress-ring/ProgressRing.js +9 -9
- package/web-dist/components/radio/Radio.js +13 -13
- package/web-dist/components/radio-group/RadioGroup.js +13 -13
- package/web-dist/components/rating/Rating.js +8 -8
- package/web-dist/components/reader/Reader.js +34 -34
- package/web-dist/components/scan-overlay/ScanOverlay.js +19 -19
- package/web-dist/components/screen/Screen.js +5 -5
- package/web-dist/components/screen-section/ScreenSection.js +9 -9
- package/web-dist/components/scroll-view/ScrollView.js +5 -5
- package/web-dist/components/search-input/SearchInput.js +13 -13
- package/web-dist/components/section-header/SectionHeader.js +9 -9
- package/web-dist/components/section-list/SectionList.js +12 -12
- package/web-dist/components/select/Select.js +23 -259
- package/web-dist/components/select/Select.types-0.d.ts +2 -0
- package/web-dist/components/selectable-item/SelectableItem.js +4 -4
- package/web-dist/components/selection-provider/SelectionProvider.js +4 -4
- package/web-dist/components/sign-in-form/SignInForm.js +21 -21
- package/web-dist/components/sign-up-form/SignUpForm.js +21 -21
- package/web-dist/components/skeleton/Skeleton.js +21 -21
- package/web-dist/components/skeleton-card/SkeletonCard.js +21 -21
- package/web-dist/components/skeleton-list/SkeletonList.js +21 -21
- package/web-dist/components/skeleton-text/SkeletonText.js +21 -21
- package/web-dist/components/spatial-grid/SpatialGrid.js +1 -1
- package/web-dist/components/surface/Surface.js +6 -6
- package/web-dist/components/switch/Switch.js +8 -8
- package/web-dist/components/tab/Tab.js +6 -6
- package/web-dist/components/tab-list/TabList.js +6 -6
- package/web-dist/components/tab-panel/TabPanel.js +6 -6
- package/web-dist/components/tabletop-table/TabletopTable.js +5 -5
- package/web-dist/components/tabs/Tabs.js +6 -6
- package/web-dist/components/text/Text.js +6 -6
- package/web-dist/components/text-input/TextInput.js +13 -13
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +11 -11
- package/web-dist/components/tile-grid/TileGrid.js +1 -1
- package/web-dist/components/time-grid/TimeGrid.js +2 -2
- package/web-dist/components/time-picker/TimePicker.js +18 -18
- package/web-dist/components/timeline/Timeline.js +11 -11
- package/web-dist/components/toast/Toast.js +9 -9
- package/web-dist/components/toast-provider/ToastProvider.js +9 -9
- package/web-dist/components/toolbar/Toolbar.js +18 -18
- package/web-dist/components/tree-item/TreeItem.js +17 -17
- package/web-dist/components/tree-view/TreeView.js +1 -1
- package/web-dist/components/uploader/Uploader.js +23 -23
- package/web-dist/components/view/View.js +5 -5
- package/web-dist/manifest.json +1950 -1877
- package/web-dist/runtime/ZoraProvider.js +9 -9
- package/web-dist/chunks/Accordion-r1wkgt7c.js +0 -1074
- package/web-dist/chunks/{Accordion-vgkvvdvg.js → Accordion-ykk40jz9.js} +36 -36
|
@@ -1,153 +1,97 @@
|
|
|
1
1
|
import { generateHarmonyRoleColors } from '@ankhorage/color-theory';
|
|
2
|
-
import { Button } from '@ankhorage/surface';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { Circle, Defs, Line,
|
|
5
|
-
import { View } from '../layout/public';
|
|
3
|
+
import { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';
|
|
6
4
|
import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
|
|
7
|
-
import { useZoraTheme } from '../theme/composition/useZoraTheme';
|
|
8
|
-
import { Text } from '../typography/public';
|
|
9
|
-
import { ColorHexField } from './ColorHexField';
|
|
10
|
-
import { ColorHorizontalPointerProxy } from './ColorHorizontalPointerProxy';
|
|
11
5
|
import { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';
|
|
12
6
|
import { ColorWheelPointerProxy } from './ColorWheelPointerProxy';
|
|
13
7
|
import { resolveColorHue } from './utils/resolveColorHue';
|
|
14
8
|
import { resolveOklchColor } from './utils/resolveOklchColor';
|
|
15
9
|
import { resolveWheelColor } from './utils/resolveWheelColor';
|
|
16
10
|
import { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
/***
|
|
11
|
+
const VIEWBOX = 1000;
|
|
12
|
+
const CENTER = VIEWBOX / 2;
|
|
13
|
+
const RADIUS = 480;
|
|
14
|
+
const SEGMENTS = 720;
|
|
15
|
+
const MAX_CHROMA = 0.2;
|
|
16
|
+
/*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */
|
|
23
17
|
export const ColorWheel = withZoraThemeScope(ColorWheelInner);
|
|
24
|
-
/***
|
|
25
|
-
function ColorWheelInner({ themeId: _themeId, mode: _mode, inverted: _inverted, interactionPolicy, value, harmony = null,
|
|
26
|
-
const { theme } = useZoraTheme();
|
|
18
|
+
/*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */
|
|
19
|
+
function ColorWheelInner({ themeId: _themeId, mode: _mode, inverted: _inverted, interactionPolicy, value, harmony = null, toneTarget, onChange, size = 340, testID, }) {
|
|
27
20
|
const hue = resolveColorHue(value);
|
|
28
21
|
const { chroma, lightness } = resolveWheelColorComponents(value);
|
|
29
|
-
const
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
const targetLightness = toneTarget?.lightness ?? lightness;
|
|
23
|
+
const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;
|
|
24
|
+
const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));
|
|
25
|
+
const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
|
|
26
|
+
const harmonyPoints = harmonyRoles.map((role) => ({
|
|
27
|
+
color: role.hex,
|
|
28
|
+
...pointFor(role.hueDegrees, Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma)),
|
|
29
|
+
}));
|
|
30
|
+
const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;
|
|
31
|
+
const changeAt = (x, y) => {
|
|
32
|
+
if (interactionPolicy !== 'passive')
|
|
33
|
+
onChange({
|
|
34
|
+
color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),
|
|
35
|
+
harmony,
|
|
36
|
+
});
|
|
41
37
|
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
harmony,
|
|
45
|
-
});
|
|
46
|
-
return (<View align="center" gap="s" testID={testID}>
|
|
47
|
-
<ColorWheelKeyboardProxy chroma={chroma} disabled={interactionPolicy === 'passive'} hue={hue} onChange={(nextHue, nextChroma) => onChange({
|
|
48
|
-
color: resolveOklchColor({ lightness: resolveWheelLightness(value), chroma: nextChroma }, nextHue),
|
|
38
|
+
return (<ColorWheelKeyboardProxy chroma={chroma} disabled={interactionPolicy === 'passive'} hue={hue} maxChroma={maximumChroma} onChange={(nextHue, nextChroma) => onChange({
|
|
39
|
+
color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),
|
|
49
40
|
harmony,
|
|
50
41
|
})}>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
54
|
-
changeColorAt(locationX, locationY);
|
|
55
|
-
}} onResponderMove={(event) => {
|
|
56
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
57
|
-
changeColorAt(locationX, locationY);
|
|
58
|
-
}} onResponderRelease={(event) => {
|
|
59
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
60
|
-
changeColorAt(locationX, locationY);
|
|
61
|
-
}} onStartShouldSetResponder={() => interactionPolicy !== 'passive'} width={WHEEL_SIZE}>
|
|
62
|
-
<Defs>
|
|
63
|
-
{resolveWheelSegments().map((segment) => (<RadialGradient cx={WHEEL_CENTER} cy={WHEEL_CENTER} id={`${wheelGradientId}-${segment.hue}`} key={segment.hue} r={WHEEL_RADIUS}>
|
|
64
|
-
<Stop offset="0" stopColor={resolveOklchColor({ lightness: 0.65, chroma: 0 }, segment.hue)}/>
|
|
65
|
-
<Stop offset="1" stopColor={segment.color}/>
|
|
66
|
-
</RadialGradient>))}
|
|
67
|
-
</Defs>
|
|
68
|
-
{resolveWheelSegments().map((segment) => (<Path d={segment.path} fill={`url(#${wheelGradientId}-${segment.hue})`} key={segment.hue}/>))}
|
|
69
|
-
{harmony === 'triadic' && harmonyPoints.length === 3 ? (<Polygon fill="none" points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')} stroke={theme.semantics.content.default} strokeWidth={2}/>) : (harmonyLines)}
|
|
70
|
-
{harmonyPoints.map((point) => (<Circle cx={point.x} cy={point.y} fill={theme.semantics.content.default} key={`${point.x}-${point.y}`} r={5}/>))}
|
|
71
|
-
<Circle cx={selectedPoint.x} cy={selectedPoint.y} fill="none" r={9} stroke={theme.semantics.content.default} strokeWidth={3}/>
|
|
72
|
-
</Svg>
|
|
73
|
-
</ColorWheelPointerProxy>
|
|
74
|
-
</ColorWheelKeyboardProxy>
|
|
75
|
-
<ColorLightnessSlider chroma={chroma} disabled={interactionPolicy === 'passive'} hue={hue} lightness={lightness} onChange={changeLightness} selectionBorderColor={theme.semantics.content.default}/>
|
|
76
|
-
<ColorHexField disabled={interactionPolicy === 'passive'} key={value} onChange={(color) => onChange({ color, harmony })} value={value}/>
|
|
77
|
-
{harmonies ? (<View direction="row" gap="xs" wrap="wrap">
|
|
78
|
-
<Button disabled={interactionPolicy === 'passive'} onPress={() => onChange({ color: value, harmony: null })} variant={harmony === null ? 'solid' : 'outline'}>
|
|
79
|
-
None
|
|
80
|
-
</Button>
|
|
81
|
-
{harmonies.map((candidate) => (<Button key={candidate} disabled={interactionPolicy === 'passive'} onPress={() => onChange({ color: value, harmony: candidate })} variant={harmony === candidate ? 'solid' : 'outline'}>
|
|
82
|
-
{candidate}
|
|
83
|
-
</Button>))}
|
|
84
|
-
</View>) : null}
|
|
85
|
-
</View>);
|
|
86
|
-
}
|
|
87
|
-
/*** Renders a continuous OKLCH lightness track without adding a second color persistence model. */
|
|
88
|
-
function ColorLightnessSlider({ chroma, disabled, hue, lightness, onChange, selectionBorderColor, }) {
|
|
89
|
-
const changeAt = (locationX) => {
|
|
90
|
-
if (!disabled)
|
|
91
|
-
onChange(Math.max(0, Math.min(1, locationX / WHEEL_SIZE)));
|
|
92
|
-
};
|
|
93
|
-
return (<View gap="xxs" width={WHEEL_SIZE}>
|
|
94
|
-
<View direction="row" justify="space-between">
|
|
95
|
-
<Text variant="label">Lightness</Text>
|
|
96
|
-
<Text variant="label">{`${Math.round(lightness * 100)}%`}</Text>
|
|
97
|
-
</View>
|
|
98
|
-
<ColorHorizontalPointerProxy disabled={disabled} onChange={changeAt} width={WHEEL_SIZE}>
|
|
99
|
-
<Svg accessibilityLabel="Color lightness" height={36} width={WHEEL_SIZE}>
|
|
42
|
+
<ColorWheelPointerProxy disabled={interactionPolicy === 'passive'} height={VIEWBOX} onChange={changeAt} renderedSize={size} width={VIEWBOX}>
|
|
43
|
+
<Svg accessibilityLabel="Color wheel" height={size} testID={testID} viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`} width={size}>
|
|
100
44
|
<Defs>
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
45
|
+
{segments(targetLightness, maximumChroma).map((segment) => (<RadialGradient cx={CENTER} cy={CENTER} gradientUnits="userSpaceOnUse" id={`${gradientId}-${segment.hue}`} key={segment.hue} r={RADIUS}>
|
|
46
|
+
<Stop offset="0" stopColor={segment.centerColor}/>
|
|
47
|
+
<Stop offset="1" stopColor={segment.color}/>
|
|
48
|
+
</RadialGradient>))}
|
|
105
49
|
</Defs>
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
50
|
+
{segments(targetLightness, maximumChroma).map((segment) => (<Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue}/>))}
|
|
51
|
+
{harmonyPoints.length >= 3 ? (<Polygon fill="none" points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')} stroke="white" strokeWidth={6}/>) : (linesFor(harmonyPoints, primaryPoint, 'white'))}
|
|
52
|
+
{harmonyPoints
|
|
53
|
+
.filter((point) => point.color !== value)
|
|
54
|
+
.map((point) => (<Circle cx={point.x} cy={point.y} fill={point.color} key={`${point.x}-${point.y}`} stroke="white" strokeWidth={6} r={26}/>))}
|
|
55
|
+
<Circle cx={primaryPoint.x} cy={primaryPoint.y} fill={value} r={36} stroke="white" strokeWidth={12}/>
|
|
56
|
+
<Circle cx={primaryPoint.x} cy={primaryPoint.y} fill="none" r={42} stroke="white" strokeWidth={6}/>
|
|
109
57
|
</Svg>
|
|
110
|
-
</
|
|
111
|
-
</
|
|
58
|
+
</ColorWheelPointerProxy>
|
|
59
|
+
</ColorWheelKeyboardProxy>);
|
|
112
60
|
}
|
|
113
|
-
/***
|
|
114
|
-
function
|
|
115
|
-
return Array.from({ length:
|
|
116
|
-
const hue = (index * 360) /
|
|
61
|
+
/*** Creates fine radial hue segments from the same OKLCH projection used for interaction. */
|
|
62
|
+
function segments(lightness, maximumChroma) {
|
|
63
|
+
return Array.from({ length: SEGMENTS }, (_, index) => {
|
|
64
|
+
const hue = (index * 360) / SEGMENTS;
|
|
117
65
|
return {
|
|
118
|
-
|
|
66
|
+
centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),
|
|
67
|
+
color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),
|
|
119
68
|
hue,
|
|
120
|
-
path:
|
|
69
|
+
path: segmentPath(hue, hue + 360 / SEGMENTS),
|
|
121
70
|
};
|
|
122
71
|
});
|
|
123
72
|
}
|
|
124
|
-
/***
|
|
125
|
-
function
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
return `M ${
|
|
73
|
+
/*** Describes one filled wheel segment in the stable coordinate system. */
|
|
74
|
+
function segmentPath(start, end) {
|
|
75
|
+
const startPoint = pointFor(start);
|
|
76
|
+
const endPoint = pointFor(end);
|
|
77
|
+
return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;
|
|
129
78
|
}
|
|
130
|
-
/***
|
|
131
|
-
function
|
|
79
|
+
/*** Projects an OKLCH hue and chroma ratio into the wheel coordinate system. */
|
|
80
|
+
function pointFor(hue, ratio = 1) {
|
|
132
81
|
const radians = ((hue - 90) * Math.PI) / 180;
|
|
133
82
|
return {
|
|
134
|
-
x:
|
|
135
|
-
y:
|
|
83
|
+
x: CENTER + RADIUS * ratio * Math.cos(radians),
|
|
84
|
+
y: CENTER + RADIUS * ratio * Math.sin(radians),
|
|
136
85
|
};
|
|
137
86
|
}
|
|
138
|
-
/***
|
|
139
|
-
function
|
|
87
|
+
/*** Connects derived harmony points behind their corresponding knobs. */
|
|
88
|
+
function linesFor(points, primary, stroke) {
|
|
140
89
|
return points.slice(1).reduce(({ lines, previous }, point) => ({
|
|
141
90
|
lines: [
|
|
142
91
|
...lines,
|
|
143
|
-
<Line key={`${previous.x}-${previous.y}-${point.x}-${point.y}`} stroke={stroke} strokeWidth={
|
|
92
|
+
<Line key={`${previous.x}-${previous.y}-${point.x}-${point.y}`} stroke={stroke} strokeWidth={6} x1={previous.x} x2={point.x} y1={previous.y} y2={point.y}/>,
|
|
144
93
|
],
|
|
145
94
|
previous: point,
|
|
146
|
-
}), { lines: [], previous: points.at(0) ??
|
|
147
|
-
}
|
|
148
|
-
/*** Read the selected color's lightness for wheel-only hue and chroma changes. */
|
|
149
|
-
function resolveWheelLightness(color) {
|
|
150
|
-
const { lightness } = resolveWheelColorComponents(color);
|
|
151
|
-
return lightness;
|
|
95
|
+
}), { lines: [], previous: points.at(0) ?? primary }).lines;
|
|
152
96
|
}
|
|
153
97
|
//# sourceMappingURL=ColorWheel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAiB,MAAM,yBAAyB,C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AC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACZ;SACH;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC,EACF,EAAE,KAAK,EAAE,EAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,aAAa,EAAE,CAC5E,CAAC,KAAK,CAAC;AACV,CAAC;AAED,kFAAkF;AAClF,SAAS,qBAAqB,CAAC,KAAe;IAC5C,MAAM,EAAE,SAAS,EAAE,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';\nimport { Button } from '@ankhorage/surface';\nimport React from 'react';\nimport {\n Circle,\n Defs,\n Line,\n LinearGradient,\n Path,\n Polygon,\n RadialGradient,\n Rect,\n Stop,\n Svg,\n} from 'react-native-svg';\n\nimport type { ColorWheelProps } from '../../types/color';\nimport { View } from '../layout/public';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { useZoraTheme } from '../theme/composition/useZoraTheme';\nimport { Text } from '../typography/public';\nimport { ColorHexField } from './ColorHexField';\nimport { ColorHorizontalPointerProxy } from './ColorHorizontalPointerProxy';\nimport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';\nimport { ColorWheelPointerProxy } from './ColorWheelPointerProxy';\nimport { resolveColorHue } from './utils/resolveColorHue';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\nimport { resolveWheelColor } from './utils/resolveWheelColor';\nimport { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';\n\nconst WHEEL_SIZE = 280;\nconst WHEEL_CENTER = WHEEL_SIZE / 2;\nconst WHEEL_RADIUS = 128;\nconst WHEEL_SEGMENT_COUNT = 72;\nconst WHEEL_MAX_CHROMA = 0.2;\n\n/*** Selects an OKLCH hue and optionally visualizes the existing color-theory harmony. */\nexport const ColorWheel = withZoraThemeScope(ColorWheelInner);\n\n/*** Renders a directly manipulable hue wheel and harmony controls without returning derived colors. */\nfunction ColorWheelInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n interactionPolicy,\n value,\n harmony = null,\n harmonies,\n onChange,\n testID,\n}: ColorWheelProps) {\n const { theme } = useZoraTheme();\n const hue = resolveColorHue(value);\n const { chroma, lightness } = resolveWheelColorComponents(value);\n const harmonyColors = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];\n const selectedPoint = resolveWheelPoint(hue, Math.min(1, chroma / WHEEL_MAX_CHROMA));\n const harmonyPoints = harmonyColors.map((color) => resolveWheelPoint(color.hueDegrees));\n const harmonyLines = resolveHarmonyLines(\n harmonyPoints,\n selectedPoint,\n theme.semantics.content.default,\n );\n const wheelGradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;\n const changeColorAt = (x: number, y: number) => {\n if (interactionPolicy === 'passive') return;\n onChange({\n color: resolveWheelColor(value, x, y, WHEEL_CENTER, WHEEL_RADIUS, WHEEL_MAX_CHROMA),\n harmony,\n });\n };\n const changeLightness = (nextLightness: number) =>\n onChange({\n color: resolveOklchColor({ chroma, lightness: Math.max(0, Math.min(1, nextLightness)) }, hue),\n harmony,\n });\n\n return (\n <View align=\"center\" gap=\"s\" testID={testID}>\n <ColorWheelKeyboardProxy\n chroma={chroma}\n disabled={interactionPolicy === 'passive'}\n hue={hue}\n onChange={(nextHue, nextChroma) =>\n onChange({\n color: resolveOklchColor(\n { lightness: resolveWheelLightness(value), chroma: nextChroma },\n nextHue,\n ),\n harmony,\n })\n }\n >\n <ColorWheelPointerProxy\n disabled={interactionPolicy === 'passive'}\n height={WHEEL_SIZE}\n onChange={changeColorAt}\n width={WHEEL_SIZE}\n >\n <Svg\n accessibilityLabel=\"Color wheel\"\n height={WHEEL_SIZE}\n onResponderGrant={(event) => {\n const { locationX, locationY } = event.nativeEvent;\n changeColorAt(locationX, locationY);\n }}\n onResponderMove={(event) => {\n const { locationX, locationY } = event.nativeEvent;\n changeColorAt(locationX, locationY);\n }}\n onResponderRelease={(event) => {\n const { locationX, locationY } = event.nativeEvent;\n changeColorAt(locationX, locationY);\n }}\n onStartShouldSetResponder={() => interactionPolicy !== 'passive'}\n width={WHEEL_SIZE}\n >\n <Defs>\n {resolveWheelSegments().map((segment) => (\n <RadialGradient\n cx={WHEEL_CENTER}\n cy={WHEEL_CENTER}\n id={`${wheelGradientId}-${segment.hue}`}\n key={segment.hue}\n r={WHEEL_RADIUS}\n >\n <Stop\n offset=\"0\"\n stopColor={resolveOklchColor({ lightness: 0.65, chroma: 0 }, segment.hue)}\n />\n <Stop offset=\"1\" stopColor={segment.color} />\n </RadialGradient>\n ))}\n </Defs>\n {resolveWheelSegments().map((segment) => (\n <Path\n d={segment.path}\n fill={`url(#${wheelGradientId}-${segment.hue})`}\n key={segment.hue}\n />\n ))}\n {harmony === 'triadic' && harmonyPoints.length === 3 ? (\n <Polygon\n fill=\"none\"\n points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}\n stroke={theme.semantics.content.default}\n strokeWidth={2}\n />\n ) : (\n harmonyLines\n )}\n {harmonyPoints.map((point) => (\n <Circle\n cx={point.x}\n cy={point.y}\n fill={theme.semantics.content.default}\n key={`${point.x}-${point.y}`}\n r={5}\n />\n ))}\n <Circle\n cx={selectedPoint.x}\n cy={selectedPoint.y}\n fill=\"none\"\n r={9}\n stroke={theme.semantics.content.default}\n strokeWidth={3}\n />\n </Svg>\n </ColorWheelPointerProxy>\n </ColorWheelKeyboardProxy>\n <ColorLightnessSlider\n chroma={chroma}\n disabled={interactionPolicy === 'passive'}\n hue={hue}\n lightness={lightness}\n onChange={changeLightness}\n selectionBorderColor={theme.semantics.content.default}\n />\n <ColorHexField\n disabled={interactionPolicy === 'passive'}\n key={value}\n onChange={(color) => onChange({ color, harmony })}\n value={value}\n />\n {harmonies ? (\n <View direction=\"row\" gap=\"xs\" wrap=\"wrap\">\n <Button\n disabled={interactionPolicy === 'passive'}\n onPress={() => onChange({ color: value, harmony: null })}\n variant={harmony === null ? 'solid' : 'outline'}\n >\n None\n </Button>\n {harmonies.map((candidate) => (\n <Button\n key={candidate}\n disabled={interactionPolicy === 'passive'}\n onPress={() => onChange({ color: value, harmony: candidate })}\n variant={harmony === candidate ? 'solid' : 'outline'}\n >\n {candidate}\n </Button>\n ))}\n </View>\n ) : null}\n </View>\n );\n}\n\n/*** Renders a continuous OKLCH lightness track without adding a second color persistence model. */\nfunction ColorLightnessSlider({\n chroma,\n disabled,\n hue,\n lightness,\n onChange,\n selectionBorderColor,\n}: {\n readonly chroma: number;\n readonly disabled: boolean;\n readonly hue: number;\n readonly lightness: number;\n readonly onChange: (lightness: number) => void;\n readonly selectionBorderColor: string;\n}) {\n const changeAt = (locationX: number) => {\n if (!disabled) onChange(Math.max(0, Math.min(1, locationX / WHEEL_SIZE)));\n };\n return (\n <View gap=\"xxs\" width={WHEEL_SIZE}>\n <View direction=\"row\" justify=\"space-between\">\n <Text variant=\"label\">Lightness</Text>\n <Text variant=\"label\">{`${Math.round(lightness * 100)}%`}</Text>\n </View>\n <ColorHorizontalPointerProxy disabled={disabled} onChange={changeAt} width={WHEEL_SIZE}>\n <Svg accessibilityLabel=\"Color lightness\" height={36} width={WHEEL_SIZE}>\n <Defs>\n <LinearGradient id=\"color-lightness\" x1=\"0\" x2=\"1\" y1=\"0\" y2=\"0\">\n <Stop offset=\"0\" stopColor={resolveOklchColor({ chroma, lightness: 0 }, hue)} />\n <Stop offset=\"1\" stopColor={resolveOklchColor({ chroma, lightness: 1 }, hue)} />\n </LinearGradient>\n </Defs>\n <Rect fill=\"url(#color-lightness)\" height={10} rx={5} y={13} width={WHEEL_SIZE} />\n <Circle\n cx={lightness * WHEEL_SIZE}\n cy={18}\n fill=\"white\"\n r={10}\n stroke={selectionBorderColor}\n strokeWidth={2}\n />\n <Rect\n fill=\"transparent\"\n height={36}\n onResponderGrant={(event) => changeAt(event.nativeEvent.locationX)}\n onResponderMove={(event) => changeAt(event.nativeEvent.locationX)}\n onResponderRelease={(event) => changeAt(event.nativeEvent.locationX)}\n onStartShouldSetResponder={() => !disabled}\n width={WHEEL_SIZE}\n />\n </Svg>\n </ColorHorizontalPointerProxy>\n </View>\n );\n}\n\n/*** Build the wheel's OKLCH segments from the existing conversion tool. */\nfunction resolveWheelSegments(): readonly {\n readonly color: HexColor;\n readonly hue: number;\n readonly path: string;\n}[] {\n return Array.from({ length: WHEEL_SEGMENT_COUNT }, (_, index) => {\n const hue = (index * 360) / WHEEL_SEGMENT_COUNT;\n return {\n color: resolveOklchColor({ lightness: 0.65, chroma: WHEEL_MAX_CHROMA }, hue),\n hue,\n path: resolveSegmentPath(hue, hue + 360 / WHEEL_SEGMENT_COUNT),\n };\n });\n}\n\n/*** Describe one wedge in the visual hue wheel. */\nfunction resolveSegmentPath(startHue: number, endHue: number): string {\n const start = resolveWheelPoint(startHue);\n const end = resolveWheelPoint(endHue);\n return `M ${WHEEL_CENTER} ${WHEEL_CENTER} L ${start.x} ${start.y} A ${WHEEL_RADIUS} ${WHEEL_RADIUS} 0 0 1 ${end.x} ${end.y} Z`;\n}\n\n/*** Convert a hue degree to the corresponding visual wheel coordinate. */\nfunction resolveWheelPoint(\n hue: number,\n radiusRatio = 1,\n): { readonly x: number; readonly y: number } {\n const radians = ((hue - 90) * Math.PI) / 180;\n return {\n x: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.cos(radians),\n y: WHEEL_CENTER + WHEEL_RADIUS * radiusRatio * Math.sin(radians),\n };\n}\n\n/*** Connect consecutive harmony points without dynamic collection indexing. */\nfunction resolveHarmonyLines(\n points: readonly { readonly x: number; readonly y: number }[],\n selectedPoint: { readonly x: number; readonly y: number },\n stroke: string,\n) {\n return points.slice(1).reduce(\n ({ lines, previous }, point) => ({\n lines: [\n ...lines,\n <Line\n key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}\n stroke={stroke}\n strokeWidth={2}\n x1={previous.x}\n x2={point.x}\n y1={previous.y}\n y2={point.y}\n />,\n ],\n previous: point,\n }),\n { lines: [] as React.ReactNode[], previous: points.at(0) ?? selectedPoint },\n ).lines;\n}\n\n/*** Read the selected color's lightness for wheel-only hue and chroma changes. */\nfunction resolveWheelLightness(color: HexColor): number {\n const { lightness } = resolveWheelColorComponents(color);\n return lightness;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ColorWheel.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAiB,MAAM,yBAAyB,CAAC;AACnF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAGhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAElF,MAAM,OAAO,GAAG,IAAI,CAAC;AACrB,MAAM,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC;AAC3B,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,QAAQ,GAAG,GAAG,CAAC;AACrB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,4FAA4F;AAC5F,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC;AAE9D,gGAAgG;AAChG,SAAS,eAAe,CAAC,E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AAC,CAAC,MAAM,CAC3B,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;QAC/B,KAAK,EAAE;YACL,GAAG,KAAK;YACR,CAAC,IAAI,CACH,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CACzD,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,WAAW,CAAC,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CACZ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACf,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EACZ;SACH;QACD,QAAQ,EAAE,KAAK;KAChB,CAAC,EACF,EAAE,KAAK,EAAE,EAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CACtE,CAAC,KAAK,CAAC;AACV,CAAC","sourcesContent":["import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';\nimport React from 'react';\nimport { Circle, Defs, Line, Path, Polygon, RadialGradient, Stop, Svg } from 'react-native-svg';\n\nimport type { ColorWheelProps } from '../../types/color';\nimport { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';\nimport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';\nimport { ColorWheelPointerProxy } from './ColorWheelPointerProxy';\nimport { resolveColorHue } from './utils/resolveColorHue';\nimport { resolveOklchColor } from './utils/resolveOklchColor';\nimport { resolveWheelColor } from './utils/resolveWheelColor';\nimport { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';\n\nconst VIEWBOX = 1000;\nconst CENTER = VIEWBOX / 2;\nconst RADIUS = 480;\nconst SEGMENTS = 720;\nconst MAX_CHROMA = 0.2;\n\n/*** Renders a size-owned, filled OKLCH wheel with controlled primary and harmony points. */\nexport const ColorWheel = withZoraThemeScope(ColorWheelInner);\n\n/*** Maps pointer and keyboard input through one viewBox into the controlled selected colour. */\nfunction ColorWheelInner({\n themeId: _themeId,\n mode: _mode,\n inverted: _inverted,\n interactionPolicy,\n value,\n harmony = null,\n toneTarget,\n onChange,\n size = 340,\n testID,\n}: ColorWheelProps) {\n const hue = resolveColorHue(value);\n const { chroma, lightness } = resolveWheelColorComponents(value);\n const targetLightness = toneTarget?.lightness ?? lightness;\n const maximumChroma = toneTarget?.chroma ?? MAX_CHROMA;\n const primaryPoint = pointFor(hue, Math.min(1, chroma / maximumChroma));\n const harmonyRoles = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];\n const harmonyPoints = harmonyRoles.map((role) => ({\n color: role.hex,\n ...pointFor(\n role.hueDegrees,\n Math.min(1, resolveWheelColorComponents(role.hex).chroma / maximumChroma),\n ),\n }));\n const gradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;\n const changeAt = (x: number, y: number) => {\n if (interactionPolicy !== 'passive')\n onChange({\n color: resolveWheelColor(value, x, y, CENTER, RADIUS, maximumChroma, targetLightness),\n harmony,\n });\n };\n return (\n <ColorWheelKeyboardProxy\n chroma={chroma}\n disabled={interactionPolicy === 'passive'}\n hue={hue}\n maxChroma={maximumChroma}\n onChange={(nextHue, nextChroma) =>\n onChange({\n color: resolveOklchColor({ chroma: nextChroma, lightness: targetLightness }, nextHue),\n harmony,\n })\n }\n >\n <ColorWheelPointerProxy\n disabled={interactionPolicy === 'passive'}\n height={VIEWBOX}\n onChange={changeAt}\n renderedSize={size}\n width={VIEWBOX}\n >\n <Svg\n accessibilityLabel=\"Color wheel\"\n height={size}\n testID={testID}\n viewBox={`0 0 ${VIEWBOX} ${VIEWBOX}`}\n width={size}\n >\n <Defs>\n {segments(targetLightness, maximumChroma).map((segment) => (\n <RadialGradient\n cx={CENTER}\n cy={CENTER}\n gradientUnits=\"userSpaceOnUse\"\n id={`${gradientId}-${segment.hue}`}\n key={segment.hue}\n r={RADIUS}\n >\n <Stop offset=\"0\" stopColor={segment.centerColor} />\n <Stop offset=\"1\" stopColor={segment.color} />\n </RadialGradient>\n ))}\n </Defs>\n {segments(targetLightness, maximumChroma).map((segment) => (\n <Path d={segment.path} fill={`url(#${gradientId}-${segment.hue})`} key={segment.hue} />\n ))}\n {harmonyPoints.length >= 3 ? (\n <Polygon\n fill=\"none\"\n points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}\n stroke=\"white\"\n strokeWidth={6}\n />\n ) : (\n linesFor(harmonyPoints, primaryPoint, 'white')\n )}\n {harmonyPoints\n .filter((point) => point.color !== value)\n .map((point) => (\n <Circle\n cx={point.x}\n cy={point.y}\n fill={point.color}\n key={`${point.x}-${point.y}`}\n stroke=\"white\"\n strokeWidth={6}\n r={26}\n />\n ))}\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill={value}\n r={36}\n stroke=\"white\"\n strokeWidth={12}\n />\n <Circle\n cx={primaryPoint.x}\n cy={primaryPoint.y}\n fill=\"none\"\n r={42}\n stroke=\"white\"\n strokeWidth={6}\n />\n </Svg>\n </ColorWheelPointerProxy>\n </ColorWheelKeyboardProxy>\n );\n}\n\n/*** Creates fine radial hue segments from the same OKLCH projection used for interaction. */\nfunction segments(\n lightness: number,\n maximumChroma: number,\n): readonly {\n readonly centerColor: HexColor;\n readonly color: HexColor;\n readonly hue: number;\n readonly path: string;\n}[] {\n return Array.from({ length: SEGMENTS }, (_, index) => {\n const hue = (index * 360) / SEGMENTS;\n return {\n centerColor: resolveOklchColor({ chroma: 0, lightness }, hue),\n color: resolveOklchColor({ chroma: maximumChroma, lightness }, hue),\n hue,\n path: segmentPath(hue, hue + 360 / SEGMENTS),\n };\n });\n}\n\n/*** Describes one filled wheel segment in the stable coordinate system. */\nfunction segmentPath(start: number, end: number) {\n const startPoint = pointFor(start);\n const endPoint = pointFor(end);\n return `M ${CENTER} ${CENTER} L ${startPoint.x} ${startPoint.y} A ${RADIUS} ${RADIUS} 0 0 1 ${endPoint.x} ${endPoint.y} Z`;\n}\n\n/*** Projects an OKLCH hue and chroma ratio into the wheel coordinate system. */\nfunction pointFor(hue: number, ratio = 1) {\n const radians = ((hue - 90) * Math.PI) / 180;\n return {\n x: CENTER + RADIUS * ratio * Math.cos(radians),\n y: CENTER + RADIUS * ratio * Math.sin(radians),\n };\n}\n\n/*** Connects derived harmony points behind their corresponding knobs. */\nfunction linesFor(\n points: readonly { readonly x: number; readonly y: number }[],\n primary: { readonly x: number; readonly y: number },\n stroke: string,\n) {\n return points.slice(1).reduce(\n ({ lines, previous }, point) => ({\n lines: [\n ...lines,\n <Line\n key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}\n stroke={stroke}\n strokeWidth={6}\n x1={previous.x}\n x2={point.x}\n y1={previous.y}\n y2={point.y}\n />,\n ],\n previous: point,\n }),\n { lines: [] as React.ReactNode[], previous: points.at(0) ?? primary },\n ).lines;\n}\n"]}
|
|
@@ -5,6 +5,7 @@ export interface ColorWheelKeyboardProxyProps {
|
|
|
5
5
|
readonly chroma: number;
|
|
6
6
|
readonly disabled: boolean;
|
|
7
7
|
readonly hue: number;
|
|
8
|
+
readonly maxChroma?: number;
|
|
8
9
|
readonly onChange: (hue: number, chroma: number) => void;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=ColorWheelKeyboardProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelKeyboardProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
|
|
1
|
+
{"version":3,"file":"ColorWheelKeyboardProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelKeyboardProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy.native';\n\nexport interface ColorWheelKeyboardProxyProps {\n readonly children: React.ReactNode;\n readonly chroma: number;\n readonly disabled: boolean;\n readonly hue: number;\n readonly onChange: (hue: number, chroma: number) => void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ColorWheelKeyboardProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy.native';\n\nexport interface ColorWheelKeyboardProxyProps {\n readonly children: React.ReactNode;\n readonly chroma: number;\n readonly disabled: boolean;\n readonly hue: number;\n readonly maxChroma?: number;\n readonly onChange: (hue: number, chroma: number) => void;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';
|
|
3
3
|
/*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */
|
|
4
|
-
export declare function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onChange, }: ColorWheelKeyboardProxyProps): React.JSX.Element;
|
|
4
|
+
export declare function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, maxChroma, onChange, }: ColorWheelKeyboardProxyProps): React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=ColorWheelKeyboardProxy.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelKeyboardProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,QAAQ,GACT,EAAE,4BAA4B,qBAqB9B"}
|
|
1
|
+
{"version":3,"file":"ColorWheelKeyboardProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAE9E,wFAAwF;AACxF,wBAAgB,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,SAAe,EACf,QAAQ,GACT,EAAE,4BAA4B,qBAqB9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */
|
|
2
|
-
export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onChange, }) {
|
|
2
|
+
export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, maxChroma = 0.2, onChange, }) {
|
|
3
3
|
return (<div aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`} aria-valuemax={360} aria-valuemin={0} aria-valuenow={Math.round(hue)} aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`} aria-disabled={disabled} onKeyDown={(event) => {
|
|
4
|
-
const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma);
|
|
4
|
+
const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);
|
|
5
5
|
if (!nextValue || disabled)
|
|
6
6
|
return;
|
|
7
7
|
event.preventDefault();
|
|
@@ -11,7 +11,7 @@ export function ColorWheelKeyboardProxy({ children, chroma, disabled, hue, onCha
|
|
|
11
11
|
</div>);
|
|
12
12
|
}
|
|
13
13
|
/*** Resolve portable arrow keys into bounded color-wheel increments. */
|
|
14
|
-
function resolveKeyboardWheelValue(key, hue, chroma) {
|
|
14
|
+
function resolveKeyboardWheelValue(key, hue, chroma, maxChroma) {
|
|
15
15
|
if (key === 'ArrowLeft')
|
|
16
16
|
return { chroma, hue: normalizeHue(hue - 5) };
|
|
17
17
|
if (key === 'ArrowRight')
|
|
@@ -19,7 +19,7 @@ function resolveKeyboardWheelValue(key, hue, chroma) {
|
|
|
19
19
|
if (key === 'ArrowDown')
|
|
20
20
|
return { chroma: Math.max(0, chroma - 0.02), hue };
|
|
21
21
|
if (key === 'ArrowUp')
|
|
22
|
-
return { chroma: Math.min(
|
|
22
|
+
return { chroma: Math.min(maxChroma, chroma + 0.02), hue };
|
|
23
23
|
return undefined;
|
|
24
24
|
}
|
|
25
25
|
/*** Normalize keyboard hue increments to the slider's documented range. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelKeyboardProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAIA,wFAAwF;AACxF,MAAM,UAAU,uBAAuB,CAAC,EACtC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,GAAG,EACH,QAAQ,GACqB;IAC7B,OAAO,CACL,CAAC,GAAG,CACF,UAAU,CAAC,CAAC,oBAAoB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/E,aAAa,CAAC,CAAC,GAAG,CAAC,CACnB,aAAa,CAAC,CAAC,CAAC,CAAC,CACjB,aAAa,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAC/B,cAAc,CAAC,CAAC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CACtE,aAAa,CAAC,CAAC,QAAQ,CAAC,CACxB,SAAS,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACnB,MAAM,SAAS,GAAG,yBAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"ColorWheelKeyboardProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelKeyboardProxy.web.tsx"],"names":[],"mappings":"AAIA,wFAAwF;A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M,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;IACvE,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC;IACxE,IAAI,GAAG,KAAK,WAAW;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAC5E,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IAClF,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,2EAA2E;AAC3E,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AAC5D,CAAC","sourcesContent":["import type React from 'react';\n\nimport type { ColorWheelKeyboardProxyProps } from './ColorWheelKeyboardProxy';\n\n/*** Bridges browser keyboard input to controlled OKLCH wheel hue and chroma changes. */\nexport function ColorWheelKeyboardProxy({\n children,\n chroma,\n disabled,\n hue,\n maxChroma = 0.2,\n onChange,\n}: ColorWheelKeyboardProxyProps) {\n return (\n <div\n aria-label={`Color wheel, hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-valuemax={360}\n aria-valuemin={0}\n aria-valuenow={Math.round(hue)}\n aria-valuetext={`Hue ${Math.round(hue)}, chroma ${chroma.toFixed(2)}`}\n aria-disabled={disabled}\n onKeyDown={(event) => {\n const nextValue = resolveKeyboardWheelValue(event.key, hue, chroma, maxChroma);\n if (!nextValue || disabled) return;\n event.preventDefault();\n onChange(nextValue.hue, nextValue.chroma);\n }}\n role=\"slider\"\n tabIndex={disabled ? -1 : 0}\n >\n {children}\n </div>\n );\n}\n\n/*** Resolve portable arrow keys into bounded color-wheel increments. */\nfunction resolveKeyboardWheelValue(key: string, hue: number, chroma: number, maxChroma: number) {\n if (key === 'ArrowLeft') return { chroma, hue: normalizeHue(hue - 5) };\n if (key === 'ArrowRight') return { chroma, hue: normalizeHue(hue + 5) };\n if (key === 'ArrowDown') return { chroma: Math.max(0, chroma - 0.02), hue };\n if (key === 'ArrowUp') return { chroma: Math.min(maxChroma, chroma + 0.02), hue };\n return undefined;\n}\n\n/*** Normalize keyboard hue increments to the slider's documented range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue >= 360 ? hue - 360 : hue;\n}\n"]}
|
|
@@ -5,6 +5,7 @@ export interface ColorWheelPointerProxyProps {
|
|
|
5
5
|
readonly disabled: boolean;
|
|
6
6
|
readonly height: number;
|
|
7
7
|
readonly onChange: (x: number, y: number) => void;
|
|
8
|
+
readonly renderedSize?: number;
|
|
8
9
|
readonly width: number;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=ColorWheelPointerProxy.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelPointerProxy } from './ColorWheelPointerProxy.native';\n\nexport interface ColorWheelPointerProxyProps {\n readonly children: React.ReactNode;\n readonly disabled: boolean;\n readonly height: number;\n readonly onChange: (x: number, y: number) => void;\n readonly width: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["import type React from 'react';\n\nexport { ColorWheelPointerProxy } from './ColorWheelPointerProxy.native';\n\nexport interface ColorWheelPointerProxyProps {\n readonly children: React.ReactNode;\n readonly disabled: boolean;\n readonly height: number;\n readonly onChange: (x: number, y: number) => void;\n readonly renderedSize?: number;\n readonly width: number;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
|
|
2
|
-
/***
|
|
3
|
-
export declare function ColorWheelPointerProxy({ children }: ColorWheelPointerProxyProps):
|
|
3
|
+
/*** Adds the sole native responder path to the SVG wheel. */
|
|
4
|
+
export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, width, renderedSize, }: ColorWheelPointerProxyProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.ReactElement<Record<string, unknown>, string | React.JSXElementConstructor<any>> | null | undefined;
|
|
4
5
|
//# sourceMappingURL=ColorWheelPointerProxy.native.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.native.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.native.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,YAAoB,GACrB,EAAE,2BAA2B,wWAe7B"}
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/*** Adds the sole native responder path to the SVG wheel. */
|
|
3
|
+
export function ColorWheelPointerProxy({ children, disabled, height, onChange, width, renderedSize = width, }) {
|
|
4
|
+
if (!React.isValidElement(children))
|
|
5
|
+
return children;
|
|
6
|
+
const changeAt = (event) => onChange((event.nativeEvent.locationX / renderedSize) * width, (event.nativeEvent.locationY / renderedSize) * height);
|
|
7
|
+
return React.cloneElement(children, {
|
|
8
|
+
onResponderGrant: disabled ? undefined : changeAt,
|
|
9
|
+
onResponderMove: disabled ? undefined : changeAt,
|
|
10
|
+
onResponderRelease: disabled ? undefined : changeAt,
|
|
11
|
+
onStartShouldSetResponder: () => !disabled,
|
|
12
|
+
});
|
|
4
13
|
}
|
|
5
14
|
//# sourceMappingURL=ColorWheelPointerProxy.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.native.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.native.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,6DAA6D;AAC7D,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,KAAK,EACL,YAAY,GAAG,KAAK,GACQ;IAC5B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IACrD,MAAM,QAAQ,GAAG,CAAC,KAEjB,EAAE,EAAE,CACH,QAAQ,CACN,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,KAAK,EACpD,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,MAAM,CACtD,CAAC;IACJ,OAAO,KAAK,CAAC,YAAY,CAAC,QAAuD,EAAE;QACjF,gBAAgB,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACjD,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QAChD,kBAAkB,EAAE,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ;QACnD,yBAAyB,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ;KAC3C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Adds the sole native responder path to the SVG wheel. */\nexport function ColorWheelPointerProxy({\n children,\n disabled,\n height,\n onChange,\n width,\n renderedSize = width,\n}: ColorWheelPointerProxyProps) {\n if (!React.isValidElement(children)) return children;\n const changeAt = (event: {\n readonly nativeEvent: { readonly locationX: number; readonly locationY: number };\n }) =>\n onChange(\n (event.nativeEvent.locationX / renderedSize) * width,\n (event.nativeEvent.locationY / renderedSize) * height,\n );\n return React.cloneElement(children as React.ReactElement<Record<string, unknown>>, {\n onResponderGrant: disabled ? undefined : changeAt,\n onResponderMove: disabled ? undefined : changeAt,\n onResponderRelease: disabled ? undefined : changeAt,\n onStartShouldSetResponder: () => !disabled,\n });\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
|
|
3
|
-
/*** Maps
|
|
4
|
-
export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, width, }: ColorWheelPointerProxyProps): React.JSX.Element;
|
|
3
|
+
/*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */
|
|
4
|
+
export declare function ColorWheelPointerProxy({ children, disabled, height, onChange, renderedSize: _renderedSize, width, }: ColorWheelPointerProxyProps): React.JSX.Element;
|
|
5
5
|
//# sourceMappingURL=ColorWheelPointerProxy.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.web.d.ts","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAE5E,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,KAAK,GACN,EAAE,2BAA2B,qBAoC7B"}
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/*** Maps
|
|
3
|
-
export function ColorWheelPointerProxy({ children, disabled, height, onChange, width, }) {
|
|
2
|
+
/*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */
|
|
3
|
+
export function ColorWheelPointerProxy({ children, disabled, height, onChange, renderedSize: _renderedSize, width, }) {
|
|
4
4
|
const dragging = React.useRef(false);
|
|
5
5
|
const changeAt = (event) => {
|
|
6
6
|
const target = event.currentTarget;
|
|
7
7
|
const rect = target.getBoundingClientRect();
|
|
8
8
|
onChange(((event.clientX - rect.left) / rect.width) * width, ((event.clientY - rect.top) / rect.height) * height);
|
|
9
9
|
};
|
|
10
|
-
return (<div
|
|
10
|
+
return (<div onPointerDown={(event) => {
|
|
11
11
|
if (disabled)
|
|
12
12
|
return;
|
|
13
13
|
dragging.current = true;
|
|
14
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
14
15
|
changeAt(event);
|
|
15
|
-
}}
|
|
16
|
+
}} onPointerMove={(event) => {
|
|
16
17
|
if (!disabled && dragging.current)
|
|
17
18
|
changeAt(event);
|
|
18
|
-
}}
|
|
19
|
+
}} onPointerUp={(event) => {
|
|
19
20
|
if (!disabled && dragging.current)
|
|
20
21
|
changeAt(event);
|
|
21
22
|
dragging.current = false;
|
|
23
|
+
}} onPointerCancel={() => {
|
|
24
|
+
dragging.current = false;
|
|
22
25
|
}} style={{ touchAction: 'none' }}>
|
|
23
26
|
{children}
|
|
24
27
|
</div>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorWheelPointerProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,
|
|
1
|
+
{"version":3,"file":"ColorWheelPointerProxy.web.js","sourceRoot":"","sources":["../../../src/features/color/ColorWheelPointerProxy.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,kGAAkG;AAClG,MAAM,UAAU,sBAAsB,CAAC,EACrC,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,YAAY,EAAE,aAAa,EAC3B,KAAK,GACuB;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,CAAC,KAAyC,EAAE,EAAE;QAC7D,MAAM,MAAM,GAAG,KAAK,CAAC,aAAgD,CAAC;QACtE,MAAM,IAAI,GAAG,MAAM,CAAC,qBAAqB,EAAE,CAAC;QAC5C,QAAQ,CACN,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,EAClD,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,MAAM,CACpD,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,CAAC,GAAG,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;YAEtB,KAAK,CAAC,aACP,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YACrC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,CAAC,CACF,aAAa,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACvB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;QACrD,CAAC,CAAC,CACF,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO;gBAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnD,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,eAAe,CAAC,CAAC,GAAG,EAAE;YACpB,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,CAAC,CAAC,CACF,KAAK,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC,CAE/B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React from 'react';\n\nimport type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';\n\n/*** Maps mouse, pen and touch coordinates into the wheel viewBox for click and drag selection. */\nexport function ColorWheelPointerProxy({\n children,\n disabled,\n height,\n onChange,\n renderedSize: _renderedSize,\n width,\n}: ColorWheelPointerProxyProps) {\n const dragging = React.useRef(false);\n const changeAt = (event: React.PointerEvent<HTMLDivElement>) => {\n const target = event.currentTarget as unknown as BrowserPointerTarget;\n const rect = target.getBoundingClientRect();\n onChange(\n ((event.clientX - rect.left) / rect.width) * width,\n ((event.clientY - rect.top) / rect.height) * height,\n );\n };\n\n return (\n <div\n onPointerDown={(event) => {\n if (disabled) return;\n dragging.current = true;\n (\n event.currentTarget as unknown as { setPointerCapture: (pointerId: number) => void }\n ).setPointerCapture(event.pointerId);\n changeAt(event);\n }}\n onPointerMove={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n }}\n onPointerUp={(event) => {\n if (!disabled && dragging.current) changeAt(event);\n dragging.current = false;\n }}\n onPointerCancel={() => {\n dragging.current = false;\n }}\n style={{ touchAction: 'none' }}\n >\n {children}\n </div>\n );\n}\n\ninterface BrowserPointerTarget {\n readonly getBoundingClientRect: () => {\n readonly height: number;\n readonly left: number;\n readonly top: number;\n readonly width: number;\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { ColorHueScaleProps, ColorPickerProps,
|
|
1
|
+
export type { ColorHueScaleProps, ColorPickerProps, ColorPickerTab, ColorToneDefinition, ColorToneProps, ColorToneSelection, ColorToneTarget, ColorWheelProps, ColorWheelSelection, } from '../../types/color';
|
|
2
2
|
export { ColorHueScale } from './ColorHueScale';
|
|
3
3
|
export { ColorPicker } from './ColorPicker';
|
|
4
4
|
export { ColorTone } from './ColorTone';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/color/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/features/color/public.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/color/public.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public.js","sourceRoot":"","sources":["../../../src/features/color/public.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC","sourcesContent":["export type {\n ColorHueScaleProps,\n ColorPickerProps,\n ColorPickerTab,\n ColorToneDefinition,\n ColorToneProps,\n ColorToneSelection,\n ColorToneTarget,\n ColorWheelProps,\n ColorWheelSelection,\n} from '../../types/color';\nexport { ColorHueScale } from './ColorHueScale';\nexport { ColorPicker } from './ColorPicker';\nexport { ColorTone } from './ColorTone';\nexport { ColorWheel } from './ColorWheel';\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*** Resolves one coherent ColorPicker geometry from the host's actual available bounds. */
|
|
2
|
+
export declare function resolveColorPickerGeometry(input: {
|
|
3
|
+
readonly height?: number;
|
|
4
|
+
readonly hostHeight?: number;
|
|
5
|
+
readonly hostWidth?: number;
|
|
6
|
+
readonly showTabs: boolean;
|
|
7
|
+
readonly width?: number;
|
|
8
|
+
}): {
|
|
9
|
+
insufficientSpace: boolean;
|
|
10
|
+
minimumHeight: number;
|
|
11
|
+
minimumWidth: number;
|
|
12
|
+
border: number;
|
|
13
|
+
cardGap: number;
|
|
14
|
+
cardHeight: number;
|
|
15
|
+
footerGap: number;
|
|
16
|
+
footerHeight: number;
|
|
17
|
+
footerInset: number;
|
|
18
|
+
gap: number;
|
|
19
|
+
headerHeight: number;
|
|
20
|
+
height: number;
|
|
21
|
+
infoLineHeight: number;
|
|
22
|
+
mainGap: number;
|
|
23
|
+
padding: number;
|
|
24
|
+
rail: number;
|
|
25
|
+
scale: number;
|
|
26
|
+
settingsHeight: number;
|
|
27
|
+
stage: number;
|
|
28
|
+
tabHeight: number;
|
|
29
|
+
width: number;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=resolveColorPickerGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveColorPickerGeometry.d.ts","sourceRoot":"","sources":["../../../src/features/color/resolveColorPickerGeometry.ts"],"names":[],"mappings":"AAGA,2FAA2F;AAC3F,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;;;;;;;;;;;;;;;;;;;;;;EAmBA"}
|