solid-panes 3.6.2-d106c9f8 → 3.6.2-d51e8ba0

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.
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1739472916523" clover="3.2.0">
3
- <project timestamp="1739472916523" name="All files">
2
+ <coverage generated="1739463379511" clover="3.2.0">
3
+ <project timestamp="1739463379511" name="All files">
4
4
  <metrics statements="125" coveredstatements="125" conditionals="6" coveredconditionals="4" methods="13" coveredmethods="13" elements="144" coveredelements="142" complexity="0" loc="125" ncloc="125" packages="2" files="5" classes="5"/>
5
5
  <package name="outline">
6
6
  <metrics statements="112" coveredstatements="112" conditionals="6" coveredconditionals="4" methods="7" coveredmethods="7"/>
@@ -116,7 +116,7 @@
116
116
  <div class='footer quiet pad2 space-top1 center small'>
117
117
  Code coverage generated by
118
118
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
119
- at 2025-02-13T18:55:16.514Z
119
+ at 2025-02-13T16:16:19.502Z
120
120
  </div>
121
121
  <script src="prettify.js"></script>
122
122
  <script>
@@ -146,7 +146,7 @@
146
146
  <div class='footer quiet pad2 space-top1 center small'>
147
147
  Code coverage generated by
148
148
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
149
- at 2025-02-13T18:55:16.514Z
149
+ at 2025-02-13T16:16:19.502Z
150
150
  </div>
151
151
  <script src="../prettify.js"></script>
152
152
  <script>
