|
| 1 | +import docJson from "./doc.json" with { type: "json" }; |
| 2 | +import { periodt } from "@carcajada/periodt"; |
| 3 | +import clr from "lunchbox/particles/clr.ts"; |
| 4 | + |
| 5 | +export const particles = [ |
| 6 | + { symbol: "α", name: "area", color: clr.panel.bg_50 }, |
| 7 | + { symbol: "β", name: "btn", color: clr.brand.bg_60 }, |
| 8 | + { symbol: "γ", name: "clr", color: clr.brand.bg_60 }, |
| 9 | + { symbol: "δ", name: "focus", color: clr.error.bg_50 }, |
| 10 | + { symbol: "ε", name: "input", color: clr.neutral.bg_25 }, |
| 11 | + { symbol: "ζ", name: "layout", color: clr.neutral.bg_10 }, |
| 12 | + { symbol: "ψ", name: "text", color: clr.neutral.bg_25 }, |
| 13 | +]; |
| 14 | + |
| 15 | +export const atoms = [ |
| 16 | + { symbol: "As", name: "Aside.Sticky", group: "A" }, |
| 17 | + { symbol: "X", name: "KatexStyles", group: "X" }, |
| 18 | + { symbol: "K", name: "Kbd", group: "K" }, |
| 19 | + { symbol: "L", name: "Link", group: "L" }, |
| 20 | + { symbol: "Ns", name: "Nav.Sticky", group: "N" }, |
| 21 | + { symbol: "P", name: "Prose", group: "R" }, |
| 22 | + { symbol: "S", name: "Separator", group: "S" }, |
| 23 | + |
| 24 | + { symbol: "Cc", name: "Code.Content", group: "C" }, |
| 25 | + { symbol: "Ci", name: "Code.Inline", group: "C" }, |
| 26 | + |
| 27 | + { symbol: "Dt", name: "Details.Container", group: "D" }, |
| 28 | + { symbol: "Ds", name: "Details.Sumary", group: "D" }, |
| 29 | + |
| 30 | + { symbol: "Ul", name: "List.UL", group: "T" }, |
| 31 | + { symbol: "Ol", name: "List.OL", group: "T" }, |
| 32 | + |
| 33 | + { symbol: "B", name: "Body", group: "P" }, |
| 34 | + { symbol: "M", name: "Main", group: "P" }, |
| 35 | + { symbol: "H", name: "Header", group: "P" }, |
| 36 | + { symbol: "F", name: "Footer", group: "P" }, |
| 37 | + |
| 38 | + { symbol: "Bb", name: "Button.Brand", group: "B" }, |
| 39 | + { symbol: "Bp", name: "Button.Panel", group: "B" }, |
| 40 | + { symbol: "Bg", name: "Button.Page", group: "B" }, |
| 41 | + { symbol: "Be", name: "Button.Error", group: "B" }, |
| 42 | + |
| 43 | + { symbol: "H0", name: "H0", group: "H" }, |
| 44 | + { symbol: "H1", name: "H1", group: "H" }, |
| 45 | + { symbol: "H2", name: "H2", group: "H" }, |
| 46 | + { symbol: "H3", name: "H3", group: "H" }, |
| 47 | + |
| 48 | + { symbol: "Ib", name: "Input.Submit", group: "I" }, |
| 49 | + { symbol: "Ic", name: "Input.Container", group: "I" }, |
| 50 | + { symbol: "Ie", name: "Input.Error", group: "I" }, |
| 51 | + { symbol: "If", name: "Input.Fieldset", group: "I" }, |
| 52 | + { symbol: "Ig", name: "Input.Legend", group: "I" }, |
| 53 | + { symbol: "Ii", name: "Input.Field", group: "I" }, |
| 54 | + { symbol: "Ik", name: "Input.Check", group: "I" }, |
| 55 | + { symbol: "Il", name: "Input.Label", group: "I" }, |
| 56 | + { symbol: "Ir", name: "Input.Radio", group: "I" }, |
| 57 | + { symbol: "Is", name: "Input.Select", group: "I" }, |
| 58 | + { symbol: "It", name: "Input.Textarea", group: "I" }, |
| 59 | + { symbol: "Ix", name: "Input.Text", group: "I" }, |
| 60 | +]; |
| 61 | + |
| 62 | +export const atomGroupColors: Record<string, string> = { |
| 63 | + "A": clr.brand.bg_60, |
| 64 | + "X": clr.error.bg_50, |
| 65 | + "K": clr.panel.bg, |
| 66 | + "L": clr.panel.bg, |
| 67 | + "N": clr.error.bg_50, |
| 68 | + "R": clr.error.bg_50, |
| 69 | + "S": clr.error.bg_50, |
| 70 | + "C": clr.brand.bg_30, |
| 71 | + "D": clr.neutral.bg_10, |
| 72 | + "T": clr.panel.bg, |
| 73 | + "P": clr.error.bg_50, |
| 74 | + "B": clr.brand.bg_60, |
| 75 | + "H": clr.neutral.bg_25, |
| 76 | + "I": clr.panel.bg_50, |
| 77 | +}; |
| 78 | + |
| 79 | +export const periodicTable = periodt< |
| 80 | + { symbol: string; name: string; group: string } |
| 81 | +>( |
| 82 | + atoms, |
| 83 | + (atom) => atom.group, |
| 84 | + () => ({ symbol: "", name: "", group: "" }), |
| 85 | +); |
| 86 | + |
| 87 | +const moduleDocs = docJson.nodes.filter((node) => node.kind === "moduleDoc"); |
| 88 | + |
| 89 | +export const particleDocs = moduleDocs.find((doc) => |
| 90 | + doc.location.filename.includes("particles.ts") |
| 91 | +)?.jsDoc?.doc; |
| 92 | +export const atomDocs = moduleDocs.find((doc) => |
| 93 | + doc.location.filename.includes("atoms.ts") |
| 94 | +)?.jsDoc?.doc; |
| 95 | +export const moleculeDocs = moduleDocs.find((doc) => |
| 96 | + doc.location.filename.includes("molecules.ts") |
| 97 | +)?.jsDoc?.doc; |
0 commit comments