@ankhorage/zora 27.10.3 → 27.10.5
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 +13 -0
- package/README.md +1 -1
- package/dist/features/color/ColorHexField.d.ts +9 -0
- package/dist/features/color/ColorHexField.d.ts.map +1 -0
- package/dist/features/color/ColorHexField.js +17 -0
- package/dist/features/color/ColorHexField.js.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.d.ts +9 -0
- package/dist/features/color/ColorHorizontalPointerProxy.d.ts.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.js +2 -0
- package/dist/features/color/ColorHorizontalPointerProxy.js.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.native.d.ts +4 -0
- package/dist/features/color/ColorHorizontalPointerProxy.native.d.ts.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.native.js +5 -0
- package/dist/features/color/ColorHorizontalPointerProxy.native.js.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.web.d.ts +5 -0
- package/dist/features/color/ColorHorizontalPointerProxy.web.d.ts.map +1 -0
- package/dist/features/color/ColorHorizontalPointerProxy.web.js +26 -0
- package/dist/features/color/ColorHorizontalPointerProxy.web.js.map +1 -0
- package/dist/features/color/ColorHueScale.d.ts.map +1 -1
- package/dist/features/color/ColorHueScale.js +18 -7
- package/dist/features/color/ColorHueScale.js.map +1 -1
- package/dist/features/color/ColorPicker.d.ts.map +1 -1
- package/dist/features/color/ColorPicker.js +37 -10
- package/dist/features/color/ColorPicker.js.map +1 -1
- package/dist/features/color/ColorSpectrumSlider.d.ts +9 -0
- package/dist/features/color/ColorSpectrumSlider.d.ts.map +1 -0
- package/dist/features/color/ColorSpectrumSlider.js +38 -0
- package/dist/features/color/ColorSpectrumSlider.js.map +1 -0
- package/dist/features/color/ColorTone.d.ts.map +1 -1
- package/dist/features/color/ColorTone.js +71 -12
- package/dist/features/color/ColorTone.js.map +1 -1
- package/dist/features/color/ColorWheel.d.ts.map +1 -1
- package/dist/features/color/ColorWheel.js +64 -36
- package/dist/features/color/ColorWheel.js.map +1 -1
- package/dist/features/color/ColorWheelPointerProxy.d.ts +10 -0
- package/dist/features/color/ColorWheelPointerProxy.d.ts.map +1 -0
- package/dist/features/color/ColorWheelPointerProxy.js +2 -0
- package/dist/features/color/ColorWheelPointerProxy.js.map +1 -0
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts +4 -0
- package/dist/features/color/ColorWheelPointerProxy.native.d.ts.map +1 -0
- package/dist/features/color/ColorWheelPointerProxy.native.js +5 -0
- package/dist/features/color/ColorWheelPointerProxy.native.js.map +1 -0
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts +5 -0
- package/dist/features/color/ColorWheelPointerProxy.web.d.ts.map +1 -0
- package/dist/features/color/ColorWheelPointerProxy.web.js +26 -0
- package/dist/features/color/ColorWheelPointerProxy.web.js.map +1 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js +14 -2
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
- package/dist/types/color.d.ts +2 -0
- package/dist/types/color.d.ts.map +1 -1
- package/dist/types/color.js.map +1 -1
- package/package.json +2 -2
- package/src/features/color/ColorHexField.tsx +45 -0
- package/src/features/color/ColorHorizontalPointerProxy.native.tsx +6 -0
- package/src/features/color/ColorHorizontalPointerProxy.tsx +10 -0
- package/src/features/color/ColorHorizontalPointerProxy.web.tsx +45 -0
- package/src/features/color/ColorHueScale.tsx +48 -29
- package/src/features/color/ColorPicker.layout.test.tsx +72 -0
- package/src/features/color/ColorPicker.tsx +74 -20
- package/src/features/color/ColorSpectrumSlider.tsx +79 -0
- package/src/features/color/ColorTone.tsx +138 -21
- package/src/features/color/ColorWheel.tsx +173 -92
- package/src/features/color/ColorWheelPointerProxy.native.tsx +6 -0
- package/src/features/color/ColorWheelPointerProxy.tsx +11 -0
- package/src/features/color/ColorWheelPointerProxy.web.tsx +51 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +18 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +18 -2
- package/src/types/color.ts +2 -0
- package/web-dist/chunks/{Accordion-mxad79vq.js → Accordion-0kr0h68p.js} +4568 -669
- package/web-dist/chunks/{Accordion-0jkpvxwd.js → Accordion-1etqb3cj.js} +2 -2
- package/web-dist/chunks/{Accordion-jr0201qc.js → Accordion-1mxnyexh.js} +17 -17
- package/web-dist/chunks/{Accordion-9kkfz7s8.js → Accordion-3ecnh8d0.js} +4 -4
- package/web-dist/chunks/{Accordion-jsapannb.js → Accordion-3jkeydhb.js} +4 -4
- package/web-dist/chunks/{Accordion-r6gwemh9.js → Accordion-3wkd5x2q.js} +3 -3
- package/web-dist/chunks/{Accordion-0bgzetnd.js → Accordion-3zw817fr.js} +6 -6
- package/web-dist/chunks/{Accordion-91v243pz.js → Accordion-49w9bc2f.js} +2 -2
- package/web-dist/chunks/{Accordion-8vw4k0s6.js → Accordion-4g54je0w.js} +2 -2
- package/web-dist/chunks/{Accordion-1andv7gg.js → Accordion-5vs1k81g.js} +8 -8
- package/web-dist/chunks/{Accordion-ttjyk97v.js → Accordion-6m3k4avp.js} +2 -2
- package/web-dist/chunks/{Accordion-dnfrzbpb.js → Accordion-6nrpdbmb.js} +7 -7
- package/web-dist/chunks/{Accordion-y524ph0g.js → Accordion-6yv4beha.js} +1 -1
- package/web-dist/chunks/{Accordion-9cpm8x92.js → Accordion-705yrq6w.js} +1 -1
- package/web-dist/chunks/{Accordion-th8pkeqc.js → Accordion-8g9c7890.js} +4 -4
- package/web-dist/chunks/{Accordion-6qesggn9.js → Accordion-9c63jn3m.js} +4 -4
- package/web-dist/chunks/{Accordion-1mjn0atk.js → Accordion-aws0caav.js} +3 -3
- package/web-dist/chunks/{Accordion-hha54x4c.js → Accordion-bd6q61s1.js} +5 -5
- package/web-dist/chunks/{Accordion-8rkwd0wx.js → Accordion-c0a7mhq3.js} +2 -2
- package/web-dist/chunks/{Accordion-j5wsx41j.js → Accordion-c3nna2bz.js} +1 -1
- package/web-dist/chunks/{Accordion-r6mc7qtj.js → Accordion-dfq04q82.js} +9 -9
- package/web-dist/chunks/{Accordion-nbje2ywp.js → Accordion-e3r3573t.js} +3 -3
- package/web-dist/chunks/{Accordion-hqg1zbxk.js → Accordion-e5jr9ahb.js} +1 -1
- package/web-dist/chunks/{Accordion-pkbvsn5y.js → Accordion-eak89n4n.js} +6 -6
- package/web-dist/chunks/{Accordion-7e0mb55z.js → Accordion-f60g73bp.js} +6 -6
- package/web-dist/chunks/{Accordion-grtf75xt.js → Accordion-g451f3g9.js} +4 -4
- package/web-dist/chunks/{Accordion-27rxpbvf.js → Accordion-gezcm372.js} +4 -4
- package/web-dist/chunks/{Accordion-45tbe5v0.js → Accordion-h0e95qxp.js} +9 -9
- package/web-dist/chunks/{Accordion-m7jt3c87.js → Accordion-h2nd5y0z.js} +5 -5
- package/web-dist/chunks/{Accordion-f6k281sv.js → Accordion-j0zhpq4s.js} +7 -7
- package/web-dist/chunks/{Accordion-q6xnm1k4.js → Accordion-jbwey4za.js} +17 -17
- package/web-dist/chunks/{Accordion-vdqc8rxv.js → Accordion-jd26f516.js} +3 -3
- package/web-dist/chunks/{Accordion-1k7pyxdd.js → Accordion-ne91vwkd.js} +2 -2
- package/web-dist/chunks/{Accordion-k058095e.js → Accordion-p29kmwh9.js} +1 -1
- package/web-dist/chunks/{Accordion-0pbcs0xf.js → Accordion-pcj256bc.js} +5 -5
- package/web-dist/chunks/{Accordion-8wq38d9b.js → Accordion-phtyg3k4.js} +7 -7
- package/web-dist/chunks/{Accordion-b991pn6e.js → Accordion-pmfdf08d.js} +1 -1
- package/web-dist/chunks/{Accordion-xp2t3pkj.js → Accordion-q1tdazgq.js} +8 -8
- package/web-dist/chunks/{Accordion-v21vz0cg.js → Accordion-qhn8z92r.js} +3 -3
- package/web-dist/chunks/Accordion-r1wkgt7c.js +1074 -0
- package/web-dist/chunks/{Accordion-ctcxh9pk.js → Accordion-rzf52xq8.js} +2 -2
- package/web-dist/chunks/{Accordion-hrxdchkq.js → Accordion-vewhx028.js} +8 -8
- package/web-dist/chunks/{Accordion-jsdjgfn2.js → Accordion-vk2v1zwv.js} +2 -2
- package/web-dist/chunks/{Accordion-19zt3dyq.js → Accordion-vnrqvfca.js} +1 -1
- package/web-dist/chunks/{Accordion-rt4jfq2r.js → Accordion-x0p3wxfp.js} +2 -2
- package/web-dist/chunks/{Accordion-w1ag7sr4.js → Accordion-x7ynjdv7.js} +1 -1
- package/web-dist/chunks/{Accordion-ga82tcs9.js → Accordion-xb174981.js} +10 -10
- package/web-dist/chunks/{Accordion-yskcfahv.js → Accordion-xwstve3k.js} +2 -2
- package/web-dist/chunks/{Accordion-xb2nj0q6.js → Accordion-ysmzrvhn.js} +3 -3
- package/web-dist/chunks/{Accordion-tnq8bt8v.js → Accordion-z4qakakw.js} +2 -2
- package/web-dist/chunks/{Accordion-w9vbdg9r.js → Accordion-z8ryq8cb.js} +11 -11
- package/web-dist/chunks/{Accordion-x3em7tpd.js → Accordion-zx8gmww4.js} +9 -9
- package/web-dist/components/accordion/Accordion.js +10 -10
- package/web-dist/components/accordion-item/AccordionItem.js +10 -10
- package/web-dist/components/activity-indicator/ActivityIndicator.js +3 -3
- package/web-dist/components/app-bar/AppBar.js +15 -16
- package/web-dist/components/app-header/AppHeader.js +15 -16
- package/web-dist/components/app-shell/AppShell.js +4 -4
- package/web-dist/components/auth-screen/AuthScreen.js +20 -21
- package/web-dist/components/avatar/Avatar.js +10 -10
- package/web-dist/components/avatar-group/AvatarGroup.js +10 -10
- package/web-dist/components/badge/Badge.js +5 -5
- package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +18 -19
- package/web-dist/components/bottom-sheet/BottomSheet.js +6 -6
- package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +6 -6
- package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +6 -6
- package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +6 -6
- package/web-dist/components/bottom-sheet-view/BottomSheetView.js +6 -6
- package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +6 -6
- package/web-dist/components/breadcrumbs/Breadcrumbs.js +15 -16
- package/web-dist/components/button/Button.js +13 -14
- package/web-dist/components/button-group/ButtonGroup.js +11 -12
- package/web-dist/components/calendar/Calendar.js +12 -13
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +18 -19
- package/web-dist/components/card/Card.js +17 -18
- package/web-dist/components/card-back/CardBack.js +4 -4
- package/web-dist/components/card-hand/CardHand.js +4 -4
- package/web-dist/components/carousel/Carousel.js +2 -2
- package/web-dist/components/chat-list-item/ChatListItem.js +14 -14
- package/web-dist/components/checkbox/Checkbox.js +10 -10
- package/web-dist/components/checkbox-group/CheckboxGroup.js +10 -10
- package/web-dist/components/chess-board/ChessBoard.js +4 -4
- package/web-dist/components/chip/Chip.js +11 -11
- package/web-dist/components/chip-group/ChipGroup.js +11 -11
- package/web-dist/components/collection-editor/CollectionEditor.js +21 -22
- package/web-dist/components/color-hue-scale/ColorHueScale.js +15 -14
- package/web-dist/components/color-picker/ColorPicker.js +15 -14
- package/web-dist/components/color-picker/ColorPicker.types-0.d.ts +2 -0
- package/web-dist/components/color-tone/ColorTone.js +15 -14
- package/web-dist/components/color-wheel/ColorWheel.js +15 -14
- package/web-dist/components/content-rail/ContentRail.js +13 -14
- package/web-dist/components/data-table/DataTable.js +27 -28
- package/web-dist/components/date-picker/DatePicker.js +19 -20
- package/web-dist/components/dialog/Dialog.js +9 -9
- package/web-dist/components/divider/Divider.js +4 -4
- package/web-dist/components/empty-state/EmptyState.js +18 -19
- package/web-dist/components/explorer/Explorer.js +11 -11
- package/web-dist/components/field/Field.js +10 -10
- package/web-dist/components/file-explorer/FileExplorer.js +11 -11
- package/web-dist/components/flat-list/FlatList.js +11 -11
- package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +20 -21
- package/web-dist/components/form/Form.js +14 -15
- package/web-dist/components/form-actions/FormActions.js +14 -15
- package/web-dist/components/form-error/FormError.js +14 -15
- package/web-dist/components/game/Game.js +5 -5
- package/web-dist/components/game-entity/GameEntity.js +5 -5
- package/web-dist/components/game-field/GameField.js +5 -5
- package/web-dist/components/game-input-zone/GameInputZone.js +5 -5
- package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +5 -5
- package/web-dist/components/game-overlay/GameOverlay.js +5 -5
- package/web-dist/components/gradient/Gradient.js +5 -5
- package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +5 -5
- package/web-dist/components/graph-view/GraphView.js +9 -2
- package/web-dist/components/grid/Grid.js +4 -4
- package/web-dist/components/grid-line-overlay/GridLineOverlay.js +4 -4
- package/web-dist/components/grid-ruler/GridRuler.js +4 -4
- package/web-dist/components/heading/Heading.js +5 -5
- package/web-dist/components/hero/Hero.js +20 -21
- package/web-dist/components/icon/Icon.js +4 -4
- package/web-dist/components/icon-button/IconButton.js +11 -12
- package/web-dist/components/image/Image.js +8 -8
- package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +3 -3
- package/web-dist/components/list/List.js +11 -11
- package/web-dist/components/list-item/ListItem.js +11 -11
- package/web-dist/components/list-section/ListSection.js +11 -11
- package/web-dist/components/master-detail/MasterDetail.js +4 -4
- package/web-dist/components/matrix-grid/MatrixGrid.js +4 -4
- package/web-dist/components/media-card/MediaCard.js +17 -18
- package/web-dist/components/media-explorer/MediaExplorer.js +11 -11
- package/web-dist/components/message-bubble/MessageBubble.js +14 -14
- package/web-dist/components/metric-card/MetricCard.js +17 -18
- package/web-dist/components/missing-element/MissingElement.js +9 -9
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +20 -21
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +20 -21
- package/web-dist/components/opening-book/OpeningBook.js +4 -4
- package/web-dist/components/otp-form/OtpForm.js +20 -21
- package/web-dist/components/pagination/Pagination.js +18 -19
- package/web-dist/components/palette-item/PaletteItem.js +17 -18
- package/web-dist/components/playing-card/PlayingCard.js +4 -4
- package/web-dist/components/poker-training-table/PokerTrainingTable.js +4 -4
- package/web-dist/components/popover-menu/PopoverMenu.js +10 -10
- package/web-dist/components/post-card/PostCard.js +17 -18
- package/web-dist/components/product-card/ProductCard.js +17 -18
- package/web-dist/components/progress/Progress.js +8 -8
- package/web-dist/components/progress-ring/ProgressRing.js +8 -8
- package/web-dist/components/radio/Radio.js +12 -12
- package/web-dist/components/radio-group/RadioGroup.js +12 -12
- package/web-dist/components/rating/Rating.js +7 -7
- package/web-dist/components/reader/Reader.js +20 -21
- package/web-dist/components/scan-overlay/ScanOverlay.js +18 -19
- package/web-dist/components/screen/Screen.js +4 -4
- package/web-dist/components/screen-section/ScreenSection.js +8 -8
- package/web-dist/components/scroll-view/ScrollView.js +4 -4
- package/web-dist/components/search-input/SearchInput.js +12 -13
- package/web-dist/components/section-header/SectionHeader.js +8 -8
- package/web-dist/components/section-list/SectionList.js +11 -11
- package/web-dist/components/select/Select.js +16 -17
- package/web-dist/components/selectable-item/SelectableItem.js +3 -3
- package/web-dist/components/selection-provider/SelectionProvider.js +3 -3
- package/web-dist/components/sign-in-form/SignInForm.js +20 -21
- package/web-dist/components/sign-up-form/SignUpForm.js +20 -21
- package/web-dist/components/skeleton/Skeleton.js +20 -21
- package/web-dist/components/skeleton-card/SkeletonCard.js +20 -21
- package/web-dist/components/skeleton-list/SkeletonList.js +20 -21
- package/web-dist/components/skeleton-text/SkeletonText.js +20 -21
- package/web-dist/components/surface/Surface.js +5 -5
- package/web-dist/components/switch/Switch.js +5 -5
- package/web-dist/components/tab/Tab.js +5 -5
- package/web-dist/components/tab-list/TabList.js +5 -5
- package/web-dist/components/tab-panel/TabPanel.js +5 -5
- package/web-dist/components/tabletop-table/TabletopTable.js +4 -4
- package/web-dist/components/tabs/Tabs.js +5 -5
- package/web-dist/components/text/Text.js +5 -5
- package/web-dist/components/text-input/TextInput.js +12 -13
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +12 -13
- package/web-dist/components/time-picker/TimePicker.js +19 -20
- package/web-dist/components/timeline/Timeline.js +10 -10
- package/web-dist/components/toast/Toast.js +7 -7
- package/web-dist/components/toast-provider/ToastProvider.js +7 -7
- package/web-dist/components/toolbar/Toolbar.js +17 -18
- package/web-dist/components/tree-item/TreeItem.js +17 -18
- package/web-dist/components/uploader/Uploader.js +26 -27
- package/web-dist/components/view/View.js +4 -4
- package/web-dist/manifest.json +1417 -1459
- package/web-dist/runtime/ZoraProvider.js +6 -6
- package/web-dist/chunks/Accordion-fjnb7anx.js +0 -548
- package/web-dist/chunks/Accordion-ztcmb44y.js +0 -3928
- package/web-dist/chunks/{Accordion-ng79nxzz.js → Accordion-an5prgty.js} +18 -18
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
import { generateHarmonyRoleColors, type HexColor
|
|
2
|
-
import { Button
|
|
1
|
+
import { generateHarmonyRoleColors, type HexColor } from '@ankhorage/color-theory';
|
|
2
|
+
import { Button } from '@ankhorage/surface';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Circle,
|
|
6
|
+
Defs,
|
|
7
|
+
Line,
|
|
8
|
+
LinearGradient,
|
|
9
|
+
Path,
|
|
10
|
+
Polygon,
|
|
11
|
+
RadialGradient,
|
|
12
|
+
Rect,
|
|
13
|
+
Stop,
|
|
14
|
+
Svg,
|
|
15
|
+
} from 'react-native-svg';
|
|
5
16
|
|
|
6
17
|
import type { ColorWheelProps } from '../../types/color';
|
|
7
18
|
import { View } from '../layout/public';
|
|
8
19
|
import { withZoraThemeScope } from '../theme/adapters/inbound/withZoraThemeScope';
|
|
20
|
+
import { useZoraTheme } from '../theme/composition/useZoraTheme';
|
|
21
|
+
import { Text } from '../typography/public';
|
|
22
|
+
import { ColorHexField } from './ColorHexField';
|
|
23
|
+
import { ColorHorizontalPointerProxy } from './ColorHorizontalPointerProxy';
|
|
9
24
|
import { ColorWheelKeyboardProxy } from './ColorWheelKeyboardProxy';
|
|
25
|
+
import { ColorWheelPointerProxy } from './ColorWheelPointerProxy';
|
|
10
26
|
import { resolveColorHue } from './utils/resolveColorHue';
|
|
11
27
|
import { resolveOklchColor } from './utils/resolveOklchColor';
|
|
12
28
|
import { resolveWheelColor } from './utils/resolveWheelColor';
|
|
13
29
|
import { resolveWheelColorComponents } from './utils/resolveWheelColorComponents';
|
|
14
30
|
|
|
15
|
-
const WHEEL_SIZE =
|
|
31
|
+
const WHEEL_SIZE = 280;
|
|
16
32
|
const WHEEL_CENTER = WHEEL_SIZE / 2;
|
|
17
|
-
const WHEEL_RADIUS =
|
|
18
|
-
const WHEEL_SEGMENT_COUNT =
|
|
33
|
+
const WHEEL_RADIUS = 128;
|
|
34
|
+
const WHEEL_SEGMENT_COUNT = 72;
|
|
19
35
|
const WHEEL_MAX_CHROMA = 0.2;
|
|
20
36
|
|
|
21
37
|
/*** Selects an OKLCH hue and optionally visualizes the existing color-theory harmony. */
|
|
@@ -33,12 +49,18 @@ function ColorWheelInner({
|
|
|
33
49
|
onChange,
|
|
34
50
|
testID,
|
|
35
51
|
}: ColorWheelProps) {
|
|
52
|
+
const { theme } = useZoraTheme();
|
|
36
53
|
const hue = resolveColorHue(value);
|
|
37
54
|
const { chroma, lightness } = resolveWheelColorComponents(value);
|
|
38
55
|
const harmonyColors = harmony ? generateHarmonyRoleColors(value, harmony).colors : [];
|
|
39
56
|
const selectedPoint = resolveWheelPoint(hue, Math.min(1, chroma / WHEEL_MAX_CHROMA));
|
|
40
57
|
const harmonyPoints = harmonyColors.map((color) => resolveWheelPoint(color.hueDegrees));
|
|
41
|
-
const harmonyLines = resolveHarmonyLines(
|
|
58
|
+
const harmonyLines = resolveHarmonyLines(
|
|
59
|
+
harmonyPoints,
|
|
60
|
+
selectedPoint,
|
|
61
|
+
theme.semantics.content.default,
|
|
62
|
+
);
|
|
63
|
+
const wheelGradientId = `color-wheel-${React.useId().replaceAll(':', '')}`;
|
|
42
64
|
const changeColorAt = (x: number, y: number) => {
|
|
43
65
|
if (interactionPolicy === 'passive') return;
|
|
44
66
|
onChange({
|
|
@@ -46,17 +68,14 @@ function ColorWheelInner({
|
|
|
46
68
|
harmony,
|
|
47
69
|
});
|
|
48
70
|
};
|
|
49
|
-
const changeLightness = (
|
|
71
|
+
const changeLightness = (nextLightness: number) =>
|
|
50
72
|
onChange({
|
|
51
|
-
color: resolveOklchColor(
|
|
52
|
-
{ chroma, lightness: Math.max(0, Math.min(1, lightness + offset)) },
|
|
53
|
-
hue,
|
|
54
|
-
),
|
|
73
|
+
color: resolveOklchColor({ chroma, lightness: Math.max(0, Math.min(1, nextLightness)) }, hue),
|
|
55
74
|
harmony,
|
|
56
75
|
});
|
|
57
76
|
|
|
58
77
|
return (
|
|
59
|
-
<View align="center" gap="
|
|
78
|
+
<View align="center" gap="s" testID={testID}>
|
|
60
79
|
<ColorWheelKeyboardProxy
|
|
61
80
|
chroma={chroma}
|
|
62
81
|
disabled={interactionPolicy === 'passive'}
|
|
@@ -71,71 +90,96 @@ function ColorWheelInner({
|
|
|
71
90
|
})
|
|
72
91
|
}
|
|
73
92
|
>
|
|
74
|
-
<
|
|
75
|
-
|
|
93
|
+
<ColorWheelPointerProxy
|
|
94
|
+
disabled={interactionPolicy === 'passive'}
|
|
76
95
|
height={WHEEL_SIZE}
|
|
77
|
-
|
|
78
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
79
|
-
changeColorAt(locationX, locationY);
|
|
80
|
-
}}
|
|
81
|
-
onResponderMove={(event) => {
|
|
82
|
-
const { locationX, locationY } = event.nativeEvent;
|
|
83
|
-
changeColorAt(locationX, locationY);
|
|
84
|
-
}}
|
|
85
|
-
onStartShouldSetResponder={() => interactionPolicy !== 'passive'}
|
|
96
|
+
onChange={changeColorAt}
|
|
86
97
|
width={WHEEL_SIZE}
|
|
87
98
|
>
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
<Svg
|
|
100
|
+
accessibilityLabel="Color wheel"
|
|
101
|
+
height={WHEEL_SIZE}
|
|
102
|
+
onResponderGrant={(event) => {
|
|
103
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
104
|
+
changeColorAt(locationX, locationY);
|
|
105
|
+
}}
|
|
106
|
+
onResponderMove={(event) => {
|
|
107
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
108
|
+
changeColorAt(locationX, locationY);
|
|
109
|
+
}}
|
|
110
|
+
onResponderRelease={(event) => {
|
|
111
|
+
const { locationX, locationY } = event.nativeEvent;
|
|
112
|
+
changeColorAt(locationX, locationY);
|
|
113
|
+
}}
|
|
114
|
+
onStartShouldSetResponder={() => interactionPolicy !== 'passive'}
|
|
115
|
+
width={WHEEL_SIZE}
|
|
116
|
+
>
|
|
117
|
+
<Defs>
|
|
118
|
+
{resolveWheelSegments().map((segment) => (
|
|
119
|
+
<RadialGradient
|
|
120
|
+
cx={WHEEL_CENTER}
|
|
121
|
+
cy={WHEEL_CENTER}
|
|
122
|
+
id={`${wheelGradientId}-${segment.hue}`}
|
|
123
|
+
key={segment.hue}
|
|
124
|
+
r={WHEEL_RADIUS}
|
|
125
|
+
>
|
|
126
|
+
<Stop
|
|
127
|
+
offset="0"
|
|
128
|
+
stopColor={resolveOklchColor({ lightness: 0.65, chroma: 0 }, segment.hue)}
|
|
129
|
+
/>
|
|
130
|
+
<Stop offset="1" stopColor={segment.color} />
|
|
131
|
+
</RadialGradient>
|
|
132
|
+
))}
|
|
133
|
+
</Defs>
|
|
134
|
+
{resolveWheelSegments().map((segment) => (
|
|
135
|
+
<Path
|
|
136
|
+
d={segment.path}
|
|
137
|
+
fill={`url(#${wheelGradientId}-${segment.hue})`}
|
|
138
|
+
key={segment.hue}
|
|
139
|
+
/>
|
|
140
|
+
))}
|
|
141
|
+
{harmony === 'triadic' && harmonyPoints.length === 3 ? (
|
|
142
|
+
<Polygon
|
|
143
|
+
fill="none"
|
|
144
|
+
points={harmonyPoints.map((point) => `${point.x},${point.y}`).join(' ')}
|
|
145
|
+
stroke={theme.semantics.content.default}
|
|
146
|
+
strokeWidth={2}
|
|
147
|
+
/>
|
|
148
|
+
) : (
|
|
149
|
+
harmonyLines
|
|
150
|
+
)}
|
|
151
|
+
{harmonyPoints.map((point) => (
|
|
152
|
+
<Circle
|
|
153
|
+
cx={point.x}
|
|
154
|
+
cy={point.y}
|
|
155
|
+
fill={theme.semantics.content.default}
|
|
156
|
+
key={`${point.x}-${point.y}`}
|
|
157
|
+
r={5}
|
|
158
|
+
/>
|
|
159
|
+
))}
|
|
102
160
|
<Circle
|
|
103
|
-
cx={
|
|
104
|
-
cy={
|
|
105
|
-
fill="
|
|
106
|
-
|
|
107
|
-
|
|
161
|
+
cx={selectedPoint.x}
|
|
162
|
+
cy={selectedPoint.y}
|
|
163
|
+
fill="none"
|
|
164
|
+
r={9}
|
|
165
|
+
stroke={theme.semantics.content.default}
|
|
166
|
+
strokeWidth={3}
|
|
108
167
|
/>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
cx={selectedPoint.x}
|
|
112
|
-
cy={selectedPoint.y}
|
|
113
|
-
fill="none"
|
|
114
|
-
r={9}
|
|
115
|
-
stroke="currentColor"
|
|
116
|
-
strokeWidth={3}
|
|
117
|
-
/>
|
|
118
|
-
</Svg>
|
|
168
|
+
</Svg>
|
|
169
|
+
</ColorWheelPointerProxy>
|
|
119
170
|
</ColorWheelKeyboardProxy>
|
|
120
|
-
<
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
onPress={() => changeLightness(0.05)}
|
|
130
|
-
>
|
|
131
|
-
Lightness +
|
|
132
|
-
</Button>
|
|
133
|
-
</View>
|
|
134
|
-
<ColorHexInput
|
|
171
|
+
<ColorLightnessSlider
|
|
172
|
+
chroma={chroma}
|
|
173
|
+
disabled={interactionPolicy === 'passive'}
|
|
174
|
+
hue={hue}
|
|
175
|
+
lightness={lightness}
|
|
176
|
+
onChange={changeLightness}
|
|
177
|
+
selectionBorderColor={theme.semantics.content.default}
|
|
178
|
+
/>
|
|
179
|
+
<ColorHexField
|
|
135
180
|
disabled={interactionPolicy === 'passive'}
|
|
136
|
-
harmony={harmony}
|
|
137
181
|
key={value}
|
|
138
|
-
onChange={onChange}
|
|
182
|
+
onChange={(color) => onChange({ color, harmony })}
|
|
139
183
|
value={value}
|
|
140
184
|
/>
|
|
141
185
|
{harmonies ? (
|
|
@@ -163,6 +207,63 @@ function ColorWheelInner({
|
|
|
163
207
|
);
|
|
164
208
|
}
|
|
165
209
|
|
|
210
|
+
/*** Renders a continuous OKLCH lightness track without adding a second color persistence model. */
|
|
211
|
+
function ColorLightnessSlider({
|
|
212
|
+
chroma,
|
|
213
|
+
disabled,
|
|
214
|
+
hue,
|
|
215
|
+
lightness,
|
|
216
|
+
onChange,
|
|
217
|
+
selectionBorderColor,
|
|
218
|
+
}: {
|
|
219
|
+
readonly chroma: number;
|
|
220
|
+
readonly disabled: boolean;
|
|
221
|
+
readonly hue: number;
|
|
222
|
+
readonly lightness: number;
|
|
223
|
+
readonly onChange: (lightness: number) => void;
|
|
224
|
+
readonly selectionBorderColor: string;
|
|
225
|
+
}) {
|
|
226
|
+
const changeAt = (locationX: number) => {
|
|
227
|
+
if (!disabled) onChange(Math.max(0, Math.min(1, locationX / WHEEL_SIZE)));
|
|
228
|
+
};
|
|
229
|
+
return (
|
|
230
|
+
<View gap="xxs" width={WHEEL_SIZE}>
|
|
231
|
+
<View direction="row" justify="space-between">
|
|
232
|
+
<Text variant="label">Lightness</Text>
|
|
233
|
+
<Text variant="label">{`${Math.round(lightness * 100)}%`}</Text>
|
|
234
|
+
</View>
|
|
235
|
+
<ColorHorizontalPointerProxy disabled={disabled} onChange={changeAt} width={WHEEL_SIZE}>
|
|
236
|
+
<Svg accessibilityLabel="Color lightness" height={36} width={WHEEL_SIZE}>
|
|
237
|
+
<Defs>
|
|
238
|
+
<LinearGradient id="color-lightness" x1="0" x2="1" y1="0" y2="0">
|
|
239
|
+
<Stop offset="0" stopColor={resolveOklchColor({ chroma, lightness: 0 }, hue)} />
|
|
240
|
+
<Stop offset="1" stopColor={resolveOklchColor({ chroma, lightness: 1 }, hue)} />
|
|
241
|
+
</LinearGradient>
|
|
242
|
+
</Defs>
|
|
243
|
+
<Rect fill="url(#color-lightness)" height={10} rx={5} y={13} width={WHEEL_SIZE} />
|
|
244
|
+
<Circle
|
|
245
|
+
cx={lightness * WHEEL_SIZE}
|
|
246
|
+
cy={18}
|
|
247
|
+
fill="white"
|
|
248
|
+
r={10}
|
|
249
|
+
stroke={selectionBorderColor}
|
|
250
|
+
strokeWidth={2}
|
|
251
|
+
/>
|
|
252
|
+
<Rect
|
|
253
|
+
fill="transparent"
|
|
254
|
+
height={36}
|
|
255
|
+
onResponderGrant={(event) => changeAt(event.nativeEvent.locationX)}
|
|
256
|
+
onResponderMove={(event) => changeAt(event.nativeEvent.locationX)}
|
|
257
|
+
onResponderRelease={(event) => changeAt(event.nativeEvent.locationX)}
|
|
258
|
+
onStartShouldSetResponder={() => !disabled}
|
|
259
|
+
width={WHEEL_SIZE}
|
|
260
|
+
/>
|
|
261
|
+
</Svg>
|
|
262
|
+
</ColorHorizontalPointerProxy>
|
|
263
|
+
</View>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
166
267
|
/*** Build the wheel's OKLCH segments from the existing conversion tool. */
|
|
167
268
|
function resolveWheelSegments(): readonly {
|
|
168
269
|
readonly color: HexColor;
|
|
@@ -202,6 +303,7 @@ function resolveWheelPoint(
|
|
|
202
303
|
function resolveHarmonyLines(
|
|
203
304
|
points: readonly { readonly x: number; readonly y: number }[],
|
|
204
305
|
selectedPoint: { readonly x: number; readonly y: number },
|
|
306
|
+
stroke: string,
|
|
205
307
|
) {
|
|
206
308
|
return points.slice(1).reduce(
|
|
207
309
|
({ lines, previous }, point) => ({
|
|
@@ -209,7 +311,7 @@ function resolveHarmonyLines(
|
|
|
209
311
|
...lines,
|
|
210
312
|
<Line
|
|
211
313
|
key={`${previous.x}-${previous.y}-${point.x}-${point.y}`}
|
|
212
|
-
stroke=
|
|
314
|
+
stroke={stroke}
|
|
213
315
|
strokeWidth={2}
|
|
214
316
|
x1={previous.x}
|
|
215
317
|
x2={point.x}
|
|
@@ -228,24 +330,3 @@ function resolveWheelLightness(color: HexColor): number {
|
|
|
228
330
|
const { lightness } = resolveWheelColorComponents(color);
|
|
229
331
|
return lightness;
|
|
230
332
|
}
|
|
231
|
-
|
|
232
|
-
/*** Retains in-progress hexadecimal input while resetting for an externally controlled color. */
|
|
233
|
-
function ColorHexInput({
|
|
234
|
-
disabled,
|
|
235
|
-
harmony,
|
|
236
|
-
onChange,
|
|
237
|
-
value,
|
|
238
|
-
}: Pick<ColorWheelProps, 'harmony' | 'onChange' | 'value'> & { readonly disabled: boolean }) {
|
|
239
|
-
const [input, setInput] = React.useState<string>(value);
|
|
240
|
-
return (
|
|
241
|
-
<TextInput
|
|
242
|
-
accessibilityLabel="Color hex value"
|
|
243
|
-
disabled={disabled}
|
|
244
|
-
onChangeText={(nextValue) => {
|
|
245
|
-
setInput(nextValue);
|
|
246
|
-
if (isHexColor(nextValue)) onChange({ color: nextValue, harmony: harmony ?? null });
|
|
247
|
-
}}
|
|
248
|
-
value={input}
|
|
249
|
-
/>
|
|
250
|
-
);
|
|
251
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
|
|
3
|
+
export { ColorWheelPointerProxy } from './ColorWheelPointerProxy.native';
|
|
4
|
+
|
|
5
|
+
export interface ColorWheelPointerProxyProps {
|
|
6
|
+
readonly children: React.ReactNode;
|
|
7
|
+
readonly disabled: boolean;
|
|
8
|
+
readonly height: number;
|
|
9
|
+
readonly onChange: (x: number, y: number) => void;
|
|
10
|
+
readonly width: number;
|
|
11
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import type { ColorWheelPointerProxyProps } from './ColorWheelPointerProxy';
|
|
4
|
+
|
|
5
|
+
/*** Maps browser pointer coordinates into the fixed SVG wheel viewport for click and drag selection. */
|
|
6
|
+
export function ColorWheelPointerProxy({
|
|
7
|
+
children,
|
|
8
|
+
disabled,
|
|
9
|
+
height,
|
|
10
|
+
onChange,
|
|
11
|
+
width,
|
|
12
|
+
}: ColorWheelPointerProxyProps) {
|
|
13
|
+
const dragging = React.useRef(false);
|
|
14
|
+
const changeAt = (event: React.MouseEvent<HTMLDivElement>) => {
|
|
15
|
+
const target = event.currentTarget as unknown as BrowserPointerTarget;
|
|
16
|
+
const rect = target.getBoundingClientRect();
|
|
17
|
+
onChange(
|
|
18
|
+
((event.clientX - rect.left) / rect.width) * width,
|
|
19
|
+
((event.clientY - rect.top) / rect.height) * height,
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div
|
|
25
|
+
onMouseDown={(event) => {
|
|
26
|
+
if (disabled) return;
|
|
27
|
+
dragging.current = true;
|
|
28
|
+
changeAt(event);
|
|
29
|
+
}}
|
|
30
|
+
onMouseMove={(event) => {
|
|
31
|
+
if (!disabled && dragging.current) changeAt(event);
|
|
32
|
+
}}
|
|
33
|
+
onMouseUp={(event) => {
|
|
34
|
+
if (!disabled && dragging.current) changeAt(event);
|
|
35
|
+
dragging.current = false;
|
|
36
|
+
}}
|
|
37
|
+
style={{ touchAction: 'none' }}
|
|
38
|
+
>
|
|
39
|
+
{children}
|
|
40
|
+
</div>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface BrowserPointerTarget {
|
|
45
|
+
readonly getBoundingClientRect: () => {
|
|
46
|
+
readonly height: number;
|
|
47
|
+
readonly left: number;
|
|
48
|
+
readonly top: number;
|
|
49
|
+
readonly width: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -111,6 +111,8 @@ test('fits changed topology but preserves viewport and avoids relayout for highl
|
|
|
111
111
|
|
|
112
112
|
test('preserves a stable topology removal without relayout, fit, or retained-node movement', async () => {
|
|
113
113
|
const ready = Promise.withResolvers<GraphViewController>();
|
|
114
|
+
const controllers: GraphViewController[] = [];
|
|
115
|
+
const snapshots: (readonly GraphViewRenderedNode[])[] = [];
|
|
114
116
|
const calls = { complete: 0, ready: 0, sort: 0 };
|
|
115
117
|
const runtime = createGraphRuntime(undefined, {
|
|
116
118
|
current: {
|
|
@@ -119,10 +121,12 @@ test('preserves a stable topology removal without relayout, fit, or retained-nod
|
|
|
119
121
|
},
|
|
120
122
|
onReady: (controller) => {
|
|
121
123
|
calls.ready += 1;
|
|
124
|
+
controllers.push(controller);
|
|
122
125
|
ready.resolve(controller);
|
|
123
126
|
},
|
|
124
127
|
},
|
|
125
128
|
});
|
|
129
|
+
const unsubscribe = runtime.subscribeRenderedNodes((nodes) => snapshots.push(nodes));
|
|
126
130
|
const nodes = Array.from({ length: 87 }, (_, index) => ({ id: `repository-${index}` }));
|
|
127
131
|
const input = {
|
|
128
132
|
nodes,
|
|
@@ -156,6 +160,10 @@ test('preserves a stable topology removal without relayout, fit, or retained-nod
|
|
|
156
160
|
nodes: nodes.slice(0, -1),
|
|
157
161
|
edges: input.edges.slice(0, -1),
|
|
158
162
|
});
|
|
163
|
+
expect(
|
|
164
|
+
controller.measureNodes?.(retainedIds)?.nodes.map(({ id, position }) => ({ id, position })),
|
|
165
|
+
).toEqual(before?.nodes.map(({ id, position }) => ({ id, position })));
|
|
166
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
159
167
|
runtime.setNodeSize('repository-0', { height: 24, width: 48 });
|
|
160
168
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
161
169
|
|
|
@@ -163,10 +171,13 @@ test('preserves a stable topology removal without relayout, fit, or retained-nod
|
|
|
163
171
|
controller.measureNodes?.(retainedIds)?.nodes.map(({ id, position }) => ({ id, position })),
|
|
164
172
|
).toEqual(before?.nodes.map(({ id, position }) => ({ id, position })));
|
|
165
173
|
expect(controller.getViewport()).toEqual(viewport);
|
|
174
|
+
expect(snapshots.at(-1)?.find((node) => node.id === 'repository-0')?.selected).toBe(true);
|
|
166
175
|
expect(calls.ready).toBe(1);
|
|
176
|
+
expect(controllers).toEqual([controller]);
|
|
167
177
|
expect(calls.complete).toBe(1);
|
|
168
178
|
expect(calls.sort).toBe(sortCount);
|
|
169
179
|
} finally {
|
|
180
|
+
unsubscribe();
|
|
170
181
|
runtime.destroy();
|
|
171
182
|
}
|
|
172
183
|
});
|
|
@@ -311,6 +322,13 @@ test('keeps explicit fit and layout available after preserving a rich-node topol
|
|
|
311
322
|
await completed.promise;
|
|
312
323
|
|
|
313
324
|
expect(calls.sort).toBeGreaterThan(preservedSorts);
|
|
325
|
+
const explicitLayoutSorts = calls.sort;
|
|
326
|
+
const measured = Promise.withResolvers<void>();
|
|
327
|
+
callbacks.current = { onLayoutComplete: () => measured.resolve() };
|
|
328
|
+
runtime.setNodeSize('repository-1', { height: 24, width: 48 });
|
|
329
|
+
await measured.promise;
|
|
330
|
+
|
|
331
|
+
expect(calls.sort).toBeGreaterThan(explicitLayoutSorts);
|
|
314
332
|
} finally {
|
|
315
333
|
runtime.destroy();
|
|
316
334
|
}
|
|
@@ -62,6 +62,7 @@ interface GraphRuntimeState {
|
|
|
62
62
|
readonly labelSizedNodeIds: Set<string>;
|
|
63
63
|
readonly loopSizer: ReturnType<typeof createGraphLoopSizer>;
|
|
64
64
|
readonly pendingInitialFitRef: { current: boolean };
|
|
65
|
+
readonly preservedTopologyRef: { current: boolean };
|
|
65
66
|
readonly preservedTopologyMeasurementRef: { current: boolean };
|
|
66
67
|
readonly readyRef: { current: boolean };
|
|
67
68
|
readonly settledLayoutRef: { current: GraphRuntimeUpdate['layout'] | null };
|
|
@@ -134,6 +135,7 @@ function createRuntimeState(
|
|
|
134
135
|
labelSizedNodeIds: new Set<string>(),
|
|
135
136
|
loopSizer: createGraphLoopSizer(cy),
|
|
136
137
|
pendingInitialFitRef: { current: false },
|
|
138
|
+
preservedTopologyRef: { current: false },
|
|
137
139
|
preservedTopologyMeasurementRef: { current: false },
|
|
138
140
|
readyRef,
|
|
139
141
|
settledLayoutRef: { current: null as GraphRuntimeUpdate['layout'] | null },
|
|
@@ -266,7 +268,10 @@ function beginPreservedTopologyMeasurementWindow(
|
|
|
266
268
|
previous !== null &&
|
|
267
269
|
getGraphTopologyKey(previous.nodes, previous.edges) !==
|
|
268
270
|
getGraphTopologyKey(input.nodes, input.edges);
|
|
269
|
-
|
|
271
|
+
const preservedTopology = preservesTopology && topologyChanged;
|
|
272
|
+
state.preservedTopologyRef.current =
|
|
273
|
+
preservesTopology && (state.preservedTopologyRef.current || topologyChanged);
|
|
274
|
+
state.preservedTopologyMeasurementRef.current = preservedTopology;
|
|
270
275
|
if (!state.preservedTopologyMeasurementRef.current) return;
|
|
271
276
|
scheduleGraphFrame(() => {
|
|
272
277
|
state.preservedTopologyMeasurementRef.current = false;
|
|
@@ -360,6 +365,7 @@ function completeCurrentLayout(state: GraphRuntimeState, generation: number) {
|
|
|
360
365
|
state.viewport.settle(shouldFit);
|
|
361
366
|
state.settledLayoutRef.current = input.layout;
|
|
362
367
|
state.settledTopologyRef.current = topology;
|
|
368
|
+
state.preservedTopologyRef.current = false;
|
|
363
369
|
const fitRequest = state.fitRequestRef.current;
|
|
364
370
|
state.fitRequestRef.current = null;
|
|
365
371
|
if (fitRequest) requestOptimizedFit(state, fitRequest);
|
|
@@ -454,10 +460,20 @@ function setNodeSize(state: GraphRuntimeState, id: string, size: GraphViewSize)
|
|
|
454
460
|
if (previous?.width === size.width && previous.height === size.height) return;
|
|
455
461
|
state.nodeSizes.set(id, size);
|
|
456
462
|
applyNodeSize(state.cy, id, size);
|
|
457
|
-
if (state
|
|
463
|
+
if (preservesSettledTopology(state)) return;
|
|
458
464
|
scheduleMeasuredNodeRelayout(state);
|
|
459
465
|
}
|
|
460
466
|
|
|
467
|
+
/*** Retain a user-owned stable topology until the next layout generation settles. */
|
|
468
|
+
function preservesSettledTopology(state: GraphRuntimeState): boolean {
|
|
469
|
+
return (
|
|
470
|
+
state.readyRef.current &&
|
|
471
|
+
!state.pendingInitialFitRef.current &&
|
|
472
|
+
state.preservedTopologyRef.current &&
|
|
473
|
+
state.latestUpdateRef.current?.topologyUpdatePolicy === 'preserve-positions'
|
|
474
|
+
);
|
|
475
|
+
}
|
|
476
|
+
|
|
461
477
|
/*** Apply every known rich-node size after Cytoscape elements are replaced. */
|
|
462
478
|
function applyKnownNodeSizes(state: GraphRuntimeState) {
|
|
463
479
|
for (const [id, size] of state.nodeSizes) applyNodeSize(state.cy, id, size);
|
package/src/types/color.ts
CHANGED
|
@@ -68,6 +68,8 @@ export interface ColorPickerProps extends ZoraBaseProps {
|
|
|
68
68
|
readonly value: ColorPickerValue;
|
|
69
69
|
readonly onValueChange: (value: ColorPickerValue) => void;
|
|
70
70
|
readonly onSelectionChange?: (selection: ColorPickerSelection) => void;
|
|
71
|
+
/** Requests dismissal from the owning Popover or BottomSheet presentation. */
|
|
72
|
+
readonly onDismiss?: () => void;
|
|
71
73
|
readonly hideTabListWhenSingle?: boolean;
|
|
72
74
|
readonly wheel?: Omit<ColorWheelProps, 'onChange' | 'value'>;
|
|
73
75
|
readonly tone?: Omit<ColorToneProps, 'onChange' | 'value'>;
|