@@ -550,7 +550,7 @@ outlineIcons.termWidgets.addTri = new outlineIcons.OutlinerIcon(
550
550
  <div class='footer quiet pad2 space-top1 center small'>
551
551
  Code coverage generated by
552
552
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
553
- at 2025-02-13T18:55:16.514Z
553
+ at 2025-02-13T16:16:19.502Z
554
554
  </div>
555
555
  <script src="../prettify.js"></script>
556
556
  <script>
@@ -181,7 +181,7 @@ export function viewsAddPropertyView (views, property, pviewfunc, isDefault) {
181
181
  <div class='footer quiet pad2 space-top1 center small'>
182
182
  Code coverage generated by
183
183
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
184
- at 2025-02-13T18:55:16.514Z
184
+ at 2025-02-13T16:16:19.502Z
185
185
  </div>
186
186
  <script src="../prettify.js"></script>
187
187
  <script>
@@ -106,7 +106,7 @@ export default (dom) =&gt; function viewAsImage (obj) {
106
106
  <div class='footer quiet pad2 space-top1 center small'>
107
107
  Code coverage generated by
108
108
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
109
- at 2025-02-13T18:55:16.514Z
109
+ at 2025-02-13T16:16:19.502Z
110
110
  </div>
111
111
  <script src="../prettify.js"></script>
112
112
  <script>
@@ -112,7 +112,7 @@
112
112
  <div class='footer quiet pad2 space-top1 center small'>
113
113
  Code coverage generated by
114
114
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
115
- at 2025-02-13T18:55:16.514Z
115
+ at 2025-02-13T16:16:19.502Z
116
116
  </div>
117
117
  <script src="../prettify.js"></script>
118
118
  <script>
@@ -101,7 +101,7 @@
101
101
  <div class='footer quiet pad2 space-top1 center small'>
102
102
  Code coverage generated by
103
103
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
- at 2025-02-13T18:55:16.514Z
104
+ at 2025-02-13T16:16:19.502Z
105
105
  </div>
106
106
  <script src="../prettify.js"></script>
107
107
  <script>
@@ -223,7 +223,7 @@ export function generateRandomString () {
223
223
  <div class='footer quiet pad2 space-top1 center small'>
224
224
  Code coverage generated by
225
225
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
226
- at 2025-02-13T18:55:16.514Z
226
+ at 2025-02-13T16:16:19.502Z
227
227
  </div>
228
228
  <script src="../prettify.js"></script>
229
229
  <script>
@@ -40,7 +40,7 @@ var humanReadablePane = {
40
40
 
41
41
  // This data could come from a fetch OR from ldp container
42
42
  var hasContentTypeIn2 = function hasContentTypeIn2(kb, x, displayables) {
43
- var t = kb.findTypeURIs(subject);
43
+ var t = kb.findTypeURIs(x);
44
44
  for (var k = 0; k < displayables.length; k++) {
45
45
  if (_rdflib.Util.mediaTypeClass(displayables[k]).uri in t) {
46
46
  return true;
@@ -77,7 +77,7 @@ var humanReadablePane = {
77
77
  frame.setAttribute('src', URL.createObjectURL(blob));
78
78
  frame.setAttribute('type', blob.type);
79
79
  frame.setAttribute('class', 'doc');
80
- frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 800px; resize: both; overflow: auto;"));
80
+ frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 100%; max-width: 800px; resize: both; overflow: auto;"));
81
81
 
82
82
  // Apply sandbox attribute only for HTML files
83
83
  // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
@@ -88,45 +88,43 @@ var humanReadablePane = {
88
88
  frame.setAttribute('sandbox', 'allow-scripts allow-same-origin');
89
89
  }
90
90
  };
91
-
92
- // render markdown to html
93
- var markdownHtml = function markdownHtml() {
91
+ var processMarkdown = function processMarkdown(frame, markdownText) {
92
+ var lines = Math.min(30, markdownText.split(/\n/).length + 5);
93
+ var res = _marked.marked.parse(markdownText);
94
+ var clean = _dompurify["default"].sanitize(res);
95
+ frame.innerHTML = clean;
96
+ frame.setAttribute('class', 'doc');
97
+ frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 100%; max-width: 800px; resize: both; overflow: auto;"));
98
+ };
99
+ var fetchAndProcessBlob = function fetchAndProcessBlob(kb, subject, frame) {
100
+ kb.fetcher._fetch(subject.uri).then(function (response) {
101
+ return response.blob();
102
+ }).then(function (blob) {
103
+ var lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\n/).length + 5) : 5;
104
+ setIframeAttributes(frame, blob, lines);
105
+ return blob.type.startsWith('text') ? blob.text() : '';
106
+ }).then(function (blobText) {
107
+ if (blobText) {
108
+ var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
109
+ var lines = Math.min(30, blobText.split(/\n/).length + newLines);
110
+ frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 100%; max-width: 800px; resize: both; overflow: auto;"));
111
+ }
112
+ })["catch"](function (error) {
113
+ console.error('Error processing blob:', error);
114
+ frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');
115
+ frame.textContent = 'Error loading content';
116
+ });
117
+ };
118
+ if (ct === 'text/markdown') {
94
119
  kb.fetcher.webOperation('GET', subject.uri).then(function (response) {
95
120
  var markdownText = response.responseText;
96
- var lines = Math.min(30, markdownText.split(/\n/).length + 5);
97
- var res = _marked.marked.parse(markdownText);
98
- var clean = _dompurify["default"].sanitize(res);
99
- frame.innerHTML = clean;
100
- frame.setAttribute('class', 'doc');
101
- frame.setAttribute('style', "border: 1px solid; padding: 1em; height: ".concat(lines, "em; width: 800px; resize: both; overflow: auto;"));
121
+ processMarkdown(frame, markdownText);
102
122
  })["catch"](function (error) {
103
123
  console.error('Error fetching markdown content:', error);
104
124
  frame.innerHTML = '<p>Error loading content</p>';
105
125
  });
106
- };
107
- if (ct === 'text/markdown') {
108
- markdownHtml();
109
126
  } else {
110
- // Fetch and process the blob
111
- kb.fetcher._fetch(subject.uri).then(function (response) {
112
- return response.blob();
113
- }).then(function (blob) {
114
- var blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('');
115
- return blobTextPromise.then(function (blobText) {
116
- return {
117
- blob: blob,
118
- blobText: blobText
119
- };
120
- });
121
- }).then(function (_ref) {
122
- var blob = _ref.blob,
123
- blobText = _ref.blobText;
124
- var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
125
- var lines = Math.min(30, blobText.split(/\n/).length + newLines);
126
- setIframeAttributes(frame, blob, lines);
127
- })["catch"](function (err) {
128
- console.log('Error fetching or processing blob:', err);
129
- });
127
+ fetchAndProcessBlob(kb, subject, frame);
130
128
  }
131
129
  var tr = myDocument.createElement('TR');
132
130
  tr.appendChild(frame);
@@ -1 +1 @@
1
- {"version":3,"file":"humanReadablePane.js","names":["_solidUi","require","_rdflib","_marked","_dompurify","_interopRequireDefault","e","__esModule","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","concat","markdownHtml","webOperation","then","response","markdownText","responseText","Math","min","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","error","_fetch","blobTextPromise","startsWith","text","Promise","resolve","blobText","_ref","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(subject)\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;AAAkC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AARlC;AACA;AACA;AACA;AACA;;AAMA,IAAME,iBAAiB,GAAG;EACxBC,IAAI,EAAEC,cAAK,CAACC,gBAAgB,GAAG,6BAA6B;EAE5DC,IAAI,EAAE,eAAe;EAErBC,KAAK,EAAE,SAAPA,KAAKA,CAAYC,OAAO,EAAEC,OAAO,EAAE;IACjC,IAAMC,EAAE,GAAGD,OAAO,CAACE,OAAO,CAACC,KAAK;;IAEhC;;IAEA,IAAMC,OAA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,CAAC,CAAC;IACJ;IAEA,IAAMC,EAAE,GAAG/C,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzC4C,EAAE,CAACC,WAAW,CAACpC,KAAK,CAAC;IACrBV,GAAG,CAAC8C,WAAW,CAACD,EAAE,CAAC;IACnB,OAAO7C,GAAG;EACZ;AACF,CAAC;AAAA,IAAA+C,QAAA,GAAAC,OAAA,cAEcjF,iBAAiB,EAChC","ignoreList":[]}
1
+ {"version":3,"file":"humanReadablePane.js","names":["_solidUi","require","_rdflib","_marked","_dompurify","_interopRequireDefault","e","__esModule","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","concat","processMarkdown","markdownText","Math","min","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","fetchAndProcessBlob","_fetch","then","response","startsWith","text","blobText","newLines","includes","error","textContent","webOperation","responseText","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: 100%; max-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 const processMarkdown = (frame, markdownText) => {\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: 100%; max-width: 800px; resize: both; overflow: auto;`);\n };\n\n const fetchAndProcessBlob = (kb, subject, frame) => {\n kb.fetcher._fetch(subject.uri)\n .then(response => response.blob())\n .then(blob => {\n const lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\\n/).length + 5) : 5;\n setIframeAttributes(frame, blob, lines);\n return blob.type.startsWith('text') ? blob.text() : '';\n })\n .then(blobText => {\n if (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 frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);\n }\n })\n .catch(error => {\n console.error('Error processing blob:', error);\n frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');\n frame.textContent = 'Error loading content';\n });\n };\n\n if (ct === 'text/markdown') {\n kb.fetcher.webOperation('GET', subject.uri).then(response => {\n const markdownText = response.responseText\n processMarkdown(frame, markdownText);\n }).catch(error => {\n console.error('Error fetching markdown content:', error)\n frame.innerHTML = '<p>Error loading content</p>'\n })\n } else {\n fetchAndProcessBlob(kb, subject, frame);\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;AAAkC,SAAAI,u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SACI,CAAC,UAAAyB,KAAK,EAAI;QACdhC,OAAO,CAACgC,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;QAC9C5B,KAAK,CAACF,YAAY,CAAC,OAAO,EAAE,4GAA4G,CAAC;QACzIE,KAAK,CAAC6B,WAAW,GAAG,uBAAuB;MAC7C,CAAC,CAAC;IACN,CAAC;IAED,IAAIpC,EAAE,KAAK,eAAe,EAAE;MAC1B5B,EAAE,CAACQ,OAAO,CAACyD,YAAY,CAAC,KAAK,EAAEnE,OAAO,CAACqB,GAAG,CAAC,CAACqC,IAAI,CAAC,UAAAC,QAAQ,EAAI;QAC3D,IAAMb,YAAY,GAAGa,QAAQ,CAACS,YAAY;QAC1CvB,eAAe,CAACR,KAAK,EAAES,YAAY,CAAC;MACtC,CAAC,CAAC,SAAM,CAAC,UAAAmB,KAAK,EAAI;QAChBhC,OAAO,CAACgC,KAAK,CAAC,kCAAkC,EAAEA,KAAK,CAAC;QACxD5B,KAAK,CAACkB,SAAS,GAAG,8BAA8B;MAClD,CAAC,CAAC;IACJ,CAAC,MAAM;MACLC,mBAAmB,CAACtD,EAAE,EAAEF,OAAO,EAAEqC,KAAK,CAAC;IACzC;IAEA,IAAMgC,EAAE,GAAG5C,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzCyC,EAAE,CAACC,WAAW,CAACjC,KAAK,CAAC;IACrBV,GAAG,CAAC2C,WAAW,CAACD,EAAE,CAAC;IACnB,OAAO1C,GAAG;EACZ;AACF,CAAC;AAAA,IAAA4C,QAAA,GAAAC,OAAA,cAEc9E,iBAAiB,EAChC","ignoreList":[]}
@@ -1,4 +1,8 @@
1
1
  "use strict";
2
2
 
3
- module.exports = "\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = exports["default"] = "\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n";
4
8
  //# sourceMappingURL=formsForSchedule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"formsForSchedule.js","names":["module","exports"],"sources":["../../src/schedule/formsForSchedule.js"],"sourcesContent":["module.exports = `\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n`\n"],"mappings":";;AAAAA,MAAM,CAACC,OAAO,m6GAoHb","ignoreList":[]}
1
+ {"version":3,"file":"formsForSchedule.js","names":[],"sources":["../../src/schedule/formsForSchedule.js"],"sourcesContent":["export default `\n@prefix dc: <http://purl.org/dc/elements/1.1/>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix cal: <http://www.w3.org/2002/12/cal/ical#>.\n@prefix ui: <http://www.w3.org/ns/ui#>.\n@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.\n@prefix sched: <http://www.w3.org/ns/pim/schedule#>.\n\n cal:Vevent ui:annotationForm <#form2>, <#form3>; ui:creationForm <#form1> .\n\n<#bigForm>\n dc:title\n \"Schedule event (single form).\";\n a ui:Group;\n ui:parts ( <#form1> <#form2> <#form3> ).\n\n<#form1>\n dc:title\n \"Schedule an event (wizard)\";\n a ui:Form;\n ui:parts (\n <#form1header>\n <#eventTitle>\n <#eventLocation>\n <#eventType>\n <#eventSwitch>\n <#eventComment>\n <#eventAuthor> ).\n\n<#form1header> a ui:Heading; ui:contents \"Schedule an event\" .\n\n<#eventTitle>\n a ui:SingleLineTextField;\n ui:maxLength\n \"128\";\n ui:property\n cal:summary;\n ui:size\n \"40\".\n\n<#eventLocation>\n a ui:SingleLineTextField;\n ui:maxLength\n \"512\";\n ui:property\n cal:location;\n ui:size\n \"40\".\n\n<#eventType> a ui:BooleanField;\n ui:property sched:allDay;\n ui:default true . # Used to be the only way\n\n<#eventSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm> ].\n\n <#AllDayForm> a ui:IntegerField ;\n ui:property sched:durationInDays;\n ui:label \"How many days?\";\n ui:min 1;\n ui:default 1 .\n\n <#NotAllDayForm> a ui:IntegerField ;\n ui:property sched:durationInMinutes;\n ui:label \"Duration (mins)\";\n ui:min 5;\n ui:default 55 .\n\n<#eventComment>\n a ui:MultiLineTextField;\n# ui:maxLength\n# \"1048\";\n# ui:size\n# \"40\".\n ui:property\n cal:comment.\n\n<#eventAuthor>\n a ui:Multiple; ui:min 1; ui:part <#eventAuthorGroup>; ui:property dc:author.\n\n <#eventAuthorGroup> a ui:Group; ui:parts ( <#authorName> <#authorEmail> ) .\n <#authorName> a ui:SingleLineTextField; ui:property foaf:name .\n <#authorEmail> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n\n\n#####################\n\n<#form2> dc:title \"Select possible days or times\"; a ui:Form;\n ui:parts ( <#id1118132113134> <#possibleSwitch> ).\n\n <#id1118132113134> a ui:Heading; ui:contents \"Time proposals\" .\n\n <#possibleSwitch> a ui:Options;\n ui:dependingOn sched:allDay;\n ui:case [ ui:for true; ui:use <#AllDayForm2> ];\n ui:case [ ui:for false; ui:use <#NotAllDayForm2> ].\n\n <#AllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleDate>; ui:property sched:option.\n <#posssibleDate> a ui:DateField; ui:property cal:dtstart; ui:label \"date\".\n\n <#NotAllDayForm2>\n a ui:Multiple; ui:min 2; ui:part <#posssibleTime>; ui:property sched:option.\n <#posssibleTime> a ui:DateTimeField; ui:property cal:dtstart; ui:label \"date and time\".\n\n ##################################\n\n <#form3> dc:title \"Select invited people\"; a ui:Form; ui:parts ( <#id1118132113135> <#id1417314641301b> ) .\n<#id1417314641301b>\n a ui:Multiple; ui:min 1; ui:part <#id1417314674292b>; ui:property sched:invitee.\n <#id1417314674292b> a ui:EmailField; ui:label \"email\"; ui:property foaf:mbox .\n <#id1118132113135> a ui:Heading; ui:contents \"Who to invite\" .\n\n# ENDS\n`\n"],"mappings":"","ignoreList":[]}
@@ -5,8 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = exports["default"] = {
8
- buildTime: "2025-02-13T18:55:17Z",
9
- commit: "d106c9f8cd6d23ce251a2de0c73f5d735aa22833",
8
+ buildTime: "2025-02-13T16:16:20Z",
9
+ commit: "d51e8ba0feeb3e115619b6d8a8e86cc7d7002826",
10
10
  npmInfo: {
11
11
  'solid-panes': '3.6.2',
12
12
  npm: '8.19.4',
@@ -1 +1 @@
1
- {"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","acorn","ada","ares","base64","brotli","cjs_module_lexer","cldr","icu","llhttp","modules","napi","nghttp2","nghttp3","ngtcp2","openssl","simdutf","tz","undici","unicode","uv","uvwasi","v8","zlib"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-02-13T18:55:17Z\",\ncommit: \"d106c9f8cd6d23ce251a2de0c73f5d735aa22833\",\nnpmInfo:\n{\n 'solid-panes': '3.6.2',\n npm: '8.19.4',\n node: '18.20.6',\n acorn: '8.13.0',\n ada: '2.8.0',\n ares: '1.29.0',\n base64: '0.5.2',\n brotli: '1.1.0',\n cjs_module_lexer: '1.2.2',\n cldr: '44.1',\n icu: '74.2',\n llhttp: '6.1.1',\n modules: '108',\n napi: '9',\n nghttp2: '1.61.0',\n nghttp3: '0.7.0',\n ngtcp2: '1.3.0',\n openssl: '3.0.15+quic',\n simdutf: '5.6.0',\n tz: '2024a',\n undici: '5.28.5',\n unicode: '15.1',\n uv: '1.44.2',\n uvwasi: '0.0.19',\n v8: '10.2.154.26-node.37',\n zlib: '1.3.0.1-motley'\n}\n};\n"],"mappings":";;;;;;oCAAe;EACfA,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACP;IACE,aAAa,EAAE,OAAO;IACtBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,QAAQ;IACfC,GAAG,EAAE,OAAO;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,MAAM,EAAE,OAAO;IACfC,gBAAgB,EAAE,OAAO;IACzBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,KAAK;IACdC,IAAI,EAAE,GAAG;IACTC,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,OAAO;IAChBC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,aAAa;IACtBC,OAAO,EAAE,OAAO;IAChBC,EAAE,EAAE,OAAO;IACXC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,MAAM;IACfC,EAAE,EAAE,QAAQ;IACZC,MAAM,EAAE,QAAQ;IAChBC,EAAE,EAAE,qBAAqB;IACzBC,IAAI,EAAE;EACR;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","acorn","ada","ares","base64","brotli","cjs_module_lexer","cldr","icu","llhttp","modules","napi","nghttp2","nghttp3","ngtcp2","openssl","simdutf","tz","undici","unicode","uv","uvwasi","v8","zlib"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-02-13T16:16:20Z\",\ncommit: \"d51e8ba0feeb3e115619b6d8a8e86cc7d7002826\",\nnpmInfo:\n{\n 'solid-panes': '3.6.2',\n npm: '8.19.4',\n node: '18.20.6',\n acorn: '8.13.0',\n ada: '2.8.0',\n ares: '1.29.0',\n base64: '0.5.2',\n brotli: '1.1.0',\n cjs_module_lexer: '1.2.2',\n cldr: '44.1',\n icu: '74.2',\n llhttp: '6.1.1',\n modules: '108',\n napi: '9',\n nghttp2: '1.61.0',\n nghttp3: '0.7.0',\n ngtcp2: '1.3.0',\n openssl: '3.0.15+quic',\n simdutf: '5.6.0',\n tz: '2024a',\n undici: '5.28.5',\n unicode: '15.1',\n uv: '1.44.2',\n uvwasi: '0.0.19',\n v8: '10.2.154.26-node.37',\n zlib: '1.3.0.1-motley'\n}\n};\n"],"mappings":";;;;;;oCAAe;EACfA,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACP;IACE,aAAa,EAAE,OAAO;IACtBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,QAAQ;IACfC,GAAG,EAAE,OAAO;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,MAAM,EAAE,OAAO;IACfC,gBAAgB,EAAE,OAAO;IACzBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,KAAK;IACdC,IAAI,EAAE,GAAG;IACTC,OAAO,EAAE,QAAQ;IACjBC,OAAO,EAAE,OAAO;IAChBC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE,aAAa;IACtBC,OAAO,EAAE,OAAO;IAChBC,EAAE,EAAE,OAAO;IACXC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,MAAM;IACfC,EAAE,EAAE,QAAQ;IACZC,MAAM,EAAE,QAAQ;IAChBC,EAAE,EAAE,qBAAqB;IACzBC,IAAI,EAAE;EACR;AACA,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-panes",
3
- "version": "3.6.2-d106c9f8",
3
+ "version": "3.6.2-d51e8ba0",
4
4
  "description": "Solid-compatible Panes: applets and views for the mashlib and databrowser",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -45,7 +45,7 @@ const humanReadablePane = {
45
45
 
46
46
  // This data could come from a fetch OR from ldp container
47
47
  const hasContentTypeIn2 = function (kb, x, displayables) {
48
- const t = kb.findTypeURIs(subject)
48
+ const t = kb.findTypeURIs(x)
49
49
  for (let k = 0; k < displayables.length; k++) {
50
50
  if (Util.mediaTypeClass(displayables[k]).uri in t) {
51
51
  return true
@@ -91,7 +91,7 @@ const humanReadablePane = {
91
91
  frame.setAttribute('src', URL.createObjectURL(blob));
92
92
  frame.setAttribute('type', blob.type);
93
93
  frame.setAttribute('class', 'doc');
94
- frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`);
94
+ frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);
95
95
 
96
96
  // Apply sandbox attribute only for HTML files
97
97
  // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
@@ -103,40 +103,47 @@ const humanReadablePane = {
103
103
  }
104
104
  };
105
105
 
106
- // render markdown to html
107
- const markdownHtml = function () {
106
+ const processMarkdown = (frame, markdownText) => {
107
+ const lines = Math.min(30, markdownText.split(/\n/).length + 5);
108
+ const res = marked.parse(markdownText);
109
+ const clean = DOMPurify.sanitize(res);
110
+ frame.innerHTML = clean;
111
+ frame.setAttribute('class', 'doc');
112
+ frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);
113
+ };
114
+
115
+ const fetchAndProcessBlob = (kb, subject, frame) => {
116
+ kb.fetcher._fetch(subject.uri)
117
+ .then(response => response.blob())
118
+ .then(blob => {
119
+ const lines = blob.type.startsWith('text') ? Math.min(30, blob.text().split(/\n/).length + 5) : 5;
120
+ setIframeAttributes(frame, blob, lines);
121
+ return blob.type.startsWith('text') ? blob.text() : '';
122
+ })
123
+ .then(blobText => {
124
+ if (blobText) {
125
+ const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
126
+ const lines = Math.min(30, blobText.split(/\n/).length + newLines);
127
+ frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 100%; max-width: 800px; resize: both; overflow: auto;`);
128
+ }
129
+ })
130
+ .catch(error => {
131
+ console.error('Error processing blob:', error);
132
+ frame.setAttribute('style', 'border: 1px solid; padding: 1em; height: 5em; width: 100%; max-width: 800px; resize: both; overflow: auto;');
133
+ frame.textContent = 'Error loading content';
134
+ });
135
+ };
136
+
137
+ if (ct === 'text/markdown') {
108
138
  kb.fetcher.webOperation('GET', subject.uri).then(response => {
109
139
  const markdownText = response.responseText
110
- const lines = Math.min(30, markdownText.split(/\n/).length + 5)
111
- const res = marked.parse(markdownText)
112
- const clean = DOMPurify.sanitize(res)
113
- frame.innerHTML = clean
114
- frame.setAttribute('class', 'doc')
115
- frame.setAttribute('style', `border: 1px solid; padding: 1em; height: ${lines}em; width: 800px; resize: both; overflow: auto;`)
140
+ processMarkdown(frame, markdownText);
116
141
  }).catch(error => {
117
142
  console.error('Error fetching markdown content:', error)
118
143
  frame.innerHTML = '<p>Error loading content</p>'
119
144
  })
120
- }
121
-
122
- if (ct === 'text/markdown') {
123
- markdownHtml()
124
145
  } else {
125
- // Fetch and process the blob
126
- kb.fetcher._fetch(subject.uri)
127
- .then(response => response.blob())
128
- .then(blob => {
129
- const blobTextPromise = blob.type.startsWith('text') ? blob.text() : Promise.resolve('')
130
- return blobTextPromise.then(blobText => ({ blob, blobText }))
131
- })
132
- .then(({ blob, blobText }) => {
133
- const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5
134
- const lines = Math.min(30, blobText.split(/\n/).length + newLines)
135
- setIframeAttributes(frame, blob, lines)
136
- })
137
- .catch(err => {
138
- console.log('Error fetching or processing blob:', err)
139
- })
146
+ fetchAndProcessBlob(kb, subject, frame);
140
147
  }
141
148
 
142
149
  const tr = myDocument.createElement('TR')
@@ -1,4 +1,4 @@
1
- module.exports = `
1
+ export default `
2
2
  @prefix dc: <http://purl.org/dc/elements/1.1/>.
3
3
  @prefix foaf: <http://xmlns.com/foaf/0.1/>.
4
4
  @prefix cal: <http://www.w3.org/2002/12/cal/ical#>.
@@ -1,6 +1,6 @@
1
1
  export default {
2
- buildTime: "2025-02-13T18:55:17Z",
3
- commit: "d106c9f8cd6d23ce251a2de0c73f5d735aa22833",
2
+ buildTime: "2025-02-13T16:16:20Z",
3
+ commit: "d51e8ba0feeb3e115619b6d8a8e86cc7d7002826",
4
4
  npmInfo:
5
5
  {
6
6
  'solid-panes': '3.6.2',