solidos-lite
v0.0.4
Published
Lightweight SolidOS shim with data island support
Downloads
314
Maintainers
Readme
solidos-lite
Lightweight SolidOS shim with data island support.
What is this?
solidos-lite lets you embed RDF data directly in HTML and render it with SolidOS - no server required. Just one script tag:
<script src="https://cdn.jsdelivr.net/npm/solidos-lite/solidos-lite.js"></script>It automatically:
- Loads mashlib from CDN
- Parses embedded Turtle or JSON-LD data islands
- Renders with SolidOS panes
Quick Start
<!DOCTYPE html>
<script type="text/turtle">
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:name "Alice" .
</script>
<script src="https://cdn.jsdelivr.net/npm/solidos-lite/solidos-lite.js"></script>That's it! Visit page.html#me to see Alice's profile.
Supported Formats
Turtle
<script type="text/turtle">
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#me> a foaf:Person ; foaf:name "Alice" .
</script>JSON-LD
<script type="application/ld+json">
{
"@context": { "foaf": "http://xmlns.com/foaf/0.1/" },
"@id": "#me",
"@type": "foaf:Person",
"foaf:name": "Alice"
}
</script>How It Works
- Auto-detection - When the page loads, solidos-lite checks for data islands
- Loads mashlib - Dynamically loads mashlib + CSS from CDN
- Creates UI - Adds required DOM elements to body automatically
- Parses data - Turtle parsed directly, JSON-LD converted to Turtle (custom parser, no webpack chunks)
- Renders - Navigates to the URL fragment (e.g.,
#me) or shows document view
API
For manual control:
// Run everything automatically
SolidOSLite.run()
// Or step by step:
await SolidOSLite.loadMashlib()
SolidOSLite.init({ verbose: true })
SolidOSLite.parseAllIslands()SolidOSLite.run(options)
Initialize and run the data browser. Called automatically if data island detected.
SolidOSLite.loadMashlib()
Load mashlib from CDN. Returns a Promise.
SolidOSLite.init(options)
Initialize the data island shim. Options: { verbose: true } for logging.
SolidOSLite.parseAllIslands()
Parse all data islands into the RDF store.
SolidOSLite.VERSION
Current version string.
Examples
- Person Profile (JSON-LD) - foaf:Person with photo and connections
- Bookmarks (Turtle) - Organized link collection
- minimal.html - Minimal Turtle example
- minimal-jsonld.html - Minimal JSON-LD example
Benefits
- Zero boilerplate - Just data + script tag, UI created automatically
- No CORS issues - Data is in the page
- No server required - Works with static HTML files
- Works offline - Once loaded, no network needed
- Single script - Mashlib loaded automatically from CDN
License
AGPL-3.0
