Skip to content

AMDphreak/code-lens

Repository files navigation

code-lens

Deploy GitHub Pages License: MIT Live demo pnpm monorepo

One snippet, multiple pedagogical naming conventions — the real lens for code examples (not a metaphor).

Live demo: ryanjohnson.dev/code-lens

Delivery model

In Solid/React/Next you install a component — e.g. import { CodeLens } from "@code-lens/solid". Under the hood one shared engine powers every framework package; you don’t touch that unless you’re on plain HTML.

Layer Package
Component (your import) @code-lens/solid, @code-lens/react, …
Skin @code-lens/css or @code-lens/tailwind (planned)
Engine @code-lens/vanilla + @code-lens/core (pulled in automatically)

docs/ecosystem.md

Quick start

pnpm install
pnpm dev          # SolidJS + solid-ui demo (port 5174) — mounts vanilla <code-lens>
import "@code-lens/css";
import { createCodeLens, registerCodeLens } from "@code-lens/vanilla";
import { parseLensBlock, parseThemes, parseUi } from "@code-lens/core";

registerCodeLens();
const el = createCodeLens({
  document: parseLensBlock(blockJson5),
  themes: parseThemes(themesJson5),
  ui: parseUi(uiJson5),
}, "earth");
document.body.appendChild(el);
<code-lens theme="earth" appearance="auto"></code-lens>

appearance: auto | light | dark — independent of pedagogical color theme.

slotHighlight: plain | box — rounded highlight on changeable tokens (default plain).

Portable spec

File Role
spec/examples/*.json5 Aligned token data per lens
spec/themes.json5 Color schemes (light/dark per theme)
spec/ui.json5 Interaction + animation

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors