Skip to content
Open
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
546 changes: 344 additions & 202 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,16 @@
"homepage": "https://github.com/solidos/mashlib",
"dependencies": {
"rdflib": "^2.3.3",
"solid-logic": "^4.0.0",
"solid-panes": "^4.0.0",
"solid-ui": "^3.0.0"
"solid-logic": "^4.0.1",
"solid-panes": "4.0.0-newStyle-b960ffb7",
"solid-ui": "^3.0.1"
},
"overrides": {
"rdflib": "^2.3.3",
"solid-logic": "^4.0.1",
"solid-panes": "4.0.0-newStyle-b960ffb7",
"solid-ui": "^3.0.1",
"profile-pane": "2.0.0-newStyle-6806a782"
},
"devDependencies": {
"@babel/cli": "^7.28.0",
Expand Down
27 changes: 20 additions & 7 deletions src/databrowser.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,26 @@
})
</script>
</head>
<body id="PageBody">
<body id="PageBody">
<a href="#DummyUUID" class="skip-link" style="position:absolute;left:-999px;top:auto;width:1px;height:1px;overflow:hidden;">Skip to main content</a>
<!-- solid-panes' OutlineManager injects into this element -->
<header id="PageHeader"></header>
<div class="TabulatorOutline" id="DummyUUID" role="main">
<table id="outline"></table>
<div id="GlobalDashboard"></div>
</div>
<footer id="PageFooter"></footer>
<header id="PageHeader" role="banner"></header>
<main id="mainContent" tabindex="-1">
<div class="TabulatorOutline" id="DummyUUID" role="main">
<table id="outline">
<thead>
<tr>
<th id="outlineHeader" scope="col"></th>
<!-- Add more <th> as needed for columns -->
</tr>
</thead>
<tbody>
<!-- Table rows injected by JS -->
</tbody>
</table>
<div id="GlobalDashboard" aria-label="Global Dashboard"></div>
</div>
</main>
<footer id="PageFooter" role="contentinfo"></footer>
</body>
</html>
42 changes: 35 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,39 @@ import * as $rdf from 'rdflib'
import * as panes from 'solid-panes'
import { authn, solidLogicSingleton, authSession, store } from 'solid-logic'
import versionInfo from './versionInfo'
import { mashStyle } from './styles/mashlib-style'
import './styles/mash.css'

const global: any = window

// Theme Management
const initializeTheme = () => {
const savedTheme = localStorage.getItem('mashlib-theme')
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches
const theme = savedTheme || (prefersDark ? 'dark' : 'light')

if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark')
} else {
document.documentElement.removeAttribute('data-theme')
}
}

const setTheme = (theme: 'light' | 'dark') => {
if (theme === 'dark') {
document.documentElement.setAttribute('data-theme', 'dark')
} else {
document.documentElement.removeAttribute('data-theme')
}
localStorage.setItem('mashlib-theme', theme)
}

const getTheme = (): 'light' | 'dark' => {
return document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'light'
}

// Initialize theme on load
initializeTheme()

global.$rdf = $rdf
global.panes = panes
global.SolidLogic = {
Expand All @@ -16,15 +44,15 @@ global.SolidLogic = {
solidLogicSingleton
}
global.mashlib = {
versionInfo
versionInfo,
theme: {
set: setTheme,
get: getTheme,
init: initializeTheme
}
}

global.panes.runDataBrowser = function (uri?:string|$rdf.NamedNode|null) {
document.getElementById('PageBody')?.setAttribute('style', mashStyle.dbLayout)
document.getElementById('PageHeader')?.setAttribute('style', mashStyle.dbLayoutHeader)
document.getElementById('PageFooter')?.setAttribute('style', mashStyle.dbLayoutFooter)
document.getElementById('DummyUUID')?.setAttribute('style', mashStyle.dbLayoutContent)

// Set up cross-site proxy
const fetcher: any = $rdf.Fetcher
fetcher.crossSiteProxyTemplate = window.origin + '/xss/?uri={uri}'
Expand Down
Loading