@fragments-sdk/cli 0.8.1 → 0.9.1
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/bin.js +517 -77
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-WI6SLMSO.js → chunk-5GT62FCB.js} +2 -2
- package/dist/{chunk-CJEGT3WD.js → chunk-BW3ZATBW.js} +20 -3
- package/dist/chunk-BW3ZATBW.js.map +1 -0
- package/dist/{chunk-2JIKCJX3.js → chunk-D7372LQX.js} +13 -6
- package/dist/chunk-D7372LQX.js.map +1 -0
- package/dist/chunk-EZYXYWNF.js +131 -0
- package/dist/chunk-EZYXYWNF.js.map +1 -0
- package/dist/{chunk-NGIMCIK2.js → chunk-GF6OVPIN.js} +2 -2
- package/dist/{chunk-GOVI6COW.js → chunk-NVSPGSKB.js} +12 -4
- package/dist/chunk-NVSPGSKB.js.map +1 -0
- package/dist/core/index.d.ts +105 -3
- package/dist/core/index.js +12 -2
- package/dist/{defineFragment-D0UTve-I.d.ts → defineFragment-CBMS7Bab.d.ts} +21 -1
- package/dist/generate-LQA2R7FN.js +461 -0
- package/dist/generate-LQA2R7FN.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/{init-KFYN37ZY.js → init-2GEGVIUQ.js} +14 -76
- package/dist/init-2GEGVIUQ.js.map +1 -0
- package/dist/mcp-bin.js +4 -3
- package/dist/mcp-bin.js.map +1 -1
- package/dist/{scan-65RH3QMM.js → scan-JGS65S7P.js} +6 -5
- package/dist/{service-A5GIGGGK.js → service-XP2EAJXD.js} +4 -3
- package/dist/{static-viewer-NSODM5VX.js → static-viewer-XCS7UJTO.js} +4 -3
- package/dist/storyFilters-3LUYAFZF.js +15 -0
- package/dist/storyFilters-3LUYAFZF.js.map +1 -0
- package/dist/{test-RPWZAYSJ.js → test-TD6TJNVY.js} +3 -3
- package/dist/{tokens-NIXSZRX7.js → tokens-2EXPCVP3.js} +5 -4
- package/dist/{tokens-NIXSZRX7.js.map → tokens-2EXPCVP3.js.map} +1 -1
- package/dist/{viewer-HZK4BSDK.js → viewer-RFA2KVBG.js} +249 -22
- package/dist/viewer-RFA2KVBG.js.map +1 -0
- package/package.json +2 -2
- package/src/bin.ts +26 -0
- package/src/build.ts +12 -2
- package/src/commands/build.ts +16 -2
- package/src/commands/doctor.ts +498 -0
- package/src/commands/generate.ts +383 -68
- package/src/commands/init-framework.ts +1 -1
- package/src/commands/init.ts +9 -51
- package/src/core/config.ts +15 -2
- package/src/core/generators/typescript-extractor.ts +10 -0
- package/src/core/index.ts +15 -0
- package/src/core/schema.ts +10 -2
- package/src/core/storyFilters.test.ts +350 -0
- package/src/core/storyFilters.ts +253 -0
- package/src/core/types.ts +22 -0
- package/src/migrate/converter.ts +9 -1
- package/src/migrate/parser.ts +2 -0
- package/src/migrate/types.ts +2 -0
- package/src/setup.ts +69 -24
- package/src/viewer/__tests__/viewer-integration.test.ts +1 -1
- package/src/viewer/components/AccessibilityPanel.tsx +305 -312
- package/src/viewer/components/ActionsPanel.tsx +31 -29
- package/src/viewer/components/AllVariantsPreview.tsx +78 -0
- package/src/viewer/components/App.tsx +187 -740
- package/src/viewer/components/BottomPanel.tsx +228 -132
- package/src/viewer/components/CodePanel.tsx +1 -1
- package/src/viewer/components/CommandPalette.tsx +7 -10
- package/src/viewer/components/ComponentDocView.tsx +164 -0
- package/src/viewer/components/ComponentGraph.tsx +111 -142
- package/src/viewer/components/ContractPanel.tsx +6 -6
- package/src/viewer/components/EmptyVariantMessage.tsx +54 -0
- package/src/viewer/components/FigmaEmbed.tsx +20 -18
- package/src/viewer/components/FragmentEditor.tsx +92 -115
- package/src/viewer/components/HeaderSearch.tsx +24 -0
- package/src/viewer/components/HealthDashboard.tsx +16 -2
- package/src/viewer/components/Icons.tsx +9 -0
- package/src/viewer/components/InteractionsPanel.tsx +101 -117
- package/src/viewer/components/IsolatedPreviewFrame.tsx +1 -0
- package/src/viewer/components/LandingPage.tsx +3 -3
- package/src/viewer/components/LeftSidebar.tsx +141 -63
- package/src/viewer/components/LoadErrorMessage.tsx +102 -0
- package/src/viewer/components/MultiViewportPreview.tsx +61 -142
- package/src/viewer/components/NoVariantsMessage.tsx +59 -0
- package/src/viewer/components/PanelShell.tsx +161 -0
- package/src/viewer/components/PerformancePanel.tsx +31 -28
- package/src/viewer/components/PreviewArea.tsx +1 -1
- package/src/viewer/components/PreviewAside.tsx +168 -0
- package/src/viewer/components/PreviewFrameHost.tsx +3 -3
- package/src/viewer/components/PropsEditor.tsx +70 -156
- package/src/viewer/components/ResizablePanel.tsx +103 -263
- package/src/viewer/components/RightSidebar.tsx +3 -9
- package/src/viewer/components/SkeletonLoader.tsx +13 -13
- package/src/viewer/components/TokenStylePanel.tsx +182 -209
- package/src/viewer/components/TopToolbar.tsx +159 -0
- package/src/viewer/components/VariantMatrix.tsx +42 -86
- package/src/viewer/components/VariantTabs.tsx +3 -3
- package/src/viewer/components/ViewerHeader.tsx +69 -0
- package/src/viewer/components/WebMCPDevTools.tsx +17 -23
- package/src/viewer/components/viewer-utils.ts +16 -0
- package/src/viewer/entry.tsx +5 -0
- package/src/viewer/hooks/useAppState.ts +27 -4
- package/src/viewer/hooks/usePreviewBridge.ts +2 -2
- package/src/viewer/preview-frame.html +6 -12
- package/src/viewer/server.ts +184 -6
- package/src/viewer/vendor/shared/src/ComponentDocContent.module.scss +10 -0
- package/src/viewer/vendor/shared/src/ComponentDocContent.module.scss.d.ts +2 -0
- package/src/viewer/vendor/shared/src/ComponentDocContent.tsx +274 -0
- package/src/viewer/vendor/shared/src/DocsPageShell.tsx +5 -0
- package/src/viewer/vendor/shared/src/PropsTable.module.scss +68 -0
- package/src/viewer/vendor/shared/src/PropsTable.module.scss.d.ts +2 -0
- package/src/viewer/vendor/shared/src/PropsTable.tsx +76 -0
- package/src/viewer/vendor/shared/src/VariantPreviewCard.module.scss +122 -0
- package/src/viewer/vendor/shared/src/VariantPreviewCard.module.scss.d.ts +2 -0
- package/src/viewer/vendor/shared/src/VariantPreviewCard.tsx +134 -0
- package/src/viewer/vendor/shared/src/docs-data/index.ts +32 -0
- package/src/viewer/vendor/shared/src/docs-data/mcp-configs.ts +72 -0
- package/src/viewer/vendor/shared/src/docs-data/palettes.ts +75 -0
- package/src/viewer/vendor/shared/src/docs-data/setup-examples.ts +55 -0
- package/src/viewer/vendor/shared/src/index.ts +8 -0
- package/src/viewer/vendor/shared/src/types.ts +12 -0
- package/src/viewer/vite-plugin.ts +109 -4
- package/dist/chunk-2JIKCJX3.js.map +0 -1
- package/dist/chunk-CJEGT3WD.js.map +0 -1
- package/dist/chunk-GOVI6COW.js.map +0 -1
- package/dist/generate-35OIMW4Y.js +0 -252
- package/dist/generate-35OIMW4Y.js.map +0 -1
- package/dist/init-KFYN37ZY.js.map +0 -1
- package/dist/viewer-HZK4BSDK.js.map +0 -1
- /package/dist/{chunk-WI6SLMSO.js.map → chunk-5GT62FCB.js.map} +0 -0
- /package/dist/{chunk-NGIMCIK2.js.map → chunk-GF6OVPIN.js.map} +0 -0
- /package/dist/{scan-65RH3QMM.js.map → scan-JGS65S7P.js.map} +0 -0
- /package/dist/{service-A5GIGGGK.js.map → service-XP2EAJXD.js.map} +0 -0
- /package/dist/{static-viewer-NSODM5VX.js.map → static-viewer-XCS7UJTO.js.map} +0 -0
- /package/dist/{test-RPWZAYSJ.js.map → test-TD6TJNVY.js.map} +0 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Badge } from '@fragments-sdk/ui';
|
|
4
|
+
import type { DocProp } from './types';
|
|
5
|
+
import styles from './PropsTable.module.scss';
|
|
6
|
+
|
|
7
|
+
/** Detect auto-generated descriptions like "variant prop" */
|
|
8
|
+
function isGenericPropDescription(name: string, description: string): boolean {
|
|
9
|
+
const lower = description.toLowerCase().trim();
|
|
10
|
+
return lower === `${name.toLowerCase()} prop` || lower === `${name.toLowerCase()} property`;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface PropsTableProps {
|
|
14
|
+
props: Record<string, DocProp>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function PropsTable({ props }: PropsTableProps) {
|
|
18
|
+
const propEntries = Object.entries(props);
|
|
19
|
+
|
|
20
|
+
if (propEntries.length === 0) {
|
|
21
|
+
return <p className={styles.empty}>No props documented</p>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className={styles.container}>
|
|
26
|
+
<table className={styles.table}>
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
<th>Prop</th>
|
|
30
|
+
<th>Type</th>
|
|
31
|
+
<th>Default</th>
|
|
32
|
+
<th>Description</th>
|
|
33
|
+
</tr>
|
|
34
|
+
</thead>
|
|
35
|
+
<tbody>
|
|
36
|
+
{propEntries.map(([name, prop]) => (
|
|
37
|
+
<tr key={name}>
|
|
38
|
+
<td>
|
|
39
|
+
<span className={styles.propName}>
|
|
40
|
+
<code>{name}</code>
|
|
41
|
+
{prop.required && (
|
|
42
|
+
<Badge size="sm" variant="error">
|
|
43
|
+
Required
|
|
44
|
+
</Badge>
|
|
45
|
+
)}
|
|
46
|
+
</span>
|
|
47
|
+
</td>
|
|
48
|
+
<td>
|
|
49
|
+
<span className={styles.type}>
|
|
50
|
+
<code>{prop.type}</code>
|
|
51
|
+
{prop.values && (
|
|
52
|
+
<span className={styles.values}>
|
|
53
|
+
{prop.values.map((v) => (
|
|
54
|
+
<code key={v} className={styles.value}>
|
|
55
|
+
{v}
|
|
56
|
+
</code>
|
|
57
|
+
))}
|
|
58
|
+
</span>
|
|
59
|
+
)}
|
|
60
|
+
</span>
|
|
61
|
+
</td>
|
|
62
|
+
<td>
|
|
63
|
+
{prop.default !== undefined ? (
|
|
64
|
+
<code className={styles.default}>{String(prop.default)}</code>
|
|
65
|
+
) : (
|
|
66
|
+
<span className={styles.noDefault}>Not set</span>
|
|
67
|
+
)}
|
|
68
|
+
</td>
|
|
69
|
+
<td>{prop.description && !isGenericPropDescription(name, prop.description) ? prop.description : '—'}</td>
|
|
70
|
+
</tr>
|
|
71
|
+
))}
|
|
72
|
+
</tbody>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Shared variant preview card — used by docs and CLI viewer
|
|
2
|
+
.card {
|
|
3
|
+
border: 1px solid var(--fui-border);
|
|
4
|
+
border-radius: var(--fui-radius-lg);
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background-color: var(--fui-bg-primary);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.highlighted {
|
|
10
|
+
border-color: var(--fui-color-accent);
|
|
11
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--fui-color-accent) 40%, transparent);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.header {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: space-between;
|
|
18
|
+
gap: var(--fui-space-4);
|
|
19
|
+
padding: var(--fui-space-2) var(--fui-space-4);
|
|
20
|
+
background-color: var(--fui-bg-primary);
|
|
21
|
+
border-bottom: 1px solid var(--fui-border);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.headerContent {
|
|
25
|
+
flex: 1;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.title {
|
|
30
|
+
font-size: var(--fui-font-size-sm);
|
|
31
|
+
font-weight: var(--fui-font-weight-semibold);
|
|
32
|
+
color: var(--fui-text-primary);
|
|
33
|
+
margin: 0;
|
|
34
|
+
line-height: 1.4;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.description {
|
|
38
|
+
font-size: var(--fui-font-size-xs);
|
|
39
|
+
color: var(--fui-text-tertiary);
|
|
40
|
+
margin: var(--fui-space-0-5) 0 0 0;
|
|
41
|
+
line-height: 1.4;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Preview area with subtle dotted grid pattern
|
|
45
|
+
.previewPanel {
|
|
46
|
+
position: relative;
|
|
47
|
+
min-height: 400px;
|
|
48
|
+
padding: var(--fui-space-4);
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
align-items: stretch;
|
|
52
|
+
background-color: var(--fui-bg-primary);
|
|
53
|
+
|
|
54
|
+
// Subtle dotted grid pattern
|
|
55
|
+
background-image: radial-gradient(circle, var(--fui-border) 1px, transparent 1px);
|
|
56
|
+
background-size: 24px 24px;
|
|
57
|
+
|
|
58
|
+
> * {
|
|
59
|
+
width: 100%;
|
|
60
|
+
flex: 1;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Code panel
|
|
65
|
+
.codePanel {
|
|
66
|
+
background-color: var(--fui-bg-tertiary);
|
|
67
|
+
padding: 0 !important; // Override Tabs panel padding
|
|
68
|
+
|
|
69
|
+
// Override CodeBlock styles for embedded use
|
|
70
|
+
:global([class*="CodeBlock_container"]) {
|
|
71
|
+
border: none;
|
|
72
|
+
border-radius: 0;
|
|
73
|
+
margin: 0;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
:global([class*="CodeBlock_wrapper"]) {
|
|
77
|
+
border-top-left-radius: 0;
|
|
78
|
+
border-top-right-radius: 0;
|
|
79
|
+
border: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:global([class*="CodeBlock_title"]) {
|
|
83
|
+
display: none;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.placeholder {
|
|
88
|
+
color: var(--fui-text-tertiary);
|
|
89
|
+
font-style: italic;
|
|
90
|
+
font-size: var(--fui-font-size-sm);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.headerActions {
|
|
94
|
+
display: flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
gap: var(--fui-space-2);
|
|
97
|
+
flex-shrink: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Override Tabs styling for preview cards
|
|
101
|
+
.card {
|
|
102
|
+
:global([class*="Tabs_root"]) {
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Tabs list sits inline with header
|
|
108
|
+
:global([class*="Tabs_list"]) {
|
|
109
|
+
padding: 0;
|
|
110
|
+
border-bottom: none;
|
|
111
|
+
background-color: transparent;
|
|
112
|
+
flex-shrink: 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:global([class*="Tabs_listPills"]) {
|
|
116
|
+
margin: 0;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:global([class*="Tabs_panel"]) {
|
|
120
|
+
padding: 0;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
import { CodeBlock, Tabs } from '@fragments-sdk/ui';
|
|
5
|
+
import styles from './VariantPreviewCard.module.scss';
|
|
6
|
+
|
|
7
|
+
/** Detect auto-generated descriptions like "Alternative Layout variant" or "Default ActionMenu" */
|
|
8
|
+
function isGenericVariantDescription(name: string, description: string): boolean {
|
|
9
|
+
const lower = description.toLowerCase().trim();
|
|
10
|
+
const nameLower = name.toLowerCase().trim();
|
|
11
|
+
return (
|
|
12
|
+
lower === `${nameLower} variant` ||
|
|
13
|
+
lower === `default ${nameLower}` ||
|
|
14
|
+
lower === nameLower ||
|
|
15
|
+
// "Default SomeComponent" — "Default" followed by a PascalCase component name
|
|
16
|
+
/^default [a-z][a-z0-9]*$/i.test(description.trim())
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface VariantPreviewCardProps {
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
code?: string;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
isLoading?: boolean;
|
|
26
|
+
error?: string | null;
|
|
27
|
+
defaultTab?: 'preview' | 'code';
|
|
28
|
+
highlight?: boolean;
|
|
29
|
+
id?: string;
|
|
30
|
+
headerActions?: ReactNode;
|
|
31
|
+
className?: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function VariantPreviewCard({
|
|
35
|
+
name,
|
|
36
|
+
description,
|
|
37
|
+
code,
|
|
38
|
+
children,
|
|
39
|
+
isLoading,
|
|
40
|
+
error,
|
|
41
|
+
defaultTab = 'preview',
|
|
42
|
+
highlight,
|
|
43
|
+
id,
|
|
44
|
+
headerActions,
|
|
45
|
+
className,
|
|
46
|
+
}: VariantPreviewCardProps) {
|
|
47
|
+
const cardClassName = [
|
|
48
|
+
styles.card,
|
|
49
|
+
highlight && styles.highlighted,
|
|
50
|
+
className,
|
|
51
|
+
]
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.join(' ');
|
|
54
|
+
|
|
55
|
+
const hasPreview = !!children;
|
|
56
|
+
const hasCode = typeof code === 'string' && code.length > 0;
|
|
57
|
+
|
|
58
|
+
// No preview, code only — render without tabs
|
|
59
|
+
if (!hasPreview && hasCode) {
|
|
60
|
+
return (
|
|
61
|
+
<div className={cardClassName} id={id}>
|
|
62
|
+
<div className={styles.header}>
|
|
63
|
+
<div className={styles.headerContent}>
|
|
64
|
+
<h3 className={styles.title}>{name}</h3>
|
|
65
|
+
{description && !isGenericVariantDescription(name, description) && <p className={styles.description}>{description}</p>}
|
|
66
|
+
</div>
|
|
67
|
+
{headerActions && <div className={styles.headerActions}>{headerActions}</div>}
|
|
68
|
+
</div>
|
|
69
|
+
<div className={styles.codePanel}>
|
|
70
|
+
<CodeBlock code={code} language="tsx" />
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// No code — render preview only, no tabs
|
|
77
|
+
if (!hasCode) {
|
|
78
|
+
return (
|
|
79
|
+
<div className={cardClassName} id={id}>
|
|
80
|
+
<div className={styles.header}>
|
|
81
|
+
<div className={styles.headerContent}>
|
|
82
|
+
<h3 className={styles.title}>{name}</h3>
|
|
83
|
+
{description && !isGenericVariantDescription(name, description) && <p className={styles.description}>{description}</p>}
|
|
84
|
+
</div>
|
|
85
|
+
{headerActions && <div className={styles.headerActions}>{headerActions}</div>}
|
|
86
|
+
</div>
|
|
87
|
+
<div className={styles.previewPanel}>
|
|
88
|
+
{isLoading ? (
|
|
89
|
+
<div className={styles.placeholder}>Loading preview...</div>
|
|
90
|
+
) : error ? (
|
|
91
|
+
<div className={styles.placeholder}>Preview error: {error}</div>
|
|
92
|
+
) : (
|
|
93
|
+
children
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
</div>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Both preview and code — render with tabs
|
|
101
|
+
return (
|
|
102
|
+
<div className={cardClassName} id={id}>
|
|
103
|
+
<Tabs defaultValue={defaultTab}>
|
|
104
|
+
<div className={styles.header}>
|
|
105
|
+
<div className={styles.headerContent}>
|
|
106
|
+
<h3 className={styles.title}>{name}</h3>
|
|
107
|
+
{description && !isGenericVariantDescription(name, description) && <p className={styles.description}>{description}</p>}
|
|
108
|
+
</div>
|
|
109
|
+
<div className={styles.headerActions}>
|
|
110
|
+
{headerActions}
|
|
111
|
+
<Tabs.List variant="pills">
|
|
112
|
+
<Tabs.Tab value="preview">Preview</Tabs.Tab>
|
|
113
|
+
<Tabs.Tab value="code">Code</Tabs.Tab>
|
|
114
|
+
</Tabs.List>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<Tabs.Panel value="preview" className={styles.previewPanel}>
|
|
119
|
+
{isLoading ? (
|
|
120
|
+
<div className={styles.placeholder}>Loading preview...</div>
|
|
121
|
+
) : error ? (
|
|
122
|
+
<div className={styles.placeholder}>Preview error: {error}</div>
|
|
123
|
+
) : (
|
|
124
|
+
children
|
|
125
|
+
)}
|
|
126
|
+
</Tabs.Panel>
|
|
127
|
+
|
|
128
|
+
<Tabs.Panel value="code" className={styles.codePanel}>
|
|
129
|
+
<CodeBlock code={code} language="tsx" />
|
|
130
|
+
</Tabs.Panel>
|
|
131
|
+
</Tabs>
|
|
132
|
+
</div>
|
|
133
|
+
);
|
|
134
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docs data — single source of truth for content shared across
|
|
3
|
+
* READMEs, docs pages, and MCP tool descriptions.
|
|
4
|
+
*
|
|
5
|
+
* Follows the same pattern as `cli-commands/index.ts`.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
NEUTRAL_PALETTES,
|
|
10
|
+
DENSITY_PRESETS,
|
|
11
|
+
RADIUS_STYLES,
|
|
12
|
+
SEED_DEFAULTS,
|
|
13
|
+
type PaletteDef,
|
|
14
|
+
type DensityDef,
|
|
15
|
+
type RadiusDef,
|
|
16
|
+
} from './palettes.js';
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
SCSS_SETUP_MINIMAL,
|
|
20
|
+
SCSS_SETUP_FULL,
|
|
21
|
+
USE_THEME_EXAMPLE,
|
|
22
|
+
USE_THEME_RETURN_SHAPE,
|
|
23
|
+
PROVIDER_SETUP_EXAMPLE,
|
|
24
|
+
MIXIN_IMPORT,
|
|
25
|
+
STYLES_IMPORT_JS,
|
|
26
|
+
STYLES_IMPORT_SCSS,
|
|
27
|
+
} from './setup-examples.js';
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
MCP_CONFIGS,
|
|
31
|
+
type McpConfigDef,
|
|
32
|
+
} from './mcp-configs.js';
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server configuration examples per AI tool.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for all READMEs and docs pages
|
|
5
|
+
* that show how to configure the Fragments MCP server.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export interface McpConfigDef {
|
|
9
|
+
/** AI tool name (e.g., "Claude Code", "Cursor") */
|
|
10
|
+
tool: string;
|
|
11
|
+
/** Config file path */
|
|
12
|
+
filePath: string;
|
|
13
|
+
/** JSON config string (with comment header) */
|
|
14
|
+
config: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const npxArgs = `["-y", "@fragments-sdk/mcp@latest"]`;
|
|
18
|
+
|
|
19
|
+
export const MCP_CONFIGS: McpConfigDef[] = [
|
|
20
|
+
{
|
|
21
|
+
tool: 'Claude Code',
|
|
22
|
+
filePath: '.mcp.json',
|
|
23
|
+
config: `// .mcp.json (project root)
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"fragments": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": ${npxArgs}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}`,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
tool: 'Cursor',
|
|
35
|
+
filePath: '.cursor/mcp.json',
|
|
36
|
+
config: `// .cursor/mcp.json
|
|
37
|
+
{
|
|
38
|
+
"mcpServers": {
|
|
39
|
+
"fragments": {
|
|
40
|
+
"command": "npx",
|
|
41
|
+
"args": ${npxArgs}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
tool: 'VS Code',
|
|
48
|
+
filePath: '.vscode/mcp.json',
|
|
49
|
+
config: `// .vscode/mcp.json
|
|
50
|
+
{
|
|
51
|
+
"servers": {
|
|
52
|
+
"fragments": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ${npxArgs}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}`,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
tool: 'Windsurf',
|
|
61
|
+
filePath: '~/.codeium/windsurf/mcp_config.json',
|
|
62
|
+
config: `// ~/.codeium/windsurf/mcp_config.json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"fragments": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ${npxArgs}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}`,
|
|
71
|
+
},
|
|
72
|
+
];
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Design token seed definitions — single source of truth.
|
|
3
|
+
*
|
|
4
|
+
* Values must match libs/ui/src/tokens/_seeds.scss exactly.
|
|
5
|
+
* READMEs, docs pages, and MCP tool descriptions are generated from these.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Types
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
export interface PaletteDef {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DensityDef {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly baseUnit: string;
|
|
20
|
+
readonly description: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface RadiusDef {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly description: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// Neutral Palettes (must match _seeds.scss:27)
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
export const NEUTRAL_PALETTES: PaletteDef[] = [
|
|
33
|
+
{ name: 'stone', description: 'Cool gray neutrals (balanced, professional) — default' },
|
|
34
|
+
{ name: 'ice', description: 'Cool blue-tinted grays (crisp, technical)' },
|
|
35
|
+
{ name: 'earth', description: 'Warm brown-tinted grays (natural, grounded)' },
|
|
36
|
+
{ name: 'sand', description: 'Warm tan-tinted grays (organic, approachable)' },
|
|
37
|
+
{ name: 'fire', description: 'Warm red-tinted grays (bold, energetic)' },
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Density Presets (must match _seeds.scss:32)
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
|
|
44
|
+
export const DENSITY_PRESETS: readonly DensityDef[] = [
|
|
45
|
+
{ name: 'compact', baseUnit: '6px', description: 'Tighter spacing, smaller elements' },
|
|
46
|
+
{ name: 'default', baseUnit: '7px', description: 'Balanced, standard appearance' },
|
|
47
|
+
{ name: 'relaxed', baseUnit: '8px', description: 'More spacious layout' },
|
|
48
|
+
] as const;
|
|
49
|
+
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Radius Styles (must match _seeds.scss:37)
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
|
|
54
|
+
export const RADIUS_STYLES: readonly RadiusDef[] = [
|
|
55
|
+
{ name: 'sharp', description: 'No rounding (technical, precise)' },
|
|
56
|
+
{ name: 'subtle', description: 'Minimal rounding (modern minimal)' },
|
|
57
|
+
{ name: 'default', description: 'Balanced rounding' },
|
|
58
|
+
{ name: 'rounded', description: 'More prominent (friendly)' },
|
|
59
|
+
{ name: 'pill', description: 'Maximum rounding (playful, soft)' },
|
|
60
|
+
] as const;
|
|
61
|
+
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Seed Defaults (must match _seeds.scss)
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
export const SEED_DEFAULTS = {
|
|
67
|
+
brand: '#18181b',
|
|
68
|
+
neutral: 'stone',
|
|
69
|
+
density: 'default',
|
|
70
|
+
radiusStyle: 'default',
|
|
71
|
+
danger: '#ef4444',
|
|
72
|
+
success: '#22c55e',
|
|
73
|
+
warning: '#f59e0b',
|
|
74
|
+
info: '#3b82f6',
|
|
75
|
+
} as const;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Correct code examples for setup documentation.
|
|
3
|
+
*
|
|
4
|
+
* These are the canonical snippets used across READMEs and docs pages.
|
|
5
|
+
* If you change a pattern here, all generated docs update automatically.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// SCSS Setup
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
/** Minimal SCSS setup — @use with() syntax, not standalone variables */
|
|
13
|
+
export const SCSS_SETUP_MINIMAL = `@use '@fragments-sdk/ui/styles' with (
|
|
14
|
+
$fui-brand: #0066ff
|
|
15
|
+
);`;
|
|
16
|
+
|
|
17
|
+
/** Full SCSS setup with all seeds */
|
|
18
|
+
export const SCSS_SETUP_FULL = `@use '@fragments-sdk/ui/styles' with (
|
|
19
|
+
$fui-brand: #0066ff,
|
|
20
|
+
$fui-neutral: "ice",
|
|
21
|
+
$fui-density: "compact",
|
|
22
|
+
$fui-radius-style: "rounded"
|
|
23
|
+
);`;
|
|
24
|
+
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
// Theme API
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
|
|
29
|
+
/** Correct useTheme() API — mode/setMode, NOT theme/setTheme */
|
|
30
|
+
export const USE_THEME_EXAMPLE = `const { mode, setMode } = useTheme();`;
|
|
31
|
+
|
|
32
|
+
/** Full useTheme return shape */
|
|
33
|
+
export const USE_THEME_RETURN_SHAPE = `interface UseThemeReturn {
|
|
34
|
+
mode: ThemeMode;
|
|
35
|
+
setMode: (mode: ThemeMode) => void;
|
|
36
|
+
resolvedMode: 'light' | 'dark';
|
|
37
|
+
systemPreference: 'light' | 'dark';
|
|
38
|
+
toggleMode: () => void;
|
|
39
|
+
}`;
|
|
40
|
+
|
|
41
|
+
/** Canonical ThemeProvider prop — defaultMode, NOT defaultTheme */
|
|
42
|
+
export const PROVIDER_SETUP_EXAMPLE = `<ThemeProvider defaultMode="system">`;
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Import Paths
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/** Correct mixin import path (NOT /tokens) */
|
|
49
|
+
export const MIXIN_IMPORT = `@use '@fragments-sdk/ui/mixins' as *;`;
|
|
50
|
+
|
|
51
|
+
/** Correct styles import — JS side */
|
|
52
|
+
export const STYLES_IMPORT_JS = `import '@fragments-sdk/ui/styles';`;
|
|
53
|
+
|
|
54
|
+
/** Correct styles import — SCSS side */
|
|
55
|
+
export const STYLES_IMPORT_SCSS = `@use '@fragments-sdk/ui/styles'`;
|
|
@@ -24,3 +24,11 @@ export type {
|
|
|
24
24
|
HeaderNavDropdown,
|
|
25
25
|
} from './types';
|
|
26
26
|
export { isDropdown } from './types';
|
|
27
|
+
|
|
28
|
+
export { VariantPreviewCard } from './VariantPreviewCard';
|
|
29
|
+
export type { VariantPreviewCardProps } from './VariantPreviewCard';
|
|
30
|
+
|
|
31
|
+
export { PropsTable } from './PropsTable';
|
|
32
|
+
export { ComponentDocContent } from './ComponentDocContent';
|
|
33
|
+
export type { ComponentDocContentProps } from './ComponentDocContent';
|
|
34
|
+
export type { DocProp } from './types';
|
|
@@ -39,3 +39,15 @@ export type HeaderNavEntry = HeaderNavLink | HeaderNavDropdown;
|
|
|
39
39
|
export function isDropdown(entry: HeaderNavEntry): entry is HeaderNavDropdown {
|
|
40
40
|
return 'items' in entry;
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Prop documentation type for shared PropsTable / ComponentDocContent.
|
|
45
|
+
* Intentionally simple — consumers map their richer types into this shape.
|
|
46
|
+
*/
|
|
47
|
+
export interface DocProp {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
required?: boolean;
|
|
51
|
+
default?: unknown;
|
|
52
|
+
values?: string[];
|
|
53
|
+
}
|