@treeui/mcp 0.4.1 → 0.6.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/README.md +27 -3
- package/dist/{chunk-UPSK3E4U.js → chunk-ITEC3SEF.js} +3117 -395
- package/dist/cli.cjs +3115 -395
- package/dist/cli.js +1 -1
- package/dist/index.cjs +3431 -399
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +316 -5
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -46,6 +46,7 @@ interface TreeuiComponentEntry {
|
|
|
46
46
|
selection: TreeuiSelectionProfile;
|
|
47
47
|
setup: TreeuiComponentSetup;
|
|
48
48
|
recipes: string[];
|
|
49
|
+
practices: string[];
|
|
49
50
|
}
|
|
50
51
|
interface TreeuiDecisionGuideOption {
|
|
51
52
|
use: string;
|
|
@@ -64,6 +65,13 @@ interface TreeuiRecipe {
|
|
|
64
65
|
compose: string[];
|
|
65
66
|
notes: string[];
|
|
66
67
|
}
|
|
68
|
+
interface TreeuiPractice {
|
|
69
|
+
id: string;
|
|
70
|
+
title: string;
|
|
71
|
+
summary: string;
|
|
72
|
+
rules: string[];
|
|
73
|
+
components: string[];
|
|
74
|
+
}
|
|
67
75
|
interface TreeuiSetupEntry {
|
|
68
76
|
install: {
|
|
69
77
|
packageManagerExamples: Record<string, string>;
|
|
@@ -90,14 +98,25 @@ interface TreeuiSetupEntry {
|
|
|
90
98
|
commonCompositions: string[];
|
|
91
99
|
};
|
|
92
100
|
}
|
|
101
|
+
interface TreeuiTokenEntry {
|
|
102
|
+
cssVar: string;
|
|
103
|
+
path: string;
|
|
104
|
+
value: string;
|
|
105
|
+
category: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
/** Per-theme values for tokens that change with `[data-tree-theme]`. */
|
|
108
|
+
themeValues?: Record<string, string>;
|
|
109
|
+
}
|
|
93
110
|
interface TreeuiCatalog {
|
|
94
111
|
generatedAt: string;
|
|
95
112
|
packageName: string;
|
|
96
113
|
packageVersion: string;
|
|
97
114
|
decisionGuides: TreeuiDecisionGuide[];
|
|
98
115
|
recipes: TreeuiRecipe[];
|
|
116
|
+
practices: TreeuiPractice[];
|
|
99
117
|
setup: TreeuiSetupEntry;
|
|
100
118
|
components: TreeuiComponentEntry[];
|
|
119
|
+
tokens: TreeuiTokenEntry[];
|
|
101
120
|
}
|
|
102
121
|
interface TreeuiSearchResult {
|
|
103
122
|
component: TreeuiComponentEntry;
|
|
@@ -108,20 +127,33 @@ interface TreeuiRecipeSearchResult {
|
|
|
108
127
|
recipe: TreeuiRecipe;
|
|
109
128
|
score: number;
|
|
110
129
|
}
|
|
130
|
+
interface TreeuiTokenSearchResult {
|
|
131
|
+
token: TreeuiTokenEntry;
|
|
132
|
+
score: number;
|
|
133
|
+
}
|
|
111
134
|
|
|
112
135
|
declare const catalog: TreeuiCatalog;
|
|
113
136
|
declare const findComponent: (name: string) => TreeuiComponentEntry | undefined;
|
|
114
137
|
declare const searchComponents: (query: string, limit?: number) => TreeuiSearchResult[];
|
|
115
138
|
declare const recommendComponents: (task: string, limit?: number) => TreeuiSearchResult[];
|
|
116
139
|
declare const searchRecipes: (query: string, limit?: number) => TreeuiRecipeSearchResult[];
|
|
140
|
+
declare const searchTokens: (query: string, limit?: number) => TreeuiTokenSearchResult[];
|
|
117
141
|
declare const formatComponentSummary: (component: TreeuiComponentEntry) => string;
|
|
118
142
|
declare const formatSearchResults: (results: TreeuiSearchResult[]) => string;
|
|
119
143
|
declare const formatRecipeResults: (results: TreeuiRecipeSearchResult[]) => string;
|
|
144
|
+
declare const formatTokenResults: (results: TreeuiTokenSearchResult[]) => string;
|
|
120
145
|
declare const formatSetupGuide: (componentName?: string) => string;
|
|
121
146
|
|
|
122
147
|
declare const buildCatalogFromRepo: (repoRoot: string) => TreeuiCatalog;
|
|
123
148
|
declare const getRepoRootFromPackageRoot: (packageRoot: string) => string;
|
|
124
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Flatten the design tokens into catalog entries. Foundation tokens carry a
|
|
152
|
+
* single value; themed tokens carry one value per theme plus the default-theme
|
|
153
|
+
* value on `value`.
|
|
154
|
+
*/
|
|
155
|
+
declare const buildTokenEntries: () => TreeuiTokenEntry[];
|
|
156
|
+
|
|
125
157
|
declare const createTreeuiMcpServer: () => Server<{
|
|
126
158
|
method: string;
|
|
127
159
|
params?: {
|
|
@@ -157,4 +189,4 @@ declare const createTreeuiMcpServer: () => Server<{
|
|
|
157
189
|
} | undefined;
|
|
158
190
|
}>;
|
|
159
191
|
|
|
160
|
-
export { type TreeuiCatalog, type TreeuiCatalogField, type TreeuiComponentEntry, type TreeuiDecisionGuide, type TreeuiRecipe, type TreeuiSearchResult, type TreeuiSetupEntry, buildCatalogFromRepo, catalog, createTreeuiMcpServer, findComponent, formatComponentSummary, formatRecipeResults, formatSearchResults, formatSetupGuide, getRepoRootFromPackageRoot, recommendComponents, searchComponents, searchRecipes };
|
|
192
|
+
export { type TreeuiCatalog, type TreeuiCatalogField, type TreeuiComponentEntry, type TreeuiDecisionGuide, type TreeuiRecipe, type TreeuiSearchResult, type TreeuiSetupEntry, type TreeuiTokenEntry, type TreeuiTokenSearchResult, buildCatalogFromRepo, buildTokenEntries, catalog, createTreeuiMcpServer, findComponent, formatComponentSummary, formatRecipeResults, formatSearchResults, formatSetupGuide, formatTokenResults, getRepoRootFromPackageRoot, recommendComponents, searchComponents, searchRecipes, searchTokens };
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ interface TreeuiComponentEntry {
|
|
|
46
46
|
selection: TreeuiSelectionProfile;
|
|
47
47
|
setup: TreeuiComponentSetup;
|
|
48
48
|
recipes: string[];
|
|
49
|
+
practices: string[];
|
|
49
50
|
}
|
|
50
51
|
interface TreeuiDecisionGuideOption {
|
|
51
52
|
use: string;
|
|
@@ -64,6 +65,13 @@ interface TreeuiRecipe {
|
|
|
64
65
|
compose: string[];
|
|
65
66
|
notes: string[];
|
|
66
67
|
}
|
|
68
|
+
interface TreeuiPractice {
|
|
69
|
+
id: string;
|
|
70
|
+
title: string;
|
|
71
|
+
summary: string;
|
|
72
|
+
rules: string[];
|
|
73
|
+
components: string[];
|
|
74
|
+
}
|
|
67
75
|
interface TreeuiSetupEntry {
|
|
68
76
|
install: {
|
|
69
77
|
packageManagerExamples: Record<string, string>;
|
|
@@ -90,14 +98,25 @@ interface TreeuiSetupEntry {
|
|
|
90
98
|
commonCompositions: string[];
|
|
91
99
|
};
|
|
92
100
|
}
|
|
101
|
+
interface TreeuiTokenEntry {
|
|
102
|
+
cssVar: string;
|
|
103
|
+
path: string;
|
|
104
|
+
value: string;
|
|
105
|
+
category: string;
|
|
106
|
+
description?: string;
|
|
107
|
+
/** Per-theme values for tokens that change with `[data-tree-theme]`. */
|
|
108
|
+
themeValues?: Record<string, string>;
|
|
109
|
+
}
|
|
93
110
|
interface TreeuiCatalog {
|
|
94
111
|
generatedAt: string;
|
|
95
112
|
packageName: string;
|
|
96
113
|
packageVersion: string;
|
|
97
114
|
decisionGuides: TreeuiDecisionGuide[];
|
|
98
115
|
recipes: TreeuiRecipe[];
|
|
116
|
+
practices: TreeuiPractice[];
|
|
99
117
|
setup: TreeuiSetupEntry;
|
|
100
118
|
components: TreeuiComponentEntry[];
|
|
119
|
+
tokens: TreeuiTokenEntry[];
|
|
101
120
|
}
|
|
102
121
|
interface TreeuiSearchResult {
|
|
103
122
|
component: TreeuiComponentEntry;
|
|
@@ -108,20 +127,33 @@ interface TreeuiRecipeSearchResult {
|
|
|
108
127
|
recipe: TreeuiRecipe;
|
|
109
128
|
score: number;
|
|
110
129
|
}
|
|
130
|
+
interface TreeuiTokenSearchResult {
|
|
131
|
+
token: TreeuiTokenEntry;
|
|
132
|
+
score: number;
|
|
133
|
+
}
|
|
111
134
|
|
|
112
135
|
declare const catalog: TreeuiCatalog;
|
|
113
136
|
declare const findComponent: (name: string) => TreeuiComponentEntry | undefined;
|
|
114
137
|
declare const searchComponents: (query: string, limit?: number) => TreeuiSearchResult[];
|
|
115
138
|
declare const recommendComponents: (task: string, limit?: number) => TreeuiSearchResult[];
|
|
116
139
|
declare const searchRecipes: (query: string, limit?: number) => TreeuiRecipeSearchResult[];
|
|
140
|
+
declare const searchTokens: (query: string, limit?: number) => TreeuiTokenSearchResult[];
|
|
117
141
|
declare const formatComponentSummary: (component: TreeuiComponentEntry) => string;
|
|
118
142
|
declare const formatSearchResults: (results: TreeuiSearchResult[]) => string;
|
|
119
143
|
declare const formatRecipeResults: (results: TreeuiRecipeSearchResult[]) => string;
|
|
144
|
+
declare const formatTokenResults: (results: TreeuiTokenSearchResult[]) => string;
|
|
120
145
|
declare const formatSetupGuide: (componentName?: string) => string;
|
|
121
146
|
|
|
122
147
|
declare const buildCatalogFromRepo: (repoRoot: string) => TreeuiCatalog;
|
|
123
148
|
declare const getRepoRootFromPackageRoot: (packageRoot: string) => string;
|
|
124
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Flatten the design tokens into catalog entries. Foundation tokens carry a
|
|
152
|
+
* single value; themed tokens carry one value per theme plus the default-theme
|
|
153
|
+
* value on `value`.
|
|
154
|
+
*/
|
|
155
|
+
declare const buildTokenEntries: () => TreeuiTokenEntry[];
|
|
156
|
+
|
|
125
157
|
declare const createTreeuiMcpServer: () => Server<{
|
|
126
158
|
method: string;
|
|
127
159
|
params?: {
|
|
@@ -157,4 +189,4 @@ declare const createTreeuiMcpServer: () => Server<{
|
|
|
157
189
|
} | undefined;
|
|
158
190
|
}>;
|
|
159
191
|
|
|
160
|
-
export { type TreeuiCatalog, type TreeuiCatalogField, type TreeuiComponentEntry, type TreeuiDecisionGuide, type TreeuiRecipe, type TreeuiSearchResult, type TreeuiSetupEntry, buildCatalogFromRepo, catalog, createTreeuiMcpServer, findComponent, formatComponentSummary, formatRecipeResults, formatSearchResults, formatSetupGuide, getRepoRootFromPackageRoot, recommendComponents, searchComponents, searchRecipes };
|
|
192
|
+
export { type TreeuiCatalog, type TreeuiCatalogField, type TreeuiComponentEntry, type TreeuiDecisionGuide, type TreeuiRecipe, type TreeuiSearchResult, type TreeuiSetupEntry, type TreeuiTokenEntry, type TreeuiTokenSearchResult, buildCatalogFromRepo, buildTokenEntries, catalog, createTreeuiMcpServer, findComponent, formatComponentSummary, formatRecipeResults, formatSearchResults, formatSetupGuide, formatTokenResults, getRepoRootFromPackageRoot, recommendComponents, searchComponents, searchRecipes, searchTokens };
|
package/dist/index.js
CHANGED
|
@@ -6,15 +6,302 @@ import {
|
|
|
6
6
|
formatRecipeResults,
|
|
7
7
|
formatSearchResults,
|
|
8
8
|
formatSetupGuide,
|
|
9
|
+
formatTokenResults,
|
|
9
10
|
recommendComponents,
|
|
10
11
|
searchComponents,
|
|
11
|
-
searchRecipes
|
|
12
|
-
|
|
12
|
+
searchRecipes,
|
|
13
|
+
searchTokens
|
|
14
|
+
} from "./chunk-ITEC3SEF.js";
|
|
13
15
|
|
|
14
16
|
// src/catalog-source.ts
|
|
15
17
|
import fs from "fs";
|
|
16
18
|
import path from "path";
|
|
17
19
|
import { parseAllDocuments } from "yaml";
|
|
20
|
+
|
|
21
|
+
// ../tokens/src/tokens.ts
|
|
22
|
+
var treeTokens = {
|
|
23
|
+
font: {
|
|
24
|
+
family: {
|
|
25
|
+
sans: "'Google Sans Flex', 'Segoe UI', sans-serif",
|
|
26
|
+
mono: "'Google Sans Code', 'SFMono-Regular', monospace"
|
|
27
|
+
},
|
|
28
|
+
size: {
|
|
29
|
+
xs: "0.6875rem",
|
|
30
|
+
sm: "0.8125rem",
|
|
31
|
+
md: "0.9375rem",
|
|
32
|
+
base: "0.9375rem",
|
|
33
|
+
lg: "1.125rem",
|
|
34
|
+
xl: "1.375rem",
|
|
35
|
+
"2xl": "1.375rem",
|
|
36
|
+
"3xl": "1.75rem",
|
|
37
|
+
"4xl": "2.25rem",
|
|
38
|
+
"5xl": "3rem"
|
|
39
|
+
},
|
|
40
|
+
weight: {
|
|
41
|
+
regular: "400",
|
|
42
|
+
medium: "500",
|
|
43
|
+
semibold: "600",
|
|
44
|
+
bold: "700",
|
|
45
|
+
extrabold: "800"
|
|
46
|
+
},
|
|
47
|
+
lineHeight: {
|
|
48
|
+
compact: "1.1",
|
|
49
|
+
ui: "1.15",
|
|
50
|
+
tight: "1.25",
|
|
51
|
+
heading: "1.3",
|
|
52
|
+
base: "1.5",
|
|
53
|
+
body: "1.6",
|
|
54
|
+
relaxed: "1.65"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
space: {
|
|
58
|
+
0: "0",
|
|
59
|
+
1: "0.25rem",
|
|
60
|
+
2: "0.5rem",
|
|
61
|
+
3: "0.75rem",
|
|
62
|
+
4: "1rem",
|
|
63
|
+
5: "1.25rem",
|
|
64
|
+
6: "1.5rem",
|
|
65
|
+
8: "2rem",
|
|
66
|
+
12: "3rem",
|
|
67
|
+
16: "4rem"
|
|
68
|
+
},
|
|
69
|
+
radius: {
|
|
70
|
+
sm: "0.375rem",
|
|
71
|
+
md: "0.625rem",
|
|
72
|
+
lg: "0.875rem",
|
|
73
|
+
pill: "999px"
|
|
74
|
+
},
|
|
75
|
+
shadow: {
|
|
76
|
+
xs: "0 1px 2px rgba(15, 23, 42, 0.06)",
|
|
77
|
+
sm: "0 6px 18px rgba(15, 23, 42, 0.08)",
|
|
78
|
+
md: "0 14px 34px rgba(15, 23, 42, 0.12)"
|
|
79
|
+
},
|
|
80
|
+
// Brand gradient for high-emphasis surfaces (e.g. the primary CTA).
|
|
81
|
+
// References the theme brand vars so it follows light/dark automatically;
|
|
82
|
+
// override `--tree-gradient-brand` to match a product's marketing gradient.
|
|
83
|
+
gradient: {
|
|
84
|
+
brand: "linear-gradient(135deg, var(--tree-color-brand-primary), var(--tree-color-brand-hover))"
|
|
85
|
+
},
|
|
86
|
+
border: {
|
|
87
|
+
width: {
|
|
88
|
+
subtle: "1px",
|
|
89
|
+
strong: "1.5px"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
motion: {
|
|
93
|
+
duration: {
|
|
94
|
+
fast: "100ms",
|
|
95
|
+
moderate: "200ms",
|
|
96
|
+
normal: "300ms",
|
|
97
|
+
slow: "400ms",
|
|
98
|
+
slower: "500ms"
|
|
99
|
+
},
|
|
100
|
+
easing: {
|
|
101
|
+
standard: "cubic-bezier(0.2, 0, 0, 1)",
|
|
102
|
+
easeOut: "cubic-bezier(0, 0, 0.2, 1)",
|
|
103
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
|
104
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
size: {
|
|
108
|
+
control: {
|
|
109
|
+
sm: "2rem",
|
|
110
|
+
md: "2.5rem",
|
|
111
|
+
lg: "3rem"
|
|
112
|
+
},
|
|
113
|
+
icon: {
|
|
114
|
+
sm: "1rem",
|
|
115
|
+
md: "1.25rem",
|
|
116
|
+
lg: "1.5rem",
|
|
117
|
+
xl: "2rem",
|
|
118
|
+
"2xl": "3rem"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
layout: {
|
|
122
|
+
grid: {
|
|
123
|
+
columns: "12",
|
|
124
|
+
base: "8px"
|
|
125
|
+
},
|
|
126
|
+
gutter: {
|
|
127
|
+
sm: "1rem",
|
|
128
|
+
md: "1.5rem"
|
|
129
|
+
},
|
|
130
|
+
margin: {
|
|
131
|
+
sm: "1.5rem",
|
|
132
|
+
md: "2rem",
|
|
133
|
+
lg: "3rem"
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
z: {
|
|
137
|
+
base: "1",
|
|
138
|
+
dropdown: "1000",
|
|
139
|
+
popover: "1050",
|
|
140
|
+
sticky: "1100",
|
|
141
|
+
overlay: "1200",
|
|
142
|
+
modal: "1300",
|
|
143
|
+
toast: "1400"
|
|
144
|
+
},
|
|
145
|
+
breakpoint: {
|
|
146
|
+
sm: "640px",
|
|
147
|
+
md: "768px",
|
|
148
|
+
lg: "1024px",
|
|
149
|
+
xl: "1280px"
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
var treeThemes = {
|
|
153
|
+
light: {
|
|
154
|
+
color: {
|
|
155
|
+
bg: {
|
|
156
|
+
primary: "#f6f8fa",
|
|
157
|
+
surface: "#ffffff",
|
|
158
|
+
subtle: "#eff2f5"
|
|
159
|
+
},
|
|
160
|
+
border: {
|
|
161
|
+
default: "#d0d7de",
|
|
162
|
+
strong: "#afb8c1"
|
|
163
|
+
},
|
|
164
|
+
text: {
|
|
165
|
+
primary: "#1f2328",
|
|
166
|
+
muted: "#59636e",
|
|
167
|
+
inverse: "#ffffff"
|
|
168
|
+
},
|
|
169
|
+
brand: {
|
|
170
|
+
primary: "#0969da",
|
|
171
|
+
hover: "#0550ae",
|
|
172
|
+
soft: "#ddf4ff",
|
|
173
|
+
contrast: "#ffffff"
|
|
174
|
+
},
|
|
175
|
+
status: {
|
|
176
|
+
success: "#1a7f37",
|
|
177
|
+
warning: "#9a6700",
|
|
178
|
+
error: "#d1242f",
|
|
179
|
+
info: "#0969da"
|
|
180
|
+
},
|
|
181
|
+
// Categorical data-viz palette. Fixed hue order (blue → orange), validated
|
|
182
|
+
// for CVD separation and contrast against the light surface. Assign in order;
|
|
183
|
+
// the components cycle after 8 as a fallback, but prefer folding a 9th+
|
|
184
|
+
// category into "Other".
|
|
185
|
+
chart: {
|
|
186
|
+
1: "#2a78d6",
|
|
187
|
+
2: "#1baf7a",
|
|
188
|
+
3: "#eda100",
|
|
189
|
+
4: "#008300",
|
|
190
|
+
5: "#4a3aa7",
|
|
191
|
+
6: "#e34948",
|
|
192
|
+
7: "#e87ba4",
|
|
193
|
+
8: "#eb6834"
|
|
194
|
+
},
|
|
195
|
+
overlay: "rgba(31, 35, 40, 0.5)",
|
|
196
|
+
"focus-ring": "rgba(9, 105, 218, 0.32)"
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
dark: {
|
|
200
|
+
color: {
|
|
201
|
+
bg: {
|
|
202
|
+
primary: "#1c2128",
|
|
203
|
+
surface: "#22272e",
|
|
204
|
+
subtle: "#2d333b"
|
|
205
|
+
},
|
|
206
|
+
border: {
|
|
207
|
+
default: "#444c56",
|
|
208
|
+
strong: "#576270"
|
|
209
|
+
},
|
|
210
|
+
text: {
|
|
211
|
+
primary: "#adbac7",
|
|
212
|
+
muted: "#95a3b2",
|
|
213
|
+
inverse: "#1c2128"
|
|
214
|
+
},
|
|
215
|
+
brand: {
|
|
216
|
+
primary: "#539bf5",
|
|
217
|
+
hover: "#6cabf7",
|
|
218
|
+
soft: "#1a3453",
|
|
219
|
+
contrast: "#0a1a2f"
|
|
220
|
+
},
|
|
221
|
+
status: {
|
|
222
|
+
success: "#57ab5a",
|
|
223
|
+
warning: "#c69026",
|
|
224
|
+
error: "#f47067",
|
|
225
|
+
info: "#6cb6ff"
|
|
226
|
+
},
|
|
227
|
+
// Same hue order stepped for the dark surface (not a separate palette) —
|
|
228
|
+
// each step re-validated for the dark band and >= 3:1 on the dark surface.
|
|
229
|
+
chart: {
|
|
230
|
+
1: "#3987e5",
|
|
231
|
+
2: "#199e70",
|
|
232
|
+
3: "#c98500",
|
|
233
|
+
4: "#008300",
|
|
234
|
+
5: "#9085e9",
|
|
235
|
+
6: "#e66767",
|
|
236
|
+
7: "#d55181",
|
|
237
|
+
8: "#d95926"
|
|
238
|
+
},
|
|
239
|
+
overlay: "rgba(13, 17, 23, 0.6)",
|
|
240
|
+
"focus-ring": "rgba(83, 155, 245, 0.32)"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
// src/token-source.ts
|
|
246
|
+
var toCssVariable = (path2) => `--tree-${path2.join("-")}`;
|
|
247
|
+
var flattenTokens = (record, path2 = []) => Object.entries(record).flatMap(([key, value]) => {
|
|
248
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
249
|
+
return [[[...path2, key], value]];
|
|
250
|
+
}
|
|
251
|
+
return flattenTokens(value, [...path2, key]);
|
|
252
|
+
});
|
|
253
|
+
var DEFAULT_THEME_NAME = "light";
|
|
254
|
+
var categoryDescriptions = {
|
|
255
|
+
font: "Typography token: font family, size, weight, or line height.",
|
|
256
|
+
space: "Spacing scale step for padding, margin, and gap.",
|
|
257
|
+
radius: "Corner radius scale step.",
|
|
258
|
+
shadow: "Elevation shadow.",
|
|
259
|
+
gradient: "Gradient composed from the themed brand variables.",
|
|
260
|
+
border: "Border width step.",
|
|
261
|
+
motion: "Motion duration or easing curve.",
|
|
262
|
+
size: "Control and icon sizing scale step.",
|
|
263
|
+
layout: "Layout grid, gutter, or margin measurement.",
|
|
264
|
+
z: "Stacking layer (z-index).",
|
|
265
|
+
breakpoint: "Responsive breakpoint width.",
|
|
266
|
+
color: "Themed semantic color, resolved per [data-tree-theme]."
|
|
267
|
+
};
|
|
268
|
+
var describeToken = (category) => categoryDescriptions[category] ?? "TreeUI design token.";
|
|
269
|
+
var buildTokenEntries = () => {
|
|
270
|
+
const foundation = flattenTokens(treeTokens).map(
|
|
271
|
+
([path2, value]) => ({
|
|
272
|
+
cssVar: toCssVariable(path2),
|
|
273
|
+
path: path2.join("."),
|
|
274
|
+
value: String(value),
|
|
275
|
+
category: path2[0],
|
|
276
|
+
description: describeToken(path2[0])
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
const themed = /* @__PURE__ */ new Map();
|
|
280
|
+
for (const [themeName, theme] of Object.entries(treeThemes)) {
|
|
281
|
+
for (const [path2, value] of flattenTokens(theme)) {
|
|
282
|
+
const cssVar = toCssVariable(path2);
|
|
283
|
+
const existing = themed.get(cssVar);
|
|
284
|
+
if (existing) {
|
|
285
|
+
existing.themeValues = { ...existing.themeValues, [themeName]: String(value) };
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
themed.set(cssVar, {
|
|
289
|
+
cssVar,
|
|
290
|
+
path: path2.join("."),
|
|
291
|
+
value: String(value),
|
|
292
|
+
category: path2[0],
|
|
293
|
+
description: describeToken(path2[0]),
|
|
294
|
+
themeValues: { [themeName]: String(value) }
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
for (const entry of themed.values()) {
|
|
299
|
+
entry.value = entry.themeValues?.[DEFAULT_THEME_NAME] ?? entry.value;
|
|
300
|
+
}
|
|
301
|
+
return [...foundation, ...themed.values()];
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
// src/catalog-source.ts
|
|
18
305
|
var readText = (filePath) => fs.readFileSync(filePath, "utf8");
|
|
19
306
|
var normalizeWhitespace = (value) => value.replace(/\s+/g, " ").trim();
|
|
20
307
|
var stringifyValue = (value) => {
|
|
@@ -225,6 +512,21 @@ var normalizeRecipes = (value) => {
|
|
|
225
512
|
};
|
|
226
513
|
});
|
|
227
514
|
};
|
|
515
|
+
var normalizePractices = (value) => {
|
|
516
|
+
if (!Array.isArray(value)) {
|
|
517
|
+
return [];
|
|
518
|
+
}
|
|
519
|
+
return value.map((practice) => {
|
|
520
|
+
const record = practice;
|
|
521
|
+
return {
|
|
522
|
+
id: String(record.id),
|
|
523
|
+
title: String(record.title),
|
|
524
|
+
summary: stringifyValue(record.summary) ?? "",
|
|
525
|
+
rules: normalizeStringList(record.rules),
|
|
526
|
+
components: normalizeStringList(record.components)
|
|
527
|
+
};
|
|
528
|
+
});
|
|
529
|
+
};
|
|
228
530
|
var loadYamlDocuments = (filePath) => parseAllDocuments(readText(filePath)).map((document) => document.toJSON()).filter((document) => Boolean(document));
|
|
229
531
|
var buildStoryIndex = (repoRoot) => {
|
|
230
532
|
const storiesDir = path.join(repoRoot, "apps/docs/src/stories");
|
|
@@ -263,10 +565,12 @@ var buildCatalogFromRepo = (repoRoot) => {
|
|
|
263
565
|
const setupDoc = loadYamlDocuments(path.join(docsDir, "SETUP.yaml"))[0] ?? {};
|
|
264
566
|
const recipesDoc = loadYamlDocuments(path.join(docsDir, "RECIPES.yaml"))[0] ?? {};
|
|
265
567
|
const contractsDoc = loadYamlDocuments(path.join(docsDir, "CONTRACTS.yaml"))[0] ?? {};
|
|
568
|
+
const practicesDoc = JSON.parse(readText(path.join(docsDir, "practices.json")));
|
|
266
569
|
const componentProfiles = selectionDoc.component_profiles ?? {};
|
|
267
570
|
const componentSetup = setupDoc.component_setup ?? {};
|
|
268
571
|
const aliasMap = contractsDoc.compatibility_aliases ?? {};
|
|
269
572
|
const recipes = normalizeRecipes(recipesDoc.recipes);
|
|
573
|
+
const practices = normalizePractices(practicesDoc.practices);
|
|
270
574
|
const components = fs.readdirSync(componentsDir).filter((fileName) => fileName.endsWith(".yaml")).flatMap((fileName) => {
|
|
271
575
|
const filePath = path.join(componentsDir, fileName);
|
|
272
576
|
return loadYamlDocuments(filePath).flatMap((document) => {
|
|
@@ -285,6 +589,7 @@ var buildCatalogFromRepo = (repoRoot) => {
|
|
|
285
589
|
)
|
|
286
590
|
);
|
|
287
591
|
const componentRecipes = recipes.filter((recipe) => recipe.compose.includes(name)).map((recipe) => recipe.id);
|
|
592
|
+
const componentPractices = practices.filter((practice) => practice.components.includes(name)).map((practice) => practice.id);
|
|
288
593
|
const entry = {
|
|
289
594
|
name,
|
|
290
595
|
legacyAlias: aliasMap[name] ?? aliases.find((alias) => alias.startsWith("Tree")),
|
|
@@ -306,7 +611,8 @@ var buildCatalogFromRepo = (repoRoot) => {
|
|
|
306
611
|
behavior: normalizeStringList(document.behavior),
|
|
307
612
|
selection,
|
|
308
613
|
setup: setup2,
|
|
309
|
-
recipes: componentRecipes
|
|
614
|
+
recipes: componentRecipes,
|
|
615
|
+
practices: componentPractices
|
|
310
616
|
};
|
|
311
617
|
return [entry];
|
|
312
618
|
});
|
|
@@ -349,13 +655,16 @@ var buildCatalogFromRepo = (repoRoot) => {
|
|
|
349
655
|
packageVersion: vuePackage.version,
|
|
350
656
|
decisionGuides: normalizeDecisionGuides(selectionDoc.decision_guides),
|
|
351
657
|
recipes,
|
|
658
|
+
practices,
|
|
352
659
|
setup,
|
|
353
|
-
components
|
|
660
|
+
components,
|
|
661
|
+
tokens: buildTokenEntries()
|
|
354
662
|
};
|
|
355
663
|
};
|
|
356
664
|
var getRepoRootFromPackageRoot = (packageRoot) => path.resolve(packageRoot, "../..");
|
|
357
665
|
export {
|
|
358
666
|
buildCatalogFromRepo,
|
|
667
|
+
buildTokenEntries,
|
|
359
668
|
catalog,
|
|
360
669
|
createTreeuiMcpServer,
|
|
361
670
|
findComponent,
|
|
@@ -363,8 +672,10 @@ export {
|
|
|
363
672
|
formatRecipeResults,
|
|
364
673
|
formatSearchResults,
|
|
365
674
|
formatSetupGuide,
|
|
675
|
+
formatTokenResults,
|
|
366
676
|
getRepoRootFromPackageRoot,
|
|
367
677
|
recommendComponents,
|
|
368
678
|
searchComponents,
|
|
369
|
-
searchRecipes
|
|
679
|
+
searchRecipes,
|
|
680
|
+
searchTokens
|
|
370
681
|
};
|