{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "cells-matrix",
  "type": "registry:component",
  "title": "Cells matrix",
  "description": "Clusters across two sets of categories. Sample data: requests across 16 topics in code, support, search and agents, by size from 128 to 16K, one cell marked at 1,284.",
  "registryDependencies": [
    "@chartory/core",
    "@chartory/plot-matrix"
  ],
  "files": [
    {
      "path": "registry/chartory/components/cells-matrix.tsx",
      "type": "registry:component",
      "target": "components/chartory/cells-matrix.tsx",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// Cells matrix (Chartory chart 027): 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/cells-matrix\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/027-cells-matrix/data\"\nimport { def } from \"@/lib/chartory/charts/types/027-cells-matrix/layout\"\n\nregisterChart(def, sample)\n\nexport type CellsMatrixData = typeof sample\nexport type CellsMatrixProps = Omit<ChartViewProps, \"def\" | \"data\" | \"states\"> & {\n  /** the data to draw (default: the sample) */\n  data?: CellsMatrixData\n  /** further data states: the chart morphs to them (update) or ticks through them (live, with interval) */\n  states?: CellsMatrixData[]\n}\n\nexport function CellsMatrix(props: CellsMatrixProps) {\n  return <ChartView def={def} {...props} />\n}\n"
    },
    {
      "path": "registry/chartory/charts/types/027-cells-matrix/data.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/027-cells-matrix/data.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 027 Cells matrix · sample data (Figma chart/027, AI: prompt clusters by request size (rows, tokens) × topic\n// (16 columns), last 7 days; strong = dense cells, track = unclustered outliers; the crosshair marks a busy cell).\nimport type { MatrixData } from \"../../plots/matrix\";\n\nexport const data: MatrixData = {\n  rows: [\"16K\", \"8K\", \"4K\", \"2K\", \"1K\", \"512\", \"256\", \"128\"],\n  ncols: 16,\n  cells: [\n    [0, 0, \"data/cat-2\", true],\n    [0, 1, \"data/cat-2\", true],\n    [0, 3, \"data/cat-2\", false],\n    [0, 4, \"data/cat-2\", true],\n    [1, 0, \"data/cat-2\", true],\n    [1, 1, \"data/cat-2\", true],\n    [1, 2, \"data/cat-2\", false],\n    [1, 4, \"data/cat-2\", true],\n    [2, 0, \"data/cat-2\", false],\n    [2, 1, \"data/cat-2\", false],\n    [2, 2, \"data/cat-2\", true],\n    [2, 3, \"data/cat-2\", false],\n    [2, 4, \"data/cat-2\", true],\n    [3, 0, \"data/cat-2\", false],\n    [3, 1, \"data/cat-2\", true],\n    [3, 3, \"data/cat-2\", true],\n    [3, 4, \"data/cat-2\", false],\n    [2, 5, \"data/cat-3\", false],\n    [2, 6, \"data/cat-3\", false],\n    [3, 5, \"data/cat-3\", true],\n    [4, 7, \"data/cat-3\", true],\n    [4, 8, \"data/cat-3\", true],\n    [5, 7, \"data/cat-3\", false],\n    [5, 8, \"data/cat-3\", false],\n    [4, 10, \"data/cat-6\", false],\n    [4, 11, \"data/cat-6\", false],\n    [4, 12, \"data/cat-6\", false],\n    [5, 10, \"data/cat-6\", false],\n    [5, 11, \"data/cat-6\", true],\n    [5, 12, \"data/cat-6\", true],\n    [6, 10, \"data/cat-6\", true],\n    [6, 11, \"data/cat-6\", true],\n    [6, 12, \"data/cat-6\", true],\n    [7, 9, \"data/cat-6\", true],\n    [7, 10, \"data/cat-6\", false],\n    [7, 12, \"data/cat-6\", false],\n    [5, 15, \"data/cat-5\", true],\n    [6, 14, \"data/cat-5\", false],\n    [6, 15, \"data/cat-5\", false],\n    [7, 13, \"data/cat-5\", false],\n    [7, 14, \"data/cat-5\", false],\n    [7, 15, \"data/cat-5\", true],\n    [6, 1, \"data/track\", true],\n    [7, 2, \"data/track\", true],\n    [1, 9, \"data/track\", true],\n    [2, 13, \"data/track\", true],\n    [0, 11, \"data/track\", true],\n    [7, 6, \"data/track\", true],\n    [3, 6, \"data/cat-3\", true],\n  ],\n  cross: { r: 3, c: 6, text: \"1,284 REQ\" },\n};\n"
    },
    {
      "path": "registry/chartory/charts/types/027-cells-matrix/layout.ts",
      "type": "registry:lib",
      "target": "lib/chartory/charts/types/027-cells-matrix/layout.ts",
      "content": "// SPDX-License-Identifier: MIT · Copyright (c) 2026 BEY AGENCY LTD · Chartory, usechartory.com\n// 027 Cells matrix (Figma chart/027, \"Prompt clusters by size\"): C.matrix, four topic clusters over request sizes.\nimport type { ChartDef, TooltipSpec } from \"../../core/shell\";\nimport { matrix } from \"../../plots/matrix\";\nimport { data } from \"./data\";\n\nconst names: Record<string, string> = { \"data/cat-2\": \"Code\", \"data/cat-3\": \"Support\", \"data/cat-6\": \"Search\", \"data/cat-5\": \"Agents\", \"data/track\": \"Unclustered\" };\n\n/** Tooltip for one cell (group = the cell's index in `cells`): request size and topic, its cluster and density (the\n *  marked cell adds its request count). */\nfunction tipOf(o: typeof data, g: number): TooltipSpec | null {\n  const cell = o.cells[g];\n  if (!cell) return null;\n  const [r, c, tok, strong] = cell;\n  const req = o.cross && o.cross.r === r && o.cross.c === c ? \" · \" + o.cross.text : \"\";\n  return { kind: \"cell\", caps: `${o.rows[r]} TOKENS · TOPIC ${c + 1}`, value: names[tok] ?? \"Cluster\", swatch: tok, share: (strong ? \"HIGH DENSITY\" : \"LOW DENSITY\") + req };\n}\n\nexport const def: ChartDef = {\n  no: 27,\n  slug: \"cells-matrix\",\n  legend: [[\"data/cat-2\", \"Code\"], [\"data/cat-3\", \"Support\"], [\"data/cat-6\", \"Search\"], [\"data/cat-5\", \"Agents\"]],\n  // update: the next week; a few cells change density (dense ↔ sparse, deterministic per step) and the crosshair\n  // follows the busiest dense Support cell at 2K tokens, with its request count\n  update: (d, step) => {\n    const o = d as typeof data;\n    const cells = o.cells.map(([r, c, tok, strong], i) => [r, c, tok, (i * 7 + step * 3) % 11 === 0 ? !strong : strong] as typeof o.cells[number]);\n    const busy = cells.filter(([r, , tok, strong]) => r === o.cross!.r && tok === \"data/cat-3\" && strong).map(([, c]) => c);\n    const c = busy[step % busy.length] ?? o.cross!.c;\n    const req = Math.round(1284 * (1 + 0.09 * Math.sin(step * 2.3 + 0.4)));\n    return { ...o, cells, cross: { ...o.cross!, c, text: req.toLocaleString(\"en-US\") + \" REQ\" } };\n  },\n  plot: (K, p, w, d) => matrix(K, p, w, (d as typeof data | undefined) ?? data),\n  tip: (d, g) => tipOf(d as typeof data, g),\n  describe: {\n    title: \"Prompt clusters by size\",\n    summary: `Requests of the last 7 days by request size (128 to 16K tokens) and topic (16 columns), in four clusters: Code sits at the large sizes, Search and Agents at the small ones; the marked 2K cell in Support holds 1,284 requests.`,\n    table: {\n      head: [\"Request size\", \"Topic\", \"Cluster\", \"Density\"],\n      rows: data.cells.map(([r, c, tok, strong]) => [data.rows[r], c + 1, names[tok], strong ? \"High\" : \"Low\"]),\n    },\n  },\n};\n"
    }
  ],
  "categories": [
    "charts",
    "relationship"
  ],
  "meta": {
    "access": "free",
    "no": 27,
    "family": "Relationship"
  }
}
