Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 5 additions & 52 deletions src/resources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { logError } from '../utils/logger.js';
import { getAxiosImplementation } from '../utils/framework.js';
import { handleGetThemeMetadata } from './tweakcn/get-theme-metadata.js';

/**
Expand Down Expand Up @@ -33,59 +34,11 @@ export const resources = [
*/
const getComponentsList = async () => {
try {
// List of available components in shadcn/ui
// This hardcoded list can be updated in the future if needed
const components = [
"accordion",
"alert",
"alert-dialog",
"aspect-ratio",
"avatar",
"badge",
"breadcrumb",
"button",
"calendar",
"card",
"carousel",
"checkbox",
"collapsible",
"command",
"context-menu",
"data-table",
"date-picker",
"dialog",
"drawer",
"dropdown-menu",
"form",
"hover-card",
"input",
"label",
"menubar",
"navigation-menu",
"pagination",
"popover",
"progress",
"radio-group",
"resizable",
"scroll-area",
"select",
"separator",
"sheet",
"skeleton",
"slider",
"sonner",
"switch",
"table",
"tabs",
"textarea",
"toast",
"toggle",
"toggle-group",
"tooltip"
];
const axios = await getAxiosImplementation();
const components = await axios.getAvailableComponents();

return {
content: JSON.stringify(components, null, 2),
content: JSON.stringify(components.sort(), null, 2),
contentType: 'application/json',
};
} catch (error) {
Expand All @@ -107,4 +60,4 @@ const getComponentsList = async () => {
export const resourceHandlers = {
'resource:get_components': getComponentsList,
'resource:get_theme_metadata': handleGetThemeMetadata,
};
};
32 changes: 29 additions & 3 deletions src/utils/axios-react-native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,38 @@ async function getAvailableComponents(): Promise<string[]> {
*/
function getFallbackComponents(): string[] {
return [
"accordion",
"alert",
"alert-dialog",
"aspect-ratio",
"avatar",
"badge",
"button",
"input",
"card",
"checkbox",
"collapsible",
"context-menu",
"dialog",
"dropdown-menu",
"hover-card",
"icon",
"input",
"label",
"menubar",
"native-only-animated-view",
"popover",
"progress",
"radio-group",
"select",
"separator",
"skeleton",
"switch",
"tabs",
"text",
"view",
// Add more as needed based on the actual registry
"textarea",
"toggle",
"toggle-group",
"tooltip",
];
}

Expand Down
12 changes: 11 additions & 1 deletion src/utils/axios-svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ function getFallbackComponents(): string[] {
'badge',
'breadcrumb',
'button',
'button-group',
'calendar',
'card',
'carousel',
Expand All @@ -143,20 +144,28 @@ function getFallbackComponents(): string[] {
'collapsible',
'command',
'context-menu',
'data-table',
'dialog',
'drawer',
'dropdown-menu',
'empty',
'field',
'form',
'hover-card',
'input',
'input-group',
'input-otp',
'item',
'kbd',
'label',
'menubar',
'native-select',
'navigation-menu',
'pagination',
'popover',
'progress',
'radio-group',
'range-calendar',
'resizable',
'scroll-area',
'select',
Expand All @@ -166,6 +175,7 @@ function getFallbackComponents(): string[] {
'skeleton',
'slider',
'sonner',
'spinner',
'switch',
'table',
'tabs',
Expand Down Expand Up @@ -848,4 +858,4 @@ export const axios = {
REGISTRY_PATH,
BLOCKS
}
}
}
16 changes: 13 additions & 3 deletions src/utils/axios-vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,24 +231,31 @@ function getFallbackComponents(): string[] {
"badge",
"breadcrumb",
"button",
"button-group",
"calendar",
"card",
"carousel",
"chart",
"checkbox",
"collapsible",
"combobox",
"command",
"context-menu",
"data-table",
"date-picker",
"dialog",
"drawer",
"dropdown-menu",
"empty",
"field",
"form",
"hover-card",
"input",
"input-group",
"input-otp",
"item",
"kbd",
"label",
"menubar",
"native-select",
"navigation-menu",
"number-field",
"pagination",
Expand All @@ -262,14 +269,17 @@ function getFallbackComponents(): string[] {
"select",
"separator",
"sheet",
"sidebar",
"skeleton",
"slider",
"sonner",
"spinner",
"stepper",
"switch",
"table",
"tabs",
"tags-input",
"textarea",
"toast",
"toggle",
"toggle-group",
"tooltip",
Expand Down
11 changes: 10 additions & 1 deletion src/utils/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,23 +138,31 @@ function getFallbackComponents(): string[] {
'badge',
'breadcrumb',
'button',
'button-group',
'calendar',
'card',
'carousel',
'chart',
'checkbox',
'collapsible',
'combobox',
'command',
'context-menu',
'dialog',
'drawer',
'dropdown-menu',
'empty',
'field',
'form',
'hover-card',
'input',
'input-group',
'input-otp',
'item',
'kbd',
'label',
'menubar',
'native-select',
'navigation-menu',
'pagination',
'popover',
Expand All @@ -169,6 +177,7 @@ function getFallbackComponents(): string[] {
'skeleton',
'slider',
'sonner',
'spinner',
'switch',
'table',
'tabs',
Expand Down Expand Up @@ -858,4 +867,4 @@ export const axios = {
REGISTRY_PATH,
NEW_YORK_V4_PATH
}
}
}
Loading