Skip to content

Commit b9eede5

Browse files
committed
refactor: code block thems
1 parent 5be1e5a commit b9eede5

21 files changed

+112
-25
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
"@chakra-ui/react": patch
3+
---
4+
5+
**CodeBlock**: Add configurable theme support and sync loading for Shiki adapter
6+
7+
- **Theme configuration is now required** - The `theme` property must be
8+
explicitly provided to `createShikiAdapter`
9+
- **Removed hard-coded theme fallbacks** - Missing themes now throw descriptive
10+
errors
11+
- **Optional sync loading** with `loadSync` method for better performance
12+
13+
```typescript
14+
// Before
15+
const adapter = createShikiAdapter({
16+
async load() { /* ... */ },
17+
})
18+
19+
// After
20+
const adapter = createShikiAdapter({
21+
async load() { /* ... */ },
22+
theme: {
23+
light: "github-light",
24+
dark: "github-dark",
25+
},
26+
})
27+
```

.changeset/yellow-readers-tell.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
"@chakra-ui/react": minor
3+
---
4+
5+
**Listbox [New]**: Add new component with support for single/multi-select,
6+
grouping, virtualization, controlled state, icons, descriptions, and
7+
accessibility features.
8+
9+
This component can be used to build command palettes, dropdowns with search, and
10+
much more.
11+
12+
```tsx
13+
<Listbox.Root collection={frameworks} width="320px">
14+
<Listbox.Label>Select framework</Listbox.Label>
15+
<Listbox.Content>
16+
{frameworks.items.map((framework) => (
17+
<Listbox.Item item={framework} key={framework.value}>
18+
<Listbox.ItemText>{framework.label}</Listbox.ItemText>
19+
<Listbox.ItemIndicator />
20+
</Listbox.Item>
21+
))}
22+
</Listbox.Content>
23+
</Listbox.Root>
24+
```

apps/compositions/src/examples/code-block-basic.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
3232
const { createHighlighter } = await import("shiki")
3333
return createHighlighter({
3434
langs: ["tsx", "scss", "html", "bash", "json"],
35-
themes: ["github-dark", "github-light"],
35+
themes: ["github-dark"],
3636
})
3737
},
38+
theme: "github-dark",
3839
})

apps/compositions/src/examples/code-block-with-copy-button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
4343
themes: ["github-dark"],
4444
})
4545
},
46+
theme: "github-dark",
4647
})

apps/compositions/src/examples/code-block-with-custom-action.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
5151
const { createHighlighter } = await import("shiki")
5252
return createHighlighter({
5353
langs: ["tsx", "scss", "html", "bash", "json"],
54-
themes: ["github-dark", "github-light"],
54+
themes: ["github-dark"],
5555
})
5656
},
57+
theme: "github-dark",
5758
})

apps/compositions/src/examples/code-block-with-diff.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
4343
const { createHighlighter } = await import("shiki")
4444
return createHighlighter({
4545
langs: ["tsx", "scss", "html", "bash", "json"],
46-
themes: ["github-dark", "github-light"],
46+
themes: ["github-dark"],
4747
})
4848
},
49+
theme: "github-dark",
4950
})

apps/compositions/src/examples/code-block-with-floating-copy-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
4444
const { createHighlighter } = await import("shiki")
4545
return createHighlighter({
4646
langs: ["tsx", "scss", "html", "bash", "json"],
47-
themes: ["github-dark", "github-light"],
47+
themes: ["github-dark"],
4848
})
4949
},
50+
theme: "github-dark",
5051
})

apps/compositions/src/examples/code-block-with-language-switcher.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
8686
const { createHighlighter } = await import("shiki")
8787
return createHighlighter({
8888
langs: ["python", "typescript"],
89-
themes: ["github-dark", "github-light"],
89+
themes: ["github-dark"],
9090
})
9191
},
92+
theme: "github-dark",
9293
})
9394

9495
interface CodeFile {

apps/compositions/src/examples/code-block-with-line-focus.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
4040
const { createHighlighter } = await import("shiki")
4141
return createHighlighter({
4242
langs: ["tsx", "scss", "html", "bash", "json"],
43-
themes: ["github-dark", "github-light"],
43+
themes: ["github-dark"],
4444
})
4545
},
46+
theme: "github-dark",
4647
})

apps/compositions/src/examples/code-block-with-line-highlight.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ const shikiAdapter = createShikiAdapter<HighlighterGeneric<any, any>>({
3636
const { createHighlighter } = await import("shiki")
3737
return createHighlighter({
3838
langs: ["tsx", "scss", "html", "bash", "json"],
39-
themes: ["github-dark", "github-light"],
39+
themes: ["github-dark"],
4040
})
4141
},
42+
theme: "github-dark",
4243
})

0 commit comments

Comments
 (0)