Loading...
Loading...
Compare original and translation side by side
// Get full frame tree
mcp__pencil__batch_get({
filePath: "<path>.pen",
nodeIds: ["frameId"],
readDepth: 10,
resolveInstances: true,
resolveVariables: true
})
// Get design variables/theme
mcp__pencil__get_variables({ filePath: "<path>.pen" })// Get full frame tree
mcp__pencil__batch_get({
filePath: "<path>.pen",
nodeIds: ["frameId"],
readDepth: 10,
resolveInstances: true,
resolveVariables: true
})
// Get design variables/theme
mcp__pencil__get_variables({ filePath: "<path>.pen" })/* From .pen variables */
@theme {
--color-primary: [from variables.colors.primary];
--color-background: [from variables.colors.background];
--font-sans: [from variables.fonts.body];
/* ... */
}references/token-extraction.md/* From .pen variables */
@theme {
--color-primary: [from variables.colors.primary];
--color-background: [from variables.colors.background];
--font-sans: [from variables.fonts.body];
/* ... */
}references/token-extraction.md| .pen Node Type | React Output |
|---|---|
| |
| Component with children |
| |
| Reusable component |
| |
| |
| |
references/node-mapping.md| .pen节点类型 | React输出 |
|---|---|
| |
| 包含子元素的组件 |
| |
| 可复用组件 |
| 带有填充的 |
| |
| |
references/node-mapping.md// components/[ComponentName].tsx
import { cn } from "@/lib/utils"
interface [ComponentName]Props {
className?: string
// Extracted props from design
}
export function [ComponentName]({ className, ...props }: [ComponentName]Props) {
return (
<div className={cn("[tailwind classes]", className)}>
{/* Nested structure */}
</div>
)
}.pen property → Tailwind class
--------------------------------
fill: #000 → bg-black
layout: horizontal → flex flex-row
gap: 16 → gap-4
padding: [16,24,16,24] → py-4 px-6
fontSize: 24 → text-2xl
fontWeight: 700 → font-bold
cornerRadius: [8,8,8,8] → rounded-lg// components/[ComponentName].tsx
import { cn } from "@/lib/utils"
interface [ComponentName]Props {
className?: string
// Extracted props from design
}
export function [ComponentName]({ className, ...props }: [ComponentName]Props) {
return (
<div className={cn("[tailwind classes]", className)}>
{/* Nested structure */}
</div>
)
}.pen属性 → Tailwind类
--------------------------------
fill: #000 → bg-black
layout: horizontal → flex flex-row
gap: 16 → gap-4
padding: [16,24,16,24] → py-4 px-6
fontSize: 24 → text-2xl
fontWeight: 700 → font-bold
cornerRadius: [8,8,8,8] → rounded-lg// Screenshot the .pen frame
mcp__pencil__get_screenshot({ nodeId: "frameId" })
// Compare visually with rendered React
// (Manual step or browser automation)// Screenshot the .pen frame
mcp__pencil__get_screenshot({ nodeId: "frameId" })
// Compare visually with rendered React
// (Manual step or browser automation)undefinedundefinedcomponents/[ComponentName].tsxcomponents/[ComponentName].tsxapp/globals.cssapp/globals.cssundefinedundefined.pen Tailwind
--------------------------------------
layout: "vertical" → flex flex-col
layout: "horizontal" → flex flex-row
layout: "grid" → grid
alignItems: "center" → items-center
justifyContent: "center" → justify-center
gap: 8 → gap-2
gap: 16 → gap-4
gap: 24 → gap-6
width: "fill_container" → w-full
height: "fill_container" → h-full.pen Tailwind
--------------------------------------
layout: "vertical" → flex flex-col
layout: "horizontal" → flex flex-row
layout: "grid" → grid
alignItems: "center" → items-center
justifyContent: "center" → justify-center
gap: 8 → gap-2
gap: 16 → gap-4
gap: 24 → gap-6
width: "fill_container" → w-full
height: "fill_container" → h-full.pen padding Tailwind
----------------------------------------
[8,8,8,8] → p-2
[16,16,16,16] → p-4
[16,24,16,24] → py-4 px-6
[24,32,24,32] → py-6 px-8.pen padding Tailwind
----------------------------------------
[8,8,8,8] → p-2
[16,16,16,16] → p-4
[16,24,16,24] → py-4 px-6
[24,32,24,32] → py-6 px-8.pen Tailwind
----------------------------------------
fontSize: 12 → text-xs
fontSize: 14 → text-sm
fontSize: 16 → text-base
fontSize: 20 → text-xl
fontSize: 24 → text-2xl
fontSize: 32 → text-3xl
fontSize: 48 → text-5xl
fontWeight: 400 → font-normal
fontWeight: 500 → font-medium
fontWeight: 600 → font-semibold
fontWeight: 700 → font-bold.pen Tailwind
----------------------------------------
fontSize: 12 → text-xs
fontSize: 14 → text-sm
fontSize: 16 → text-base
fontSize: 20 → text-xl
fontSize: 24 → text-2xl
fontSize: 32 → text-3xl
fontSize: 48 → text-5xl
fontWeight: 400 → font-normal
fontWeight: 500 → font-medium
fontWeight: 600 → font-semibold
fontWeight: 700 → font-bold.pen Tailwind
----------------------------------------
fill: "#FFFFFF" → bg-white
fill: "#000000" → bg-black
fill: variable → bg-[var(--color-name)]
textColor: "#6B7280" → text-gray-500
stroke: "#E5E5E5" → border-gray-200.pen Tailwind
----------------------------------------
fill: "#FFFFFF" → bg-white
fill: "#000000" → bg-black
fill: variable → bg-[var(--color-name)]
textColor: "#6B7280" → text-gray-500
stroke: "#E5E5E5" → border-gray-200.pen cornerRadius Tailwind
----------------------------------------
[0,0,0,0] → rounded-none
[4,4,4,4] → rounded
[8,8,8,8] → rounded-lg
[16,16,16,16] → rounded-2xl
[9999,9999,9999,9999] → rounded-full.pen cornerRadius Tailwind
----------------------------------------
[0,0,0,0] → rounded-none
[4,4,4,4] → rounded
[8,8,8,8] → rounded-lg
[16,16,16,16] → rounded-2xl
[9999,9999,9999,9999] → rounded-fullreferences/node-mapping.mdreferences/token-extraction.mddesign-tokens/references/node-mapping.mdreferences/token-extraction.mddesign-tokens/design-explorationdesign-tokensdesign-explorationdesign-tokens