Skip to content

Commit 8d040ad

Browse files
authored
feat: add more playground providers (#1607)
1 parent 57738e8 commit 8d040ad

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

app/components/Package/Playgrounds.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ const providerIcons: Record<string, string> = {
1616
'nuxt-new': 'i-simple-icons:nuxtdotjs',
1717
'vite-new': 'i-simple-icons:vite',
1818
'jsfiddle': 'i-lucide:code',
19+
'typescript-playground': 'i-simple-icons:typescript',
20+
'solid-playground': 'i-simple-icons:solid',
21+
'svelte-playground': 'i-simple-icons:svelte',
22+
'tailwind-playground': 'i-simple-icons:tailwindcss',
1923
}
2024
2125
// Map provider id to color class
@@ -29,6 +33,10 @@ const providerColors: Record<string, string> = {
2933
'nuxt-new': 'text-provider-nuxt',
3034
'vite-new': 'text-provider-vite',
3135
'jsfiddle': 'text-provider-jsfiddle',
36+
'typescript-playground': 'text-provider-typescript',
37+
'solid-playground': 'text-provider-solid',
38+
'svelte-playground': 'text-provider-svelte',
39+
'tailwind-playground': 'text-provider-tailwind',
3240
}
3341
3442
function getIcon(provider: string): string {

server/utils/readme.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface PlaygroundProvider {
1515
id: string // Provider identifier
1616
name: string
1717
domains: string[] // Associated domains
18-
path?: string
18+
paths?: string[]
1919
icon?: string // Provider icon name
2020
}
2121

@@ -81,9 +81,28 @@ const PLAYGROUND_PROVIDERS: PlaygroundProvider[] = [
8181
id: 'typescript-playground',
8282
name: 'TypeScript Playground',
8383
domains: ['typescriptlang.org'],
84-
path: '/play',
84+
paths: ['/play'],
8585
icon: 'typescript',
8686
},
87+
{
88+
id: 'solid-playground',
89+
name: 'Solid Playground',
90+
domains: ['playground.solidjs.com'],
91+
icon: 'solid',
92+
},
93+
{
94+
id: 'svelte-playground',
95+
name: 'Svelte Playground',
96+
domains: ['svelte.dev'],
97+
paths: ['/repl', '/playground'],
98+
icon: 'svelte',
99+
},
100+
{
101+
id: 'tailwind-playground',
102+
name: 'Tailwind Play',
103+
domains: ['play.tailwindcss.com'],
104+
icon: 'tailwindcss',
105+
},
87106
]
88107

89108
/**
@@ -98,7 +117,7 @@ function matchPlaygroundProvider(url: string): PlaygroundProvider | null {
98117
for (const domain of provider.domains) {
99118
if (
100119
(hostname === domain || hostname.endsWith(`.${domain}`)) &&
101-
(!provider.path || parsed.pathname.startsWith(provider.path))
120+
(!provider.paths || provider.paths.some(path => parsed.pathname.startsWith(path)))
102121
) {
103122
return provider
104123
}

uno.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ export default defineConfig({
100100
nuxt: '#00DC82',
101101
vite: '#646CFF',
102102
jsfiddle: '#0084FF',
103+
typescript: '#3178C6',
104+
solid: '#2C4F7C',
105+
svelte: '#FF3E00',
106+
tailwind: '#06B6D4',
103107
},
104108
},
105109
animation: {

0 commit comments

Comments
 (0)