Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow loading .ttl files #155

Merged
merged 1 commit into from
Aug 27, 2019
Merged
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
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.ttl' {
const content: string
export default content
}
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ module.exports = {
use: {
loader: 'babel-loader'
}
},
{
test: /\.ttl$/i,
use: {
loader: 'raw-loader'
}
}
]
},
Expand Down