Files
zeekayandHanzo Dev 1e5664bf21 ui: Grid gains a column cap, and this package stops splitting the gui train
Grid `max` — the missing half of `min`. A single auto-fill floor cannot say
"2-up on a phone, 4-up on a desktop": 2-up at 390px needs a ~170px floor, and
that same floor yields SIX columns at 1280. `max` raises the floor to one-Mth of
the row so auto-fill cannot fit an (M+1)th track, and below that width the max()
picks the min again and the grid wraps normally — so the cap costs nothing on
small screens. That is why it is expressed as a floor and not a breakpoint.
Proven: remove the cap and 1280px comes back FIVE columns.

@hanzogui/* ranges move to the 8.1 train. The @hanzogui packages pin each other
EXACTLY ([email protected] -> [email protected], no caret), so one stale range here dragged a
whole second generation in beside a consumer's. Both typecheck, both build, then
the config singleton lives in one copy and the components read the other, and
the app dies on prerender with `Missing theme.` — hanzo.ai hit that and had to
state the invariant by hand in a pnpm.overrides block. The invariant belongs in
the package that caused it.

The whole train moved together, including pkgs/canvas and pkgs/dashboard:
bumping this package alone SPLIT the monorepo the same way, and the ~30 "prop
does not exist" errors that produced were the split wearing a mask, not an API
change.

The consumer harness now asserts ONE copy of @hanzogui/web in the installed app,
before any test runs. Mutation-proven the honest way: the first attempt "passed"
because `pnpm pack` had failed and the check never ran — the real proof pins an
older @hanzogui/web in the consumer and watches the diagnostic name both
versions.

NOT changed: `gui-config.d.ts` ending `}, "default">`. That was reported as a
latent declaration defect; it is not one. `InferGuiConfig`'s eighth parameter IS
`ExtractAnimationDriverKeys<E>`, so `"default"` is the correct resolution for a
config whose animations object has one driver named `default`. An honest lib
check (skipLibCheck off) reports zero errors in that file. Changing it would
have made it wrong.

Co-authored-by: Hanzo Dev <[email protected]>
2026-08-04 20:22:35 -07:00
..

@hanzo/canvas

A Railway-grade PaaS project canvas for any Hanzo console — a pannable / zoomable board of service nodes with live status, metric sparklines, deploy timelines, an environment switcher, and a service detail drawer.

Built on @hanzo/gui (so it is brand / white-label aware via the design tokens — the same components render in the Hanzo, Lux, and Zoo consoles in each brand) with an optional @xyflow/react peer for the canvas itself.

Every component is presentational and data-prop-driven: the host fetches its /v1 rows and maps them into the plain view-models in ./types. The pure folds (status normalization, layout, relative time) are unit-tested in isolation; the components never reach into a data layer. One way to do everything, decomplected.

Install

pnpm add @hanzo/canvas
# peers: @hanzo/gui, react, react-dom, and (for the canvas) @xyflow/react

The pieces

Export What it is
ProjectCanvas The pan/zoom board (React Flow): dot-grid, minimap, controls, auto-layout, theme-aware. Dynamic-import with SSR disabled.
ServiceNode The layered service card — icon, name, type + /v1 capability, status badge, source ref, replicas, latest-deploy time, metric sparkline.
ServiceStatusBadge Status pill (dot + label) with a live pulse for active/deploying.
MetricSparkline A tiny honest sparkline (flat baseline when there is no data — never a fake trend).
DeployTimeline A vertical deploy/build timeline.
EnvSwitcher A segmented environment switcher (production / preview / …).
ServiceDetailDrawer A right-side drawer with a service header + host-supplied tabs (Deployments, Variables, Metrics, Logs, Domains, SBOM).
SourceRef, ReplicaPill Small primitives — a repo/image source ref and a replica-count pill.
normalizeServiceStatus, layoutGraph, relativeTime, toEpochMs, statusColors, withAlpha, kindLabel Pure helpers the host maps its data through.

Usage

import dynamic from 'next/dynamic'
import { type ServiceNodeData } from '@hanzo/canvas'

// The canvas touches browser globals at import — load it client-side only.
const ProjectCanvas = dynamic(
  () => import('@hanzo/canvas').then((m) => m.ProjectCanvas),
  { ssr: false },
)

const nodes: ServiceNodeData[] = apps.map((a) => ({
  id: a.id,
  name: a.name,
  kind: 'app',
  status: normalizeServiceStatus(a.phase ?? a.status),
  source: { kind: 'image', ref: `${a.image.repository}:${a.image.tag}` },
  replicas: a.replicas,
  deployedAt: toEpochMs(a.updatedAt),
  capability: { id: 'platform', label: 'App Platform' },
}))

<ProjectCanvas
  nodes={nodes}
  edges={edges}
  theme={resolvedTheme}
  reducedMotion={reducedMotion}
  onOpenDetail={(svc) => setSelected(svc)}
/>

Status colors are semantic, not brand (green = active, amber = deploying, red = crashed, …) and overridable per brand via the statusPalette prop; all card chrome uses the neutral design tokens, so the canvas takes on each brand's theme automatically.