Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions data-browser.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* jspod minimal data-browser styles. Auto-loaded by JSS as the .css
sibling of data-browser.js (see generateModuleDatabrowserHtml). */
body{font:14px/1.6 system-ui,-apple-system,sans-serif;margin:2em;color:#222;background:#fafaf8}
#mashlib pre{padding:1em;background:#fff;border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.06);overflow:auto;white-space:pre-wrap;word-break:break-all}
a{color:#0366d6;text-decoration:none}
a:hover{text-decoration:underline}
/* Intentionally empty. Styles live inside data-browser.js so the
browser is a single file. JSS auto-fetches this sibling URL
(mashlib/index.js:307); shipping an empty 200 keeps the console
warning-free until JSS makes the .css fetch optional. */
12 changes: 8 additions & 4 deletions data-browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// jspod minimal data browser — the page is the data. JSS embeds the
// resource as JSON-LD in #dataisland; this module just makes it visible
// in #mashlib with clickable URIs. See data-browser.css for the styling.
const d=document.getElementById('dataisland'),m=document.getElementById('mashlib');
m.innerHTML=`<pre>${d.textContent.replace(/https?:\/\/[^"\s]+/g,'<a href="$&">$&</a>')}</pre>`
// resource as JSON-LD in #dataisland; this single module:
// 1. Injects its own <style> (no separate .css fetch needed)
// 2. Parses the JSON-LD and pretty-prints with 2-space indent
// 3. Renders into #mashlib with every URI as a clickable <a>
// Goal: a baseline mashlib that fits in one file, ~800 bytes total.
document.head.insertAdjacentHTML('beforeend','<style>body{font:14px/1.6 system-ui,-apple-system,sans-serif;margin:2em;color:#222;background:#f3eee5}#mashlib pre{padding:1.5em;background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,.08);overflow:auto;white-space:pre-wrap;word-break:break-all}a{color:#0a66c2;text-decoration:none}a:hover{text-decoration:underline}</style>')
const d=JSON.parse(document.getElementById('dataisland').textContent)
document.getElementById('mashlib').innerHTML='<pre>'+JSON.stringify(d,null,2).replace(/https?:\/\/[^"\s]+/g,'<a href="$&">$&</a>')+'</pre>'
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jspod",
"version": "0.0.11",
"version": "0.0.12",
"description": "JavaScript Solid Pod - Just works, batteries included",
"type": "module",
"main": "index.js",
Expand Down