@petrarca/sonnet-playground 0.6.0 → 0.7.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/README.md +63 -101
- package/dist/PlayAuth-SOEYPOOL.js +8 -0
- package/dist/PlayForms-L532W3JL.js +7 -0
- package/dist/PlayGraph-M4KQSFI7.js +7 -0
- package/dist/PlaySchemaDesigner-S4DBB53G.js +7 -0
- package/dist/PlaySchemaDesigner-S4DBB53G.js.map +1 -0
- package/dist/{chunk-6VQJFBTM.js → chunk-2XMWOZ5O.js} +1 -1
- package/dist/chunk-2XMWOZ5O.js.map +1 -0
- package/dist/{chunk-C2P3UQMZ.js → chunk-E5X7GVLU.js} +2 -2
- package/dist/chunk-E5X7GVLU.js.map +1 -0
- package/dist/{chunk-ZSUCFEB6.js → chunk-I2FLG6ZD.js} +2 -1
- package/dist/{chunk-ZSUCFEB6.js.map → chunk-I2FLG6ZD.js.map} +1 -1
- package/dist/chunk-RYCRENYO.js +401 -0
- package/dist/chunk-RYCRENYO.js.map +1 -0
- package/dist/index.d.ts +20 -10
- package/dist/index.js +50 -5
- package/dist/index.js.map +1 -1
- package/dist/pages/index.d.ts +3 -1
- package/dist/pages/index.js +7 -3
- package/package.json +7 -7
- package/dist/PlayForms-2G7PROCH.js +0 -7
- package/dist/PlayGraph-M7UE5MZC.js +0 -7
- package/dist/PlaySchemaDesigner-ZM4F7KBU.js +0 -7
- package/dist/chunk-6VQJFBTM.js.map +0 -1
- package/dist/chunk-C2P3UQMZ.js.map +0 -1
- /package/dist/{PlayForms-2G7PROCH.js.map → PlayAuth-SOEYPOOL.js.map} +0 -0
- /package/dist/{PlayGraph-M7UE5MZC.js.map → PlayForms-L532W3JL.js.map} +0 -0
- /package/dist/{PlaySchemaDesigner-ZM4F7KBU.js.map → PlayGraph-M4KQSFI7.js.map} +0 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/PlaygroundRegistry.ts","../src/builtinEntries.ts","../src/createPlaygroundModule.tsx","../src/PlaygroundOverview.tsx","../src/PlaygroundSettingsPanel.tsx","../src/PlaygroundSettings.tsx","../src/index.ts"],"sourcesContent":["/**\n * PlaygroundRegistry -- mutable collection of playground entries.\n *\n * The library ships a default instance pre-populated with the built-in\n * sonnet component demos. Consumers register additional entries for\n * domain-specific playgrounds before passing the registry to\n * createPlaygroundModule().\n */\nimport type { PlaygroundEntry } from \"./types\";\n\nexport class PlaygroundRegistry {\n private entries: Map<string, PlaygroundEntry> = new Map();\n\n /** Register a playground entry. Overwrites any existing entry with the same id. */\n register(entry: PlaygroundEntry): void {\n this.entries.set(entry.id, entry);\n }\n\n /** Register multiple entries at once. */\n registerAll(entries: PlaygroundEntry[]): void {\n for (const entry of entries) {\n this.entries.set(entry.id, entry);\n }\n }\n\n /** Remove an entry by id. Returns true if it existed. */\n unregister(id: string): boolean {\n return this.entries.delete(id);\n }\n\n /** Get a single entry by id. */\n get(id: string): PlaygroundEntry | undefined {\n return this.entries.get(id);\n }\n\n /** Fallback group label for entries with no group defined. */\n static readonly DEFAULT_GROUP = \"General\";\n\n /**\n * All registered entries, sorted by group registration order then\n * by `order` within each group.\n */\n getAll(): PlaygroundEntry[] {\n const groupOrder = this.getGroupOrder();\n return [...this.entries.values()].sort((a, b) => {\n const groupA = a.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n const groupB = b.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n if (groupA !== groupB) {\n return (\n (groupOrder.get(groupA) ?? 999) - (groupOrder.get(groupB) ?? 999)\n );\n }\n return (a.order ?? 0) - (b.order ?? 0);\n });\n }\n\n /**\n * Entries grouped by their group label.\n * Returns an array of [groupLabel, entries[]] tuples, preserving\n * first-seen registration order for groups and `order` within each group.\n */\n getGrouped(): Array<[string, PlaygroundEntry[]]> {\n const grouped = new Map<string, PlaygroundEntry[]>();\n for (const entry of this.getAll()) {\n const group = entry.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n const list = grouped.get(group) ?? [];\n list.push(entry);\n grouped.set(group, list);\n }\n return [...grouped.entries()];\n }\n\n /** Map of group name → first-seen index (registration order). */\n private getGroupOrder(): Map<string, number> {\n const order = new Map<string, number>();\n let idx = 0;\n for (const entry of this.entries.values()) {\n const group = entry.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n if (!order.has(group)) {\n order.set(group, idx++);\n }\n }\n return order;\n }\n\n /** Number of registered entries. */\n get size(): number {\n return this.entries.size;\n }\n}\n","/**\n * Built-in playground entries for the sonnet component library.\n *\n * These entries demonstrate @petrarca/sonnet-* components with static\n * mock data -- no application backend required. Each page is lazy-loaded.\n */\nimport { lazy } from \"react\";\nimport {\n Type,\n Palette,\n Grid,\n Layers,\n Braces,\n Check,\n Edit,\n Package,\n Table2,\n Network,\n SquareTerminal,\n PencilRuler,\n} from \"lucide-react\";\nimport type { PlaygroundEntry } from \"./types\";\n\nexport const builtinEntries: PlaygroundEntry[] = [\n {\n id: \"sonnet.typography\",\n title: \"Typography\",\n description:\n \"Living style-guide for the typography system. Font families, type scale, weights, heading hierarchy, color tiers, and component patterns.\",\n icon: Type,\n color: \"teal\",\n path: \"typography\",\n component: lazy(() => import(\"./pages/PlayTypography\")),\n group: \"Design System\",\n order: 0,\n },\n {\n id: \"sonnet.color-palette\",\n title: \"Color Palette\",\n description:\n \"Living reference for the color system. Semantic tokens, extended palette, badge colors, icon accents, and usage guidance.\",\n icon: Palette,\n color: \"violet\",\n path: \"color-palette\",\n component: lazy(() => import(\"./pages/PlayColorPalette\")),\n group: \"Design System\",\n order: 1,\n },\n {\n id: \"sonnet.core-components\",\n title: \"Core UI Components\",\n description:\n \"Test all core UI components (notifications, buttons, dialogs, forms, etc.) in isolation before production use.\",\n icon: Grid,\n color: \"indigo\",\n path: \"core-components\",\n component: lazy(() => import(\"./pages/PlayCoreComponents\")),\n group: \"Components\",\n order: 0,\n },\n {\n id: \"sonnet.advanced-components\",\n title: \"Advanced Components\",\n description:\n \"Multi-step workflows (Stepper) and hierarchical data structures (TreeView) with keyboard navigation and selection.\",\n icon: Layers,\n color: \"emerald\",\n path: \"advanced-components\",\n component: lazy(() => import(\"./pages/PlayAdvancedComponents\")),\n group: \"Components\",\n order: 1,\n },\n {\n id: \"sonnet.json-editor\",\n title: \"JSON Editor\",\n description:\n \"Constrained JSON editor with selectively editable regions using JSON Pointer (RFC 6901). Readonly sections are visible but locked.\",\n icon: Braces,\n color: \"amber\",\n path: \"json-editor\",\n component: lazy(() => import(\"./pages/PlayJsonEditor\")),\n group: \"Components\",\n order: 2,\n },\n {\n id: \"sonnet.form-components\",\n title: \"Form Components\",\n description:\n \"Test custom Form wrapper components with labels, descriptions, and error states. Includes Input, Textarea, Number, Checkbox, Select, MultiSelect, and Tags.\",\n icon: Check,\n color: \"blue\",\n path: \"form-components\",\n component: lazy(() => import(\"./pages/PlayFormComponents\")),\n group: \"Forms\",\n order: 0,\n },\n {\n id: \"sonnet.forms\",\n title: \"Forms Renderer\",\n description:\n \"Test and experiment with the JsonSchemaFormRenderer component. Try different schemas and see real-time validation.\",\n icon: Edit,\n color: \"purple\",\n path: \"forms\",\n component: lazy(() => import(\"./pages/PlayForms\")),\n group: \"Forms\",\n order: 1,\n },\n {\n id: \"sonnet.form-widgets\",\n title: \"Form Widgets\",\n description:\n \"Pluggable field components consumed by the Forms Renderer. Each widget maps to a JSON Schema type or format and can be swapped independently.\",\n icon: Package,\n color: \"indigo\",\n path: \"form-widgets\",\n component: lazy(() => import(\"./pages/PlayFormWidgets\")),\n group: \"Forms\",\n order: 2,\n },\n {\n id: \"sonnet.schema-designer\",\n title: \"Schema Designer\",\n description:\n \"Visually author a JSON Schema and its UI presentation hints. Field tree, inspector, and live preview; edits emit a valid schema + uiSchema.\",\n icon: PencilRuler,\n color: \"teal\",\n path: \"schema-designer\",\n component: lazy(() => import(\"./pages/PlaySchemaDesigner\")),\n group: \"Schemas\",\n order: 0,\n },\n {\n id: \"sonnet.data-components\",\n title: \"Data Components\",\n description:\n \"Interactive sandbox for SearchInput (simple and faceted mode) and EntityTable. Includes a live table wired to the faceted search.\",\n icon: Table2,\n color: \"teal\",\n path: \"data-components\",\n component: lazy(() => import(\"./pages/PlayDataComponents\")),\n group: \"Data\",\n order: 0,\n },\n {\n id: \"sonnet.graph\",\n title: \"Graph Visualization\",\n description:\n \"Interactive property graph visualization with dual renderer support (Cytoscape, Reagraph). Org hierarchy demo with filtering, selection, and exploration.\",\n icon: Network,\n color: \"cyan\",\n path: \"graph\",\n component: lazy(() => import(\"./pages/PlayGraph\")),\n group: \"Graph\",\n order: 0,\n },\n {\n id: \"sonnet.shell-api\",\n title: \"Shell API\",\n description:\n \"Interactive demo of the shell API: notifications, dialogs, programmatic navigation, slide-over panels, the resizable sidePane, and the Cmd+K command menu.\",\n icon: SquareTerminal,\n color: \"orange\",\n path: \"shell-api\",\n component: lazy(() => import(\"./pages/PlayShellApi\")),\n group: \"Shell\",\n order: 0,\n },\n];\n","/**\n * Factory that turns a PlaygroundRegistry into a ShellModule.\n *\n * Generates routes (lazy + Suspense), sidebar navigation, and the\n * overview index page -- all derived from the registry entries.\n * The consumer just passes a registry and optional overrides.\n */\nimport React, { Suspense } from \"react\";\nimport { Outlet } from \"react-router-dom\";\nimport { FlaskConical } from \"lucide-react\";\nimport type { ShellModule, NavGroup } from \"@petrarca/sonnet-shell\";\nimport type { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport type { PlaygroundModuleOptions } from \"./types\";\nimport { PlaygroundOverview } from \"./PlaygroundOverview\";\nimport { PlaygroundSettingsProvider } from \"./PlaygroundSettings\";\n\nfunction buildNavigation(\n registry: PlaygroundRegistry,\n basePath: string,\n): NavGroup[] {\n const groups = registry.getGrouped();\n const navGroups: NavGroup[] = [];\n\n navGroups.push({\n id: \"playground-overview\",\n links: [{ label: \"Overview\", path: basePath }],\n });\n\n for (const [groupLabel, entries] of groups) {\n navGroups.push({\n id: `playground-${groupLabel.toLowerCase().replace(/\\s+/g, \"-\")}`,\n heading: groupLabel,\n links: entries.map((e) => ({\n label: e.title,\n path: `${basePath}/${e.path}`,\n })),\n });\n }\n\n return navGroups;\n}\n\n// Wrap a component in Suspense for lazy loading.\nfunction suspended(Component: React.ComponentType): React.ReactElement {\n return (\n <Suspense>\n <Component />\n </Suspense>\n );\n}\n\n// Layout route element: a single PlaygroundSettingsProvider wrapping all\n// playground routes via <Outlet>. Mounted once, never torn down on navigation,\n// so settings state is stable across route changes within the playground.\nfunction PlaygroundLayout(): React.ReactElement {\n return (\n <PlaygroundSettingsProvider>\n <Outlet />\n </PlaygroundSettingsProvider>\n );\n}\n\nexport function createPlaygroundModule(\n registry: PlaygroundRegistry,\n options: PlaygroundModuleOptions = {},\n): ShellModule {\n const {\n icon = FlaskConical,\n label = \"Playground\",\n basePath = \"/playground\",\n overviewTitle = \"Developer Playground\",\n overviewSubtitle = \"Experiment with components, test features, and explore capabilities.\",\n grouped = true,\n } = options;\n\n const routeBase = basePath.replace(/^\\//, \"\");\n\n // A single layout route wraps all playground routes. The settings provider\n // lives here -- mounted once, alive for the full playground session.\n const routes = [\n {\n path: routeBase,\n element: <PlaygroundLayout />,\n children: [\n {\n index: true,\n element: suspended(() => (\n <PlaygroundOverview\n registry={registry}\n basePath={basePath}\n title={overviewTitle}\n subtitle={overviewSubtitle}\n grouped={grouped}\n />\n )),\n },\n ...registry.getAll().map((entry) => ({\n path: entry.path,\n element: suspended(entry.component),\n })),\n ],\n },\n ];\n\n return {\n id: \"playground\",\n label,\n icon,\n basePath,\n pinBottom: true,\n navigation: buildNavigation(registry, basePath),\n routes,\n };\n}\n","/**\n * PlaygroundOverview -- tile grid rendered from a PlaygroundRegistry.\n *\n * Displays cards with colored icons. Clicking a card navigates to the\n * playground page. A toggle in the header lets the user switch between\n * grouped (by category) and flat (all tiles) views.\n */\nimport React, { useState } from \"react\";\nimport { useNavigate } from \"react-router-dom\";\nimport { LayoutGrid, List } from \"lucide-react\";\nimport { Card, Button, SimpleTooltip } from \"@petrarca/sonnet-ui\";\nimport type { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport type { PlaygroundColor, PlaygroundEntry } from \"./types\";\nimport { PlaygroundSettingsPanel } from \"./PlaygroundSettingsPanel\";\n\n// Maps colour name to icon container classes (bg-*-100 text-*-600 pairing).\nconst COLOR_CLASSES: Record<PlaygroundColor, string> = {\n blue: \"bg-blue-100 text-blue-600\",\n violet: \"bg-violet-100 text-violet-600\",\n indigo: \"bg-indigo-100 text-indigo-600\",\n purple: \"bg-purple-100 text-purple-600\",\n teal: \"bg-teal-100 text-teal-600\",\n amber: \"bg-amber-100 text-amber-600\",\n emerald: \"bg-emerald-100 text-emerald-600\",\n rose: \"bg-rose-100 text-rose-600\",\n orange: \"bg-orange-100 text-orange-600\",\n cyan: \"bg-cyan-100 text-cyan-600\",\n};\n\nconst TILE_GRID = \"grid grid-cols-1 sm:grid-cols-2 2xl:grid-cols-3 gap-6\";\n\ninterface PlaygroundOverviewProps {\n registry: PlaygroundRegistry;\n basePath: string;\n title: string;\n subtitle: string;\n /** Initial grouping state. Defaults to true. User can toggle at runtime. */\n grouped?: boolean;\n}\n\ninterface TileProps {\n item: PlaygroundEntry;\n onNavigate: (path: string) => void;\n}\n\n/** A single playground tile card. */\nfunction PlaygroundTile({ item, onNavigate }: TileProps): React.ReactElement {\n return (\n <Card\n className=\"cursor-pointer shadow-sm border rounded-md p-6 transition-transform duration-200 motion-safe:hover:-translate-y-1\"\n onClick={() => onNavigate(item.path)}\n >\n <div className=\"flex items-center mb-4\">\n <div\n className={`flex items-center justify-center w-9 h-9 rounded-md ${COLOR_CLASSES[item.color] ?? COLOR_CLASSES.blue}`}\n >\n <item.icon size={18} />\n </div>\n </div>\n <h3 className=\"heading-section mb-1\">{item.title}</h3>\n <p className=\"text-sm text-muted-foreground\">{item.description}</p>\n </Card>\n );\n}\n\n/** Developer playground overview -- card grid linking to all registered pages. */\nexport function PlaygroundOverview({\n registry,\n basePath,\n title,\n subtitle,\n grouped: initialGrouped = true,\n}: PlaygroundOverviewProps): React.ReactElement {\n const navigate = useNavigate();\n const [grouped, setGrouped] = useState(initialGrouped);\n\n const handleNavigate = (path: string) => navigate(`${basePath}/${path}`);\n\n return (\n <div className=\"w-full\">\n <div className=\"flex items-start justify-between mb-6\">\n <div>\n <h1 className=\"mb-1\">{title}</h1>\n <p className=\"text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n <div className=\"flex items-center gap-1\">\n <SimpleTooltip\n label={grouped ? \"Show flat list\" : \"Group by category\"}\n >\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => setGrouped((v) => !v)}\n >\n {grouped ? (\n <LayoutGrid className=\"h-4 w-4\" />\n ) : (\n <List className=\"h-4 w-4\" />\n )}\n </Button>\n </SimpleTooltip>\n <PlaygroundSettingsPanel />\n </div>\n </div>\n\n {grouped ? (\n registry.getGrouped().map(([groupLabel, entries]) => (\n <div key={groupLabel} className=\"mb-8\">\n <h2 className=\"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4\">\n {groupLabel}\n </h2>\n <div className={TILE_GRID}>\n {entries.map((item) => (\n <PlaygroundTile\n key={item.id}\n item={item}\n onNavigate={handleNavigate}\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className={TILE_GRID}>\n {registry.getAll().map((item) => (\n <PlaygroundTile\n key={item.id}\n item={item}\n onNavigate={handleNavigate}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * PlaygroundSettingsPanel -- gear button that opens a right-side settings sheet.\n *\n * Hosts playground-wide settings (currently locale). Edits flow through\n * usePlaygroundSettings, which drives the SonnetConfigProvider wrapping all\n * playground routes.\n */\n\nimport React, { useState } from \"react\";\nimport { Settings } from \"lucide-react\";\nimport {\n IconButton,\n Label,\n Sheet,\n SheetContent,\n SheetHeader,\n SheetTitle,\n SheetDescription,\n SheetBody,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n} from \"@petrarca/sonnet-ui\";\nimport { usePlaygroundSettings } from \"./PlaygroundSettings\";\n\n// Locale choices for the playground. \"__inherit__\" uses the app/browser locale.\nconst INHERIT = \"__inherit__\";\nconst LOCALE_OPTIONS = [\n { code: INHERIT, label: \"Inherit (app / browser)\" },\n { code: \"en-US\", label: \"English (US) - MM/DD, Sun\" },\n { code: \"en-GB\", label: \"English (UK) - DD/MM, Mon\" },\n { code: \"de-DE\", label: \"German - DD.MM, Mon\" },\n { code: \"fr-FR\", label: \"French - DD/MM, Mon\" },\n { code: \"sv-SE\", label: \"Swedish - YYYY-MM-DD, Mon\" },\n { code: \"ja-JP\", label: \"Japanese - YYYY/MM/DD, Sun\" },\n];\n\nexport function PlaygroundSettingsPanel(): React.ReactElement {\n const [open, setOpen] = useState(false);\n const { settings, setSettings } = usePlaygroundSettings();\n\n return (\n <Sheet open={open} onOpenChange={setOpen}>\n <IconButton label=\"Playground settings\" onClick={() => setOpen(true)}>\n <Settings />\n </IconButton>\n <SheetContent side=\"right\">\n <SheetHeader>\n <SheetTitle>Playground settings</SheetTitle>\n <SheetDescription>\n Scoped to the playground. Values exchanged with components stay\n locale-independent (ISO); only display and input parsing change.\n </SheetDescription>\n </SheetHeader>\n <SheetBody>\n <div className=\"space-y-2\">\n <Label htmlFor=\"playground-locale\">Locale</Label>\n <Select\n value={settings.locale || INHERIT}\n onValueChange={(value) =>\n setSettings({ locale: value === INHERIT ? \"\" : value })\n }\n >\n <SelectTrigger id=\"playground-locale\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {LOCALE_OPTIONS.map((opt) => (\n <SelectItem key={opt.code} value={opt.code}>\n {opt.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"text-xs text-tertiary-foreground\">\n Drives locale-sensitive components (e.g. Date Input) across every\n playground page.\n </p>\n </div>\n </SheetBody>\n </SheetContent>\n </Sheet>\n );\n}\n","/**\n * Playground-scoped settings (locale, ...).\n *\n * A self-contained provider that wraps all playground routes. It owns a small\n * settings object, persists it to a namespaced localStorage key, and renders a\n * SonnetConfigProvider so the settings flow to every playground page.\n *\n * Scope and containment: the provider is nested under any host-app provider and\n * merges onto it, so a playground override shadows the app/browser value only\n * within the playground subtree -- it never mutates the host app's global\n * config. The default is \"inherit\" (empty locale), so out of the box the\n * playground changes nothing.\n */\n\nimport React, {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { SonnetConfigProvider } from \"@petrarca/sonnet-core/config\";\n\nconst STORAGE_KEY = \"sonnet.playground.settings\";\n\nexport interface PlaygroundSettings {\n /** BCP-47 locale override, or \"\" to inherit the app/browser locale. */\n locale: string;\n}\n\ninterface PlaygroundSettingsContextValue {\n settings: PlaygroundSettings;\n setSettings: (next: Partial<PlaygroundSettings>) => void;\n}\n\nconst DEFAULT_SETTINGS: PlaygroundSettings = { locale: \"\" };\n\nconst PlaygroundSettingsContext =\n createContext<PlaygroundSettingsContextValue | null>(null);\n\n// Safe localStorage access (guards against SSR and storage failures).\nconst storage = {\n get(key: string): string | null {\n try {\n return typeof localStorage !== \"undefined\"\n ? localStorage.getItem(key)\n : null;\n } catch {\n return null;\n }\n },\n set(key: string, value: string): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, value);\n } catch {\n // Ignore quota / private-mode failures.\n }\n },\n};\n\nfunction loadSettings(): PlaygroundSettings {\n const raw = storage.get(STORAGE_KEY);\n if (!raw) return DEFAULT_SETTINGS;\n try {\n return { ...DEFAULT_SETTINGS, ...(JSON.parse(raw) as PlaygroundSettings) };\n } catch {\n return DEFAULT_SETTINGS;\n }\n}\n\nfunction persistSettings(settings: PlaygroundSettings): void {\n storage.set(STORAGE_KEY, JSON.stringify(settings));\n}\n\nexport interface PlaygroundSettingsProviderProps {\n children: React.ReactNode;\n}\n\nexport function PlaygroundSettingsProvider({\n children,\n}: PlaygroundSettingsProviderProps): React.ReactElement {\n const [settings, setSettingsState] =\n useState<PlaygroundSettings>(loadSettings);\n\n const setSettings = useCallback(\n (next: Partial<PlaygroundSettings>) =>\n setSettingsState((prev) => {\n const merged = { ...prev, ...next };\n persistSettings(merged);\n return merged;\n }),\n [],\n );\n\n const contextValue = useMemo(\n () => ({ settings, setSettings }),\n [settings, setSettings],\n );\n\n // Only override the global locale when explicitly set; \"\" inherits.\n const config = useMemo(\n () => ({ globals: { locale: settings.locale || undefined } }),\n [settings.locale],\n );\n\n return (\n <PlaygroundSettingsContext.Provider value={contextValue}>\n <SonnetConfigProvider value={config}>{children}</SonnetConfigProvider>\n </PlaygroundSettingsContext.Provider>\n );\n}\n\n/** Access playground settings. Returns defaults when no provider is present. */\nexport function usePlaygroundSettings(): PlaygroundSettingsContextValue {\n return (\n useContext(PlaygroundSettingsContext) ?? {\n settings: DEFAULT_SETTINGS,\n setSettings: () => {},\n }\n );\n}\n","/**\n * @petrarca/sonnet-playground\n *\n * Playground framework and built-in component demos for the Petrarca\n * Sonnet component library.\n *\n * Usage:\n *\n * import {\n * createPlaygroundRegistry,\n * createPlaygroundModule,\n * } from \"@petrarca/sonnet-playground\";\n *\n * const playground = createPlaygroundRegistry();\n * // Optionally register additional entries:\n * playground.register({ id: \"app.custom\", ... });\n *\n * const playgroundModule = createPlaygroundModule(playground);\n */\n\nimport { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport { builtinEntries } from \"./builtinEntries\";\n\n// Framework\nexport { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nexport { createPlaygroundModule } from \"./createPlaygroundModule\";\nexport { PlaygroundOverview } from \"./PlaygroundOverview\";\nexport { PlaygroundSection } from \"./PlaygroundSection\";\nexport {\n PlaygroundSettingsProvider,\n usePlaygroundSettings,\n type PlaygroundSettings,\n} from \"./PlaygroundSettings\";\nexport { PlaygroundSettingsPanel } from \"./PlaygroundSettingsPanel\";\n\n// Types\nexport type {\n PlaygroundEntry,\n PlaygroundColor,\n PlaygroundModuleOptions,\n} from \"./types\";\n\n// Built-in entries (for selective use or extending)\nexport { builtinEntries } from \"./builtinEntries\";\n\n/**\n * Convenience factory: creates a new PlaygroundRegistry pre-populated\n * with all built-in sonnet component demos.\n */\nexport function createPlaygroundRegistry(): PlaygroundRegistry {\n const registry = new PlaygroundRegistry();\n registry.registerAll(builtinEntries);\n return registry;\n}\n"],"mappings":";;;;;AAUO,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EACtB,UAAwC,oBAAI,IAAI;AAAA;AAAA,EAGxD,SAAS,OAA8B;AACrC,SAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;AAAA,EAClC;AAAA;AAAA,EAGA,YAAY,SAAkC;AAC5C,eAAW,SAAS,SAAS;AAC3B,WAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;AAAA,IAClC;AAAA,EACF;AAAA;AAAA,EAGA,WAAW,IAAqB;AAC9B,WAAO,KAAK,QAAQ,OAAO,EAAE;AAAA,EAC/B;AAAA;AAAA,EAGA,IAAI,IAAyC;AAC3C,WAAO,KAAK,QAAQ,IAAI,EAAE;AAAA,EAC5B;AAAA;AAAA,EAGA,OAAgB,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMhC,SAA4B;AAC1B,UAAM,aAAa,KAAK,cAAc;AACtC,WAAO,CAAC,GAAG,KAAK,QAAQ,OAAO,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM;AAC/C,YAAM,SAAS,EAAE,SAAS,oBAAmB;AAC7C,YAAM,SAAS,EAAE,SAAS,oBAAmB;AAC7C,UAAI,WAAW,QAAQ;AACrB,gBACG,WAAW,IAAI,MAAM,KAAK,QAAQ,WAAW,IAAI,MAAM,KAAK;AAAA,MAEjE;AACA,cAAQ,EAAE,SAAS,MAAM,EAAE,SAAS;AAAA,IACtC,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,aAAiD;AAC/C,UAAM,UAAU,oBAAI,IAA+B;AACnD,eAAW,SAAS,KAAK,OAAO,GAAG;AACjC,YAAM,QAAQ,MAAM,SAAS,oBAAmB;AAChD,YAAM,OAAO,QAAQ,IAAI,KAAK,KAA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;AAAA,cACV;AAAA;AAAA,UACF,CACD;AAAA,QACH;AAAA,QACA,GAAG,SAAS,OAAO,EAAE,IAAI,CAAC,WAAW;AAAA,UACnC,MAAM,MAAM;AAAA,UACZ,SAAS,UAAU,MAAM,SAAS;AAAA,QACpC,EAAE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,YAAY,gBAAgB,UAAU,QAAQ;AAAA,IAC9C;AAAA,EACF;AACF;;;AIhEO,SAAS,2BAA+C;AAC7D,QAAM,WAAW,IAAI,mBAAmB;AACxC,WAAS,YAAY,cAAc;AACnC,SAAO;AACT;","names":["useState","useState","jsx","useState","jsx","jsxs","useState","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/PlaygroundRegistry.ts","../src/builtinEntries.ts","../src/createPlaygroundModule.tsx","../src/PlaygroundOverview.tsx","../src/PlaygroundSettingsPanel.tsx","../src/PlaygroundSettings.tsx","../src/index.ts"],"sourcesContent":["/**\n * PlaygroundRegistry -- mutable collection of playground entries.\n *\n * The library ships a default instance pre-populated with the built-in\n * sonnet component demos. Consumers register additional entries for\n * domain-specific playgrounds before passing the registry to\n * createPlaygroundModule().\n */\nimport { warnLog } from \"@petrarca/sonnet-core\";\nimport type { PlaygroundEntry } from \"./types\";\n\nexport class PlaygroundRegistry {\n private entries: Map<string, PlaygroundEntry> = new Map();\n\n /**\n * Report registrations that cannot work, rather than silently misbehaving.\n *\n * Entries are keyed by `id`, so two entries may legally share a `path` --\n * and then both produce a route on the same URL and one is unreachable.\n * Groups are bucketed by their exact label, so two labels differing only by\n * case become two separate groups.\n *\n * Neither is corrected here: dropping an entry, or merging groups the caller\n * spelled differently, would be its own surprise. The registration stands and\n * the problem is made diagnosable.\n */\n private warnOnConflicts(entry: PlaygroundEntry): void {\n for (const existing of this.entries.values()) {\n if (existing.id === entry.id) continue;\n\n if (existing.path === entry.path) {\n warnLog(\n `[PlaygroundRegistry] entries \"${existing.id}\" and \"${entry.id}\" share the path \"${entry.path}\". Both will route to the same URL and one will be unreachable.`,\n );\n }\n\n const group = entry.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n const existingGroup = existing.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n if (\n group !== existingGroup &&\n group.toLowerCase() === existingGroup.toLowerCase()\n ) {\n warnLog(\n `[PlaygroundRegistry] group \"${group}\" differs from \"${existingGroup}\" only by case; they will render as two separate groups.`,\n );\n }\n }\n }\n\n /** Register a playground entry. Overwrites any existing entry with the same id. */\n register(entry: PlaygroundEntry): void {\n this.warnOnConflicts(entry);\n this.entries.set(entry.id, entry);\n }\n\n /** Register multiple entries at once. */\n registerAll(entries: PlaygroundEntry[]): void {\n for (const entry of entries) {\n this.register(entry);\n }\n }\n\n /** Remove an entry by id. Returns true if it existed. */\n unregister(id: string): boolean {\n return this.entries.delete(id);\n }\n\n /** Get a single entry by id. */\n get(id: string): PlaygroundEntry | undefined {\n return this.entries.get(id);\n }\n\n /** Fallback group label for entries with no group defined. */\n static readonly DEFAULT_GROUP = \"General\";\n\n /**\n * All registered entries, sorted by group registration order then\n * by `order` within each group.\n */\n getAll(): PlaygroundEntry[] {\n const groupOrder = this.getGroupOrder();\n return [...this.entries.values()].sort((a, b) => {\n const groupA = a.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n const groupB = b.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n if (groupA !== groupB) {\n return (\n (groupOrder.get(groupA) ?? 999) - (groupOrder.get(groupB) ?? 999)\n );\n }\n return (a.order ?? 0) - (b.order ?? 0);\n });\n }\n\n /**\n * Entries grouped by their group label.\n * Returns an array of [groupLabel, entries[]] tuples, preserving\n * first-seen registration order for groups and `order` within each group.\n */\n getGrouped(): Array<[string, PlaygroundEntry[]]> {\n const grouped = new Map<string, PlaygroundEntry[]>();\n for (const entry of this.getAll()) {\n const group = entry.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n const list = grouped.get(group) ?? [];\n list.push(entry);\n grouped.set(group, list);\n }\n return [...grouped.entries()];\n }\n\n /** Map of group name → first-seen index (registration order). */\n private getGroupOrder(): Map<string, number> {\n const order = new Map<string, number>();\n let idx = 0;\n for (const entry of this.entries.values()) {\n const group = entry.group ?? PlaygroundRegistry.DEFAULT_GROUP;\n if (!order.has(group)) {\n order.set(group, idx++);\n }\n }\n return order;\n }\n\n /** Number of registered entries. */\n get size(): number {\n return this.entries.size;\n }\n}\n","/**\n * Built-in playground entries for the sonnet component library.\n *\n * These entries demonstrate @petrarca/sonnet-* components with static\n * mock data -- no application backend required. Each page is lazy-loaded.\n */\nimport { lazy } from \"react\";\nimport {\n Type,\n Palette,\n Grid,\n Layers,\n Braces,\n Check,\n Edit,\n Package,\n Table2,\n Network,\n SquareTerminal,\n PencilRuler,\n ShieldCheck,\n} from \"lucide-react\";\nimport type { PlaygroundEntry } from \"./types\";\n\nexport const builtinEntries: PlaygroundEntry[] = [\n {\n id: \"sonnet.typography\",\n title: \"Typography\",\n description:\n \"Living style-guide for the typography system. Font families, type scale, weights, heading hierarchy, color tiers, and component patterns.\",\n icon: Type,\n color: \"teal\",\n path: \"typography\",\n component: lazy(() => import(\"./pages/PlayTypography\")),\n group: \"Design System\",\n order: 0,\n },\n {\n id: \"sonnet.color-palette\",\n title: \"Color Palette\",\n description:\n \"Living reference for the color system. Semantic tokens, extended palette, badge colors, icon accents, and usage guidance.\",\n icon: Palette,\n color: \"violet\",\n path: \"color-palette\",\n component: lazy(() => import(\"./pages/PlayColorPalette\")),\n group: \"Design System\",\n order: 1,\n },\n {\n id: \"sonnet.core-components\",\n title: \"Core UI Components\",\n description:\n \"Test all core UI components (notifications, buttons, dialogs, forms, etc.) in isolation before production use.\",\n icon: Grid,\n color: \"indigo\",\n path: \"core-components\",\n component: lazy(() => import(\"./pages/PlayCoreComponents\")),\n group: \"Components\",\n order: 0,\n },\n {\n id: \"sonnet.advanced-components\",\n title: \"Advanced Components\",\n description:\n \"Multi-step workflows (Stepper) and hierarchical data structures (TreeView) with keyboard navigation and selection.\",\n icon: Layers,\n color: \"emerald\",\n path: \"advanced-components\",\n component: lazy(() => import(\"./pages/PlayAdvancedComponents\")),\n group: \"Components\",\n order: 1,\n },\n {\n id: \"sonnet.json-editor\",\n title: \"JSON Editor\",\n description:\n \"Constrained JSON editor with selectively editable regions using JSON Pointer (RFC 6901). Readonly sections are visible but locked.\",\n icon: Braces,\n color: \"amber\",\n path: \"json-editor\",\n component: lazy(() => import(\"./pages/PlayJsonEditor\")),\n group: \"Components\",\n order: 2,\n },\n {\n id: \"sonnet.form-components\",\n title: \"Form Components\",\n description:\n \"Test custom Form wrapper components with labels, descriptions, and error states. Includes Input, Textarea, Number, Checkbox, Select, MultiSelect, and Tags.\",\n icon: Check,\n color: \"blue\",\n path: \"form-components\",\n component: lazy(() => import(\"./pages/PlayFormComponents\")),\n group: \"Forms\",\n order: 0,\n },\n {\n id: \"sonnet.forms\",\n title: \"Forms Renderer\",\n description:\n \"Test and experiment with the JsonSchemaFormRenderer component. Try different schemas and see real-time validation.\",\n icon: Edit,\n color: \"purple\",\n path: \"forms\",\n component: lazy(() => import(\"./pages/PlayForms\")),\n group: \"Forms\",\n order: 1,\n },\n {\n id: \"sonnet.form-widgets\",\n title: \"Form Widgets\",\n description:\n \"Pluggable field components consumed by the Forms Renderer. Each widget maps to a JSON Schema type or format and can be swapped independently.\",\n icon: Package,\n color: \"indigo\",\n path: \"form-widgets\",\n component: lazy(() => import(\"./pages/PlayFormWidgets\")),\n group: \"Forms\",\n order: 2,\n },\n {\n id: \"sonnet.schema-designer\",\n title: \"Schema Designer\",\n description:\n \"Visually author a JSON Schema and its UI presentation hints. Field tree, inspector, and live preview; edits emit a valid schema + uiSchema.\",\n icon: PencilRuler,\n color: \"teal\",\n path: \"schema-designer\",\n component: lazy(() => import(\"./pages/PlaySchemaDesigner\")),\n group: \"Schemas\",\n order: 0,\n },\n {\n id: \"sonnet.data-components\",\n title: \"Data Components\",\n description:\n \"Interactive sandbox for SearchInput (simple and faceted mode) and EntityTable. Includes a live table wired to the faceted search.\",\n icon: Table2,\n color: \"teal\",\n path: \"data-components\",\n component: lazy(() => import(\"./pages/PlayDataComponents\")),\n group: \"Data\",\n order: 0,\n },\n {\n id: \"sonnet.graph\",\n title: \"Graph Visualization\",\n description:\n \"Interactive property graph visualization with dual renderer support (Cytoscape, Reagraph). Org hierarchy demo with filtering, selection, and exploration.\",\n icon: Network,\n color: \"cyan\",\n path: \"graph\",\n component: lazy(() => import(\"./pages/PlayGraph\")),\n group: \"Graph\",\n order: 0,\n },\n {\n id: \"sonnet.shell-api\",\n title: \"Shell API\",\n description:\n \"Interactive demo of the shell API: notifications, dialogs, programmatic navigation, slide-over panels, the resizable sidePane, and the Cmd+K command menu.\",\n icon: SquareTerminal,\n color: \"orange\",\n path: \"shell-api\",\n component: lazy(() => import(\"./pages/PlayShellApi\")),\n group: \"Shell\",\n order: 0,\n },\n {\n id: \"sonnet.auth\",\n title: \"Auth Screens\",\n description:\n \"The pre-application login and organization selection screens: identifier-first and legacy flows, provider combinations, error and loading states, and every org-selection outcome.\",\n icon: ShieldCheck,\n color: \"teal\",\n path: \"auth\",\n component: lazy(() => import(\"./pages/PlayAuth\")),\n group: \"Shell\",\n order: 1,\n },\n];\n","/**\n * Factory that turns a PlaygroundRegistry into a ShellModule.\n *\n * Generates routes (lazy + Suspense), sidebar navigation, and the\n * overview index page -- all derived from the registry entries.\n * The consumer just passes a registry and optional overrides.\n */\nimport React, { Suspense } from \"react\";\nimport { Outlet } from \"react-router-dom\";\nimport { FlaskConical } from \"lucide-react\";\nimport type { ShellModule, NavGroup } from \"@petrarca/sonnet-shell\";\nimport type { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport type { PlaygroundModuleOptions } from \"./types\";\nimport { PlaygroundOverview } from \"./PlaygroundOverview\";\nimport { PlaygroundSettingsProvider } from \"./PlaygroundSettings\";\n\nfunction buildNavigation(\n registry: PlaygroundRegistry,\n basePath: string,\n): NavGroup[] {\n const groups = registry.getGrouped();\n const navGroups: NavGroup[] = [];\n\n navGroups.push({\n id: \"playground-overview\",\n links: [{ label: \"Overview\", path: basePath }],\n });\n\n for (const [groupLabel, entries] of groups) {\n navGroups.push({\n id: `playground-${groupLabel.toLowerCase().replace(/\\s+/g, \"-\")}`,\n heading: groupLabel,\n links: entries.map((e) => ({\n label: e.title,\n path: `${basePath}/${e.path}`,\n })),\n });\n }\n\n return navGroups;\n}\n\n// Wrap a component in Suspense for lazy loading.\nfunction suspended(Component: React.ComponentType): React.ReactElement {\n return (\n <Suspense>\n <Component />\n </Suspense>\n );\n}\n\n// Layout route element: a single PlaygroundSettingsProvider wrapping all\n// playground routes via <Outlet>. Mounted once, never torn down on navigation,\n// so settings state is stable across route changes within the playground.\nfunction PlaygroundLayout(): React.ReactElement {\n return (\n <PlaygroundSettingsProvider>\n <Outlet />\n </PlaygroundSettingsProvider>\n );\n}\n\nexport function createPlaygroundModule(\n registry: PlaygroundRegistry,\n options: PlaygroundModuleOptions = {},\n): ShellModule {\n const {\n icon = FlaskConical,\n label = \"Playground\",\n basePath = \"/playground\",\n overviewTitle = \"Developer Playground\",\n overviewSubtitle = \"Experiment with components, test features, and explore capabilities.\",\n grouped = true,\n } = options;\n\n const routeBase = basePath.replace(/^\\//, \"\");\n\n // A single layout route wraps all playground routes. The settings provider\n // lives here -- mounted once, alive for the full playground session.\n const routes = [\n {\n path: routeBase,\n element: <PlaygroundLayout />,\n children: [\n {\n index: true,\n element: suspended(() => (\n <PlaygroundOverview\n registry={registry}\n basePath={basePath}\n title={overviewTitle}\n subtitle={overviewSubtitle}\n grouped={grouped}\n />\n )),\n },\n ...registry.getAll().map((entry) => ({\n path: entry.path,\n element: suspended(entry.component),\n })),\n ],\n },\n ];\n\n return {\n id: \"playground\",\n label,\n icon,\n basePath,\n pinBottom: true,\n navigation: buildNavigation(registry, basePath),\n routes,\n };\n}\n","/**\n * PlaygroundOverview -- tile grid rendered from a PlaygroundRegistry.\n *\n * Displays cards with colored icons. Clicking a card navigates to the\n * playground page. A toggle in the header lets the user switch between\n * grouped (by category) and flat (all tiles) views.\n */\nimport React, { useState } from \"react\";\nimport { useNavigate } from \"react-router-dom\";\nimport { LayoutGrid, List } from \"lucide-react\";\nimport { Card, Button, SimpleTooltip } from \"@petrarca/sonnet-ui\";\nimport type { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport type { PlaygroundColor, PlaygroundEntry } from \"./types\";\nimport { PlaygroundSettingsPanel } from \"./PlaygroundSettingsPanel\";\n\n// Maps colour name to icon container classes (bg-*-100 text-*-600 pairing).\nconst COLOR_CLASSES: Record<PlaygroundColor, string> = {\n blue: \"bg-blue-100 text-blue-600\",\n violet: \"bg-violet-100 text-violet-600\",\n indigo: \"bg-indigo-100 text-indigo-600\",\n purple: \"bg-purple-100 text-purple-600\",\n teal: \"bg-teal-100 text-teal-600\",\n amber: \"bg-amber-100 text-amber-600\",\n emerald: \"bg-emerald-100 text-emerald-600\",\n rose: \"bg-rose-100 text-rose-600\",\n orange: \"bg-orange-100 text-orange-600\",\n cyan: \"bg-cyan-100 text-cyan-600\",\n};\n\nconst TILE_GRID = \"grid grid-cols-1 sm:grid-cols-2 2xl:grid-cols-3 gap-6\";\n\ninterface PlaygroundOverviewProps {\n registry: PlaygroundRegistry;\n basePath: string;\n title: string;\n subtitle: string;\n /** Initial grouping state. Defaults to true. User can toggle at runtime. */\n grouped?: boolean;\n}\n\ninterface TileProps {\n item: PlaygroundEntry;\n onNavigate: (path: string) => void;\n}\n\n/** A single playground tile card. */\nfunction PlaygroundTile({ item, onNavigate }: TileProps): React.ReactElement {\n return (\n <Card\n className=\"cursor-pointer shadow-sm border rounded-md p-6 transition-transform duration-200 motion-safe:hover:-translate-y-1\"\n onClick={() => onNavigate(item.path)}\n >\n <div className=\"flex items-center mb-4\">\n <div\n className={`flex items-center justify-center w-9 h-9 rounded-md ${COLOR_CLASSES[item.color] ?? COLOR_CLASSES.blue}`}\n >\n <item.icon size={18} />\n </div>\n </div>\n <h3 className=\"heading-section mb-1\">{item.title}</h3>\n <p className=\"text-sm text-muted-foreground\">{item.description}</p>\n </Card>\n );\n}\n\n/** Developer playground overview -- card grid linking to all registered pages. */\nexport function PlaygroundOverview({\n registry,\n basePath,\n title,\n subtitle,\n grouped: initialGrouped = true,\n}: PlaygroundOverviewProps): React.ReactElement {\n const navigate = useNavigate();\n const [grouped, setGrouped] = useState(initialGrouped);\n\n const handleNavigate = (path: string) => navigate(`${basePath}/${path}`);\n\n return (\n <div className=\"w-full\">\n <div className=\"flex items-start justify-between mb-6\">\n <div>\n <h1 className=\"mb-1\">{title}</h1>\n <p className=\"text-sm text-muted-foreground\">{subtitle}</p>\n </div>\n <div className=\"flex items-center gap-1\">\n <SimpleTooltip\n label={grouped ? \"Show flat list\" : \"Group by category\"}\n >\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => setGrouped((v) => !v)}\n >\n {grouped ? (\n <LayoutGrid className=\"h-4 w-4\" />\n ) : (\n <List className=\"h-4 w-4\" />\n )}\n </Button>\n </SimpleTooltip>\n <PlaygroundSettingsPanel />\n </div>\n </div>\n\n {grouped ? (\n registry.getGrouped().map(([groupLabel, entries]) => (\n <div key={groupLabel} className=\"mb-8\">\n <h2 className=\"text-sm font-medium text-muted-foreground uppercase tracking-wider mb-4\">\n {groupLabel}\n </h2>\n <div className={TILE_GRID}>\n {entries.map((item) => (\n <PlaygroundTile\n key={item.id}\n item={item}\n onNavigate={handleNavigate}\n />\n ))}\n </div>\n </div>\n ))\n ) : (\n <div className={TILE_GRID}>\n {registry.getAll().map((item) => (\n <PlaygroundTile\n key={item.id}\n item={item}\n onNavigate={handleNavigate}\n />\n ))}\n </div>\n )}\n </div>\n );\n}\n","/**\n * PlaygroundSettingsPanel -- gear button that opens a right-side settings sheet.\n *\n * Hosts playground-wide settings (currently locale). Edits flow through\n * usePlaygroundSettings, which drives the SonnetConfigProvider wrapping all\n * playground routes.\n */\n\nimport React, { useState } from \"react\";\nimport { Settings } from \"lucide-react\";\nimport {\n IconButton,\n Label,\n Sheet,\n SheetContent,\n SheetHeader,\n SheetTitle,\n SheetDescription,\n SheetBody,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n} from \"@petrarca/sonnet-ui\";\nimport { usePlaygroundSettings } from \"./PlaygroundSettings\";\n\n// Locale choices for the playground. \"__inherit__\" uses the app/browser locale.\nconst INHERIT = \"__inherit__\";\nconst LOCALE_OPTIONS = [\n { code: INHERIT, label: \"Inherit (app / browser)\" },\n { code: \"en-US\", label: \"English (US) - MM/DD, Sun\" },\n { code: \"en-GB\", label: \"English (UK) - DD/MM, Mon\" },\n { code: \"de-DE\", label: \"German - DD.MM, Mon\" },\n { code: \"fr-FR\", label: \"French - DD/MM, Mon\" },\n { code: \"sv-SE\", label: \"Swedish - YYYY-MM-DD, Mon\" },\n { code: \"ja-JP\", label: \"Japanese - YYYY/MM/DD, Sun\" },\n];\n\nexport function PlaygroundSettingsPanel(): React.ReactElement {\n const [open, setOpen] = useState(false);\n const { settings, setSettings } = usePlaygroundSettings();\n\n return (\n <Sheet open={open} onOpenChange={setOpen}>\n <IconButton label=\"Playground settings\" onClick={() => setOpen(true)}>\n <Settings />\n </IconButton>\n <SheetContent side=\"right\">\n <SheetHeader>\n <SheetTitle>Playground settings</SheetTitle>\n <SheetDescription>\n Scoped to the playground. Values exchanged with components stay\n locale-independent (ISO); only display and input parsing change.\n </SheetDescription>\n </SheetHeader>\n <SheetBody>\n <div className=\"space-y-2\">\n <Label htmlFor=\"playground-locale\">Locale</Label>\n <Select\n value={settings.locale || INHERIT}\n onValueChange={(value) =>\n setSettings({ locale: value === INHERIT ? \"\" : value })\n }\n >\n <SelectTrigger id=\"playground-locale\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {LOCALE_OPTIONS.map((opt) => (\n <SelectItem key={opt.code} value={opt.code}>\n {opt.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"text-xs text-tertiary-foreground\">\n Drives locale-sensitive components (e.g. Date Input) across every\n playground page.\n </p>\n </div>\n </SheetBody>\n </SheetContent>\n </Sheet>\n );\n}\n","/**\n * Playground-scoped settings (locale, ...).\n *\n * A self-contained provider that wraps all playground routes. It owns a small\n * settings object, persists it to a namespaced localStorage key, and renders a\n * SonnetConfigProvider so the settings flow to every playground page.\n *\n * Scope and containment: the provider is nested under any host-app provider and\n * merges onto it, so a playground override shadows the app/browser value only\n * within the playground subtree -- it never mutates the host app's global\n * config. The default is \"inherit\" (empty locale), so out of the box the\n * playground changes nothing.\n */\n\nimport React, {\n createContext,\n useCallback,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { SonnetConfigProvider } from \"@petrarca/sonnet-core/config\";\n\nconst STORAGE_KEY = \"sonnet.playground.settings\";\n\nexport interface PlaygroundSettings {\n /** BCP-47 locale override, or \"\" to inherit the app/browser locale. */\n locale: string;\n}\n\ninterface PlaygroundSettingsContextValue {\n settings: PlaygroundSettings;\n setSettings: (next: Partial<PlaygroundSettings>) => void;\n}\n\nconst DEFAULT_SETTINGS: PlaygroundSettings = { locale: \"\" };\n\nconst PlaygroundSettingsContext =\n createContext<PlaygroundSettingsContextValue | null>(null);\n\n// Safe localStorage access (guards against SSR and storage failures).\nconst storage = {\n get(key: string): string | null {\n try {\n return typeof localStorage !== \"undefined\"\n ? localStorage.getItem(key)\n : null;\n } catch {\n return null;\n }\n },\n set(key: string, value: string): void {\n try {\n if (typeof localStorage !== \"undefined\") localStorage.setItem(key, value);\n } catch {\n // Ignore quota / private-mode failures.\n }\n },\n};\n\nfunction loadSettings(): PlaygroundSettings {\n const raw = storage.get(STORAGE_KEY);\n if (!raw) return DEFAULT_SETTINGS;\n try {\n return { ...DEFAULT_SETTINGS, ...(JSON.parse(raw) as PlaygroundSettings) };\n } catch {\n return DEFAULT_SETTINGS;\n }\n}\n\nfunction persistSettings(settings: PlaygroundSettings): void {\n storage.set(STORAGE_KEY, JSON.stringify(settings));\n}\n\nexport interface PlaygroundSettingsProviderProps {\n children: React.ReactNode;\n}\n\nexport function PlaygroundSettingsProvider({\n children,\n}: PlaygroundSettingsProviderProps): React.ReactElement {\n const [settings, setSettingsState] =\n useState<PlaygroundSettings>(loadSettings);\n\n const setSettings = useCallback(\n (next: Partial<PlaygroundSettings>) =>\n setSettingsState((prev) => {\n const merged = { ...prev, ...next };\n persistSettings(merged);\n return merged;\n }),\n [],\n );\n\n const contextValue = useMemo(\n () => ({ settings, setSettings }),\n [settings, setSettings],\n );\n\n // Only override the global locale when explicitly set; \"\" inherits.\n const config = useMemo(\n () => ({ globals: { locale: settings.locale || undefined } }),\n [settings.locale],\n );\n\n return (\n <PlaygroundSettingsContext.Provider value={contextValue}>\n <SonnetConfigProvider value={config}>{children}</SonnetConfigProvider>\n </PlaygroundSettingsContext.Provider>\n );\n}\n\n/** Access playground settings. Returns defaults when no provider is present. */\nexport function usePlaygroundSettings(): PlaygroundSettingsContextValue {\n return (\n useContext(PlaygroundSettingsContext) ?? {\n settings: DEFAULT_SETTINGS,\n setSettings: () => {},\n }\n );\n}\n","/**\n * @petrarca/sonnet-playground\n *\n * Playground framework and built-in component demos for the Petrarca\n * Sonnet component library.\n *\n * Usage:\n *\n * import {\n * createPlaygroundRegistry,\n * createPlaygroundModule,\n * } from \"@petrarca/sonnet-playground\";\n *\n * const playground = createPlaygroundRegistry();\n * // Optionally register additional entries:\n * playground.register({ id: \"app.custom\", ... });\n *\n * const playgroundModule = createPlaygroundModule(playground);\n */\n\nimport { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nimport { builtinEntries } from \"./builtinEntries\";\n\n// Framework\nexport { PlaygroundRegistry } from \"./PlaygroundRegistry\";\nexport { createPlaygroundModule } from \"./createPlaygroundModule\";\nexport { PlaygroundOverview } from \"./PlaygroundOverview\";\nexport { PlaygroundSection, ExampleBlock } from \"./PlaygroundSection\";\nexport {\n PlaygroundSettingsProvider,\n usePlaygroundSettings,\n type PlaygroundSettings,\n} from \"./PlaygroundSettings\";\nexport { PlaygroundSettingsPanel } from \"./PlaygroundSettingsPanel\";\n\n// Types\nexport type {\n PlaygroundEntry,\n PlaygroundColor,\n PlaygroundModuleOptions,\n} from \"./types\";\n\n// Built-in entries (for selective use or extending)\nexport { builtinEntries } from \"./builtinEntries\";\n\n/**\n * Convenience factory: creates a new PlaygroundRegistry pre-populated\n * with all built-in sonnet component demos.\n */\nexport function createPlaygroundRegistry(): PlaygroundRegistry {\n const registry = new PlaygroundRegistry();\n registry.registerAll(builtinEntries);\n return registry;\n}\n"],"mappings":";;;;;;AAQA,SAAS,eAAe;AAGjB,IAAM,qBAAN,MAAM,oBAAmB;AAAA,EACtB,UAAwC,oBAAI,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAchD,gBAAgB,OAA8B;AACpD,eAAW,YAAY,KAAK,QAAQ,OAAO,GAAG;AAC5C,UAAI,SAAS,OAAO,MAAM,GAAI;AAE9B,UAAI,SAAS,SAAS,MAAM,MAAM;AAChC;AAAA,UACE,iCAAiC,SAAS,EAAE,UAAU,MAAM,EAAE,qBAAqB,MAAM,IAAI;AAAA,QAC/F;AAAA,MACF;AAEA,YAAM,QAAQ,MAAM,SAAS,oBAAmB;AAChD,YAAM,gBAAgB,SAAS,SAAS,oBAAmB;AAC3D,UACE,UAAU,iBACV,MAAM,YAAY,MAAM,cAAc,YAAY,GAClD;AACA;AAAA,UACE,+BAA+B,KAAK,mBAAmB,aAAa;AAAA,QACtE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA;AAAA,EAGA,SAAS,OAA8B;AACrC,SAAK,gBAAgB,KAAK;AAC1B,SAAK,QAAQ,IAAI,MAAM,IAAI,KAAK;AAAA,EAClC;AAAA;AAAA,EAGA,YAAY,SAAkC;AAC5C,eAAW,SAAS,SAAS;AAC3B,WAAK,SAAS,KAAK;AAAA,IACrB;AAAA,EACF;AAAA;AAAA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A,SAAO;AAAA,IACL,IAAI;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,YAAY,gBAAgB,UAAU,QAAQ;AAAA,IAC9C;AAAA,EACF;AACF;;;AIhEO,SAAS,2BAA+C;AAC7D,QAAM,WAAW,IAAI,mBAAmB;AACxC,WAAS,YAAY,cAAc;AACnC,SAAO;AACT;","names":["useState","useState","jsx","useState","jsx","jsxs","useState","jsx"]}
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -89,4 +89,6 @@ declare function PlayGraph(): React.ReactElement;
|
|
|
89
89
|
*/
|
|
90
90
|
declare function PlayShellApi(): react_jsx_runtime.JSX.Element;
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
declare function PlayAuth(): react_jsx_runtime.JSX.Element;
|
|
93
|
+
|
|
94
|
+
export { PlayAdvancedComponents, PlayAuth, PlayColorPalette, PlayCoreComponents, PlayDataComponents, PlayFormComponents, PlayFormWidgets, PlayForms, PlayGraph, PlayJsonEditor, PlaySchemaDesigner, PlayShellApi, PlayTypography };
|
package/dist/pages/index.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PlayForms
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-I2FLG6ZD.js";
|
|
4
4
|
import {
|
|
5
5
|
PlayFormWidgets
|
|
6
6
|
} from "../chunk-UB7462QG.js";
|
|
7
7
|
import {
|
|
8
8
|
PlaySchemaDesigner
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-2XMWOZ5O.js";
|
|
10
10
|
import {
|
|
11
11
|
PlayDataComponents
|
|
12
12
|
} from "../chunk-O2QMWJZI.js";
|
|
13
13
|
import {
|
|
14
14
|
PlayGraph
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-E5X7GVLU.js";
|
|
16
16
|
import {
|
|
17
17
|
PlayShellApi
|
|
18
18
|
} from "../chunk-CQ6PGFRV.js";
|
|
19
|
+
import {
|
|
20
|
+
PlayAuth
|
|
21
|
+
} from "../chunk-RYCRENYO.js";
|
|
19
22
|
import {
|
|
20
23
|
PlayTypography
|
|
21
24
|
} from "../chunk-7IBZEHLI.js";
|
|
@@ -37,6 +40,7 @@ import {
|
|
|
37
40
|
import "../chunk-C2EZ2ECG.js";
|
|
38
41
|
export {
|
|
39
42
|
PlayAdvancedComponents,
|
|
43
|
+
PlayAuth,
|
|
40
44
|
PlayColorPalette,
|
|
41
45
|
PlayCoreComponents,
|
|
42
46
|
PlayDataComponents,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@petrarca/sonnet-playground",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Playground framework and built-in component demos for the Petrarca Sonnet component library",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"lucide-react": "^0.553.0",
|
|
27
27
|
"sonner": "^2.0.7",
|
|
28
28
|
"zod": "^4.3.6",
|
|
29
|
-
"@petrarca/sonnet-
|
|
30
|
-
"@petrarca/sonnet-
|
|
31
|
-
"@petrarca/sonnet-forms": "0.
|
|
32
|
-
"@petrarca/sonnet-
|
|
33
|
-
"@petrarca/sonnet-graph": "0.
|
|
34
|
-
"@petrarca/sonnet-schema-designer": "0.
|
|
29
|
+
"@petrarca/sonnet-core": "0.7.0",
|
|
30
|
+
"@petrarca/sonnet-ui": "0.7.0",
|
|
31
|
+
"@petrarca/sonnet-forms": "0.7.0",
|
|
32
|
+
"@petrarca/sonnet-shell": "0.7.0",
|
|
33
|
+
"@petrarca/sonnet-graph": "0.7.0",
|
|
34
|
+
"@petrarca/sonnet-schema-designer": "0.7.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": ">=19",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pages/PlaySchemaDesigner.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport {\n SchemaDesigner,\n type SchemaDesignerCapabilities,\n} from \"@petrarca/sonnet-schema-designer\";\nimport { FormSelect } from \"@petrarca/sonnet-forms\";\nimport type { JsonSchema, UISchema } from \"@petrarca/sonnet-core/schema\";\n\nconst SAMPLE_SCHEMA: JsonSchema = {\n title: \"Patient\",\n type: \"object\",\n properties: {\n first_name: { type: \"string\", title: \"First name\", minLength: 1 },\n last_name: { type: \"string\", title: \"Last name\", minLength: 1 },\n date_of_birth: { type: \"string\", format: \"date\", title: \"Date of birth\" },\n gender: {\n type: \"string\",\n title: \"Gender\",\n enum: [\"male\", \"female\", \"other\", \"unknown\"],\n },\n active: { type: \"boolean\", title: \"Active\" },\n contact: {\n type: \"object\",\n title: \"Contact\",\n properties: {\n email: { type: \"string\", format: \"email\", title: \"Email\" },\n phone: { type: \"string\", title: \"Phone\" },\n },\n required: [\"email\"],\n },\n addresses: {\n type: \"array\",\n title: \"Addresses\",\n minItems: 1,\n maxItems: 3,\n items: {\n type: \"object\",\n properties: {\n street: { type: \"string\", title: \"Street\" },\n city: { type: \"string\", title: \"City\" },\n zip: { type: \"string\", title: \"ZIP\" },\n country: { type: \"string\", title: \"Country\" },\n },\n required: [\"street\", \"city\"],\n },\n },\n },\n required: [\"first_name\", \"last_name\"],\n};\n\n// An audit-event-like schema: a fixed envelope (actor, targets) with three\n// extensible metadata containers. Used to demo scoped editing.\nconst AUDIT_SCHEMA: JsonSchema = {\n title: \"AuditEvent\",\n type: \"object\",\n properties: {\n actor: {\n type: \"object\",\n title: \"Actor\",\n properties: {\n type: { type: \"string\", title: \"Type\" },\n id: { type: \"string\", title: \"ID\" },\n metadata: {\n type: \"object\",\n title: \"Actor metadata\",\n properties: { role: { type: \"string\", title: \"Role\" } },\n },\n },\n },\n targets: {\n type: \"array\",\n title: \"Targets\",\n items: {\n type: \"object\",\n properties: {\n type: { type: \"string\", title: \"Type\" },\n id: { type: \"string\", title: \"ID\" },\n metadata: {\n type: \"object\",\n title: \"Target metadata\",\n properties: { ward: { type: \"string\", title: \"Ward\" } },\n },\n },\n },\n },\n metadata: {\n type: \"object\",\n title: \"Metadata\",\n properties: { reason: { type: \"string\", title: \"Reason\" } },\n },\n },\n};\n\n// A schema exercising every logic construct the designer can author: a oneOf\n// discriminated variant (payment method), if/then/else conditionals (authored\n// as allOf members), a const-tagged field, and a nullable anyOf optional field.\n// x-ui-order places each conditional field right after the property it depends\n// on (see docs/design/schema-designer-logic-authoring.md, ordering note).\nconst LOGIC_SCHEMA: JsonSchema = {\n title: \"Checkout\",\n type: \"object\",\n // A reusable definition referenced by $ref (shows read-only expansion).\n $defs: {\n Address: {\n type: \"object\",\n properties: {\n street: { type: \"string\", title: \"Street\" },\n city: { type: \"string\", title: \"City\" },\n zip: { type: \"string\", title: \"ZIP\" },\n },\n },\n },\n \"x-ui-order\": [\n \"schema_version\",\n \"amount\",\n \"requires_approval\",\n \"currency\",\n \"expedited\",\n \"delivery_window\",\n \"gift_wrap\",\n \"gift_message\",\n \"shipping_address\",\n \"note\",\n \"payment\",\n ],\n properties: {\n // A $ref to the shared Address definition (read-only in the tree).\n shipping_address: { $ref: \"#/$defs/Address\", title: \"Shipping address\" },\n // A fixed value carried by every document (const authoring).\n schema_version: {\n type: \"string\",\n title: \"Schema version\",\n const: \"checkout/v1\",\n },\n amount: { type: \"number\", title: \"Amount\", minimum: 0 },\n currency: {\n type: \"string\",\n title: \"Currency\",\n enum: [\"EUR\", \"USD\", \"GBP\"],\n },\n expedited: { type: \"boolean\", title: \"Expedited\" },\n gift_wrap: { type: \"boolean\", title: \"Gift wrap\" },\n // Declarative visibility rule (x-ui-rule): declared at its own position,\n // shown only when gift_wrap is checked. Contrast with the if/then/else\n // fields above, which are structurally added by their conditionals.\n gift_message: {\n type: \"string\",\n title: \"Gift message\",\n \"x-ui-rule\": {\n effect: \"show\",\n condition: { scope: \"/gift_wrap\", schema: { const: true } },\n },\n },\n // Nullable optional (anyOf [T, null]) -- the renderer unwraps to T.\n note: {\n title: \"Note (optional)\",\n anyOf: [{ type: \"string\" }, { type: \"null\" }],\n },\n // A discriminated union (oneOf): the payment method.\n payment: {\n type: \"object\",\n title: \"Payment method\",\n discriminator: { propertyName: \"kind\" },\n oneOf: [\n {\n title: \"Card\",\n properties: {\n kind: { const: \"card\" },\n card_number: { type: \"string\", title: \"Card number\" },\n cvc: { type: \"string\", title: \"CVC\" },\n },\n },\n {\n title: \"Bank transfer\",\n properties: {\n kind: { const: \"bank\" },\n iban: { type: \"string\", title: \"IBAN\" },\n },\n },\n {\n title: \"Cash\",\n properties: { kind: { const: \"cash\" } },\n },\n ],\n },\n },\n required: [\"amount\", \"currency\"],\n // Conditionals (if/then/else) authored as allOf members.\n allOf: [\n {\n // Large amounts require an approval reference.\n if: {\n properties: { amount: { exclusiveMinimum: 1000 } },\n required: [\"amount\"],\n },\n then: {\n properties: {\n requires_approval: {\n type: \"string\",\n title: \"Approval reference\",\n },\n },\n required: [\"requires_approval\"],\n },\n },\n {\n // Expedited orders ask for a delivery window; otherwise none.\n if: {\n properties: { expedited: { const: true } },\n required: [\"expedited\"],\n },\n then: {\n properties: {\n delivery_window: {\n type: \"string\",\n title: \"Delivery window\",\n enum: [\"morning\", \"afternoon\", \"evening\"],\n },\n },\n },\n },\n ],\n};\n\nconst AUDIT_EDITABLE_PATHS = [\n \"/properties/metadata/properties\",\n \"/properties/actor/properties/metadata/properties\",\n \"/properties/targets/items/properties/metadata/properties\",\n];\n\ntype ProfileKey = \"full\" | \"data\" | \"scoped\" | \"structure\" | \"logic\";\n\ninterface Profile {\n label: string;\n description: string;\n schema: JsonSchema;\n capabilities?: SchemaDesignerCapabilities;\n readOnly?: boolean;\n}\n\nconst PROFILES: Record<ProfileKey, Profile> = {\n full: {\n label: \"Full (schema + uiSchema)\",\n description: \"Default: author the schema and its form presentation hints.\",\n schema: SAMPLE_SCHEMA,\n capabilities: { previews: [\"form\", \"table\", \"json\", \"capabilities\"] },\n },\n data: {\n label: \"Data schema only\",\n description:\n \"Pure JSON Schema (audit, terminology): no UI/Combined tabs, JSON preview only.\",\n schema: SAMPLE_SCHEMA,\n capabilities: { mode: \"data\", previews: [\"json\", \"capabilities\"] },\n },\n scoped: {\n label: \"Scoped (audit event)\",\n description:\n \"Fixed envelope; only the three metadata containers are editable.\",\n schema: AUDIT_SCHEMA,\n capabilities: {\n mode: \"data\",\n editablePaths: AUDIT_EDITABLE_PATHS,\n previews: [\"json\", \"capabilities\"],\n },\n },\n structure: {\n label: \"Structure only (no preview)\",\n description: \"Tree + inspector only; the center preview pane is hidden.\",\n schema: SAMPLE_SCHEMA,\n capabilities: { mode: \"data\", previews: [] },\n },\n logic: {\n label: \"Logic (variants + conditionals)\",\n description:\n \"Shows every logic construct: a oneOf variant, if/then/else conditionals, a const field, and a nullable optional.\",\n schema: LOGIC_SCHEMA,\n capabilities: { previews: [\"form\", \"table\", \"json\", \"capabilities\"] },\n },\n};\n\n/**\n * PlaySchemaDesigner -- exercises SchemaDesigner: visually author a JsonSchema\n * (and its uiSchema presentation hints), with a live preview. The profile\n * switcher presets the capability profile (data/full triage, scoped editing,\n * read-only); the in-designer Capabilities tab tweaks it live.\n */\nexport default function PlaySchemaDesigner() {\n const [profileKey, setProfileKey] = useState<ProfileKey>(\"full\");\n const profile = PROFILES[profileKey];\n\n const [schema, setSchema] = useState<JsonSchema>(profile.schema);\n const [uiSchema, setUiSchema] = useState<Record<string, UISchema>>({});\n\n const selectProfile = (key: ProfileKey) => {\n setProfileKey(key);\n setSchema(PROFILES[key].schema);\n setUiSchema({});\n };\n\n return (\n <div className=\"w-full flex flex-col gap-3 h-[calc(100vh-8rem)]\">\n <div>\n <h1>Schema Designer</h1>\n <p className=\"text-sm text-muted-foreground mb-3\">\n Visually author a JSON Schema and its UI presentation hints. Edits\n flow through onChange as a valid schema + uiSchema.\n </p>\n </div>\n\n <div className=\"flex items-center gap-3\">\n <label\n htmlFor=\"capability-profile\"\n className=\"shrink-0 text-sm font-medium\"\n >\n Capability profile\n </label>\n <div className=\"w-72\">\n <FormSelect\n id=\"capability-profile\"\n name=\"profile\"\n value={profileKey}\n options={(Object.keys(PROFILES) as ProfileKey[]).map((k) => ({\n value: k,\n label: PROFILES[k].label,\n }))}\n onChange={(v) => selectProfile((v as ProfileKey) ?? \"full\")}\n clearable={false}\n />\n </div>\n <p className=\"text-sm text-muted-foreground\">{profile.description}</p>\n </div>\n\n <div style={{ flex: 1, minHeight: 0 }}>\n <SchemaDesigner\n key={profileKey}\n schema={schema}\n uiSchema={uiSchema}\n capabilities={profile.capabilities}\n readOnly={profile.readOnly}\n onChange={(nextSchema, nextUiSchema) => {\n setSchema(nextSchema);\n setUiSchema(nextUiSchema);\n }}\n />\n </div>\n </div>\n );\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB;AAAA,EACE;AAAA,OAEK;AACP,SAAS,kBAAkB;AAwSrB,SACE,KADF;AArSN,IAAM,gBAA4B;AAAA,EAChC,OAAO;AAAA,EACP,MAAM;AAAA,EACN,YAAY;AAAA,IACV,YAAY,EAAE,MAAM,UAAU,OAAO,cAAc,WAAW,EAAE;AAAA,IAChE,WAAW,EAAE,MAAM,UAAU,OAAO,aAAa,WAAW,EAAE;AAAA,IAC9D,eAAe,EAAE,MAAM,UAAU,QAAQ,QAAQ,OAAO,gBAAgB;AAAA,IACxE,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,MAAM,CAAC,QAAQ,UAAU,SAAS,SAAS;AAAA,IAC7C;AAAA,IACA,QAAQ,EAAE,MAAM,WAAW,OAAO,SAAS;AAAA,IAC3C,SAAS;AAAA,MACP,MAAM;AAAA,MACN,OAAO;AAAA,MACP,YAAY;AAAA,QACV,OAAO,EAAE,MAAM,UAAU,QAAQ,SAAS,OAAO,QAAQ;AAAA,QACzD,OAAO,EAAE,MAAM,UAAU,OAAO,QAAQ;AAAA,MAC1C;AAAA,MACA,UAAU,CAAC,OAAO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C,kBAAc,GAAG;AACjB,cAAU,SAAS,GAAG,EAAE,MAAM;AAC9B,gBAAY,CAAC,CAAC;AAAA,EAChB;AAEA,SACE,qBAAC,SAAI,WAAU,mDACb;AAAA,yBAAC,SACC;AAAA,0BAAC,QAAG,6BAAe;AAAA,MACnB,oBAAC,OAAE,WAAU,sCAAqC,oIAGlD;AAAA,OACF;AAAA,IAEA,qBAAC,SAAI,WAAU,2BACb;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,WAAU;AAAA,UACX;AAAA;AAAA,MAED;AAAA,MACA,oBAAC,SAAI,WAAU,QACb;AAAA,QAAC;AAAA;AAAA,UACC,IAAG;AAAA,UACH,MAAK;AAAA,UACL,OAAO;AAAA,UACP,SAAU,OAAO,KAAK,QAAQ,EAAmB,IAAI,CAAC,OAAO;AAAA,YAC3D,OAAO;AAAA,YACP,OAAO,SAAS,CAAC,EAAE;AAAA,UACrB,EAAE;AAAA,UACF,UAAU,CAAC,MAAM,cAAe,KAAoB,MAAM;AAAA,UAC1D,WAAW;AAAA;AAAA,MACb,GACF;AAAA,MACA,oBAAC,OAAE,WAAU,iCAAiC,kBAAQ,aAAY;AAAA,OACpE;AAAA,IAEA,oBAAC,SAAI,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE,GAClC;AAAA,MAAC;AAAA;AAAA,QAEC;AAAA,QACA;AAAA,QACA,cAAc,QAAQ;AAAA,QACtB,UAAU,QAAQ;AAAA,QAClB,UAAU,CAAC,YAAY,iBAAiB;AACtC,oBAAU,UAAU;AACpB,sBAAY,YAAY;AAAA,QAC1B;AAAA;AAAA,MARK;AAAA,IASP,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/pages/PlayGraph.tsx","../src/pages/graph/inMemoryGraphEditing.ts","../src/pages/graph/relationWidget.tsx"],"sourcesContent":["/**\n * Playground page for @petrarca/sonnet-graph.\n * Accessible at /playground/graph\n *\n * Demonstrates graph visualization with static mock data -- no backend required.\n * Uses the GraphStoresContext provider pattern that consumers like explorer\n * and any consumer app would use to wire their own stores.\n */\n\nimport React, { useCallback, useMemo, useRef, useState } from \"react\";\nimport {\n GraphVisualizer,\n ActionPanel,\n GraphA11yList,\n GraphRendererProvider,\n GraphStoresContext,\n GraphEditToolbar,\n createGraphDataStore,\n createGraphFilterStore,\n createGraphExplorationStore,\n createSelectionStore,\n createGraphFocusStore,\n enrichNodes,\n enrichEdges,\n buildColorPalette,\n GraphModelEditor,\n type GraphModel,\n type GraphModelCapabilities,\n type GraphCapabilities,\n type RawGraphNode,\n type RawGraphEdge,\n type WorkspaceStores,\n} from \"@petrarca/sonnet-graph\";\nimport { DEFAULT_WIDGETS, type WidgetRegistry } from \"@petrarca/sonnet-forms\";\nimport {\n createInMemoryPort,\n createModelSchemaProvider,\n type GraphStore,\n} from \"./graph/inMemoryGraphEditing\";\nimport { createRelationWidget } from \"./graph/relationWidget\";\nimport {\n Button,\n Alert,\n AlertDescription,\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n ResizeHandle,\n} from \"@petrarca/sonnet-ui\";\nimport { FormSelect } from \"@petrarca/sonnet-forms\";\nimport { Play, RotateCcw } from \"lucide-react\";\n\n// ---------------------------------------------------------------------------\n// Technology Stack dataset (fictitious) -- a Product at the centre, broken\n// into Components, the Technologies they use, and external Dependencies.\n// Domain inspired by the lauro tech-stack/knowledge graph.\n// ---------------------------------------------------------------------------\n\nconst TECH_NODES: RawGraphNode[] = [\n {\n id_: 1,\n label_: \"Product\",\n properties_: { key: \"product-a\", name: \"Product A\" },\n },\n {\n id_: 2,\n label_: \"Product\",\n properties_: { key: \"product-b\", name: \"Product B\" },\n },\n {\n id_: 3,\n label_: \"TechnologyStack\",\n properties_: { key: \"product-a-stack\", name: \"Product A stack\" },\n },\n {\n id_: 4,\n label_: \"TechnologyStack\",\n properties_: { key: \"product-b-stack\", name: \"Product B stack\" },\n },\n {\n id_: 5,\n label_: \"Technology\",\n properties_: { key: \"react\", name: \"React\" },\n },\n {\n id_: 6,\n label_: \"Technology\",\n properties_: { key: \"postgresql\", name: \"PostgreSQL\" },\n },\n {\n id_: 7,\n label_: \"Technology\",\n properties_: { key: \"kafka\", name: \"Kafka\" },\n },\n {\n id_: 8,\n label_: \"Technology\",\n properties_: { key: \"go\", name: \"Go\" },\n },\n {\n id_: 9,\n label_: \"TechnologyCategory\",\n properties_: { key: \"frontend-framework\", name: \"Frontend Framework\" },\n },\n {\n id_: 10,\n label_: \"TechnologyCategory\",\n properties_: { key: \"database\", name: \"Database\" },\n },\n {\n id_: 11,\n label_: \"TechnologyCategory\",\n properties_: { key: \"messaging\", name: \"Messaging\" },\n },\n {\n id_: 12,\n label_: \"TechnologyCategory\",\n properties_: { key: \"language\", name: \"Language\" },\n },\n];\n\nconst TECH_EDGES: RawGraphEdge[] = [\n // Two products, each with its own stack; both stacks share PostgreSQL.\n {\n id_: 101,\n label_: \"HAS_TECH_STACK\",\n start_id_: 1,\n end_id_: 3,\n properties_: {},\n },\n {\n id_: 102,\n label_: \"HAS_TECH_STACK\",\n start_id_: 2,\n end_id_: 4,\n properties_: {},\n },\n {\n id_: 103,\n label_: \"INTEGRATES_WITH\",\n start_id_: 1,\n end_id_: 2,\n properties_: {},\n },\n // Product A stack: React, PostgreSQL, Kafka.\n {\n id_: 104,\n label_: \"USES_TECHNOLOGY\",\n start_id_: 3,\n end_id_: 5,\n properties_: {},\n },\n {\n id_: 105,\n label_: \"USES_TECHNOLOGY\",\n start_id_: 3,\n end_id_: 6,\n properties_: {},\n },\n {\n id_: 106,\n label_: \"USES_TECHNOLOGY\",\n start_id_: 3,\n end_id_: 7,\n properties_: {},\n },\n // Product B stack: Go + the shared PostgreSQL.\n {\n id_: 107,\n label_: \"USES_TECHNOLOGY\",\n start_id_: 4,\n end_id_: 6,\n properties_: {},\n },\n {\n id_: 108,\n label_: \"USES_TECHNOLOGY\",\n start_id_: 4,\n end_id_: 8,\n properties_: {},\n },\n // Technology -> category.\n { id_: 109, label_: \"BELONGS_TO\", start_id_: 5, end_id_: 9, properties_: {} },\n {\n id_: 110,\n label_: \"BELONGS_TO\",\n start_id_: 6,\n end_id_: 10,\n properties_: {},\n },\n {\n id_: 111,\n label_: \"BELONGS_TO\",\n start_id_: 7,\n end_id_: 11,\n properties_: {},\n },\n {\n id_: 112,\n label_: \"BELONGS_TO\",\n start_id_: 8,\n end_id_: 12,\n properties_: {},\n },\n];\n\n// ---------------------------------------------------------------------------\n// Store setup\n//\n// Stores are created once at module load, not inside the component.\n// This avoids re-creation on re-render and removes the need for useMemo.\n// ---------------------------------------------------------------------------\n\nfunction createPlaygroundStores(): WorkspaceStores {\n const graphFilter = createGraphFilterStore();\n const graphData = createGraphDataStore();\n const selection = createSelectionStore();\n const graphFocus = createGraphFocusStore();\n const graphExploration = createGraphExplorationStore({\n graphData,\n selection,\n graphFocus,\n graphFilter,\n // Static data -- no server expansion available in the playground\n expandNode: async () => ({ nodes: [], edges: [], has_more: false }),\n getNodes: async () => [],\n });\n return { graphFilter, graphData, graphExploration, selection };\n}\n\nconst PLAYGROUND_STORES = createPlaygroundStores();\n\n// ---------------------------------------------------------------------------\n// Data helpers\n// ---------------------------------------------------------------------------\n\ninterface GraphInput {\n nodes: RawGraphNode[];\n edges: RawGraphEdge[];\n}\n\nconst EMPTY_DATA: GraphInput = { nodes: [], edges: [] };\n\nfunction serializeGraphData(data: GraphInput): string {\n return JSON.stringify(data, null, 2);\n}\n\nfunction validateNode(n: unknown, i: number): string | null {\n if (!n || typeof n !== \"object\") return `nodes[${i}] must be an object`;\n const node = n as Record<string, unknown>;\n if (node.id_ === undefined) return `nodes[${i}] is missing id_`;\n if (typeof node.label_ !== \"string\") return `nodes[${i}] is missing label_`;\n return null;\n}\n\nfunction validateEdge(e: unknown, i: number): string | null {\n if (!e || typeof e !== \"object\") return `edges[${i}] must be an object`;\n const edge = e as Record<string, unknown>;\n if (edge.id_ === undefined) return `edges[${i}] is missing id_`;\n if (typeof edge.label_ !== \"string\") return `edges[${i}] is missing label_`;\n if (edge.start_id_ === undefined) return `edges[${i}] is missing start_id_`;\n if (edge.end_id_ === undefined) return `edges[${i}] is missing end_id_`;\n return null;\n}\n\n/** Validates that parsed JSON is a usable GraphInput. Returns an error string or null. */\nfunction validateGraphInput(value: unknown): string | null {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"JSON must be an object with nodes and edges arrays\";\n }\n const obj = value as Record<string, unknown>;\n if (!Array.isArray(obj.nodes)) return '\"nodes\" must be an array';\n if (!Array.isArray(obj.edges)) return '\"edges\" must be an array';\n for (const [i, n] of (obj.nodes as unknown[]).entries()) {\n const err = validateNode(n, i);\n if (err) return err;\n }\n for (const [i, e] of (obj.edges as unknown[]).entries()) {\n const err = validateEdge(e, i);\n if (err) return err;\n }\n return null;\n}\n\nfunction loadIntoStore(stores: WorkspaceStores, data: GraphInput) {\n const labelCounts: Record<string, number> = {};\n for (const n of data.nodes) {\n labelCounts[n.label_] = (labelCounts[n.label_] ?? 0) + 1;\n }\n const palette = buildColorPalette(labelCounts);\n const nodes = enrichNodes(data.nodes, palette);\n const edges = enrichEdges(data.edges, palette);\n stores.graphFilter.getState().resetFilters();\n stores.graphData.getState().setQueryData(nodes, edges, {\n nodes: nodes.length,\n edges: edges.length,\n });\n // Signal renderers to re-fit layout after data change\n stores.graphFilter.getState().notifyDataChange();\n}\n\n// The mutable in-memory dataset the instance-editing port operates on. It is\n// the single source of truth shared by the Data JSON tab and the live editor;\n// after each edit it is re-enriched into the graph data store (the consumer's\n// cache-patch analog). Initialised to the default dataset's data below.\nconst LIVE_STORE: GraphStore = { nodes: [], edges: [] };\n\n// Replace LIVE_STORE's contents and load them into the visual store.\nfunction setLiveData(stores: WorkspaceStores, data: GraphInput): void {\n LIVE_STORE.nodes = data.nodes.map((n) => ({ ...n }));\n LIVE_STORE.edges = data.edges.map((e) => ({ ...e }));\n loadIntoStore(stores, LIVE_STORE);\n}\n\n// Load the default dataset's data immediately -- no effect needed, no empty\n// render cycle. (The dataset bundle is defined below; its data lives here.)\nsetLiveData(PLAYGROUND_STORES, { nodes: TECH_NODES, edges: TECH_EDGES });\n\n// ---------------------------------------------------------------------------\n// Model tab -- GraphModelEditor over the metamodel of the Graph/Data tabs\n// ---------------------------------------------------------------------------\n\n// A faithful subset of the apex-graph tech-stack domain model: Product at the\n// centre, with TechnologyStack, Technology and TechnologyCategory node types\n// and the real relation types between them (HAS_TECH_STACK, INTEGRATES_WITH,\n// USES_TECHNOLOGY, BELONGS_TO). PROVIDES_STACK_FOR is a second, fictitious\n// Product -> TechnologyStack relation so a single node-type pair has two\n// distinct relation types (exercises the edge editor's multi-relation create).\n// The Model tab is the schema; the Graph / Data tabs are instances conforming\n// to it.\nconst TECH_MODEL: GraphModel = [\n {\n title: \"Product\",\n type: \"object\",\n properties: { key: { type: \"string\" }, name: { type: \"string\" } },\n required: [\"key\", \"name\"],\n \"x-graph\": {\n type: \"NODE\",\n label: \"Product\",\n relations: [\n {\n rel_type_name: \"HAS_TECH_STACK\",\n to_type_name: \"TechnologyStack\",\n cardinality: \"ONE_TO_ONE\",\n form_field: true,\n },\n {\n // Fictitious second Product -> TechnologyStack relation: a product\n // may also provision a stack it does not own (one-to-many).\n rel_type_name: \"PROVIDES_STACK_FOR\",\n to_type_name: \"TechnologyStack\",\n cardinality: \"ONE_TO_MANY\",\n form_field: true,\n },\n {\n rel_type_name: \"INTEGRATES_WITH\",\n to_type_name: \"Product\",\n cardinality: \"ONE_TO_MANY\",\n form_field: true,\n },\n ],\n },\n },\n {\n title: \"TechnologyStack\",\n type: \"object\",\n properties: { key: { type: \"string\" }, name: { type: \"string\" } },\n \"x-graph\": {\n type: \"NODE\",\n label: \"TechnologyStack\",\n relations: [\n {\n rel_type_name: \"USES_TECHNOLOGY\",\n to_type_name: \"Technology\",\n cardinality: \"ONE_TO_MANY\",\n form_field: true,\n },\n ],\n },\n },\n {\n title: \"Technology\",\n type: \"object\",\n properties: { key: { type: \"string\" }, name: { type: \"string\" } },\n required: [\"key\", \"name\"],\n \"x-graph\": {\n type: \"NODE\",\n label: \"Technology\",\n relations: [\n {\n rel_type_name: \"BELONGS_TO\",\n to_type_name: \"TechnologyCategory\",\n cardinality: \"ONE_TO_ONE\",\n form_field: true,\n },\n ],\n },\n },\n {\n title: \"TechnologyCategory\",\n type: \"object\",\n properties: { key: { type: \"string\" }, name: { type: \"string\" } },\n required: [\"key\", \"name\"],\n \"x-graph\": { type: \"NODE\", label: \"TechnologyCategory\" },\n },\n];\n\n// The Organization metamodel -- a subset of the Sestina organization model\n// (see sestina web/docs/design/organization-graph.md). Node-type labels are\n// the organization types (Network, Hospital, Department, Practice). Relations\n// are directional triples: `partOf` is containment (child -> parent, FHIR\n// Organization.partOf); `affiliation` is a non-hierarchical link (FHIR\n// OrganizationAffiliation). Directionality encodes the rules (a Department is\n// partOf a Hospital, not the reverse). Paired with a locked-down profile (see\n// the dataset below): edgeTypes \"catalog\" (a fixed relation-type vocabulary,\n// no new edge types) and no property editing.\nconst ORG_MODEL: GraphModel = [\n {\n title: \"Network\",\n type: \"object\",\n \"x-graph\": { type: \"NODE\", label: \"Network\" },\n },\n {\n title: \"Hospital\",\n type: \"object\",\n \"x-graph\": {\n type: \"NODE\",\n label: \"Hospital\",\n relations: [\n {\n rel_type_name: \"partOf\",\n to_type_name: \"Network\",\n cardinality: \"ONE_TO_ONE\",\n },\n ],\n },\n },\n {\n title: \"Department\",\n type: \"object\",\n \"x-graph\": {\n type: \"NODE\",\n label: \"Department\",\n relations: [\n {\n rel_type_name: \"partOf\",\n to_type_name: \"Hospital\",\n cardinality: \"ONE_TO_ONE\",\n },\n ],\n },\n },\n {\n title: \"Practice\",\n type: \"object\",\n \"x-graph\": {\n type: \"NODE\",\n label: \"Practice\",\n relations: [\n {\n rel_type_name: \"partOf\",\n to_type_name: \"Network\",\n cardinality: \"ONE_TO_ONE\",\n },\n {\n rel_type_name: \"affiliation\",\n to_type_name: \"Hospital\",\n cardinality: \"ONE_TO_MANY\",\n },\n ],\n },\n },\n // Pre-defined relation-type catalog. With edgeTypes \"catalog\", relations may\n // only use these types; no new edge types can be created.\n {\n title: \"partOf\",\n type: \"object\",\n \"x-graph\": { type: \"EDGE\", label: \"partOf\" },\n },\n {\n title: \"affiliation\",\n type: \"object\",\n \"x-graph\": { type: \"EDGE\", label: \"affiliation\" },\n },\n];\n\nconst ORG_NODES: RawGraphNode[] = [\n {\n id_: 1,\n label_: \"Network\",\n properties_: { name: \"Northwind Care Network\" },\n },\n { id_: 2, label_: \"Hospital\", properties_: { name: \"Riverside General\" } },\n { id_: 3, label_: \"Hospital\", properties_: { name: \"Lakeside Clinic\" } },\n { id_: 4, label_: \"Department\", properties_: { name: \"Cardiology\" } },\n { id_: 5, label_: \"Department\", properties_: { name: \"Radiology\" } },\n { id_: 6, label_: \"Practice\", properties_: { name: \"Maple Street GP\" } },\n];\n\nconst ORG_EDGES: RawGraphEdge[] = [\n // partOf: child -> parent (containment).\n { id_: 201, label_: \"partOf\", start_id_: 2, end_id_: 1, properties_: {} },\n { id_: 202, label_: \"partOf\", start_id_: 3, end_id_: 1, properties_: {} },\n { id_: 203, label_: \"partOf\", start_id_: 4, end_id_: 2, properties_: {} },\n { id_: 204, label_: \"partOf\", start_id_: 5, end_id_: 2, properties_: {} },\n // affiliation: a practice affiliated with a hospital (non-hierarchical).\n {\n id_: 205,\n label_: \"affiliation\",\n start_id_: 6,\n end_id_: 2,\n properties_: {},\n },\n];\n\n// ---------------------------------------------------------------------------\n// Datasets -- each bundles { graph data + model + capability profile }. The\n// selector above the tabs swaps all three at once.\n// ---------------------------------------------------------------------------\n\n// The Model Editor's { readOnly, capabilities } config, edited as JSON on the\n// Capabilities tab and applied to the GraphModelEditor.\ninterface CapabilitiesConfig {\n readOnly: boolean;\n capabilities: GraphModelCapabilities;\n}\n\ninterface GraphDataset {\n label: string;\n data: GraphInput;\n model: GraphModel;\n capabilities: CapabilitiesConfig;\n /** Instance-editing capabilities for the live data graph (the Graph tab). */\n editCapabilities: GraphCapabilities;\n}\n\nconst DATASETS: Record<string, GraphDataset> = {\n empty: {\n label: \"Empty\",\n data: EMPTY_DATA,\n model: [],\n capabilities: { readOnly: false, capabilities: {} },\n // No model to drive forms, so editing stays off.\n editCapabilities: {},\n },\n techStack: {\n label: \"Technology Stack\",\n data: { nodes: TECH_NODES, edges: TECH_EDGES },\n model: TECH_MODEL,\n capabilities: { readOnly: false, capabilities: {} },\n // Full instance editing: create / edit / delete nodes and edges.\n editCapabilities: {\n createNode: \"edit\",\n updateNode: \"edit\",\n deleteNode: \"edit\",\n createEdge: \"edit\",\n updateEdge: \"edit\",\n deleteEdge: \"edit\",\n },\n },\n organization: {\n label: \"Organization model\",\n data: { nodes: ORG_NODES, edges: ORG_EDGES },\n model: ORG_MODEL,\n // Simulates the planned Sestina org editor: fixed edge-type catalog (no new\n // edge types) and no property editing (node/edge properties hidden).\n capabilities: {\n readOnly: false,\n capabilities: {\n edgeTypes: \"catalog\",\n nodeProperties: \"hidden\",\n edgeProperties: \"hidden\",\n },\n },\n // A constrained instance-editing profile: edges may be linked / unlinked\n // (partOf / affiliation), but nodes are not created or deleted here.\n editCapabilities: {\n updateNode: \"edit\",\n createEdge: \"edit\",\n deleteEdge: \"edit\",\n },\n },\n};\n\nconst DATASET_OPTIONS = Object.entries(DATASETS).map(([value, d]) => ({\n value,\n label: d.label,\n}));\n\nconst DEFAULT_DATASET = \"techStack\";\n\ninterface ModelState {\n model: GraphModel;\n modelText: string;\n modelError: string | null;\n setModelText: (v: string) => void;\n applyModel: () => void;\n /** Replace the model wholesale (used by the dataset selector). */\n loadModel: (model: GraphModel) => void;\n /** Apply an edited model (from the graph editor) and re-sync the JSON text. */\n updateModel: (model: GraphModel) => void;\n}\n\n// Shared model state for the Model and Model JSON tabs.\nfunction useModelState(initialModel: GraphModel): ModelState {\n const [modelText, setModelText] = useState(() =>\n JSON.stringify(initialModel, null, 2),\n );\n const [model, setModel] = useState<GraphModel>(initialModel);\n const [modelError, setModelError] = useState<string | null>(null);\n\n const applyModel = useCallback(() => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(modelText);\n } catch (e) {\n setModelError(e instanceof Error ? e.message : \"Invalid JSON\");\n return;\n }\n if (!Array.isArray(parsed)) {\n setModelError(\"A graph model must be a JSON array of type schemas.\");\n return;\n }\n setModelError(null);\n setModel(parsed as GraphModel);\n }, [modelText]);\n\n const loadModel = useCallback((next: GraphModel) => {\n setModelText(JSON.stringify(next, null, 2));\n setModel(next);\n setModelError(null);\n }, []);\n\n const updateModel = useCallback((next: GraphModel) => {\n setModel(next);\n setModelText(JSON.stringify(next, null, 2));\n setModelError(null);\n }, []);\n\n return {\n model,\n modelText,\n modelError,\n setModelText,\n applyModel,\n loadModel,\n updateModel,\n };\n}\n\n// Full-canvas model editor (editable; changes flow back to the shared state).\nfunction ModelGraphTab({\n model,\n onChange,\n readOnly,\n capabilities,\n}: {\n model: GraphModel;\n onChange: (model: GraphModel) => void;\n readOnly: boolean;\n capabilities: GraphModelCapabilities;\n}): React.ReactElement {\n return (\n <div className=\"h-[640px] rounded-lg border overflow-hidden\">\n <GraphModelEditor\n value={model}\n onChange={onChange}\n readOnly={readOnly}\n capabilities={capabilities}\n widgetOptions={[\"entity-select\", \"coded-value\", \"textarea\"]}\n />\n </div>\n );\n}\n\nfunction CapabilitiesTab({\n config,\n onApply,\n}: {\n config: CapabilitiesConfig;\n onApply: (config: CapabilitiesConfig) => void;\n}): React.ReactElement {\n const [text, setText] = useState(() => JSON.stringify(config, null, 2));\n const [error, setError] = useState<string | null>(null);\n\n const apply = useCallback(() => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(text);\n } catch (e) {\n setError(e instanceof Error ? e.message : \"Invalid JSON\");\n return;\n }\n setError(null);\n const obj = parsed as Partial<CapabilitiesConfig>;\n onApply({\n readOnly: Boolean(obj.readOnly),\n capabilities: (obj.capabilities ?? {}) as GraphModelCapabilities,\n });\n }, [text, onApply]);\n\n const reset = useCallback(() => {\n const fresh: CapabilitiesConfig = { readOnly: false, capabilities: {} };\n setText(JSON.stringify(fresh, null, 2));\n setError(null);\n onApply(fresh);\n }, [onApply]);\n\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Button size=\"sm\" onClick={apply}>\n <Play className=\"h-4 w-4 mr-1\" />\n Apply\n </Button>\n <Button size=\"sm\" variant=\"outline\" onClick={reset}>\n <RotateCcw className=\"h-4 w-4 mr-1\" />\n Reset\n </Button>\n <span className=\"text-xs text-muted-foreground ml-2\">\n Edit, Apply, then open the Model Editor tab and select a node.\n </span>\n </div>\n {error && (\n <Alert variant=\"destructive\">\n <AlertDescription>{error}</AlertDescription>\n </Alert>\n )}\n <textarea\n value={text}\n onChange={(e) => setText(e.target.value)}\n spellCheck={false}\n className=\"w-full h-[280px] font-mono text-xs p-3 border rounded-lg bg-muted/30 resize-y focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n <div>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n Effective config (applied to GraphModelEditor)\n </p>\n <pre className=\"rounded-md bg-muted px-3 py-2 text-xs overflow-auto max-h-40\">\n {JSON.stringify(config, null, 2)}\n </pre>\n <p className=\"mt-2 text-xs text-muted-foreground\">\n readOnly = lock everything. capabilities: nodeTypes / relations (edit\n | readonly), edgeTypes (edit = select or create | catalog = select\n only | readonly), nodeProperties / edgeProperties (edit | readonly |\n hidden), showEdgeTypes (bool, default false starts edge-type nodes\n deselected; true shows them). More fields are added as the editor\n grows.\n </p>\n </div>\n </div>\n );\n}\n\n// Editable model JSON, applied to the shared model state.\nfunction ModelJsonTab({\n state,\n onReset,\n}: {\n state: ModelState;\n onReset: () => void;\n}): React.ReactElement {\n const { modelText, modelError, setModelText, applyModel } = state;\n return (\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Button size=\"sm\" onClick={applyModel}>\n <Play className=\"h-4 w-4 mr-1\" />\n Apply\n </Button>\n <Button size=\"sm\" variant=\"outline\" onClick={onReset}>\n <RotateCcw className=\"h-4 w-4 mr-1\" />\n Reset\n </Button>\n <span className=\"text-xs text-muted-foreground ml-2\">\n Edit the model, Apply, then switch to the Model tab\n </span>\n </div>\n {modelError && (\n <Alert variant=\"destructive\">\n <AlertDescription>{modelError}</AlertDescription>\n </Alert>\n )}\n <textarea\n value={modelText}\n onChange={(e) => setModelText(e.target.value)}\n spellCheck={false}\n className=\"w-full h-[600px] font-mono text-xs p-3 border rounded-lg bg-muted/30 resize-y focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Component\n// ---------------------------------------------------------------------------\n\nexport default function PlayGraph(): React.ReactElement {\n const [datasetKey, setDatasetKey] = useState(DEFAULT_DATASET);\n const [jsonText, setJsonText] = useState(() =>\n serializeGraphData(DATASETS[DEFAULT_DATASET].data),\n );\n const [parseError, setParseError] = useState<string | null>(null);\n const modelState = useModelState(DATASETS[DEFAULT_DATASET].model);\n const { loadModel } = modelState;\n const [capsConfig, setCapsConfig] = useState<CapabilitiesConfig>(\n DATASETS[DEFAULT_DATASET].capabilities,\n );\n\n // Instance-editing seams over the in-memory store + the current model. The\n // port re-loads LIVE_STORE into the visual store after every mutation; the\n // schema provider resolves forms from the (live-edited) model. Recreated when\n // the model changes so edits use the latest schema.\n const editPort = useMemo(\n () =>\n createInMemoryPort(LIVE_STORE, () =>\n loadIntoStore(PLAYGROUND_STORES, LIVE_STORE),\n ),\n [],\n );\n const editSchemaProvider = useMemo(\n () => createModelSchemaProvider(modelState.model),\n [modelState.model],\n );\n // Keep the Data JSON tab in sync after a live edit.\n const handleMutated = useCallback(() => {\n setJsonText(serializeGraphData(LIVE_STORE));\n }, []);\n\n // App-supplied form widgets: the relation widget resolves __rel_* options\n // from the in-memory store, registered under \"entity-select\" (the library's\n // default relation widget hint). This is the playground analog of the\n // explorer's cypher-select.\n const editWidgets = useMemo<WidgetRegistry>(\n () => ({\n ...DEFAULT_WIDGETS,\n \"entity-select\": createRelationWidget(LIVE_STORE),\n }),\n [],\n );\n\n // Swap the whole dataset: graph data + model + capability profile.\n const loadDataset = useCallback(\n (key: string) => {\n const ds = DATASETS[key];\n if (!ds) return;\n setDatasetKey(key);\n setJsonText(serializeGraphData(ds.data));\n setParseError(null);\n setLiveData(PLAYGROUND_STORES, ds.data);\n loadModel(ds.model);\n setCapsConfig(ds.capabilities);\n },\n [loadModel],\n );\n\n // Resizable side panel (demonstrates ResizeHandle).\n const [panelWidth, setPanelWidth] = useState(300);\n const rowRef = useRef<HTMLDivElement>(null);\n const startResize = useCallback((e: React.PointerEvent) => {\n e.preventDefault();\n const target = e.currentTarget as HTMLElement;\n target.setPointerCapture(e.pointerId);\n const move = (ev: PointerEvent) => {\n const right = rowRef.current?.getBoundingClientRect().right ?? 0;\n setPanelWidth(Math.min(560, Math.max(200, right - ev.clientX)));\n };\n const up = () => {\n window.removeEventListener(\"pointermove\", move);\n window.removeEventListener(\"pointerup\", up);\n };\n window.addEventListener(\"pointermove\", move);\n window.addEventListener(\"pointerup\", up);\n }, []);\n\n const handleApply = useCallback(() => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(jsonText);\n } catch (e) {\n setParseError(e instanceof Error ? e.message : \"Invalid JSON\");\n return;\n }\n const validationError = validateGraphInput(parsed);\n if (validationError) {\n setParseError(validationError);\n return;\n }\n setParseError(null);\n setLiveData(PLAYGROUND_STORES, parsed as GraphInput);\n }, [jsonText]);\n\n const handleReset = useCallback(() => {\n const data = DATASETS[datasetKey].data;\n setJsonText(serializeGraphData(data));\n setParseError(null);\n setLiveData(PLAYGROUND_STORES, data);\n }, [datasetKey]);\n\n // Reset the model JSON tab to the current dataset's model.\n const handleResetModel = useCallback(() => {\n loadModel(DATASETS[datasetKey].model);\n }, [datasetKey, loadModel]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent) => {\n if ((e.metaKey || e.ctrlKey) && e.key === \"Enter\") {\n e.preventDefault();\n handleApply();\n }\n },\n [handleApply],\n );\n\n return (\n <div className=\"space-y-6\">\n <div>\n <h1>Graph Visualization</h1>\n <p className=\"text-sm text-muted-foreground mt-1\">\n Interactive property graph with dual renderer support. Edit the JSON\n data and apply to re-render. The Model tab renders a graph model\n (metamodel) with GraphModelEditor.\n </p>\n </div>\n <div className=\"flex items-center gap-3\">\n <FormSelect\n label=\"Dataset\"\n options={DATASET_OPTIONS}\n value={datasetKey}\n onChange={(v) => v && loadDataset(v)}\n clearable={false}\n wrapperClassName=\"w-64\"\n />\n <span className=\"text-xs text-muted-foreground mt-5\">\n A dataset bundles graph data + model + capability profile.\n </span>\n </div>\n <GraphStoresContext.Provider value={PLAYGROUND_STORES}>\n <Tabs defaultValue=\"graph\" className=\"space-y-3\">\n <TabsList>\n <TabsTrigger value=\"graph\">Graph</TabsTrigger>\n <TabsTrigger value=\"data\">Data JSON</TabsTrigger>\n <TabsTrigger value=\"model\">Model Editor</TabsTrigger>\n <TabsTrigger value=\"model-json\">Model JSON</TabsTrigger>\n <TabsTrigger value=\"model-capabilities\">\n Model Editor Capabilities\n </TabsTrigger>\n </TabsList>\n\n <TabsContent value=\"graph\" className=\"mt-0\">\n <GraphRendererProvider defaultRenderer=\"cytoscape\">\n <div ref={rowRef} className=\"flex overflow-hidden h-[600px]\">\n <div className=\"flex-1 min-w-0\">\n <GraphVisualizer />\n </div>\n {/* Drag to resize the side panel (ResizeHandle demo). */}\n <ResizeHandle\n orientation=\"vertical\"\n aria-valuenow={panelWidth}\n aria-valuemin={200}\n aria-valuemax={560}\n onPointerDown={startResize}\n onDoubleClick={() => setPanelWidth(300)}\n />\n <div\n style={{ width: panelWidth }}\n className=\"flex-shrink-0 flex flex-col min-h-0\"\n >\n <div className=\"flex-1 min-h-0 overflow-hidden\">\n <ActionPanel\n actions={\n <GraphEditToolbar\n port={editPort}\n schemaProvider={editSchemaProvider}\n capabilities={DATASETS[datasetKey].editCapabilities}\n widgets={editWidgets}\n onMutated={handleMutated}\n />\n }\n />\n </div>\n {/* Accessible DOM mirror (playground demo only): keyboard / AT /\n automation can select the same nodes/edges as the canvas.\n Real consumers render it sr-only (omit `visible`). */}\n <div className=\"shrink-0 px-4 pb-4 pt-2\">\n <p className=\"text-xs font-medium text-muted-foreground uppercase tracking-wide mb-2\">\n Accessible list (demo)\n </p>\n <GraphA11yList visible maxHeight={160} />\n </div>\n </div>\n </div>\n </GraphRendererProvider>\n </TabsContent>\n\n <TabsContent value=\"data\" className=\"mt-0\">\n <div className=\"space-y-3\">\n <div className=\"flex items-center gap-2\">\n <Button size=\"sm\" onClick={handleApply}>\n <Play className=\"h-4 w-4 mr-1\" />\n Apply\n </Button>\n <Button size=\"sm\" variant=\"outline\" onClick={handleReset}>\n <RotateCcw className=\"h-4 w-4 mr-1\" />\n Reset\n </Button>\n <span className=\"text-xs text-muted-foreground ml-2\">\n Cmd+Enter to apply\n </span>\n </div>\n {parseError && (\n <Alert variant=\"destructive\">\n <AlertDescription>{parseError}</AlertDescription>\n </Alert>\n )}\n <textarea\n value={jsonText}\n onChange={(e) => setJsonText(e.target.value)}\n onKeyDown={handleKeyDown}\n spellCheck={false}\n className=\"w-full h-[600px] font-mono text-xs p-3 border rounded-lg bg-muted/30 resize-y focus:outline-none focus:ring-2 focus:ring-ring\"\n />\n </div>\n </TabsContent>\n\n <TabsContent value=\"model\" className=\"mt-0\">\n <ModelGraphTab\n model={modelState.model}\n onChange={modelState.updateModel}\n readOnly={capsConfig.readOnly}\n capabilities={capsConfig.capabilities}\n />\n </TabsContent>\n\n <TabsContent value=\"model-json\" className=\"mt-0\">\n <ModelJsonTab state={modelState} onReset={handleResetModel} />\n </TabsContent>\n\n <TabsContent value=\"model-capabilities\" className=\"mt-0\">\n <CapabilitiesTab config={capsConfig} onApply={setCapsConfig} />\n </TabsContent>\n </Tabs>\n </GraphStoresContext.Provider>\n </div>\n );\n}\n","/**\n * In-memory graph-editing adapters for the playground.\n *\n * Implements the sonnet-graph instance-editing seams against a mutable\n * in-memory dataset and the selected dataset's model, with NO backend:\n *\n * - `createInMemoryPort` -> a `GraphMutationPort` that mutates the dataset\n * and re-loads the store so the canvas reflects the change.\n * - `createModelSchemaProvider` -> a `GraphSchemaProvider` that resolves\n * node/edge schemas and relations synchronously from the in-memory model.\n *\n * This is the playground's acceptance demo (tier 1 of the override model): the\n * shared library editor driven end-to-end with zero app-specific UI. A real\n * consumer (e.g. the explorer) implements the same seams over its REST API.\n */\n\nimport type {\n GraphMutationPort,\n GraphSchemaProvider,\n RelationDef,\n RawGraphNode,\n RawGraphEdge,\n GraphModel,\n CreateNodeInput,\n UpdateNodeInput,\n CreateEdgeInput,\n UpdateEdgeInput,\n CreateNodeWithRelationsInput,\n UpdateNodeWithRelationsInput,\n RelationMap,\n} from \"@petrarca/sonnet-graph\";\nimport type { JsonSchema } from \"@petrarca/sonnet-core/schema\";\n\n/** The mutable dataset the in-memory port operates on. */\nexport interface GraphStore {\n nodes: RawGraphNode[];\n edges: RawGraphEdge[];\n}\n\n/** Allocates monotonically increasing ids, seeded above the existing maximum.\n * Uses reduce instead of spread-into-Math.max to avoid stack overflow on large\n * stores. */\nfunction createIdAllocator(store: GraphStore): () => number {\n const allIds = [\n ...store.nodes.map((n) => n.id_ ?? 0),\n ...store.edges.map((e) => e.id_ ?? 0),\n ];\n const max = allIds.reduce((m, id) => (id > m ? id : m), 0);\n let next = max + 1;\n return () => next++;\n}\n\n/** Edges touching a node, as the inbound / outbound subsets. */\nfunction edgesForNode(\n store: GraphStore,\n id: number,\n): { inbound: RawGraphEdge[]; outbound: RawGraphEdge[] } {\n return {\n inbound: store.edges.filter((e) => e.end_id_ === id),\n outbound: store.edges.filter((e) => e.start_id_ === id),\n };\n}\n\n/**\n * Apply a relation map to a node by diffing against its current edges: create\n * edges for new targets, delete edges for removed targets, keep the rest.\n * Returns the created and deleted-edge ids (mirrors the backend's atomic diff).\n */\nfunction diffRelations(\n store: GraphStore,\n nodeId: number,\n relations: RelationMap,\n nextId: () => number,\n): { created: RawGraphEdge[]; deleted: number[] } {\n const created: RawGraphEdge[] = [];\n const deleted: number[] = [];\n\n for (const [relType, targetIds] of Object.entries(relations)) {\n const existing = store.edges.filter(\n (e) => e.label_ === relType && e.start_id_ === nodeId,\n );\n const desired = new Set(targetIds);\n\n // Delete edges whose target is no longer desired.\n for (const edge of existing) {\n if (!desired.has(edge.end_id_) && edge.id_ != null) {\n deleted.push(edge.id_);\n }\n }\n // Create edges for desired targets not already present.\n const present = new Set(existing.map((e) => e.end_id_));\n for (const targetId of targetIds) {\n if (!present.has(targetId)) {\n const edge: RawGraphEdge = {\n id_: nextId(),\n label_: relType,\n start_id_: nodeId,\n end_id_: targetId,\n properties_: {},\n };\n created.push(edge);\n }\n }\n }\n\n store.edges = store.edges\n .filter((e) => e.id_ == null || !deleted.includes(e.id_))\n .concat(created);\n return { created, deleted };\n}\n\n/**\n * Build a `GraphMutationPort` over a mutable in-memory store. `onChange` is\n * called after every mutation so the playground can re-load the store into the\n * graph data store (the consumer's cache-patch analog).\n */\nexport function createInMemoryPort(\n store: GraphStore,\n onChange: () => void,\n): GraphMutationPort {\n const nextId = createIdAllocator(store);\n\n const createNode = (input: CreateNodeInput): RawGraphNode => {\n const node: RawGraphNode = {\n id_: nextId(),\n label_: input.label_,\n properties_: input.properties_,\n };\n store.nodes = [...store.nodes, node];\n return node;\n };\n\n const updateNode = (input: UpdateNodeInput): RawGraphNode => {\n const node: RawGraphNode = {\n id_: input.id_,\n label_: input.label_,\n properties_: input.properties_,\n };\n store.nodes = store.nodes.map((n) => (n.id_ === input.id_ ? node : n));\n return node;\n };\n\n const createEdge = (input: CreateEdgeInput): RawGraphEdge => {\n const edge: RawGraphEdge = {\n id_: nextId(),\n label_: input.label_,\n start_id_: input.start_id_,\n end_id_: input.end_id_,\n properties_: input.properties_ ?? {},\n };\n store.edges = [...store.edges, edge];\n return edge;\n };\n\n const updateEdge = (input: UpdateEdgeInput): RawGraphEdge => {\n let updated: RawGraphEdge | undefined;\n store.edges = store.edges.map((e) => {\n if (e.id_ !== input.id_) return e;\n updated = { ...e, properties_: input.properties_ };\n return updated;\n });\n if (!updated) throw new Error(`Edge ${input.id_} not found`);\n return updated;\n };\n\n // Wrap each mutation: call onChange synchronously after the mutation\n // completes so the canvas reflects the change immediately (the playground\n // has no async cache layer). The Promise wrapper satisfies the port contract.\n const withRefresh = <Args extends unknown[], R>(\n fn: (...args: Args) => R,\n ): ((...args: Args) => Promise<R>) => {\n return (...args: Args) => {\n const result = fn(...args);\n onChange();\n return Promise.resolve(result);\n };\n };\n\n return {\n createNode: withRefresh(createNode),\n updateNode: withRefresh(updateNode),\n deleteNode: withRefresh((id: number) => {\n store.nodes = store.nodes.filter((n) => n.id_ !== id);\n store.edges = store.edges.filter(\n (e) => e.start_id_ !== id && e.end_id_ !== id,\n );\n }),\n createEdge: withRefresh(createEdge),\n updateEdge: withRefresh(updateEdge),\n deleteEdge: withRefresh((id: number) => {\n store.edges = store.edges.filter((e) => e.id_ !== id);\n }),\n createNodeWithRelations: withRefresh(\n (input: CreateNodeWithRelationsInput) => {\n const node = createNode(input);\n const { created } = diffRelations(\n store,\n node.id_!,\n input.relations,\n nextId,\n );\n return { node, edges: created };\n },\n ),\n updateNodeWithRelations: withRefresh(\n (input: UpdateNodeWithRelationsInput) => {\n const node = updateNode(input);\n const { created, deleted } = diffRelations(\n store,\n input.id_,\n input.relations,\n nextId,\n );\n return { node, edges: { created, deleted } };\n },\n ),\n getInboundEdges: (id: number) =>\n Promise.resolve(edgesForNode(store, id).inbound),\n getOutboundEdges: (id: number) =>\n Promise.resolve(edgesForNode(store, id).outbound),\n getPairEdges: (a: number, b: number) =>\n Promise.resolve(\n store.edges.filter(\n (e) =>\n (e.start_id_ === a && e.end_id_ === b) ||\n (e.start_id_ === b && e.end_id_ === a),\n ),\n ),\n getNodes: (ids: number[]) =>\n Promise.resolve(\n store.nodes.filter((n) => n.id_ != null && ids.includes(n.id_)),\n ),\n };\n}\n\n/**\n * Strip the model's `x-graph` extension, yielding a plain property JSON Schema.\n * `GraphModelProperty` is structurally compatible with `JsonSchemaProperty`\n * (same keys: type, title, description, enum, format, items, default); the cast\n * via unknown is safe here and confined to this playground adapter.\n */\nfunction toPropertySchema(\n type: GraphModel[number] | undefined,\n): JsonSchema | null {\n if (!type) return null;\n return {\n type: \"object\",\n properties: (type.properties ?? {}) as unknown as JsonSchema[\"properties\"],\n required: type.required ?? [],\n } as unknown as JsonSchema;\n}\n\n/**\n * Build a `GraphSchemaProvider` from an in-memory `GraphModel`. All lookups\n * resolve synchronously (wrapped in `Promise.resolve`); a host with the model\n * already in memory does not need an async source.\n */\nexport function createModelSchemaProvider(\n model: GraphModel,\n): GraphSchemaProvider {\n const byLabel = new Map(model.map((t) => [t[\"x-graph\"].label, t]));\n\n const nodeLabels = model\n .filter((t) => t[\"x-graph\"].type !== \"EDGE\")\n .map((t) => t[\"x-graph\"].label);\n\n return {\n getNodeSchema: (label: string) =>\n Promise.resolve(toPropertySchema(byLabel.get(label))),\n getEdgeSchema: (type: string) =>\n Promise.resolve(toPropertySchema(byLabel.get(type))),\n listNodeLabels: () => Promise.resolve(nodeLabels),\n relationsFor: (label: string): Promise<RelationDef[]> => {\n const relations = byLabel.get(label)?.[\"x-graph\"].relations ?? [];\n return Promise.resolve(\n relations.map((r) => ({\n rel_type_name: r.rel_type_name,\n to_type_name: r.to_type_name,\n form_field: r.form_field,\n // cardinality drives single- vs multi-select in the form.\n cardinality: r.cardinality as RelationDef[\"cardinality\"],\n })),\n );\n },\n };\n}\n","/**\n * Playground relation widget -- an app-level form widget that renders the\n * `__rel_*` relation fields produced by the library's schema enrichment.\n *\n * This is the playground's analog of the explorer's `cypher-select` widget: the\n * library emits the relation field schema/uiSchema (with `x-ui-widget:\n * \"entity-select\"` and `x-ui-options.targetType`), and the consuming app\n * supplies the actual widget via the form widget registry. Here the options are\n * resolved synchronously from the in-memory store; the explorer resolves them\n * via Cypher. This demonstrates the \"widget stays app-level\" seam.\n */\n\nimport React from \"react\";\nimport {\n FormSelect,\n FormMultiSelect,\n type WidgetProps,\n} from \"@petrarca/sonnet-forms\";\nimport { extractDisplayLabel } from \"@petrarca/sonnet-graph\";\nimport type { GraphStore } from \"./inMemoryGraphEditing\";\n\ninterface RelationOption {\n value: string;\n label: string;\n}\n\n// Options for a target node-type label: every node of that label as {id, name}.\nfunction optionsForType(\n store: GraphStore,\n targetType: string,\n): RelationOption[] {\n return store.nodes\n .filter((n) => n.label_ === targetType && n.id_ != null)\n .map((n) => ({ value: String(n.id_), label: extractDisplayLabel(n) }));\n}\n\nfunction toStringArray(value: unknown): string[] {\n if (Array.isArray(value)) return value.map(String);\n if (value == null || value === \"\") return [];\n return [String(value)];\n}\n\n/**\n * Build the relation widget bound to a store. Registered under \"entity-select\"\n * (the library's default relation widget hint) so the enriched `__rel_*` fields\n * resolve to it.\n */\nexport function createRelationWidget(store: GraphStore) {\n return function RelationWidget({\n value,\n onChange,\n label,\n options,\n placeholder,\n }: WidgetProps): React.ReactElement {\n const targetType = String(options?.targetType ?? \"\");\n const multiple = options?.multiple !== false;\n const selectOptions = optionsForType(store, targetType);\n\n if (multiple) {\n return (\n <FormMultiSelect\n label={label || false}\n options={selectOptions}\n value={toStringArray(value)}\n onChange={(v) => onChange(v)}\n placeholder={placeholder ?? `Select ${targetType}...`}\n />\n );\n }\n\n const single = toStringArray(value)[0] ?? null;\n return (\n <FormSelect\n label={label || false}\n options={selectOptions}\n value={single}\n onChange={(v) => onChange(v ?? \"\")}\n placeholder={placeholder ?? `Select ${targetType}...`}\n />\n );\n };\n}\n"],"mappings":";AASA,SAAgB,aAAa,SAAS,QAAQ,gBAAgB;AAC9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,uBAA4C;;;ACSrD,SAAS,kBAAkB,OAAiC;AAC1D,QAAM,SAA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