Skip to content

Commit 89c9c46

Browse files
committed
wired in environement in context and added left side menu
1 parent 4f2c7e0 commit 89c9c46

10 files changed

Lines changed: 305 additions & 38 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,5 @@ We have added comments in the code to make it explicit which parts are 100% writ
8686

8787
### Prompt usage hitory:
8888
* Model Claude Opus 4.6: Initially solid-panes is loaded into a HTML shell form mashlib that looks like ... Also, an iFrame is rendered inside the <div class="TabulatorOutline" id="DummyUUID"> for “isolated pane rendering”. Analize the solid-panes code for what it uses from this HTML and suggest a new HTML structure which is mobile and accessibility friendly. Lets go ahead and make chnages in this code as suggested to accommodate the new databwroser HTML.
89+
90+
* Raptor mini: take a look how I wired the environement from mashlib into solid-panes. It is not quite right, can you suggest fixes?

package-lock.json

Lines changed: 33 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"pane-registry": "^3.0.1",
7171
"profile-pane": "^3.1.2",
7272
"solid-namespace": "^0.5.4",
73-
"solid-ui": "^3.0.4",
73+
"solid-ui": "^3.0.5",
7474
"source-pane": "^3.0.1"
7575
},
7676
"overrides": {
@@ -105,10 +105,10 @@
105105
"node-polyfill-webpack-plugin": "^4.1.0",
106106
"path-browserify": "^1.0.1",
107107
"raw-loader": "^4.0.2",
108-
"rdflib": "^2.3.5",
108+
"rdflib": "^2.3.6",
109109
"react": "^19.2.4",
110110
"react-dom": "^19.2.4",
111-
"solid-logic": "^4.0.3",
111+
"solid-logic": "^4.0.6",
112112
"style-loader": "^4.0.0",
113113
"terser-webpack-plugin": "^5.3.16",
114114
"ts-jest": "^29.4.6",

src/index.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,36 @@ import {
2121
paneForIcon,
2222
paneForPredicate,
2323
register,
24-
byName
24+
byName,
25+
RenderEnvironment
2526
} from 'pane-registry'
2627
import { createContext } from './outline/context'
27-
import initMainPage from './mainPage'
28+
import { initMainPage, updateMenuLayout } from './mainPage'
2829

29-
function getOutliner (dom) {
30+
function getOutliner (dom, environment?: RenderEnvironment): OutlineManager {
3031
if (!dom.outlineManager) {
3132
const context = createContext(
3233
dom,
3334
{ list, paneForIcon, paneForPredicate, register, byName },
3435
store as LiveStore,
35-
solidLogicSingleton
36+
solidLogicSingleton,
37+
environment
3638
)
3739
dom.outlineManager = new OutlineManager(context)
40+
} else if (environment) {
41+
dom.outlineManager.context = dom.outlineManager.context || {}
42+
dom.outlineManager.context.environment = environment
3843
}
3944
return dom.outlineManager
4045
}
4146

47+
function updateEnvironment(outliner: OutlineManager, environment: RenderEnvironment) {
48+
if (!outliner) return
49+
outliner.context = outliner.context || {}
50+
outliner.context.environment = environment
51+
}
52+
53+
4254
if (typeof window !== 'undefined') {
4355
getOutliner(window.document)
4456
}
@@ -53,9 +65,11 @@ registerPanes((cjsOrEsModule: any) => register(cjsOrEsModule.default || cjsOrEsM
5365
export {
5466
OutlineManager,
5567
getOutliner,
68+
updateEnvironment,
5669
UI,
5770
versionInfo,
5871
initMainPage,
72+
updateMenuLayout,
5973
list, // from paneRegistry
6074
paneForIcon, // from paneRegistry
6175
paneForPredicate, // from paneRegistry

src/mainPage/header.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { authSession, authn } from 'solid-logic'
22
import { icons, initHeader } from 'solid-ui'
3+
import { OutlineManager } from '../outline/manager'
4+
import { LiveStore } from 'rdflib'
35
/**
46
* menu icons
57
*/
@@ -21,7 +23,7 @@ type UserMenuItem = { label: string; onclick: () => void }
2123
const USER_GUIDE_MENU_URL = 'https://solidos.github.io/userguide/'
2224
const REPORT_A_PROBLEM_MENU_URL = 'https://github.com/solidos/solidos/issues'
2325

24-
export async function createHeader (store, outliner) {
26+
export async function createHeader (store: LiveStore, outliner: OutlineManager) {
2527
initHeader(store, await setUserMenu(outliner), setHeaderOptions())
2628
}
2729

@@ -35,7 +37,7 @@ function setHeaderOptions () {
3537
return headerOptions
3638
}
3739

38-
async function setUserMenu (outliner: any) {
40+
async function setUserMenu (outliner: OutlineManager) {
3941
// @ts-ignore: showProfile is used conditionally
4042
const showProfile = {
4143
label: SHOW_YOUR_PROFILE_MENU_ITEM,
@@ -58,12 +60,12 @@ async function setUserMenu (outliner: any) {
5860
}
5961

6062
// Does not work to jump to user profile,
61-
function openUserProfile (outliner: any) {
63+
function openUserProfile (outliner: OutlineManager) {
6264
outliner.GotoSubject(authn.currentUser(), true, undefined, true, undefined)
6365
location.reload()
6466
}
6567

66-
async function getMenuItems (outliner: any) {
68+
async function getMenuItems (outliner: OutlineManager) {
6769
const items = await outliner.getDashboardItems()
6870
return items.map((element) => {
6971
return {
@@ -73,7 +75,7 @@ async function getMenuItems (outliner: any) {
7375
})
7476
}
7577

76-
async function openDashboardPane (outliner: any, pane: string): Promise<void> {
78+
async function openDashboardPane (outliner: OutlineManager, pane: string): Promise<void> {
7779
outliner.showDashboard({
7880
pane
7981
})

src/mainPage/index.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,37 @@ import { LiveStore, NamedNode } from 'rdflib'
77
import { getOutliner } from '../index'
88
import { createHeader } from './header'
99
import { createFooter } from './footer'
10+
import { initResponsiveMenu } from './menu'
1011

11-
export default async function initMainPage (store: LiveStore, uri?: string | NamedNode | null) {
12-
const outliner = getOutliner(document)
12+
export { updateMenuLayout } from './menu'
13+
14+
function ensureMainContent() {
15+
let main = document.getElementById('MainContent') as HTMLElement | null
16+
if (!main) {
17+
main = document.createElement('main')
18+
main.id = 'MainContent'
19+
main.setAttribute('role', 'main')
20+
main.setAttribute('tabindex', '-1')
21+
main.setAttribute('aria-live', 'polite')
22+
document.body.appendChild(main)
23+
}
24+
return main
25+
}
26+
27+
export async function initMainPage (
28+
store: LiveStore,
29+
uri?: string | NamedNode | null,
30+
environment?: any
31+
) {
32+
ensureMainContent()
33+
const outliner = getOutliner(document, environment)
1334
uri = uri || window.location.href
1435
let subject = uri
1536
if (typeof uri === 'string') subject = store.sym(uri)
1637
outliner.GotoSubject(subject, true, undefined, true, undefined)
38+
1739
const header = await createHeader(store, outliner)
40+
const menu = initResponsiveMenu(outliner)
1841
const footer = createFooter(store)
19-
return Promise.all([header, footer])
42+
return Promise.all([header, menu, footer])
2043
}

src/mainPage/menu.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
.menu-content {
2+
display: flex;
3+
flex-direction: column;
4+
gap: 0.5rem;
5+
}
6+
7+
.menu-item {
8+
display: block;
9+
border: 1px solid var(--color-border);
10+
border-radius: 0.35rem;
11+
padding: 0.5rem 0.75rem;
12+
background: var(--color-background);
13+
color: var(--color-text);
14+
text-decoration: none;
15+
}
16+
17+
.menu-item:hover,
18+
.menu-item:focus {
19+
background: var(--color-highlight-bg);
20+
}
21+
22+
.menu-toggle {
23+
position: fixed;
24+
top: 1.75rem;
25+
left: 2.75rem;
26+
z-index: 300;
27+
display: inline-flex;
28+
align-items: center;
29+
justify-content: center;
30+
width: 2.5rem;
31+
height: 2.5rem;
32+
border: 1px solid var(--color-border);
33+
background: var(--color-background);
34+
color: var(--color-text);
35+
border-radius: 0.4rem;
36+
margin: 0;
37+
}
38+
39+
.menu-overlay {
40+
position: fixed;
41+
inset: 0;
42+
background: rgba(0, 0, 0, 0.35);
43+
z-index: 100;
44+
}
45+
46+
.app-nav.mobile-hidden {
47+
transform: translateX(-100%);
48+
transition: transform 0.25s ease-in-out;
49+
position: fixed;
50+
left: 0;
51+
top: 4.5rem;
52+
bottom: 0;
53+
z-index: 110;
54+
width: min(80vw, 320px);
55+
}
56+
57+
.app-nav.mobile-visible {
58+
transform: translateX(0);
59+
}

0 commit comments

Comments
 (0)