Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
14706bb
slideshow option when 1 image
SharonStrats Nov 20, 2026
c9515c2
move human readable and make iframe component
SharonStrats Nov 20, 2026
00f11df
link in tab, open in solidos
SharonStrats Nov 20, 2026
663b898
pdf new design and web component
SharonStrats Nov 21, 2026
4dbc824
improve plaintext
SharonStrats Nov 21, 2026
a722436
use markdown it instead of marked and improve code
SharonStrats Nov 21, 2026
cca8a32
Add JSON separately and format nicely
SharonStrats Nov 21, 2026
4cfdf56
fix(pdf): emit worker as separate asset
SharonStrats Nov 21, 2026
2f7acd3
small improvements
SharonStrats Nov 21, 2026
0d10829
nicely handle errors
SharonStrats Nov 21, 2026
5e334da
update video and styles
SharonStrats Nov 21, 2026
c4e6dea
human readable axe testing
SharonStrats Nov 21, 2026
357af64
pad creation test
SharonStrats Nov 21, 2026
3c3f749
some cleanup
SharonStrats Nov 21, 2026
0e8ed4b
Address PR feedback
SharonStrats Nov 21, 2026
ca9f735
fix mobile
SharonStrats Nov 24, 2026
5fe59c6
mobile styling
SharonStrats Nov 24, 2026
282c74e
chore: update solidos dependencies (dev: [email protected] solid-ui…
github-actions[bot] Nov 24, 2026
edcc721
chore: update solidos dependencies (dev: [email protected] solid-ui…
github-actions[bot] Nov 25, 2026
669cb4e
chore: update solidos dependencies (dev: [email protected] solid-ui…
github-actions[bot] Nov 25, 2026
fa8a5c1
restore standalone image and video pane lifecycle
SharonStrats Nov 25, 2026
1eed59f
remove office document integration from human readable
SharonStrats Nov 25, 2026
f2a46eb
update media accessibility tests for standalone panes
SharonStrats Nov 26, 2026
7a8a348
chore: update solidos dependencies (dev: [email protected] solid-ui…
github-actions[bot] Nov 26, 2026
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
594 changes: 516 additions & 78 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,13 @@
"dompurify": "^3.4.4",
"folder-pane": "4.1.5-0",
"issue-pane": "4.1.1-0",
"lit": "^3.3.3",
"lit-html": "^3.3.2",
"marked": "^18.0.3",
"markdown-it": "^15.0.3",
"meeting-pane": "4.1.1-0",
"mime-types": "^3.0.2",
"pane-registry": "5.1.2-0",
"pdfjs-dist": "^6.5.438",
"profile-pane": "4.1.1-0",
"rdflib": "2.4.1",
"solid-logic": "6.2.1-0",
Expand All @@ -83,9 +85,11 @@
"@iconify/json": "2.2.494",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@types/markdown-it": "^14.2.0",
"@types/node": "^22.20.0",
"@typescript-eslint/parser": "^8.59.3",
"@vitest/coverage-v8": "^4.0.18",
"axe-core": "^4.14.1",
"eslint": "^9.39.4",
"globals": "^17.6.0",
"jsdom": "^28.1.0",
Expand All @@ -94,7 +98,8 @@
"typescript": "^6.0.3",
"unplugin-icons": "^23.0.1",
"vite": "^8.0.16",
"vitest": "^4.0.18"
"vitest": "^4.0.18",
"vitest-axe": "^0.1.0"
},
"solidosDependencies": [
"rdflib",
Expand Down
23 changes: 23 additions & 0 deletions src/components/iframe-preview/IframePreview.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:host {
display: flex;
flex: 1 1 0%;
min-height: 0;
min-width: 0;
}

.editor-card,
.human-readable-pane__container--iframe {
display: flex;
flex: 1 1 0%;
flex-direction: column;
min-height: 0;
min-width: 0;
}

.human-readable-pane__frame--iframe {
flex: 1 1 0%;
width: 100%;
min-height: 0;
box-sizing: border-box;
border: 1px solid var(--solid-ui-color-slate-200, #E2E8F0);
}
169 changes: 169 additions & 0 deletions src/components/iframe-preview/IframePreview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
import { html, nothing } from 'lit'
import { property, state } from 'lit/decorators.js'
import { customElement, WebComponent } from 'solid-ui'
import type { LiveStore, NamedNode } from 'rdflib'
import {
documentTitle,
HTML_PREVIEW_SANDBOX,
IFRAME_PREVIEW_FRAME_NAME,
resourceFilename,
addResponsivePreviewStyles
} from '../../humanReadable/previewHelpers'
import styles from './IframePreview.styles.css'
import 'solid-ui/components/error-state'

@customElement('solid-panes-iframe-preview')
export default class IframePreview extends WebComponent {
static styles = styles

@property({ attribute: false })
accessor store: LiveStore | undefined = undefined

@property({ attribute: false })
accessor subject: NamedNode | undefined = undefined

@state()
private accessor contentType: string | null = null

@state()
private accessor content: string | undefined = undefined

@state()
private accessor errorMessage = ''

@state()
private accessor dokieliHtml = false

@state()
private accessor fetchedTitle = ''

@property({ attribute: false })
accessor rememberHtmlType: ((uri: string, isDokieli: boolean) => void) | undefined

@property({ attribute: false })
accessor withBaseHref: ((html: string, uri: string) => string) | undefined

@property({ attribute: false })
accessor isDokieliHtml: ((html: string) => boolean) | undefined

@property({ attribute: false })
accessor mountDokieliBridge:
((frame: HTMLIFrameElement, uri: string, html: string) => () => void) | undefined

private objectUrl: string | undefined
private removeDokieliBridge = () => {}
private rawHtml: string | undefined
private fetchGeneration = 0

private get previewTitle (): string {
return this.fetchedTitle || (this.subject?.uri ? resourceFilename(this.subject.uri) : 'preview')
}

private dismissError = (): void => {
this.errorMessage = ''
}

private clearPreview (): void {
this.removeDokieliBridge()
Comment thread
SharonStrats marked this conversation as resolved.
Resolved
this.removeDokieliBridge = () => {}
this.renderRoot.querySelector('iframe')?.removeAttribute('srcdoc')
if (this.objectUrl) {
URL.revokeObjectURL(this.objectUrl)
this.objectUrl = undefined
}
this.content = undefined
this.contentType = null
this.rawHtml = undefined
this.fetchedTitle = ''
this.dokieliHtml = false
this.errorMessage = ''
}

private async fetchDocument (): Promise<void> {
const generation = ++this.fetchGeneration
const { subject, store } = this
this.clearPreview()
if (!subject || !store) return

const isCurrent = () => this.isConnected &&
generation === this.fetchGeneration && this.subject === subject && this.store === store

try {
const response = await store.fetcher._fetch(subject.uri)
if (!response.ok) throw new Error(`HTTP ${response.status}`)
const contentType = response.headers.get('content-type')?.split(';', 1)[0].trim().toLowerCase() ?? null
const isHtml = contentType === 'text/html' || contentType === 'application/xhtml+xml'

if (isHtml) {
const htmlContent = await response.text()
if (!isCurrent()) return
this.dokieliHtml = this.isDokieliHtml?.(htmlContent) ?? false
this.rememberHtmlType?.(subject.uri, this.dokieliHtml)
this.rawHtml = htmlContent
this.fetchedTitle = documentTitle(htmlContent, subject.uri)
this.contentType = contentType
const documentHtml = this.withBaseHref?.(htmlContent, subject.uri) ?? htmlContent
this.content = addResponsivePreviewStyles(documentHtml)
} else {
const blob = await response.blob()
if (!isCurrent()) return
this.objectUrl = URL.createObjectURL(blob)
this.contentType = contentType
this.content = this.objectUrl
}
} catch (error) {
if (isCurrent()) {
this.errorMessage = error instanceof Error ? error.message : String(error)
}
}
}

connectedCallback (): void {
super.connectedCallback()
if (this.hasUpdated) this.fetchDocument()
}

protected updated (changed: Map<PropertyKey, unknown>): void {
super.updated(changed)
if (changed.has('subject') || changed.has('store')) {
this.fetchDocument()
} else if (changed.has('content') && this.dokieliHtml && this.rawHtml && this.subject) {
const frame = this.renderRoot.querySelector<HTMLIFrameElement>('iframe')
if (frame && this.mountDokieliBridge) {
this.removeDokieliBridge()
this.removeDokieliBridge = this.mountDokieliBridge(frame, this.subject.uri, this.rawHtml)
}
}
}

disconnectedCallback (): void {
++this.fetchGeneration
this.clearPreview()
super.disconnectedCallback()
}

render () {
const isHtml = this.contentType === 'text/html' || this.contentType === 'application/xhtml+xml'
return html`
<section class="editor-card" aria-label=${`Preview of ${this.previewTitle}`}>
<div class="human-readable-pane__container--iframe">
<iframe
class="human-readable-pane__frame--iframe"
name=${IFRAME_PREVIEW_FRAME_NAME}
title=${this.previewTitle}
sandbox=${this.contentType === 'application/pdf' ? nothing : HTML_PREVIEW_SANDBOX}
src=${isHtml ? nothing : this.content ?? nothing}
srcdoc=${isHtml && !this.dokieliHtml ? this.content ?? nothing : nothing}
></iframe>
</div>
${this.errorMessage
? html`<solid-ui-error-state
title="Unable to load preview"
.message=${this.errorMessage}
@close=${this.dismissError}
></solid-ui-error-state>`
: nothing}
</section>
`
}
}
4 changes: 4 additions & 0 deletions src/components/iframe-preview/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import IframePreview from './IframePreview'

export { IframePreview }
export default IframePreview
Loading
Loading