solid-panes 3.7.3-125af630 → 3.7.3-1bd42721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RDFXMLPane.js +58 -0
- package/dist/RDFXMLPane.js.map +1 -0
- package/dist/argument/argumentPane.js +61 -0
- package/dist/argument/argumentPane.js.map +1 -0
- package/dist/attach/attachPane.js +394 -0
- package/dist/attach/attachPane.js.map +1 -0
- package/dist/audio/audioPane.js +182 -0
- package/dist/audio/audioPane.js.map +1 -0
- package/dist/classInstancePane.js +92 -0
- package/dist/classInstancePane.js.map +1 -0
- package/dist/dataContentPane.js +259 -0
- package/dist/dataContentPane.js.map +1 -0
- package/dist/defaultPane.js +75 -0
- package/dist/defaultPane.js.map +1 -0
- package/dist/dokieli/dokieliPane.js +169 -0
- package/dist/dokieli/dokieliPane.js.map +1 -0
- package/dist/dokieli/new.js +28 -0
- package/dist/dokieli/new.js.map +1 -0
- package/dist/form/pane.js +185 -0
- package/dist/form/pane.js.map +1 -0
- package/dist/humanReadablePane.js +135 -0
- package/dist/humanReadablePane.js.map +1 -0
- package/dist/imagePane.js +70 -0
- package/dist/imagePane.js.map +1 -0
- package/dist/microblogPane/microblogPane.js +1031 -0
- package/dist/microblogPane/microblogPane.js.map +1 -0
- package/dist/n3Pane.js +56 -0
- package/dist/n3Pane.js.map +1 -0
- package/dist/outline/manager.js +1997 -0
- package/dist/outline/manager.js.map +1 -0
- package/dist/outline/outlineIcons.js +127 -0
- package/dist/outline/outlineIcons.js.map +1 -0
- package/dist/outline/queryByExample.js +285 -0
- package/dist/outline/queryByExample.js.map +1 -0
- package/dist/outline/userInput.js +1819 -0
- package/dist/outline/userInput.js.map +1 -0
- package/dist/playlist/playlistPane.js +124 -0
- package/dist/playlist/playlistPane.js.map +1 -0
- package/dist/registerPanes.js +146 -0
- package/dist/registerPanes.js.map +1 -0
- package/dist/schedule/formsForSchedule.js +124 -0
- package/dist/schedule/formsForSchedule.js.map +1 -0
- package/dist/schedule/schedulePane.js +889 -0
- package/dist/schedule/schedulePane.js.map +1 -0
- package/dist/slideshow/slideshowPane.js +80 -0
- package/dist/slideshow/slideshowPane.js.map +1 -0
- package/dist/socialPane.js +430 -0
- package/dist/socialPane.js.map +1 -0
- package/dist/tableViewPane.js +57 -0
- package/dist/tableViewPane.js.map +1 -0
- package/dist/transaction/pane.js +478 -0
- package/dist/transaction/pane.js.map +1 -0
- package/dist/transaction/period.js +324 -0
- package/dist/transaction/period.js.map +1 -0
- package/dist/trip/tripPane.js +175 -0
- package/dist/trip/tripPane.js.map +1 -0
- package/dist/ui/pane.js +147 -0
- package/dist/ui/pane.js.map +1 -0
- package/dist/versionInfo.js +2 -2
- package/dist/video/videoPane.js +43 -0
- package/dist/video/videoPane.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultPane = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
/* Default Pane
|
|
11
|
+
**
|
|
12
|
+
** This outline pane contains the properties which are
|
|
13
|
+
** normally displayed to the user. See also: internalPane
|
|
14
|
+
** This pane hides the ones considered too low-level for the normal user.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const ns = UI.ns;
|
|
18
|
+
const defaultPane = exports.defaultPane = {
|
|
19
|
+
icon: UI.icons.originalIconBase + 'about.png',
|
|
20
|
+
name: 'default',
|
|
21
|
+
audience: [ns.solid('Developer')],
|
|
22
|
+
label: function (_subject) {
|
|
23
|
+
return 'about ';
|
|
24
|
+
},
|
|
25
|
+
render: function (subject, context) {
|
|
26
|
+
const dom = context.dom;
|
|
27
|
+
const filter = function (pred, inverse) {
|
|
28
|
+
if (typeof context.session.paneRegistry.byName('internal').predicates[pred.uri] !== 'undefined') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
if (inverse && pred.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
const outliner = context.getOutliner(dom);
|
|
37
|
+
const kb = context.session.store;
|
|
38
|
+
// var outline = outliner; // @@
|
|
39
|
+
UI.log.info('@defaultPane.render, dom is now ' + dom.location);
|
|
40
|
+
subject = kb.canon(subject);
|
|
41
|
+
const div = dom.createElement('div');
|
|
42
|
+
div.setAttribute('class', 'defaultPane');
|
|
43
|
+
// appendRemoveIcon(div, subject, div)
|
|
44
|
+
|
|
45
|
+
let plist = kb.statementsMatching(subject);
|
|
46
|
+
outliner.appendPropertyTRs(div, plist, false, filter);
|
|
47
|
+
plist = kb.statementsMatching(undefined, undefined, subject);
|
|
48
|
+
outliner.appendPropertyTRs(div, plist, true, filter);
|
|
49
|
+
if (subject.termType === 'Literal' && subject.value.slice(0, 7) === 'http://') {
|
|
50
|
+
outliner.appendPropertyTRs(div, [$rdf.st(kb.sym(subject.value), UI.ns.link('uri'), subject)], true, filter);
|
|
51
|
+
}
|
|
52
|
+
if (subject.termType === 'NamedNode' && kb.updater.editable(UI.rdf.Util.uri.docpart(subject.uri), kb) || subject.termType === 'BlankNode' && kb.anyStatementMatching(subject) && kb.anyStatementMatching(subject).why && kb.anyStatementMatching(subject).why.uri && kb.updater.editable(kb.anyStatementMatching(subject).why.uri)
|
|
53
|
+
// check the document containing something about of the bnode @@ what about as object?
|
|
54
|
+
/* ! && HCIoptions["bottom insert highlights"].enabled */) {
|
|
55
|
+
const holdingTr = dom.createElement('tr'); // these are to minimize required changes
|
|
56
|
+
const holdingTd = dom.createElement('td'); // in userinput.js
|
|
57
|
+
holdingTd.setAttribute('colspan', '2');
|
|
58
|
+
holdingTd.setAttribute('notSelectable', 'true');
|
|
59
|
+
const img = dom.createElement('img');
|
|
60
|
+
img.src = UI.icons.originalIconBase + 'tango/22-list-add-new.png';
|
|
61
|
+
img.addEventListener('click', function addNewTripleIconMouseDownListener(e) {
|
|
62
|
+
outliner.UserInput.addNewPredicateObject(e);
|
|
63
|
+
e.stopPropagation();
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
});
|
|
66
|
+
img.className = 'bottom-border-active';
|
|
67
|
+
// img.addEventListener('click', thisOutline.UserInput.addNewPredicateObject,false)
|
|
68
|
+
div.appendChild(holdingTr).appendChild(holdingTd).appendChild(img);
|
|
69
|
+
}
|
|
70
|
+
return div;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// ends
|
|
75
|
+
//# sourceMappingURL=defaultPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultPane.js","names":["UI","_interopRequireWildcard","require","$rdf","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","defaultPane","exports","icon","icons","originalIconBase","name","audience","solid","label","_subject","render","subject","context","dom","filter","pred","inverse","session","paneRegistry","byName","predicates","uri","outliner","getOutliner","kb","store","log","info","location","canon","div","createElement","setAttribute","plist","statementsMatching","appendPropertyTRs","undefined","termType","value","slice","st","sym","link","updater","editable","rdf","Util","docpart","anyStatementMatching","why","holdingTr","holdingTd","img","src","addEventListener","addNewTripleIconMouseDownListener","UserInput","addNewPredicateObject","stopPropagation","preventDefault","className","appendChild"],"sources":["../src/defaultPane.js"],"sourcesContent":["/* Default Pane\n **\n ** This outline pane contains the properties which are\n ** normally displayed to the user. See also: internalPane\n ** This pane hides the ones considered too low-level for the normal user.\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nexport const defaultPane = {\n icon: UI.icons.originalIconBase + 'about.png',\n\n name: 'default',\n\n audience: [ns.solid('Developer')],\n\n label: function (_subject) {\n return 'about '\n },\n\n render: function (subject, context) {\n const dom = context.dom\n\n const filter = function (pred, inverse) {\n if (\n typeof context.session.paneRegistry.byName('internal').predicates[\n pred.uri\n ] !== 'undefined'\n ) {\n return false\n }\n if (\n inverse &&\n pred.uri === 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type'\n ) {\n return false\n }\n return true\n }\n\n const outliner = context.getOutliner(dom)\n const kb = context.session.store\n // var outline = outliner; // @@\n UI.log.info('@defaultPane.render, dom is now ' + dom.location)\n subject = kb.canon(subject)\n const div = dom.createElement('div')\n div.setAttribute('class', 'defaultPane')\n // appendRemoveIcon(div, subject, div)\n\n let plist = kb.statementsMatching(subject)\n outliner.appendPropertyTRs(div, plist, false, filter)\n plist = kb.statementsMatching(undefined, undefined, subject)\n outliner.appendPropertyTRs(div, plist, true, filter)\n if (\n subject.termType === 'Literal' &&\n subject.value.slice(0, 7) === 'http://'\n ) {\n outliner.appendPropertyTRs(\n div,\n [$rdf.st(kb.sym(subject.value), UI.ns.link('uri'), subject)],\n true,\n filter\n )\n }\n if (\n (subject.termType === 'NamedNode' &&\n kb.updater.editable(UI.rdf.Util.uri.docpart(subject.uri), kb)) ||\n (subject.termType === 'BlankNode' &&\n kb.anyStatementMatching(subject) &&\n kb.anyStatementMatching(subject).why &&\n kb.anyStatementMatching(subject).why.uri &&\n kb.updater.editable(kb.anyStatementMatching(subject).why.uri))\n // check the document containing something about of the bnode @@ what about as object?\n /* ! && HCIoptions[\"bottom insert highlights\"].enabled */\n ) {\n const holdingTr = dom.createElement('tr') // these are to minimize required changes\n const holdingTd = dom.createElement('td') // in userinput.js\n holdingTd.setAttribute('colspan', '2')\n holdingTd.setAttribute('notSelectable', 'true')\n const img = dom.createElement('img')\n img.src = UI.icons.originalIconBase + 'tango/22-list-add-new.png'\n img.addEventListener('click', function addNewTripleIconMouseDownListener (\n e\n ) {\n outliner.UserInput.addNewPredicateObject(e)\n e.stopPropagation()\n e.preventDefault()\n })\n img.className = 'bottom-border-active'\n // img.addEventListener('click', thisOutline.UserInput.addNewPredicateObject,false)\n div\n .appendChild(holdingTr)\n .appendChild(holdingTd)\n .appendChild(img)\n }\n return div\n }\n}\n\n// ends\n"],"mappings":";;;;;;AAOA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAA8B,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAA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,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
9
|
+
var mime = _interopRequireWildcard(require("mime-types"));
|
|
10
|
+
var _new = _interopRequireDefault(require("./new.js"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
13
|
+
/* Human-readable editable "Dokieli" Pane
|
|
14
|
+
**
|
|
15
|
+
** This outline pane contains the document contents for a Dokieli document
|
|
16
|
+
** The dokeili system allows the user to edit a document including anotations
|
|
17
|
+
** review. It does not use turtle, but RDF/a
|
|
18
|
+
*/
|
|
19
|
+
// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok
|
|
20
|
+
// Distributed with this library
|
|
21
|
+
var _default = exports.default = {
|
|
22
|
+
icon: UI.icons.iconBase + 'dokieli-logo.png',
|
|
23
|
+
// @@ improve? more like doccument?
|
|
24
|
+
|
|
25
|
+
name: 'Dokieli',
|
|
26
|
+
mintClass: UI.ns.solid('DokieliDocument'),
|
|
27
|
+
// @@ A better class?
|
|
28
|
+
|
|
29
|
+
label: function (subject, context) {
|
|
30
|
+
const kb = context.session.store;
|
|
31
|
+
const ns = UI.ns;
|
|
32
|
+
const allowed = [
|
|
33
|
+
// 'text/plain',
|
|
34
|
+
'text/html', 'application/xhtml+xml'
|
|
35
|
+
// 'image/png', 'image/jpeg', 'application/pdf',
|
|
36
|
+
// 'video/mp4'
|
|
37
|
+
];
|
|
38
|
+
const hasContentTypeIn = function (kb, x, displayables) {
|
|
39
|
+
const cts = kb.fetcher.getHeader(x, 'content-type');
|
|
40
|
+
if (cts) {
|
|
41
|
+
for (let j = 0; j < cts.length; j++) {
|
|
42
|
+
for (let k = 0; k < displayables.length; k++) {
|
|
43
|
+
if (cts[j].indexOf(displayables[k]) >= 0) {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
// This data coul d come from a fetch OR from ldp comtaimner
|
|
53
|
+
const hasContentTypeIn2 = function (kb, x, displayables) {
|
|
54
|
+
const t = kb.findTypeURIs(x);
|
|
55
|
+
for (let k = 0; k < displayables.length; k++) {
|
|
56
|
+
if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
};
|
|
62
|
+
if (!subject.uri) return null; // no bnodes
|
|
63
|
+
|
|
64
|
+
const t = kb.findTypeURIs(subject);
|
|
65
|
+
if (t[ns.link('WebPage').uri]) return 'view';
|
|
66
|
+
if (hasContentTypeIn(kb, subject, allowed) || hasContentTypeIn2(kb, subject, allowed)) {
|
|
67
|
+
return 'Dok';
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
},
|
|
71
|
+
// Create a new folder in a Solid system, with a dokieli editable document in it
|
|
72
|
+
mintNew: function (context, newPaneOptions) {
|
|
73
|
+
const kb = context.session.store;
|
|
74
|
+
let newInstance = newPaneOptions.newInstance;
|
|
75
|
+
if (!newInstance) {
|
|
76
|
+
let uri = newPaneOptions.newBase;
|
|
77
|
+
if (uri.endsWith('/')) {
|
|
78
|
+
uri = uri.slice(0, -1);
|
|
79
|
+
newPaneOptions.newBase = uri;
|
|
80
|
+
}
|
|
81
|
+
newInstance = kb.sym(uri);
|
|
82
|
+
}
|
|
83
|
+
const contentType = mime.lookup(newInstance.uri);
|
|
84
|
+
if (!contentType || !contentType.includes('html')) {
|
|
85
|
+
newInstance = $rdf.sym(newInstance.uri + '.html');
|
|
86
|
+
}
|
|
87
|
+
newPaneOptions.newInstance = newInstance; // Save for creation system
|
|
88
|
+
|
|
89
|
+
// console.log('New dokieli will make: ' + newInstance)
|
|
90
|
+
|
|
91
|
+
let htmlContents = _new.default;
|
|
92
|
+
let filename = newInstance.uri.split('/').slice(-1)[0];
|
|
93
|
+
filename = decodeURIComponent(filename.split('.')[0]);
|
|
94
|
+
const encodedTitle = filename.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
95
|
+
htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle);
|
|
96
|
+
htmlContents = htmlContents.replace('</article>', '<h1>' + encodedTitle + '</h1></article>');
|
|
97
|
+
// console.log('@@ New HTML for Dok:' + htmlContents)
|
|
98
|
+
return new Promise(function (resolve) {
|
|
99
|
+
kb.fetcher.webOperation('PUT', newInstance.uri, {
|
|
100
|
+
data: htmlContents,
|
|
101
|
+
contentType: 'text/html'
|
|
102
|
+
}).then(function () {
|
|
103
|
+
console.log('new Dokieli document created at ' + newPaneOptions.newInstance);
|
|
104
|
+
resolve(newPaneOptions);
|
|
105
|
+
}).catch(function (err) {
|
|
106
|
+
console.log('Error creating dokieli doc at ' + newPaneOptions.newInstance + ': ' + err);
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
},
|
|
110
|
+
// Derived from: humanReadablePane .. share code?
|
|
111
|
+
render: function (subject, context) {
|
|
112
|
+
const myDocument = context.dom;
|
|
113
|
+
const div = myDocument.createElement('div');
|
|
114
|
+
const kb = context.session.store;
|
|
115
|
+
|
|
116
|
+
// @@ When we can, use CSP to turn off scripts within the iframe
|
|
117
|
+
div.setAttribute('class', 'docView');
|
|
118
|
+
const iframe = myDocument.createElement('IFRAME');
|
|
119
|
+
|
|
120
|
+
// Function to set iframe attributes
|
|
121
|
+
const setIframeAttributes = (iframe, blob, lines) => {
|
|
122
|
+
const objectURL = URL.createObjectURL(blob);
|
|
123
|
+
iframe.setAttribute('src', objectURL);
|
|
124
|
+
iframe.setAttribute('type', blob.type);
|
|
125
|
+
iframe.setAttribute('class', 'doc');
|
|
126
|
+
iframe.setAttribute('style', `border: 1px solid; padding: 1em; height:${lines}em; width:800px; resize: both; overflow: auto;`);
|
|
127
|
+
|
|
128
|
+
// Apply sandbox attribute only for HTML files
|
|
129
|
+
// @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
|
|
130
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
131
|
+
// You can;'t have any sandbox and allow plugins.
|
|
132
|
+
// We could sandbox only HTML files I suppose.
|
|
133
|
+
// HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html
|
|
134
|
+
if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {
|
|
135
|
+
iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Fetch and process the blob
|
|
140
|
+
kb.fetcher._fetch(subject.uri).then(response => response.blob()).then(blob => {
|
|
141
|
+
const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('');
|
|
142
|
+
return blobTextPromise.then(blobText => ({
|
|
143
|
+
blob,
|
|
144
|
+
blobText
|
|
145
|
+
}));
|
|
146
|
+
}).then(({
|
|
147
|
+
blob,
|
|
148
|
+
blobText
|
|
149
|
+
}) => {
|
|
150
|
+
const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
|
|
151
|
+
const lines = Math.min(30, blobText.split(/\n/).length + newLines);
|
|
152
|
+
setIframeAttributes(iframe, blob, lines);
|
|
153
|
+
}).catch(err => {
|
|
154
|
+
console.log('Error fetching or processing blob:', err);
|
|
155
|
+
});
|
|
156
|
+
const cts = kb.fetcher.getHeader(subject.doc(), 'content-type');
|
|
157
|
+
const ct = cts ? cts[0].split(';', 1)[0].trim() : null;
|
|
158
|
+
if (ct) {
|
|
159
|
+
console.log('dokieliPane: c-t:' + ct);
|
|
160
|
+
} else {
|
|
161
|
+
console.log('dokieliPane: unknown content-type?');
|
|
162
|
+
}
|
|
163
|
+
const tr = myDocument.createElement('tr');
|
|
164
|
+
tr.appendChild(iframe);
|
|
165
|
+
div.appendChild(tr);
|
|
166
|
+
return div;
|
|
167
|
+
}
|
|
168
|
+
}; // ends
|
|
169
|
+
//# sourceMappingURL=dokieliPane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dokieliPane.js","names":["UI","_interopRequireWildcard","require","$rdf","mime","_new","_interopRequireDefault","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_default","exports","icon","icons","iconBase","name","mintClass","ns","solid","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","findTypeURIs","Util","mediaTypeClass","uri","link","mintNew","newPaneOptions","newInstance","newBase","endsWith","slice","sym","contentType","lookup","includes","htmlContents","DOKIELI_TEMPLATE","filename","split","decodeURIComponent","encodedTitle","replace","Promise","resolve","webOperation","data","then","console","log","catch","err","render","myDocument","dom","div","createElement","setAttribute","iframe","setIframeAttributes","blob","lines","objectURL","URL","createObjectURL","type","_fetch","response","blobTextPromise","startsWith","text","blobText","newLines","Math","min","doc","ct","trim","tr","appendChild"],"sources":["../../src/dokieli/dokieliPane.js"],"sourcesContent":["/* Human-readable editable \"Dokieli\" Pane\n **\n ** This outline pane contains the document contents for a Dokieli document\n ** The dokeili system allows the user to edit a document including anotations\n ** review. It does not use turtle, but RDF/a\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport * as mime from 'mime-types'\n\n// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok\n\nimport DOKIELI_TEMPLATE from './new.js' // Distributed with this library\n\nexport default {\n icon: UI.icons.iconBase + 'dokieli-logo.png', // @@ improve? more like doccument?\n\n name: 'Dokieli',\n\n mintClass: UI.ns.solid('DokieliDocument'), // @@ A better class?\n\n label: function (subject, context) {\n const kb = context.session.store\n const ns = UI.ns\n const allowed = [\n // 'text/plain',\n 'text/html',\n 'application/xhtml+xml'\n // 'image/png', 'image/jpeg', 'application/pdf',\n // 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data coul d come from a fetch OR from ldp comtaimner\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(x)\n for (let k = 0; k < displayables.length; k++) {\n if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'Dok'\n }\n\n return null\n },\n\n // Create a new folder in a Solid system, with a dokieli editable document in it\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n let newInstance = newPaneOptions.newInstance\n if (!newInstance) {\n let uri = newPaneOptions.newBase\n if (uri.endsWith('/')) {\n uri = uri.slice(0, -1)\n newPaneOptions.newBase = uri\n }\n newInstance = kb.sym(uri)\n }\n\n const contentType = mime.lookup(newInstance.uri)\n if (!contentType || !contentType.includes('html')) {\n newInstance = $rdf.sym(newInstance.uri + '.html')\n }\n newPaneOptions.newInstance = newInstance // Save for creation system\n\n // console.log('New dokieli will make: ' + newInstance)\n\n let htmlContents = DOKIELI_TEMPLATE\n let filename = newInstance.uri.split('/').slice(-1)[0]\n filename = decodeURIComponent(filename.split('.')[0])\n const encodedTitle = filename\n .replace(/&/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>')\n htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle)\n htmlContents = htmlContents.replace(\n '</article>',\n '<h1>' + encodedTitle + '</h1></article>'\n )\n // console.log('@@ New HTML for Dok:' + htmlContents)\n return new Promise(function (resolve) {\n kb.fetcher\n .webOperation('PUT', newInstance.uri, {\n data: htmlContents,\n contentType: 'text/html'\n })\n .then(function () {\n console.log(\n 'new Dokieli document created at ' + newPaneOptions.newInstance\n )\n resolve(newPaneOptions)\n })\n .catch(function (err) {\n console.log(\n 'Error creating dokieli doc at ' +\n newPaneOptions.newInstance +\n ': ' +\n err\n )\n })\n })\n },\n\n // Derived from: humanReadablePane .. share code?\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const iframe = myDocument.createElement('IFRAME')\n\n // Function to set iframe attributes\n const setIframeAttributes = (iframe, blob, lines) => {\n const objectURL = URL.createObjectURL(blob)\n iframe.setAttribute('src', objectURL)\n iframe.setAttribute('type', blob.type)\n iframe.setAttribute('class', 'doc')\n iframe.setAttribute('style', `border: 1px solid; padding: 1em; height:${lines}em; width:800px; resize: both; overflow: auto;`)\n\n // Apply sandbox attribute only for HTML files\n // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can;'t have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {\n iframe.setAttribute('sandbox', 'allow-scripts allow-same-origin')\n }\n }\n\n // Fetch and process the blob\n kb.fetcher._fetch(subject.uri)\n .then(response => response.blob())\n .then(blob => {\n const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('')\n return blobTextPromise.then(blobText => ({ blob, blobText }))\n })\n .then(({ blob, blobText }) => {\n const newLines = blobText.includes('<script src=\"https://dokie.li/scripts/dokieli.js\">') ? -10 : 5\n const lines = Math.min(30, blobText.split(/\\n/).length + newLines)\n setIframeAttributes(iframe, blob, lines)\n })\n .catch(err => {\n console.log('Error fetching or processing blob:', err)\n })\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0].split(';', 1)[0].trim() : null\n if (ct) {\n console.log('dokieliPane: c-t:' + ct)\n } else {\n console.log('dokieliPane: unknown content-type?')\n }\n\n const tr = myDocument.createElement('tr')\n tr.appendChild(iframe)\n div.appendChild(tr)\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;AAOA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,uBAAA,CAAAC,OAAA;AAIA,IAAAG,IAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAuC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,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E,GAAG,CAAC;MAClG,MAAM0B,KAAK,GAAGY,IAAI,CAACC,GAAG,CAAC,EAAE,EAAEH,QAAQ,CAAChC,KAAK,CAAC,IAAI,CAAC,CAACtB,MAAM,GAAGuD,QAAQ,CAAC;MAClEb,mBAAmB,CAACD,MAAM,EAAEE,IAAI,EAAEC,KAAK,CAAC;IAC1C,CAAC,CAAC,CACDX,KAAK,CAACC,GAAG,IAAI;MACZH,OAAO,CAACC,GAAG,CAAC,oCAAoC,EAAEE,GAAG,CAAC;IACxD,CAAC,CAAC;IAEJ,MAAMtC,GAAG,GAAGP,EAAE,CAACQ,OAAO,CAACC,SAAS,CAACX,OAAO,CAACuE,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC;IAC/D,MAAMC,EAAE,GAAG/D,GAAG,GAAGA,GAAG,CAAC,CAAC,CAAC,CAAC0B,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAACsC,IAAI,CAAC,CAAC,GAAG,IAAI;IACtD,IAAID,EAAE,EAAE;MACN5B,OAAO,CAACC,GAAG,CAAC,mBAAmB,GAAG2B,EAAE,CAAC;IACvC,CAAC,MAAM;MACL5B,OAAO,CAACC,GAAG,CAAC,oCAAoC,CAAC;IACnD;IAEA,MAAM6B,EAAE,GAAGzB,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzCsB,EAAE,CAACC,WAAW,CAACrB,MAAM,CAAC;IACtBH,GAAG,CAACwB,WAAW,CAACD,EAAE,CAAC;IACnB,OAAOvB,GAAG;EACZ;AACF,CAAC,EACD","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const DOKIELI_TEMPLATE = `
|
|
8
|
+
<!DOCTYPE html>
|
|
9
|
+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="utf-8" />
|
|
12
|
+
<title></title>
|
|
13
|
+
<meta content="width=device-width, initial-scale=1" name="viewport" />
|
|
14
|
+
<link href="https://dokie.li/media/css/basic.css" media="all" rel="stylesheet" title="Basic" />
|
|
15
|
+
<link href="https://dokie.li/media/css/dokieli.css" media="all" rel="stylesheet" />
|
|
16
|
+
<script src="https://dokie.li/scripts/dokieli.js"></script>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body about="" prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#" typeof="schema:CreativeWork prov:Entity">
|
|
20
|
+
<main>
|
|
21
|
+
<article about="" typeof="schema:Article">
|
|
22
|
+
|
|
23
|
+
</article>
|
|
24
|
+
</main>
|
|
25
|
+
</body>
|
|
26
|
+
</html>`;
|
|
27
|
+
var _default = exports.default = DOKIELI_TEMPLATE;
|
|
28
|
+
//# sourceMappingURL=new.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new.js","names":["DOKIELI_TEMPLATE","_default","exports","default"],"sources":["../../src/dokieli/new.js"],"sourcesContent":["const DOKIELI_TEMPLATE = `\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>`\n\nexport default DOKIELI_TEMPLATE\n"],"mappings":";;;;;;AAAA,MAAMA,gBAAgB,GAAG;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEOH,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.formPane = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
var _solidLogic = require("solid-logic");
|
|
9
|
+
var $rdf = _interopRequireWildcard(require("rdflib"));
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
|
+
/*
|
|
12
|
+
** Pane for running existing forms for any object
|
|
13
|
+
**
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const ns = UI.ns;
|
|
17
|
+
const formPane = exports.formPane = {
|
|
18
|
+
icon: UI.icons.iconBase + 'noun_122196.svg',
|
|
19
|
+
name: 'form',
|
|
20
|
+
audience: [ns.solid('PowerUser')],
|
|
21
|
+
// Does the subject deserve this pane?
|
|
22
|
+
label: function (subject) {
|
|
23
|
+
const n = UI.widgets.formsFor(subject).length;
|
|
24
|
+
UI.log.debug('Form pane: forms for ' + subject + ': ' + n);
|
|
25
|
+
if (!n) return null;
|
|
26
|
+
return '' + n + ' forms';
|
|
27
|
+
},
|
|
28
|
+
render: function (subject, context) {
|
|
29
|
+
const kb = context.session.store;
|
|
30
|
+
const dom = context.dom;
|
|
31
|
+
const mention = function complain(message, style) {
|
|
32
|
+
const pre = dom.createElement('p');
|
|
33
|
+
pre.setAttribute('style', style || 'color: grey; background-color: white');
|
|
34
|
+
box.appendChild(pre).textContent = message;
|
|
35
|
+
return pre;
|
|
36
|
+
};
|
|
37
|
+
const complain = function complain(message, style) {
|
|
38
|
+
mention(message, 'style', style || 'color: grey; background-color: #fdd;');
|
|
39
|
+
};
|
|
40
|
+
const complainIfBad = function (ok, body) {
|
|
41
|
+
if (ok) {
|
|
42
|
+
// setModifiedDate(store, kb, store);
|
|
43
|
+
// rerender(box); // Deleted forms at the moment
|
|
44
|
+
} else complain('Sorry, failed to save your change:\n' + body);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// The question of where to store this data about subject
|
|
48
|
+
// This in general needs a whole lot more thought
|
|
49
|
+
// and it connects to the discoverbility through links
|
|
50
|
+
|
|
51
|
+
// const t = kb.findTypeURIs(subject)
|
|
52
|
+
|
|
53
|
+
const me = _solidLogic.authn.currentUser();
|
|
54
|
+
const box = dom.createElement('div');
|
|
55
|
+
box.setAttribute('class', 'formPane');
|
|
56
|
+
if (!me) {
|
|
57
|
+
mention('You are not logged in. If you log in and have ' + 'workspaces then you would be able to select workspace in which ' + 'to put this new information');
|
|
58
|
+
} else {
|
|
59
|
+
const ws = kb.each(me, ns.ui('workspace'));
|
|
60
|
+
if (ws.length === 0) {
|
|
61
|
+
mention('You don\'t seem to have any workspaces defined. ' + 'A workspace is a place on the web (http://..) or in ' + 'the file system (file:///) to store application data.\n');
|
|
62
|
+
} else {
|
|
63
|
+
// @@
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Render forms using a given store
|
|
68
|
+
|
|
69
|
+
const renderFormsFor = function (store, subject) {
|
|
70
|
+
kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {
|
|
71
|
+
if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body);
|
|
72
|
+
|
|
73
|
+
// Render the forms
|
|
74
|
+
|
|
75
|
+
const forms = UI.widgets.formsFor(subject);
|
|
76
|
+
|
|
77
|
+
// complain('Form for editing this form:');
|
|
78
|
+
for (let i = 0; i < forms.length; i++) {
|
|
79
|
+
const form = forms[i];
|
|
80
|
+
const heading = dom.createElement('h4');
|
|
81
|
+
box.appendChild(heading);
|
|
82
|
+
if (form.uri) {
|
|
83
|
+
const formStore = $rdf.Util.uri.document(form.uri);
|
|
84
|
+
if (formStore.uri !== form.uri) {
|
|
85
|
+
// The form is a hash-type URI
|
|
86
|
+
const e = box.appendChild(UI.widgets.editFormButton(dom, box, form, formStore, complainIfBad));
|
|
87
|
+
e.setAttribute('style', 'float: right;');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const anchor = dom.createElement('a');
|
|
91
|
+
anchor.setAttribute('href', form.uri);
|
|
92
|
+
heading.appendChild(anchor);
|
|
93
|
+
anchor.textContent = UI.utils.label(form, true);
|
|
94
|
+
|
|
95
|
+
/* Keep tis as a reminder to let a New one have its URI given by user
|
|
96
|
+
mention("Where will this information be stored?")
|
|
97
|
+
const ele = dom.createElement('input');
|
|
98
|
+
box.appendChild(ele);
|
|
99
|
+
ele.setAttribute('type', 'text');
|
|
100
|
+
ele.setAttribute('size', '72');
|
|
101
|
+
ele.setAttribute('maxlength', '1024');
|
|
102
|
+
ele.setAttribute('style', 'font-size: 80%; color:#222;');
|
|
103
|
+
ele.value = store.uri
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
UI.widgets.appendForm(dom, box, {}, subject, form, store, complainIfBad);
|
|
107
|
+
}
|
|
108
|
+
}); // end: when store loded
|
|
109
|
+
}; // renderFormsFor
|
|
110
|
+
|
|
111
|
+
// Figure out what store
|
|
112
|
+
|
|
113
|
+
// Which places are editable and have stuff about the subject?
|
|
114
|
+
|
|
115
|
+
let store = null;
|
|
116
|
+
|
|
117
|
+
// 1. The document URI of the subject itself
|
|
118
|
+
const docuri = $rdf.Util.uri.docpart(subject.uri);
|
|
119
|
+
if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {
|
|
120
|
+
store = subject.doc();
|
|
121
|
+
} // an editable data file with hash
|
|
122
|
+
|
|
123
|
+
store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'));
|
|
124
|
+
|
|
125
|
+
// 2. where stuff is already stored
|
|
126
|
+
if (!store) {
|
|
127
|
+
const docs = {};
|
|
128
|
+
const docList = [];
|
|
129
|
+
store.statementsMatching(subject).forEach(function (st) {
|
|
130
|
+
docs[st.why.uri] = 1;
|
|
131
|
+
});
|
|
132
|
+
store.statementsMatching(undefined, undefined, subject).forEach(function (st) {
|
|
133
|
+
docs[st.why.uri] = 2;
|
|
134
|
+
});
|
|
135
|
+
for (const d in docs) docList.push(docs[d], d);
|
|
136
|
+
docList.sort();
|
|
137
|
+
for (let i = 0; i < docList.length; i++) {
|
|
138
|
+
const uri = docList[i][1];
|
|
139
|
+
if (uri && store.updater.editable(uri)) {
|
|
140
|
+
store = store.sym(uri);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// 3. In a workspace store
|
|
147
|
+
// @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)
|
|
148
|
+
const _followeach = function (kb, subject, path) {
|
|
149
|
+
if (path.length === 0) return [subject];
|
|
150
|
+
const oo = kb.each(subject, path[0]);
|
|
151
|
+
let res = [];
|
|
152
|
+
for (let i = 0; i < oo.length; i++) {
|
|
153
|
+
res = res.concat(_followeach(kb, oo[i], path.slice(1)));
|
|
154
|
+
}
|
|
155
|
+
return res;
|
|
156
|
+
};
|
|
157
|
+
const date = '2014'; // @@@@@@@@@@@@ pass as parameter
|
|
158
|
+
|
|
159
|
+
if (store) {
|
|
160
|
+
// mention("@@ Ok, we have a store <" + store.uri + ">.");
|
|
161
|
+
renderFormsFor(store, subject);
|
|
162
|
+
} else {
|
|
163
|
+
complain('No suitable store is known, to edit <' + subject.uri + '>.');
|
|
164
|
+
const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {
|
|
165
|
+
mention('Workspace selected OK: ' + ws);
|
|
166
|
+
const activities = store.each(undefined, ns.space('workspace'), ws);
|
|
167
|
+
for (let j = 0; j < activities.length; j++) {
|
|
168
|
+
const act = activities[j];
|
|
169
|
+
const subjectDoc2 = store.any(ws, ns.space('store'));
|
|
170
|
+
const start = store.any(ws, ns.cal('dtstart')).value();
|
|
171
|
+
const end = store.any(ws, ns.cal('dtend')).value();
|
|
172
|
+
if (subjectDoc2 && start && end && start <= date && end > date) {
|
|
173
|
+
renderFormsFor(subjectDoc2, subject);
|
|
174
|
+
break;
|
|
175
|
+
} else {
|
|
176
|
+
complain('Note no suitable annotation store in activity: ' + act);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
box.appendChild(foobarbaz);
|
|
181
|
+
}
|
|
182
|
+
return box;
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=pane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pane.js","names":["UI","_interopRequireWildcard","require","_solidLogic","$rdf","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","formPane","exports","icon","icons","iconBase","name","audience","solid","label","subject","widgets","formsFor","length","log","debug","render","context","kb","session","store","dom","mention","complain","message","style","pre","createElement","setAttribute","box","appendChild","textContent","complainIfBad","ok","body","me","authn","currentUser","ws","each","ui","renderFormsFor","fetcher","nowOrWhenFetched","uri","forms","form","heading","formStore","Util","document","editFormButton","anchor","utils","appendForm","docuri","docpart","updater","editable","doc","any","sym","link","docs","docList","statementsMatching","forEach","st","why","undefined","d","push","sort","_followeach","path","oo","res","concat","slice","date","foobarbaz","login","selectWorkspace","activities","space","j","act","subjectDoc2","start","cal","value","end"],"sources":["../../src/form/pane.js"],"sourcesContent":["/*\n ** Pane for running existing forms for any object\n **\n */\n\nimport * as UI from 'solid-ui'\nimport { authn } from 'solid-logic'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nexport const formPane = {\n icon: UI.icons.iconBase + 'noun_122196.svg',\n\n name: 'form',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject) {\n const n = UI.widgets.formsFor(subject).length\n UI.log.debug('Form pane: forms for ' + subject + ': ' + n)\n if (!n) return null\n return '' + n + ' forms'\n },\n\n render: function (subject, context) {\n const kb = context.session.store\n const dom = context.dom\n\n const mention = function complain (message, style) {\n const pre = dom.createElement('p')\n pre.setAttribute('style', style || 'color: grey; background-color: white')\n box.appendChild(pre).textContent = message\n return pre\n }\n\n const complain = function complain (message, style) {\n mention(message, 'style', style || 'color: grey; background-color: #fdd;')\n }\n\n const complainIfBad = function (ok, body) {\n if (ok) {\n // setModifiedDate(store, kb, store);\n // rerender(box); // Deleted forms at the moment\n } else complain('Sorry, failed to save your change:\\n' + body)\n }\n\n // The question of where to store this data about subject\n // This in general needs a whole lot more thought\n // and it connects to the discoverbility through links\n\n // const t = kb.findTypeURIs(subject)\n\n const me = authn.currentUser()\n\n const box = dom.createElement('div')\n box.setAttribute('class', 'formPane')\n\n if (!me) {\n mention(\n 'You are not logged in. If you log in and have ' +\n 'workspaces then you would be able to select workspace in which ' +\n 'to put this new information'\n )\n } else {\n const ws = kb.each(me, ns.ui('workspace'))\n if (ws.length === 0) {\n mention(\n 'You don\\'t seem to have any workspaces defined. ' +\n 'A workspace is a place on the web (http://..) or in ' +\n 'the file system (file:///) to store application data.\\n'\n )\n } else {\n // @@\n }\n }\n\n // Render forms using a given store\n\n const renderFormsFor = function (store, subject) {\n kb.fetcher.nowOrWhenFetched(store.uri, subject, function (ok, body) {\n if (!ok) return complain('Cannot load store ' + store.uri + ': ' + body)\n\n // Render the forms\n\n const forms = UI.widgets.formsFor(subject)\n\n // complain('Form for editing this form:');\n for (let i = 0; i < forms.length; i++) {\n const form = forms[i]\n const heading = dom.createElement('h4')\n box.appendChild(heading)\n if (form.uri) {\n const formStore = $rdf.Util.uri.document(form.uri)\n if (formStore.uri !== form.uri) {\n // The form is a hash-type URI\n const e = box.appendChild(\n UI.widgets.editFormButton(\n dom,\n box,\n form,\n formStore,\n complainIfBad\n )\n )\n e.setAttribute('style', 'float: right;')\n }\n }\n const anchor = dom.createElement('a')\n anchor.setAttribute('href', form.uri)\n heading.appendChild(anchor)\n anchor.textContent = UI.utils.label(form, true)\n\n /* Keep tis as a reminder to let a New one have its URI given by user\n mention(\"Where will this information be stored?\")\n const ele = dom.createElement('input');\n box.appendChild(ele);\n ele.setAttribute('type', 'text');\n ele.setAttribute('size', '72');\n ele.setAttribute('maxlength', '1024');\n ele.setAttribute('style', 'font-size: 80%; color:#222;');\n ele.value = store.uri\n */\n\n UI.widgets.appendForm(\n dom,\n box,\n {},\n subject,\n form,\n store,\n complainIfBad\n )\n }\n }) // end: when store loded\n } // renderFormsFor\n\n // Figure out what store\n\n // Which places are editable and have stuff about the subject?\n\n let store = null\n\n // 1. The document URI of the subject itself\n const docuri = $rdf.Util.uri.docpart(subject.uri)\n if (subject.uri !== docuri && kb.updater.editable(docuri, kb)) {\n store = subject.doc()\n } // an editable data file with hash\n\n store = store || kb.any(kb.sym(docuri), ns.link('annotationStore'))\n\n // 2. where stuff is already stored\n if (!store) {\n const docs = {}\n const docList = []\n store.statementsMatching(subject).forEach(function (st) {\n docs[st.why.uri] = 1\n })\n store\n .statementsMatching(undefined, undefined, subject)\n .forEach(function (st) {\n docs[st.why.uri] = 2\n })\n for (const d in docs) docList.push(docs[d], d)\n docList.sort()\n for (let i = 0; i < docList.length; i++) {\n const uri = docList[i][1]\n if (uri && store.updater.editable(uri)) {\n store = store.sym(uri)\n break\n }\n }\n }\n\n // 3. In a workspace store\n // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor)\n const _followeach = function (kb, subject, path) {\n if (path.length === 0) return [subject]\n const oo = kb.each(subject, path[0])\n let res = []\n for (let i = 0; i < oo.length; i++) {\n res = res.concat(_followeach(kb, oo[i], path.slice(1)))\n }\n return res\n }\n\n const date = '2014' // @@@@@@@@@@@@ pass as parameter\n\n if (store) {\n // mention(\"@@ Ok, we have a store <\" + store.uri + \">.\");\n renderFormsFor(store, subject)\n } else {\n complain('No suitable store is known, to edit <' + subject.uri + '>.')\n const foobarbaz = UI.login.selectWorkspace(dom, function (ws) {\n mention('Workspace selected OK: ' + ws)\n\n const activities = store.each(undefined, ns.space('workspace'), ws)\n for (let j = 0; j < activities.length; j++) {\n const act = activities[j]\n\n const subjectDoc2 = store.any(ws, ns.space('store'))\n const start = store.any(ws, ns.cal('dtstart')).value()\n const end = store.any(ws, ns.cal('dtend')).value()\n if (subjectDoc2 && start && end && start <= date && end > date) {\n renderFormsFor(subjectDoc2, subject)\n break\n } else {\n complain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