Skip to content

Commit 6f7b52a

Browse files
committed
use pane-registry types
1 parent 0c324c1 commit 6f7b52a

6 files changed

Lines changed: 11 additions & 31 deletions

File tree

src/RDFXMLPane.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import * as UI from 'solid-ui'
99
import * as $rdf from 'rdflib'
10-
import type { DataBrowserContext } from 'pane-registry'
10+
import type { DataBrowserContext, RenderEnvironment } from 'pane-registry'
1111
import type { NamedNode, Statement } from 'rdflib'
1212
import './RDFXMLPane.css'
1313

@@ -21,10 +21,6 @@ type RDFXMLPaneDefinition = {
2121
render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement
2222
}
2323

24-
type RenderEnvironmentLike = {
25-
layout?: 'mobile' | 'desktop'
26-
}
27-
2824
function leadingIndentWidth (line: string): number {
2925
if (line.trim().length === 0) {
3026
return 0
@@ -79,7 +75,7 @@ export const RDFXMLPane: RDFXMLPaneDefinition = {
7975
const kb = context.session.store
8076

8177
function applyEnvironmentAttributes (element: HTMLDivElement): void {
82-
const environment = (context.environment ?? {}) as RenderEnvironmentLike
78+
const environment = (context.environment ?? {}) as Partial<RenderEnvironment>
8379
element.dataset.layout = environment.layout ?? 'desktop'
8480
}
8581

src/dataContentPane.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import * as UI from 'solid-ui'
1313
import * as $rdf from 'rdflib'
14-
import type { DataBrowserContext } from 'pane-registry'
14+
import type { DataBrowserContext, RenderEnvironment } from 'pane-registry'
1515
import type {
1616
BlankNode,
1717
Formula,
@@ -39,12 +39,6 @@ type DataContentPaneLike = {
3939
) => HTMLTableElement
4040
}
4141

42-
type RenderEnvironmentLike = {
43-
layout?: 'mobile' | 'desktop' | string
44-
theme?: 'light' | 'dark' | string
45-
inputMode?: 'pointer' | 'touch' | string
46-
}
47-
4842
export const dataContentPane = {
4943
icon: UI.icons.originalIconBase + 'rdf_flyer.24.gif',
5044

@@ -290,7 +284,7 @@ export const dataContentPane = {
290284
const myDocument = context.dom
291285

292286
function applyEnvironmentAttributes (element: HTMLDivElement): void {
293-
const environment = (context.environment ?? {}) as RenderEnvironmentLike
287+
const environment = (context.environment ?? {}) as Partial<RenderEnvironment>
294288
element.dataset.layout = environment.layout ?? 'desktop'
295289
element.dataset.theme = environment.theme ?? 'light'
296290
element.dataset.inputMode = environment.inputMode ?? 'pointer'

src/humanReadablePane.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { icons, ns } from 'solid-ui'
77
import { Util } from 'rdflib'
88
import { marked } from 'marked'
99
import DOMPurify from 'dompurify'
10-
import type { DataBrowserContext } from 'pane-registry'
10+
import type { DataBrowserContext, RenderEnvironment } from 'pane-registry'
1111
import type { NamedNode } from 'rdflib'
1212
import './humanReadablePane.css'
1313

@@ -23,10 +23,6 @@ type HumanReadablePaneDefinition = {
2323
render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement
2424
}
2525

26-
type RenderEnvironmentLike = {
27-
layout?: 'mobile' | 'desktop' | string
28-
}
29-
3026
const isMarkdownFile = (uri?: string | null): boolean => {
3127
if (!uri) return false
3228
const path = uri.split('?')[0].split('#')[0] // Remove query string and fragment
@@ -205,7 +201,7 @@ const humanReadablePane: HumanReadablePaneDefinition = {
205201
const kb = context.session.store
206202

207203
function applyEnvironmentAttributes (element: HTMLDivElement): void {
208-
const environment = (context.environment ?? {}) as RenderEnvironmentLike
204+
const environment = (context.environment ?? {}) as Partial<RenderEnvironment>
209205
element.dataset.layout = environment.layout ?? 'desktop'
210206
}
211207

src/n3Pane.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
import * as UI from 'solid-ui'
88
import * as $rdf from 'rdflib'
9-
import type { DataBrowserContext } from 'pane-registry'
9+
import type { DataBrowserContext, RenderEnvironment } from 'pane-registry'
1010
import type { NamedNode, Statement } from 'rdflib'
1111
import './n3Pane.css'
1212

@@ -20,9 +20,6 @@ type N3PaneLike = {
2020
render: (subject: NamedNode, context: DataBrowserContext) => HTMLDivElement
2121
}
2222

23-
type RenderEnvironmentLike = {
24-
layout?: 'mobile' | 'desktop'
25-
}
2623
/* This code was generated by Generative AI (GPT-5.4 in GitHub Copilot) based on the following prompt:
2724
Make this look good on mobile by indenting the lines that wrap. */
2825
function leadingIndentWidth (line: string): number {
@@ -74,7 +71,7 @@ export const n3Pane: N3PaneLike = {
7471
const kb = context.session.store
7572

7673
function applyEnvironmentAttributes (element: HTMLDivElement): void {
77-
const environment = (context.environment ?? {}) as RenderEnvironmentLike
74+
const environment = (context.environment ?? {}) as Partial<RenderEnvironment>
7875
element.dataset.layout = environment.layout ?? 'desktop'
7976
}
8077

src/schedule/schedulePane.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import * as UI from 'solid-ui'
88
import { authn } from 'solid-logic'
99
import * as $rdf from 'rdflib'
10-
import type { DataBrowserContext } from 'pane-registry'
10+
import type { DataBrowserContext, RenderEnvironment } from 'pane-registry'
1111
import type { NamedNode, Node as RdflibNode, Statement, Variable } from 'rdflib'
1212
import formText from './formsForSchedule.ttl'
1313
import './schedulePane.css'
@@ -56,10 +56,6 @@ type LoginStatusBoxLike = {
5656
refresh: () => void
5757
}
5858

59-
type RenderEnvironmentLike = {
60-
layout?: string
61-
}
62-
6359
function runNextAgendaItem (agenda: AgendaTask[]): void {
6460
const nextTask = agenda.shift()
6561
if (nextTask) {
@@ -391,7 +387,7 @@ export const schedulePane = {
391387
const appPathSegment = 'app-when-can-we.w3.org' // how to allocate this string and connect to
392388

393389
function applyEnvironmentAttributes (element: HTMLDivElement): void {
394-
const environment = (context.environment ?? {}) as RenderEnvironmentLike
390+
const environment = (context.environment ?? {}) as Partial<RenderEnvironment>
395391
element.dataset.layout = environment.layout ?? 'desktop'
396392
}
397393

src/sharing/sharingPane.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
import { aclControl, icons, ns } from 'solid-ui'
12+
import './sharingPane.css'
1213

1314
const sharingPane = {
1415
icon: icons.iconBase + 'padlock-timbl.svg',

0 commit comments

Comments
 (0)