@godxjp/ui-mcp 0.4.2 → 0.5.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/dist/index.js CHANGED
@@ -1252,6 +1252,62 @@ function findRule(num) {
1252
1252
 
1253
1253
  // src/data/patterns.ts
1254
1254
  var PATTERNS = [
1255
+ {
1256
+ name: "common-fixes",
1257
+ tagline: "Fix the most common @godxjp/ui consumer mistakes & visual bugs (CardStat double-border, grey StatusBadge, crushed/empty table headers, washed-out sidebar footer, Inertia layout crash, SSR hydration). Before \u2192 after.",
1258
+ tags: ["fixes", "migration", "bug", "cardstat", "statusbadge", "datatable", "sidebar", "gotcha", "review"],
1259
+ code: `// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
1260
+ // 1) CardStat shows a DOUBLE border (too thick)
1261
+ // Cause: CardStat IS already a bordered Card. Don't wrap it.
1262
+ // \u274C <Card><CardContent><CardStat label="x" value="1" /></CardContent></Card>
1263
+ // \u2705 <ResponsiveGrid columns={4}><CardStat label="x" value="1" /></ResponsiveGrid>
1264
+ // Need a section title? Use a heading, NOT a Card:
1265
+ // \u2705 <Stack gap="sm"><div className="text-sm font-medium">KPI</div>
1266
+ // <ResponsiveGrid columns={4}><CardStat .../></ResponsiveGrid></Stack>
1267
+
1268
+ // 2) StatusBadge renders grey with a \u25CB (no colour) for localized/tier labels
1269
+ // Cause: it auto-maps only English lifecycle keys. (@godxjp/ui >= 6.1)
1270
+ // \u274C <StatusBadge status="\u30D7\u30EC\u30DF\u30A2\u30E0" />
1271
+ // \u2705 <StatusBadge status="\u30D7\u30EC\u30DF\u30A2\u30E0" tone="success" icon={null} /> // tier \u2192 pill, no icon
1272
+ // \u2705 <StatusBadge status="active" label="\u516C\u958B\u4E2D" /> // lifecycle \u2192 keep icon
1273
+
1274
+ // 3) Table text collapses to one char per line, or a chip wraps
1275
+ // Cause: pre-6.1.2. (@godxjp/ui >= 6.1.2 \u2192 cells + chips are nowrap)
1276
+ // \u2705 npm i @godxjp/ui@^6.2.0
1277
+ // \u2705 give long columns a width: { key: "name", header: "\u6C0F\u540D", width: "w-64" }
1278
+
1279
+ // 4) Empty (icon/action) column header shows a blank grey block
1280
+ // (@godxjp/ui >= 6.2.0 auto-hides it: [data-slot=table-head][data-empty] \u2192 transparent)
1281
+ // \u2705 npm i @godxjp/ui@^6.2.0 // header: "" now renders a transparent cell
1282
+
1283
+ // 5) DataTable columns are crushed / squeezed
1284
+ // Cause: the table is nested in a narrow grid column.
1285
+ // \u274C <ResponsiveGrid columns={3}><div className="lg:col-span-2"><Card><DataTable/></Card></div></ResponsiveGrid>
1286
+ // \u2705 Table gets its OWN full-width row: <Card><CardContent flush><DataTable/></CardContent></Card>
1287
+
1288
+ // 6) FilterBar has no padding (sticks to the edge)
1289
+ // Cause: it's inside CardContent flush (flush strips padding \u2014 that's for tables).
1290
+ // \u274C <Card><CardContent flush><FilterBar/><DataTable/></CardContent></Card>
1291
+ // \u2705 <FilterBar/> then <Card><CardContent flush><DataTable/></CardContent></Card>
1292
+
1293
+ // 7) Sidebar footer looks washed-out / off-design
1294
+ // Cause: raw opacity-*/text-[11px]. Use semantic tokens.
1295
+ // \u2705 <div className="text-muted-foreground text-xs">
1296
+ // <div className="text-foreground font-medium">{name}</div><div>{role}</div></div>
1297
+
1298
+ // 8) Inertia: "Objects are not valid as a React child {errors, auth, \u2026}"
1299
+ // Cause: persistent layout passed as a render fn. Use the ARRAY form.
1300
+ // \u274C Page.layout = (page) => <Layout>{page}</Layout>
1301
+ // \u2705 Page.layout = [Layout] // Layout is ({children}) => ...
1302
+
1303
+ // 9) Inertia v3 hydration mismatch ("server rendered text didn't match the client")
1304
+ // Cause: Math.random()/argless new Date() during render (SSR \u2260 client).
1305
+ // \u2705 seed deterministically by index, or compute in an event handler.
1306
+
1307
+ // 10) Hide a column on mobile / sign-aware KPI delta (@godxjp/ui >= 6.2.0)
1308
+ // \u2705 columns: [{ key: "email", header: "\u30E1\u30FC\u30EB", hiddenOnMobile: true }]
1309
+ // \u2705 <CardStat label="\u58F2\u4E0A" value="\xA58.2M" delta="+12%" /> // + green / - red; inverse flips`
1310
+ },
1255
1311
  {
1256
1312
  name: "signup-form",
1257
1313
  tagline: "Card-wrapped sign-up form using react-hook-form + zod with FormField/Input and a CardFooter action bar (real @godxjp/ui API).",