2 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.1 1553adc808 fix(styles): the copy button moves into a toolbar row above the code (v0.2.7) (#30)
#27 cleared the code out from under the copy button with a fixed padding-top
on the <pre> (--bp-copy-clearance, 2.75rem), sized to the button's measured
height of ~30px. That number was the bug waiting to happen: the button's
height is decided by the consumer's stylesheet, not this one. fleetcrown has a
global accessibility rule — `button, summary, select, textarea, [role="button"]
{ min-height: 2.75rem }` under `@media (pointer: coarse)`, the fleet's own 44px
touch-target guideline — so its copy button is 44px tall. top 8px + 44px puts
its bottom at 52px; the first code line starts at 46px. Measured live on
fleetcrown at 390x844 with hasTouch: the button covers the tail of the opening
line. kivvi and botsmann (30px buttons, no coarse-pointer rule) show 0 overlap,
which is exactly what made it fragile: correctness depended on a consumer rule
bip-kit cannot see.

So the fix is to the class of bug, not the number. The button is now in
normal flow: a toolbar row (.bp-codeblock-toolbar — flex, justify-end) above
the <pre>, holding the optional filename label (now a span in that row rather
than a figcaption above the body) and the copy button. Layout pays for the
button's height whatever a consumer sizes it to, so code can never sit under
it. --bp-copy-clearance and the padding-top it drove are deleted.

Kept: desktop hover-reveal under (hover: hover) and (pointer: fine) — fading
is opacity-only, so the toolbar keeps its height and nothing jumps on reveal;
always-visible on touch; data-copied state; focus-visible; clipboard copy.
Toolbar precedes the code in DOM order, so keyboard and screen-reader users
reach "copy" before the thing it copies. Print zeroes the toolbar's top padding
so an empty toolbar (button hidden, no filename) collapses to nothing.

Consumer CSS: grepped all eight sites (orangecat, fleetcrown, evig, botsmann,
datacat, aoz-housing, kivvi, petvity) for bp-copy, bp-codeblock-body,
copy-clearance, bp-codeblock-filename — no overrides anywhere. Only
theming vars and orangecat's shiki-span color scope touch bp-codeblock-*.

Guards: test/styles.test.js asserts no rule mentioning .bp-copy positions it
out of flow, that .bp-codeblock-toolbar is a flex row in flow, that
--bp-copy-clearance is gone and the scroller reserves no padding-top, and that
print collapses the toolbar. test/react-render.test.js asserts the toolbar
(containing the one copy button) closes before the <pre> opens, for the plain
and shiki paths, with and without a filename. Mutation-proved: restoring
position:absolute on .bp-copy → red (1 test); reintroducing the clearance var
+ padding-top → red (1); moving CopyButton below the code → red (2); restored
→ 150/150 green.

Rendered check with the built dist and fleetcrown's coarse-pointer rule
injected: at 390x844 hasTouch the button is 44px tall, bottom at 53px, first
code text at 64px, no intersection, scrollWidth == clientWidth; at 1440 the
button rests at opacity 0, reveals to 1 on hover of that block, block height
unchanged (jump 0).


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 17:31:45 -07:00
CatoandClaude Fable 5 a711d1834e feat: v0.2 — inline model, extended block vocabulary, react reference renderer (#18)
One vocabulary + one reference renderer so every fleet site reads long-form
at the same standard, while typography tokens stay per-site.

Parser (root export, still zero-dep; the v0.1 ten block types unchanged):
- Inline model: parseInline → text/strong/em/code/link/footnoteRef spans;
  every text-bearing block keeps `text` and gains additive `spans`.
- New blocks: h4, hr, figure (caption title), gallery (adjacent images
  merge), callout (GitHub > [!NOTE] syntax, nestable), pullquote (>> with
  — cite), mermaid, chart (tiny declarative spec; malformed specs THROW),
  math ($$), footnote defs, stats fence.
- Headings gain slugified, de-duplicated, umlaut-aware ids (kivvi's scheme).
- parseFrontmatter learns YAML arrays (inline + block lists), still dep-free.
- Helpers: extractToc, readingTime, slugify/createSlugger, parseChartSpec.

Renderer (new bip-kit/react subpath + bip-kit/styles.css):
- ArticleBody: async RSC that pre-awaits shiki/katex, then emits a fully
  synchronous tree (renderToString-safe). Server components for every block;
  client islands: Toc (scroll-spy, hidden under 3 headings), ReadingProgress,
  Lightbox, CopyButton. MermaidBlock on its own bip-kit/react/mermaid subpath
  so the mermaid peer never enters uninterested bundles (components override).
- shiki/katex are optional peers loaded via bundler-invisible dynamic import;
  honest degradation without them (mono <pre>, TeX source with data-math).
- styles.css: complete neutral theme — 70ch measure, real vertical rhythm,
  dark mode via vars only (data-theme wins over prefers-color-scheme),
  mobile-first, print-safe; every color/radius/font is a --bp-* custom
  property (theming contract documented in the README).

CI: ci.yml gains workflow_dispatch (re-arm strand — a GITHUB_TOKEN merge
cannot trigger workflows on its own; threadkit#28 pattern).

96 tests: v0.1 compat goldens (original shapes byte-identical after
stripping additive fields), goldens for every new syntax form and edge case,
renderToString smoke tests for every block type with and without the
optional peers (BIPKIT_DISABLE_PEERS seam), consumer-install pack test now
probing ./react, ./react/mermaid and ./styles.css.


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-05 16:03:53 +00:00