{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "yard-map",
  "type": "registry:component",
  "title": "Yard map",
  "description": "Every dock door and what is at it. Sample data: 12 dock doors and the yard, loading, loaded, reefer and waiting 2 h+.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-yard"
  ],
  "files": [
    {
      "path": "registry/chartory/components/yard-map.tsx",
      "type": "registry:component",
      "target": "components/chartory/yard-map.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Yard map (Chartory chart 058): sizes xs | s | m | l, laid out again from the data at each\n// size; collection \"hearth\" (default) or \"signal\" (with @chartory/signal, Code and Complete). Data in the type's shape (default: the sample). Docs:\n// https://usechartory.com/docs/charts/yard-map\nimport { ChartView, type ChartViewProps } from \"@/lib/chartory/charts/chart-view\"\nimport { registerChart } from \"@/lib/chartory/charts/defs\"\nimport { data as sample } from \"@/lib/chartory/charts/types/058-yard-map/data\"\nimport { def } from \"@/lib/chartory/charts/types/058-yard-map/layout\"\n\nregisterChart(def, sample)\n\nexport type YardMapData = typeof sample\nexport type YardMapProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: YardMapData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: YardMapData[]\n}\n\nexport function YardMap(props: YardMapProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/058-yard-map/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/058-yard-map/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 058 Yard occupancy · sample data (Figma chart/058, from the Figma definition, seeded values expanded).\nimport type { YardData } from \"../../plots/yard\";\n\nexport const data: YardData = {\n  toks: { load: \"data/primary\", empty: \"chipFill\", blocked: \"status/danger\", loaded: \"data/cat-2\", reefer: \"data/cat-3\", wait: \"status/warning\" },\n  doors: [\"load\", \"load\", \"empty\", \"load\", \"blocked\", \"load\", \"empty\", \"load\", \"load\", \"empty\", \"load\", \"load\"],\n  slots: [\"loaded\", \"loaded\", \"reefer\", \"wait\", \"loaded\", \"empty\", \"loaded\", \"reefer\", \"loaded\", \"loaded\", \"reefer\", \"loaded\", \"empty\", \"loaded\", \"wait\", \"loaded\", \"loaded\", \"empty\", \"reefer\", \"loaded\", \"loaded\", \"empty\", \"loaded\", \"loaded\", \"wait\", \"reefer\", \"empty\", \"loaded\", \"loaded\", \"wait\", \"loaded\", \"empty\", \"loaded\", \"reefer\", \"empty\", \"loaded\", \"empty\", \"loaded\", \"empty\", \"loaded\"]\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/058-yard-map/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/058-yard-map/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 058 Yard map (Figma chart/058, \"Yard occupancy\"): C.yard, 12 dock doors and 40 trailer slots by state.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { yard } from \"../../plots/yard\";\nimport { data } from \"./data\";\n\nconst names: Record<string, string> = { load: \"Loading\", empty: \"Empty\", blocked: \"Blocked\", loaded: \"Loaded\", reefer: \"Reefer\", wait: \"Waiting 2 h+\" };\nconst count = (xs: string[], s: string) => xs.filter((x) => x === s).length;\n\n// tooltip: one door (groups 0 … doors − 1) or one trailer slot (after the doors): its state, swatch = its fill,\n// share = how many doors / slots are in that state\nconst tip = (o: typeof data, g: number): TooltipSpec | null => {\n  const door = g < o.doors.length, xs = door ? o.doors : o.slots, i = door ? g : g - o.doors.length, st = xs[i];\n  if (st == null) return null;\n  const tok = o.toks[st] === \"chipFill\" ? \"chip/fill\" : o.toks[st];\n  return { kind: \"cell\", caps: (door ? \"DOOR \" : \"SLOT \") + (i + 1), value: names[st] ?? st, swatch: tok, share: count(xs, st) + \" OF \" + xs.length + (door ? \" DOORS\" : \" SLOTS\") };\n};\n\nexport const def: ChartDef = {\n  no: 58,\n  slug: \"yard-map\",\n  legend: [[\"data/primary\", \"Loading\"], [\"data/cat-2\", \"Loaded\"], [\"data/cat-3\", \"Reefer\"], [\"status/warning\", \"Waiting 2 h+\"]],\n  plot: (K, p, w, d) => yard(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tip(d as typeof data, g),\n  // the yard an hour later: a few doors and slots change state (same places, same marks)\n  update: (d, step) => {\n    const o = d as typeof data;\n    const doorNext: Record<string, string> = { load: \"empty\", empty: \"load\", blocked: \"blocked\" };\n    const slotNext: Record<string, string> = { loaded: \"wait\", wait: \"empty\", empty: \"loaded\", reefer: \"reefer\" };\n    const hit = (i: number, k: number) => (i * 7 + step * 5 + k) % 9 === 0;\n    return { ...o, doors: o.doors.map((s, i) => (hit(i, 1) ? doorNext[s] : s)), slots: o.slots.map((s, i) => (hit(i, 4) ? slotNext[s] : s)) };\n  },\n  describe: {\n    title: \"Yard occupancy\",\n    summary: `${data.doors.length} dock doors: ${count(data.doors, \"load\")} loading, ${count(data.doors, \"empty\")} empty, ${count(data.doors, \"blocked\")} blocked; ${data.slots.length} yard slots: ${count(data.slots, \"loaded\")} loaded, ${count(data.slots, \"reefer\")} reefer, ${count(data.slots, \"wait\")} waiting over 2 h, ${count(data.slots, \"empty\")} empty.`,\n    table: {\n      head: [\"Place\", \"State\"],\n      rows: [...data.doors.map((s, i) => [\"Door \" + (i + 1), names[s]]), ...data.slots.map((s, i) => [\"Slot \" + (i + 1), names[s]])],\n    },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "space-and-place"
  ],
  "meta": {
    "access": "free",
    "no": 58,
    "family": "Space and place"
  }
}
