@almadar/ui 5.116.1 → 5.118.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/avl/index.cjs +97 -20
- package/dist/avl/index.js +97 -20
- package/dist/components/index.cjs +97 -20
- package/dist/components/index.d.cts +20 -2
- package/dist/components/index.d.ts +20 -2
- package/dist/components/index.js +97 -20
- package/dist/providers/index.cjs +97 -20
- package/dist/providers/index.js +97 -20
- package/dist/runtime/index.cjs +97 -20
- package/dist/runtime/index.js +97 -20
- package/package.json +1 -1
|
@@ -8831,6 +8831,18 @@ interface GraphEdge {
|
|
|
8831
8831
|
weight?: number;
|
|
8832
8832
|
color?: string;
|
|
8833
8833
|
}
|
|
8834
|
+
/**
|
|
8835
|
+
* All-pairs similarity (cosine 0–1) used ONLY for layout: ideal pair distance
|
|
8836
|
+
* is derived from similarity (higher ⇒ closer). Never drawn — `edges` remain
|
|
8837
|
+
* the only rendered links. When provided it supersedes edge-weight attraction;
|
|
8838
|
+
* when omitted, edges drive layout as before.
|
|
8839
|
+
*/
|
|
8840
|
+
interface GraphSimilarity {
|
|
8841
|
+
source: string;
|
|
8842
|
+
target: string;
|
|
8843
|
+
/** Cosine similarity in [0,1]; higher ⇒ closer. */
|
|
8844
|
+
weight: number;
|
|
8845
|
+
}
|
|
8834
8846
|
interface GraphAction {
|
|
8835
8847
|
label: string;
|
|
8836
8848
|
event?: string;
|
|
@@ -8842,8 +8854,14 @@ interface GraphCanvasProps {
|
|
|
8842
8854
|
title?: string;
|
|
8843
8855
|
/** Graph nodes */
|
|
8844
8856
|
nodes?: readonly GraphNode[];
|
|
8845
|
-
/** Graph edges */
|
|
8857
|
+
/** Graph edges (the only rendered links) */
|
|
8846
8858
|
edges?: readonly GraphEdge[];
|
|
8859
|
+
/**
|
|
8860
|
+
* All-pairs similarity (cosine 0–1) used ONLY for layout: ideal pair
|
|
8861
|
+
* distance = linkDistance × (1 − cosine). Never drawn. When provided it
|
|
8862
|
+
* supersedes edge-weight attraction; when omitted, edges drive layout.
|
|
8863
|
+
*/
|
|
8864
|
+
similarity?: readonly GraphSimilarity[];
|
|
8847
8865
|
/** Canvas height */
|
|
8848
8866
|
height?: number;
|
|
8849
8867
|
/** Show node labels */
|
|
@@ -11226,4 +11244,4 @@ interface AboutPageTemplateProps extends TemplateProps<AboutPageEntity> {
|
|
|
11226
11244
|
}
|
|
11227
11245
|
declare const AboutPageTemplate: React__default.FC<AboutPageTemplateProps>;
|
|
11228
11246
|
|
|
11229
|
-
export { ALL_PRESETS, AR_BOOK_FIELDS, type AboutPageEntity, AboutPageTemplate, type AboutPageTemplateProps, Accordion, type AccordionItem, type AccordionProps, Card as ActionCard, type CardProps as ActionCardProps, ActionPalette, type ActionPaletteProps, ActionTile, type ActionTileProps, ActivationBlock, type ActivationBlockProps, Alert, type AlertProps, type AlertVariant, type AlgorithmBar, AlgorithmCanvas, type AlgorithmCanvasProps, type AlgorithmCell, type AlgorithmPointer, AnimatedCounter, type AnimatedCounterProps, AnimatedGraphic, type AnimatedGraphicProps, AnimatedReveal, type AnimatedRevealProps, ArticleSection, type ArticleSectionProps, Aside, type AsideProps, AssetPicker, type AssetPickerProps, AtlasImage, type AtlasImageAsset, type AtlasImageProps, AtlasPanel, type AtlasPanelProps, AuthLayout, type AuthLayoutProps, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeVariant, BehaviorView, type BehaviorViewProps, BiologyCanvas, type BiologyCanvasProps, type BiologyEdge, type BiologyNode, type BlockType, type BloomLevel, BloomQuizBlock, type BloomQuizBlockProps, BookChapterView, type BookChapterViewProps, BookCoverPage, type BookCoverPageProps, type BookFieldMap, BookNavBar, type BookNavBarProps, BookTableOfContents, type BookTableOfContentsProps, BookViewer, type BookViewerProps, Box, type BoxBg, type BoxMargin, type BoxPadding, type BoxProps, type BoxRounded, type BoxShadow, BranchingLogicBuilder, type BranchingLogicBuilderProps, type BranchingQuestion, type BranchingRule, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, CTABanner, type CTABannerBackground, type CTABannerProps, CalendarGrid, type CalendarGridProps, type CameraMode, CameraState, Canvas, Canvas2D, type Canvas2DProps, type CanvasItemShape, type CanvasItemStatus, type CanvasMode, type CanvasProps, Card$1 as Card, type CardAction, CardBody, CardContent, CardFooter, CardGrid, type CardGridGap, type CardGridProps, CardHeader, type CardProps$1 as CardProps, CardTitle, Carousel, type CarouselProps, CaseStudyCard, type CaseStudyCardProps, CaseStudyOrganism, type CaseStudyOrganismProps, Center, type CenterProps, Chart, type ChartDataPoint, ChartLegend, type ChartLegendItem, type ChartLegendProps, type ChartProps, type ChartSeries, type ChartType, ChatBar, type ChatBarProps, type ChatBarStatus, Checkbox, type CheckboxProps, type ChemistryArrow, type ChemistryAtom, type ChemistryBond, ChemistryCanvas, type ChemistryCanvasProps, ChoiceButton, type ChoiceButtonProps, Coachmark, type CoachmarkAnchor, type CoachmarkPlacement, type CoachmarkProps, CodeBlock, type CodeBlockProps, type CodeLanguage, CodeRunnerPanel, type CodeRunnerPanelProps, type CodeSimulationOutput, type CodeViewerAction, type CodeViewerFile, type CodeViewerMode, CollapsibleSection, type CollapsibleSectionProps, type Column, CommunityLinks, type CommunityLinksProps, type ConditionalContext, ConditionalWrapper, type ConditionalWrapperProps, ConfettiEffect, type ConfettiEffectProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogVariant, ConnectionBlock, type ConnectionBlockProps, Container, type ContainerProps, ContentRenderer, type ContentRendererProps, ContentSection, type ContentSectionBackground, type ContentSectionPadding, type ContentSectionProps, ControlButton, type ControlButtonProps, ControlGrid, type ControlGridButton, type ControlGridKind, type ControlGridProps, type CounterSize, CounterTemplate, type CounterTemplateProps, type CounterVariant, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, type DPadDirection, DashboardGrid, type DashboardGridCell, type DashboardGridProps, DashboardLayout, type DashboardLayoutProps, DataGrid, type DataGridField, type DataGridItemAction, type DataGridProps, DataList, type DataListField, type DataListItemAction, type DataListProps, DataTable, type DataTableProps, DateRangePicker, type DateRangePickerPreset, type DateRangePickerProps, DateRangeSelector, type DateRangeSelectorOption, type DateRangeSelectorProps, DayCell, type DayCellProps, type DetailField, DetailPanel, type DetailPanelProps, type DetailSection, Dialog, type DialogProps, DialogueBubble, type DialogueBubbleProps, type DiffLine$1 as DiffLine, type DiffLineType, type DiffRevision, type DisplayStateProps, Divider, type DividerOrientation, type DividerProps, DocBreadcrumb, type DocBreadcrumbItem, type DocBreadcrumbProps, DocPagination, type DocPaginationLink, type DocPaginationProps, DocSearch, type DocSearchProps, type DocSearchResult, DocSidebar, type DocSidebarItem, type DocSidebarProps, DocTOC, type DocTOCItem, type DocTOCProps, type DocumentType, DocumentViewer, type DocumentViewerProps, StateMachineView as DomStateMachineVisualizer, type DotSize, type DotState, Drawer, type DrawerPosition, type DrawerProps, type DrawerSize, DrawerSlot, type DrawerSlotProps, ELEMENT_SELECTED_EVENT, EdgeDecoration, type EdgeDecorationProps, type EdgeSide, type EdgeVariant, EditorCheckbox, type EditorCheckboxProps, type EditorMode, EditorSelect, type EditorSelectProps, EditorSlider, type EditorSliderProps, EditorTextInput, type EditorTextInputProps, EditorToolbar, type EditorToolbarProps, EmptyState, type EmptyStateProps, EntityDisplayEvents, ErrorBoundary, type ErrorBoundaryProps, ErrorState, type ErrorStateProps, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FacingDirection, FeatureCard, type FeatureCardProps, type FeatureDetailPageEntity, FeatureDetailPageTemplate, type FeatureDetailPageTemplateProps, type FeatureDetailSection, FeatureGrid, FeatureGridOrganism, type FeatureGridOrganismProps, type FeatureGridProps, FileTree, type FileTreeNode, type FileTreeProps, type FilterDefinition, FilterGroup, type FilterGroupProps, type FilterPayload, FilterPill, type FilterPillProps, type FilterPillSize, type FilterPillVariant, Flex, type FlexProps, FlipCard, type FlipCardProps, FlipContainer, type FlipContainerProps, type FloatingAction, FloatingActionButton, type FloatingActionButtonProps, type FooterLinkColumn, type FooterLinkItem, Form, FormActions, type FormActionsProps, FormField, type FormFieldProps, FormLayout, type FormLayoutProps, type FormProps, FormSection$1 as FormSection, FormSectionHeader, type FormSectionHeaderProps, type FormSectionProps, GameAudioToggle, type GameAudioToggleProps, GameHud, type GameHudElement, type GameHudProps, type GameHudStat, GameIcon, type GameIconProps, GameMenu, type GameMenuProps, GameShell, type GameShellProps, GenericAppTemplate, type GenericAppTemplateProps, GeometricPattern, type GeometricPatternProps, GradientDivider, type GradientDividerProps, GraphCanvas, type GraphCanvasProps, type GraphEdge, type GraphNode, GraphView, type GraphViewEdge, type GraphViewNode, type GraphViewProps, type GraphicAnimation, Grid, GridPicker, type GridPickerCellSize, type GridPickerProps, type GridProps, HStack, type HStackProps, Header, type HeaderProps, HealthBar, type HealthBarProps, HeroOrganism, type HeroOrganismProps, HeroSection, type HeroSectionProps, type HighlightType, IDENTITY_BOOK_FIELDS, Icon, type IconAnimation, type IconInput, IconPicker, type IconPickerProps, type IconProps, type IconSize, ImageSource, InfiniteScrollSentinel, type InfiniteScrollSentinelProps, Input, InputGroup, type InputGroupProps, type InputProps, InstallBox, type InstallBoxProps, IsometricUnit, JazariStateMachine, type JazariStateMachineProps, JsonTreeEditor, type JsonTreeEditorProps, Label, type LabelProps, type LandingPageEntity, LandingPageTemplate, type LandingPageTemplateProps, type LawReference, LawReferenceTooltip, type LawReferenceTooltipProps, LearningCanvas, type LearningCanvasProps, type LearningPhysicsBody, type LearningPhysicsConstraint, type LearningPoint, type LearningShape, type LearningShapeType, type LessonSegment, type LessonUserProgress, Lightbox, type LightboxImage, type LightboxProps, type LikertOption, LikertScale, type LikertScaleProps, LineChart, type LineChartProps, LinkAction, List, type ListItem, type ListProps, LoadingState, type LoadingStateProps, type MapMarkerData, type MapRouteData, type MapRouteWaypoint, MapView, type MapViewProps, MarkdownContent, type MarkdownContentProps, MarketingFooter, type MarketingFooterProps, MarketingStatCard, type MarketingStatCardProps, MasterDetail, MasterDetailLayout, type MasterDetailLayoutProps, type MasterDetailProps, MathCanvas, type MathCanvasProps, type MathCurve, type MathPoint, type MathVector, type MatrixColumn, MatrixQuestion, type MatrixQuestionProps, type MatrixRow, MediaGallery, type MediaGalleryProps, type MediaItem, Menu, type MenuItem, type MenuOption, type MenuProps, Meter, type MeterAction, type MeterProps, type MeterThreshold, type MeterVariant, type MixedSegment, Modal, type ModalProps, type ModalSize, ModalSlot, type ModalSlotProps, ModuleCard, type ModuleCardProps, type NavItem, Navigation, type NavigationItem, type NavigationProps, NodeSlotEditor, type NodeSlotEditorProps, NotifyListener, NumberStepper, type NumberStepperProps, type NumberStepperSize, OnboardingSpotlight, type OnboardingSpotlightProps, type OptionConstraint, OptionConstraintGroup, type OptionConstraintGroupProps, type OptionConstraintOption, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, type OrbitalVisualizationProps, Overlay, type OverlayProps, type PageBreadcrumb, PageHeader, type PageHeaderProps, type PaginatePayload, Pagination, type PaginationProps, PatternTile, type PatternTileProps, type PatternVariant, PhysicsCanvas, type PhysicsCanvasProps, type PickerItem, type Platform, Point, Popover, type PopoverProps, PositionedCanvas, type PositionedCanvasProps, PricingCard, type PricingCardProps, PricingGrid, type PricingGridProps, PricingOrganism, type PricingOrganismProps, type PricingPageEntity, PricingPageTemplate, type PricingPageTemplateProps, ProgressBar, type ProgressBarColor, type ProgressBarProps, type ProgressBarVariant, ProgressDots, type ProgressDotsProps, type Projection, PropertyInspector, type PropertyInspectorProps, PullQuote, type PullQuoteProps, PullToRefresh, type PullToRefreshProps, type QrScanResult, QrScanner, type QrScannerProps, QuizBlock, type QuizBlockProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, type RangeSliderSize, ReflectionBlock, type ReflectionBlockProps, type RelationOption, RelationSelect, type RelationSelectProps, RepeatableFormSection, type RepeatableFormSectionProps, type RepeatableItem, ReplyTree, type ReplyTreeProps, ResolvedFrame, type RevealAnimation, type RevealTrigger, type RichBlock, RichBlockEditor, type RichBlockEditorProps, type RowAction, type RuleDefinition, type RuleOption, RuntimeDebugger, type RuntimeDebuggerProps, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, type ScaledDiagramProps, ScoreDisplay, type ScoreDisplayProps, SearchInput, type SearchInputProps, type SearchPayload, Section, SectionHeader, type SectionHeaderProps, type SectionProps, SegmentRenderer, type SegmentRendererProps, Select, type SelectOption, type SelectOptionGroup, type SelectPayload, type SelectProps, SequenceBar, type SequenceBarProps, ServiceCatalog, type ServiceCatalogItem, type ServiceCatalogProps, ShowcaseCard, type ShowcaseCardProps, ShowcaseOrganism, type ShowcaseOrganismProps, SidePanel, type SidePanelProps, type SidePlayer, Sidebar, type SidebarItem, type SidebarProps, SignaturePad, type SignaturePadProps, SimpleGrid, type SimpleGridProps, Skeleton, type SkeletonProps, type SkeletonVariant, SlotContent, SlotContentRenderer, type SlotItemData, SocialProof, type SocialProofItem, type SocialProofProps, type SortPayload, SortableList, type SortableListProps, Spacer, type SpacerProps, type SpacerSize, Sparkline, type SparklineColor, type SparklineProps, Spinner, type SpinnerProps, Split, SplitPane, type SplitPaneProps, type SplitProps, SplitSection, type SplitSectionProps, type SpotlightStep, SpriteFrameDims, SpriteSheetUrls, Stack, type StackAlign, type StackDirection, type StackGap, type StackJustify, type StackProps, StarRating, type StarRatingPrecision, type StarRatingProps, type StarRatingSize, StatBadge, type StatBadgeProps, StatCard, type StatCardProps, type StatCardSize, StatDisplay, type StatDisplayProps, StateGraph, type StateGraphProps, type StateGraphTransition, StateJsonView, type StateJsonViewProps, StateMachineView, type StateMachineViewProps, StateNode, type StateNodeProps, StatsGrid, type StatsGridProps, StatsOrganism, type StatsOrganismProps, StatusBar, type StatusBarProps, StatusDot, type StatusDotProps, type StatusDotSize, type StatusDotStatus, StepFlow, StepFlowOrganism, type StepFlowOrganismProps, type StepFlowProps, type StepItemProps, SubagentTracePanel, type SubagentTracePanelProps, SvgBranch, type SvgBranchProps, SvgConnection, type SvgConnectionProps, SvgFlow, type SvgFlowProps, SvgGrid, type SvgGridProps, SvgLobe, type SvgLobeProps, SvgMesh, type SvgMeshProps, SvgMorph, type SvgMorphProps, SvgNode, type SvgNodeProps, SvgPulse, type SvgPulseProps, SvgRing, type SvgRingProps, SvgShield, type SvgShieldProps, SvgStack, type SvgStackProps, type SwipeAction, SwipeableRow, type SwipeableRowProps, Switch, type SwitchProps, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, type TabDefinition, type TabItem, TabbedContainer, type TabbedContainerProps, TableView, type TableViewColumn, type TableViewProps, Tabs, type TabsProps, TagCloud, type TagCloudItem, type TagCloudProps, TagInput, type TagInputProps, TeamCard, type TeamCardProps, TeamOrganism, type TeamOrganismProps, type TeamUnitTraits, type TemplateProps, TerrainPalette, type TerrainPaletteProps, TextHighlight, type TextHighlightProps, Textarea, type TextareaProps, ThemeToggle, type ThemeToggleProps, type TileCoord, type TileLayout, TimeSlotCell, type TimeSlotCellProps, Timeline, type TimelineItem, type TimelineItemStatus, type TimelineProps, TimerDisplay, type TimerDisplayProps, Toast, type ToastProps, ToastSlot, type ToastSlotProps, type ToastVariant, Tooltip, type TooltipProps, type TraceDisclosureLevel, TraitFrame, type TraitFrameProps, TraitSlot, type TraitSlotProps, type TraitStateMachineDefinition, TraitStateViewer, type TraitStateViewerProps, type TraitTransition, TransitionArrow, type TransitionArrowProps, type TransitionBundle, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type TrendIndicatorSize, TypewriterText, type TypewriterTextProps, Typography, type TypographyProps, type TypographyVariant, UISlotComponent, UISlotRenderer, type UISlotRendererProps, UiError, UnitAnimationState, UploadDropZone, type UploadDropZoneProps, VStack, type VStackProps, type Vec2, VersionDiff, type DiffLine as VersionDiffLine, type VersionDiffProps, ViolationAlert, type ViolationAlertProps, type ViolationRecord, VoteStack, type VoteStackProps, WizardContainer, type WizardContainerProps, WizardNavigation, type WizardNavigationProps, WizardProgress, type WizardProgressProps, type WizardProgressStep, type WizardStep, boardEntity, bool, createUnitAnimationState, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAnchorRect, useAtlasSliceDataUrl, useCamera, useImageCache, useUnitSpriteAtlas, vec2 };
|
|
11247
|
+
export { ALL_PRESETS, AR_BOOK_FIELDS, type AboutPageEntity, AboutPageTemplate, type AboutPageTemplateProps, Accordion, type AccordionItem, type AccordionProps, Card as ActionCard, type CardProps as ActionCardProps, ActionPalette, type ActionPaletteProps, ActionTile, type ActionTileProps, ActivationBlock, type ActivationBlockProps, Alert, type AlertProps, type AlertVariant, type AlgorithmBar, AlgorithmCanvas, type AlgorithmCanvasProps, type AlgorithmCell, type AlgorithmPointer, AnimatedCounter, type AnimatedCounterProps, AnimatedGraphic, type AnimatedGraphicProps, AnimatedReveal, type AnimatedRevealProps, ArticleSection, type ArticleSectionProps, Aside, type AsideProps, AssetPicker, type AssetPickerProps, AtlasImage, type AtlasImageAsset, type AtlasImageProps, AtlasPanel, type AtlasPanelProps, AuthLayout, type AuthLayoutProps, Avatar, type AvatarProps, type AvatarSize, type AvatarStatus, Badge, type BadgeProps, type BadgeVariant, BehaviorView, type BehaviorViewProps, BiologyCanvas, type BiologyCanvasProps, type BiologyEdge, type BiologyNode, type BlockType, type BloomLevel, BloomQuizBlock, type BloomQuizBlockProps, BookChapterView, type BookChapterViewProps, BookCoverPage, type BookCoverPageProps, type BookFieldMap, BookNavBar, type BookNavBarProps, BookTableOfContents, type BookTableOfContentsProps, BookViewer, type BookViewerProps, Box, type BoxBg, type BoxMargin, type BoxPadding, type BoxProps, type BoxRounded, type BoxShadow, BranchingLogicBuilder, type BranchingLogicBuilderProps, type BranchingQuestion, type BranchingRule, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, ButtonGroup, type ButtonGroupProps, type ButtonProps, CTABanner, type CTABannerBackground, type CTABannerProps, CalendarGrid, type CalendarGridProps, type CameraMode, CameraState, Canvas, Canvas2D, type Canvas2DProps, type CanvasItemShape, type CanvasItemStatus, type CanvasMode, type CanvasProps, Card$1 as Card, type CardAction, CardBody, CardContent, CardFooter, CardGrid, type CardGridGap, type CardGridProps, CardHeader, type CardProps$1 as CardProps, CardTitle, Carousel, type CarouselProps, CaseStudyCard, type CaseStudyCardProps, CaseStudyOrganism, type CaseStudyOrganismProps, Center, type CenterProps, Chart, type ChartDataPoint, ChartLegend, type ChartLegendItem, type ChartLegendProps, type ChartProps, type ChartSeries, type ChartType, ChatBar, type ChatBarProps, type ChatBarStatus, Checkbox, type CheckboxProps, type ChemistryArrow, type ChemistryAtom, type ChemistryBond, ChemistryCanvas, type ChemistryCanvasProps, ChoiceButton, type ChoiceButtonProps, Coachmark, type CoachmarkAnchor, type CoachmarkPlacement, type CoachmarkProps, CodeBlock, type CodeBlockProps, type CodeLanguage, CodeRunnerPanel, type CodeRunnerPanelProps, type CodeSimulationOutput, type CodeViewerAction, type CodeViewerFile, type CodeViewerMode, CollapsibleSection, type CollapsibleSectionProps, type Column, CommunityLinks, type CommunityLinksProps, type ConditionalContext, ConditionalWrapper, type ConditionalWrapperProps, ConfettiEffect, type ConfettiEffectProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogVariant, ConnectionBlock, type ConnectionBlockProps, Container, type ContainerProps, ContentRenderer, type ContentRendererProps, ContentSection, type ContentSectionBackground, type ContentSectionPadding, type ContentSectionProps, ControlButton, type ControlButtonProps, ControlGrid, type ControlGridButton, type ControlGridKind, type ControlGridProps, type CounterSize, CounterTemplate, type CounterTemplateProps, type CounterVariant, DEFAULT_LIKERT_OPTIONS, DEFAULT_MATRIX_COLUMNS, DIAMOND_TOP_Y, type DPadDirection, DashboardGrid, type DashboardGridCell, type DashboardGridProps, DashboardLayout, type DashboardLayoutProps, DataGrid, type DataGridField, type DataGridItemAction, type DataGridProps, DataList, type DataListField, type DataListItemAction, type DataListProps, DataTable, type DataTableProps, DateRangePicker, type DateRangePickerPreset, type DateRangePickerProps, DateRangeSelector, type DateRangeSelectorOption, type DateRangeSelectorProps, DayCell, type DayCellProps, type DetailField, DetailPanel, type DetailPanelProps, type DetailSection, Dialog, type DialogProps, DialogueBubble, type DialogueBubbleProps, type DiffLine$1 as DiffLine, type DiffLineType, type DiffRevision, type DisplayStateProps, Divider, type DividerOrientation, type DividerProps, DocBreadcrumb, type DocBreadcrumbItem, type DocBreadcrumbProps, DocPagination, type DocPaginationLink, type DocPaginationProps, DocSearch, type DocSearchProps, type DocSearchResult, DocSidebar, type DocSidebarItem, type DocSidebarProps, DocTOC, type DocTOCItem, type DocTOCProps, type DocumentType, DocumentViewer, type DocumentViewerProps, StateMachineView as DomStateMachineVisualizer, type DotSize, type DotState, Drawer, type DrawerPosition, type DrawerProps, type DrawerSize, DrawerSlot, type DrawerSlotProps, ELEMENT_SELECTED_EVENT, EdgeDecoration, type EdgeDecorationProps, type EdgeSide, type EdgeVariant, EditorCheckbox, type EditorCheckboxProps, type EditorMode, EditorSelect, type EditorSelectProps, EditorSlider, type EditorSliderProps, EditorTextInput, type EditorTextInputProps, EditorToolbar, type EditorToolbarProps, EmptyState, type EmptyStateProps, EntityDisplayEvents, ErrorBoundary, type ErrorBoundaryProps, ErrorState, type ErrorStateProps, FEATURE_COLORS, FEATURE_TYPES, FLOOR_HEIGHT, FacingDirection, FeatureCard, type FeatureCardProps, type FeatureDetailPageEntity, FeatureDetailPageTemplate, type FeatureDetailPageTemplateProps, type FeatureDetailSection, FeatureGrid, FeatureGridOrganism, type FeatureGridOrganismProps, type FeatureGridProps, FileTree, type FileTreeNode, type FileTreeProps, type FilterDefinition, FilterGroup, type FilterGroupProps, type FilterPayload, FilterPill, type FilterPillProps, type FilterPillSize, type FilterPillVariant, Flex, type FlexProps, FlipCard, type FlipCardProps, FlipContainer, type FlipContainerProps, type FloatingAction, FloatingActionButton, type FloatingActionButtonProps, type FooterLinkColumn, type FooterLinkItem, Form, FormActions, type FormActionsProps, FormField, type FormFieldProps, FormLayout, type FormLayoutProps, type FormProps, FormSection$1 as FormSection, FormSectionHeader, type FormSectionHeaderProps, type FormSectionProps, GameAudioToggle, type GameAudioToggleProps, GameHud, type GameHudElement, type GameHudProps, type GameHudStat, GameIcon, type GameIconProps, GameMenu, type GameMenuProps, GameShell, type GameShellProps, GenericAppTemplate, type GenericAppTemplateProps, GeometricPattern, type GeometricPatternProps, GradientDivider, type GradientDividerProps, GraphCanvas, type GraphCanvasProps, type GraphEdge, type GraphNode, type GraphSimilarity, GraphView, type GraphViewEdge, type GraphViewNode, type GraphViewProps, type GraphicAnimation, Grid, GridPicker, type GridPickerCellSize, type GridPickerProps, type GridProps, HStack, type HStackProps, Header, type HeaderProps, HealthBar, type HealthBarProps, HeroOrganism, type HeroOrganismProps, HeroSection, type HeroSectionProps, type HighlightType, IDENTITY_BOOK_FIELDS, Icon, type IconAnimation, type IconInput, IconPicker, type IconPickerProps, type IconProps, type IconSize, ImageSource, InfiniteScrollSentinel, type InfiniteScrollSentinelProps, Input, InputGroup, type InputGroupProps, type InputProps, InstallBox, type InstallBoxProps, IsometricUnit, JazariStateMachine, type JazariStateMachineProps, JsonTreeEditor, type JsonTreeEditorProps, Label, type LabelProps, type LandingPageEntity, LandingPageTemplate, type LandingPageTemplateProps, type LawReference, LawReferenceTooltip, type LawReferenceTooltipProps, LearningCanvas, type LearningCanvasProps, type LearningPhysicsBody, type LearningPhysicsConstraint, type LearningPoint, type LearningShape, type LearningShapeType, type LessonSegment, type LessonUserProgress, Lightbox, type LightboxImage, type LightboxProps, type LikertOption, LikertScale, type LikertScaleProps, LineChart, type LineChartProps, LinkAction, List, type ListItem, type ListProps, LoadingState, type LoadingStateProps, type MapMarkerData, type MapRouteData, type MapRouteWaypoint, MapView, type MapViewProps, MarkdownContent, type MarkdownContentProps, MarketingFooter, type MarketingFooterProps, MarketingStatCard, type MarketingStatCardProps, MasterDetail, MasterDetailLayout, type MasterDetailLayoutProps, type MasterDetailProps, MathCanvas, type MathCanvasProps, type MathCurve, type MathPoint, type MathVector, type MatrixColumn, MatrixQuestion, type MatrixQuestionProps, type MatrixRow, MediaGallery, type MediaGalleryProps, type MediaItem, Menu, type MenuItem, type MenuOption, type MenuProps, Meter, type MeterAction, type MeterProps, type MeterThreshold, type MeterVariant, type MixedSegment, Modal, type ModalProps, type ModalSize, ModalSlot, type ModalSlotProps, ModuleCard, type ModuleCardProps, type NavItem, Navigation, type NavigationItem, type NavigationProps, NodeSlotEditor, type NodeSlotEditorProps, NotifyListener, NumberStepper, type NumberStepperProps, type NumberStepperSize, OnboardingSpotlight, type OnboardingSpotlightProps, type OptionConstraint, OptionConstraintGroup, type OptionConstraintGroupProps, type OptionConstraintOption, StateMachineView as OrbitalStateMachineView, OrbitalVisualization, type OrbitalVisualizationProps, Overlay, type OverlayProps, type PageBreadcrumb, PageHeader, type PageHeaderProps, type PaginatePayload, Pagination, type PaginationProps, PatternTile, type PatternTileProps, type PatternVariant, PhysicsCanvas, type PhysicsCanvasProps, type PickerItem, type Platform, Point, Popover, type PopoverProps, PositionedCanvas, type PositionedCanvasProps, PricingCard, type PricingCardProps, PricingGrid, type PricingGridProps, PricingOrganism, type PricingOrganismProps, type PricingPageEntity, PricingPageTemplate, type PricingPageTemplateProps, ProgressBar, type ProgressBarColor, type ProgressBarProps, type ProgressBarVariant, ProgressDots, type ProgressDotsProps, type Projection, PropertyInspector, type PropertyInspectorProps, PullQuote, type PullQuoteProps, PullToRefresh, type PullToRefreshProps, type QrScanResult, QrScanner, type QrScannerProps, QuizBlock, type QuizBlockProps, Radio, type RadioProps, RangeSlider, type RangeSliderProps, type RangeSliderSize, ReflectionBlock, type ReflectionBlockProps, type RelationOption, RelationSelect, type RelationSelectProps, RepeatableFormSection, type RepeatableFormSectionProps, type RepeatableItem, ReplyTree, type ReplyTreeProps, ResolvedFrame, type RevealAnimation, type RevealTrigger, type RichBlock, RichBlockEditor, type RichBlockEditorProps, type RowAction, type RuleDefinition, type RuleOption, RuntimeDebugger, type RuntimeDebuggerProps, SHEET_COLUMNS, SPRITE_SHEET_LAYOUT, ScaledDiagram, type ScaledDiagramProps, ScoreDisplay, type ScoreDisplayProps, SearchInput, type SearchInputProps, type SearchPayload, Section, SectionHeader, type SectionHeaderProps, type SectionProps, SegmentRenderer, type SegmentRendererProps, Select, type SelectOption, type SelectOptionGroup, type SelectPayload, type SelectProps, SequenceBar, type SequenceBarProps, ServiceCatalog, type ServiceCatalogItem, type ServiceCatalogProps, ShowcaseCard, type ShowcaseCardProps, ShowcaseOrganism, type ShowcaseOrganismProps, SidePanel, type SidePanelProps, type SidePlayer, Sidebar, type SidebarItem, type SidebarProps, SignaturePad, type SignaturePadProps, SimpleGrid, type SimpleGridProps, Skeleton, type SkeletonProps, type SkeletonVariant, SlotContent, SlotContentRenderer, type SlotItemData, SocialProof, type SocialProofItem, type SocialProofProps, type SortPayload, SortableList, type SortableListProps, Spacer, type SpacerProps, type SpacerSize, Sparkline, type SparklineColor, type SparklineProps, Spinner, type SpinnerProps, Split, SplitPane, type SplitPaneProps, type SplitProps, SplitSection, type SplitSectionProps, type SpotlightStep, SpriteFrameDims, SpriteSheetUrls, Stack, type StackAlign, type StackDirection, type StackGap, type StackJustify, type StackProps, StarRating, type StarRatingPrecision, type StarRatingProps, type StarRatingSize, StatBadge, type StatBadgeProps, StatCard, type StatCardProps, type StatCardSize, StatDisplay, type StatDisplayProps, StateGraph, type StateGraphProps, type StateGraphTransition, StateJsonView, type StateJsonViewProps, StateMachineView, type StateMachineViewProps, StateNode, type StateNodeProps, StatsGrid, type StatsGridProps, StatsOrganism, type StatsOrganismProps, StatusBar, type StatusBarProps, StatusDot, type StatusDotProps, type StatusDotSize, type StatusDotStatus, StepFlow, StepFlowOrganism, type StepFlowOrganismProps, type StepFlowProps, type StepItemProps, SubagentTracePanel, type SubagentTracePanelProps, SvgBranch, type SvgBranchProps, SvgConnection, type SvgConnectionProps, SvgFlow, type SvgFlowProps, SvgGrid, type SvgGridProps, SvgLobe, type SvgLobeProps, SvgMesh, type SvgMeshProps, SvgMorph, type SvgMorphProps, SvgNode, type SvgNodeProps, SvgPulse, type SvgPulseProps, SvgRing, type SvgRingProps, SvgShield, type SvgShieldProps, SvgStack, type SvgStackProps, type SwipeAction, SwipeableRow, type SwipeableRowProps, Switch, type SwitchProps, TERRAIN_COLORS, TILE_HEIGHT, TILE_WIDTH, type TabDefinition, type TabItem, TabbedContainer, type TabbedContainerProps, TableView, type TableViewColumn, type TableViewProps, Tabs, type TabsProps, TagCloud, type TagCloudItem, type TagCloudProps, TagInput, type TagInputProps, TeamCard, type TeamCardProps, TeamOrganism, type TeamOrganismProps, type TeamUnitTraits, type TemplateProps, TerrainPalette, type TerrainPaletteProps, TextHighlight, type TextHighlightProps, Textarea, type TextareaProps, ThemeToggle, type ThemeToggleProps, type TileCoord, type TileLayout, TimeSlotCell, type TimeSlotCellProps, Timeline, type TimelineItem, type TimelineItemStatus, type TimelineProps, TimerDisplay, type TimerDisplayProps, Toast, type ToastProps, ToastSlot, type ToastSlotProps, type ToastVariant, Tooltip, type TooltipProps, type TraceDisclosureLevel, TraitFrame, type TraitFrameProps, TraitSlot, type TraitSlotProps, type TraitStateMachineDefinition, TraitStateViewer, type TraitStateViewerProps, type TraitTransition, TransitionArrow, type TransitionArrowProps, type TransitionBundle, type TrendDirection, TrendIndicator, type TrendIndicatorProps, type TrendIndicatorSize, TypewriterText, type TypewriterTextProps, Typography, type TypographyProps, type TypographyVariant, UISlotComponent, UISlotRenderer, type UISlotRendererProps, UiError, UnitAnimationState, UploadDropZone, type UploadDropZoneProps, VStack, type VStackProps, type Vec2, VersionDiff, type DiffLine as VersionDiffLine, type VersionDiffProps, ViolationAlert, type ViolationAlertProps, type ViolationRecord, VoteStack, type VoteStackProps, WizardContainer, type WizardContainerProps, WizardNavigation, type WizardNavigationProps, WizardProgress, type WizardProgressProps, type WizardProgressStep, type WizardStep, boardEntity, bool, createUnitAnimationState, getCurrentFrame, getTileDimensions, inferDirection, isoToScreen, makeAsset, makeAssetMap, mapBookData, num, objAvailableActions, objAvailableEvents, objCurrentState, objIcon, objId, objMaxRules, objName, objRules, objStates, parseEditFocus, parseLessonSegments, parseMarkdownWithCodeBlocks, pendulum, projectileMotion, resolveFieldMap, resolveFrame, resolveSheetDirection, rows, screenToIso, springOscillator, str, tickAnimationState, toCodeLanguage, transitionAnimation, unitHealth, unitPosition, unitTeam, useAnchorRect, useAtlasSliceDataUrl, useCamera, useImageCache, useUnitSpriteAtlas, vec2 };
|
package/dist/components/index.js
CHANGED
|
@@ -36593,6 +36593,23 @@ function getGroupColor(group, groups) {
|
|
|
36593
36593
|
const idx = groups.indexOf(group);
|
|
36594
36594
|
return GROUP_COLORS2[idx % GROUP_COLORS2.length];
|
|
36595
36595
|
}
|
|
36596
|
+
function hashSeed(str2) {
|
|
36597
|
+
let h = 1779033703 ^ str2.length;
|
|
36598
|
+
for (let i = 0; i < str2.length; i++) {
|
|
36599
|
+
h = Math.imul(h ^ str2.charCodeAt(i), 3432918353);
|
|
36600
|
+
h = h << 13 | h >>> 19;
|
|
36601
|
+
}
|
|
36602
|
+
return (h ^= h >>> 16) >>> 0;
|
|
36603
|
+
}
|
|
36604
|
+
function mulberry32(a) {
|
|
36605
|
+
return function() {
|
|
36606
|
+
a |= 0;
|
|
36607
|
+
a = a + 1831565813 | 0;
|
|
36608
|
+
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
36609
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
36610
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
36611
|
+
};
|
|
36612
|
+
}
|
|
36596
36613
|
function resolveColor3(color, el) {
|
|
36597
36614
|
const m = /^var\((--[^,)]+)(?:,\s*([^)]+))?\)$/.exec(color.trim());
|
|
36598
36615
|
if (!m) return color;
|
|
@@ -36624,6 +36641,7 @@ var init_GraphCanvas = __esm({
|
|
|
36624
36641
|
title,
|
|
36625
36642
|
nodes: propNodes = [],
|
|
36626
36643
|
edges: propEdges = [],
|
|
36644
|
+
similarity: propSimilarity = [],
|
|
36627
36645
|
height = 400,
|
|
36628
36646
|
showLabels = true,
|
|
36629
36647
|
interactive = true,
|
|
@@ -36655,6 +36673,7 @@ var init_GraphCanvas = __esm({
|
|
|
36655
36673
|
offsetRef.current = offset;
|
|
36656
36674
|
const [hoveredNode, setHoveredNode] = useState(null);
|
|
36657
36675
|
const nodesRef = useRef([]);
|
|
36676
|
+
const laidOutRef = useRef(false);
|
|
36658
36677
|
const [, forceUpdate] = useState(0);
|
|
36659
36678
|
const [logicalW, setLogicalW] = useState(800);
|
|
36660
36679
|
useEffect(() => {
|
|
@@ -36743,13 +36762,19 @@ var init_GraphCanvas = __esm({
|
|
|
36743
36762
|
x = gapX * (idx % cols + 1);
|
|
36744
36763
|
y = gapY * (Math.floor(idx / cols) + 1);
|
|
36745
36764
|
} else {
|
|
36746
|
-
|
|
36747
|
-
|
|
36765
|
+
const rand = mulberry32(hashSeed(n.id));
|
|
36766
|
+
x = w * 0.2 + rand() * w * 0.6;
|
|
36767
|
+
y = h * 0.2 + rand() * h * 0.6;
|
|
36748
36768
|
}
|
|
36749
36769
|
}
|
|
36750
36770
|
return { ...n, x, y, vx: 0, vy: 0, fx: 0, fy: 0 };
|
|
36751
36771
|
});
|
|
36752
36772
|
nodesRef.current = simNodes;
|
|
36773
|
+
const prevIds = /* @__PURE__ */ new Set([...prevPos.keys()]);
|
|
36774
|
+
const newIdList = simNodes.map((n) => n.id);
|
|
36775
|
+
const kept = newIdList.filter((id) => prevIds.has(id)).length;
|
|
36776
|
+
const overlap = prevIds.size === 0 ? 0 : kept / Math.max(prevIds.size, newIdList.length);
|
|
36777
|
+
const fullRelayout = !laidOutRef.current || overlap < 0.5;
|
|
36753
36778
|
if (layout === "force") {
|
|
36754
36779
|
const maxIterations = 300;
|
|
36755
36780
|
const tick = () => {
|
|
@@ -36774,22 +36799,43 @@ var init_GraphCanvas = __esm({
|
|
|
36774
36799
|
nodes[j].fy += fy;
|
|
36775
36800
|
}
|
|
36776
36801
|
}
|
|
36777
|
-
|
|
36778
|
-
|
|
36779
|
-
const
|
|
36780
|
-
|
|
36781
|
-
|
|
36782
|
-
|
|
36783
|
-
|
|
36784
|
-
|
|
36785
|
-
|
|
36786
|
-
|
|
36787
|
-
|
|
36788
|
-
|
|
36789
|
-
|
|
36790
|
-
|
|
36791
|
-
|
|
36792
|
-
|
|
36802
|
+
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
36803
|
+
if (propSimilarity.length > 0) {
|
|
36804
|
+
for (const pair of propSimilarity) {
|
|
36805
|
+
const source = nodeById.get(pair.source);
|
|
36806
|
+
const target = nodeById.get(pair.target);
|
|
36807
|
+
if (!source || !target) continue;
|
|
36808
|
+
const dx = target.x - source.x;
|
|
36809
|
+
const dy = target.y - source.y;
|
|
36810
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
36811
|
+
const w2 = Math.min(1, Math.max(0, pair.weight));
|
|
36812
|
+
const linkTarget = linkDistance * (1 - w2);
|
|
36813
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
36814
|
+
const fx = dx / dist * force;
|
|
36815
|
+
const fy = dy / dist * force;
|
|
36816
|
+
source.fx += fx;
|
|
36817
|
+
source.fy += fy;
|
|
36818
|
+
target.fx -= fx;
|
|
36819
|
+
target.fy -= fy;
|
|
36820
|
+
}
|
|
36821
|
+
} else {
|
|
36822
|
+
for (const edge of propEdges) {
|
|
36823
|
+
const source = nodeById.get(edge.source);
|
|
36824
|
+
const target = nodeById.get(edge.target);
|
|
36825
|
+
if (!source || !target) continue;
|
|
36826
|
+
const dx = target.x - source.x;
|
|
36827
|
+
const dy = target.y - source.y;
|
|
36828
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
36829
|
+
const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
|
|
36830
|
+
const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
|
|
36831
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
36832
|
+
const fx = dx / dist * force;
|
|
36833
|
+
const fy = dy / dist * force;
|
|
36834
|
+
source.fx += fx;
|
|
36835
|
+
source.fy += fy;
|
|
36836
|
+
target.fx -= fx;
|
|
36837
|
+
target.fy -= fy;
|
|
36838
|
+
}
|
|
36793
36839
|
}
|
|
36794
36840
|
const centroids = /* @__PURE__ */ new Map();
|
|
36795
36841
|
for (const node of nodes) {
|
|
@@ -36856,7 +36902,38 @@ var init_GraphCanvas = __esm({
|
|
|
36856
36902
|
}
|
|
36857
36903
|
}
|
|
36858
36904
|
};
|
|
36859
|
-
|
|
36905
|
+
if (fullRelayout) {
|
|
36906
|
+
for (let i = 0; i < maxIterations; i++) tick();
|
|
36907
|
+
laidOutRef.current = true;
|
|
36908
|
+
} else {
|
|
36909
|
+
const centroids = /* @__PURE__ */ new Map();
|
|
36910
|
+
for (const node of simNodes) {
|
|
36911
|
+
if (!prevPos.has(node.id)) continue;
|
|
36912
|
+
const g = node.group ?? "__none__";
|
|
36913
|
+
let c = centroids.get(g);
|
|
36914
|
+
if (!c) {
|
|
36915
|
+
c = { x: 0, y: 0, n: 0 };
|
|
36916
|
+
centroids.set(g, c);
|
|
36917
|
+
}
|
|
36918
|
+
c.x += node.x;
|
|
36919
|
+
c.y += node.y;
|
|
36920
|
+
c.n += 1;
|
|
36921
|
+
}
|
|
36922
|
+
const ringCount = /* @__PURE__ */ new Map();
|
|
36923
|
+
for (const node of simNodes) {
|
|
36924
|
+
if (prevPos.has(node.id)) continue;
|
|
36925
|
+
const g = node.group ?? "__none__";
|
|
36926
|
+
const c = centroids.get(g);
|
|
36927
|
+
const cx = c && c.n > 0 ? c.x / c.n : w / 2;
|
|
36928
|
+
const cy = c && c.n > 0 ? c.y / c.n : h / 2;
|
|
36929
|
+
const k = ringCount.get(g) ?? 0;
|
|
36930
|
+
ringCount.set(g, k + 1);
|
|
36931
|
+
const angle = k * 2.399963;
|
|
36932
|
+
const r = 22 + k * 8;
|
|
36933
|
+
node.x = Math.max(30, Math.min(w - 30, cx + r * Math.cos(angle)));
|
|
36934
|
+
node.y = Math.max(30, Math.min(h - 30, cy + r * Math.sin(angle)));
|
|
36935
|
+
}
|
|
36936
|
+
}
|
|
36860
36937
|
forceUpdate((n) => n + 1);
|
|
36861
36938
|
} else {
|
|
36862
36939
|
forceUpdate((n) => n + 1);
|
|
@@ -36864,7 +36941,7 @@ var init_GraphCanvas = __esm({
|
|
|
36864
36941
|
return () => {
|
|
36865
36942
|
cancelAnimationFrame(animRef.current);
|
|
36866
36943
|
};
|
|
36867
|
-
}, [propNodes, propEdges, layout, repulsion, linkDistance, nodeSpacing, showLabels
|
|
36944
|
+
}, [propNodes, propEdges, propSimilarity, layout, repulsion, linkDistance, nodeSpacing, showLabels]);
|
|
36868
36945
|
useEffect(() => {
|
|
36869
36946
|
const canvas = canvasRef.current;
|
|
36870
36947
|
if (!canvas) return;
|
package/dist/providers/index.cjs
CHANGED
|
@@ -35379,6 +35379,23 @@ function getGroupColor(group, groups) {
|
|
|
35379
35379
|
const idx = groups.indexOf(group);
|
|
35380
35380
|
return GROUP_COLORS2[idx % GROUP_COLORS2.length];
|
|
35381
35381
|
}
|
|
35382
|
+
function hashSeed(str) {
|
|
35383
|
+
let h = 1779033703 ^ str.length;
|
|
35384
|
+
for (let i = 0; i < str.length; i++) {
|
|
35385
|
+
h = Math.imul(h ^ str.charCodeAt(i), 3432918353);
|
|
35386
|
+
h = h << 13 | h >>> 19;
|
|
35387
|
+
}
|
|
35388
|
+
return (h ^= h >>> 16) >>> 0;
|
|
35389
|
+
}
|
|
35390
|
+
function mulberry32(a) {
|
|
35391
|
+
return function() {
|
|
35392
|
+
a |= 0;
|
|
35393
|
+
a = a + 1831565813 | 0;
|
|
35394
|
+
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
35395
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
35396
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
35397
|
+
};
|
|
35398
|
+
}
|
|
35382
35399
|
function resolveColor3(color, el) {
|
|
35383
35400
|
const m = /^var\((--[^,)]+)(?:,\s*([^)]+))?\)$/.exec(color.trim());
|
|
35384
35401
|
if (!m) return color;
|
|
@@ -35410,6 +35427,7 @@ var init_GraphCanvas = __esm({
|
|
|
35410
35427
|
title,
|
|
35411
35428
|
nodes: propNodes = [],
|
|
35412
35429
|
edges: propEdges = [],
|
|
35430
|
+
similarity: propSimilarity = [],
|
|
35413
35431
|
height = 400,
|
|
35414
35432
|
showLabels = true,
|
|
35415
35433
|
interactive = true,
|
|
@@ -35441,6 +35459,7 @@ var init_GraphCanvas = __esm({
|
|
|
35441
35459
|
offsetRef.current = offset;
|
|
35442
35460
|
const [hoveredNode, setHoveredNode] = React83.useState(null);
|
|
35443
35461
|
const nodesRef = React83.useRef([]);
|
|
35462
|
+
const laidOutRef = React83.useRef(false);
|
|
35444
35463
|
const [, forceUpdate] = React83.useState(0);
|
|
35445
35464
|
const [logicalW, setLogicalW] = React83.useState(800);
|
|
35446
35465
|
React83.useEffect(() => {
|
|
@@ -35529,13 +35548,19 @@ var init_GraphCanvas = __esm({
|
|
|
35529
35548
|
x = gapX * (idx % cols + 1);
|
|
35530
35549
|
y = gapY * (Math.floor(idx / cols) + 1);
|
|
35531
35550
|
} else {
|
|
35532
|
-
|
|
35533
|
-
|
|
35551
|
+
const rand = mulberry32(hashSeed(n.id));
|
|
35552
|
+
x = w * 0.2 + rand() * w * 0.6;
|
|
35553
|
+
y = h * 0.2 + rand() * h * 0.6;
|
|
35534
35554
|
}
|
|
35535
35555
|
}
|
|
35536
35556
|
return { ...n, x, y, vx: 0, vy: 0, fx: 0, fy: 0 };
|
|
35537
35557
|
});
|
|
35538
35558
|
nodesRef.current = simNodes;
|
|
35559
|
+
const prevIds = /* @__PURE__ */ new Set([...prevPos.keys()]);
|
|
35560
|
+
const newIdList = simNodes.map((n) => n.id);
|
|
35561
|
+
const kept = newIdList.filter((id) => prevIds.has(id)).length;
|
|
35562
|
+
const overlap = prevIds.size === 0 ? 0 : kept / Math.max(prevIds.size, newIdList.length);
|
|
35563
|
+
const fullRelayout = !laidOutRef.current || overlap < 0.5;
|
|
35539
35564
|
if (layout === "force") {
|
|
35540
35565
|
const maxIterations = 300;
|
|
35541
35566
|
const tick = () => {
|
|
@@ -35560,22 +35585,43 @@ var init_GraphCanvas = __esm({
|
|
|
35560
35585
|
nodes[j].fy += fy;
|
|
35561
35586
|
}
|
|
35562
35587
|
}
|
|
35563
|
-
|
|
35564
|
-
|
|
35565
|
-
const
|
|
35566
|
-
|
|
35567
|
-
|
|
35568
|
-
|
|
35569
|
-
|
|
35570
|
-
|
|
35571
|
-
|
|
35572
|
-
|
|
35573
|
-
|
|
35574
|
-
|
|
35575
|
-
|
|
35576
|
-
|
|
35577
|
-
|
|
35578
|
-
|
|
35588
|
+
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
35589
|
+
if (propSimilarity.length > 0) {
|
|
35590
|
+
for (const pair of propSimilarity) {
|
|
35591
|
+
const source = nodeById.get(pair.source);
|
|
35592
|
+
const target = nodeById.get(pair.target);
|
|
35593
|
+
if (!source || !target) continue;
|
|
35594
|
+
const dx = target.x - source.x;
|
|
35595
|
+
const dy = target.y - source.y;
|
|
35596
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
35597
|
+
const w2 = Math.min(1, Math.max(0, pair.weight));
|
|
35598
|
+
const linkTarget = linkDistance * (1 - w2);
|
|
35599
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
35600
|
+
const fx = dx / dist * force;
|
|
35601
|
+
const fy = dy / dist * force;
|
|
35602
|
+
source.fx += fx;
|
|
35603
|
+
source.fy += fy;
|
|
35604
|
+
target.fx -= fx;
|
|
35605
|
+
target.fy -= fy;
|
|
35606
|
+
}
|
|
35607
|
+
} else {
|
|
35608
|
+
for (const edge of propEdges) {
|
|
35609
|
+
const source = nodeById.get(edge.source);
|
|
35610
|
+
const target = nodeById.get(edge.target);
|
|
35611
|
+
if (!source || !target) continue;
|
|
35612
|
+
const dx = target.x - source.x;
|
|
35613
|
+
const dy = target.y - source.y;
|
|
35614
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
35615
|
+
const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
|
|
35616
|
+
const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
|
|
35617
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
35618
|
+
const fx = dx / dist * force;
|
|
35619
|
+
const fy = dy / dist * force;
|
|
35620
|
+
source.fx += fx;
|
|
35621
|
+
source.fy += fy;
|
|
35622
|
+
target.fx -= fx;
|
|
35623
|
+
target.fy -= fy;
|
|
35624
|
+
}
|
|
35579
35625
|
}
|
|
35580
35626
|
const centroids = /* @__PURE__ */ new Map();
|
|
35581
35627
|
for (const node of nodes) {
|
|
@@ -35642,7 +35688,38 @@ var init_GraphCanvas = __esm({
|
|
|
35642
35688
|
}
|
|
35643
35689
|
}
|
|
35644
35690
|
};
|
|
35645
|
-
|
|
35691
|
+
if (fullRelayout) {
|
|
35692
|
+
for (let i = 0; i < maxIterations; i++) tick();
|
|
35693
|
+
laidOutRef.current = true;
|
|
35694
|
+
} else {
|
|
35695
|
+
const centroids = /* @__PURE__ */ new Map();
|
|
35696
|
+
for (const node of simNodes) {
|
|
35697
|
+
if (!prevPos.has(node.id)) continue;
|
|
35698
|
+
const g = node.group ?? "__none__";
|
|
35699
|
+
let c = centroids.get(g);
|
|
35700
|
+
if (!c) {
|
|
35701
|
+
c = { x: 0, y: 0, n: 0 };
|
|
35702
|
+
centroids.set(g, c);
|
|
35703
|
+
}
|
|
35704
|
+
c.x += node.x;
|
|
35705
|
+
c.y += node.y;
|
|
35706
|
+
c.n += 1;
|
|
35707
|
+
}
|
|
35708
|
+
const ringCount = /* @__PURE__ */ new Map();
|
|
35709
|
+
for (const node of simNodes) {
|
|
35710
|
+
if (prevPos.has(node.id)) continue;
|
|
35711
|
+
const g = node.group ?? "__none__";
|
|
35712
|
+
const c = centroids.get(g);
|
|
35713
|
+
const cx = c && c.n > 0 ? c.x / c.n : w / 2;
|
|
35714
|
+
const cy = c && c.n > 0 ? c.y / c.n : h / 2;
|
|
35715
|
+
const k = ringCount.get(g) ?? 0;
|
|
35716
|
+
ringCount.set(g, k + 1);
|
|
35717
|
+
const angle = k * 2.399963;
|
|
35718
|
+
const r = 22 + k * 8;
|
|
35719
|
+
node.x = Math.max(30, Math.min(w - 30, cx + r * Math.cos(angle)));
|
|
35720
|
+
node.y = Math.max(30, Math.min(h - 30, cy + r * Math.sin(angle)));
|
|
35721
|
+
}
|
|
35722
|
+
}
|
|
35646
35723
|
forceUpdate((n) => n + 1);
|
|
35647
35724
|
} else {
|
|
35648
35725
|
forceUpdate((n) => n + 1);
|
|
@@ -35650,7 +35727,7 @@ var init_GraphCanvas = __esm({
|
|
|
35650
35727
|
return () => {
|
|
35651
35728
|
cancelAnimationFrame(animRef.current);
|
|
35652
35729
|
};
|
|
35653
|
-
}, [propNodes, propEdges, layout, repulsion, linkDistance, nodeSpacing, showLabels
|
|
35730
|
+
}, [propNodes, propEdges, propSimilarity, layout, repulsion, linkDistance, nodeSpacing, showLabels]);
|
|
35654
35731
|
React83.useEffect(() => {
|
|
35655
35732
|
const canvas = canvasRef.current;
|
|
35656
35733
|
if (!canvas) return;
|
package/dist/providers/index.js
CHANGED
|
@@ -35334,6 +35334,23 @@ function getGroupColor(group, groups) {
|
|
|
35334
35334
|
const idx = groups.indexOf(group);
|
|
35335
35335
|
return GROUP_COLORS2[idx % GROUP_COLORS2.length];
|
|
35336
35336
|
}
|
|
35337
|
+
function hashSeed(str) {
|
|
35338
|
+
let h = 1779033703 ^ str.length;
|
|
35339
|
+
for (let i = 0; i < str.length; i++) {
|
|
35340
|
+
h = Math.imul(h ^ str.charCodeAt(i), 3432918353);
|
|
35341
|
+
h = h << 13 | h >>> 19;
|
|
35342
|
+
}
|
|
35343
|
+
return (h ^= h >>> 16) >>> 0;
|
|
35344
|
+
}
|
|
35345
|
+
function mulberry32(a) {
|
|
35346
|
+
return function() {
|
|
35347
|
+
a |= 0;
|
|
35348
|
+
a = a + 1831565813 | 0;
|
|
35349
|
+
let t = Math.imul(a ^ a >>> 15, 1 | a);
|
|
35350
|
+
t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
|
|
35351
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
35352
|
+
};
|
|
35353
|
+
}
|
|
35337
35354
|
function resolveColor3(color, el) {
|
|
35338
35355
|
const m = /^var\((--[^,)]+)(?:,\s*([^)]+))?\)$/.exec(color.trim());
|
|
35339
35356
|
if (!m) return color;
|
|
@@ -35365,6 +35382,7 @@ var init_GraphCanvas = __esm({
|
|
|
35365
35382
|
title,
|
|
35366
35383
|
nodes: propNodes = [],
|
|
35367
35384
|
edges: propEdges = [],
|
|
35385
|
+
similarity: propSimilarity = [],
|
|
35368
35386
|
height = 400,
|
|
35369
35387
|
showLabels = true,
|
|
35370
35388
|
interactive = true,
|
|
@@ -35396,6 +35414,7 @@ var init_GraphCanvas = __esm({
|
|
|
35396
35414
|
offsetRef.current = offset;
|
|
35397
35415
|
const [hoveredNode, setHoveredNode] = useState(null);
|
|
35398
35416
|
const nodesRef = useRef([]);
|
|
35417
|
+
const laidOutRef = useRef(false);
|
|
35399
35418
|
const [, forceUpdate] = useState(0);
|
|
35400
35419
|
const [logicalW, setLogicalW] = useState(800);
|
|
35401
35420
|
useEffect(() => {
|
|
@@ -35484,13 +35503,19 @@ var init_GraphCanvas = __esm({
|
|
|
35484
35503
|
x = gapX * (idx % cols + 1);
|
|
35485
35504
|
y = gapY * (Math.floor(idx / cols) + 1);
|
|
35486
35505
|
} else {
|
|
35487
|
-
|
|
35488
|
-
|
|
35506
|
+
const rand = mulberry32(hashSeed(n.id));
|
|
35507
|
+
x = w * 0.2 + rand() * w * 0.6;
|
|
35508
|
+
y = h * 0.2 + rand() * h * 0.6;
|
|
35489
35509
|
}
|
|
35490
35510
|
}
|
|
35491
35511
|
return { ...n, x, y, vx: 0, vy: 0, fx: 0, fy: 0 };
|
|
35492
35512
|
});
|
|
35493
35513
|
nodesRef.current = simNodes;
|
|
35514
|
+
const prevIds = /* @__PURE__ */ new Set([...prevPos.keys()]);
|
|
35515
|
+
const newIdList = simNodes.map((n) => n.id);
|
|
35516
|
+
const kept = newIdList.filter((id) => prevIds.has(id)).length;
|
|
35517
|
+
const overlap = prevIds.size === 0 ? 0 : kept / Math.max(prevIds.size, newIdList.length);
|
|
35518
|
+
const fullRelayout = !laidOutRef.current || overlap < 0.5;
|
|
35494
35519
|
if (layout === "force") {
|
|
35495
35520
|
const maxIterations = 300;
|
|
35496
35521
|
const tick = () => {
|
|
@@ -35515,22 +35540,43 @@ var init_GraphCanvas = __esm({
|
|
|
35515
35540
|
nodes[j].fy += fy;
|
|
35516
35541
|
}
|
|
35517
35542
|
}
|
|
35518
|
-
|
|
35519
|
-
|
|
35520
|
-
const
|
|
35521
|
-
|
|
35522
|
-
|
|
35523
|
-
|
|
35524
|
-
|
|
35525
|
-
|
|
35526
|
-
|
|
35527
|
-
|
|
35528
|
-
|
|
35529
|
-
|
|
35530
|
-
|
|
35531
|
-
|
|
35532
|
-
|
|
35533
|
-
|
|
35543
|
+
const nodeById = new Map(nodes.map((n) => [n.id, n]));
|
|
35544
|
+
if (propSimilarity.length > 0) {
|
|
35545
|
+
for (const pair of propSimilarity) {
|
|
35546
|
+
const source = nodeById.get(pair.source);
|
|
35547
|
+
const target = nodeById.get(pair.target);
|
|
35548
|
+
if (!source || !target) continue;
|
|
35549
|
+
const dx = target.x - source.x;
|
|
35550
|
+
const dy = target.y - source.y;
|
|
35551
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
35552
|
+
const w2 = Math.min(1, Math.max(0, pair.weight));
|
|
35553
|
+
const linkTarget = linkDistance * (1 - w2);
|
|
35554
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
35555
|
+
const fx = dx / dist * force;
|
|
35556
|
+
const fy = dy / dist * force;
|
|
35557
|
+
source.fx += fx;
|
|
35558
|
+
source.fy += fy;
|
|
35559
|
+
target.fx -= fx;
|
|
35560
|
+
target.fy -= fy;
|
|
35561
|
+
}
|
|
35562
|
+
} else {
|
|
35563
|
+
for (const edge of propEdges) {
|
|
35564
|
+
const source = nodeById.get(edge.source);
|
|
35565
|
+
const target = nodeById.get(edge.target);
|
|
35566
|
+
if (!source || !target) continue;
|
|
35567
|
+
const dx = target.x - source.x;
|
|
35568
|
+
const dy = target.y - source.y;
|
|
35569
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
35570
|
+
const w2 = Math.min(1, Math.max(0, edge.weight ?? 1));
|
|
35571
|
+
const linkTarget = linkDistance * (0.5 + (1 - w2) * 1.5);
|
|
35572
|
+
const force = (dist - linkTarget) * (0.04 + 0.1 * w2);
|
|
35573
|
+
const fx = dx / dist * force;
|
|
35574
|
+
const fy = dy / dist * force;
|
|
35575
|
+
source.fx += fx;
|
|
35576
|
+
source.fy += fy;
|
|
35577
|
+
target.fx -= fx;
|
|
35578
|
+
target.fy -= fy;
|
|
35579
|
+
}
|
|
35534
35580
|
}
|
|
35535
35581
|
const centroids = /* @__PURE__ */ new Map();
|
|
35536
35582
|
for (const node of nodes) {
|
|
@@ -35597,7 +35643,38 @@ var init_GraphCanvas = __esm({
|
|
|
35597
35643
|
}
|
|
35598
35644
|
}
|
|
35599
35645
|
};
|
|
35600
|
-
|
|
35646
|
+
if (fullRelayout) {
|
|
35647
|
+
for (let i = 0; i < maxIterations; i++) tick();
|
|
35648
|
+
laidOutRef.current = true;
|
|
35649
|
+
} else {
|
|
35650
|
+
const centroids = /* @__PURE__ */ new Map();
|
|
35651
|
+
for (const node of simNodes) {
|
|
35652
|
+
if (!prevPos.has(node.id)) continue;
|
|
35653
|
+
const g = node.group ?? "__none__";
|
|
35654
|
+
let c = centroids.get(g);
|
|
35655
|
+
if (!c) {
|
|
35656
|
+
c = { x: 0, y: 0, n: 0 };
|
|
35657
|
+
centroids.set(g, c);
|
|
35658
|
+
}
|
|
35659
|
+
c.x += node.x;
|
|
35660
|
+
c.y += node.y;
|
|
35661
|
+
c.n += 1;
|
|
35662
|
+
}
|
|
35663
|
+
const ringCount = /* @__PURE__ */ new Map();
|
|
35664
|
+
for (const node of simNodes) {
|
|
35665
|
+
if (prevPos.has(node.id)) continue;
|
|
35666
|
+
const g = node.group ?? "__none__";
|
|
35667
|
+
const c = centroids.get(g);
|
|
35668
|
+
const cx = c && c.n > 0 ? c.x / c.n : w / 2;
|
|
35669
|
+
const cy = c && c.n > 0 ? c.y / c.n : h / 2;
|
|
35670
|
+
const k = ringCount.get(g) ?? 0;
|
|
35671
|
+
ringCount.set(g, k + 1);
|
|
35672
|
+
const angle = k * 2.399963;
|
|
35673
|
+
const r = 22 + k * 8;
|
|
35674
|
+
node.x = Math.max(30, Math.min(w - 30, cx + r * Math.cos(angle)));
|
|
35675
|
+
node.y = Math.max(30, Math.min(h - 30, cy + r * Math.sin(angle)));
|
|
35676
|
+
}
|
|
35677
|
+
}
|
|
35601
35678
|
forceUpdate((n) => n + 1);
|
|
35602
35679
|
} else {
|
|
35603
35680
|
forceUpdate((n) => n + 1);
|
|
@@ -35605,7 +35682,7 @@ var init_GraphCanvas = __esm({
|
|
|
35605
35682
|
return () => {
|
|
35606
35683
|
cancelAnimationFrame(animRef.current);
|
|
35607
35684
|
};
|
|
35608
|
-
}, [propNodes, propEdges, layout, repulsion, linkDistance, nodeSpacing, showLabels
|
|
35685
|
+
}, [propNodes, propEdges, propSimilarity, layout, repulsion, linkDistance, nodeSpacing, showLabels]);
|
|
35609
35686
|
useEffect(() => {
|
|
35610
35687
|
const canvas = canvasRef.current;
|
|
35611
35688
|
if (!canvas) return;
|