@ankhorage/zora 27.3.9 → 27.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/features/color/ColorHueScale.d.ts +4 -0
- package/dist/features/color/ColorHueScale.d.ts.map +1 -0
- package/dist/features/color/ColorHueScale.js +22 -0
- package/dist/features/color/ColorHueScale.js.map +1 -0
- package/dist/features/color/ColorPicker.d.ts +5 -0
- package/dist/features/color/ColorPicker.d.ts.map +1 -0
- package/dist/features/color/ColorPicker.js +48 -0
- package/dist/features/color/ColorPicker.js.map +1 -0
- package/dist/features/color/ColorTone.d.ts +5 -0
- package/dist/features/color/ColorTone.d.ts.map +1 -0
- package/dist/features/color/ColorTone.js +65 -0
- package/dist/features/color/ColorTone.js.map +1 -0
- package/dist/features/color/ColorWheel.d.ts +5 -0
- package/dist/features/color/ColorWheel.d.ts.map +1 -0
- package/dist/features/color/ColorWheel.js +125 -0
- package/dist/features/color/ColorWheel.js.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts +10 -0
- package/dist/features/color/ColorWheelKeyboardProxy.d.ts.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.js +2 -0
- package/dist/features/color/ColorWheelKeyboardProxy.js.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.native.d.ts +4 -0
- package/dist/features/color/ColorWheelKeyboardProxy.native.d.ts.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.native.js +17 -0
- package/dist/features/color/ColorWheelKeyboardProxy.native.js.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts +5 -0
- package/dist/features/color/ColorWheelKeyboardProxy.web.d.ts.map +1 -0
- package/dist/features/color/ColorWheelKeyboardProxy.web.js +29 -0
- package/dist/features/color/ColorWheelKeyboardProxy.web.js.map +1 -0
- package/dist/features/color/public.d.ts +6 -0
- package/dist/features/color/public.d.ts.map +1 -0
- package/dist/features/color/public.js +5 -0
- package/dist/features/color/public.js.map +1 -0
- package/dist/features/color/utils/resolveColorAtHue.d.ts +4 -0
- package/dist/features/color/utils/resolveColorAtHue.d.ts.map +1 -0
- package/dist/features/color/utils/resolveColorAtHue.js +12 -0
- package/dist/features/color/utils/resolveColorAtHue.js.map +1 -0
- package/dist/features/color/utils/resolveColorHue.d.ts +4 -0
- package/dist/features/color/utils/resolveColorHue.d.ts.map +1 -0
- package/dist/features/color/utils/resolveColorHue.js +8 -0
- package/dist/features/color/utils/resolveColorHue.js.map +1 -0
- package/dist/features/color/utils/resolveOklchColor.d.ts +5 -0
- package/dist/features/color/utils/resolveOklchColor.d.ts.map +1 -0
- package/dist/features/color/utils/resolveOklchColor.js +10 -0
- package/dist/features/color/utils/resolveOklchColor.js.map +1 -0
- package/dist/features/color/utils/resolveWheelColor.d.ts +4 -0
- package/dist/features/color/utils/resolveWheelColor.d.ts.map +1 -0
- package/dist/features/color/utils/resolveWheelColor.js +17 -0
- package/dist/features/color/utils/resolveWheelColor.js.map +1 -0
- package/dist/features/color/utils/resolveWheelColorComponents.d.ts +7 -0
- package/dist/features/color/utils/resolveWheelColorComponents.d.ts.map +1 -0
- package/dist/features/color/utils/resolveWheelColorComponents.js +11 -0
- package/dist/features/color/utils/resolveWheelColorComponents.js.map +1 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js +11 -7
- package/dist/features/graph-view/adapters/inbound/web-artifact/GraphView.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.d.ts +2 -2
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.d.ts.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js +7 -7
- package/dist/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.js.map +1 -1
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts +7 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts.map +1 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js +40 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js.map +1 -0
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.d.ts +1 -1
- 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 +28 -4
- package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.js.map +1 -1
- package/dist/features/selection/application/resolveSelectionEventIntent.d.ts +1 -1
- package/dist/features/selection/application/resolveSelectionEventIntent.d.ts.map +1 -1
- package/dist/features/selection/application/resolveSelectionEventIntent.js +14 -5
- package/dist/features/selection/application/resolveSelectionEventIntent.js.map +1 -1
- package/dist/index.d.ts +2 -0
- 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 +70 -0
- package/dist/types/color.d.ts.map +1 -0
- package/dist/types/color.js +2 -0
- package/dist/types/color.js.map +1 -0
- package/package.json +3 -1
- package/src/audit.test.ts +3 -3
- package/src/features/color/ColorHueScale.tsx +57 -0
- package/src/features/color/ColorPicker.tsx +105 -0
- package/src/features/color/ColorTone.tsx +137 -0
- package/src/features/color/ColorWheel.tsx +251 -0
- package/src/features/color/ColorWheelKeyboardProxy.native.tsx +34 -0
- package/src/features/color/ColorWheelKeyboardProxy.tsx +11 -0
- package/src/features/color/ColorWheelKeyboardProxy.web.tsx +47 -0
- package/src/features/color/public.ts +17 -0
- package/src/features/color/utils/colorMath.test.ts +37 -0
- package/src/features/color/utils/resolveColorAtHue.ts +14 -0
- package/src/features/color/utils/resolveColorHue.ts +10 -0
- package/src/features/color/utils/resolveOklchColor.ts +13 -0
- package/src/features/color/utils/resolveWheelColor.ts +28 -0
- package/src/features/color/utils/resolveWheelColorComponents.ts +16 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx +16 -4
- package/src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts +24 -4
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.test.ts +28 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.ts +48 -0
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.test.ts +16 -6
- package/src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts +34 -3
- package/src/features/selection/application/resolveSelectionEventIntent.test.ts +1 -0
- package/src/features/selection/application/resolveSelectionEventIntent.ts +18 -4
- package/src/index.ts +14 -0
- package/src/types/color.ts +75 -0
- package/src/webPackageExports.test.ts +15 -0
- package/web-dist/authoring/index.js +6 -5
- package/web-dist/chunks/{Accordion-5w8chhxm.js → Accordion-001ymezm.js} +3 -63
- package/web-dist/chunks/{Accordion-2d5jdxeg.js → Accordion-01s50nga.js} +2 -2
- package/web-dist/chunks/{Accordion-dhnd347t.js → Accordion-09jkcm1x.js} +695 -4591
- package/web-dist/chunks/Accordion-0z2t95zw.js +548 -0
- package/web-dist/chunks/{Accordion-z1k4wg10.js → Accordion-120nmpbe.js} +3 -3
- package/web-dist/chunks/{Accordion-zrn4dy6s.js → Accordion-401452az.js} +6 -6
- package/web-dist/chunks/{Accordion-yy6qy5y2.js → Accordion-44bcsg35.js} +6 -6
- package/web-dist/chunks/{Accordion-5hvq2r84.js → Accordion-49m38edd.js} +4 -4
- package/web-dist/chunks/{Accordion-x4bpna1q.js → Accordion-49mzcav8.js} +4 -4
- package/web-dist/chunks/{Accordion-h3r90b65.js → Accordion-52a3dpsm.js} +4 -4
- package/web-dist/chunks/{Accordion-bhr3r525.js → Accordion-549akrjn.js} +4 -4
- package/web-dist/chunks/{Accordion-7atd70rg.js → Accordion-64px84rh.js} +10 -10
- package/web-dist/chunks/{Accordion-enracgev.js → Accordion-6ec9bfd8.js} +4 -4
- package/web-dist/chunks/Accordion-6jb7b67v.js +66 -0
- package/web-dist/chunks/{Accordion-5gbd0wzf.js → Accordion-8ac6dkcs.js} +1 -1
- package/web-dist/chunks/{Accordion-w18jbs39.js → Accordion-8q7hn9aj.js} +1 -1
- package/web-dist/chunks/{Accordion-825x4t0z.js → Accordion-8vcs6nz6.js} +1 -1
- package/web-dist/chunks/{Accordion-qqv9mak2.js → Accordion-9d3rd7ne.js} +1 -1
- package/web-dist/chunks/{Accordion-zfsnh03k.js → Accordion-9hcbf56f.js} +2 -2
- package/web-dist/chunks/{Accordion-rrmy3736.js → Accordion-a6xxvydp.js} +2 -2
- package/web-dist/chunks/{Accordion-dv281jw0.js → Accordion-b4yr6yq3.js} +2 -2
- package/web-dist/chunks/{Accordion-c1x8bqnr.js → Accordion-b8t2gq8g.js} +9 -9
- package/web-dist/chunks/{Accordion-25xjvp3t.js → Accordion-dk40hsc0.js} +2 -2
- package/web-dist/chunks/{Accordion-1dr6ktbf.js → Accordion-dxhs3xwx.js} +7 -7
- package/web-dist/chunks/{Accordion-q5swmcwm.js → Accordion-e1krqvc4.js} +3 -3
- package/web-dist/chunks/{Accordion-md1g54wg.js → Accordion-eq27a9ms.js} +6 -5
- package/web-dist/chunks/{Accordion-b7jgtnvm.js → Accordion-ew2cebyd.js} +3 -3
- package/web-dist/chunks/{Accordion-j3twwxyt.js → Accordion-g9m813fh.js} +2 -2
- package/web-dist/chunks/{Accordion-b36h9a7g.js → Accordion-gysa24fk.js} +1 -1
- package/web-dist/chunks/{Accordion-2xdwc579.js → Accordion-h21ah8w3.js} +6 -6
- package/web-dist/chunks/{Accordion-2rtkfs9t.js → Accordion-hfb983jm.js} +3 -3
- package/web-dist/chunks/{Accordion-5p0pc8wp.js → Accordion-j61qh3rb.js} +2 -2
- package/web-dist/chunks/{Accordion-tf459afq.js → Accordion-kexh248h.js} +2 -2
- package/web-dist/chunks/{Accordion-gbe84kyw.js → Accordion-kx6695j5.js} +2 -2
- package/web-dist/chunks/{Accordion-w42y21pt.js → Accordion-mrhkw8n6.js} +1 -1
- package/web-dist/chunks/{Accordion-vyr0wyp9.js → Accordion-ng9pnz9r.js} +9 -9
- package/web-dist/chunks/{Accordion-x3shxr1k.js → Accordion-p43psvv8.js} +6 -6
- package/web-dist/chunks/{Accordion-6y9ac3ad.js → Accordion-rcs75kj4.js} +3 -3
- package/web-dist/chunks/Accordion-rj3ayvn5.js +3925 -0
- package/web-dist/chunks/{Accordion-4d12nnq0.js → Accordion-sheqvs8c.js} +11 -11
- package/web-dist/chunks/{Accordion-j77vvja1.js → Accordion-ss57gqjb.js} +5 -5
- package/web-dist/chunks/{Accordion-hsnh2dgt.js → Accordion-sttjd4rs.js} +7 -7
- package/web-dist/chunks/{Accordion-n95zwem8.js → Accordion-sz17szqm.js} +8 -8
- package/web-dist/chunks/{Accordion-0ecj6p6b.js → Accordion-tchccn9f.js} +5 -5
- package/web-dist/chunks/{Accordion-4d4xahgg.js → Accordion-tpd1vvy9.js} +77 -74
- package/web-dist/chunks/{Accordion-bm75sm6d.js → Accordion-vzgpdtr2.js} +1 -1
- package/web-dist/chunks/{Accordion-4hthnyjj.js → Accordion-wdefxczv.js} +9 -9
- package/web-dist/chunks/{Accordion-2pq8kbaq.js → Accordion-wtqev4qa.js} +7 -7
- package/web-dist/chunks/{Accordion-s6n61fx6.js → Accordion-x33am5bc.js} +3 -3
- package/web-dist/chunks/{Accordion-5zx8d19h.js → Accordion-xfdp8w37.js} +13 -13
- package/web-dist/chunks/{Accordion-st7rj6hc.js → Accordion-xs9aspze.js} +4 -4
- package/web-dist/chunks/{Accordion-nf16vayy.js → Accordion-z4m47w0b.js} +2 -2
- package/web-dist/chunks/{Accordion-x2d68rrj.js → Accordion-z5kr43w5.js} +4 -4
- package/web-dist/chunks/{Accordion-nks69epp.js → Accordion-z8c7y6d8.js} +5 -5
- 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 +16 -15
- package/web-dist/components/app-header/AppHeader.js +16 -15
- package/web-dist/components/app-shell/AppShell.js +4 -4
- package/web-dist/components/auth-screen/AuthScreen.js +21 -19
- 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 +19 -18
- 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 -14
- package/web-dist/components/button/Button.js +11 -10
- package/web-dist/components/button-group/ButtonGroup.js +11 -10
- package/web-dist/components/camera-permission-view/CameraPermissionView.js +19 -18
- package/web-dist/components/card/Card.js +18 -17
- package/web-dist/components/card-back/CardBack.js +4 -4
- package/web-dist/components/card-hand/CardHand.js +4 -4
- 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 +20 -19
- package/web-dist/components/color-hue-scale/ColorHueScale.d.ts +6 -0
- package/web-dist/components/color-hue-scale/ColorHueScale.js +33 -0
- package/web-dist/components/color-hue-scale/index.d.ts +1 -0
- package/web-dist/components/color-hue-scale/index.js +2 -0
- package/web-dist/components/color-picker/ColorPicker.d.ts +6 -0
- package/web-dist/components/color-picker/ColorPicker.js +33 -0
- package/web-dist/components/color-picker/index.d.ts +1 -0
- package/web-dist/components/color-picker/index.js +2 -0
- package/web-dist/components/color-tone/ColorTone.d.ts +6 -0
- package/web-dist/components/color-tone/ColorTone.js +33 -0
- package/web-dist/components/color-tone/index.d.ts +1 -0
- package/web-dist/components/color-tone/index.js +2 -0
- package/web-dist/components/color-wheel/ColorWheel.d.ts +6 -0
- package/web-dist/components/color-wheel/ColorWheel.js +33 -0
- package/web-dist/components/color-wheel/index.d.ts +1 -0
- package/web-dist/components/color-wheel/index.js +2 -0
- package/web-dist/components/content-rail/ContentRail.js +14 -13
- package/web-dist/components/data-table/DataTable.js +25 -24
- package/web-dist/components/date-picker/DatePicker.js +16 -15
- 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 +19 -18
- 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 +21 -19
- package/web-dist/components/form/Form.js +15 -14
- package/web-dist/components/form-actions/FormActions.js +15 -14
- package/web-dist/components/form-error/FormError.js +15 -14
- 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 +81 -18
- 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 -19
- package/web-dist/components/icon/Icon.js +4 -4
- package/web-dist/components/icon-button/IconButton.js +11 -10
- 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/matrix-grid/MatrixGrid.js +5 -5
- package/web-dist/components/media-card/MediaCard.js +18 -17
- 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 +18 -17
- package/web-dist/components/missing-element/MissingElement.js +9 -9
- package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +21 -19
- package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +21 -19
- package/web-dist/components/opening-book/OpeningBook.js +4 -4
- package/web-dist/components/otp-form/OtpForm.js +21 -19
- package/web-dist/components/pagination/Pagination.js +14 -13
- package/web-dist/components/palette-item/PaletteItem.js +18 -17
- 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 +18 -17
- package/web-dist/components/product-card/ProductCard.js +18 -17
- 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 +21 -20
- package/web-dist/components/scan-overlay/ScanOverlay.js +19 -18
- 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 +14 -12
- 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 +14 -13
- 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 +21 -19
- package/web-dist/components/sign-up-form/SignUpForm.js +21 -19
- package/web-dist/components/skeleton/Skeleton.js +21 -20
- package/web-dist/components/skeleton-card/SkeletonCard.js +21 -20
- package/web-dist/components/skeleton-list/SkeletonList.js +21 -20
- package/web-dist/components/skeleton-text/SkeletonText.js +21 -20
- 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 +14 -12
- package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +13 -12
- package/web-dist/components/time-picker/TimePicker.js +16 -15
- package/web-dist/components/timeline/Timeline.js +9 -9
- 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 +18 -17
- package/web-dist/components/tree-item/TreeItem.js +19 -18
- package/web-dist/components/tree-view/TreeView.js +1 -1
- package/web-dist/components/uploader/Uploader.js +23 -22
- package/web-dist/components/view/View.js +4 -4
- package/web-dist/manifest.json +1473 -1271
- package/web-dist/runtime/ZoraProvider.js +6 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveColorHue.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveColorHue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAGvD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { converter } from '@ankhorage/color-theory/culori/fn';
|
|
2
|
+
const toOklch = converter('oklch');
|
|
3
|
+
/*** Read the editable hue from a selected hex color. */
|
|
4
|
+
export function resolveColorHue(color) {
|
|
5
|
+
const parsed = toOklch(color);
|
|
6
|
+
return typeof parsed?.h === 'number' ? parsed.h : 0;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=resolveColorHue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveColorHue.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveColorHue.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAEnC,wDAAwD;AACxD,MAAM,UAAU,eAAe,CAAC,KAAe;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,OAAO,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\nimport { converter } from '@ankhorage/color-theory/culori/fn';\n\nconst toOklch = converter('oklch');\n\n/*** Read the editable hue from a selected hex color. */\nexport function resolveColorHue(color: HexColor): number {\n const parsed = toOklch(color);\n return typeof parsed?.h === 'number' ? parsed.h : 0;\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HexColor } from '@ankhorage/color-theory';
|
|
2
|
+
import type { ColorToneTarget } from '../../../types/color';
|
|
3
|
+
/*** Resolve a valid hex color from a bounded OKLCH target without owning color theory policy. */
|
|
4
|
+
export declare function resolveOklchColor(target: ColorToneTarget, hue: number): HexColor;
|
|
5
|
+
//# sourceMappingURL=resolveOklchColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOklchColor.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveOklchColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAIxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,iGAAiG;AACjG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAKhF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { parseHexColorOrThrow } from '@ankhorage/color-theory';
|
|
2
|
+
import { formatHex } from '@ankhorage/color-theory/culori/fn';
|
|
3
|
+
/*** Resolve a valid hex color from a bounded OKLCH target without owning color theory policy. */
|
|
4
|
+
export function resolveOklchColor(target, hue) {
|
|
5
|
+
const formatted = formatHex({ mode: 'oklch', l: target.lightness, c: target.chroma, h: hue });
|
|
6
|
+
if (!formatted)
|
|
7
|
+
throw new Error('The supplied OKLCH target cannot be represented as a hex color.');
|
|
8
|
+
return parseHexColorOrThrow(formatted);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=resolveOklchColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOklchColor.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveOklchColor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAI9D,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,MAAuB,EAAE,GAAW;IACpE,MAAM,SAAS,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC9F,IAAI,CAAC,SAAS;QACZ,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACrF,OAAO,oBAAoB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\nimport { parseHexColorOrThrow } from '@ankhorage/color-theory';\nimport { formatHex } from '@ankhorage/color-theory/culori/fn';\n\nimport type { ColorToneTarget } from '../../../types/color';\n\n/*** Resolve a valid hex color from a bounded OKLCH target without owning color theory policy. */\nexport function resolveOklchColor(target: ColorToneTarget, hue: number): HexColor {\n const formatted = formatHex({ mode: 'oklch', l: target.lightness, c: target.chroma, h: hue });\n if (!formatted)\n throw new Error('The supplied OKLCH target cannot be represented as a hex color.');\n return parseHexColorOrThrow(formatted);\n}\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HexColor } from '@ankhorage/color-theory';
|
|
2
|
+
/*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */
|
|
3
|
+
export declare function resolveWheelColor(color: HexColor, x: number, y: number, center: number, radius: number, maxChroma: number): HexColor;
|
|
4
|
+
//# sourceMappingURL=resolveWheelColor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveWheelColor.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,qGAAqG;AACrG,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,QAAQ,EACf,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,GAChB,QAAQ,CASV"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { resolveOklchColor } from './resolveOklchColor';
|
|
2
|
+
import { resolveWheelColorComponents } from './resolveWheelColorComponents';
|
|
3
|
+
/*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */
|
|
4
|
+
export function resolveWheelColor(color, x, y, center, radius, maxChroma) {
|
|
5
|
+
const { lightness } = resolveWheelColorComponents(color);
|
|
6
|
+
const deltaX = x - center;
|
|
7
|
+
const deltaY = y - center;
|
|
8
|
+
const distance = Math.min(Math.hypot(deltaX, deltaY), radius);
|
|
9
|
+
const hue = normalizeHue((Math.atan2(deltaY, deltaX) * 180) / Math.PI + 90);
|
|
10
|
+
const chroma = (distance / radius) * maxChroma;
|
|
11
|
+
return resolveOklchColor({ lightness, chroma }, hue);
|
|
12
|
+
}
|
|
13
|
+
/*** Normalize an angular wheel coordinate to the OKLCH hue range. */
|
|
14
|
+
function normalizeHue(hue) {
|
|
15
|
+
return hue < 0 ? hue + 360 : hue;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=resolveWheelColor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveWheelColor.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,qGAAqG;AACrG,MAAM,UAAU,iBAAiB,CAC/B,KAAe,EACf,CAAS,EACT,CAAS,EACT,MAAc,EACd,MAAc,EACd,SAAiB;IAEjB,MAAM,EAAE,SAAS,EAAE,GAAG,2BAA2B,CAAC,KAAK,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,MAAM,GAAG,CAAC,GAAG,MAAM,CAAC;IAC1B,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;IAC9D,MAAM,GAAG,GAAG,YAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,QAAQ,GAAG,MAAM,CAAC,GAAG,SAAS,CAAC;IAC/C,OAAO,iBAAiB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,qEAAqE;AACrE,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnC,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\n\nimport { resolveOklchColor } from './resolveOklchColor';\nimport { resolveWheelColorComponents } from './resolveWheelColorComponents';\n\n/*** Resolve a wheel coordinate into a bounded OKLCH color while retaining the selected lightness. */\nexport function resolveWheelColor(\n color: HexColor,\n x: number,\n y: number,\n center: number,\n radius: number,\n maxChroma: number,\n): HexColor {\n const { lightness } = resolveWheelColorComponents(color);\n\n const deltaX = x - center;\n const deltaY = y - center;\n const distance = Math.min(Math.hypot(deltaX, deltaY), radius);\n const hue = normalizeHue((Math.atan2(deltaY, deltaX) * 180) / Math.PI + 90);\n const chroma = (distance / radius) * maxChroma;\n return resolveOklchColor({ lightness, chroma }, hue);\n}\n\n/*** Normalize an angular wheel coordinate to the OKLCH hue range. */\nfunction normalizeHue(hue: number): number {\n return hue < 0 ? hue + 360 : hue;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HexColor } from '@ankhorage/color-theory';
|
|
2
|
+
/*** Read the selected OKLCH values used by wheel keyboard and accessibility controls. */
|
|
3
|
+
export declare function resolveWheelColorComponents(color: HexColor): {
|
|
4
|
+
readonly chroma: number;
|
|
5
|
+
readonly lightness: number;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=resolveWheelColorComponents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveWheelColorComponents.d.ts","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColorComponents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAKxD,yFAAyF;AACzF,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,QAAQ,GAAG;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAMA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { converter } from '@ankhorage/color-theory/culori/fn';
|
|
2
|
+
const toOklch = converter('oklch');
|
|
3
|
+
/*** Read the selected OKLCH values used by wheel keyboard and accessibility controls. */
|
|
4
|
+
export function resolveWheelColorComponents(color) {
|
|
5
|
+
const parsed = toOklch(color);
|
|
6
|
+
return {
|
|
7
|
+
chroma: typeof parsed?.c === 'number' ? parsed.c : 0,
|
|
8
|
+
lightness: typeof parsed?.l === 'number' ? parsed.l : 0.65,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=resolveWheelColorComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveWheelColorComponents.js","sourceRoot":"","sources":["../../../../src/features/color/utils/resolveWheelColorComponents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAE9D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;AAEnC,yFAAyF;AACzF,MAAM,UAAU,2BAA2B,CAAC,KAAe;IAIzD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO;QACL,MAAM,EAAE,OAAO,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,SAAS,EAAE,OAAO,MAAM,EAAE,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;KAC3D,CAAC;AACJ,CAAC","sourcesContent":["import type { HexColor } from '@ankhorage/color-theory';\nimport { converter } from '@ankhorage/color-theory/culori/fn';\n\nconst toOklch = converter('oklch');\n\n/*** Read the selected OKLCH values used by wheel keyboard and accessibility controls. */\nexport function resolveWheelColorComponents(color: HexColor): {\n readonly chroma: number;\n readonly lightness: number;\n} {\n const parsed = toOklch(color);\n return {\n chroma: typeof parsed?.c === 'number' ? parsed.c : 0,\n lightness: typeof parsed?.l === 'number' ? parsed.l : 0.65,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"GraphView.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,iCAAiC,CAAC;AASzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,qBA0C9C;yBA1Ce,SAAS"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { GRAPH_VIEW_EVENTS } from '../../../constants/events';
|
|
3
|
+
import { createGraphPointerDownReader } from './createGraphPointerDownReader';
|
|
3
4
|
import { createGraphRuntime } from './createGraphRuntime';
|
|
4
5
|
import { createGraphViewDomCallbacks } from './createGraphViewDomCallbacks';
|
|
5
6
|
import { GraphNodeOverlay } from './GraphNodeOverlay';
|
|
@@ -26,8 +27,11 @@ import { GraphNodeOverlay } from './GraphNodeOverlay';
|
|
|
26
27
|
*/
|
|
27
28
|
export function GraphView(props) {
|
|
28
29
|
const hostRef = React.useRef(null);
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const pointerDownReader = React.useMemo(createGraphPointerDownReader, []);
|
|
31
|
+
const { containerRef, renderedNodes, runtimeRef } = useGraphViewRuntime(props, hostRef, pointerDownReader);
|
|
32
|
+
return (<div ref={hostRef} onPointerDown={(event) => {
|
|
33
|
+
pointerDownReader.write(event.nativeEvent);
|
|
34
|
+
}} onPointerCancel={pointerDownReader.clear} aria-label={props.ariaLabel ?? 'Graph'} className={props.className} role="application" style={{
|
|
31
35
|
height: '100%',
|
|
32
36
|
minHeight: 0,
|
|
33
37
|
minWidth: 0,
|
|
@@ -42,12 +46,12 @@ export function GraphView(props) {
|
|
|
42
46
|
/*** Publish the same canonical event registry on the standalone GraphView artifact. */
|
|
43
47
|
GraphView.events = GRAPH_VIEW_EVENTS;
|
|
44
48
|
/*** Compose React synchronization around the single imperative graph runtime. */
|
|
45
|
-
function useGraphViewRuntime(props, hostRef) {
|
|
49
|
+
function useGraphViewRuntime(props, hostRef, pointerDownReader) {
|
|
46
50
|
const containerRef = React.useRef(null);
|
|
47
51
|
const runtimeRef = React.useRef(null);
|
|
48
52
|
const callbacksRef = useGraphCallbacksRef(props, hostRef);
|
|
49
53
|
const [renderedNodes, setRenderedNodes] = React.useState([]);
|
|
50
|
-
useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef);
|
|
54
|
+
useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef, pointerDownReader);
|
|
51
55
|
useRuntimeGraphUpdate(runtimeRef, props);
|
|
52
56
|
useRuntimeSelection(runtimeRef, props.selectedNodeIds);
|
|
53
57
|
useRenderedNodeSubscription(runtimeRef, props.renderNode, setRenderedNodes);
|
|
@@ -79,18 +83,18 @@ function useGraphCallbacksRef(props, hostRef) {
|
|
|
79
83
|
return callbacksRef;
|
|
80
84
|
}
|
|
81
85
|
/*** Create and dispose the runtime only with the underlying browser container lifetime. */
|
|
82
|
-
function useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef) {
|
|
86
|
+
function useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef, pointerDownReader) {
|
|
83
87
|
React.useEffect(() => {
|
|
84
88
|
const container = containerRef.current;
|
|
85
89
|
if (container === null)
|
|
86
90
|
return;
|
|
87
|
-
const runtime = createGraphRuntime(container, callbacksRef);
|
|
91
|
+
const runtime = createGraphRuntime(container, callbacksRef, pointerDownReader.read);
|
|
88
92
|
runtimeRef.current = runtime;
|
|
89
93
|
return () => {
|
|
90
94
|
runtime.destroy();
|
|
91
95
|
runtimeRef.current = null;
|
|
92
96
|
};
|
|
93
|
-
}, [callbacksRef, containerRef, runtimeRef]);
|
|
97
|
+
}, [callbacksRef, containerRef, pointerDownReader, runtimeRef]);
|
|
94
98
|
}
|
|
95
99
|
/*** Synchronize graph data and layout policy without exposing Cytoscape to React. */
|
|
96
100
|
function useRuntimeGraphUpdate(runtimeRef, props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphView.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,g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xB,UAA4C,EAC5C,KAA+B,EAC/B,WAA0C;IAE1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,IAAI,OAAO,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO;QAC1D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,IAAI;gBAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,uEAAuE;AACvE,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;KACnD,CAAC;AACJ,CAAC","sourcesContent":["import type { CytoscapeOptions } from 'cytoscape';\nimport React from 'react';\n\nimport type {\n GraphViewCallbacks,\n GraphViewNode,\n GraphViewProps,\n GraphViewRenderedNode,\n} from '../../../../../types/graph-view';\nimport { GRAPH_VIEW_EVENTS } from '../../../constants/events';\nimport { createGraphRuntime, type GraphRuntime } from './createGraphRuntime';\nimport { createGraphViewDomCallbacks } from './createGraphViewDomCallbacks';\nimport { GraphNodeOverlay } from './GraphNodeOverlay';\n\ntype GraphContainer = NonNullable<CytoscapeOptions['container']>;\n\n/***\n * Render a browser graph while one runtime owns Cytoscape layout, viewport, and disposal.\n * zoomMode Use `fit-relative` to make controller zoom, events and min/max limits relative\n * to the visible-node fit (1 = fit). The default `absolute` keeps engine-space zoom units.\n * sizeNodesToLabels Opt in to renderer-measured plain labels, including bold and Unicode\n * text. Keep padding in styleRules. Compound and rich-node dimensions retain their existing owners.\n * minReadableLabelSize Expand the manual zoom ceiling until plain labels reach this CSS-pixel size.\n * maxFitLabelSize Cap automatic fitting at this plain-label CSS-pixel size, leaving whitespace for tiny graphs.\n * Browser lifecycle events named by public GRAPH_VIEW_EVENTS bubble from the root\n * with `detail.controller`: the same public GraphViewController delivered to React.\n * Browser integrations can call `measureNodes` without accessing the Cytoscape runtime.\n * The standalone browser artifact exposes the same names as `GraphView.events`.\n * onSpacingFactorChange Receive the spacing accepted by explicit fit({ optimizeSpacing: true }).\n * Ordinary zoom never adjusts spacing or relayouts. Explicit optimization preserves layout ordering,\n * stops once effective fit reaches maxFitLabelSize, keeps labels and unrelated compound boundaries\n * collision-safe, and permits only a small rendered background-overlap fallback for dense graphs.\n * topologyUpdatePolicy Use `preserve-positions` for controlled incremental topology changes. It\n * retains settled nodes and the user viewport, and initially places new nodes on a deterministic\n * local grid. Use an explicit controller fit or a layout change when a complete rearrangement is\n * intentional.\n */\nexport function GraphView(props: GraphViewProps) {\n const hostRef = React.useRef<HTMLDivElement | null>(null);\n const { containerRef, renderedNodes, runtimeRef } = useGraphViewRuntime(props, hostRef);\n\n return (\n <div\n ref={hostRef}\n aria-label={props.ariaLabel ?? 'Graph'}\n className={props.className}\n role=\"application\"\n style={{\n height: '100%',\n minHeight: 0,\n minWidth: 0,\n position: 'relative',\n width: '100%',\n ...props.style,\n }}\n >\n <div ref={containerRef} style={{ height: '100%', width: '100%' }} />\n {props.renderNode ? (\n <GraphNodeOverlay\n nodes={props.nodes}\n renderedNodes={renderedNodes}\n renderNode={props.renderNode}\n onNodeEvent={(id, type, selectionIntent) =>\n runtimeRef.current?.handleOverlayNodeEvent(id, type, selectionIntent)\n }\n onNodeSize={(id, size) => runtimeRef.current?.setNodeSize(id, size)}\n />\n ) : null}\n </div>\n );\n}\n\n/*** Publish the same canonical event registry on the standalone GraphView artifact. */\nGraphView.events = GRAPH_VIEW_EVENTS;\n\n/*** Compose React synchronization around the single imperative graph runtime. */\nfunction useGraphViewRuntime(\n props: GraphViewProps,\n hostRef: React.RefObject<HTMLDivElement | null>,\n) {\n const containerRef = React.useRef<GraphContainer | null>(null);\n const runtimeRef = React.useRef<GraphRuntime | null>(null);\n const callbacksRef = useGraphCallbacksRef(props, hostRef);\n const [renderedNodes, setRenderedNodes] = React.useState<readonly GraphViewRenderedNode[]>([]);\n\n useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef);\n useRuntimeGraphUpdate(runtimeRef, props);\n useRuntimeSelection(runtimeRef, props.selectedNodeIds);\n useRenderedNodeSubscription(runtimeRef, props.renderNode, setRenderedNodes);\n useKnownNodeSizes(runtimeRef, props.nodes, props.getNodeSize);\n\n return { containerRef, renderedNodes, runtimeRef };\n}\n\n/*** Keep the callback ref current without mutating refs during render. */\nfunction useGraphCallbacksRef(\n props: GraphViewProps,\n hostRef: React.RefObject<HTMLDivElement | null>,\n) {\n const callbacksRef = React.useRef<GraphViewCallbacks>(\n createGraphViewDomCallbacks(readCallbacks(props), hostRef),\n );\n const {\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n } = props;\n\n React.useEffect(() => {\n callbacksRef.current = createGraphViewDomCallbacks(\n {\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n },\n hostRef,\n );\n }, [\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n hostRef,\n ]);\n\n return callbacksRef;\n}\n\n/*** Create and dispose the runtime only with the underlying browser container lifetime. */\nfunction useRuntimeLifecycle(\n containerRef: { current: GraphContainer | null },\n runtimeRef: { current: GraphRuntime | null },\n callbacksRef: { current: GraphViewCallbacks },\n) {\n React.useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n const runtime = createGraphRuntime(container, callbacksRef);\n runtimeRef.current = runtime;\n return () => {\n runtime.destroy();\n runtimeRef.current = null;\n };\n }, [callbacksRef, containerRef, runtimeRef]);\n}\n\n/*** Synchronize graph data and layout policy without exposing Cytoscape to React. */\nfunction useRuntimeGraphUpdate(\n runtimeRef: { current: GraphRuntime | null },\n props: GraphViewProps,\n) {\n const {\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n renderNode,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n } = props;\n\n React.useEffect(() => {\n runtimeRef.current?.update({\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n richNodeRendering: renderNode !== undefined,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n });\n }, [\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n renderNode,\n runtimeRef,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n ]);\n}\n\n/*** Synchronize optional controlled selection independently from graph layout. */\nfunction useRuntimeSelection(\n runtimeRef: { current: GraphRuntime | null },\n selectedNodeIds: readonly string[] | undefined,\n) {\n React.useEffect(() => {\n runtimeRef.current?.setSelectedNodeIds(selectedNodeIds);\n }, [runtimeRef, selectedNodeIds]);\n}\n\n/*** Subscribe the optional rich-node overlay to rendered runtime positions. */\nfunction useRenderedNodeSubscription(\n runtimeRef: { current: GraphRuntime | null },\n renderNode: GraphViewProps['renderNode'],\n setRenderedNodes: (nodes: readonly GraphViewRenderedNode[]) => void,\n) {\n React.useEffect(() => {\n const runtime = runtimeRef.current;\n if (runtime === null || renderNode === undefined) {\n setRenderedNodes([]);\n return;\n }\n return runtime.subscribeRenderedNodes(setRenderedNodes);\n }, [renderNode, runtimeRef, setRenderedNodes]);\n}\n\n/*** Seed known rich-node dimensions without requiring DOM measurement. */\nfunction useKnownNodeSizes(\n runtimeRef: { current: GraphRuntime | null },\n nodes: readonly GraphViewNode[],\n getNodeSize: GraphViewProps['getNodeSize'],\n) {\n React.useEffect(() => {\n const runtime = runtimeRef.current;\n if (runtime === null || getNodeSize === undefined) return;\n for (const node of nodes) {\n const size = getNodeSize(node);\n if (size) runtime.setNodeSize(node.id, size);\n }\n }, [getNodeSize, nodes, runtimeRef]);\n}\n\n/*** Read callback props for the initial runtime callback-ref value. */\nfunction readCallbacks(props: GraphViewProps): GraphViewCallbacks {\n return {\n onEdgeEvent: props.onEdgeEvent,\n onLayoutComplete: props.onLayoutComplete,\n onNodeEvent: props.onNodeEvent,\n onReady: props.onReady,\n onViewportChange: props.onViewportChange,\n onSpacingFactorChange: props.onSpacingFactorChange,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"GraphView.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/GraphView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAItD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAC;IAC1D,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,4BAA4B,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C1D,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,gBAAgB,CAAC,CAAC,CAAC;AACjD,CAAC;AAED,0EAA0E;AAC1E,SAAS,iBAAiB,CACxB,UAA4C,EAC5C,KAA+B,EAC/B,WAA0C;IAE1C,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QACnC,IAAI,OAAO,KAAK,IAAI,IAAI,WAAW,KAAK,SAAS;YAAE,OAAO;QAC1D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;YAC/B,IAAI,IAAI;gBAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,uEAAuE;AACvE,SAAS,aAAa,CAAC,KAAqB;IAC1C,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;QACxC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;KACnD,CAAC;AACJ,CAAC","sourcesContent":["import type { CytoscapeOptions } from 'cytoscape';\nimport React from 'react';\n\nimport type {\n GraphViewCallbacks,\n GraphViewNode,\n GraphViewProps,\n GraphViewRenderedNode,\n} from '../../../../../types/graph-view';\nimport { GRAPH_VIEW_EVENTS } from '../../../constants/events';\nimport { createGraphPointerDownReader } from './createGraphPointerDownReader';\nimport { createGraphRuntime, type GraphRuntime } from './createGraphRuntime';\nimport { createGraphViewDomCallbacks } from './createGraphViewDomCallbacks';\nimport { GraphNodeOverlay } from './GraphNodeOverlay';\n\ntype GraphContainer = NonNullable<CytoscapeOptions['container']>;\n\n/***\n * Render a browser graph while one runtime owns Cytoscape layout, viewport, and disposal.\n * zoomMode Use `fit-relative` to make controller zoom, events and min/max limits relative\n * to the visible-node fit (1 = fit). The default `absolute` keeps engine-space zoom units.\n * sizeNodesToLabels Opt in to renderer-measured plain labels, including bold and Unicode\n * text. Keep padding in styleRules. Compound and rich-node dimensions retain their existing owners.\n * minReadableLabelSize Expand the manual zoom ceiling until plain labels reach this CSS-pixel size.\n * maxFitLabelSize Cap automatic fitting at this plain-label CSS-pixel size, leaving whitespace for tiny graphs.\n * Browser lifecycle events named by public GRAPH_VIEW_EVENTS bubble from the root\n * with `detail.controller`: the same public GraphViewController delivered to React.\n * Browser integrations can call `measureNodes` without accessing the Cytoscape runtime.\n * The standalone browser artifact exposes the same names as `GraphView.events`.\n * onSpacingFactorChange Receive the spacing accepted by explicit fit({ optimizeSpacing: true }).\n * Ordinary zoom never adjusts spacing or relayouts. Explicit optimization preserves layout ordering,\n * stops once effective fit reaches maxFitLabelSize, keeps labels and unrelated compound boundaries\n * collision-safe, and permits only a small rendered background-overlap fallback for dense graphs.\n * topologyUpdatePolicy Use `preserve-positions` for controlled incremental topology changes. It\n * retains settled nodes and the user viewport, and initially places new nodes on a deterministic\n * local grid. Use an explicit controller fit or a layout change when a complete rearrangement is\n * intentional.\n */\nexport function GraphView(props: GraphViewProps) {\n const hostRef = React.useRef<HTMLDivElement | null>(null);\n const pointerDownReader = React.useMemo(createGraphPointerDownReader, []);\n const { containerRef, renderedNodes, runtimeRef } = useGraphViewRuntime(\n props,\n hostRef,\n pointerDownReader,\n );\n\n return (\n <div\n ref={hostRef}\n onPointerDown={(event) => {\n pointerDownReader.write(event.nativeEvent);\n }}\n onPointerCancel={pointerDownReader.clear}\n aria-label={props.ariaLabel ?? 'Graph'}\n className={props.className}\n role=\"application\"\n style={{\n height: '100%',\n minHeight: 0,\n minWidth: 0,\n position: 'relative',\n width: '100%',\n ...props.style,\n }}\n >\n <div ref={containerRef} style={{ height: '100%', width: '100%' }} />\n {props.renderNode ? (\n <GraphNodeOverlay\n nodes={props.nodes}\n renderedNodes={renderedNodes}\n renderNode={props.renderNode}\n onNodeEvent={(id, type, selectionIntent) =>\n runtimeRef.current?.handleOverlayNodeEvent(id, type, selectionIntent)\n }\n onNodeSize={(id, size) => runtimeRef.current?.setNodeSize(id, size)}\n />\n ) : null}\n </div>\n );\n}\n\n/*** Publish the same canonical event registry on the standalone GraphView artifact. */\nGraphView.events = GRAPH_VIEW_EVENTS;\n\n/*** Compose React synchronization around the single imperative graph runtime. */\nfunction useGraphViewRuntime(\n props: GraphViewProps,\n hostRef: React.RefObject<HTMLDivElement | null>,\n pointerDownReader: ReturnType<typeof createGraphPointerDownReader>,\n) {\n const containerRef = React.useRef<GraphContainer | null>(null);\n const runtimeRef = React.useRef<GraphRuntime | null>(null);\n const callbacksRef = useGraphCallbacksRef(props, hostRef);\n const [renderedNodes, setRenderedNodes] = React.useState<readonly GraphViewRenderedNode[]>([]);\n\n useRuntimeLifecycle(containerRef, runtimeRef, callbacksRef, pointerDownReader);\n useRuntimeGraphUpdate(runtimeRef, props);\n useRuntimeSelection(runtimeRef, props.selectedNodeIds);\n useRenderedNodeSubscription(runtimeRef, props.renderNode, setRenderedNodes);\n useKnownNodeSizes(runtimeRef, props.nodes, props.getNodeSize);\n\n return { containerRef, renderedNodes, runtimeRef };\n}\n\n/*** Keep the callback ref current without mutating refs during render. */\nfunction useGraphCallbacksRef(\n props: GraphViewProps,\n hostRef: React.RefObject<HTMLDivElement | null>,\n) {\n const callbacksRef = React.useRef<GraphViewCallbacks>(\n createGraphViewDomCallbacks(readCallbacks(props), hostRef),\n );\n const {\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n } = props;\n\n React.useEffect(() => {\n callbacksRef.current = createGraphViewDomCallbacks(\n {\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n },\n hostRef,\n );\n }, [\n onEdgeEvent,\n onLayoutComplete,\n onNodeEvent,\n onReady,\n onViewportChange,\n onSpacingFactorChange,\n hostRef,\n ]);\n\n return callbacksRef;\n}\n\n/*** Create and dispose the runtime only with the underlying browser container lifetime. */\nfunction useRuntimeLifecycle(\n containerRef: { current: GraphContainer | null },\n runtimeRef: { current: GraphRuntime | null },\n callbacksRef: { current: GraphViewCallbacks },\n pointerDownReader: ReturnType<typeof createGraphPointerDownReader>,\n) {\n React.useEffect(() => {\n const container = containerRef.current;\n if (container === null) return;\n const runtime = createGraphRuntime(container, callbacksRef, pointerDownReader.read);\n runtimeRef.current = runtime;\n return () => {\n runtime.destroy();\n runtimeRef.current = null;\n };\n }, [callbacksRef, containerRef, pointerDownReader, runtimeRef]);\n}\n\n/*** Synchronize graph data and layout policy without exposing Cytoscape to React. */\nfunction useRuntimeGraphUpdate(\n runtimeRef: { current: GraphRuntime | null },\n props: GraphViewProps,\n) {\n const {\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n renderNode,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n } = props;\n\n React.useEffect(() => {\n runtimeRef.current?.update({\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n richNodeRendering: renderNode !== undefined,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n });\n }, [\n edges,\n fitPadding,\n layout,\n layoutOptions,\n maxZoom,\n minReadableLabelSize,\n maxFitLabelSize,\n minZoom,\n zoomMode,\n sizeNodesToLabels,\n nodes,\n renderNode,\n runtimeRef,\n spacingFactor,\n styleRules,\n topologyUpdatePolicy,\n ]);\n}\n\n/*** Synchronize optional controlled selection independently from graph layout. */\nfunction useRuntimeSelection(\n runtimeRef: { current: GraphRuntime | null },\n selectedNodeIds: readonly string[] | undefined,\n) {\n React.useEffect(() => {\n runtimeRef.current?.setSelectedNodeIds(selectedNodeIds);\n }, [runtimeRef, selectedNodeIds]);\n}\n\n/*** Subscribe the optional rich-node overlay to rendered runtime positions. */\nfunction useRenderedNodeSubscription(\n runtimeRef: { current: GraphRuntime | null },\n renderNode: GraphViewProps['renderNode'],\n setRenderedNodes: (nodes: readonly GraphViewRenderedNode[]) => void,\n) {\n React.useEffect(() => {\n const runtime = runtimeRef.current;\n if (runtime === null || renderNode === undefined) {\n setRenderedNodes([]);\n return;\n }\n return runtime.subscribeRenderedNodes(setRenderedNodes);\n }, [renderNode, runtimeRef, setRenderedNodes]);\n}\n\n/*** Seed known rich-node dimensions without requiring DOM measurement. */\nfunction useKnownNodeSizes(\n runtimeRef: { current: GraphRuntime | null },\n nodes: readonly GraphViewNode[],\n getNodeSize: GraphViewProps['getNodeSize'],\n) {\n React.useEffect(() => {\n const runtime = runtimeRef.current;\n if (runtime === null || getNodeSize === undefined) return;\n for (const node of nodes) {\n const size = getNodeSize(node);\n if (size) runtime.setNodeSize(node.id, size);\n }\n }, [getNodeSize, nodes, runtimeRef]);\n}\n\n/*** Read callback props for the initial runtime callback-ref value. */\nfunction readCallbacks(props: GraphViewProps): GraphViewCallbacks {\n return {\n onEdgeEvent: props.onEdgeEvent,\n onLayoutComplete: props.onLayoutComplete,\n onNodeEvent: props.onNodeEvent,\n onReady: props.onReady,\n onViewportChange: props.onViewportChange,\n onSpacingFactorChange: props.onSpacingFactorChange,\n };\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Core } from 'cytoscape';
|
|
1
|
+
import type { Core, EventObject } from 'cytoscape';
|
|
2
2
|
import type { GraphViewCallbacks, GraphViewController } from '../../../../../types/graph-view';
|
|
3
3
|
/*** Bind stable Cytoscape events that always read the latest React callbacks. */
|
|
4
4
|
export declare function bindGraphEvents(cy: Core, callbacksRef: {
|
|
5
5
|
current: GraphViewCallbacks;
|
|
6
|
-
}, controller: GraphViewController, onRuntimeChange: () => void): () => void;
|
|
6
|
+
}, controller: GraphViewController, onRuntimeChange: () => void, readLatestPointerDown?: (event: EventObject) => unknown): () => void;
|
|
7
7
|
//# sourceMappingURL=bindGraphEvents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindGraphEvents.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"bindGraphEvents.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EAGpB,MAAM,iCAAiC,CAAC;AAGzC,iFAAiF;AACjF,wBAAgB,eAAe,CAC7B,EAAE,EAAE,IAAI,EACR,YAAY,EAAE;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,EAC7C,UAAU,EAAE,mBAAmB,EAC/B,eAAe,EAAE,MAAM,IAAI,EAC3B,qBAAqB,GAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAoB,cA2BpE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resolveSelectionEventIntent } from '../../../../selection/application/resolveSelectionEventIntent';
|
|
2
2
|
/*** Bind stable Cytoscape events that always read the latest React callbacks. */
|
|
3
|
-
export function bindGraphEvents(cy, callbacksRef, controller, onRuntimeChange) {
|
|
4
|
-
const nodeHandlers = bindElementEvents(cy, 'node', callbacksRef, onRuntimeChange);
|
|
5
|
-
const edgeHandlers = bindElementEvents(cy, 'edge', callbacksRef, onRuntimeChange);
|
|
3
|
+
export function bindGraphEvents(cy, callbacksRef, controller, onRuntimeChange, readLatestPointerDown = () => null) {
|
|
4
|
+
const nodeHandlers = bindElementEvents(cy, 'node', callbacksRef, onRuntimeChange, readLatestPointerDown);
|
|
5
|
+
const edgeHandlers = bindElementEvents(cy, 'edge', callbacksRef, onRuntimeChange, readLatestPointerDown);
|
|
6
6
|
const viewportHandler = () => {
|
|
7
7
|
callbacksRef.current.onViewportChange?.(controller.getViewport());
|
|
8
8
|
onRuntimeChange();
|
|
@@ -15,13 +15,13 @@ export function bindGraphEvents(cy, callbacksRef, controller, onRuntimeChange) {
|
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
/*** Bind one selector's translated event set without resubscribing on callback changes. */
|
|
18
|
-
function bindElementEvents(cy, selector, callbacksRef, onRuntimeChange) {
|
|
18
|
+
function bindElementEvents(cy, selector, callbacksRef, onRuntimeChange, readLatestPointerDown) {
|
|
19
19
|
return EVENT_TYPES.map(([cytoscapeEvent, type]) => {
|
|
20
20
|
const handler = (event) => {
|
|
21
21
|
const target = event.target;
|
|
22
22
|
if (!isGraphEventTarget(target))
|
|
23
23
|
return;
|
|
24
|
-
emitElementEvent(callbacksRef.current, selector, createElementEvent(event, target.id(), type));
|
|
24
|
+
emitElementEvent(callbacksRef.current, selector, createElementEvent(event, target.id(), type, type === 'press' ? readLatestPointerDown(event) : null));
|
|
25
25
|
onRuntimeChange();
|
|
26
26
|
};
|
|
27
27
|
cy.on(cytoscapeEvent, selector, handler);
|
|
@@ -29,13 +29,13 @@ function bindElementEvents(cy, selector, callbacksRef, onRuntimeChange) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
/*** Translate one renderer event into the engine-neutral public event contract. */
|
|
32
|
-
function createElementEvent(event, id, type) {
|
|
32
|
+
function createElementEvent(event, id, type, nativeEvent) {
|
|
33
33
|
if (type !== 'press')
|
|
34
34
|
return { id, type };
|
|
35
35
|
return {
|
|
36
36
|
id,
|
|
37
37
|
type,
|
|
38
|
-
selectionIntent: resolveSelectionEventIntent(event, 'pointer'),
|
|
38
|
+
selectionIntent: resolveSelectionEventIntent(event, 'pointer', nativeEvent),
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/*** Return whether a Cytoscape event target exposes the element identifier contract. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bindGraphEvents.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+DAA+D,CAAC;AAE5G,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAC7B,EAAQ,EACR,YAA6C,EAC7C,UAA+B,EAC/B,eAA2B;
|
|
1
|
+
{"version":3,"file":"bindGraphEvents.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/bindGraphEvents.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+DAA+D,CAAC;AAE5G,iFAAiF;AACjF,MAAM,UAAU,eAAe,CAC7B,EAAQ,EACR,YAA6C,EAC7C,UAA+B,EAC/B,eAA2B,EAC3B,wBAAyD,GAAG,EAAE,CAAC,IAAI;IAEnE,MAAM,YAAY,GAAG,iBAAiB,CACpC,EAAE,EACF,MAAM,EACN,YAAY,EACZ,eAAe,EACf,qBAAqB,CACtB,CAAC;IACF,MAAM,YAAY,GAAG,iBAAiB,CACpC,EAAE,EACF,MAAM,EACN,YAAY,EACZ,eAAe,EACf,qBAAqB,CACtB,CAAC;IACF,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;QAClE,eAAe,EAAE,CAAC;IACpB,CAAC,CAAC;IACF,EAAE,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAEnC,OAAO,GAAG,EAAE;QACV,mBAAmB,CAAC,EA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5E,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,EAAE,KAAK,UAAU,CAC/F,CAAC;AACJ,CAAC;AAMD,mFAAmF;AACnF,SAAS,gBAAgB,CACvB,SAA6B,EAC7B,QAAyB,EACzB,KAA4B;IAE5B,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC;QAC/B,OAAO;IACT,CAAC;IACD,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC;AAED,uFAAuF;AACvF,SAAS,mBAAmB,CAC1B,EAAQ,EACR,QAAyB,EACzB,QAAwC;IAExC,KAAK,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,IAAI,QAAQ,EAAE,CAAC;QACnD,EAAE,CAAC,GAAG,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG;IAClB,CAAC,KAAK,EAAE,OAAO,CAAC;IAChB,CAAC,QAAQ,EAAE,cAAc,CAAC;IAC1B,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,UAAU,EAAE,UAAU,CAAC;IACxB,CAAC,WAAW,EAAE,eAAe,CAAC;IAC9B,CAAC,UAAU,EAAE,eAAe,CAAC;CAC+C,CAAC","sourcesContent":["import type { Core, EventObject } from 'cytoscape';\n\nimport type {\n GraphViewCallbacks,\n GraphViewController,\n GraphViewElementEvent,\n GraphViewElementEventType,\n} from '../../../../../types/graph-view';\nimport { resolveSelectionEventIntent } from '../../../../selection/application/resolveSelectionEventIntent';\n\n/*** Bind stable Cytoscape events that always read the latest React callbacks. */\nexport function bindGraphEvents(\n cy: Core,\n callbacksRef: { current: GraphViewCallbacks },\n controller: GraphViewController,\n onRuntimeChange: () => void,\n readLatestPointerDown: (event: EventObject) => unknown = () => null,\n) {\n const nodeHandlers = bindElementEvents(\n cy,\n 'node',\n callbacksRef,\n onRuntimeChange,\n readLatestPointerDown,\n );\n const edgeHandlers = bindElementEvents(\n cy,\n 'edge',\n callbacksRef,\n onRuntimeChange,\n readLatestPointerDown,\n );\n const viewportHandler = () => {\n callbacksRef.current.onViewportChange?.(controller.getViewport());\n onRuntimeChange();\n };\n cy.on('zoom pan', viewportHandler);\n\n return () => {\n unbindElementEvents(cy, 'node', nodeHandlers);\n unbindElementEvents(cy, 'edge', edgeHandlers);\n cy.off('zoom pan', viewportHandler);\n };\n}\n\ntype ElementSelector = 'edge' | 'node';\n\ninterface BoundElementHandler {\n readonly cytoscapeEvent: string;\n readonly handler: (event: EventObject) => void;\n}\n\n/*** Bind one selector's translated event set without resubscribing on callback changes. */\nfunction bindElementEvents(\n cy: Core,\n selector: ElementSelector,\n callbacksRef: { current: GraphViewCallbacks },\n onRuntimeChange: () => void,\n readLatestPointerDown: (event: EventObject) => unknown,\n): readonly BoundElementHandler[] {\n return EVENT_TYPES.map(([cytoscapeEvent, type]) => {\n const handler = (event: EventObject) => {\n const target: unknown = event.target;\n if (!isGraphEventTarget(target)) return;\n emitElementEvent(\n callbacksRef.current,\n selector,\n createElementEvent(\n event,\n target.id(),\n type,\n type === 'press' ? readLatestPointerDown(event) : null,\n ),\n );\n onRuntimeChange();\n };\n cy.on(cytoscapeEvent, selector, handler);\n return { cytoscapeEvent, handler };\n });\n}\n\n/*** Translate one renderer event into the engine-neutral public event contract. */\nfunction createElementEvent(\n event: EventObject,\n id: string,\n type: GraphViewElementEventType,\n nativeEvent: unknown,\n): GraphViewElementEvent {\n if (type !== 'press') return { id, type };\n return {\n id,\n type,\n selectionIntent: resolveSelectionEventIntent(event, 'pointer', nativeEvent),\n };\n}\n\n/*** Return whether a Cytoscape event target exposes the element identifier contract. */\nfunction isGraphEventTarget(value: unknown): value is GraphEventTarget {\n return (\n typeof value === 'object' && value !== null && 'id' in value && typeof value.id === 'function'\n );\n}\n\ninterface GraphEventTarget {\n id(): string;\n}\n\n/*** Emit one translated element event without dynamic callback-property access. */\nfunction emitElementEvent(\n callbacks: GraphViewCallbacks,\n selector: ElementSelector,\n event: GraphViewElementEvent,\n) {\n if (selector === 'node') {\n callbacks.onNodeEvent?.(event);\n return;\n }\n callbacks.onEdgeEvent?.(event);\n}\n\n/*** Remove one selector's event handlers using the exact bound callback identities. */\nfunction unbindElementEvents(\n cy: Core,\n selector: ElementSelector,\n handlers: readonly BoundElementHandler[],\n) {\n for (const { cytoscapeEvent, handler } of handlers) {\n cy.off(cytoscapeEvent, selector, handler);\n }\n}\n\nconst EVENT_TYPES = [\n ['tap', 'press'],\n ['dbltap', 'double-press'],\n ['select', 'select'],\n ['unselect', 'unselect'],\n ['mouseover', 'pointer-enter'],\n ['mouseout', 'pointer-leave'],\n] as const satisfies readonly (readonly [string, GraphViewElementEventType])[];\n"]}
|
package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/*** Correlate one native pointer-down snapshot with its renderer activation without retaining stale modifiers. */
|
|
2
|
+
export declare function createGraphPointerDownReader(): {
|
|
3
|
+
clear: () => void;
|
|
4
|
+
read: (rendererEvent: unknown) => unknown;
|
|
5
|
+
write: (event: unknown) => void;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=createGraphPointerDownReader.d.ts.map
|
package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGraphPointerDownReader.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.ts"],"names":[],"mappings":"AAEA,kHAAkH;AAClH,wBAAgB,4BAA4B;;0BAOlB,OAAO,KAAG,OAAO;mBAMxB,OAAO;EAIzB"}
|
package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isRecord } from '@ankhorage/utility/object';
|
|
2
|
+
/*** Correlate one native pointer-down snapshot with its renderer activation without retaining stale modifiers. */
|
|
3
|
+
export function createGraphPointerDownReader() {
|
|
4
|
+
let latestPointerDown = null;
|
|
5
|
+
return {
|
|
6
|
+
clear: () => {
|
|
7
|
+
latestPointerDown = null;
|
|
8
|
+
},
|
|
9
|
+
read: (rendererEvent) => {
|
|
10
|
+
const pointerDown = latestPointerDown;
|
|
11
|
+
latestPointerDown = null;
|
|
12
|
+
if (pointerDown === null)
|
|
13
|
+
return null;
|
|
14
|
+
return matchesPointerActivation(pointerDown, rendererEvent) ? pointerDown.event : null;
|
|
15
|
+
},
|
|
16
|
+
write: (event) => {
|
|
17
|
+
latestPointerDown = createPointerDownSnapshot(event);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/*** Match only the same browser pointer so unrelated renderer events cannot inherit modifiers. */
|
|
22
|
+
function matchesPointerActivation(pointerDown, rendererEvent) {
|
|
23
|
+
return readRendererPointerId(rendererEvent) === pointerDown.pointerId;
|
|
24
|
+
}
|
|
25
|
+
/*** Retain a browser pointer event only when it provides a stable pointer identity. */
|
|
26
|
+
function createPointerDownSnapshot(event) {
|
|
27
|
+
if (!isRecord(event) || typeof event.pointerId !== 'number')
|
|
28
|
+
return null;
|
|
29
|
+
return { event, pointerId: event.pointerId };
|
|
30
|
+
}
|
|
31
|
+
/*** Read Cytoscape's underlying browser event without trusting programmatic event shapes. */
|
|
32
|
+
function readRendererPointerId(value) {
|
|
33
|
+
if (!isRecord(value))
|
|
34
|
+
return null;
|
|
35
|
+
const { originalEvent } = value;
|
|
36
|
+
if (!isRecord(originalEvent) || typeof originalEvent.pointerId !== 'number')
|
|
37
|
+
return null;
|
|
38
|
+
return originalEvent.pointerId;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=createGraphPointerDownReader.js.map
|
package/dist/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createGraphPointerDownReader.js","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphPointerDownReader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,kHAAkH;AAClH,MAAM,UAAU,4BAA4B;IAC1C,IAAI,iBAAiB,GAAoC,IAAI,CAAC;IAE9D,OAAO;QACL,KAAK,EAAE,GAAG,EAAE;YACV,iBAAiB,GAAG,IAAI,CAAC;QAC3B,CAAC;QACD,IAAI,EAAE,CAAC,aAAsB,EAAW,EAAE;YACxC,MAAM,WAAW,GAAG,iBAAiB,CAAC;YACtC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI,WAAW,KAAK,IAAI;gBAAE,OAAO,IAAI,CAAC;YACtC,OAAO,wBAAwB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QACzF,CAAC;QACD,KAAK,EAAE,CAAC,KAAc,EAAE,EAAE;YACxB,iBAAiB,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kGAAkG;AAClG,SAAS,wBAAwB,CAC/B,WAAqC,EACrC,aAAsB;IAEtB,OAAO,qBAAqB,CAAC,aAAa,CAAC,KAAK,WAAW,CAAC,SAAS,CAAC;AACxE,CAAC;AAED,uFAAuF;AACvF,SAAS,yBAAyB,CAAC,KAAc;IAC/C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;AAC/C,CAAC;AAED,6FAA6F;AAC7F,SAAS,qBAAqB,CAAC,KAAc;IAC3C,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAChC,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,OAAO,aAAa,CAAC,SAAS,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzF,OAAO,aAAa,CAAC,SAAS,CAAC;AACjC,CAAC","sourcesContent":["import { isRecord } from '@ankhorage/utility/object';\n\n/*** Correlate one native pointer-down snapshot with its renderer activation without retaining stale modifiers. */\nexport function createGraphPointerDownReader() {\n let latestPointerDown: GraphPointerDownSnapshot | null = null;\n\n return {\n clear: () => {\n latestPointerDown = null;\n },\n read: (rendererEvent: unknown): unknown => {\n const pointerDown = latestPointerDown;\n latestPointerDown = null;\n if (pointerDown === null) return null;\n return matchesPointerActivation(pointerDown, rendererEvent) ? pointerDown.event : null;\n },\n write: (event: unknown) => {\n latestPointerDown = createPointerDownSnapshot(event);\n },\n };\n}\n\n/*** Match only the same browser pointer so unrelated renderer events cannot inherit modifiers. */\nfunction matchesPointerActivation(\n pointerDown: GraphPointerDownSnapshot,\n rendererEvent: unknown,\n): boolean {\n return readRendererPointerId(rendererEvent) === pointerDown.pointerId;\n}\n\n/*** Retain a browser pointer event only when it provides a stable pointer identity. */\nfunction createPointerDownSnapshot(event: unknown): GraphPointerDownSnapshot | null {\n if (!isRecord(event) || typeof event.pointerId !== 'number') return null;\n return { event, pointerId: event.pointerId };\n}\n\n/*** Read Cytoscape's underlying browser event without trusting programmatic event shapes. */\nfunction readRendererPointerId(value: unknown): number | null {\n if (!isRecord(value)) return null;\n const { originalEvent } = value;\n if (!isRecord(originalEvent) || typeof originalEvent.pointerId !== 'number') return null;\n return originalEvent.pointerId;\n}\n\ninterface GraphPointerDownSnapshot {\n readonly event: unknown;\n readonly pointerId: number;\n}\n"]}
|
|
@@ -15,6 +15,6 @@ export interface GraphRuntime {
|
|
|
15
15
|
/*** Create one Cytoscape runtime that exclusively owns layout, fit, resize, and disposal. */
|
|
16
16
|
export declare function createGraphRuntime(container: GraphContainer, callbacksRef: {
|
|
17
17
|
current: GraphViewCallbacks;
|
|
18
|
-
}): GraphRuntime;
|
|
18
|
+
}, readLatestPointerDown?: (event: unknown) => unknown): GraphRuntime;
|
|
19
19
|
export {};
|
|
20
20
|
//# sourceMappingURL=createGraphRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGraphRuntime.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAkB,EAAa,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EAEzB,qBAAqB,EACrB,aAAa,EAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAkBhF,KAAK,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AACpD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,KAAK,IAAI,CAAC;AAE9E,MAAM,WAAW,YAAY;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,sBAAsB,CACpB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,yBAAyB,EAC/B,eAAe,CAAC,EAAE,eAAe,GAChC,IAAI,CAAC;IACR,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IACnD,kBAAkB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;IACjE,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC;
|
|
1
|
+
{"version":3,"file":"createGraphRuntime.d.ts","sourceRoot":"","sources":["../../../../../../src/features/graph-view/adapters/inbound/web-artifact/createGraphRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAkB,EAAa,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAExE,OAAO,KAAK,EACV,kBAAkB,EAClB,yBAAyB,EAEzB,qBAAqB,EACrB,aAAa,EAEd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAkBhF,KAAK,cAAc,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;AACpD,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,KAAK,IAAI,CAAC;AAE9E,MAAM,WAAW,YAAY;IAC3B,OAAO,IAAI,IAAI,CAAC;IAChB,sBAAsB,CACpB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,yBAAyB,EAC/B,eAAe,CAAC,EAAE,eAAe,GAChC,IAAI,CAAC;IACR,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IACnD,kBAAkB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;IACjE,sBAAsB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAAC;IACnE,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CACzC;AA8BD,6FAA6F;AAC7F,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,cAAc,EACzB,YAAY,EAAE;IAAE,OAAO,EAAE,kBAAkB,CAAA;CAAE,EAC7C,qBAAqB,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAoB,GAC9D,YAAY,CAoBd"}
|
|
@@ -16,7 +16,7 @@ import { shouldFitGraphAfterLayout } from './shouldFitGraphAfterLayout';
|
|
|
16
16
|
import { sizeGraphNodesToLabels } from './sizeGraphNodesToLabels';
|
|
17
17
|
import { syncGraphElements } from './syncGraphElements';
|
|
18
18
|
/*** Create one Cytoscape runtime that exclusively owns layout, fit, resize, and disposal. */
|
|
19
|
-
export function createGraphRuntime(container, callbacksRef) {
|
|
19
|
+
export function createGraphRuntime(container, callbacksRef, readLatestPointerDown = () => null) {
|
|
20
20
|
const cy = cytoscape({
|
|
21
21
|
container,
|
|
22
22
|
elements: [],
|
|
@@ -25,7 +25,7 @@ export function createGraphRuntime(container, callbacksRef) {
|
|
|
25
25
|
selectionType: 'additive',
|
|
26
26
|
userPanningEnabled: true,
|
|
27
27
|
});
|
|
28
|
-
const state = createRuntimeState(cy, container, callbacksRef);
|
|
28
|
+
const state = createRuntimeState(cy, container, callbacksRef, readLatestPointerDown);
|
|
29
29
|
return {
|
|
30
30
|
destroy: () => destroyRuntime(state),
|
|
31
31
|
handleOverlayNodeEvent: (id, type, selectionIntent) => handleOverlayNodeEvent(state, id, type, selectionIntent),
|
|
@@ -36,7 +36,7 @@ export function createGraphRuntime(container, callbacksRef) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
/*** Build the mutable state shared by the single graph-runtime owner. */
|
|
39
|
-
function createRuntimeState(cy, container, callbacksRef) {
|
|
39
|
+
function createRuntimeState(cy, container, callbacksRef, readLatestPointerDown) {
|
|
40
40
|
const fitPaddingRef = { current: 50 };
|
|
41
41
|
const viewport = createGraphController(cy, fitPaddingRef, (options) => requestOptimizedFit(state, options));
|
|
42
42
|
const { controller } = viewport;
|
|
@@ -54,6 +54,7 @@ function createRuntimeState(cy, container, callbacksRef) {
|
|
|
54
54
|
generationRef: { current: 0 },
|
|
55
55
|
geometryRef: { current: null },
|
|
56
56
|
hoveredNodeIds: new Set(),
|
|
57
|
+
initialLayoutScheduledRef: { current: false },
|
|
57
58
|
latestUpdateRef: { current: null },
|
|
58
59
|
layoutRef: { current: null },
|
|
59
60
|
layoutRunningRef,
|
|
@@ -67,7 +68,7 @@ function createRuntimeState(cy, container, callbacksRef) {
|
|
|
67
68
|
relayoutScheduledRef: { current: false },
|
|
68
69
|
renderedNodeListeners,
|
|
69
70
|
};
|
|
70
|
-
const unbindEvents = bindGraphEvents(cy, callbacksRef, controller, () => emitRenderedNodes(stateBase));
|
|
71
|
+
const unbindEvents = bindGraphEvents(cy, callbacksRef, controller, () => emitRenderedNodes(stateBase), readLatestPointerDown);
|
|
71
72
|
const resizeObserver = createGraphResizeObserver({
|
|
72
73
|
container,
|
|
73
74
|
cy,
|
|
@@ -163,6 +164,29 @@ function getRetainedNodeIds(previous, input, preservesTopology) {
|
|
|
163
164
|
}
|
|
164
165
|
/*** Start a generation-safe layout whose completion is the only normal automatic fit trigger. */
|
|
165
166
|
function startCurrentLayout(state, input) {
|
|
167
|
+
if (!state.readyRef.current) {
|
|
168
|
+
scheduleInitialLayout(state);
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
startGraphLayout(state, input);
|
|
172
|
+
}
|
|
173
|
+
/*** Coalesce progressive pre-ready topology updates before the initial layout can complete. */
|
|
174
|
+
function scheduleInitialLayout(state) {
|
|
175
|
+
if (state.initialLayoutScheduledRef.current)
|
|
176
|
+
return;
|
|
177
|
+
state.initialLayoutScheduledRef.current = true;
|
|
178
|
+
scheduleGraphFrame(() => {
|
|
179
|
+
scheduleGraphFrame(() => {
|
|
180
|
+
state.initialLayoutScheduledRef.current = false;
|
|
181
|
+
const input = state.latestUpdateRef.current;
|
|
182
|
+
if (input === null || state.cy.destroyed() || state.readyRef.current)
|
|
183
|
+
return;
|
|
184
|
+
startGraphLayout(state, input);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/*** Start one layout generation after its input has reached the runtime owner. */
|
|
189
|
+
function startGraphLayout(state, input) {
|
|
166
190
|
state.pendingInitialFitRef.current = false;
|
|
167
191
|
const generation = state.generationRef.current + 1;
|
|
168
192
|
state.generationRef.current = generation;
|