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,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _solidUi = require("solid-ui");
|
|
8
|
+
var _rdflib = require("rdflib");
|
|
9
|
+
var _marked = require("marked");
|
|
10
|
+
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
/* Human-readable Pane
|
|
13
|
+
**
|
|
14
|
+
** This outline pane contains the document contents for an HTML document
|
|
15
|
+
** This is for peeking at a page, because the user might not want to leave the data browser.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const humanReadablePane = {
|
|
19
|
+
icon: _solidUi.icons.originalIconBase + 'tango/22-text-x-generic.png',
|
|
20
|
+
name: 'humanReadable',
|
|
21
|
+
label: function (subject, context) {
|
|
22
|
+
const kb = context.session.store;
|
|
23
|
+
|
|
24
|
+
// See also the source pane, which has lower precedence.
|
|
25
|
+
|
|
26
|
+
const allowed = ['text/plain', 'text/html', 'text/markdown', 'application/xhtml+xml', 'image/png', 'image/jpeg', 'application/pdf', 'video/mp4'];
|
|
27
|
+
const hasContentTypeIn = function (kb, x, displayables) {
|
|
28
|
+
const cts = kb.fetcher.getHeader(x, 'content-type');
|
|
29
|
+
if (cts) {
|
|
30
|
+
for (let j = 0; j < cts.length; j++) {
|
|
31
|
+
for (let k = 0; k < displayables.length; k++) {
|
|
32
|
+
if (cts[j].indexOf(displayables[k]) >= 0) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// This data could come from a fetch OR from ldp container
|
|
42
|
+
const hasContentTypeIn2 = function (kb, x, displayables) {
|
|
43
|
+
const t = kb.findTypeURIs(x);
|
|
44
|
+
for (let k = 0; k < displayables.length; k++) {
|
|
45
|
+
if (_rdflib.Util.mediaTypeClass(displayables[k]).uri in t) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
};
|
|
51
|
+
if (!subject.uri) return null; // no bnodes
|
|
52
|
+
|
|
53
|
+
const t = kb.findTypeURIs(subject);
|
|
54
|
+
if (t[_solidUi.ns.link('WebPage').uri]) return 'view';
|
|
55
|
+
if (hasContentTypeIn(kb, subject, allowed) || hasContentTypeIn2(kb, subject, allowed)) {
|
|
56
|
+
return 'View';
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
},
|
|
60
|
+
render: function (subject, context) {
|
|
61
|
+
const myDocument = context.dom;
|
|
62
|
+
const div = myDocument.createElement('div');
|
|
63
|
+
const kb = context.session.store;
|
|
64
|
+
const cts = kb.fetcher.getHeader(subject.doc(), 'content-type');
|
|
65
|
+
const ct = cts ? cts[0].split(';', 1)[0].trim() : null; // remove content-type parameters
|
|
66
|
+
if (ct) {
|
|
67
|
+
// console.log('humanReadablePane: c-t:' + ct)
|
|
68
|
+
} else {
|
|
69
|
+
console.log('humanReadablePane: unknown content-type?');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// @@ When we can, use CSP to turn off scripts within the iframe
|
|
73
|
+
div.setAttribute('class', 'docView');
|
|
74
|
+
const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME';
|
|
75
|
+
const frame = myDocument.createElement(element);
|
|
76
|
+
const setIframeAttributes = (frame, blob, lines) => {
|
|
77
|
+
frame.setAttribute('src', URL.createObjectURL(blob));
|
|
78
|
+
frame.setAttribute('type', blob.type);
|
|
79
|
+
frame.setAttribute('class', 'doc');
|
|
80
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
|
|
81
|
+
|
|
82
|
+
// Apply sandbox attribute only for HTML files
|
|
83
|
+
// @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
|
|
84
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
|
|
85
|
+
// You can't have any sandbox and allow plugins.
|
|
86
|
+
// We could sandbox only HTML files I suppose.
|
|
87
|
+
if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {
|
|
88
|
+
frame.setAttribute('sandbox', 'allow-scripts allow-same-origin');
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// render markdown to html
|
|
93
|
+
const markdownHtml = function () {
|
|
94
|
+
kb.fetcher.webOperation('GET', subject.uri).then(response => {
|
|
95
|
+
const markdownText = response.responseText;
|
|
96
|
+
const lines = Math.min(30, markdownText.split(/\n/).length + 5);
|
|
97
|
+
const res = _marked.marked.parse(markdownText);
|
|
98
|
+
const clean = _dompurify.default.sanitize(res);
|
|
99
|
+
frame.innerHTML = clean;
|
|
100
|
+
frame.setAttribute('class', 'doc');
|
|
101
|
+
frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
|
|
102
|
+
}).catch(error => {
|
|
103
|
+
console.error('Error fetching markdown content:', error);
|
|
104
|
+
frame.innerHTML = '<p>Error loading content</p>';
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
if (ct === 'text/markdown') {
|
|
108
|
+
markdownHtml();
|
|
109
|
+
} else {
|
|
110
|
+
// Fetch and process the blob
|
|
111
|
+
kb.fetcher._fetch(subject.uri).then(response => response.blob()).then(blob => {
|
|
112
|
+
const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('');
|
|
113
|
+
return blobTextPromise.then(blobText => ({
|
|
114
|
+
blob,
|
|
115
|
+
blobText
|
|
116
|
+
}));
|
|
117
|
+
}).then(({
|
|
118
|
+
blob,
|
|
119
|
+
blobText
|
|
120
|
+
}) => {
|
|
121
|
+
const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
|
|
122
|
+
const lines = Math.min(30, blobText.split(/\n/).length + newLines);
|
|
123
|
+
setIframeAttributes(frame, blob, lines);
|
|
124
|
+
}).catch(err => {
|
|
125
|
+
console.log('Error fetching or processing blob:', err);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const tr = myDocument.createElement('TR');
|
|
129
|
+
tr.appendChild(frame);
|
|
130
|
+
div.appendChild(tr);
|
|
131
|
+
return div;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
var _default = exports.default = humanReadablePane; // ends
|
|
135
|
+
//# sourceMappingURL=humanReadablePane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"humanReadablePane.js","names":["_solidUi","require","_rdflib","_marked","_dompurify","_interopRequireDefault","e","__esModule","default","humanReadablePane","icon","icons","originalIconBase","name","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","t","findTypeURIs","Util","mediaTypeClass","uri","ns","link","render","myDocument","dom","div","createElement","doc","ct","split","trim","console","log","setAttribute","element","frame","setIframeAttributes","blob","lines","URL","createObjectURL","type","markdownHtml","webOperation","then","response","markdownText","responseText","Math","min","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","catch","error","_fetch","blobTextPromise","startsWith","text","Promise","resolve","blobText","newLines","includes","err","tr","appendChild","_default","exports"],"sources":["../src/humanReadablePane.js"],"sourcesContent":["/* Human-readable Pane\n **\n ** This outline pane contains the document contents for an HTML document\n ** This is for peeking at a page, because the user might not want to leave the data browser.\n */\nimport { icons, ns } from 'solid-ui'\nimport { Util } from 'rdflib'\nimport { marked } from 'marked'\nimport DOMPurify from 'dompurify'\n\nconst humanReadablePane = {\n icon: icons.originalIconBase + 'tango/22-text-x-generic.png',\n\n name: 'humanReadable',\n\n label: function (subject, context) {\n const kb = context.session.store\n\n // See also the source pane, which has lower precedence.\n\n const allowed = [\n 'text/plain',\n 'text/html',\n 'text/markdown',\n 'application/xhtml+xml',\n 'image/png',\n 'image/jpeg',\n '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 could come from a fetch OR from ldp container\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(x)\n for (let k = 0; k < displayables.length; k++) {\n if (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 'View'\n }\n\n return null\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0].split(';', 1)[0].trim() : null // remove content-type parameters\n if (ct) {\n // console.log('humanReadablePane: c-t:' + ct)\n } else {\n console.log('humanReadablePane: unknown content-type?')\n }\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const element = ct === 'text/markdown' ? 'DIV' : 'IFRAME'\n const frame = myDocument.createElement(element)\n\n const setIframeAttributes = (frame, blob, lines) => {\n frame.setAttribute('src', URL.createObjectURL(blob))\n frame.setAttribute('type', blob.type)\n frame.setAttribute('class', 'doc')\n frame.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 below - 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 if (blob.type === 'text/html' || blob.type === 'application/xhtml+xml') {\n frame.setAttribute('sandbox', 'allow-scripts allow-same-origin')\n }\n }\n\n // render markdown to html\n const markdownHtml = function () {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n const lines = Math.min(30, markdownText.split(/\\n/).length + 5)\n const res = marked.parse(markdownText)\n const clean = DOMPurify.sanitize(res)\n frame.innerHTML = clean\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)\n }).catch(error => {\n console.error('Error fetching markdown content:', error)\n frame.innerHTML = '<p>Error loading content</p>'\n })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else {\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(frame, blob, lines)\n })\n .catch(err => {\n console.log('Error fetching or processing blob:', err)\n })\n }\n\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane\n// ends\n"],"mappings":";;;;;;AAKA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAiC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AARjC;AACA;AACA;AACA;AACA;;AAMA,MAAMG,iBAAiB,GAAG;EACxBC,IAAI,EAAEC,cAAK,CAACC,gBAAgB,GAAG,6BAA6B;EAE5DC,IAAI,EAAE,eAAe;EAErBC,KAAK,EAAE,SAAAA,CAAUC,OAAO,EAAEC,OAAO,EAAE;IACjC,MAAMC,EAAE,GAAGD,OAAO,CAACE,OAAO,CAACC,KAAK;;IAEhC;;IAEA,MAAMC,OAAO,GAAG,CACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,WAAW,CACZ;IAED,MAAMC,gBAAgB,GAAG,SAAAA,CAAUJ,EAAE,EAAEK,CAAC,EAAEC,YAAY,EAAE;MACtD,MAAMC,GAAG,GAAGP,EAAE,CAACQ,OAAO,CAACC,SAAS,CAACJ,CAAC,EAAE,cAAc,CAAC;MACnD,IAAIE,GAAG,EAAE;QACP,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,GAAG,CAACI,MAAM,EAAED,CAAC,EAAE,EAAE;UACnC,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGN,YAAY,CAACK,MAA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E5B,IAAI;UAAE4B;QAAS,CAAC,CAAC,CAAC;MAC/D,CAAC,CAAC,CACDrB,IAAI,CAAC,CAAC;QAAEP,IAAI;QAAE4B;MAAS,CAAC,KAAK;QAC5B,MAAMC,QAAQ,GAAGD,QAAQ,CAACE,QAAQ,CAAC,oDAAoD,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC;QAClG,MAAM7B,KAAK,GAAGU,IAAI,CAACC,GAAG,CAAC,EAAE,EAAEgB,QAAQ,CAACpC,KAAK,CAAC,IAAI,CAAC,CAAClB,MAAM,GAAGuD,QAAQ,CAAC;QAClE9B,mBAAmB,CAACD,KAAK,EAAEE,IAAI,EAAEC,KAAK,CAAC;MACzC,CAAC,CAAC,CACDmB,KAAK,CAACW,GAAG,IAAI;QACZrC,OAAO,CAACC,GAAG,CAAC,oCAAoC,EAAEoC,GAAG,CAAC;MACxD,CAAC,CAAC;IACN;IAEA,MAAMC,EAAE,GAAG9C,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzC2C,EAAE,CAACC,WAAW,CAACnC,KAAK,CAAC;IACrBV,GAAG,CAAC6C,WAAW,CAACD,EAAE,CAAC;IACnB,OAAO5C,GAAG;EACZ;AACF,CAAC;AAAA,IAAA8C,QAAA,GAAAC,OAAA,CAAAjF,OAAA,GAEcC,iBAAiB,EAChC","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.imagePane = void 0;
|
|
7
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
8
|
+
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); }
|
|
9
|
+
/* Image Pane
|
|
10
|
+
**
|
|
11
|
+
** This outline pane contains the document contents for an Image document
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const imagePane = exports.imagePane = {
|
|
15
|
+
icon: UI.icons.originalIconBase + 'tango/22-image-x-generic.png',
|
|
16
|
+
name: 'image',
|
|
17
|
+
label: function (subject, context) {
|
|
18
|
+
const store = context.session.store;
|
|
19
|
+
if (!store.anyStatementMatching(subject, UI.ns.rdf('type'), store.sym('http://purl.org/dc/terms/Image'))) {
|
|
20
|
+
// NB: Not dc: namespace!
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// See also the source pane, which has lower precedence.
|
|
25
|
+
|
|
26
|
+
const contentTypeMatch = function (store, x, contentTypes) {
|
|
27
|
+
const cts = store.fetcher.getHeader(x, 'content-type');
|
|
28
|
+
if (cts) {
|
|
29
|
+
for (let j = 0; j < cts.length; j++) {
|
|
30
|
+
for (let k = 0; k < contentTypes.length; k++) {
|
|
31
|
+
if (cts[j].indexOf(contentTypes[k]) >= 0) {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
const suppressed = ['application/pdf'];
|
|
40
|
+
if (contentTypeMatch(store, subject, suppressed)) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return 'view';
|
|
44
|
+
},
|
|
45
|
+
render: function (subject, context) {
|
|
46
|
+
const myDocument = context.dom;
|
|
47
|
+
const store = context.session.store;
|
|
48
|
+
const div = myDocument.createElement('div');
|
|
49
|
+
div.setAttribute('class', 'imageView');
|
|
50
|
+
const img = myDocument.createElement('IMG');
|
|
51
|
+
|
|
52
|
+
// get image with authenticated fetch
|
|
53
|
+
store.fetcher._fetch(subject.uri).then(function (response) {
|
|
54
|
+
return response.blob();
|
|
55
|
+
}).then(function (myBlob) {
|
|
56
|
+
const objectURL = URL.createObjectURL(myBlob);
|
|
57
|
+
img.setAttribute('src', objectURL); // w640 h480 //
|
|
58
|
+
});
|
|
59
|
+
img.setAttribute('style', 'max-width: 100%; max-height: 100%;');
|
|
60
|
+
// div.style['max-width'] = '640'
|
|
61
|
+
// div.style['max-height'] = '480'
|
|
62
|
+
const tr = myDocument.createElement('TR'); // why need tr?
|
|
63
|
+
tr.appendChild(img);
|
|
64
|
+
div.appendChild(tr);
|
|
65
|
+
return div;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// ends
|
|
70
|
+
//# sourceMappingURL=imagePane.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imagePane.js","names":["UI","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","imagePane","exports","icon","icons","originalIconBase","name","label","subject","context","store","session","anyStatementMatching","ns","rdf","sym","contentTypeMatch","x","contentTypes","cts","fetcher","getHeader","j","length","k","indexOf","suppressed","render","myDocument","dom","div","createElement","setAttribute","img","_fetch","uri","then","response","blob","myBlob","objectURL","URL","createObjectURL","tr","appendChild"],"sources":["../src/imagePane.js"],"sourcesContent":["/* Image Pane\n **\n ** This outline pane contains the document contents for an Image document\n */\nimport * as UI from 'solid-ui'\n\nexport const imagePane = {\n icon: UI.icons.originalIconBase + 'tango/22-image-x-generic.png',\n\n name: 'image',\n\n label: function (subject, context) {\n const store = context.session.store\n if (\n !store.anyStatementMatching(\n subject,\n UI.ns.rdf('type'),\n store.sym('http://purl.org/dc/terms/Image')\n )\n ) {\n // NB: Not dc: namespace!\n return null\n }\n\n // See also the source pane, which has lower precedence.\n\n const contentTypeMatch = function (store, x, contentTypes) {\n const cts = store.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < contentTypes.length; k++) {\n if (cts[j].indexOf(contentTypes[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n const suppressed = ['application/pdf']\n if (contentTypeMatch(store, subject, suppressed)) {\n return null\n }\n return 'view'\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const store = context.session.store\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'imageView')\n const img = myDocument.createElement('IMG')\n\n // get image with authenticated fetch\n store.fetcher._fetch(subject.uri)\n .then(function (response) {\n return response.blob()\n })\n .then(function (myBlob) {\n const objectURL = URL.createObjectURL(myBlob)\n img.setAttribute('src', objectURL) // w640 h480 //\n })\n\n img.setAttribute('style', 'max-width: 100%; max-height: 100%;')\n // div.style['max-width'] = '640'\n // div.style['max-height'] = '480'\n const tr = myDocument.createElement('TR') // why need tr?\n tr.appendChild(img)\n div.appendChild(tr)\n return div\n }\n}\n\n// ends\n"],"mappings":";;;;;;AAIA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8B,SAAAD,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,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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