Skip to content

fix: pretty-print + visible palette + single-file data browser - #9

Merged
melvincarvalho merged 2 commits into
gh-pagesfrom
fix-data-browser-visible-palette
May 16, 2026
Merged

melvincarvalho merged 2 commits into
gh-pagesfrom
fix-data-browser-visible-palette

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Summary

Three small edits to the data browser shipped in 0.0.11. Bumps to 0.0.12.

  1. Pretty-print the JSON-LD with 2-space indent before linking URIs. The previous code dumped the raw single-line JSON; white-space:pre-wrap made it wrap into a wall of text with no visible structure.
  2. Palette tuned for visible contrast. Body #fafaf8 → #f3eee5 (warm cream that's clearly off-white), card border-radius 8 → 12, padding 1 → 1.5em, shadow opacity 6% → 8% with a softer larger blur, link color #0366d6 → #0a66c2. The CSS rules in 0.0.11 were applying correctly (verified via computed-style readout) — the bug was that I picked colors too close to each other to be perceivable.
  3. Single-file refactor. The CSS now lives inside data-browser.js as a <style> injected on first run. data-browser.css becomes an intentionally-empty stub so JSS's auto-fetch of the .css sibling URL (mashlib/index.js:307) still returns 200 — no console warning, no two-file version-skew risk, one file owns the experience. A future JSS PR can drop the sibling fetch entirely and the stub goes away.

Test plan

  • Local headless render: cream body is visibly off-white, white card has a visible drop shadow + rounded corners, JSON renders with indentation, every URI is a clickable <a>.
  • After merge + publish 0.0.12: npx jspod@0.0.12 from a clean dir, navigate to a Solid resource, confirm the new look.

Why this is bigger than I said

The original spike target was ~200 bytes for the renderer. With the CSS-in-JS collapse + pretty-print + minimal styling, the runtime is ~800 bytes. Bigger than promised. It's still well under any reasonable threshold for a "data browser," and it removes a whole file from the contract, but it's worth flagging that the budget creep happened: pretty-print (+~30 bytes), inline <style> boilerplate (+~50 bytes), CSS itself (~400 bytes), comments (~250 bytes).

What's next

Open a JSS PR to make the .css sibling fetch optional when --mashlib-module is set. That unlocks deleting the stub .css and positioning this implementation as a baseline JSS mashlib.

Refs #1

Two visual fixes to the minimal data browser shipped in 0.0.11:

1. JSON-LD is now pretty-printed with 2-space indent before being
   handed to the URI-linking regex. The previous version just dumped
   the raw single-line JSON; white-space:pre-wrap made it wrap but
   the result was a wall of text with no visible structure. The PR
   description that introduced this file used the word "pretty-print"
   but the code that landed didn't actually parse+stringify.

2. CSS palette tuned so the styling is actually visible:
   - Body background #fafaf8 -> #f3eee5 (warm cream that's clearly
     distinguishable from white at normal monitor calibration; the
     old value was 5 RGB units off from #fff so the card vanished)
   - Card border-radius 8 -> 12px, padding 1 -> 1.5em, shadow opacity
     6% -> 8% with a softer larger blur for a visible lift
   - Link color #0366d6 -> #0a66c2 (more saturated, reads better
     against the cream)

The CSS rules in 0.0.11 were applying correctly — verified by
inspecting computed styles. The bug was that I picked colors too
close to each other for the difference to be perceivable, not that
the rules weren't taking effect.

Bumps jspod to 0.0.12.

Refs #1
CSS now lives inside data-browser.js as a <style> tag injected on
load. data-browser.css becomes an intentionally-empty stub so JSS's
auto-fetch of the .css sibling (mashlib/index.js:307) still 200s —
no console warning, no two-file version-skew risk, one file owns
the experience. A future JSS PR can drop the sibling fetch and the
stub goes away entirely.

Refs #1
@melvincarvalho
melvincarvalho merged commit de7ad9d into gh-pages May 16, 2026
@melvincarvalho
melvincarvalho deleted the fix-data-browser-visible-palette branch May 16, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant