solid-panes 3.7.3-125af630 → 3.7.3-18da570b
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/dashboard/basicPreferences.js +121 -129
- package/dist/dashboard/basicPreferences.js.map +1 -1
- package/dist/dashboard/dashboardPane.js +60 -54
- package/dist/dashboard/dashboardPane.js.map +1 -1
- package/dist/dashboard/homepage.js +45 -54
- package/dist/dashboard/homepage.js.map +1 -1
- 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/global.d.js +2 -0
- package/dist/global.d.js.map +1 -0
- package/dist/home/homePane.js +60 -55
- package/dist/home/homePane.js.map +1 -1
- 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/index.js +86 -25
- package/dist/index.js.map +1 -1
- package/dist/internal/internalPane.js +168 -179
- package/dist/internal/internalPane.js.map +1 -1
- package/dist/mainPage/footer.js +13 -7
- package/dist/mainPage/footer.js.map +1 -1
- package/dist/mainPage/header.js +59 -58
- package/dist/mainPage/header.js.map +1 -1
- package/dist/mainPage/index.js +19 -24
- package/dist/mainPage/index.js.map +1 -1
- 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/context.js +17 -11
- package/dist/outline/context.js.map +1 -1
- 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/propertyViews.js +39 -28
- package/dist/outline/propertyViews.js.map +1 -1
- 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/outline/viewAsImage.js +13 -5
- package/dist/outline/viewAsImage.js.map +1 -1
- package/dist/outline/viewAsMbox.js +20 -11
- package/dist/outline/viewAsMbox.js.map +1 -1
- package/dist/pad/padPane.js +395 -404
- package/dist/pad/padPane.js.map +1 -1
- 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/schedulePane.js +888 -0
- package/dist/schedule/schedulePane.js.map +1 -0
- package/dist/sharing/sharingPane.js +36 -32
- package/dist/sharing/sharingPane.js.map +1 -1
- 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/tabbed/tabbedPane.js +54 -51
- package/dist/tabbed/tabbedPane.js.map +1 -1
- 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/trustedApplications/trustedApplications.dom.js +134 -146
- package/dist/trustedApplications/trustedApplications.dom.js.map +1 -1
- package/dist/trustedApplications/trustedApplications.utils.js +20 -20
- package/dist/trustedApplications/trustedApplications.utils.js.map +1 -1
- package/dist/trustedApplications/trustedApplications.view.js +51 -57
- package/dist/trustedApplications/trustedApplications.view.js.map +1 -1
- package/dist/types.js +5 -1
- package/dist/types.js.map +1 -1
- package/dist/ui/pane.js +147 -0
- package/dist/ui/pane.js.map +1 -0
- package/dist/versionInfo.js +35 -29
- package/dist/versionInfo.js.map +1 -1
- package/dist/video/videoPane.js +43 -0
- package/dist/video/videoPane.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global.d.js","names":[],"sources":["../src/global.d.ts"],"sourcesContent":["declare module '*.ttl' {\n const content: string\n export default content\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/home/homePane.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _solidLogic = require("solid-logic");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
1
9
|
/* Home Pane
|
|
2
10
|
**
|
|
3
11
|
** The home pane is avaiable everywhere and allows a user
|
|
@@ -7,62 +15,59 @@
|
|
|
7
15
|
** - keep track of accounts and workspaces etc
|
|
8
16
|
**
|
|
9
17
|
*/
|
|
10
|
-
|
|
11
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
15
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
16
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
import { authn } from 'solid-logic';
|
|
20
|
-
import { create, icons, login } from 'solid-ui';
|
|
18
|
+
|
|
21
19
|
const HomePaneSource = {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
20
|
+
icon: _solidUi.icons.iconBase + 'noun_547570.svg',
|
|
21
|
+
// noun_25830
|
|
22
|
+
|
|
23
|
+
global: true,
|
|
24
|
+
name: 'home',
|
|
25
|
+
// Does the subject deserve an home pane?
|
|
26
|
+
//
|
|
27
|
+
// yes, always!
|
|
28
|
+
//
|
|
29
|
+
label: function () {
|
|
30
|
+
return 'home';
|
|
31
|
+
},
|
|
32
|
+
render: function (subject, context) {
|
|
33
|
+
const dom = context.dom;
|
|
34
|
+
const showContent = async function () {
|
|
35
|
+
const homePaneContext = {
|
|
36
|
+
div,
|
|
37
|
+
dom,
|
|
38
|
+
statusArea: div,
|
|
39
|
+
me
|
|
40
|
+
};
|
|
41
|
+
/*
|
|
42
|
+
div.appendChild(dom.createElement('h4')).textContent = 'Login status'
|
|
43
|
+
var loginStatusDiv = div.appendChild(context.dom.createElement('div'))
|
|
44
|
+
// TODO: Find out what the actual type is:
|
|
45
|
+
type UriType = unknown;
|
|
46
|
+
loginStatusDiv.appendChild(UI.login.loginStatusBox(context.dom, () => {
|
|
47
|
+
// Here we know new log in status
|
|
48
|
+
}))
|
|
49
|
+
*/
|
|
50
|
+
div.appendChild(dom.createElement('h4')).textContent = 'Create new thing somewhere';
|
|
51
|
+
const creationDiv = div.appendChild(dom.createElement('div'));
|
|
52
|
+
const creationContext = {
|
|
53
|
+
div: creationDiv,
|
|
54
|
+
dom,
|
|
55
|
+
statusArea: div,
|
|
56
|
+
me
|
|
57
|
+
};
|
|
58
|
+
const relevantPanes = await _solidUi.login.filterAvailablePanes(context.session.paneRegistry.list);
|
|
59
|
+
_solidUi.create.newThingUI(creationContext, context, relevantPanes); // newUI Have to pass panes down
|
|
60
|
+
|
|
61
|
+
_solidUi.login.registrationList(homePaneContext, {}).then(function () {});
|
|
62
|
+
};
|
|
63
|
+
const div = dom.createElement('div');
|
|
64
|
+
const me = _solidLogic.authn.currentUser(); // this will be incorrect if not logged in
|
|
65
|
+
|
|
66
|
+
showContent();
|
|
67
|
+
return div;
|
|
68
|
+
}
|
|
65
69
|
}; // pane object
|
|
70
|
+
|
|
66
71
|
// ends
|
|
67
|
-
|
|
72
|
+
var _default = exports.default = HomePaneSource;
|
|
68
73
|
//# sourceMappingURL=homePane.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"homePane.js","
|
|
1
|
+
{"version":3,"file":"homePane.js","names":["_solidLogic","require","_solidUi","HomePaneSource","icon","icons","iconBase","global","name","label","render","subject","context","dom","showContent","homePaneContext","div","statusArea","me","appendChild","createElement","textContent","creationDiv","creationContext","relevantPanes","login","filterAvailablePanes","session","paneRegistry","list","create","newThingUI","registrationList","then","authn","currentUser","_default","exports","default"],"sources":["../../src/home/homePane.ts"],"sourcesContent":["/* Home Pane\n **\n ** The home pane is avaiable everywhere and allows a user\n ** to\n ** - keep track of their stuff\n ** - make new things, and possibly\n ** - keep track of accounts and workspaces etc\n **\n */\n\nimport { PaneDefinition } from 'pane-registry'\nimport { NamedNode } from 'rdflib'\nimport { authn } from 'solid-logic'\nimport { create, icons, login } from 'solid-ui'\nimport { CreateContext } from 'solid-ui/lib/create/types'\n\nconst HomePaneSource: PaneDefinition = {\n icon: icons.iconBase + 'noun_547570.svg', // noun_25830\n\n global: true,\n\n name: 'home',\n\n // Does the subject deserve an home pane?\n //\n // yes, always!\n //\n label: function () {\n return 'home'\n },\n\n render: function (subject, context) {\n const dom = context.dom\n const showContent = async function () {\n const homePaneContext = { div, dom, statusArea: div, me }\n /*\n div.appendChild(dom.createElement('h4')).textContent = 'Login status'\n var loginStatusDiv = div.appendChild(context.dom.createElement('div'))\n // TODO: Find out what the actual type is:\n type UriType = unknown;\n loginStatusDiv.appendChild(UI.login.loginStatusBox(context.dom, () => {\n // Here we know new log in status\n }))\n */\n div.appendChild(dom.createElement('h4')).textContent =\n 'Create new thing somewhere'\n const creationDiv = div.appendChild(dom.createElement('div'))\n const creationContext: CreateContext = {\n div: creationDiv,\n dom,\n statusArea: div,\n me\n }\n const relevantPanes = await login.filterAvailablePanes(\n context.session.paneRegistry.list\n )\n create.newThingUI(creationContext, context, relevantPanes) // newUI Have to pass panes down\n\n login.registrationList(homePaneContext, {}).then(function () {})\n }\n\n const div = dom.createElement('div')\n const me: NamedNode = authn.currentUser() as NamedNode // this will be incorrect if not logged in\n\n showContent()\n\n return div\n }\n} // pane object\n\n// ends\nexport default HomePaneSource\n"],"mappings":";;;;;;AAYA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,MAAME,cAA8B,GAAG;EACrCC,IAAI,EAAEC,cAAK,CAACC,QAAQ,GAAG,iBAAiB;EAAE;;EAE1CC,MAAM,EAAE,IAAI;EAEZC,IAAI,EAAE,MAAM;EAEZ;EACA;EACA;EACA;EACAC,KAAK,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@@ -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,MA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AAoC,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,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAJ9B;AACA;AACA;AACA;;AAGO,MAAMkB,SAAS,GAAAC,OAAA,CAA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,UAAU,GAAGnB,OAAO,CAACoB,GAAG;IAC9B,MAAMnB,KAAK,GAAGD,OAAO,CAACE,OAAO,CAACD,KAAK;IACnC,MAAMoB,GAAG,GAAGF,UAAU,CAACG,aAAa,CAAC,KAAK,CAAC;IAC3CD,GAAG,CAACE,YAAY,CAAC,OAAO,EAAE,WAAW,CAAC;IACtC,MAAMC,GAAG,GAAGL,UAAU,CAACG,aAAa,CAAC,KAAK,CAAC;;IAE3C;IACArB,KAAK,CAACU,OAAO,CAACc,MAAM,CAAC1B,OAAO,CAAC2B,GAAG,CAAC,CAC9BC,IAAI,CAAC,UAAUC,QAAQ,EAAE;MACxB,OAAOA,QAAQ,CAACC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC,CACDF,IAAI,CAAC,UAAUG,MAAM,EAAE;MACtB,MAAMC,SAAS,GAAGC,GAAG,CAACC,eAAe,CAACH,MAAM,CAAC;MAC7CN,GAAG,CAACD,YAAY,CAAC,KAAK,EAAEQ,SAAS,CAAC,EAAC;IACrC,CAAC,CAAC;IAEJP,GAAG,CAACD,YAAY,CAAC,OAAO,EAAE,oCAAoC,CAAC;IAC/D;IACA;IACA,MAAMW,EAAE,GAAGf,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC,EAAC;IAC1CY,EAAE,CAACC,WAAW,CAACX,GAAG,CAAC;IACnBH,GAAG,CAACc,WAAW,CAACD,EAAE,CAAC;IACnB,OAAOb,GAAG;EACZ;AACF,CAAC;;AAED","ignoreList":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "OutlineManager", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _manager.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
exports.UI = void 0;
|
|
13
|
+
Object.defineProperty(exports, "byName", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _paneRegistry.byName;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.getOutliner = getOutliner;
|
|
20
|
+
Object.defineProperty(exports, "initMainPage", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () {
|
|
23
|
+
return _mainPage.default;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "list", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () {
|
|
29
|
+
return _paneRegistry.list;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "paneForIcon", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _paneRegistry.paneForIcon;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "paneForPredicate", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _paneRegistry.paneForPredicate;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "register", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () {
|
|
47
|
+
return _paneRegistry.register;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "versionInfo", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () {
|
|
53
|
+
return _versionInfo.default;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var _versionInfo = _interopRequireDefault(require("./versionInfo"));
|
|
57
|
+
var UI = _interopRequireWildcard(require("solid-ui"));
|
|
58
|
+
exports.UI = UI;
|
|
59
|
+
var _solidLogic = require("solid-logic");
|
|
60
|
+
var _manager = _interopRequireDefault(require("./outline/manager.js"));
|
|
61
|
+
var _registerPanes = require("./registerPanes.js");
|
|
62
|
+
var _paneRegistry = require("pane-registry");
|
|
63
|
+
var _context = require("./outline/context");
|
|
64
|
+
var _mainPage = _interopRequireDefault(require("./mainPage"));
|
|
65
|
+
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); }
|
|
66
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
1
67
|
/* SOLID PANES
|
|
2
68
|
**
|
|
3
69
|
** Panes are regions of the outline view in which a particular subject is
|
|
@@ -9,40 +75,35 @@
|
|
|
9
75
|
** relevant to a given subject, returning null if not.
|
|
10
76
|
** If it is relevant, then it returns a suitable tooltip for a control which selects the pane
|
|
11
77
|
*/
|
|
12
|
-
|
|
13
|
-
import * as UI from 'solid-ui';
|
|
14
|
-
import { solidLogicSingleton, store } from 'solid-logic';
|
|
15
|
-
import OutlineManager from './outline/manager.js';
|
|
16
|
-
import { registerPanes } from './registerPanes.js';
|
|
17
|
-
import { list, paneForIcon, paneForPredicate, register, byName } from 'pane-registry';
|
|
18
|
-
import { createContext } from './outline/context';
|
|
19
|
-
import initMainPage from './mainPage';
|
|
78
|
+
|
|
20
79
|
function getOutliner(dom) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
80
|
+
if (!dom.outlineManager) {
|
|
81
|
+
const context = (0, _context.createContext)(dom, {
|
|
82
|
+
list: _paneRegistry.list,
|
|
83
|
+
paneForIcon: _paneRegistry.paneForIcon,
|
|
84
|
+
paneForPredicate: _paneRegistry.paneForPredicate,
|
|
85
|
+
register: _paneRegistry.register,
|
|
86
|
+
byName: _paneRegistry.byName
|
|
87
|
+
}, _solidLogic.store, _solidLogic.solidLogicSingleton);
|
|
88
|
+
dom.outlineManager = new _manager.default(context);
|
|
89
|
+
}
|
|
90
|
+
return dom.outlineManager;
|
|
26
91
|
}
|
|
27
92
|
if (typeof window !== 'undefined') {
|
|
28
|
-
|
|
93
|
+
getOutliner(window.document);
|
|
29
94
|
}
|
|
30
|
-
registerPanes(
|
|
95
|
+
(0, _registerPanes.registerPanes)(cjsOrEsModule => (0, _paneRegistry.register)(cjsOrEsModule.default || cjsOrEsModule));
|
|
96
|
+
|
|
31
97
|
// This has common outline mode functionality for the default and other other panes
|
|
32
98
|
// A separate outline manager is required per DOM in cases like a browser extension
|
|
33
99
|
// where there are many occurrences of window and of window.document
|
|
34
100
|
// But each DOM should have just one outline manager.
|
|
35
|
-
|
|
36
|
-
paneForIcon, // from paneRegistry
|
|
37
|
-
paneForPredicate, // from paneRegistry
|
|
38
|
-
register, // from paneRegistry
|
|
39
|
-
byName // from paneRegistry
|
|
40
|
-
};
|
|
101
|
+
|
|
41
102
|
// export for simpler access by non-node scripts
|
|
42
103
|
if (typeof window !== 'undefined') {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
104
|
+
;
|
|
105
|
+
window.panes = {
|
|
106
|
+
getOutliner
|
|
107
|
+
};
|
|
47
108
|
}
|
|
48
109
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_versionInfo","_interopRequireDefault","require","UI","_interopRequireWildcard","exports","_solidLogic","_manager","_registerPanes","_paneRegistry","_context","_mainPage","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getOutliner","dom","outlineManager","context","createContext","list","paneForIcon","paneForPredicate","register","byName","store","solidLogicSingleton","OutlineManager","window","document","registerPanes","cjsOrEsModule","panes"],"sources":["../src/index.ts"],"sourcesContent":["/* SOLID PANES\n **\n ** Panes are regions of the outline view in which a particular subject is\n ** displayed in a particular way.\n ** Different panes about the same subject are typically stacked vertically.\n ** Panes may be used naked or with a pane selection header.\n **\n ** The label() method has two functions: it determines whether the pane is\n ** relevant to a given subject, returning null if not.\n ** If it is relevant, then it returns a suitable tooltip for a control which selects the pane\n */\n\nimport versionInfo from './versionInfo'\nimport * as UI from 'solid-ui'\nimport { LiveStore } from 'rdflib'\nimport { solidLogicSingleton, store } from 'solid-logic'\nimport OutlineManager from './outline/manager.js'\nimport { registerPanes } from './registerPanes.js'\nimport {\n list,\n paneForIcon,\n paneForPredicate,\n register,\n byName\n} from 'pane-registry'\nimport { createContext } from './outline/context'\nimport initMainPage from './mainPage'\n\nfunction getOutliner (dom) {\n if (!dom.outlineManager) {\n const context = createContext(\n dom,\n { list, paneForIcon, paneForPredicate, register, byName },\n store as LiveStore,\n solidLogicSingleton\n )\n dom.outlineManager = new OutlineManager(context)\n }\n return dom.outlineManager\n}\n\nif (typeof window !== 'undefined') {\n getOutliner(window.document)\n}\n\nregisterPanes((cjsOrEsModule: any) => register(cjsOrEsModule.default || cjsOrEsModule))\n\n// This has common outline mode functionality for the default and other other panes\n// A separate outline manager is required per DOM in cases like a browser extension\n// where there are many occurrences of window and of window.document\n// But each DOM should have just one outline manager.\n\nexport {\n OutlineManager,\n getOutliner,\n UI,\n versionInfo,\n initMainPage,\n list, // from paneRegistry\n paneForIcon, // from paneRegistry\n paneForPredicate, // from paneRegistry\n register, // from paneRegistry\n byName // from paneRegistry\n}\n\n// export for simpler access by non-node scripts\nif (typeof window !== 'undefined') {\n ;(<any>window).panes = {\n getOutliner\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,YAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,EAAA,GAA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