Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"svelte-doc-llm": "^0.5.1",
"svelte-lib-helpers": "^0.4.31",
"svelte-meta-tags": "^4.5.0",
"svelte-rune-highlight": "^0.7.1",
"svelte-rune-highlight": "^0.8.0",
"tailwindcss": "^4.1.16",
"tsx": "^4.20.6",
"typescript": "^5.9.3",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions src/routes/docs/pages/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,27 @@ description: Learn more about the value types and class interfaces that you can
---

<script lang="ts">
import TypeList from '$lib/types.ts?raw';
import { LlmLink } from '../../utils';
import { Highlight } from 'svelte-rune-highlight';
import HighlightCompo from "../../utils/HighlightCompo.svelte";
import typescript from 'highlight.js/lib/languages/typescript';
const examples = import.meta.glob('../../../lib/types.ts', {
query: '?raw',
import: 'default',
eager: true
});
const tsLang = {
name: 'typescript',
register: typescript
};
</script>

## Typescript types

Enhance the reliability and scalability of your user interface code by leveraging data types. The following excerpt shows you the full list of TypeScript types and interfaces that are being used with the Flowbite Svelte library.

<HighlightCompo codeLang="ts" code={TypeList as string} class="max-w-7xl bg-white" />
<HighlightCompo language={tsLang} code={examples["../../../lib/types.ts"] as string} class="max-w-7xl bg-white" />


## LLM Link

Expand Down
27 changes: 20 additions & 7 deletions src/routes/utils/HighlightCompo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,39 @@
import { Button, Badge } from "$lib";
import { copyToClipboard, replaceLibImport } from "./helpers";
import { highlightcompo } from "./theme";
import type { LanguageFn } from "highlight.js";
type HighlightLanguage = {
name: string;
register: LanguageFn;
};
interface Props {
// componentStatus: boolean;
code: string;
badgeClass?: string;
buttonClass?: string;
codeLang?: string;
language: HighlightLanguage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | πŸ”΄ Critical

🧩 Analysis chain

Verify all usages have been updated for the breaking API change.

The prop has changed from optional codeLang?: string to required language: HighlightLanguage. According to previous review comments, 18+ component usages in the codebase had not been updated. Please verify all usages now pass the correct language prop.


🏁 Script executed:

#!/bin/bash
# Description: Verify all HighlightCompo usages now use the new language prop

# Search for HighlightCompo component usages
echo "=== HighlightCompo usages ==="
rg -nP --glob='*.svelte' -C3 '<HighlightCompo'

# Search for any remaining references to deprecated codeLang prop
echo -e "\n=== Deprecated codeLang usage ==="
rg -nP --glob='*.svelte' 'codeLang='

# Check for HighlightCompo usages without language prop
echo -e "\n=== Checking for missing language prop ==="
rg -nPU --glob='*.svelte' '<HighlightCompo(?:(?!language=)[^>])*>'

Length of output: 20682


Fix incompatible HighlightCompo usages across the codebase.

The component change to require language: HighlightLanguage has not been fully applied. 20 usages remain incompatible:

  • 6 usages in src/routes/builder/skeleton/+page.svelte (lines 142, 159, 174, 189, 200, 229): missing language prop entirely
  • 13 usages in src/routes/docs-examples/extend/clipboard-manager/+page.svelte (lines 28, 42, 61, 79, 99, 119, 133, 172, 189, 202, 216, 233, 247): still using deprecated codeLang prop
  • 1 usage in src/routes/admin-dashboard/(sidebar)/quickstart/+page.svelte (line 21): still using deprecated codeLang prop

Update all instances to pass the new language prop with a valid HighlightLanguage value.

πŸ€– Prompt for AI Agents
In src/routes/utils/HighlightCompo.svelte around line 18 the prop signature was
changed to require language: HighlightLanguage; but many call sites still omit
it or use deprecated codeLang; update all listed usages to pass the new language
prop with a valid HighlightLanguage value: in
src/routes/builder/skeleton/+page.svelte (lines 142, 159, 174, 189, 200, 229)
add language="..." appropriate to the snippet; in
src/routes/docs-examples/extend/clipboard-manager/+page.svelte (lines 28, 42,
61, 79, 99, 119, 133, 172, 189, 202, 216, 233, 247) replace codeLang={...} with
language={...} using the correct HighlightLanguage enum/value; and in
src/routes/admin-dashboard/(sidebar)/quickstart/+page.svelte (line 21) likewise
replace codeLang with language; ensure values are valid HighlightLanguage
entries and run typecheck to confirm no remaining incompatibilities.

class?: string;
replaceLib?: boolean;
// Highlight.svelte props
numberLine?: boolean;
langtag?: boolean;
hideBorder?: boolean;
wrapLines?: boolean;
startingLineNumber?: number;
highlightedLines?: number[];
backgroudColor?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Fix typo in prop name.

The prop name is misspelled as backgroudColor instead of backgroundColor.

Apply this diff to fix the typo:

-    backgroudColor?: string;
+    backgroundColor?: string;
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
backgroudColor?: string;
backgroundColor?: string;
πŸ€– Prompt for AI Agents
In src/routes/utils/HighlightCompo.svelte around line 28, the prop name is
misspelled as "backgroudColor"; rename the prop to "backgroundColor" everywhere
it's declared and referenced (including type annotations, props export, and any
usages within the component and its consumers) to ensure consistency and avoid
runtime/typing errors.

position?: "static" | "relative" | "absolute" | "sticky" | undefined;
}
let { code, codeLang, badgeClass, buttonClass, replaceLib = true, class: className }: Props = $props();
let { code, language, badgeClass, buttonClass, replaceLib = true, class: className, ...restProps }: Props = $props();
const mdLang = {
name: "markdown",
register: markdown
};
const processedCode = $derived(replaceLib ? replaceLibImport(code) : code);
// console.log('code: ', code)
let showExpandButton: boolean = $state(false);
let expand: boolean = $state(false);
Expand Down Expand Up @@ -60,10 +73,10 @@
{#if copiedStatus}
<Badge class={badge({ class: badgeClass })} color="green">Copied to clipboard</Badge>
{/if}
{#if codeLang === "md"}
<Highlight language={mdLang} code={processedCode} />
{#if ["markdown", "md"].includes(language.name)}
<Highlight language={mdLang} code={processedCode} {...restProps} />
{:else if code}
<HighlightSvelte code={processedCode} />
<HighlightSvelte code={processedCode} {...restProps} />
{:else}
no code is provided
{/if}
Expand Down