@triptease/design-system-mcp 0.0.3
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/CHANGELOG.md +26 -0
- package/README.md +340 -0
- package/dist/package.json +41 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +39 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/manifests/components/entries/badge.d.ts +27 -0
- package/dist/src/manifests/components/entries/badge.js +43 -0
- package/dist/src/manifests/components/entries/badge.js.map +1 -0
- package/dist/src/manifests/components/entries/barChart.d.ts +73 -0
- package/dist/src/manifests/components/entries/barChart.js +125 -0
- package/dist/src/manifests/components/entries/barChart.js.map +1 -0
- package/dist/src/manifests/components/entries/button.d.ts +40 -0
- package/dist/src/manifests/components/entries/button.js +59 -0
- package/dist/src/manifests/components/entries/button.js.map +1 -0
- package/dist/src/manifests/components/entries/card.d.ts +20 -0
- package/dist/src/manifests/components/entries/card.js +34 -0
- package/dist/src/manifests/components/entries/card.js.map +1 -0
- package/dist/src/manifests/components/entries/checkbox.d.ts +31 -0
- package/dist/src/manifests/components/entries/checkbox.js +64 -0
- package/dist/src/manifests/components/entries/checkbox.js.map +1 -0
- package/dist/src/manifests/components/entries/combobox.d.ts +64 -0
- package/dist/src/manifests/components/entries/combobox.js +176 -0
- package/dist/src/manifests/components/entries/combobox.js.map +1 -0
- package/dist/src/manifests/components/entries/datePicker.d.ts +34 -0
- package/dist/src/manifests/components/entries/datePicker.js +67 -0
- package/dist/src/manifests/components/entries/datePicker.js.map +1 -0
- package/dist/src/manifests/components/entries/dateRangePicker.d.ts +34 -0
- package/dist/src/manifests/components/entries/dateRangePicker.js +110 -0
- package/dist/src/manifests/components/entries/dateRangePicker.js.map +1 -0
- package/dist/src/manifests/components/entries/dialog.d.ts +38 -0
- package/dist/src/manifests/components/entries/dialog.js +73 -0
- package/dist/src/manifests/components/entries/dialog.js.map +1 -0
- package/dist/src/manifests/components/entries/lineChart.d.ts +76 -0
- package/dist/src/manifests/components/entries/lineChart.js +141 -0
- package/dist/src/manifests/components/entries/lineChart.js.map +1 -0
- package/dist/src/manifests/components/entries/numberinput.d.ts +52 -0
- package/dist/src/manifests/components/entries/numberinput.js +64 -0
- package/dist/src/manifests/components/entries/numberinput.js.map +1 -0
- package/dist/src/manifests/components/entries/radio.d.ts +31 -0
- package/dist/src/manifests/components/entries/radio.js +50 -0
- package/dist/src/manifests/components/entries/radio.js.map +1 -0
- package/dist/src/manifests/components/entries/select.d.ts +16 -0
- package/dist/src/manifests/components/entries/select.js +23 -0
- package/dist/src/manifests/components/entries/select.js.map +1 -0
- package/dist/src/manifests/components/entries/table.d.ts +16 -0
- package/dist/src/manifests/components/entries/table.js +43 -0
- package/dist/src/manifests/components/entries/table.js.map +1 -0
- package/dist/src/manifests/components/entries/textarea.d.ts +40 -0
- package/dist/src/manifests/components/entries/textarea.js +54 -0
- package/dist/src/manifests/components/entries/textarea.js.map +1 -0
- package/dist/src/manifests/components/entries/textinput.d.ts +40 -0
- package/dist/src/manifests/components/entries/textinput.js +53 -0
- package/dist/src/manifests/components/entries/textinput.js.map +1 -0
- package/dist/src/manifests/components/entries/toggle.d.ts +23 -0
- package/dist/src/manifests/components/entries/toggle.js +30 -0
- package/dist/src/manifests/components/entries/toggle.js.map +1 -0
- package/dist/src/manifests/components/entries/typography.d.ts +23 -0
- package/dist/src/manifests/components/entries/typography.js +32 -0
- package/dist/src/manifests/components/entries/typography.js.map +1 -0
- package/dist/src/manifests/components/index.d.ts +2 -0
- package/dist/src/manifests/components/index.js +39 -0
- package/dist/src/manifests/components/index.js.map +1 -0
- package/dist/src/manifests/components/types.d.ts +56 -0
- package/dist/src/manifests/components/types.js +2 -0
- package/dist/src/manifests/components/types.js.map +1 -0
- package/dist/src/tools/getCSSTokens/handler.d.ts +6 -0
- package/dist/src/tools/getCSSTokens/handler.js +29 -0
- package/dist/src/tools/getCSSTokens/handler.js.map +1 -0
- package/dist/src/tools/getCSSTokens/index.d.ts +12 -0
- package/dist/src/tools/getCSSTokens/index.js +14 -0
- package/dist/src/tools/getCSSTokens/index.js.map +1 -0
- package/dist/src/tools/getCSSTokens/utils.d.ts +5 -0
- package/dist/src/tools/getCSSTokens/utils.js +25 -0
- package/dist/src/tools/getCSSTokens/utils.js.map +1 -0
- package/dist/src/tools/getComponentDocs/handler.d.ts +6 -0
- package/dist/src/tools/getComponentDocs/handler.js +27 -0
- package/dist/src/tools/getComponentDocs/handler.js.map +1 -0
- package/dist/src/tools/getComponentDocs/index.d.ts +12 -0
- package/dist/src/tools/getComponentDocs/index.js +14 -0
- package/dist/src/tools/getComponentDocs/index.js.map +1 -0
- package/dist/src/tools/getSetupGuide/handler.d.ts +6 -0
- package/dist/src/tools/getSetupGuide/handler.js +50 -0
- package/dist/src/tools/getSetupGuide/handler.js.map +1 -0
- package/dist/src/tools/getSetupGuide/index.d.ts +12 -0
- package/dist/src/tools/getSetupGuide/index.js +17 -0
- package/dist/src/tools/getSetupGuide/index.js.map +1 -0
- package/dist/src/tools/getSetupGuide/setupGuides.d.ts +12 -0
- package/dist/src/tools/getSetupGuide/setupGuides.js +49 -0
- package/dist/src/tools/getSetupGuide/setupGuides.js.map +1 -0
- package/dist/src/tools/listCSSTokens/handler.d.ts +3 -0
- package/dist/src/tools/listCSSTokens/handler.js +20 -0
- package/dist/src/tools/listCSSTokens/handler.js.map +1 -0
- package/dist/src/tools/listCSSTokens/index.d.ts +8 -0
- package/dist/src/tools/listCSSTokens/index.js +10 -0
- package/dist/src/tools/listCSSTokens/index.js.map +1 -0
- package/dist/src/tools/listComponents/handler.d.ts +3 -0
- package/dist/src/tools/listComponents/handler.js +18 -0
- package/dist/src/tools/listComponents/handler.js.map +1 -0
- package/dist/src/tools/listComponents/index.d.ts +9 -0
- package/dist/src/tools/listComponents/index.js +11 -0
- package/dist/src/tools/listComponents/index.js.map +1 -0
- package/dist/src/tools/searchComponents/handler.d.ts +6 -0
- package/dist/src/tools/searchComponents/handler.js +29 -0
- package/dist/src/tools/searchComponents/handler.js.map +1 -0
- package/dist/src/tools/searchComponents/index.d.ts +12 -0
- package/dist/src/tools/searchComponents/index.js +14 -0
- package/dist/src/tools/searchComponents/index.js.map +1 -0
- package/dist/src/utils/buildCDNUrls.d.ts +3 -0
- package/dist/src/utils/buildCDNUrls.js +6 -0
- package/dist/src/utils/buildCDNUrls.js.map +1 -0
- package/package.json +43 -0
- package/src/index.ts +46 -0
- package/src/manifests/components/entries/badge.ts +45 -0
- package/src/manifests/components/entries/barChart.ts +132 -0
- package/src/manifests/components/entries/button.ts +61 -0
- package/src/manifests/components/entries/card.ts +35 -0
- package/src/manifests/components/entries/checkbox.ts +68 -0
- package/src/manifests/components/entries/combobox.ts +184 -0
- package/src/manifests/components/entries/datePicker.ts +73 -0
- package/src/manifests/components/entries/dateRangePicker.ts +118 -0
- package/src/manifests/components/entries/dialog.ts +77 -0
- package/src/manifests/components/entries/lineChart.ts +150 -0
- package/src/manifests/components/entries/numberinput.ts +66 -0
- package/src/manifests/components/entries/radio.ts +53 -0
- package/src/manifests/components/entries/select.ts +24 -0
- package/src/manifests/components/entries/table.ts +44 -0
- package/src/manifests/components/entries/textarea.ts +56 -0
- package/src/manifests/components/entries/textinput.ts +55 -0
- package/src/manifests/components/entries/toggle.ts +31 -0
- package/src/manifests/components/entries/typography.ts +33 -0
- package/src/manifests/components/index.ts +41 -0
- package/src/manifests/components/types.ts +64 -0
- package/src/tools/getCSSTokens/__snapshots__/handler.test.ts.snap +78 -0
- package/src/tools/getCSSTokens/handler.test.ts +39 -0
- package/src/tools/getCSSTokens/handler.ts +36 -0
- package/src/tools/getCSSTokens/index.ts +15 -0
- package/src/tools/getCSSTokens/utils.ts +31 -0
- package/src/tools/getComponentDocs/__snapshots__/handler.test.ts.snap +23 -0
- package/src/tools/getComponentDocs/handler.test.ts +14 -0
- package/src/tools/getComponentDocs/handler.ts +34 -0
- package/src/tools/getComponentDocs/index.ts +15 -0
- package/src/tools/getSetupGuide/__snapshots__/handler.test.ts.snap +34 -0
- package/src/tools/getSetupGuide/handler.test.ts +20 -0
- package/src/tools/getSetupGuide/handler.ts +59 -0
- package/src/tools/getSetupGuide/index.ts +20 -0
- package/src/tools/getSetupGuide/setupGuides.ts +62 -0
- package/src/tools/listCSSTokens/__snapshots__/handler.test.ts.snap +12 -0
- package/src/tools/listCSSTokens/handler.test.ts +9 -0
- package/src/tools/listCSSTokens/handler.ts +32 -0
- package/src/tools/listCSSTokens/index.ts +12 -0
- package/src/tools/listComponents/__snapshots__/handler.test.ts.snap +12 -0
- package/src/tools/listComponents/handler.test.ts +9 -0
- package/src/tools/listComponents/handler.ts +20 -0
- package/src/tools/listComponents/index.ts +12 -0
- package/src/tools/searchComponents/__snapshots__/handler.test.ts.snap +23 -0
- package/src/tools/searchComponents/handler.test.ts +14 -0
- package/src/tools/searchComponents/handler.ts +36 -0
- package/src/tools/searchComponents/index.ts +15 -0
- package/src/utils/buildCDNUrls.ts +7 -0
- package/tsconfig.json +12 -0
- package/vitest.config.ts +6 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
interface UsageGuidance {
|
|
2
|
+
whenToUse: string[];
|
|
3
|
+
bestPractices?: string[];
|
|
4
|
+
accessibility?: string[];
|
|
5
|
+
avoid?: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface PackageInstallationBase {
|
|
9
|
+
includesTypes: boolean;
|
|
10
|
+
optional: boolean;
|
|
11
|
+
guidance?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface NPMPackage extends PackageInstallationBase {
|
|
15
|
+
name: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface CDNPackage extends PackageInstallationBase {
|
|
19
|
+
name: string;
|
|
20
|
+
latestVersionUrl: string;
|
|
21
|
+
pinnedMajorVersionUrl: string;
|
|
22
|
+
pinnedVersionUrl: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Installation {
|
|
26
|
+
npm?: NPMPackage[];
|
|
27
|
+
cdn?: CDNPackage[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
interface DataAttribute {
|
|
31
|
+
type: string;
|
|
32
|
+
values?: (string | undefined)[];
|
|
33
|
+
default?: string;
|
|
34
|
+
description: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface HTMLAttribute {
|
|
38
|
+
type?: string;
|
|
39
|
+
values?: string[];
|
|
40
|
+
default?: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface ExampleUsage {
|
|
45
|
+
title: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
code: string;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ComponentConfig {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
ssrSafe?: boolean;
|
|
54
|
+
element: string;
|
|
55
|
+
usageGuidance?: UsageGuidance;
|
|
56
|
+
installation?: Installation;
|
|
57
|
+
dataAttributes?: Record<string, DataAttribute>;
|
|
58
|
+
classes?: Record<string, string>;
|
|
59
|
+
attributes?: Record<string, HTMLAttribute>;
|
|
60
|
+
states?: string[];
|
|
61
|
+
examples?: ExampleUsage[];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ComponentManifest = Record<string, ComponentConfig>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`getCSSTokens handler > should return all border tokens 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"content": [
|
|
6
|
+
{
|
|
7
|
+
"text": "[{"token":"--border-radius","value":"0.5rem"}]",
|
|
8
|
+
"type": "text",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`getCSSTokens handler > should return all border-radius tokens 1`] = `
|
|
15
|
+
{
|
|
16
|
+
"content": [
|
|
17
|
+
{
|
|
18
|
+
"text": "[{"token":"--border-radius-50","value":"0.25rem"},{"token":"--border-radius-100","value":"0.5rem"},{"token":"--border-radius-200","value":"1rem"}]",
|
|
19
|
+
"type": "text",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`getCSSTokens handler > should return all box-shadows tokens 1`] = `
|
|
26
|
+
{
|
|
27
|
+
"content": [
|
|
28
|
+
{
|
|
29
|
+
"text": "[{"token":"--box-shadow-sm","value":"0px 2px 5px rgba(0, 0, 0, 0.1)"},{"token":"--box-shadow-lg","value":"0px 2px 20px rgba(0, 0, 0, 0.1)"},{"token":"--box-shadow-lg-hover","value":"0px 10px 20px rgba(0, 0, 0, 0.2)"}]",
|
|
30
|
+
"type": "text",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
exports[`getCSSTokens handler > should return all color tokens 1`] = `
|
|
37
|
+
{
|
|
38
|
+
"content": [
|
|
39
|
+
{
|
|
40
|
+
"text": "[{"token":"--color-alert-100","value":"#FFD6D6"},{"token":"--color-alert-200","value":"#FF9999"},{"token":"--color-alert-300","value":"#F93939"},{"token":"--color-alert-400","value":"#DA0707"},{"token":"--color-alert-500","value":"#A80505"},{"token":"--color-border-100","value":"#E8EAEC"},{"token":"--color-border-200","value":"#E0E1E5"},{"token":"--color-border-300","value":"#D7D9DD"},{"token":"--color-border-400","value":"#C5C8CE"},{"token":"--color-border-500","value":"#B7BBC2"},{"token":"--color-text-100","value":"#FFFFFF"},{"token":"--color-text-200","value":"#B5B0B5"},{"token":"--color-text-300","value":"#575157"},{"token":"--color-text-400","value":"#3B353B"},{"token":"--color-text-500","value":"#0D0C0D"},{"token":"--color-text-inverted-100","value":"#0D0C0D"},{"token":"--color-text-inverted-200","value":"#77758A"},{"token":"--color-text-inverted-300","value":"#9D9CAB"},{"token":"--color-text-inverted-400","value":"#D3D3DA"},{"token":"--color-text-inverted-500","value":"#FFFFFF"},{"token":"--color-info-100","value":"#E5F3FF"},{"token":"--color-info-200","value":"#C2E3FF"},{"token":"--color-info-300","value":"#8FCBFF"},{"token":"--color-info-400","value":"#0B99FF"},{"token":"--color-info-500","value":"#007DD6"},{"token":"--color-primary-100","value":"#F3F0FA"},{"token":"--color-primary-200","value":"#E8E3F6"},{"token":"--color-primary-300","value":"#CFC6ED"},{"token":"--color-primary-400","value":"#5E43C2"},{"token":"--color-primary-500","value":"#4D35A1"},{"token":"--color-success-100","value":"#E8F6E3"},{"token":"--color-success-200","value":"#C8E9BB"},{"token":"--color-success-300","value":"#A7DB93"},{"token":"--color-success-400","value":"#86D06D"},{"token":"--color-success-500","value":"#65C345"},{"token":"--color-surface-100","value":"#FFFFFF"},{"token":"--color-surface-200","value":"#F9FAFB"},{"token":"--color-surface-300","value":"#F1F2F4"},{"token":"--color-surface-400","value":"#E8EAEC"},{"token":"--color-surface-500","value":"#E0E1E5"},{"token":"--color-surface-600","value":"#D7D9DD"},{"token":"--color-surface-700","value":"#75767E"},{"token":"--color-surface-800","value":"#1C1B27"},{"token":"--color-surface-inverted-100","value":"#1C1B27"},{"token":"--color-surface-inverted-200","value":"#3A384D"},{"token":"--color-surface-inverted-300","value":"#5B5974"},{"token":"--color-surface-inverted-400","value":"#7F7D95"},{"token":"--color-surface-inverted-500","value":"#ACAABC"},{"token":"--color-warning-100","value":"#FFEDD6"},{"token":"--color-warning-200","value":"#FFE0B8"},{"token":"--color-warning-300","value":"#FFCE8F"},{"token":"--color-warning-400","value":"#FFB95E"},{"token":"--color-warning-500","value":"#FF9D1F"}]",
|
|
41
|
+
"type": "text",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
exports[`getCSSTokens handler > should return all font tokens 1`] = `
|
|
48
|
+
{
|
|
49
|
+
"content": [
|
|
50
|
+
{
|
|
51
|
+
"text": "[{"token":"--font-family-serif","value":"'Noe Text', 'PT Serif', serif"},{"token":"--font-family-sans","value":"'Roboto', sans-serif"},{"token":"--font-family-inter","value":"'Inter', 'Helvetica Neue', sans-serif"},{"token":"--font-line-height-100","value":"1.4"},{"token":"--font-line-height-200","value":"1.5"},{"token":"--font-line-height-300","value":"1.3"},{"token":"--font-line-height-400","value":"1.4"},{"token":"--font-line-height-500","value":"1.3"},{"token":"--font-line-height-600","value":"1.5"},{"token":"--font-size-100","value":"0.875rem"},{"token":"--font-size-200","value":"1rem"},{"token":"--font-size-300","value":"1.125rem"},{"token":"--font-size-400","value":"1.25rem"},{"token":"--font-size-500","value":"1.5rem"},{"token":"--font-size-600","value":"2rem"}]",
|
|
52
|
+
"type": "text",
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
exports[`getCSSTokens handler > should return all spacing tokens 1`] = `
|
|
59
|
+
{
|
|
60
|
+
"content": [
|
|
61
|
+
{
|
|
62
|
+
"text": "[{"token":"--space-scale-1","value":"0.5rem"},{"token":"--space-scale-2","value":"1rem"},{"token":"--space-scale-3","value":"1.5rem"},{"token":"--space-scale-4","value":"2.5rem"},{"token":"--space-scale-5","value":"3.5rem"},{"token":"--space-scale-6","value":"4.5rem"},{"token":"--space-scale-7","value":"5.5rem"},{"token":"--space-scale-8","value":"6.5rem"},{"token":"--space-scale-9","value":"7.5rem"},{"token":"--space-scale-10","value":"8.5rem"},{"token":"--space-scale-0-5","value":"0.25rem"},{"token":"--space-scale-1-5","value":"0.75rem"},{"token":"--space-scale-2-5","value":"1.25rem"},{"token":"--space-scale-3-5","value":"2rem"},{"token":"--space-scale-4-5","value":"3rem"},{"token":"--space-scale-5-5","value":"4rem"},{"token":"--space-scale-6-5","value":"5rem"},{"token":"--space-scale-7-5","value":"6rem"},{"token":"--space-scale-8-5","value":"7rem"},{"token":"--space-scale-9-5","value":"8rem"}]",
|
|
63
|
+
"type": "text",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
|
|
69
|
+
exports[`getCSSTokens handler > should return error on invalid category 1`] = `
|
|
70
|
+
{
|
|
71
|
+
"content": [
|
|
72
|
+
{
|
|
73
|
+
"text": "{"error":"Invalid category 'doctorWhoIsTheBestShowInTheWorld'","available":["color","font","space","border","border-radius","box-shadow"]}",
|
|
74
|
+
"type": "text",
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
`;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import handler from './handler.js';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
describe('getCSSTokens handler', () => {
|
|
5
|
+
it('should return all color tokens', () => {
|
|
6
|
+
const result = handler({ category: 'color' });
|
|
7
|
+
expect(result).toMatchSnapshot();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should return all spacing tokens', () => {
|
|
11
|
+
const result = handler({ category: 'space' });
|
|
12
|
+
expect(result).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should return all font tokens', () => {
|
|
16
|
+
const result = handler({ category: 'font' });
|
|
17
|
+
expect(result).toMatchSnapshot();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should return all box-shadows tokens', () => {
|
|
21
|
+
const result = handler({ category: 'box-shadow' });
|
|
22
|
+
expect(result).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should return all border tokens', () => {
|
|
26
|
+
const result = handler({ category: 'border' });
|
|
27
|
+
expect(result).toMatchSnapshot();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should return all border-radius tokens', () => {
|
|
31
|
+
const result = handler({ category: 'border-radius' });
|
|
32
|
+
expect(result).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should return error on invalid category', () => {
|
|
36
|
+
const result = handler({ category: 'doctorWhoIsTheBestShowInTheWorld' });
|
|
37
|
+
expect(result).toMatchSnapshot();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import designTokens from '@triptease/stylesheet/tokens' with { type: 'json' };
|
|
3
|
+
import { buildTokens } from '@/tools/getCSSTokens/utils.js';
|
|
4
|
+
|
|
5
|
+
export interface GetDesignTokensArgs {
|
|
6
|
+
category: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default (args: GetDesignTokensArgs): CallToolResult => {
|
|
10
|
+
const category = args.category;
|
|
11
|
+
const tokens = buildTokens(designTokens);
|
|
12
|
+
|
|
13
|
+
const categories = Object.keys(tokens);
|
|
14
|
+
if (!categories.includes(category)) {
|
|
15
|
+
return {
|
|
16
|
+
content: [
|
|
17
|
+
{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify({
|
|
20
|
+
error: `Invalid category '${category}'`,
|
|
21
|
+
available: categories,
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: JSON.stringify(tokens[category]),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import handler from './handler.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
const toolDefinition = {
|
|
5
|
+
name: 'get_css_tokens',
|
|
6
|
+
config: {
|
|
7
|
+
description: 'Returns the CSS tokens for a specific category.',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
category: z.string().describe('Token category: one of the category names returned by the listCSSTokens tool.'),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
handler: handler,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default toolDefinition;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface TokenOutput {
|
|
2
|
+
token: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
const isDesignToken = (v: any): v is { value: string; path: string[] } => {
|
|
8
|
+
return v && typeof v === 'object' && typeof v.value === 'string' && Array.isArray(v.path);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const processTokenGroup = (prefix: string[], group: object): TokenOutput[] => {
|
|
12
|
+
return Object.entries(group).flatMap(([key, value]) => {
|
|
13
|
+
if (isDesignToken(value)) {
|
|
14
|
+
return { token: `--${[...prefix, key].join('-')}`, value: value.value };
|
|
15
|
+
} else if (value && typeof value === 'object') {
|
|
16
|
+
return processTokenGroup([...prefix, key], value);
|
|
17
|
+
} else {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const buildTokens = (input: Record<string, object>): Record<string, TokenOutput[]> => {
|
|
24
|
+
const result: Record<string, TokenOutput[]> = {};
|
|
25
|
+
|
|
26
|
+
for (const category of Object.keys(input).filter((category) => category !== 'asset')) {
|
|
27
|
+
result[category] = processTokenGroup([category], input[category]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return result;
|
|
31
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`getComponentDocs handler > should return not found if the provided component does not exist in the manifest 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"content": [
|
|
6
|
+
{
|
|
7
|
+
"text": "{"error":"Component 'foo' not found","available":["button","textinput","numberinput","textarea","select","checkbox","radio","toggle","badge","card","table","typography","dialog","combobox","date-picker","date-range-picker","bar-chart","line-chart"]}",
|
|
8
|
+
"type": "text",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`getComponentDocs handler > should return with the manifest entry if the component exists 1`] = `
|
|
15
|
+
{
|
|
16
|
+
"content": [
|
|
17
|
+
{
|
|
18
|
+
"text": "{"name":"Button","description":"Interactive button component with multiple themes and states","element":"button","usageGuidance":{"whenToUse":["Submitting forms","Triggering actions (save, delete, confirm)","Opening modals or dialogs","Navigation to a new page or state"],"avoid":["For navigation to external pages (use links instead)","To display non-interactive information (use text or badges)"]},"dataAttributes":{"data-theme":{"type":"enum","values":["primary","secondary","tertiary","suggestion","inline","destructive-primary","destructive-secondary","destructive-tertiary"],"default":"primary","description":"Visual theme of the button. Use primary for main actions, secondary for supporting actions, tertiary for minimal emphasis. Use destructive themes for actions that cannot be undone (delete, remove). All themes work with disabled and data-loading attributes."},"data-loading":{"type":"boolean","values":["true",null],"description":"Shows loading spinner. Always pair with aria-busy for accessibility."}},"classes":{"small":"Smaller button size for compact interfaces","large":"Larger button size for emphasis"},"attributes":{"disabled":{"type":"boolean","description":"Disables the button. Pair with aria-disabled for accessibility."}},"states":["default","hover","focus","disabled","loading"],"examples":[{"title":"Basic usage","code":"<button>Click Me</button>"}]}",
|
|
19
|
+
"type": "text",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import handler from './handler.js';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
describe('getComponentDocs handler', () => {
|
|
5
|
+
it('should return not found if the provided component does not exist in the manifest', () => {
|
|
6
|
+
const result = handler({ component: 'foo' });
|
|
7
|
+
expect(result).toMatchSnapshot();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should return with the manifest entry if the component exists', () => {
|
|
11
|
+
const result = handler({ component: 'button' });
|
|
12
|
+
expect(result).toMatchSnapshot();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { componentManifest } from '@/manifests/components/index.js';
|
|
3
|
+
|
|
4
|
+
export interface GetComponentDocsArgs {
|
|
5
|
+
component: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default (args: GetComponentDocsArgs): CallToolResult => {
|
|
9
|
+
const componentName = args.component.toLowerCase();
|
|
10
|
+
const component = componentManifest[componentName];
|
|
11
|
+
|
|
12
|
+
if (!component) {
|
|
13
|
+
return {
|
|
14
|
+
content: [
|
|
15
|
+
{
|
|
16
|
+
type: 'text',
|
|
17
|
+
text: JSON.stringify({
|
|
18
|
+
error: `Component '${componentName}' not found`,
|
|
19
|
+
available: Object.keys(componentManifest),
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
content: [
|
|
28
|
+
{
|
|
29
|
+
type: 'text',
|
|
30
|
+
text: JSON.stringify(component),
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import handler from './handler.js';
|
|
3
|
+
|
|
4
|
+
const toolDefinition = {
|
|
5
|
+
name: 'get_component_docs',
|
|
6
|
+
config: {
|
|
7
|
+
description: 'Get documentation for a design system component (button, input, badge, checkbox, card, etc.)',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
component: z.string().describe("Component name (e.g., 'button', 'input', 'badge')"),
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
handler,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default toolDefinition;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`getSetupGuide handler > should return a specific guide when type is provided 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"content": [
|
|
6
|
+
{
|
|
7
|
+
"text": "{"error":"Setup guide 'foo' not found","available":[{"key":"npm","name":"NPM Stylesheet Setup","description":"Setup instructions for using the stylesheet package via npm."},{"key":"cdn","name":"CDN Stylesheet Setup","description":"Setup instructions for using the stylesheet via CDN."}]}",
|
|
8
|
+
"type": "text",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
13
|
+
|
|
14
|
+
exports[`getSetupGuide handler > should return all setup guides if no type is given 1`] = `
|
|
15
|
+
{
|
|
16
|
+
"content": [
|
|
17
|
+
{
|
|
18
|
+
"text": "{"message":"Multiple setup options available. Choose based on user preference or project requirements.","options":[{"type":"npm","name":"NPM Stylesheet Setup","description":"Setup instructions for using the stylesheet package via npm.","guide":{"name":"NPM Stylesheet Setup","description":"Setup instructions for using the stylesheet package via npm.","steps":[{"title":"Install the stylesheet package","description":"Choose your package manager:","code":"# NPM\\nnpm install @triptease/stylesheet\\n\\n# Yarn\\nyarn add @triptease/stylesheet\\n\\n# Bun\\nbun add @triptease/stylesheet","language":"bash"},{"title":"Import the stylesheet","description":"Add this import to your application entry point:","code":"import '@triptease/stylesheet';","language":"typescript"}],"notes":["Current version: @triptease/stylesheet@1.4.1"]}},{"type":"cdn","name":"CDN Stylesheet Setup","description":"Setup instructions for using the stylesheet via CDN.","guide":{"name":"CDN Stylesheet Setup","description":"Setup instructions for using the stylesheet via CDN.","steps":[{"title":"Add stylesheet link to HTML","description":"Include this in the <head> of your HTML document:","code":"<head>\\n <!-- Specific version (recommended) -->\\n <link rel=\\"stylesheet\\" href=\\"https://cdn.design-system.triptease.io/1.4.1/triptease.css\\">\\n\\n <!-- Or, latest version (dangerous - breaking changes may occur) -->\\n <link rel=\\"stylesheet\\" href=\\"https://cdn.design-system.triptease.io/triptease.css\\">\\n</head>","language":"html"}]}}]}",
|
|
19
|
+
"type": "text",
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
`;
|
|
24
|
+
|
|
25
|
+
exports[`getSetupGuide handler > should return an error for an invalid type 1`] = `
|
|
26
|
+
{
|
|
27
|
+
"content": [
|
|
28
|
+
{
|
|
29
|
+
"text": "{"error":"Setup guide 'invalidtype' not found","available":[{"key":"npm","name":"NPM Stylesheet Setup","description":"Setup instructions for using the stylesheet package via npm."},{"key":"cdn","name":"CDN Stylesheet Setup","description":"Setup instructions for using the stylesheet via CDN."}]}",
|
|
30
|
+
"type": "text",
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import handler from './handler.js';
|
|
2
|
+
import { describe, it, expect } from 'vitest';
|
|
3
|
+
|
|
4
|
+
describe('getSetupGuide handler', () => {
|
|
5
|
+
it('should return all setup guides if no type is given', () => {
|
|
6
|
+
const result = handler({});
|
|
7
|
+
expect(result).toMatchSnapshot();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should return a specific guide when type is provided', () => {
|
|
11
|
+
const type = 'foo';
|
|
12
|
+
const result = handler({ type });
|
|
13
|
+
expect(result).toMatchSnapshot();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should return an error for an invalid type', () => {
|
|
17
|
+
const result = handler({ type: 'invalidType' });
|
|
18
|
+
expect(result).toMatchSnapshot();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { setupGuides } from './setupGuides.js';
|
|
2
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
|
|
4
|
+
export interface GetSetupGuideArgs {
|
|
5
|
+
type?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default (args: GetSetupGuideArgs): CallToolResult => {
|
|
9
|
+
if (!args.type) {
|
|
10
|
+
const allGuides = Object.entries(setupGuides).map(([key, guide]) => ({
|
|
11
|
+
type: key,
|
|
12
|
+
name: guide.name,
|
|
13
|
+
description: guide.description,
|
|
14
|
+
guide,
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: 'text',
|
|
21
|
+
text: JSON.stringify({
|
|
22
|
+
message: 'Multiple setup options available. Choose based on user preference or project requirements.',
|
|
23
|
+
options: allGuides,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const guideType = args.type.toLowerCase();
|
|
31
|
+
const guide = setupGuides[guideType];
|
|
32
|
+
|
|
33
|
+
if (!guide) {
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: 'text',
|
|
38
|
+
text: JSON.stringify({
|
|
39
|
+
error: `Setup guide '${guideType}' not found`,
|
|
40
|
+
available: Object.keys(setupGuides).map((key) => ({
|
|
41
|
+
key,
|
|
42
|
+
name: setupGuides[key].name,
|
|
43
|
+
description: setupGuides[key].description,
|
|
44
|
+
})),
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
content: [
|
|
53
|
+
{
|
|
54
|
+
type: 'text',
|
|
55
|
+
text: JSON.stringify(guide, null, 2),
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import handler from './handler.js';
|
|
3
|
+
|
|
4
|
+
const toolDefinition = {
|
|
5
|
+
name: 'get_setup_guide',
|
|
6
|
+
config: {
|
|
7
|
+
description: 'Get setup and installation instructions for integrating the design system into your project',
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: z
|
|
10
|
+
.union([z.literal('npm'), z.literal('cdn')])
|
|
11
|
+
.optional()
|
|
12
|
+
.describe(
|
|
13
|
+
'Optional: npm for npm/yarn/bun installation, cdn for CDN link. If omitted, returns both options so you can present them to the user.'
|
|
14
|
+
),
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
handler: handler,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default toolDefinition;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import packageJson from '@/../package.json' with { type: 'json' };
|
|
2
|
+
|
|
3
|
+
const stylesheetVersion = packageJson.dependencies['@triptease/stylesheet'];
|
|
4
|
+
|
|
5
|
+
export interface SetupGuide {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
steps: Array<{
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
code?: string;
|
|
12
|
+
language?: string;
|
|
13
|
+
}>;
|
|
14
|
+
notes?: string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const setupGuides: Record<string, SetupGuide> = {
|
|
18
|
+
npm: {
|
|
19
|
+
name: 'NPM Stylesheet Setup',
|
|
20
|
+
description: 'Setup instructions for using the stylesheet package via npm.',
|
|
21
|
+
steps: [
|
|
22
|
+
{
|
|
23
|
+
title: 'Install the stylesheet package',
|
|
24
|
+
description: 'Choose your package manager:',
|
|
25
|
+
code: `# NPM
|
|
26
|
+
npm install @triptease/stylesheet
|
|
27
|
+
|
|
28
|
+
# Yarn
|
|
29
|
+
yarn add @triptease/stylesheet
|
|
30
|
+
|
|
31
|
+
# Bun
|
|
32
|
+
bun add @triptease/stylesheet`,
|
|
33
|
+
language: 'bash',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
title: 'Import the stylesheet',
|
|
37
|
+
description: 'Add this import to your application entry point:',
|
|
38
|
+
code: `import '@triptease/stylesheet';`,
|
|
39
|
+
language: 'typescript',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
notes: [`Current version: @triptease/stylesheet@${stylesheetVersion}`],
|
|
43
|
+
},
|
|
44
|
+
cdn: {
|
|
45
|
+
name: 'CDN Stylesheet Setup',
|
|
46
|
+
description: 'Setup instructions for using the stylesheet via CDN.',
|
|
47
|
+
steps: [
|
|
48
|
+
{
|
|
49
|
+
title: 'Add stylesheet link to HTML',
|
|
50
|
+
description: 'Include this in the <head> of your HTML document:',
|
|
51
|
+
code: `<head>
|
|
52
|
+
<!-- Specific version (recommended) -->
|
|
53
|
+
<link rel="stylesheet" href="https://cdn.design-system.triptease.io/${stylesheetVersion}/triptease.css">
|
|
54
|
+
|
|
55
|
+
<!-- Or, latest version (dangerous - breaking changes may occur) -->
|
|
56
|
+
<link rel="stylesheet" href="https://cdn.design-system.triptease.io/triptease.css">
|
|
57
|
+
</head>`,
|
|
58
|
+
language: 'html',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`listCSSTokens handler > should summarise all available tokens 1`] = `
|
|
4
|
+
{
|
|
5
|
+
"content": [
|
|
6
|
+
{
|
|
7
|
+
"text": "{"color":{"count":53},"font":{"count":15},"space":{"count":20},"border":{"count":1},"border-radius":{"count":3},"box-shadow":{"count":3}}",
|
|
8
|
+
"type": "text",
|
|
9
|
+
},
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
`;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import designTokens from '@triptease/stylesheet/tokens' with { type: 'json' };
|
|
3
|
+
import { buildTokens } from '@/tools/getCSSTokens/utils.js';
|
|
4
|
+
|
|
5
|
+
interface Summary {
|
|
6
|
+
count: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface SummaryMap {
|
|
10
|
+
[category: string]: Summary;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default (): CallToolResult => {
|
|
14
|
+
const tokens = buildTokens(designTokens);
|
|
15
|
+
|
|
16
|
+
const categories = Object.keys(tokens);
|
|
17
|
+
const result: SummaryMap = {};
|
|
18
|
+
|
|
19
|
+
for (const category of categories) {
|
|
20
|
+
const tokenCount = tokens[category].length;
|
|
21
|
+
result[category] = { count: tokenCount };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
type: 'text',
|
|
28
|
+
text: JSON.stringify(result),
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import handler from './handler.js';
|
|
2
|
+
|
|
3
|
+
const toolDefinition = {
|
|
4
|
+
name: 'list_css_tokens',
|
|
5
|
+
config: {
|
|
6
|
+
description:
|
|
7
|
+
'Returns a summary of all available CSS tokens with a count of how many tokens exist in each category. Category names are used when using the get_css_tokens tool.',
|
|
8
|
+
},
|
|
9
|
+
handler: handler,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default toolDefinition;
|