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
14 changes: 0 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,6 @@ I want this all to be presented flexible in the component.

* Raptor mini: when we are on layout mobile we do not want to display the help menu at all.

* Raptor mini: Create for me a footer Lit Component in tsy style of the components I have and under v2. Take the code from this index.ts to start with.

* Raptor mini: Good. Now, I want the footer to be a rectangular with round corners, grey background and it should have an adjustable position.

* Raptor mini: The content of the footer should be different upon loggedin or not.
If not logged in, it should say:
Title Public View
You are viewving this profile as a guest,
And if logged in:
Title: Logged in View
You are logged in as nameOfLoggedIn user.

* Raptor mini: add a readme to the Footer component with example.

* Claude Sonnet 4.6: Make the drop down as a list under the input field and enlarge the pop up, make it higher, adjustable to fit the drop down. And make the drop down arrow area larger

* GPT-5.4 Model: can you wire up the keyboard interactions and aria attributes for Select?
Expand Down
1 change: 0 additions & 1 deletion src/components/footer/index.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/types/custom-elements.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type DialogFooter from '../components/dialog-footer/DialogFooter'
import type DialogHeader from '../components/dialog-header/DialogHeader'
import type DialogProvider from '../components/dialog-provider/DialogProvider'
import type DialogsRoot from '../components/dialogs-root/DialogsRoot'
import type Footer from '../components/footer/Footer'
import type Guard from '../components/guard/Guard'
import type Header from '../components/header/Header'
import type Input from '../components/input/Input'
Expand Down Expand Up @@ -42,7 +41,6 @@ declare global {
'solid-ui-dialog-header': DialogHeader
'solid-ui-dialog-provider': DialogProvider
'solid-ui-dialogs-root': DialogsRoot
'solid-ui-footer': Footer
'solid-ui-guard': Guard
'solid-ui-header': Header
'solid-ui-input': Input
Expand Down
126 changes: 126 additions & 0 deletions src/utils/headerHelpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
/*
Copied from mashlib/src/global/metadata.ts
*/
import { IndexedFormula, LiveStore, NamedNode, parse, sym } from 'rdflib'
import ns from '../lib/ns'

/* @ts-ignore no-console */
type ThrottleOptions = {
leading?: boolean;
throttling?: boolean;
trailing?: boolean;
}

/**
* @ignore exporting this only for the unit test
*/
export function getPod (): NamedNode {
const { origin, pathname } = document.location
const isDatabrowserShell = document.body?.dataset?.appShell === 'databrowser'
const segments = pathname.split('/').filter(Boolean)
const lastSegment = segments[segments.length - 1] || ''
const looksLikeFile = /\.[^/]+$/.test(lastSegment)

if (isDatabrowserShell && segments.length > 0 && !looksLikeFile) {
return sym(`${origin}/${segments[0]}/`)
}

// Root-hosted pods and static databrowser pages still use the site root.
return sym(origin).site()
}
/**
*/
export async function getPodOwner (pod: NamedNode, store: LiveStore): Promise<NamedNode | null> {
// This is a massive guess. In future
// const podOwner = sym(`${pod.uri}profile/card#me`)

try {
// load turtle Container representation
if (!store.any(pod, null, ns.ldp('Container'), pod)) {
const response = await store.fetcher.webOperation('GET', pod.uri, store.fetcher.initFetchOptions(pod.uri, { headers: { accept: 'text/turtle' } }))
const containerTurtle = response.responseText
parse(containerTurtle as string, store, pod.uri, 'text/turtle')
}
} catch (err) {
console.error('Error loading pod ' + pod + ': ' + err)
return null
}
if (!store.holds(pod, ns.rdf('type'), ns.space('Storage'), pod)) {
console.warn('Pod ' + pod + ' does not declare itself as a space:Storage')
return null
}
const podOwner = store.any(pod, ns.solid('owner'), null, pod) ||
store.any(null, ns.space('storage'), pod, pod)
if (podOwner) {
try {
await store.fetcher.load((podOwner as NamedNode).doc())
} catch (_err) {
console.warn('Unable to load profile of pod owner ' + podOwner)
return null
}
if (!store.holds(podOwner, ns.space('storage'), pod, (podOwner as NamedNode).doc())) {
console.warn(`Pod owner ${podOwner} does NOT list pod ${pod} as their storage`)
}
return podOwner as NamedNode// Success!
} else { // pod owner not declared in pod
// @@ TODO: This is given the structure that NSS provides
// This is a massive guess. For old pods which don't have owner link
const guess = sym(`${pod.uri}profile/card#me`)
try {
// @ts-ignore LiveStore always has fetcher
await store.fetcher.load(guess)
} catch (_err) {
console.error('Ooops. Guessed wrong pod owner webid {$guess} : can\'t load it.')
return null
}
if (store.holds(guess, ns.space('storage'), pod, guess.doc())) {
console.warn('Using guessed pod owner webid but it links back.')
return guess
}
return null
}
}
/**
* @ignore exporting this only for the unit test
*/
export function getName (store: IndexedFormula, user: NamedNode): string {
return store.anyValue(user, ns.vcard('fn'), null, user.doc()) ||
store.anyValue(user, ns.foaf('name'), null, user.doc()) ||
user.uri
}
/**
* @ignore exporting this only for the unit test
*/
export function throttle (func: Function, wait: number, options: ThrottleOptions = {}): (...args: any[]) => any {
let context: any,
args: any,
result: any
let timeout: any = null
let previous = 0
const later = function () {
previous = !options.leading ? 0 : Date.now()
timeout = null
result = func.apply(context, args)
if (!timeout) context = args = null
}
return function () {
const now = Date.now()
if (!previous && !options.leading) previous = now
const remaining = wait - (now - previous)
// @ts-ignore
context = this
args = arguments
if (remaining <= 0 || remaining > wait) {
if (timeout) {
clearTimeout(timeout)
timeout = null
}
previous = now
result = func.apply(context, args)
if (!timeout) context = args = null
} else if (!timeout && options.trailing !== false) {
timeout = setTimeout(later, remaining)
}
return result
}
}
63 changes: 0 additions & 63 deletions src/v2/components/layout/footer/Footer.test.ts

This file was deleted.

168 changes: 0 additions & 168 deletions src/v2/components/layout/footer/Footer.ts

This file was deleted.

Loading
Loading