import { Card, SizableText } from "@multiplatform.one/components"; import type { Meta, StoryObj } from "@storybook/react-native-web-vite"; import { YStack } from "tamagui"; import { GraphLayout } from "./GraphLayout"; import type { GraphLayoutEdge, GraphLayoutNode } from "./plan"; import { ogdenApps, ogdenLinks } from "./ogden.fixture"; const apps = [...ogdenApps, "sandbox-a", "sandbox-b", "sandbox-c"]; const nodes: GraphLayoutNode[] = apps.map((id) => ({ id, width: 96, height: 72 })); const edges: GraphLayoutEdge[] = ogdenLinks.map(([source, target], index) => ({ source, target, emphasis: index % 13 === 0, })); function Tile({ id }: { id: string }) { return ( {id} ); } const renderNode = (id: string) => ; const meta: Meta = { title: "NodeGraph/GraphLayout", component: GraphLayout, parameters: { status: { type: "beta" }, layout: "fullscreen", nativeGallery: { scroll: false }, docs: { description: { component: "A read-only graph of host views (LC-294). Nodes are whatever the host renders at the size it gives; GraphLayout places them with NodeGraph's dagre engine, draws every edge through NodeGraph's own edge path and router in theme tokens, and pans and zooms the canvas over a $color-6 dot grid. Edges end on box edges and never run under a node. Emphasis is the theme accent. An editable graph is NodeGraph.", }, }, }, }; export default meta; type Story = StoryObj; function Frame(props: Parameters[0]) { return ( ); } export const Apps: Story = { render: () => , }; export const LeftToRight: Story = { render: () => , }; export const TopToBottom: Story = { render: () => , }; export const EdgeKinds: Story = { render: () => ( ({ id, width: 96, height: 72, }))} edges={[ { source: "source", target: "flow", kind: "flow" }, { source: "source", target: "data", kind: "data" }, { source: "source", target: "error", kind: "error" }, { source: "source", target: "conditional", kind: "conditional" }, ]} renderNode={renderNode} direction="LR" dots={false} /> ), };