Skip to content

Commit

Permalink
Allow loading .ttl files
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinnl committed Aug 19, 2019
1 parent 1e4d6e0 commit a696958
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 19 deletions.
22 changes: 22 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -78,6 +78,7 @@
"eslint-plugin-standard": "^4.0.0",
"fork-ts-checker-webpack-plugin": "^1.3.0",
"jest": "^24.8.0",
"raw-loader": "^3.1.0",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5",
"webpack": "^4.30.0",
Expand Down
21 changes: 2 additions & 19 deletions profile/editProfilePane.source.ts
Expand Up @@ -15,6 +15,8 @@ import { NamedNode } from 'rdflib'
import { PaneDefinition } from '../types'
import { getLabel } from './profilePaneUtils'

import preferencesFormText from './preferencesFormText.ttl'

const nodeMode = (typeof module !== 'undefined')

// let panes: any
Expand Down Expand Up @@ -63,25 +65,6 @@ const thisPane: PaneDefinition = { // 'noun_638141.svg' not editing
}

function renderProfileForm (div: HTMLElement, subject: NamedNode) {
const preferencesFormText = `
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix solid: <http://www.w3.org/ns/solid/terms#>.
@prefix ui: <http://www.w3.org/ns/ui#>.
@prefix : <#>.
:this
<http://purl.org/dc/elements/1.1/title> "Profile style form" ;
a ui:Form ;
ui:part :backgroundColor, :highlightColor;
ui:parts ( :backgroundColor :highlightColor ).
:backgroundColor a ui:ColorField; ui:property solid:profileBackgroundColor;
ui:label "Background color"; ui:default "#ffffff".
:highlightColor a ui:ColorField; ui:property solid:profileHighlightColor;
ui:label "Highlight color"; ui:default "#000000".
`
const preferencesForm = kb.sym('https://solid.github.io/solid-panes/dashboard/profileStyle.ttl#this')
const preferencesFormDoc = preferencesForm.doc()
if (!kb.holds(undefined, undefined, undefined, preferencesFormDoc)) { // If not loaded already
Expand Down
17 changes: 17 additions & 0 deletions profile/preferencesFormText.ttl
@@ -0,0 +1,17 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix solid: <http://www.w3.org/ns/solid/terms#>.
@prefix ui: <http://www.w3.org/ns/ui#>.
@prefix : <#>.

:this
<http://purl.org/dc/elements/1.1/title> "Profile style form" ;
a ui:Form ;
ui:part :backgroundColor, :highlightColor;
ui:parts ( :backgroundColor :highlightColor ).

:backgroundColor a ui:ColorField; ui:property solid:profileBackgroundColor;
ui:label "Background color"; ui:default "#ffffff".
:highlightColor a ui:ColorField; ui:property solid:profileHighlightColor;
ui:label "Highlight color"; ui:default "#000000".


4 changes: 4 additions & 0 deletions typings/raw-loader.d.ts
@@ -0,0 +1,4 @@
declare module "*.ttl" {
const content: string;
export default content;
}
6 changes: 6 additions & 0 deletions webpack.config.js
Expand Up @@ -20,6 +20,12 @@ module.exports = {
use: {
loader: 'babel-loader'
}
},
{
test: /\.ttl$/i,
use: {
loader: 'raw-loader'
}
}
]
},
Expand Down

0 comments on commit a696958

Please sign in to comment.