diff --git a/.gitignore b/.gitignore index bdef460f..5117c8d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,15 @@ # Deps -node_modules +node_modules/ # Output -/.svelte-kit -/build -/dist -/dist_* -/target -/.gro -/.zzz +.svelte-kit/ +build/ +dist/ +dist_*/ +target/ +.gro/ +.fuz/ +.zzz/ # Env .env* diff --git a/CLAUDE.md b/CLAUDE.md index 82afa1ba..0a380343 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,6 +6,16 @@ A modernized fork of PrismJS optimized for runtime syntax highlighting. See [README.md](./README.md). +## Gro commands + +```bash +gro check # typecheck, test, lint, format check (run before committing) +gro typecheck # typecheck only (faster iteration) +gro test # run tests with vitest +gro gen # regenerate .gen files +gro build # build the package for production +``` + ## Commands ```bash @@ -48,8 +58,8 @@ The system uses regex-based tokenization inherited from PrismJS, maintaining com #### Themes -- `src/lib/theme.css` - CSS classes for HTML mode (requires Fuz CSS or theme_variables.css) -- `src/lib/theme_variables.css` - CSS variable definitions for non-Fuz CSS users +- `src/lib/theme.css` - CSS classes for HTML mode (requires fuz_css or theme_variables.css) +- `src/lib/theme_variables.css` - CSS variable definitions for non-fuz_css users ## How It Works @@ -142,10 +152,12 @@ An experimental alternative component (`CodeHighlight.svelte`) is available that for browsers that implement it. This is not recommended for general use due to limited browser support. **Components:** + - `src/lib/CodeHighlight.svelte` - Hybrid component supporting both HTML and range modes with auto-detection - `src/lib/highlight_manager.ts` - Manages CSS Custom Highlights per element **Theme:** + - `src/lib/theme_highlight.css` - CSS with both `.token_*` classes and `::highlight()` pseudo-elements #### Range Highlighting Implementation @@ -203,7 +215,7 @@ Results show relative performance (% of fastest) for each language and content s ## Color Variables -Theme uses CSS variables from Fuz CSS: +Theme uses CSS variables from fuz_css: - `--color_a` - Keywords, tags - `--color_b` - Strings, selectors diff --git a/README.md b/README.md index ae2dcdcb..fe02e188 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,8 @@ but there are two optional dependencies: based on [`prism-svelte`](https://github.com/pngwn/prism-svelte) and a [Svelte component](src/lib/Code.svelte) for convenient usage. - The [default theme](src/lib/theme.css) integrates - with my CSS library [Fuz CSS](https://github.com/fuzdev/fuz_css) for colors that adapt to the user's runtime `color-scheme` preference. - Non-Fuz CSS users should import [theme_variables.css](src/lib/theme_variables.css) + with my CSS library [fuz_css](https://github.com/fuzdev/fuz_css) for colors that adapt to the user's runtime `color-scheme` preference. + Non-fuz_css users should import [theme_variables.css](src/lib/theme_variables.css) or otherwise define those variables. Compared to [Shiki](https://github.com/shikijs/shiki), @@ -79,14 +79,14 @@ import '@fuzdev/fuz_code/theme.css'; ``` The primary themes (currently just [one](src/lib/theme.css)) have a dependency -on my CSS library [Fuz CSS](https://github.com/fuzdev/fuz_css) +on my CSS library [fuz_css](https://github.com/fuzdev/fuz_css) for [color-scheme](https://css.fuz.dev/docs/themes) awareness. -See the [Fuz CSS docs](https://css.fuz.dev/) for its usage. +See the [fuz_css docs](https://css.fuz.dev/) for its usage. -If you're not using Fuz CSS, import `theme_variables.css` alongside `theme.css`: +If you're not using fuz_css, import `theme_variables.css` alongside `theme.css`: ```ts -// Without Fuz CSS: +// Without fuz_css: import '@fuzdev/fuz_code/theme.css'; import '@fuzdev/fuz_code/theme_variables.css'; ``` @@ -96,9 +96,9 @@ import '@fuzdev/fuz_code/theme_variables.css'; - [@fuzdev/fuz_code/syntax_styler_global.js](src/lib/syntax_styler_global.ts) - pre-configured instance with all grammars - [@fuzdev/fuz_code/syntax_styler.js](src/lib/syntax_styler.ts) - base class for custom grammars - [@fuzdev/fuz_code/theme.css](src/lib/theme.css) - - default theme that depends on [Fuz CSS](https://github.com/fuzdev/fuz_css) + default theme that depends on [fuz_css](https://github.com/fuzdev/fuz_css) - [@fuzdev/fuz_code/theme_variables.css](src/lib/theme_variables.css) - - CSS variables for non-Fuz CSS users + CSS variables for non-fuz_css users - [@fuzdev/fuz_code/Code.svelte](src/lib/Code.svelte) - Svelte component for syntax highlighting with HTML generation diff --git a/src/lib/Code.svelte b/src/lib/Code.svelte index e6cc2bc7..58082d1c 100644 --- a/src/lib/Code.svelte +++ b/src/lib/Code.svelte @@ -136,7 +136,7 @@ > diff --git a/src/lib/theme_variables.css b/src/lib/theme_variables.css index 354851c6..6b1e3a47 100644 --- a/src/lib/theme_variables.css +++ b/src/lib/theme_variables.css @@ -1,7 +1,7 @@ /* -CSS variables for syntax highlighting when not using Fuz CSS. -Import this alongside theme.css if you're not using Fuz CSS. +CSS variables for syntax highlighting when not using fuz_css. +Import this alongside theme.css if you're not using fuz_css. */ diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index aa625b0b..21557dd6 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -12,7 +12,7 @@ const library = library_context.get(); -
+
diff --git a/src/routes/CodeTome.svelte b/src/routes/CodeTome.svelte index edbed664..d9e6a43c 100644 --- a/src/routes/CodeTome.svelte +++ b/src/routes/CodeTome.svelte @@ -41,7 +41,7 @@ import '@fuzdev/fuz_code/theme.css'; // add this"

Dependencies

- By default fuz_code depends on Fuz CSS to provide + By default fuz_code depends on fuz_css to provide color-schema-aware color variables. If you're not using it, import theme_variables.css or bring your own:

@@ -49,7 +49,7 @@ import '@fuzdev/fuz_code/theme.css'; // add this" lang="ts" content="// +layout.svelte import '@fuzdev/fuz_code/theme.css'; -import '@fuzdev/fuz_code/theme_variables.css'; // also this if not using Fuz CSS" +import '@fuzdev/fuz_code/theme_variables.css'; // also this if not using fuz_css" />
diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 5dd36089..c0a7109b 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -15,7 +15,7 @@ {library.package_json.glyph}
-
+
diff --git a/src/routes/benchmark/+page.svelte b/src/routes/benchmark/+page.svelte index 21fb82d2..2e1fbeed 100644 --- a/src/routes/benchmark/+page.svelte +++ b/src/routes/benchmark/+page.svelte @@ -84,7 +84,7 @@

benchmark

- chromium --js-flags="--expose-gc" + chromium --js-flags="--expose-gc"

diff --git a/src/routes/samples/+page.svelte b/src/routes/samples/+page.svelte index eec11ed2..55743818 100644 --- a/src/routes/samples/+page.svelte +++ b/src/routes/samples/+page.svelte @@ -15,7 +15,7 @@
-

HTML rendering (default)

+

HTML rendering (default)