solid-panes 3.6.1-e1d9d5d1 → 3.6.1-f584fd85

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="1736936226991" clover="3.2.0">
3
- <project timestamp="1736936226991" name="All files">
2
+ <coverage generated="1738516660359" clover="3.2.0">
3
+ <project timestamp="1738516660359" 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-01-15T10:17:06.983Z
119
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
149
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
553
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
184
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
109
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
115
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
104
+ at 2025-02-02T17:17:40.351Z
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-01-15T10:17:06.983Z
226
+ at 2025-02-02T17:17:40.351Z
227
227
  </div>
228
228
  <script src="../prettify.js"></script>
229
229
  <script>
@@ -173,6 +173,7 @@ var dataContentPane = exports.dataContentPane = {
173
173
  }
174
174
  for (var i = 0; i < roots.length; i++) {
175
175
  var tr = myDocument.createElement('tr');
176
+ tr.setAttribute('style', "background-color: ".concat(i % 2 === 0 ? '#f0f0f0' : 'white', ";"));
176
177
  rep.appendChild(tr);
177
178
  var subjectTD = myDocument.createElement('td');
178
179
  tr.appendChild(subjectTD);
@@ -1 +1 @@
1
- {"version":3,"file":"dataContentPane.js","names":["UI","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ns","dataContentPane","exports","icon","icons","originalIconBase","name","audience","solid","label","subject","context","session","store","findTypeURIs","statementsMatching","undefined","length","statementsAsTables","sts","initialRoots","myDocument","dom","rep","createElement","sz","rdf","Serializer","res","rootSubjects","roots","subjects","loopBreakers","x","console","log","doneBnodes","referencedBnodes","propertyTree","lastPred","toStr","appendChild","createTextNode","sort","same","predicateTD","st","tr","predicate","uri","setAttribute","anchor","addEventListener","widgets","openHrefInOutlineMode","utils","predicateLabelForXML","objectTD","objectTree","object","obj","termType","datatype","textContent","value","innerHTML","toNT","slice","newTable","ancestor","style","backgroundColor","elements","paneRegistry","byName","statements","Error","concat","filter","sameTerm","subjectTD","TDTree","root","bNT","table","insertBefore","firstChild","render","alternativeRendering","p","s2","div","plist","kb","outliner","appendPropertyTRs","_pred","_inverse","verticalAlign","td","outlineObjectTD","outlineExpand","pane","mainRendering","holds","push","ps","any","foaf","getOutliner"],"sources":["../src/dataContentPane.js"],"sourcesContent":["/* Data content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource.\n */\n\n// To do: - Only take data from one graph\n// - Only do forwards not backward?\n// - Expand automatically all the way down\n// - original source view? Use ffox view source\n\nimport * as UI from 'solid-ui'\nconst ns = UI.ns\n\nexport const dataContentPane = {\n icon: UI.icons.originalIconBase + 'rdf_flyer.24.gif',\n\n name: 'dataContents',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject, context) {\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n context.session.store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = context.session.store.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ).length\n if (n === 0) return null\n return 'Data (' + n + ')'\n },\n /*\n shouldGetFocus: function(subject) {\n return store.whether(subject, UI.ns.rdf('type'), UI.ns.link('RDFDocument'))\n },\n*/\n statementsAsTables: function statementsAsTables (sts, context, initialRoots) {\n const myDocument = context.dom\n // const outliner = context.getOutliner(myDocument)\n const rep = myDocument.createElement('table')\n const sz = UI.rdf.Serializer(context.session.store)\n const res = sz.rootSubjects(sts)\n let roots = res.roots\n const subjects = res.subjects\n const loopBreakers = res.loopBreakers\n for (const x in loopBreakers) {\n console.log('\\tdataContentPane: loopbreaker:' + x)\n }\n const doneBnodes = {} // For preventing looping\n const referencedBnodes = {} // Bnodes which need to be named alas\n\n // The property tree for a single subject or anonymous node\n function propertyTree (subject) {\n // print('Proprty tree for '+subject)\n const rep = myDocument.createElement('table')\n let lastPred = null\n const sts = subjects[sz.toStr(subject)] // relevant statements\n if (!sts) {\n // No statements in tree\n rep.appendChild(myDocument.createTextNode('...')) // just empty bnode as object\n return rep\n }\n sts.sort()\n let same = 0\n let predicateTD // The cell which holds the predicate\n for (let i = 0; i < sts.length; i++) {\n const st = sts[i]\n const tr = myDocument.createElement('tr')\n if (st.predicate.uri !== lastPred) {\n if (lastPred && same > 1) {\n predicateTD.setAttribute('rowspan', '' + same)\n }\n predicateTD = myDocument.createElement('td')\n predicateTD.setAttribute('class', 'pred')\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('href', st.predicate.uri)\n anchor.addEventListener(\n 'click',\n UI.widgets.openHrefInOutlineMode,\n true\n )\n anchor.appendChild(\n myDocument.createTextNode(\n UI.utils.predicateLabelForXML(st.predicate)\n )\n )\n predicateTD.appendChild(anchor)\n tr.appendChild(predicateTD)\n lastPred = st.predicate.uri\n same = 0\n }\n same++\n const objectTD = myDocument.createElement('td')\n objectTD.appendChild(objectTree(st.object))\n tr.appendChild(objectTD)\n rep.appendChild(tr)\n }\n if (lastPred && same > 1) predicateTD.setAttribute('rowspan', '' + same)\n return rep\n }\n\n // Convert a set of statements into a nested tree of tables\n function objectTree (obj) {\n let res, anchor\n switch (obj.termType) {\n case 'NamedNode':\n anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener(\n 'click',\n UI.widgets.openHrefInOutlineMode,\n true\n )\n anchor.appendChild(myDocument.createTextNode(UI.utils.label(obj)))\n return anchor\n\n case 'Literal':\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div')\n res.setAttribute('style', 'white-space: pre-wrap;')\n res.textContent = obj.value\n return res\n } else if (\n obj.datatype.uri ===\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'\n ) {\n res = myDocument.createElement('div')\n res.setAttribute('class', 'embeddedXHTML')\n res.innerHTML = obj.value // Try that @@@ beware embedded dangerous code\n return res\n }\n return myDocument.createTextNode(obj.value) // placeholder - could be smarter,\n\n case 'BlankNode': {\n if (obj.toNT() in doneBnodes) {\n // Break infinite recursion\n referencedBnodes[obj.toNT()] = true\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#' + obj.toNT().slice(2))\n anchor.setAttribute('class', 'bnodeRef')\n anchor.textContent = '*' + obj.toNT().slice(3)\n return anchor\n }\n doneBnodes[obj.toNT()] = true // Flag to prevent infinite recursion in propertyTree\n const newTable = propertyTree(obj)\n doneBnodes[obj.toNT()] = newTable // Track where we mentioned it first\n if (\n UI.utils.ancestor(newTable, 'TABLE') &&\n UI.utils.ancestor(newTable, 'TABLE').style.backgroundColor ===\n 'white'\n ) {\n newTable.style.backgroundColor = '#eee'\n } else {\n newTable.style.backgroundColor = 'white'\n }\n return newTable\n }\n case 'Collection':\n res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (let i = 0; i < obj.elements.length; i++) {\n const tr = myDocument.createElement('tr')\n res.appendChild(tr)\n tr.appendChild(objectTree(obj.elements[i]))\n }\n return res\n case 'Graph':\n res = context.session.paneRegistry\n .byName('dataContents')\n .statementsAsTables(obj.statements, context)\n res.setAttribute('class', 'nestedFormula')\n return res\n case 'Variable':\n res = myDocument.createTextNode('?' + obj.uri)\n return res\n }\n throw new Error('Unhandled node type: ' + obj.termType)\n }\n\n // roots.sort()\n\n if (initialRoots) {\n roots = initialRoots.concat(\n roots.filter(function (x) {\n for (let i = 0; i < initialRoots.length; i++) {\n // Max 2\n if (x.sameTerm(initialRoots[i])) return false\n }\n return true\n })\n )\n }\n for (let i = 0; i < roots.length; i++) {\n const tr = myDocument.createElement('tr')\n rep.appendChild(tr)\n const subjectTD = myDocument.createElement('td')\n tr.appendChild(subjectTD)\n const TDTree = myDocument.createElement('td')\n tr.appendChild(TDTree)\n const root = roots[i]\n if (root.termType === 'BlankNode') {\n subjectTD.appendChild(myDocument.createTextNode(UI.utils.label(root))) // Don't recurse!\n } else {\n subjectTD.appendChild(objectTree(root)) // won't have tree\n }\n TDTree.appendChild(propertyTree(root))\n }\n for (const bNT in referencedBnodes) {\n // Add number to refer to\n const table = doneBnodes[bNT]\n // let tr = myDocument.createElement('tr')\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('id', bNT.slice(2))\n anchor.setAttribute('class', 'bnodeDef')\n anchor.textContent = bNT.slice(3) + ')'\n table.insertBefore(anchor, table.firstChild)\n }\n return rep\n }, // statementsAsTables\n // View the data in a file in user-friendly way\n render: function (subject, context) {\n const myDocument = context.dom\n\n function alternativeRendering () {\n const sz = UI.rdf.Serializer(context.session.store)\n const res = sz.rootSubjects(sts)\n const roots = res.roots\n const p = {}\n p.render = function (s2) {\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'withinDocumentPane')\n const plist = kb.statementsMatching(s2, undefined, undefined, subject)\n outliner.appendPropertyTRs(div, plist, false, function (\n _pred,\n _inverse\n ) {\n return true\n })\n return div\n }\n for (let i = 0; i < roots.length; i++) {\n const tr = myDocument.createElement('TR')\n const root = roots[i]\n tr.style.verticalAlign = 'top'\n const td = outliner.outlineObjectTD(root, undefined, tr)\n tr.appendChild(td)\n div.appendChild(tr)\n outliner.outlineExpand(td, root, { pane: p })\n }\n }\n\n function mainRendering () {\n const initialRoots = [] // Ordering: start with stuff about this doc\n if (kb.holds(subject, undefined, undefined, subject)) {\n initialRoots.push(subject)\n }\n // Then about the primary topic of the document if any\n const ps = kb.any(subject, UI.ns.foaf('primaryTopic'), undefined, subject)\n if (ps) initialRoots.push(ps)\n div.appendChild(\n context.session.paneRegistry\n .byName('dataContents')\n .statementsAsTables(sts, context, initialRoots)\n )\n }\n\n const outliner = context.getOutliner(myDocument)\n const kb = context.session.store\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'dataContentPane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store!\n\n if (false) { // keep code\n alternativeRendering()\n } else {\n mainRendering()\n }\n return div\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CA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IAAMwE,EAAE,GAAGlF,OAAO,CAACC,OAAO,CAACC,KAAK;IAChC,IAAM8E,GAAG,GAAGtE,UAAU,CAACG,aAAa,CAAC,KAAK,CAAC;IAC3CmE,GAAG,CAACzC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAC5C;IACA;IACA;IACA,IAAM/B,GAAG,GAAG0E,EAAE,CAAC9E,kBAAkB,CAACC,SAAS,EAAEA,SAAS,EAAEA,SAAS,EAAEN,OAAO,CAAC,EAAC;;IAE5E,IAAI,KAAK,EAAE;MAAE;MACX8E,oBAAoB,CAAC,CAAC;IACxB,CAAC,MAAM;MACLe,aAAa,CAAC,CAAC;IACjB;IACA,OAAOZ,GAAG;EACZ;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"dataContentPane.js","names":["UI","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ns","dataContentPane","exports","icon","icons","originalIconBase","name","audience","solid","label","subject","context","session","store","findTypeURIs","statementsMatching","undefined","length","statementsAsTables","sts","initialRoots","myDocument","dom","rep","createElement","sz","rdf","Serializer","res","rootSubjects","roots","subjects","loopBreakers","x","console","log","doneBnodes","referencedBnodes","propertyTree","lastPred","toStr","appendChild","createTextNode","sort","same","predicateTD","st","tr","predicate","uri","setAttribute","anchor","addEventListener","widgets","openHrefInOutlineMode","utils","predicateLabelForXML","objectTD","objectTree","object","obj","termType","datatype","textContent","value","innerHTML","toNT","slice","newTable","ancestor","style","backgroundColor","elements","paneRegistry","byName","statements","Error","concat","filter","sameTerm","subjectTD","TDTree","root","bNT","table","insertBefore","firstChild","render","alternativeRendering","p","s2","div","plist","kb","outliner","appendPropertyTRs","_pred","_inverse","verticalAlign","td","outlineObjectTD","outlineExpand","pane","mainRendering","holds","push","ps","any","foaf","getOutliner"],"sources":["../src/dataContentPane.js"],"sourcesContent":["/* Data content Pane\n **\n ** This pane shows the content of a particular RDF resource\n ** or at least the RDF semantics we attribute to that resource.\n */\n\n// To do: - Only take data from one graph\n// - Only do forwards not backward?\n// - Expand automatically all the way down\n// - original source view? Use ffox view source\n\nimport * as UI from 'solid-ui'\nconst ns = UI.ns\n\nexport const dataContentPane = {\n icon: UI.icons.originalIconBase + 'rdf_flyer.24.gif',\n\n name: 'dataContents',\n\n audience: [ns.solid('Developer')],\n\n label: function (subject, context) {\n if (\n 'http://www.w3.org/2007/ont/link#ProtocolEvent' in\n context.session.store.findTypeURIs(subject)\n ) {\n return null\n }\n const n = context.session.store.statementsMatching(\n undefined,\n undefined,\n undefined,\n subject\n ).length\n if (n === 0) return null\n return 'Data (' + n + ')'\n },\n /*\n shouldGetFocus: function(subject) {\n return store.whether(subject, UI.ns.rdf('type'), UI.ns.link('RDFDocument'))\n },\n*/\n statementsAsTables: function statementsAsTables (sts, context, initialRoots) {\n const myDocument = context.dom\n // const outliner = context.getOutliner(myDocument)\n const rep = myDocument.createElement('table')\n const sz = UI.rdf.Serializer(context.session.store)\n const res = sz.rootSubjects(sts)\n let roots = res.roots\n const subjects = res.subjects\n const loopBreakers = res.loopBreakers\n for (const x in loopBreakers) {\n console.log('\\tdataContentPane: loopbreaker:' + x)\n }\n const doneBnodes = {} // For preventing looping\n const referencedBnodes = {} // Bnodes which need to be named alas\n\n // The property tree for a single subject or anonymous node\n function propertyTree (subject) {\n // print('Proprty tree for '+subject)\n const rep = myDocument.createElement('table')\n let lastPred = null\n const sts = subjects[sz.toStr(subject)] // relevant statements\n if (!sts) {\n // No statements in tree\n rep.appendChild(myDocument.createTextNode('...')) // just empty bnode as object\n return rep\n }\n sts.sort()\n let same = 0\n let predicateTD // The cell which holds the predicate\n for (let i = 0; i < sts.length; i++) {\n const st = sts[i]\n const tr = myDocument.createElement('tr')\n if (st.predicate.uri !== lastPred) {\n if (lastPred && same > 1) {\n predicateTD.setAttribute('rowspan', '' + same)\n }\n predicateTD = myDocument.createElement('td')\n predicateTD.setAttribute('class', 'pred')\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('href', st.predicate.uri)\n anchor.addEventListener(\n 'click',\n UI.widgets.openHrefInOutlineMode,\n true\n )\n anchor.appendChild(\n myDocument.createTextNode(\n UI.utils.predicateLabelForXML(st.predicate)\n )\n )\n predicateTD.appendChild(anchor)\n tr.appendChild(predicateTD)\n lastPred = st.predicate.uri\n same = 0\n }\n same++\n const objectTD = myDocument.createElement('td')\n objectTD.appendChild(objectTree(st.object))\n tr.appendChild(objectTD)\n rep.appendChild(tr)\n }\n if (lastPred && same > 1) predicateTD.setAttribute('rowspan', '' + same)\n return rep\n }\n\n // Convert a set of statements into a nested tree of tables\n function objectTree (obj) {\n let res, anchor\n switch (obj.termType) {\n case 'NamedNode':\n anchor = myDocument.createElement('a')\n anchor.setAttribute('href', obj.uri)\n anchor.addEventListener(\n 'click',\n UI.widgets.openHrefInOutlineMode,\n true\n )\n anchor.appendChild(myDocument.createTextNode(UI.utils.label(obj)))\n return anchor\n\n case 'Literal':\n if (!obj.datatype || !obj.datatype.uri) {\n res = myDocument.createElement('div')\n res.setAttribute('style', 'white-space: pre-wrap;')\n res.textContent = obj.value\n return res\n } else if (\n obj.datatype.uri ===\n 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral'\n ) {\n res = myDocument.createElement('div')\n res.setAttribute('class', 'embeddedXHTML')\n res.innerHTML = obj.value // Try that @@@ beware embedded dangerous code\n return res\n }\n return myDocument.createTextNode(obj.value) // placeholder - could be smarter,\n\n case 'BlankNode': {\n if (obj.toNT() in doneBnodes) {\n // Break infinite recursion\n referencedBnodes[obj.toNT()] = true\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('href', '#' + obj.toNT().slice(2))\n anchor.setAttribute('class', 'bnodeRef')\n anchor.textContent = '*' + obj.toNT().slice(3)\n return anchor\n }\n doneBnodes[obj.toNT()] = true // Flag to prevent infinite recursion in propertyTree\n const newTable = propertyTree(obj)\n doneBnodes[obj.toNT()] = newTable // Track where we mentioned it first\n if (\n UI.utils.ancestor(newTable, 'TABLE') &&\n UI.utils.ancestor(newTable, 'TABLE').style.backgroundColor ===\n 'white'\n ) {\n newTable.style.backgroundColor = '#eee'\n } else {\n newTable.style.backgroundColor = 'white'\n }\n return newTable\n }\n case 'Collection':\n res = myDocument.createElement('table')\n res.setAttribute('class', 'collectionAsTables')\n for (let i = 0; i < obj.elements.length; i++) {\n const tr = myDocument.createElement('tr')\n res.appendChild(tr)\n tr.appendChild(objectTree(obj.elements[i]))\n }\n return res\n case 'Graph':\n res = context.session.paneRegistry\n .byName('dataContents')\n .statementsAsTables(obj.statements, context)\n res.setAttribute('class', 'nestedFormula')\n return res\n case 'Variable':\n res = myDocument.createTextNode('?' + obj.uri)\n return res\n }\n throw new Error('Unhandled node type: ' + obj.termType)\n }\n\n // roots.sort()\n\n if (initialRoots) {\n roots = initialRoots.concat(\n roots.filter(function (x) {\n for (let i = 0; i < initialRoots.length; i++) {\n // Max 2\n if (x.sameTerm(initialRoots[i])) return false\n }\n return true\n })\n )\n }\n for (let i = 0; i < roots.length; i++) {\n const tr = myDocument.createElement('tr')\n tr.setAttribute('style', `background-color: ${i % 2 === 0 ? '#f0f0f0' : 'white'};`)\n rep.appendChild(tr)\n const subjectTD = myDocument.createElement('td')\n tr.appendChild(subjectTD)\n const TDTree = myDocument.createElement('td')\n tr.appendChild(TDTree)\n const root = roots[i]\n if (root.termType === 'BlankNode') {\n subjectTD.appendChild(myDocument.createTextNode(UI.utils.label(root))) // Don't recurse!\n } else {\n subjectTD.appendChild(objectTree(root)) // won't have tree\n }\n TDTree.appendChild(propertyTree(root))\n }\n for (const bNT in referencedBnodes) {\n // Add number to refer to\n const table = doneBnodes[bNT]\n // let tr = myDocument.createElement('tr')\n const anchor = myDocument.createElement('a')\n anchor.setAttribute('id', bNT.slice(2))\n anchor.setAttribute('class', 'bnodeDef')\n anchor.textContent = bNT.slice(3) + ')'\n table.insertBefore(anchor, table.firstChild)\n }\n return rep\n }, // statementsAsTables\n // View the data in a file in user-friendly way\n render: function (subject, context) {\n const myDocument = context.dom\n\n function alternativeRendering () {\n const sz = UI.rdf.Serializer(context.session.store)\n const res = sz.rootSubjects(sts)\n const roots = res.roots\n const p = {}\n p.render = function (s2) {\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'withinDocumentPane')\n const plist = kb.statementsMatching(s2, undefined, undefined, subject)\n outliner.appendPropertyTRs(div, plist, false, function (\n _pred,\n _inverse\n ) {\n return true\n })\n return div\n }\n for (let i = 0; i < roots.length; i++) {\n const tr = myDocument.createElement('TR')\n const root = roots[i]\n tr.style.verticalAlign = 'top'\n const td = outliner.outlineObjectTD(root, undefined, tr)\n tr.appendChild(td)\n div.appendChild(tr)\n outliner.outlineExpand(td, root, { pane: p })\n }\n }\n\n function mainRendering () {\n const initialRoots = [] // Ordering: start with stuff about this doc\n if (kb.holds(subject, undefined, undefined, subject)) {\n initialRoots.push(subject)\n }\n // Then about the primary topic of the document if any\n const ps = kb.any(subject, UI.ns.foaf('primaryTopic'), undefined, subject)\n if (ps) initialRoots.push(ps)\n div.appendChild(\n context.session.paneRegistry\n .byName('dataContents')\n .statementsAsTables(sts, context, initialRoots)\n )\n }\n\n const outliner = context.getOutliner(myDocument)\n const kb = context.session.store\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'dataContentPane')\n // Because of smushing etc, this will not be a copy of the original source\n // We could instead either fetch and re-parse the source,\n // or we could keep all the pre-smushed triples.\n const sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store!\n\n if (false) { // keep code\n alternativeRendering()\n } else {\n mainRendering()\n }\n return div\n }\n}\n"],"mappings":";;;;;;;AAWA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA8B,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,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c,GAAG,CAACjG,OAAO,EAAEjC,EAAE,CAACuB,EAAE,CAAC4G,IAAI,CAAC,cAAc,CAAC,EAAE5F,SAAS,EAAEN,OAAO,CAAC;MAC1E,IAAIgG,EAAE,EAAEtF,YAAY,CAACqF,IAAI,CAACC,EAAE,CAAC;MAC7Bf,GAAG,CAAClD,WAAW,CACb9B,OAAO,CAACC,OAAO,CAAC6D,YAAY,CACzBC,MAAM,CAAC,cAAc,CAAC,CACtBxD,kBAAkB,CAACC,GAAG,EAAER,OAAO,EAAES,YAAY,CAClD,CAAC;IACH;IAEA,IAAM0E,QAAQ,GAAGnF,OAAO,CAACkG,WAAW,CAACxF,UAAU,CAAC;IAChD,IAAMwE,EAAE,GAAGlF,OAAO,CAACC,OAAO,CAACC,KAAK;IAChC,IAAM8E,GAAG,GAAGtE,UAAU,CAACG,aAAa,CAAC,KAAK,CAAC;IAC3CmE,GAAG,CAACzC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC;IAC5C;IACA;IACA;IACA,IAAM/B,GAAG,GAAG0E,EAAE,CAAC9E,kBAAkB,CAACC,SAAS,EAAEA,SAAS,EAAEA,SAAS,EAAEN,OAAO,CAAC,EAAC;;IAE5E,IAAI,KAAK,EAAE;MAAE;MACX8E,oBAAoB,CAAC,CAAC;IACxB,CAAC,MAAM;MACLe,aAAa,CAAC,CAAC;IACjB;IACA,OAAOZ,GAAG;EACZ;AACF,CAAC","ignoreList":[]}
@@ -88,14 +88,15 @@ var _default = exports["default"] = {
88
88
  }
89
89
  newPaneOptions.newInstance = newInstance; // Save for creation system
90
90
 
91
- console.log('New dokieli will make: ' + newInstance);
91
+ // console.log('New dokieli will make: ' + newInstance)
92
+
92
93
  var htmlContents = _new["default"];
93
94
  var filename = newInstance.uri.split('/').slice(-1)[0];
94
95
  filename = decodeURIComponent(filename.split('.')[0]);
95
96
  var encodedTitle = filename.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
96
97
  htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle);
97
98
  htmlContents = htmlContents.replace('</article>', '<h1>' + encodedTitle + '</h1></article>');
98
- console.log('@@ New HTML for Dok:' + htmlContents);
99
+ // console.log('@@ New HTML for Dok:' + htmlContents)
99
100
  return new Promise(function (resolve) {
100
101
  kb.fetcher.webOperation('PUT', newInstance.uri, {
101
102
  data: htmlContents,
@@ -104,7 +105,7 @@ var _default = exports["default"] = {
104
105
  console.log('new Dokieli document created at ' + newPaneOptions.newInstance);
105
106
  resolve(newPaneOptions);
106
107
  })["catch"](function (err) {
107
- console.log('Error creating dokelili dok at ' + newPaneOptions.newInstance + ': ' + err);
108
+ console.log('Error creating dokieli doc at ' + newPaneOptions.newInstance + ': ' + err);
108
109
  });
109
110
  });
110
111
  },
@@ -117,8 +118,23 @@ var _default = exports["default"] = {
117
118
  // @@ When we can, use CSP to turn off scripts within the iframe
118
119
  div.setAttribute('class', 'docView');
119
120
  var iframe = myDocument.createElement('IFRAME');
120
- iframe.setAttribute('src', subject.uri); // allow-same-origin
121
- iframe.setAttribute('class', 'doc');
121
+
122
+ // get with authenticated fetch
123
+ kb.fetcher._fetch(subject.uri).then(function (response) {
124
+ return response.blob();
125
+ }).then(function (blob) {
126
+ var objectURL = URL.createObjectURL(blob);
127
+ iframe.setAttribute('src', objectURL); // w640 h480 //
128
+ iframe.setAttribute('type', blob.type);
129
+ iframe.setAttribute('class', 'doc');
130
+ return blob.text();
131
+ }).then(function (blobText) {
132
+ var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
133
+ var lines = Math.min(30, blobText.split(/\n/).length + newLines);
134
+ iframe.setAttribute('style', "border: 1px solid; padding: 1em; height:".concat(lines, "em; width:800px; resize: both; overflow: auto;"));
135
+ })["catch"](function (err) {
136
+ console.log(err);
137
+ });
122
138
  var cts = kb.fetcher.getHeader(subject.doc(), 'content-type');
123
139
  var ct = cts ? cts[0] : null;
124
140
  if (ct) {
@@ -135,9 +151,6 @@ var _default = exports["default"] = {
135
151
 
136
152
  // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
137
153
 
138
- iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;'); // @@ improve guess
139
- // iframe.setAttribute('height', '480')
140
- // iframe.setAttribute('width', '640')
141
154
  var tr = myDocument.createElement('tr');
142
155
  tr.appendChild(iframe);
143
156
  div.appendChild(tr);
@@ -1 +1 @@
1
- {"version":3,"file":"dokieliPane.js","names":["UI","_interopRequireWildcard","require","$rdf","mime","_new","_interopRequireDefault","e","__esModule","_getRequireWildcardCache","WeakMap","r","t","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_default","exports","icon","icons","iconBase","name","mintClass","ns","solid","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","findTypeURIs","Util","mediaTypeClass","uri","link","mintNew","newPaneOptions","newInstance","newBase","endsWith","slice","sym","contentType","lookup","includes","console","log","htmlContents","DOKIELI_TEMPLATE","filename","split","decodeURIComponent","encodedTitle","replace","Promise","resolve","webOperation","data","then","err","render","myDocument","dom","div","createElement","setAttribute","iframe","doc","ct","tr","appendChild"],"sources":["../../src/dokieli/dokieliPane.js"],"sourcesContent":["/* Human-readable editable \"Dokieli\" Pane\n **\n ** This outline pane contains the document contents for a Dokieli document\n ** The dokeili system allows the user to edit a document including anotations\n ** review. It does not use turtle, but RDF/a\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport * as mime from 'mime-types'\n\n// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok\n\nimport DOKIELI_TEMPLATE from './new.js' // Distributed with this library\n\nexport default {\n icon: UI.icons.iconBase + 'dokieli-logo.png', // @@ improve? more like doccument?\n\n name: 'Dokieli',\n\n mintClass: UI.ns.solid('DokieliDocument'), // @@ A better class?\n\n label: function (subject, context) {\n const kb = context.session.store\n const ns = UI.ns\n const allowed = [\n // 'text/plain',\n 'text/html',\n 'application/xhtml+xml'\n // 'image/png', 'image/jpeg', 'application/pdf',\n // 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data coul d come from a fetch OR from ldp comtaimner\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'Dok'\n }\n\n return null\n },\n\n // Create a new folder in a Solid system, with a dokieli editable document in it\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n let newInstance = newPaneOptions.newInstance\n if (!newInstance) {\n let uri = newPaneOptions.newBase\n if (uri.endsWith('/')) {\n uri = uri.slice(0, -1)\n newPaneOptions.newBase = uri\n }\n newInstance = kb.sym(uri)\n }\n\n const contentType = mime.lookup(newInstance.uri)\n if (!contentType || !contentType.includes('html')) {\n newInstance = $rdf.sym(newInstance.uri + '.html')\n }\n newPaneOptions.newInstance = newInstance // Save for creation system\n\n console.log('New dokieli will make: ' + newInstance)\n\n let htmlContents = DOKIELI_TEMPLATE\n let filename = newInstance.uri.split('/').slice(-1)[0]\n filename = decodeURIComponent(filename.split('.')[0])\n const encodedTitle = filename\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle)\n htmlContents = htmlContents.replace(\n '</article>',\n '<h1>' + encodedTitle + '</h1></article>'\n )\n console.log('@@ New HTML for Dok:' + htmlContents)\n return new Promise(function (resolve) {\n kb.fetcher\n .webOperation('PUT', newInstance.uri, {\n data: htmlContents,\n contentType: 'text/html'\n })\n .then(function () {\n console.log(\n 'new Dokieli document created at ' + newPaneOptions.newInstance\n )\n resolve(newPaneOptions)\n })\n .catch(function (err) {\n console.log(\n 'Error creating dokelili dok at ' +\n newPaneOptions.newInstance +\n ': ' +\n err\n )\n })\n })\n },\n\n // Derived from: humanReadablePane .. share code?\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const iframe = myDocument.createElement('IFRAME')\n iframe.setAttribute('src', subject.uri) // allow-same-origin\n iframe.setAttribute('class', 'doc')\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('dokieliPane: c-t:' + ct)\n } else {\n console.log('dokieliPane: unknown content-type?')\n }\n\n // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can;'t have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;') // @@ improve guess\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\n const tr = myDocument.createElement('tr')\n tr.appendChild(iframe)\n div.appendChild(tr)\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;;AAOA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;A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AAC,EAAC;IACzE;IACA;IACA,IAAMI,EAAE,GAAGR,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzCK,EAAE,CAACC,WAAW,CAACJ,MAAM,CAAC;IACtBH,GAAG,CAACO,WAAW,CAACD,EAAE,CAAC;IACnB,OAAON,GAAG;EACZ;AACF,CAAC,EACD","ignoreList":[]}
1
+ {"version":3,"file":"dokieliPane.js","names":["UI","_interopRequireWildcard","require","$rdf","mime","_new","_interopRequireDefault","e","__esModule","_getRequireWildcardCache","WeakMap","r","t","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_default","exports","icon","icons","iconBase","name","mintClass","ns","solid","label","subject","context","kb","session","store","allowed","hasContentTypeIn","x","displayables","cts","fetcher","getHeader","j","length","k","indexOf","hasContentTypeIn2","findTypeURIs","Util","mediaTypeClass","uri","link","mintNew","newPaneOptions","newInstance","newBase","endsWith","slice","sym","contentType","lookup","includes","htmlContents","DOKIELI_TEMPLATE","filename","split","decodeURIComponent","encodedTitle","replace","Promise","resolve","webOperation","data","then","console","log","err","render","myDocument","dom","div","createElement","setAttribute","iframe","_fetch","response","blob","objectURL","URL","createObjectURL","type","text","blobText","newLines","lines","Math","min","concat","doc","ct","tr","appendChild"],"sources":["../../src/dokieli/dokieliPane.js"],"sourcesContent":["/* Human-readable editable \"Dokieli\" Pane\n **\n ** This outline pane contains the document contents for a Dokieli document\n ** The dokeili system allows the user to edit a document including anotations\n ** review. It does not use turtle, but RDF/a\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nimport * as mime from 'mime-types'\n\n// const DOKIELI_TEMPLATE_URI = 'https://dokie.li/new' // Copy to make new dok\n\nimport DOKIELI_TEMPLATE from './new.js' // Distributed with this library\n\nexport default {\n icon: UI.icons.iconBase + 'dokieli-logo.png', // @@ improve? more like doccument?\n\n name: 'Dokieli',\n\n mintClass: UI.ns.solid('DokieliDocument'), // @@ A better class?\n\n label: function (subject, context) {\n const kb = context.session.store\n const ns = UI.ns\n const allowed = [\n // 'text/plain',\n 'text/html',\n 'application/xhtml+xml'\n // 'image/png', 'image/jpeg', 'application/pdf',\n // 'video/mp4'\n ]\n\n const hasContentTypeIn = function (kb, x, displayables) {\n const cts = kb.fetcher.getHeader(x, 'content-type')\n if (cts) {\n for (let j = 0; j < cts.length; j++) {\n for (let k = 0; k < displayables.length; k++) {\n if (cts[j].indexOf(displayables[k]) >= 0) {\n return true\n }\n }\n }\n }\n return false\n }\n\n // This data coul d come from a fetch OR from ldp comtaimner\n const hasContentTypeIn2 = function (kb, x, displayables) {\n const t = kb.findTypeURIs(subject)\n for (let k = 0; k < displayables.length; k++) {\n if ($rdf.Util.mediaTypeClass(displayables[k]).uri in t) {\n return true\n }\n }\n return false\n }\n\n if (!subject.uri) return null // no bnodes\n\n const t = kb.findTypeURIs(subject)\n if (t[ns.link('WebPage').uri]) return 'view'\n\n if (\n hasContentTypeIn(kb, subject, allowed) ||\n hasContentTypeIn2(kb, subject, allowed)\n ) {\n return 'Dok'\n }\n\n return null\n },\n\n // Create a new folder in a Solid system, with a dokieli editable document in it\n mintNew: function (context, newPaneOptions) {\n const kb = context.session.store\n let newInstance = newPaneOptions.newInstance\n if (!newInstance) {\n let uri = newPaneOptions.newBase\n if (uri.endsWith('/')) {\n uri = uri.slice(0, -1)\n newPaneOptions.newBase = uri\n }\n newInstance = kb.sym(uri)\n }\n\n const contentType = mime.lookup(newInstance.uri)\n if (!contentType || !contentType.includes('html')) {\n newInstance = $rdf.sym(newInstance.uri + '.html')\n }\n newPaneOptions.newInstance = newInstance // Save for creation system\n\n // console.log('New dokieli will make: ' + newInstance)\n\n let htmlContents = DOKIELI_TEMPLATE\n let filename = newInstance.uri.split('/').slice(-1)[0]\n filename = decodeURIComponent(filename.split('.')[0])\n const encodedTitle = filename\n .replace(/&/g, '&amp;')\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n htmlContents = htmlContents.replace('<title>', '<title>' + encodedTitle)\n htmlContents = htmlContents.replace(\n '</article>',\n '<h1>' + encodedTitle + '</h1></article>'\n )\n // console.log('@@ New HTML for Dok:' + htmlContents)\n return new Promise(function (resolve) {\n kb.fetcher\n .webOperation('PUT', newInstance.uri, {\n data: htmlContents,\n contentType: 'text/html'\n })\n .then(function () {\n console.log(\n 'new Dokieli document created at ' + newPaneOptions.newInstance\n )\n resolve(newPaneOptions)\n })\n .catch(function (err) {\n console.log(\n 'Error creating dokieli doc at ' +\n newPaneOptions.newInstance +\n ': ' +\n err\n )\n })\n })\n },\n\n // Derived from: humanReadablePane .. share code?\n render: function (subject, context) {\n const myDocument = context.dom\n const div = myDocument.createElement('div')\n const kb = context.session.store\n\n // @@ When we can, use CSP to turn off scripts within the iframe\n div.setAttribute('class', 'docView')\n const iframe = myDocument.createElement('IFRAME')\n\n // get with authenticated fetch\n kb.fetcher._fetch(subject.uri)\n .then(function(response) {\n return response.blob()\n })\n .then(function(blob) {\n const objectURL = URL.createObjectURL(blob)\n iframe.setAttribute('src', objectURL) // w640 h480 //\n iframe.setAttribute('type', blob.type)\n iframe.setAttribute('class', 'doc')\n return blob.text()\n })\n .then(function(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 iframe.setAttribute('style', `border: 1px solid; padding: 1em; height:${lines}em; width:800px; resize: both; overflow: auto;`)\n })\n .catch(err => { console.log(err) })\n\n const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')\n const ct = cts ? cts[0] : null\n if (ct) {\n console.log('dokieliPane: c-t:' + ct)\n } else {\n console.log('dokieliPane: unknown content-type?')\n }\n\n // @@ NOte beflow - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.\n // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe\n // You can;'t have any sandbox and allow plugins.\n // We could sandbox only HTML files I suppose.\n // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n const tr = myDocument.createElement('tr')\n tr.appendChild(iframe)\n div.appendChild(tr)\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;;AAOA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AACA,IAAAE,IAAA,GAAAH,uBAAA,CAAAC,OAAA;AAIA,IAAAG,IAAA,GAAAC,sBAAA,CAAAJ,OAAA;AAAuC,SAAAI,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,yBAAAF,CAAA,6BAAAG,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,yBAAAF,CAAA,WAAAA,CAAA,GAAAK,CAAA,GAAAD,CAAA,KAAAJ,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAI,CAAA,SAAAA,CAAA,IAAAJ,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,gBAAAM,OAAA,CAAAN,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAK,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAE,GAAA,CAAAP,CAAA,UAAAK,CAAA,CAAAG,GAAA,CAAAR,CAAA,OAAAS,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAf,CAAA,oBAAAe,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAe,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAd,CAAA,EAAAe,CAAA,UAAAG,CAAA,K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
5
5
  });
6
6
  exports["default"] = void 0;
7
- var DOKIELI_TEMPLATE = "\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>";
7
+ module.exports = "\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>";
8
8
  var _default = exports["default"] = DOKIELI_TEMPLATE;
9
9
  //# sourceMappingURL=new.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"new.js","names":["DOKIELI_TEMPLATE","_default","exports"],"sources":["../../src/dokieli/new.js"],"sourcesContent":["const DOKIELI_TEMPLATE = `\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>`\n\nexport default DOKIELI_TEMPLATE\n"],"mappings":";;;;;;AAAA,IAAMA,gBAAgB,ylEAmBd;AAAA,IAAAC,QAAA,GAAAC,OAAA,cAEOF,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"new.js","names":["module","exports","_default","DOKIELI_TEMPLATE"],"sources":["../../src/dokieli/new.js"],"sourcesContent":["module.exports = `\n<!DOCTYPE html>\n<html lang=\"en\" xml:lang=\"en\" xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <meta charset=\"utf-8\" />\n <title></title>\n <meta content=\"width=device-width, initial-scale=1\" name=\"viewport\" />\n <link href=\"https://dokie.li/media/css/basic.css\" media=\"all\" rel=\"stylesheet\" title=\"Basic\" />\n <link href=\"https://dokie.li/media/css/dokieli.css\" media=\"all\" rel=\"stylesheet\" />\n <script src=\"https://dokie.li/scripts/dokieli.js\"></script>\n </head>\n\n <body about=\"\" prefix=\"rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#\" typeof=\"schema:CreativeWork prov:Entity\">\n <main>\n <article about=\"\" typeof=\"schema:Article\">\n\n </article>\n </main>\n </body>\n</html>`\n\nexport default DOKIELI_TEMPLATE\n"],"mappings":";;;;;;AAAAA,MAAM,CAACC,OAAO,ylEAmBN;AAAA,IAAAC,QAAA,GAAAD,OAAA,cAEOE,gBAAgB","ignoreList":[]}
@@ -88,21 +88,23 @@ var humanReadablePane = {
88
88
  };
89
89
  if (ct === 'text/markdown') {
90
90
  markdownHtml();
91
- } else if (ct !== 'text/html') {
91
+ } else {
92
92
  // get with authenticated fetch
93
93
  kb.fetcher._fetch(subject.uri).then(function (response) {
94
94
  return response.blob();
95
95
  }).then(function (blob) {
96
96
  var objectURL = URL.createObjectURL(blob);
97
- frame.setAttribute('src', objectURL); // w640 h480 //
97
+ frame.setAttribute('src', objectURL);
98
+ frame.setAttribute('type', blob.type);
98
99
  frame.setAttribute('class', 'doc');
99
- frame.setAttribute('style', "border: 1px solid; padding: 1em; height:120em; width:80em; resize: both; overflow: auto;");
100
+ return blob.type.startsWith('text') ? blob.text() : '';
101
+ }).then(function (blobText) {
102
+ var newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5;
103
+ var lines = Math.min(30, blobText.split(/\n/).length + newLines);
104
+ frame.setAttribute('style', "border: 1px solid; padding: 1em; height:".concat(lines, "em; width:800px; resize: both; overflow: auto;"));
100
105
  });
101
- } else {
102
- frame.setAttribute('src', subject.uri); // allow-same-origin
103
- frame.setAttribute('class', 'doc');
104
- frame.setAttribute('style', 'resize = both; height:120em; width:80em;');
105
106
  }
107
+
106
108
  // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
107
109
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
108
110
  // You can't have any sandbox and allow plugins.
@@ -111,8 +113,6 @@ var humanReadablePane = {
111
113
 
112
114
  // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
113
115
 
114
- // iframe.setAttribute('height', '480')
115
- // iframe.setAttribute('width', '640')
116
116
  var tr = myDocument.createElement('TR');
117
117
  tr.appendChild(frame);
118
118
  div.appendChild(tr);
@@ -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","console","log","setAttribute","element","frame","markdownHtml","webOperation","then","response","markdownText","responseText","lines","Math","min","split","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","concat","_fetch","blob","objectURL","URL","createObjectURL","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] : null\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 // 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 })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else if (ct !== 'text/html') {\n // get with authenticated fetch\n kb.fetcher._fetch(subject.uri)\n .then(function(response) {\n return response.blob()\n })\n .then(function(blob) {\n const objectURL = URL.createObjectURL(blob)\n frame.setAttribute('src', objectURL) // w640 h480 //\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', `border: 1px solid; padding: 1em; height:120em; width:80em; resize: both; overflow: auto;`)\n })\n } else {\n frame.setAttribute('src', subject.uri) // allow-same-origin\n frame.setAttribute('class', 'doc')\n frame.setAttribute('style', 'resize = both; height:120em; width:80em;')\n }\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 // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n // iframe.setAttribute('height', '480')\n // iframe.setAttribute('width', '640')\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,OAAO,GAAG,CACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,WAAW,CACZ;IAED,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAaJ,EAAE,EAAEK,CAAC,EAAEC,YAAY,EAAE;MACtD,IAAMC,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,MAAM,EAAEC,CAAC,EAAE,EAAE;YAC5C,IAAIL,GAAG,CAACG,CAAC,CAAC,CAACG,OAAO,CAACP,YAAY,CAACM,CAAC,CAAC,CAAC,IAAI,CAAC,EAA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,OAAO,CAAC4C,MAAM,CAACtD,OAAO,CAACqB,GAAG,CAAC,CAC3BiB,IAAI,CAAC,UAASC,QAAQ,EAAE;QACvB,OAAOA,QAAQ,CAACgB,IAAI,CAAC,CAAC;MACxB,CAAC,CAAC,CACDjB,IAAI,CAAC,UAASiB,IAAI,EAAE;QACnB,IAAMC,SAAS,GAAGC,GAAG,CAACC,eAAe,CAACH,IAAI,CAAC;QAC3CpB,KAAK,CAACF,YAAY,CAAC,KAAK,EAAEuB,SAAS,CAAC,EAAC;QACrCrB,KAAK,CAACF,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;QAClCE,KAAK,CAACF,YAAY,CAAC,OAAO,4FAA4F,CAAC;MACzH,CAAC,CAAC;IACN,CAAC,MAAM;MACLE,KAAK,CAACF,YAAY,CAAC,KAAK,EAAEjC,OAAO,CAACqB,GAAG,CAAC,EAAC;MACvCc,KAAK,CAACF,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;MAClCE,KAAK,CAACF,YAAY,CAAC,OAAO,EAAE,0CAA0C,CAAC;IACzE;IACA;IACA;IACA;IACA;IACA;;IAEA;;IAEA;IACA;IACA,IAAM0B,EAAE,GAAGlC,UAAU,CAACG,aAAa,CAAC,IAAI,CAAC;IACzC+B,EAAE,CAACC,WAAW,CAACzB,KAAK,CAAC;IACrBR,GAAG,CAACiC,WAAW,CAACD,EAAE,CAAC;IACnB,OAAOhC,GAAG;EACZ;AACF,CAAC;AAAA,IAAAkC,QAAA,GAAAC,OAAA,cAEcpE,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","console","log","setAttribute","element","frame","markdownHtml","webOperation","then","response","markdownText","responseText","lines","Math","min","split","res","marked","parse","clean","DOMPurify","sanitize","innerHTML","concat","_fetch","blob","objectURL","URL","createObjectURL","type","startsWith","text","blobText","newLines","includes","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] : null\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 // 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 })\n }\n\n if (ct === 'text/markdown') {\n markdownHtml()\n } else {\n // get with authenticated fetch\n kb.fetcher._fetch(subject.uri)\n .then(function(response) {\n return response.blob()\n })\n .then(function(blob) {\n const objectURL = URL.createObjectURL(blob)\n frame.setAttribute('src', objectURL)\n frame.setAttribute('type', blob.type)\n frame.setAttribute('class', 'doc')\n return blob.type.startsWith('text') ? blob.text() : ''\n })\n .then(function(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:800px; resize: both; overflow: auto;`)\n })\n }\n\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 // HTML5 bug: https://lists.w3.org/Archives/Public/public-html/2011Jun/0330.html\n\n // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static\n\n const tr = myDocument.createElement('TR')\n tr.appendChild(frame)\n div.appendChild(tr)\n return div\n }\n}\n\nexport default humanReadablePane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7
7
  var _default = exports["default"] = {
8
- buildTime: "2025-01-15T10:17:07Z",
9
- commit: "e1d9d5d189f016dde0e1675e0ab2feac8e39ebc4",
8
+ buildTime: "2025-02-02T17:17:41Z",
9
+ commit: "f584fd85e218c730b022ccd30dc21e7d4dc1e0ee",
10
10
  npmInfo: {
11
11
  'solid-panes': '3.6.1',
12
12
  npm: '8.19.4',
@@ -1 +1 @@
1
- {"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-01-15T10:17:07Z\",\ncommit: \"e1d9d5d189f016dde0e1675e0ab2feac8e39ebc4\",\nnpmInfo:\n{\n 'solid-panes': '3.6.1',\n npm: '8.19.4',\n node: '16.20.2',\n v8: '9.4.146.26-node.26',\n uv: '1.43.0',\n zlib: '1.2.11',\n brotli: '1.0.9',\n ares: '1.19.1',\n modules: '93',\n nghttp2: '1.47.0',\n napi: '8',\n llhttp: '6.0.11',\n openssl: '1.1.1v+quic',\n cldr: '41.0',\n icu: '71.1',\n tz: '2022f',\n unicode: '14.0',\n ngtcp2: '0.8.1',\n nghttp3: '0.7.0'\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,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,IAAI;IACbC,OAAO,EAAE,QAAQ;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,aAAa;IACtBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,EAAE,EAAE,OAAO;IACXC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE;EACX;AACA,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"versionInfo.js","names":["buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export default {\nbuildTime: \"2025-02-02T17:17:41Z\",\ncommit: \"f584fd85e218c730b022ccd30dc21e7d4dc1e0ee\",\nnpmInfo:\n{\n 'solid-panes': '3.6.1',\n npm: '8.19.4',\n node: '16.20.2',\n v8: '9.4.146.26-node.26',\n uv: '1.43.0',\n zlib: '1.2.11',\n brotli: '1.0.9',\n ares: '1.19.1',\n modules: '93',\n nghttp2: '1.47.0',\n napi: '8',\n llhttp: '6.0.11',\n openssl: '1.1.1v+quic',\n cldr: '41.0',\n icu: '71.1',\n tz: '2022f',\n unicode: '14.0',\n ngtcp2: '0.8.1',\n nghttp3: '0.7.0'\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,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,IAAI;IACbC,OAAO,EAAE,QAAQ;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,aAAa;IACtBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,EAAE,EAAE,OAAO;IACXC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE;EACX;AACA,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-panes",
3
- "version": "3.6.1-e1d9d5d1",
3
+ "version": "3.6.1-f584fd85",
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",
@@ -153,7 +153,7 @@ export const dataContentPane = {
153
153
  if (
154
154
  UI.utils.ancestor(newTable, 'TABLE') &&
155
155
  UI.utils.ancestor(newTable, 'TABLE').style.backgroundColor ===
156
- 'white'
156
+ 'white'
157
157
  ) {
158
158
  newTable.style.backgroundColor = '#eee'
159
159
  } else {
@@ -198,6 +198,7 @@ export const dataContentPane = {
198
198
  }
199
199
  for (let i = 0; i < roots.length; i++) {
200
200
  const tr = myDocument.createElement('tr')
201
+ tr.setAttribute('style', `background-color: ${i % 2 === 0 ? '#f0f0f0' : 'white'};`)
201
202
  rep.appendChild(tr)
202
203
  const subjectTD = myDocument.createElement('td')
203
204
  tr.appendChild(subjectTD)
@@ -90,7 +90,7 @@ export default {
90
90
  }
91
91
  newPaneOptions.newInstance = newInstance // Save for creation system
92
92
 
93
- console.log('New dokieli will make: ' + newInstance)
93
+ // console.log('New dokieli will make: ' + newInstance)
94
94
 
95
95
  let htmlContents = DOKIELI_TEMPLATE
96
96
  let filename = newInstance.uri.split('/').slice(-1)[0]
@@ -104,7 +104,7 @@ export default {
104
104
  '</article>',
105
105
  '<h1>' + encodedTitle + '</h1></article>'
106
106
  )
107
- console.log('@@ New HTML for Dok:' + htmlContents)
107
+ // console.log('@@ New HTML for Dok:' + htmlContents)
108
108
  return new Promise(function (resolve) {
109
109
  kb.fetcher
110
110
  .webOperation('PUT', newInstance.uri, {
@@ -119,7 +119,7 @@ export default {
119
119
  })
120
120
  .catch(function (err) {
121
121
  console.log(
122
- 'Error creating dokelili dok at ' +
122
+ 'Error creating dokieli doc at ' +
123
123
  newPaneOptions.newInstance +
124
124
  ': ' +
125
125
  err
@@ -137,8 +137,25 @@ export default {
137
137
  // @@ When we can, use CSP to turn off scripts within the iframe
138
138
  div.setAttribute('class', 'docView')
139
139
  const iframe = myDocument.createElement('IFRAME')
140
- iframe.setAttribute('src', subject.uri) // allow-same-origin
141
- iframe.setAttribute('class', 'doc')
140
+
141
+ // get with authenticated fetch
142
+ kb.fetcher._fetch(subject.uri)
143
+ .then(function(response) {
144
+ return response.blob()
145
+ })
146
+ .then(function(blob) {
147
+ const objectURL = URL.createObjectURL(blob)
148
+ iframe.setAttribute('src', objectURL) // w640 h480 //
149
+ iframe.setAttribute('type', blob.type)
150
+ iframe.setAttribute('class', 'doc')
151
+ return blob.text()
152
+ })
153
+ .then(function(blobText) {
154
+ const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5
155
+ const lines = Math.min(30, blobText.split(/\n/).length + newLines)
156
+ iframe.setAttribute('style', `border: 1px solid; padding: 1em; height:${lines}em; width:800px; resize: both; overflow: auto;`)
157
+ })
158
+ .catch(err => { console.log(err) })
142
159
 
143
160
  const cts = kb.fetcher.getHeader(subject.doc(), 'content-type')
144
161
  const ct = cts ? cts[0] : null
@@ -156,10 +173,7 @@ export default {
156
173
 
157
174
  // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
158
175
 
159
- iframe.setAttribute('style', 'resize = both; height: 40em; width:40em;') // @@ improve guess
160
- // iframe.setAttribute('height', '480')
161
- // iframe.setAttribute('width', '640')
162
- const tr = myDocument.createElement('tr')
176
+ const tr = myDocument.createElement('tr')
163
177
  tr.appendChild(iframe)
164
178
  div.appendChild(tr)
165
179
  return div
@@ -4,27 +4,16 @@
4
4
  <meta charset="utf-8" />
5
5
  <title></title>
6
6
  <meta content="width=device-width, initial-scale=1" name="viewport" />
7
- <link
8
- href="https://dokie.li/media/css/basic.css"
9
- media="all"
10
- rel="stylesheet"
11
- title="Basic"
12
- />
13
- <link
14
- href="https://dokie.li/media/css/dokieli.css"
15
- media="all"
16
- rel="stylesheet"
17
- />
7
+ <link href="https://dokie.li/media/css/basic.css" media="all" rel="stylesheet" title="Basic" />
8
+ <link href="https://dokie.li/media/css/dokieli.css" media="all" rel="stylesheet" />
18
9
  <script src="https://dokie.li/scripts/dokieli.js"></script>
19
10
  </head>
20
11
 
21
- <body
22
- about=""
23
- prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# cc: https://creativecommons.org/ns# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#"
24
- typeof="schema:CreativeWork sioc:Post prov:Entity"
25
- >
12
+ <body about="" prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# rdfa: http://www.w3.org/ns/rdfa# dcterms: http://purl.org/dc/terms/ dctypes: http://purl.org/dc/dcmitype/ foaf: http://xmlns.com/foaf/0.1/ pimspace: http://www.w3.org/ns/pim/space# skos: http://www.w3.org/2004/02/skos/core# prov: http://www.w3.org/ns/prov# mem: http://mementoweb.org/ns# qb: http://purl.org/linked-data/cube# schema: http://schema.org/ void: http://rdfs.org/ns/void# rsa: http://www.w3.org/ns/auth/rsa# cert: http://www.w3.org/ns/auth/cert# wgs: http://www.w3.org/2003/01/geo/wgs84_pos# bibo: http://purl.org/ontology/bibo/ sioc: http://rdfs.org/sioc/ns# doap: http://usefulinc.com/ns/doap# dbr: http://dbpedia.org/resource/ dbp: http://dbpedia.org/property/ sio: http://semanticscience.org/resource/ opmw: http://www.opmw.org/ontology/ deo: http://purl.org/spar/deo/ doco: http://purl.org/spar/doco/ cito: http://purl.org/spar/cito/ fabio: http://purl.org/spar/fabio/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# ldp: http://www.w3.org/ns/ldp# solid: http://www.w3.org/ns/solid/terms# acl: http://www.w3.org/ns/auth/acl# earl: http://www.w3.org/ns/earl# spec: http://www.w3.org/ns/spec# odrl: http://www.w3.org/ns/odrl/2/ dio: https://w3id.org/dio# rel: https://www.w3.org/ns/iana/link-relations/relation#" typeof="schema:CreativeWork prov:Entity">
26
13
  <main>
27
- <article about="" typeof="schema:Article"></article>
14
+ <article about="" typeof="schema:Article">
15
+
16
+ </article>
28
17
  </main>
29
18
  </body>
30
19
  </html>
@@ -1,4 +1,4 @@
1
- const DOKIELI_TEMPLATE = `
1
+ module.exports = `
2
2
  <!DOCTYPE html>
3
3
  <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
4
4
  <head>
@@ -102,7 +102,7 @@ const humanReadablePane = {
102
102
 
103
103
  if (ct === 'text/markdown') {
104
104
  markdownHtml()
105
- } else if (ct !== 'text/html') {
105
+ } else {
106
106
  // get with authenticated fetch
107
107
  kb.fetcher._fetch(subject.uri)
108
108
  .then(function(response) {
@@ -110,15 +110,18 @@ const humanReadablePane = {
110
110
  })
111
111
  .then(function(blob) {
112
112
  const objectURL = URL.createObjectURL(blob)
113
- frame.setAttribute('src', objectURL) // w640 h480 //
113
+ frame.setAttribute('src', objectURL)
114
+ frame.setAttribute('type', blob.type)
114
115
  frame.setAttribute('class', 'doc')
115
- frame.setAttribute('style', `border: 1px solid; padding: 1em; height:120em; width:80em; resize: both; overflow: auto;`)
116
+ return blob.type.startsWith('text') ? blob.text() : ''
117
+ })
118
+ .then(function(blobText) {
119
+ const newLines = blobText.includes('<script src="https://dokie.li/scripts/dokieli.js">') ? -10 : 5
120
+ const lines = Math.min(30, blobText.split(/\n/).length + newLines)
121
+ frame.setAttribute('style', `border: 1px solid; padding: 1em; height:${lines}em; width:800px; resize: both; overflow: auto;`)
116
122
  })
117
- } else {
118
- frame.setAttribute('src', subject.uri) // allow-same-origin
119
- frame.setAttribute('class', 'doc')
120
- frame.setAttribute('style', 'resize = both; height:120em; width:80em;')
121
123
  }
124
+
122
125
  // @@ Note below - if we set ANY sandbox, then Chrome and Safari won't display it if it is PDF.
123
126
  // https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
124
127
  // You can't have any sandbox and allow plugins.
@@ -127,8 +130,6 @@ const humanReadablePane = {
127
130
 
128
131
  // iframe.setAttribute('sandbox', 'allow-same-origin allow-forms'); // allow-scripts ?? no documents should be static
129
132
 
130
- // iframe.setAttribute('height', '480')
131
- // iframe.setAttribute('width', '640')
132
133
  const tr = myDocument.createElement('TR')
133
134
  tr.appendChild(frame)
134
135
  div.appendChild(tr)
@@ -1,6 +1,6 @@
1
1
  export default {
2
- buildTime: "2025-01-15T10:17:07Z",
3
- commit: "e1d9d5d189f016dde0e1675e0ab2feac8e39ebc4",
2
+ buildTime: "2025-02-02T17:17:41Z",
3
+ commit: "f584fd85e218c730b022ccd30dc21e7d4dc1e0ee",
4
4
  npmInfo:
5
5
  {
6
6
  'solid-panes': '3.6.1',