mirror of
https://github.com/bitbaum/bip-kit.git
synced 2026-12-04 05:17:05 +01:00
#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>
99 lines
2.3 KiB
JSON
99 lines
2.3 KiB
JSON
{
|
|
"name": "bip-kit",
|
|
"version": "0.2.7",
|
|
"description": "Building in Public, as a content contract: parse markdown into typed blocks and render them with a reference React renderer (bip-kit/react) \u2014 blog, roadmap, changelog on your product site, bring your own design tokens.",
|
|
"license": "MIT",
|
|
"author": "Mao Nakamoto",
|
|
"homepage": "https://github.com/bitbaum/bip-kit#readme",
|
|
"repository": {
|
|
"type": "git",
|
|
"url": "git+https://github.com/bitbaum/bip-kit.git"
|
|
},
|
|
"bugs": {
|
|
"url": "https://github.com/bitbaum/bip-kit/issues"
|
|
},
|
|
"keywords": [
|
|
"build-in-public",
|
|
"blog",
|
|
"roadmap",
|
|
"changelog",
|
|
"markdown",
|
|
"headless",
|
|
"content",
|
|
"nextjs",
|
|
"react",
|
|
"rsc",
|
|
"renderer"
|
|
],
|
|
"type": "module",
|
|
"sideEffects": false,
|
|
"packageManager": "pnpm@11.25.0",
|
|
"engines": {
|
|
"node": ">=20"
|
|
},
|
|
"publishConfig": {
|
|
"access": "public",
|
|
"provenance": true
|
|
},
|
|
"files": [
|
|
"dist",
|
|
"styles.css"
|
|
],
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"default": "./dist/index.js"
|
|
},
|
|
"./react": {
|
|
"types": "./dist/react/index.d.ts",
|
|
"default": "./dist/react/index.js"
|
|
},
|
|
"./react/mermaid": {
|
|
"types": "./dist/react/mermaid.d.ts",
|
|
"default": "./dist/react/mermaid.js"
|
|
},
|
|
"./styles.css": "./styles.css"
|
|
},
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.json",
|
|
"lint": "eslint .",
|
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
"test": "node --test test/*.test.js",
|
|
"verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run build && pnpm test",
|
|
"prepare": "pnpm run build",
|
|
"format": "prettier --write .",
|
|
"format:check": "prettier --check ."
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10.0.1",
|
|
"@types/node": "^26.4.0",
|
|
"@types/react": "^19.2.18",
|
|
"eslint": "^10.9.1",
|
|
"globals": "^17.11.0",
|
|
"katex": "^0.18.5",
|
|
"prettier": "^3.9.6",
|
|
"react": "^19.2.8",
|
|
"react-dom": "^19.2.8",
|
|
"shiki": "^4.4.3",
|
|
"typescript": "^6.0.3",
|
|
"typescript-eslint": "^8.68.0"
|
|
},
|
|
"peerDependencies": {
|
|
"react": ">=18",
|
|
"shiki": ">=1",
|
|
"mermaid": ">=10",
|
|
"katex": ">=0.16"
|
|
},
|
|
"peerDependenciesMeta": {
|
|
"shiki": {
|
|
"optional": true
|
|
},
|
|
"mermaid": {
|
|
"optional": true
|
|
},
|
|
"katex": {
|
|
"optional": true
|
|
}
|
|
}
|
|
}
|