mashlib 1.7.17 → 1.7.18-alpha-b5d50d30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mashlib.js CHANGED
@@ -13779,7 +13779,7 @@ module.exports = {
13779
13779
  */
13780
13780
  // const DCT = $rdf.Namespace('http://purl.org/dc/terms/')
13781
13781
 
13782
- var preferencesFormText = "\n\n @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n @prefix solid: <http://www.w3.org/ns/solid/terms#>.\n @prefix ui: <http://www.w3.org/ns/ui#>.\n @prefix : <#>.\n\n :this\n <http://purl.org/dc/elements/1.1/title> \"Chat preferences\" ;\n a ui:Form ;\n ui:part :colorizeByAuthor, :expandImagesInline, :newestFirst, :inlineImageHeightEms;\n ui:parts ( :colorizeByAuthor :expandImagesInline :newestFirst :inlineImageHeightEms ).\n\n:colorizeByAuthor a ui:TristateField; ui:property solid:colorizeByAuthor;\n ui:label \"Color user input by user\".\n:expandImagesInline a ui:TristateField; ui:property solid:expandImagesInline;\n ui:label \"Expand image URLs inline\".\n:newestFirst a ui:TristateField; ui:property solid:newestFirst;\n ui:label \"Newest messages at the top\".\n\n:inlineImageHeightEms a ui:IntegerField; ui:property solid:inlineImageHeightEms;\n ui:label \"Inline image height (lines)\".\n\n";
13782
+ var preferencesFormText = "\n @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.\n @prefix solid: <http://www.w3.org/ns/solid/terms#>.\n @prefix ui: <http://www.w3.org/ns/ui#>.\n @prefix : <#>.\n\n :this\n <http://purl.org/dc/elements/1.1/title> \"Chat preferences\" ;\n a ui:Form ;\n ui:parts ( :colorizeByAuthor :expandImagesInline :newestFirst :inlineImageHeightEms\n :shiftEnterSendsMessage :authorDateOnLeft :showDeletedMessages).\n\n :colorizeByAuthor a ui:TristateField; ui:property solid:colorizeByAuthor;\n ui:label \"Color user input by user\".\n\n :expandImagesInline a ui:TristateField; ui:property solid:expandImagesInline;\n ui:label \"Expand image URLs inline\".\n\n :newestFirst a ui:TristateField; ui:property solid:newestFirst;\n ui:label \"Newest messages at the top\".\n\n :inlineImageHeightEms a ui:IntegerField; ui:property solid:inlineImageHeightEms;\n ui:label \"Inline image height (lines)\".\n\n :shiftEnterSendsMessage a ui:TristateField; ui:property solid:shiftEnterSendsMessage;\n ui:label \"Shift-Enter sends message\".\n\n :authorDateOnLeft a ui:TristateField; ui:property solid:authorDateOnLeft;\n ui:label \"Author & date of message on left\".\n\n :showDeletedMessages a ui:TristateField; ui:property solid:showDeletedMessages;\n ui:label \"Show placeholders for deleted messages\".\n";
13783
13783
  var preferencesForm = kb.sym('https://solid.github.io/solid-panes/longCharPane/preferencesForm.ttl#this');
13784
13784
  var preferencesFormDoc = preferencesForm.doc();
13785
13785
 
@@ -41774,7 +41774,7 @@ __webpack_require__.r(__webpack_exports__);
41774
41774
  * Copyright 2017 Google LLC
41775
41775
  * SPDX-License-Identifier: BSD-3-Clause
41776
41776
  */
41777
- var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea)$/i,p=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),$=p(1),y=p(2),b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T=new WeakMap,x=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,p=-1,$=0;for(;$<s.length&&(d.lastIndex=$,u=d.exec(s),null!==u);)$=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,p=-1):void 0===u[1]?p=-2:(p=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:p>=0?(l.push(o),s.slice(0,p)+"$lit$"+s.slice(p)+e+y):s+e+(-2===p?(l.push(void 0),i):y)}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==s?s.createHTML(u):u,l]};class E{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=E.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?H:"@"===i[1]?I:S})}else c.push({type:6,index:r})}for(const i of t)l.removeAttribute(i)}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h())}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else{let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1}r++}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return(null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=P(t,d._$AS(t,i.values),d,e)),i}class V{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new L(n,this,t)),this.v.push(i),d=e[++r]}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),r(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==w&&r(this._$AH)?this._$AA.nextSibling.data=t:this.S(l.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=E.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new V(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new E(t)),i}A(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.M(h()),this.M(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===w?t=w:t!==w&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}n&&!e&&this.k(t)}k(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class M extends S{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===w?void 0:t}}const k=i?i.emptyScript:"";class H extends S{constructor(){super(...arguments),this.type=4}k(t){t&&t!==w?this.element.setAttribute(this.name,k):this.element.removeAttribute(this.name)}}class I extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:w)===b)return;const e=this._$AH,o=t===w&&e!==w||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==w&&(e===w||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const R={P:"$lit$",V:e,L:o,I:1,N:C,R:V,D:u,j:P,H:N,O:S,F:H,B:I,W:M,Z:L},z=window.litHtmlPolyfillSupport;null==z||z(E,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.1.2");
41777
+ var t;const i=globalThis.trustedTypes,s=i?i.createPolicy("lit-html",{createHTML:t=>t}):void 0,e=`lit$${(Math.random()+"").slice(9)}$`,o="?"+e,n=`<${o}>`,l=document,h=(t="")=>l.createComment(t),r=t=>null===t||"object"!=typeof t&&"function"!=typeof t,d=Array.isArray,u=t=>{var i;return d(t)||"function"==typeof(null===(i=t)||void 0===i?void 0:i[Symbol.iterator])},c=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,v=/-->/g,a=/>/g,f=/>|[ \n \r](?:([^\s"'>=/]+)([ \n \r]*=[ \n \r]*(?:[^ \n \r"'`<>=]|("|')|))|$)/g,_=/'/g,m=/"/g,g=/^(?:script|style|textarea|title)$/i,p=t=>(i,...s)=>({_$litType$:t,strings:i,values:s}),$=p(1),y=p(2),b=Symbol.for("lit-noChange"),w=Symbol.for("lit-nothing"),T=new WeakMap,x=(t,i,s)=>{var e,o;const n=null!==(e=null==s?void 0:s.renderBefore)&&void 0!==e?e:i;let l=n._$litPart$;if(void 0===l){const t=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;n._$litPart$=l=new N(i.insertBefore(h(),t),t,void 0,null!=s?s:{})}return l._$AI(t),l},A=l.createTreeWalker(l,129,null,!1),C=(t,i)=>{const o=t.length-1,l=[];let h,r=2===i?"<svg>":"",d=c;for(let i=0;i<o;i++){const s=t[i];let o,u,p=-1,$=0;for(;$<s.length&&(d.lastIndex=$,u=d.exec(s),null!==u);)$=d.lastIndex,d===c?"!--"===u[1]?d=v:void 0!==u[1]?d=a:void 0!==u[2]?(g.test(u[2])&&(h=RegExp("</"+u[2],"g")),d=f):void 0!==u[3]&&(d=f):d===f?">"===u[0]?(d=null!=h?h:c,p=-1):void 0===u[1]?p=-2:(p=d.lastIndex-u[2].length,o=u[1],d=void 0===u[3]?f:'"'===u[3]?m:_):d===m||d===_?d=f:d===v||d===a?d=c:(d=f,h=void 0);const y=d===f&&t[i+1].startsWith("/>")?" ":"";r+=d===c?s+n:p>=0?(l.push(o),s.slice(0,p)+"$lit$"+s.slice(p)+e+y):s+e+(-2===p?(l.push(void 0),i):y)}const u=r+(t[o]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==s?s.createHTML(u):u,l]};class E{constructor({strings:t,_$litType$:s},n){let l;this.parts=[];let r=0,d=0;const u=t.length-1,c=this.parts,[v,a]=C(t,s);if(this.el=E.createElement(v,n),A.currentNode=this.el.content,2===s){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(l=A.nextNode())&&c.length<u;){if(1===l.nodeType){if(l.hasAttributes()){const t=[];for(const i of l.getAttributeNames())if(i.endsWith("$lit$")||i.startsWith(e)){const s=a[d++];if(t.push(i),void 0!==s){const t=l.getAttribute(s.toLowerCase()+"$lit$").split(e),i=/([.?@])?(.*)/.exec(s);c.push({type:1,index:r,name:i[2],strings:t,ctor:"."===i[1]?M:"?"===i[1]?H:"@"===i[1]?I:S})}else c.push({type:6,index:r})}for(const i of t)l.removeAttribute(i)}if(g.test(l.tagName)){const t=l.textContent.split(e),s=t.length-1;if(s>0){l.textContent=i?i.emptyScript:"";for(let i=0;i<s;i++)l.append(t[i],h()),A.nextNode(),c.push({type:2,index:++r});l.append(t[s],h())}}}else if(8===l.nodeType)if(l.data===o)c.push({type:2,index:r});else{let t=-1;for(;-1!==(t=l.data.indexOf(e,t+1));)c.push({type:7,index:r}),t+=e.length-1}r++}}static createElement(t,i){const s=l.createElement("template");return s.innerHTML=t,s}}function P(t,i,s=t,e){var o,n,l,h;if(i===b)return i;let d=void 0!==e?null===(o=s._$Cl)||void 0===o?void 0:o[e]:s._$Cu;const u=r(i)?void 0:i._$litDirective$;return(null==d?void 0:d.constructor)!==u&&(null===(n=null==d?void 0:d._$AO)||void 0===n||n.call(d,!1),void 0===u?d=void 0:(d=new u(t),d._$AT(t,s,e)),void 0!==e?(null!==(l=(h=s)._$Cl)&&void 0!==l?l:h._$Cl=[])[e]=d:s._$Cu=d),void 0!==d&&(i=P(t,d._$AS(t,i.values),d,e)),i}class V{constructor(t,i){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var i;const{el:{content:s},parts:e}=this._$AD,o=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:l).importNode(s,!0);A.currentNode=o;let n=A.nextNode(),h=0,r=0,d=e[0];for(;void 0!==d;){if(h===d.index){let i;2===d.type?i=new N(n,n.nextSibling,this,t):1===d.type?i=new d.ctor(n,d.name,d.strings,this,t):6===d.type&&(i=new L(n,this,t)),this.v.push(i),d=e[++r]}h!==(null==d?void 0:d.index)&&(n=A.nextNode(),h++)}return o}m(t){let i=0;for(const s of this.v)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,i),i+=s.strings.length-2):s._$AI(t[i])),i++}}class N{constructor(t,i,s,e){var o;this.type=2,this._$AH=w,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=s,this.options=e,this._$Cg=null===(o=null==e?void 0:e.isConnected)||void 0===o||o}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===t.nodeType&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=P(this,t,i),r(t)?t===w||null==t||""===t?(this._$AH!==w&&this._$AR(),this._$AH=w):t!==this._$AH&&t!==b&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):u(t)?this.A(t):this.$(t)}M(t,i=this._$AB){return this._$AA.parentNode.insertBefore(t,i)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.M(t))}$(t){this._$AH!==w&&r(this._$AH)?this._$AA.nextSibling.data=t:this.S(l.createTextNode(t)),this._$AH=t}T(t){var i;const{values:s,_$litType$:e}=t,o="number"==typeof e?this._$AC(t):(void 0===e.el&&(e.el=E.createElement(e.h,this.options)),e);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===o)this._$AH.m(s);else{const t=new V(o,this),i=t.p(this.options);t.m(s),this.S(i),this._$AH=t}}_$AC(t){let i=T.get(t.strings);return void 0===i&&T.set(t.strings,i=new E(t)),i}A(t){d(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let s,e=0;for(const o of t)e===i.length?i.push(s=new N(this.M(h()),this.M(h()),this,this.options)):s=i[e],s._$AI(o),e++;e<i.length&&(this._$AR(s&&s._$AB.nextSibling,e),i.length=e)}_$AR(t=this._$AA.nextSibling,i){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cg=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class S{constructor(t,i,s,e,o){this.type=1,this._$AH=w,this._$AN=void 0,this.element=t,this.name=i,this._$AM=e,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=w}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,s,e){const o=this.strings;let n=!1;if(void 0===o)t=P(this,t,i,0),n=!r(t)||t!==this._$AH&&t!==b,n&&(this._$AH=t);else{const e=t;let l,h;for(t=o[0],l=0;l<o.length-1;l++)h=P(this,e[s+l],i,l),h===b&&(h=this._$AH[l]),n||(n=!r(h)||h!==this._$AH[l]),h===w?t=w:t!==w&&(t+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}n&&!e&&this.k(t)}k(t){t===w?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class M extends S{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===w?void 0:t}}const k=i?i.emptyScript:"";class H extends S{constructor(){super(...arguments),this.type=4}k(t){t&&t!==w?this.element.setAttribute(this.name,k):this.element.removeAttribute(this.name)}}class I extends S{constructor(t,i,s,e,o){super(t,i,s,e,o),this.type=5}_$AI(t,i=this){var s;if((t=null!==(s=P(this,t,i,0))&&void 0!==s?s:w)===b)return;const e=this._$AH,o=t===w&&e!==w||t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive,n=t!==w&&(e===w||o);o&&this.element.removeEventListener(this.name,this,e),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==s?s:this.element,t):this._$AH.handleEvent(t)}}class L{constructor(t,i,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){P(this,t)}}const R={P:"$lit$",V:e,L:o,I:1,N:C,R:V,D:u,j:P,H:N,O:S,F:H,B:I,W:M,Z:L},z=window.litHtmlPolyfillSupport;null==z||z(E,N),(null!==(t=globalThis.litHtmlVersions)&&void 0!==t?t:globalThis.litHtmlVersions=[]).push("2.1.3");
41778
41778
  //# sourceMappingURL=lit-html.js.map
41779
41779
 
41780
41780
 
@@ -112583,23 +112583,23 @@ function _default(context) {
112583
112583
  }
112584
112584
 
112585
112585
  function _getDashboardItems() {
112586
- _getDashboardItems = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
112586
+ _getDashboardItems = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
112587
112587
  var me, div, _yield$Promise$all, _yield$Promise$all2, books, pods, getPods, _getPods, getAddressBooks, _getAddressBooks;
112588
112588
 
112589
- return regeneratorRuntime.wrap(function _callee6$(_context7) {
112589
+ return regeneratorRuntime.wrap(function _callee7$(_context8) {
112590
112590
  while (1) {
112591
- switch (_context7.prev = _context7.next) {
112591
+ switch (_context8.prev = _context8.next) {
112592
112592
  case 0:
112593
112593
  _getAddressBooks = function _getAddressBooks3() {
112594
- _getAddressBooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
112595
- var _context5;
112594
+ _getAddressBooks = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6() {
112595
+ var _context6;
112596
112596
 
112597
- return regeneratorRuntime.wrap(function _callee5$(_context6) {
112597
+ return regeneratorRuntime.wrap(function _callee6$(_context7) {
112598
112598
  while (1) {
112599
- switch (_context6.prev = _context6.next) {
112599
+ switch (_context7.prev = _context7.next) {
112600
112600
  case 0:
112601
- _context6.prev = 0;
112602
- _context6.next = 3;
112601
+ _context7.prev = 0;
112602
+ _context7.next = 3;
112603
112603
  return UI.authn.findAppInstances({
112604
112604
  me: me,
112605
112605
  div: div,
@@ -112607,8 +112607,8 @@ function _default(context) {
112607
112607
  }, ns.vcard('AddressBook'));
112608
112608
 
112609
112609
  case 3:
112610
- _context5 = _context6.sent;
112611
- return _context6.abrupt("return", (_context5.instances || []).map(function (book, index) {
112610
+ _context6 = _context7.sent;
112611
+ return _context7.abrupt("return", (_context6.instances || []).map(function (book, index) {
112612
112612
  return {
112613
112613
  paneName: 'contact',
112614
112614
  tabName: "contact-".concat(index),
@@ -112619,19 +112619,19 @@ function _default(context) {
112619
112619
  }));
112620
112620
 
112621
112621
  case 7:
112622
- _context6.prev = 7;
112623
- _context6.t0 = _context6["catch"](0);
112622
+ _context7.prev = 7;
112623
+ _context7.t0 = _context7["catch"](0);
112624
112624
  console.error('oops in globalAppTabs AddressBook');
112625
112625
 
112626
112626
  case 10:
112627
- return _context6.abrupt("return", []);
112627
+ return _context7.abrupt("return", []);
112628
112628
 
112629
112629
  case 11:
112630
112630
  case "end":
112631
- return _context6.stop();
112631
+ return _context7.stop();
112632
112632
  }
112633
112633
  }
112634
- }, _callee5, null, [[0, 7]]);
112634
+ }, _callee6, null, [[0, 7]]);
112635
112635
  }));
112636
112636
  return _getAddressBooks.apply(this, arguments);
112637
112637
  };
@@ -112641,142 +112641,173 @@ function _default(context) {
112641
112641
  };
112642
112642
 
112643
112643
  _getPods = function _getPods3() {
112644
- _getPods = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
112645
- var addPodRoot, _addPodRoot, addPodRootFromUrl, _addPodRootFromUrl, pods, uri, podUrl;
112644
+ _getPods = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
112645
+ var addPodStorage, _addPodStorage, addPodStorageFromUrl, _addPodStorageFromUrl, pods, uri, podUrl, uniques;
112646
112646
 
112647
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
112647
+ return regeneratorRuntime.wrap(function _callee5$(_context5) {
112648
112648
  while (1) {
112649
- switch (_context4.prev = _context4.next) {
112649
+ switch (_context5.prev = _context5.next) {
112650
112650
  case 0:
112651
- _addPodRootFromUrl = function _addPodRootFromUrl3() {
112652
- _addPodRootFromUrl = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url) {
112653
- var podStorage;
112654
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
112651
+ uniques = function _uniques(nodes) {
112652
+ var uniqueNodes = [];
112653
+ nodes.forEach(function (node) {
112654
+ if (!uniqueNodes.find(function (uniqueNode) {
112655
+ return uniqueNode.equals(node);
112656
+ })) uniqueNodes.push(node);
112657
+ });
112658
+ return uniqueNodes;
112659
+ };
112660
+
112661
+ _addPodStorageFromUrl = function _addPodStorageFromUrl3() {
112662
+ _addPodStorageFromUrl = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(url) {
112663
+ var podStorage, pathStorage;
112664
+ return regeneratorRuntime.wrap(function _callee4$(_context4) {
112655
112665
  while (1) {
112656
- switch (_context3.prev = _context3.next) {
112666
+ switch (_context4.prev = _context4.next) {
112657
112667
  case 0:
112658
- podStorage = new URL(url); // check that origin is not included in pods array
112668
+ podStorage = new URL(url); // check for predicate pim:Storage in containers up the path tree
112659
112669
 
112660
- if (pods.some(function (pod) {
112661
- return pod.uri.includes(podStorage.origin);
112662
- })) {
112663
- _context3.next = 10;
112664
- break;
112665
- }
112670
+ pathStorage = podStorage.pathname;
112666
112671
 
112667
- _context3.t0 = podStorage.pathname === '/';
112668
-
112669
- if (_context3.t0) {
112670
- _context3.next = 7;
112672
+ case 2:
112673
+ if (!pathStorage.length) {
112674
+ _context4.next = 10;
112671
112675
  break;
112672
112676
  }
112673
112677
 
112674
- _context3.next = 6;
112675
- return addPodRoot(kb.sym("".concat(podStorage.origin, "/").concat(podStorage.pathname.split('/')[1], "/")));
112678
+ pathStorage = pathStorage.substring(0, pathStorage.lastIndexOf('/'));
112679
+ _context4.next = 6;
112680
+ return addPodStorage(kb.sym("".concat(podStorage.origin).concat(pathStorage, "/")));
112676
112681
 
112677
112682
  case 6:
112678
- _context3.t0 = !_context3.sent;
112679
-
112680
- case 7:
112681
- if (!_context3.t0) {
112682
- _context3.next = 10;
112683
+ if (!_context4.sent) {
112684
+ _context4.next = 8;
112683
112685
  break;
112684
112686
  }
112685
112687
 
112686
- _context3.next = 10;
112687
- return addPodRoot(kb.sym("".concat(podStorage.origin, "/")));
112688
+ return _context4.abrupt("return");
112689
+
112690
+ case 8:
112691
+ _context4.next = 2;
112692
+ break;
112688
112693
 
112689
112694
  case 10:
112690
112695
  case "end":
112691
- return _context3.stop();
112696
+ return _context4.stop();
112692
112697
  }
112693
112698
  }
112694
- }, _callee3);
112699
+ }, _callee4);
112695
112700
  }));
112696
- return _addPodRootFromUrl.apply(this, arguments);
112701
+ return _addPodStorageFromUrl.apply(this, arguments);
112697
112702
  };
112698
112703
 
112699
- addPodRootFromUrl = function _addPodRootFromUrl2(_x8) {
112700
- return _addPodRootFromUrl.apply(this, arguments);
112704
+ addPodStorageFromUrl = function _addPodStorageFromUrl2(_x8) {
112705
+ return _addPodStorageFromUrl.apply(this, arguments);
112701
112706
  };
112702
112707
 
112703
- _addPodRoot = function _addPodRoot3() {
112704
- _addPodRoot = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(pod) {
112705
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
112708
+ _addPodStorage = function _addPodStorage3() {
112709
+ _addPodStorage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(pod) {
112710
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
112706
112711
  while (1) {
112707
- switch (_context2.prev = _context2.next) {
112712
+ switch (_context3.prev = _context3.next) {
112708
112713
  case 0:
112709
- _context2.next = 2;
112710
- return checkForContainerRepresentation(pod);
112714
+ _context3.next = 2;
112715
+ return loadContainerRepresentation(pod);
112711
112716
 
112712
112717
  case 2:
112713
112718
  if (!kb.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())) {
112714
- _context2.next = 5;
112719
+ _context3.next = 5;
112715
112720
  break;
112716
112721
  }
112717
112722
 
112718
112723
  pods.push(pod);
112719
- return _context2.abrupt("return", true);
112724
+ return _context3.abrupt("return", true);
112720
112725
 
112721
112726
  case 5:
112722
- return _context2.abrupt("return", false);
112727
+ return _context3.abrupt("return", false);
112723
112728
 
112724
112729
  case 6:
112725
112730
  case "end":
112726
- return _context2.stop();
112731
+ return _context3.stop();
112727
112732
  }
112728
112733
  }
112729
- }, _callee2);
112734
+ }, _callee3);
112730
112735
  }));
112731
- return _addPodRoot.apply(this, arguments);
112736
+ return _addPodStorage.apply(this, arguments);
112732
112737
  };
112733
112738
 
112734
- addPodRoot = function _addPodRoot2(_x7) {
112735
- return _addPodRoot.apply(this, arguments);
112739
+ addPodStorage = function _addPodStorage2(_x7) {
112740
+ return _addPodStorage.apply(this, arguments);
112736
112741
  };
112737
112742
 
112738
- _context4.prev = 4;
112739
- _context4.next = 7;
112743
+ _context5.prev = 5;
112744
+ _context5.next = 8;
112740
112745
  return kb.fetcher.load(me.doc());
112741
112746
 
112742
- case 7:
112743
- _context4.next = 13;
112747
+ case 8:
112748
+ _context5.next = 14;
112744
112749
  break;
112745
112750
 
112746
- case 9:
112747
- _context4.prev = 9;
112748
- _context4.t0 = _context4["catch"](4);
112749
- console.error('Unable to load profile', _context4.t0);
112750
- return _context4.abrupt("return", []);
112751
+ case 10:
112752
+ _context5.prev = 10;
112753
+ _context5.t0 = _context5["catch"](5);
112754
+ console.error('Unable to load profile', _context5.t0);
112755
+ return _context5.abrupt("return", []);
112751
112756
 
112752
- case 13:
112757
+ case 14:
112758
+ // load pod's storages from profile
112753
112759
  pods = kb.each(me, ns.space('storage'), null, me.doc());
112754
- _context4.prev = 14;
112760
+ pods.map( /*#__PURE__*/function () {
112761
+ var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(pod) {
112762
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
112763
+ while (1) {
112764
+ switch (_context2.prev = _context2.next) {
112765
+ case 0:
112766
+ _context2.next = 2;
112767
+ return loadContainerRepresentation(pod);
112768
+
112769
+ case 2:
112770
+ case "end":
112771
+ return _context2.stop();
112772
+ }
112773
+ }
112774
+ }, _callee2);
112775
+ }));
112776
+
112777
+ return function (_x9) {
112778
+ return _ref.apply(this, arguments);
112779
+ };
112780
+ }());
112781
+ _context5.prev = 16;
112755
112782
  // if uri then SolidOS is a browse.html web app
112756
112783
  uri = new URL(window.location.href).searchParams.get('uri');
112757
112784
  podUrl = uri || window.location.href;
112758
- _context4.next = 19;
112759
- return addPodRootFromUrl(podUrl.substring(0, podUrl.lastIndexOf('/') + 1));
112785
+ _context5.next = 21;
112786
+ return addPodStorageFromUrl(podUrl);
112760
112787
 
112761
- case 19:
112762
- _context4.next = 24;
112788
+ case 21:
112789
+ _context5.next = 26;
112763
112790
  break;
112764
112791
 
112765
- case 21:
112766
- _context4.prev = 21;
112767
- _context4.t1 = _context4["catch"](14);
112768
- console.error('cannot load container', _context4.t1);
112792
+ case 23:
112793
+ _context5.prev = 23;
112794
+ _context5.t1 = _context5["catch"](16);
112795
+ console.error('cannot load container', _context5.t1);
112796
+
112797
+ case 26:
112798
+ pods = uniques(pods);
112799
+ console.log('return pods');
112800
+ console.log(pods);
112769
112801
 
112770
- case 24:
112771
112802
  if (pods.length) {
112772
- _context4.next = 26;
112803
+ _context5.next = 31;
112773
112804
  break;
112774
112805
  }
112775
112806
 
112776
- return _context4.abrupt("return", []);
112807
+ return _context5.abrupt("return", []);
112777
112808
 
112778
- case 26:
112779
- return _context4.abrupt("return", pods.map(function (pod, index) {
112809
+ case 31:
112810
+ return _context5.abrupt("return", pods.map(function (pod, index) {
112780
112811
  function split(item) {
112781
112812
  return item.uri.split('//')[1].slice(0, -1);
112782
112813
  }
@@ -112791,12 +112822,12 @@ function _default(context) {
112791
112822
  };
112792
112823
  }));
112793
112824
 
112794
- case 27:
112825
+ case 32:
112795
112826
  case "end":
112796
- return _context4.stop();
112827
+ return _context5.stop();
112797
112828
  }
112798
112829
  }
112799
- }, _callee4, null, [[4, 9], [14, 21]]);
112830
+ }, _callee5, null, [[5, 10], [16, 23]]);
112800
112831
  }));
112801
112832
  return _getPods.apply(this, arguments);
112802
112833
  };
@@ -112808,23 +112839,23 @@ function _default(context) {
112808
112839
  me = UI.authn.currentUser();
112809
112840
 
112810
112841
  if (me) {
112811
- _context7.next = 7;
112842
+ _context8.next = 7;
112812
112843
  break;
112813
112844
  }
112814
112845
 
112815
- return _context7.abrupt("return", []);
112846
+ return _context8.abrupt("return", []);
112816
112847
 
112817
112848
  case 7:
112818
112849
  div = dom.createElement('div');
112819
- _context7.next = 10;
112850
+ _context8.next = 10;
112820
112851
  return Promise.all([getAddressBooks(), getPods()]);
112821
112852
 
112822
112853
  case 10:
112823
- _yield$Promise$all = _context7.sent;
112854
+ _yield$Promise$all = _context8.sent;
112824
112855
  _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
112825
112856
  books = _yield$Promise$all2[0];
112826
112857
  pods = _yield$Promise$all2[1];
112827
- return _context7.abrupt("return", [{
112858
+ return _context8.abrupt("return", [{
112828
112859
  paneName: 'home',
112829
112860
  label: 'Your stuff',
112830
112861
  icon: UI.icons.iconBase + 'noun_547570.svg'
@@ -112840,10 +112871,10 @@ function _default(context) {
112840
112871
 
112841
112872
  case 15:
112842
112873
  case "end":
112843
- return _context7.stop();
112874
+ return _context8.stop();
112844
112875
  }
112845
112876
  }
112846
- }, _callee6);
112877
+ }, _callee7);
112847
112878
  }));
112848
112879
  return _getDashboardItems.apply(this, arguments);
112849
112880
  }
@@ -112862,7 +112893,7 @@ function _default(context) {
112862
112893
  }
112863
112894
 
112864
112895
  function _showDashboard() {
112865
- _showDashboard = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
112896
+ _showDashboard = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
112866
112897
  var options,
112867
112898
  dashboardContainer,
112868
112899
  outlineContainer,
@@ -112870,23 +112901,23 @@ function _default(context) {
112870
112901
  dashboard,
112871
112902
  tab,
112872
112903
  closeDashboard,
112873
- _args7 = arguments;
112904
+ _args8 = arguments;
112874
112905
 
112875
- return regeneratorRuntime.wrap(function _callee7$(_context8) {
112906
+ return regeneratorRuntime.wrap(function _callee8$(_context9) {
112876
112907
  while (1) {
112877
- switch (_context8.prev = _context8.next) {
112908
+ switch (_context9.prev = _context9.next) {
112878
112909
  case 0:
112879
112910
  closeDashboard = function _closeDashboard() {
112880
112911
  dashboardContainer.style.display = 'none';
112881
112912
  outlineContainer.style.display = 'inherit';
112882
112913
  };
112883
112914
 
112884
- options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
112915
+ options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
112885
112916
  dashboardContainer = getDashboardContainer();
112886
112917
  outlineContainer = getOutlineContainer(); // reuse dashboard if already children already is inserted
112887
112918
 
112888
112919
  if (!(dashboardContainer.childNodes.length > 0 && options.pane)) {
112889
- _context8.next = 12;
112920
+ _context9.next = 12;
112890
112921
  break;
112891
112922
  }
112892
112923
 
@@ -112895,26 +112926,26 @@ function _default(context) {
112895
112926
  _tab = dashboardContainer.querySelector("[data-global-pane-name=\"".concat(options.pane, "\"]"));
112896
112927
 
112897
112928
  if (!_tab) {
112898
- _context8.next = 11;
112929
+ _context9.next = 11;
112899
112930
  break;
112900
112931
  }
112901
112932
 
112902
112933
  _tab.click();
112903
112934
 
112904
- return _context8.abrupt("return");
112935
+ return _context9.abrupt("return");
112905
112936
 
112906
112937
  case 11:
112907
112938
  console.warn('Did not find the referred tab in global dashboard, will open first one');
112908
112939
 
112909
112940
  case 12:
112910
- _context8.next = 14;
112941
+ _context9.next = 14;
112911
112942
  return globalAppTabs({
112912
112943
  selectedTab: options.pane,
112913
112944
  onClose: closeDashboard
112914
112945
  });
112915
112946
 
112916
112947
  case 14:
112917
- dashboard = _context8.sent;
112948
+ dashboard = _context9.sent;
112918
112949
  // close the dashboard if user log out
112919
112950
  UI.authn.authSession.onLogout(closeDashboard); // finally - switch to showing dashboard
112920
112951
 
@@ -112928,10 +112959,10 @@ function _default(context) {
112928
112959
 
112929
112960
  case 20:
112930
112961
  case "end":
112931
- return _context8.stop();
112962
+ return _context9.stop();
112932
112963
  }
112933
112964
  }
112934
- }, _callee7);
112965
+ }, _callee8);
112935
112966
  }));
112936
112967
  return _showDashboard.apply(this, arguments);
112937
112968
  }
@@ -112962,23 +112993,23 @@ function _default(context) {
112962
112993
  }();
112963
112994
  }
112964
112995
 
112965
- function checkForContainerRepresentation(_x) {
112966
- return _checkForContainerRepresentation.apply(this, arguments);
112996
+ function loadContainerRepresentation(_x) {
112997
+ return _loadContainerRepresentation.apply(this, arguments);
112967
112998
  }
112968
112999
 
112969
- function _checkForContainerRepresentation() {
112970
- _checkForContainerRepresentation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(subject) {
113000
+ function _loadContainerRepresentation() {
113001
+ _loadContainerRepresentation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(subject) {
112971
113002
  var response, containerTurtle;
112972
- return regeneratorRuntime.wrap(function _callee8$(_context9) {
113003
+ return regeneratorRuntime.wrap(function _callee9$(_context10) {
112973
113004
  while (1) {
112974
- switch (_context9.prev = _context9.next) {
113005
+ switch (_context10.prev = _context10.next) {
112975
113006
  case 0:
112976
113007
  if (kb.any(subject, ns.ldp('contains'), undefined, subject.doc())) {
112977
- _context9.next = 6;
113008
+ _context10.next = 6;
112978
113009
  break;
112979
113010
  }
112980
113011
 
112981
- _context9.next = 3;
113012
+ _context10.next = 3;
112982
113013
  return kb.fetcher.webOperation('GET', subject.uri, kb.fetcher.initFetchOptions(subject.uri, {
112983
113014
  headers: {
112984
113015
  accept: 'text/turtle'
@@ -112986,18 +113017,18 @@ function _default(context) {
112986
113017
  }));
112987
113018
 
112988
113019
  case 3:
112989
- response = _context9.sent;
113020
+ response = _context10.sent;
112990
113021
  containerTurtle = response.responseText;
112991
113022
  $rdf.parse(containerTurtle, kb, subject.uri, 'text/turtle');
112992
113023
 
112993
113024
  case 6:
112994
113025
  case "end":
112995
- return _context9.stop();
113026
+ return _context10.stop();
112996
113027
  }
112997
113028
  }
112998
- }, _callee8);
113029
+ }, _callee9);
112999
113030
  }));
113000
- return _checkForContainerRepresentation.apply(this, arguments);
113031
+ return _loadContainerRepresentation.apply(this, arguments);
113001
113032
  }
113002
113033
 
113003
113034
  function getRelevantPanes(_x2, _x3) {
@@ -113005,19 +113036,19 @@ function _default(context) {
113005
113036
  }
113006
113037
 
113007
113038
  function _getRelevantPanes() {
113008
- _getRelevantPanes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(subject, context) {
113039
+ _getRelevantPanes = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(subject, context) {
113009
113040
  var panes, relevantPanes, filteredPanes, firstRelevantPaneIndex, firstFilteredPaneIndex;
113010
- return regeneratorRuntime.wrap(function _callee9$(_context10) {
113041
+ return regeneratorRuntime.wrap(function _callee10$(_context11) {
113011
113042
  while (1) {
113012
- switch (_context10.prev = _context10.next) {
113043
+ switch (_context11.prev = _context11.next) {
113013
113044
  case 0:
113014
113045
  if (!subject.uri.endsWith('/')) {
113015
- _context10.next = 3;
113046
+ _context11.next = 3;
113016
113047
  break;
113017
113048
  }
113018
113049
 
113019
- _context10.next = 3;
113020
- return checkForContainerRepresentation(subject);
113050
+ _context11.next = 3;
113051
+ return loadContainerRepresentation(subject);
113021
113052
 
113022
113053
  case 3:
113023
113054
  panes = context.session.paneRegistry;
@@ -113026,38 +113057,38 @@ function _default(context) {
113026
113057
  });
113027
113058
 
113028
113059
  if (!(relevantPanes.length === 0)) {
113029
- _context10.next = 7;
113060
+ _context11.next = 7;
113030
113061
  break;
113031
113062
  }
113032
113063
 
113033
- return _context10.abrupt("return", [panes.byName('internal')]);
113064
+ return _context11.abrupt("return", [panes.byName('internal')]);
113034
113065
 
113035
113066
  case 7:
113036
- _context10.next = 9;
113067
+ _context11.next = 9;
113037
113068
  return UI.authn.filterAvailablePanes(relevantPanes);
113038
113069
 
113039
113070
  case 9:
113040
- filteredPanes = _context10.sent;
113071
+ filteredPanes = _context11.sent;
113041
113072
 
113042
113073
  if (!(filteredPanes.length === 0)) {
113043
- _context10.next = 12;
113074
+ _context11.next = 12;
113044
113075
  break;
113045
113076
  }
113046
113077
 
113047
- return _context10.abrupt("return", [relevantPanes[0]]);
113078
+ return _context11.abrupt("return", [relevantPanes[0]]);
113048
113079
 
113049
113080
  case 12:
113050
113081
  firstRelevantPaneIndex = panes.list.indexOf(relevantPanes[0]);
113051
113082
  firstFilteredPaneIndex = panes.list.indexOf(filteredPanes[0]); // if the first relevant pane is loaded before the panes available wrt role, we still want to offer the most relevant pane
113052
113083
 
113053
- return _context10.abrupt("return", firstRelevantPaneIndex < firstFilteredPaneIndex ? [relevantPanes[0]].concat(filteredPanes) : filteredPanes);
113084
+ return _context11.abrupt("return", firstRelevantPaneIndex < firstFilteredPaneIndex ? [relevantPanes[0]].concat(filteredPanes) : filteredPanes);
113054
113085
 
113055
113086
  case 15:
113056
113087
  case "end":
113057
- return _context10.stop();
113088
+ return _context11.stop();
113058
113089
  }
113059
113090
  }
113060
- }, _callee9);
113091
+ }, _callee10);
113061
113092
  }));
113062
113093
  return _getRelevantPanes.apply(this, arguments);
113063
113094
  }
@@ -113095,50 +113126,50 @@ function _default(context) {
113095
113126
 
113096
113127
 
113097
113128
  function _expandedHeaderTR() {
113098
- _expandedHeaderTR = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(subject, requiredPane, options) {
113129
+ _expandedHeaderTR = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12(subject, requiredPane, options) {
113099
113130
  var renderPaneIconTray, _renderPaneIconTray, tr, td, header, showHeader, icon, strong;
113100
113131
 
113101
- return regeneratorRuntime.wrap(function _callee11$(_context12) {
113132
+ return regeneratorRuntime.wrap(function _callee12$(_context13) {
113102
113133
  while (1) {
113103
- switch (_context12.prev = _context12.next) {
113134
+ switch (_context13.prev = _context13.next) {
113104
113135
  case 0:
113105
113136
  _renderPaneIconTray = function _renderPaneIconTray3() {
113106
- _renderPaneIconTray = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(td) {
113137
+ _renderPaneIconTray = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11(td) {
113107
113138
  var options,
113108
113139
  paneShownStyle,
113109
113140
  paneHiddenStyle,
113110
113141
  paneIconTray,
113111
113142
  relevantPanes,
113112
113143
  paneNumber,
113113
- _args10 = arguments;
113114
- return regeneratorRuntime.wrap(function _callee10$(_context11) {
113144
+ _args11 = arguments;
113145
+ return regeneratorRuntime.wrap(function _callee11$(_context12) {
113115
113146
  while (1) {
113116
- switch (_context11.prev = _context11.next) {
113147
+ switch (_context12.prev = _context12.next) {
113117
113148
  case 0:
113118
- options = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : {};
113149
+ options = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : {};
113119
113150
  paneShownStyle = 'width: 24px; border-radius: 0.5em; border-top: solid #222 1px; border-left: solid #222 0.1em; border-bottom: solid #eee 0.1em; border-right: solid #eee 0.1em; margin-left: 1em; padding: 3px; background-color: #ffd;';
113120
113151
  paneHiddenStyle = 'width: 24px; border-radius: 0.5em; margin-left: 1em; padding: 3px';
113121
113152
  paneIconTray = td.appendChild(dom.createElement('nav'));
113122
113153
  paneIconTray.style = 'display:flex; justify-content: flex-start; align-items: center;';
113123
113154
 
113124
113155
  if (!options.hideList) {
113125
- _context11.next = 9;
113156
+ _context12.next = 9;
113126
113157
  break;
113127
113158
  }
113128
113159
 
113129
- _context11.t0 = [];
113130
- _context11.next = 12;
113160
+ _context12.t0 = [];
113161
+ _context12.next = 12;
113131
113162
  break;
113132
113163
 
113133
113164
  case 9:
113134
- _context11.next = 11;
113165
+ _context12.next = 11;
113135
113166
  return getRelevantPanes(subject, context);
113136
113167
 
113137
113168
  case 11:
113138
- _context11.t0 = _context11.sent;
113169
+ _context12.t0 = _context12.sent;
113139
113170
 
113140
113171
  case 12:
113141
- relevantPanes = _context11.t0;
113172
+ relevantPanes = _context12.t0;
113142
113173
  tr.firstPane = requiredPane || getPane(relevantPanes, subject);
113143
113174
  paneNumber = relevantPanes.indexOf(tr.firstPane);
113144
113175
 
@@ -113255,19 +113286,19 @@ function _default(context) {
113255
113286
  });
113256
113287
  }
113257
113288
 
113258
- return _context11.abrupt("return", paneIconTray);
113289
+ return _context12.abrupt("return", paneIconTray);
113259
113290
 
113260
113291
  case 17:
113261
113292
  case "end":
113262
- return _context11.stop();
113293
+ return _context12.stop();
113263
113294
  }
113264
113295
  }
113265
- }, _callee10);
113296
+ }, _callee11);
113266
113297
  }));
113267
113298
  return _renderPaneIconTray.apply(this, arguments);
113268
113299
  };
113269
113300
 
113270
- renderPaneIconTray = function _renderPaneIconTray2(_x9) {
113301
+ renderPaneIconTray = function _renderPaneIconTray2(_x10) {
113271
113302
  return _renderPaneIconTray.apply(this, arguments);
113272
113303
  };
113273
113304
 
@@ -113299,16 +113330,16 @@ function _default(context) {
113299
113330
  UI.widgets.makeDraggable(strong, subject);
113300
113331
  }
113301
113332
 
113302
- _context12.t0 = header;
113303
- _context12.next = 16;
113333
+ _context13.t0 = header;
113334
+ _context13.next = 16;
113304
113335
  return renderPaneIconTray(td, {
113305
113336
  hideList: showHeader
113306
113337
  });
113307
113338
 
113308
113339
  case 16:
113309
- _context12.t1 = _context12.sent;
113340
+ _context13.t1 = _context13.sent;
113310
113341
 
113311
- _context12.t0.appendChild.call(_context12.t0, _context12.t1);
113342
+ _context13.t0.appendChild.call(_context13.t0, _context13.t1);
113312
113343
 
113313
113344
  // set DOM methods
113314
113345
  tr.firstChild.tabulatorSelect = function () {
@@ -113319,14 +113350,14 @@ function _default(context) {
113319
113350
  setSelected(this, false);
113320
113351
  };
113321
113352
 
113322
- return _context12.abrupt("return", tr);
113353
+ return _context13.abrupt("return", tr);
113323
113354
 
113324
113355
  case 21:
113325
113356
  case "end":
113326
- return _context12.stop();
113357
+ return _context13.stop();
113327
113358
  }
113328
113359
  }
113329
- }, _callee11);
113360
+ }, _callee12);
113330
113361
  }));
113331
113362
  return _expandedHeaderTR.apply(this, arguments);
113332
113363
  }
@@ -121963,25 +121994,26 @@ Object.defineProperty(exports, "__esModule", {
121963
121994
  });
121964
121995
  exports["default"] = void 0;
121965
121996
  var _default = {
121966
- buildTime: '2022-01-28T10:16:20Z',
121967
- commit: 'ad1ef0272c97b0830f9cb8d74ab8d42af173bcc1',
121997
+ buildTime: '2022-02-09T16:31:11Z',
121998
+ commit: '0d8bceeba53c989c3ab9d5b9a86b786c6977b999',
121968
121999
  npmInfo: {
121969
- 'solid-panes': '3.5.15',
121970
- npm: '6.14.13',
121971
- ares: '1.17.1',
121972
- brotli: '1.0.9',
121973
- cldr: '39.0',
121974
- icu: '69.1',
121975
- llhttp: '2.1.3',
121976
- modules: '83',
121977
- napi: '8',
121978
- nghttp2: '1.42.0',
121979
- node: '14.17.3',
121980
- openssl: '1.1.1k',
121981
- tz: '2021a',
121982
- unicode: '13.0',
121983
- uv: '1.41.0',
121984
- v8: '8.4.371.23-node.67',
122000
+ 'solid-panes': '3.5.16-alpha',
122001
+ npm: '6.10.0',
122002
+ ares: '1.15.0',
122003
+ brotli: '1.0.7',
122004
+ cldr: '35.1',
122005
+ http_parser: '2.8.0',
122006
+ icu: '64.2',
122007
+ llhttp: '1.1.4',
122008
+ modules: '72',
122009
+ napi: '4',
122010
+ nghttp2: '1.39.1',
122011
+ node: '12.7.0',
122012
+ openssl: '1.1.1c',
122013
+ tz: '2019a',
122014
+ unicode: '12.1',
122015
+ uv: '1.30.1',
122016
+ v8: '7.5.288.22-node.16',
121985
122017
  zlib: '1.2.11'
121986
122018
  }
121987
122019
  };
@@ -127234,7 +127266,6 @@ var UI = {
127234
127266
  var $rdf = UI.rdf;
127235
127267
  var BOOK = $rdf.Namespace('http://www.w3.org/2002/01/bookmark#');
127236
127268
  var BOOKMARK_ICON = 'noun_45961.svg';
127237
- var kb = _logic.store;
127238
127269
  var label = utils.label;
127239
127270
  var dom = window.document || null;
127240
127271
  /** Create a resource if it really does not exist
@@ -127245,19 +127276,20 @@ var dom = window.document || null;
127245
127276
 
127246
127277
  function createIfNotExists(doc) {
127247
127278
  return new Promise(function (resolve, reject) {
127248
- kb.fetcher.load(doc).then(function (response) {
127249
- debug.log('createIfNotExists doc exists, all good ' + doc); // kb.fetcher.webOperation('HEAD', doc.uri).then(response => {
127279
+ _logic.store.fetcher.load(doc).then(function (response) {
127280
+ debug.log('createIfNotExists doc exists, all good ' + doc); // store.fetcher.webOperation('HEAD', doc.uri).then(response => {
127250
127281
 
127251
127282
  resolve(response);
127252
127283
  }, function (err) {
127253
127284
  if (err.response.status === 404) {
127254
127285
  debug.log('createIfNotExists doc does NOT exist, will create... ' + doc);
127255
- kb.fetcher.webOperation('PUT', doc.uri, {
127286
+
127287
+ _logic.store.fetcher.webOperation('PUT', doc.uri, {
127256
127288
  data: '',
127257
127289
  contentType: 'text/turtle'
127258
127290
  }).then(function (response) {
127259
127291
  // fetcher.requested[doc.uri] = 'done' // do not need to read ?? but no headers
127260
- delete kb.fetcher.requested[doc.uri]; // delete cached 404 error
127292
+ delete _logic.store.fetcher.requested[doc.uri]; // delete cached 404 error
127261
127293
 
127262
127294
  debug.log('createIfNotExists doc created ok ' + doc);
127263
127295
  resolve(response);
@@ -127276,13 +127308,14 @@ function createIfNotExists(doc) {
127276
127308
 
127277
127309
  function updatePromise(del, ins) {
127278
127310
  return new Promise(function (resolve, reject) {
127279
- kb.updater.update(del, ins, function (uri, ok, errorBody) {
127311
+ _logic.store.updater.update(del, ins, function (uri, ok, errorBody) {
127280
127312
  if (!ok) {
127281
127313
  reject(new Error(errorBody));
127282
127314
  } else {
127283
127315
  resolve();
127284
127316
  }
127285
127317
  }); // callback
127318
+
127286
127319
  }); // promise
127287
127320
  } // export findBookmarkDocument,
127288
127321
 
@@ -127411,8 +127444,8 @@ function _addBookmark() {
127411
127444
  throw new Error('Must be logged on to add Bookmark');
127412
127445
 
127413
127446
  case 4:
127414
- author = kb.any(target, ns.foaf('maker'));
127415
- title = label(author) + ': ' + kb.anyValue(target, ns.sioc('content')).slice(0, 80); // @@ add chat title too?
127447
+ author = _logic.store.any(target, ns.foaf('maker'));
127448
+ title = label(author) + ': ' + _logic.store.anyValue(target, ns.sioc('content')).slice(0, 80); // @@ add chat title too?
127416
127449
 
127417
127450
  bookmarkDoc = context.bookmarkDocument;
127418
127451
  bookmark = UI.widgets.newThing(bookmarkDoc, title);
@@ -127457,10 +127490,10 @@ function _toggleBookmark() {
127457
127490
  switch (_context3.prev = _context3.next) {
127458
127491
  case 0:
127459
127492
  _context3.next = 2;
127460
- return kb.fetcher.load(userContext.bookmarkDocument);
127493
+ return _logic.store.fetcher.load(userContext.bookmarkDocument);
127461
127494
 
127462
127495
  case 2:
127463
- bookmarks = kb.each(null, BOOK('recalls'), target, userContext.bookmarkDocument);
127496
+ bookmarks = _logic.store.each(null, BOOK('recalls'), target, userContext.bookmarkDocument);
127464
127497
 
127465
127498
  if (!bookmarks.length) {
127466
127499
  _context3.next = 24;
@@ -127485,7 +127518,7 @@ function _toggleBookmark() {
127485
127518
 
127486
127519
  _context3.prev = 8;
127487
127520
  _context3.next = 11;
127488
- return updatePromise(kb.connectedStatements(bookmarks[i]), []);
127521
+ return updatePromise(_logic.store.connectedStatements(bookmarks[i]), []);
127489
127522
 
127490
127523
  case 11:
127491
127524
  bookmarkButton.style.backgroundColor = 'white';
@@ -127547,10 +127580,10 @@ function _renderBookmarksButton() {
127547
127580
  switch (_context4.prev = _context4.next) {
127548
127581
  case 0:
127549
127582
  _context4.next = 2;
127550
- return kb.fetcher.load(userContext.bookmarkDocument);
127583
+ return _logic.store.fetcher.load(userContext.bookmarkDocument);
127551
127584
 
127552
127585
  case 2:
127553
- bookmarked = kb.any(null, BOOK('recalls'), bookmarkButton.target, userContext.bookmarkDocument);
127586
+ bookmarked = _logic.store.any(null, BOOK('recalls'), bookmarkButton.target, userContext.bookmarkDocument);
127554
127587
  bookmarkButton.style = UI.style.buttonStyle;
127555
127588
  if (bookmarked) bookmarkButton.style.backgroundColor = 'yellow';
127556
127589
 
@@ -127596,6 +127629,357 @@ function _renderBookmarksButton() {
127596
127629
 
127597
127630
  /***/ }),
127598
127631
 
127632
+ /***/ "./node_modules/solid-ui/lib/chat/chatLogic.js":
127633
+ /*!*****************************************************!*\
127634
+ !*** ./node_modules/solid-ui/lib/chat/chatLogic.js ***!
127635
+ \*****************************************************/
127636
+ /*! no static exports found */
127637
+ /***/ (function(module, exports, __webpack_require__) {
127638
+
127639
+ "use strict";
127640
+
127641
+
127642
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/interopRequireDefault.js");
127643
+
127644
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/typeof.js");
127645
+
127646
+ Object.defineProperty(exports, "__esModule", {
127647
+ value: true
127648
+ });
127649
+ exports.ChatChannel = void 0;
127650
+ exports._createIfNotExists = _createIfNotExists;
127651
+ exports.isDeleted = isDeleted;
127652
+ exports.isHidden = isHidden;
127653
+ exports.isReplaced = isReplaced;
127654
+ exports.mostRecentVersion = mostRecentVersion;
127655
+ exports.nick = nick;
127656
+ exports.originalVersion = originalVersion;
127657
+
127658
+ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/regenerator/index.js"));
127659
+
127660
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
127661
+
127662
+ var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/classCallCheck.js"));
127663
+
127664
+ var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/createClass.js"));
127665
+
127666
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./node_modules/solid-ui/lib/debug.js"));
127667
+
127668
+ var _index = __webpack_require__(/*! ../authn/index */ "./node_modules/solid-ui/lib/authn/index.js");
127669
+
127670
+ var _dateFolder = __webpack_require__(/*! ./dateFolder */ "./node_modules/solid-ui/lib/chat/dateFolder.js");
127671
+
127672
+ var _logic = __webpack_require__(/*! ../logic */ "./node_modules/solid-ui/lib/logic.js");
127673
+
127674
+ var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./node_modules/solid-ui/lib/ns.js"));
127675
+
127676
+ var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
127677
+
127678
+ var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./node_modules/solid-ui/lib/utils/index.js"));
127679
+
127680
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
127681
+
127682
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
127683
+
127684
+ /**
127685
+ * Contains the [[ChatChannel]] class and logic for Solid Chat
127686
+ * @packageDocumentation
127687
+ */
127688
+ // pull in first avoid cross-refs
127689
+
127690
+ /* The Solid logic for a 'LongChat'
127691
+ */
127692
+
127693
+ /**
127694
+ * Common code for a chat (discussion area of messages about something)
127695
+ * This version runs over a series of files for different time periods
127696
+ *
127697
+ * Parameters for the whole chat like its title are stored on
127698
+ * index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
127699
+ *
127700
+ */
127701
+ var ChatChannel = /*#__PURE__*/function () {
127702
+ function ChatChannel(channel, options) {
127703
+ (0, _classCallCheck2["default"])(this, ChatChannel);
127704
+ this.channel = channel;
127705
+ this.channelRoot = channel.doc();
127706
+ this.options = options;
127707
+ this.dateFolder = new _dateFolder.DateFolder(this.channelRoot, 'chat.ttl');
127708
+ this.div = null; // : HTMLElement
127709
+ }
127710
+ /* Store a new message in the web,
127711
+ */
127712
+
127713
+
127714
+ (0, _createClass2["default"])(ChatChannel, [{
127715
+ key: "createMessage",
127716
+ value: function () {
127717
+ var _createMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(text) {
127718
+ return _regenerator["default"].wrap(function _callee$(_context) {
127719
+ while (1) {
127720
+ switch (_context.prev = _context.next) {
127721
+ case 0:
127722
+ return _context.abrupt("return", this.updateMessage(text));
127723
+
127724
+ case 1:
127725
+ case "end":
127726
+ return _context.stop();
127727
+ }
127728
+ }
127729
+ }, _callee, this);
127730
+ }));
127731
+
127732
+ function createMessage(_x) {
127733
+ return _createMessage.apply(this, arguments);
127734
+ }
127735
+
127736
+ return createMessage;
127737
+ }()
127738
+ /* Store a new message in the web,
127739
+ as a replacement for an existing one.
127740
+ The old one iis left, and the two are linked
127741
+ */
127742
+
127743
+ }, {
127744
+ key: "updateMessage",
127745
+ value: function () {
127746
+ var _updateMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(text) {
127747
+ var oldMsg,
127748
+ deleteIt,
127749
+ sts,
127750
+ now,
127751
+ timestamp,
127752
+ dateStamp,
127753
+ chatDocument,
127754
+ message,
127755
+ me,
127756
+ msg,
127757
+ _args2 = arguments;
127758
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
127759
+ while (1) {
127760
+ switch (_context2.prev = _context2.next) {
127761
+ case 0:
127762
+ oldMsg = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
127763
+ deleteIt = _args2.length > 2 ? _args2[2] : undefined;
127764
+ sts = [];
127765
+ now = new Date();
127766
+ timestamp = '' + now.getTime();
127767
+ dateStamp = $rdf.term(now);
127768
+ chatDocument = oldMsg ? oldMsg.doc() : this.dateFolder.leafDocumentFromDate(now);
127769
+ message = _logic.store.sym(chatDocument.uri + '#' + 'Msg' + timestamp); // const content = store.literal(text)
127770
+
127771
+ me = _index.authn.currentUser(); // If already logged on
127772
+
127773
+ if (oldMsg) {
127774
+ // edit message replaces old one
127775
+ sts.push($rdf.st(mostRecentVersion(oldMsg), ns.dct('isReplacedBy'), message, chatDocument));
127776
+
127777
+ if (deleteIt) {
127778
+ sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
127779
+ }
127780
+ } else {
127781
+ // link new message to channel
127782
+ sts.push($rdf.st(this.channel, ns.wf('message'), message, chatDocument));
127783
+ }
127784
+
127785
+ sts.push($rdf.st(message, ns.sioc('content'), _logic.store.literal(text), chatDocument));
127786
+ sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
127787
+
127788
+ if (me) {
127789
+ sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
127790
+ }
127791
+
127792
+ _context2.prev = 13;
127793
+ _context2.next = 16;
127794
+ return _logic.store.updater.update([], sts);
127795
+
127796
+ case 16:
127797
+ _context2.next = 24;
127798
+ break;
127799
+
127800
+ case 18:
127801
+ _context2.prev = 18;
127802
+ _context2.t0 = _context2["catch"](13);
127803
+ msg = 'Error saving chat message: ' + _context2.t0;
127804
+ debug.warn(msg);
127805
+ alert(msg);
127806
+ throw new Error(msg);
127807
+
127808
+ case 24:
127809
+ return _context2.abrupt("return", message);
127810
+
127811
+ case 25:
127812
+ case "end":
127813
+ return _context2.stop();
127814
+ }
127815
+ }
127816
+ }, _callee2, this, [[13, 18]]);
127817
+ }));
127818
+
127819
+ function updateMessage(_x2) {
127820
+ return _updateMessage.apply(this, arguments);
127821
+ }
127822
+
127823
+ return updateMessage;
127824
+ }()
127825
+ /* Mark a message as deleted
127826
+ * Wee add a new version of the message,m witha deletion flag (deletion date)
127827
+ * so that the deletion can be revoked by adding another non-deleted update
127828
+ */
127829
+
127830
+ }, {
127831
+ key: "deleteMessage",
127832
+ value: function () {
127833
+ var _deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(message) {
127834
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
127835
+ while (1) {
127836
+ switch (_context3.prev = _context3.next) {
127837
+ case 0:
127838
+ return _context3.abrupt("return", this.updateMessage('(message deleted)', message, true));
127839
+
127840
+ case 1:
127841
+ case "end":
127842
+ return _context3.stop();
127843
+ }
127844
+ }
127845
+ }, _callee3, this);
127846
+ }));
127847
+
127848
+ function deleteMessage(_x3) {
127849
+ return _deleteMessage.apply(this, arguments);
127850
+ }
127851
+
127852
+ return deleteMessage;
127853
+ }()
127854
+ }]);
127855
+ return ChatChannel;
127856
+ }(); // class ChatChannel
127857
+
127858
+
127859
+ exports.ChatChannel = ChatChannel;
127860
+
127861
+ function originalVersion(message) {
127862
+ var msg = message;
127863
+
127864
+ while (msg) {
127865
+ message = msg;
127866
+ msg = _logic.store.any(null, ns.dct('isReplacedBy'), message, message.doc());
127867
+ }
127868
+
127869
+ return message;
127870
+ }
127871
+
127872
+ function mostRecentVersion(message) {
127873
+ var msg = message;
127874
+
127875
+ while (msg) {
127876
+ message = msg;
127877
+ msg = _logic.store.any(message, ns.dct('isReplacedBy'), null, message.doc());
127878
+ }
127879
+
127880
+ return message;
127881
+ }
127882
+
127883
+ function isDeleted(message) {
127884
+ return _logic.store.holds(message, ns.schema('dateDeleted'), null, message.doc());
127885
+ }
127886
+
127887
+ function isReplaced(message) {
127888
+ return _logic.store.holds(message, ns.dct('isReplacedBy'), null, message.doc());
127889
+ }
127890
+
127891
+ function isHidden(message) {
127892
+ return this.isDeleted(message) || this.isReplaced(message);
127893
+ } // A Nickname for a person
127894
+
127895
+
127896
+ function nick(person) {
127897
+ var s = _logic.store.any(person, ns.foaf('nick'));
127898
+
127899
+ if (s) return '' + s.value;
127900
+ return '' + utils.label(person);
127901
+ }
127902
+
127903
+ function _createIfNotExists(_x4) {
127904
+ return _createIfNotExists2.apply(this, arguments);
127905
+ } // ends
127906
+
127907
+
127908
+ function _createIfNotExists2() {
127909
+ _createIfNotExists2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(doc) {
127910
+ var contentType,
127911
+ data,
127912
+ response,
127913
+ _args4 = arguments;
127914
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
127915
+ while (1) {
127916
+ switch (_context4.prev = _context4.next) {
127917
+ case 0:
127918
+ contentType = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 'text/turtle';
127919
+ data = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : '';
127920
+ _context4.prev = 2;
127921
+ _context4.next = 5;
127922
+ return _logic.store.fetcher.load(doc);
127923
+
127924
+ case 5:
127925
+ response = _context4.sent;
127926
+ _context4.next = 28;
127927
+ break;
127928
+
127929
+ case 8:
127930
+ _context4.prev = 8;
127931
+ _context4.t0 = _context4["catch"](2);
127932
+
127933
+ if (!(_context4.t0.response.status === 404)) {
127934
+ _context4.next = 26;
127935
+ break;
127936
+ }
127937
+
127938
+ debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
127939
+ _context4.prev = 12;
127940
+ _context4.next = 15;
127941
+ return _logic.store.fetcher.webOperation('PUT', doc.uri, {
127942
+ data: data,
127943
+ contentType: contentType
127944
+ });
127945
+
127946
+ case 15:
127947
+ response = _context4.sent;
127948
+ _context4.next = 22;
127949
+ break;
127950
+
127951
+ case 18:
127952
+ _context4.prev = 18;
127953
+ _context4.t1 = _context4["catch"](12);
127954
+ debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context4.t1);
127955
+ throw _context4.t1;
127956
+
127957
+ case 22:
127958
+ delete _logic.store.fetcher.requested[doc.uri]; // delete cached 404 error
127959
+ // debug.log('createIfNotExists doc created ok ' + doc)
127960
+
127961
+ return _context4.abrupt("return", response);
127962
+
127963
+ case 26:
127964
+ debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context4.t0);
127965
+ throw _context4.t0;
127966
+
127967
+ case 28:
127968
+ return _context4.abrupt("return", response);
127969
+
127970
+ case 29:
127971
+ case "end":
127972
+ return _context4.stop();
127973
+ }
127974
+ }
127975
+ }, _callee4, null, [[2, 8], [12, 18]]);
127976
+ }));
127977
+ return _createIfNotExists2.apply(this, arguments);
127978
+ }
127979
+ //# sourceMappingURL=chatLogic.js.map
127980
+
127981
+ /***/ }),
127982
+
127599
127983
  /***/ "./node_modules/solid-ui/lib/chat/dateFolder.js":
127600
127984
  /*!******************************************************!*\
127601
127985
  !*** ./node_modules/solid-ui/lib/chat/dateFolder.js ***!
@@ -127637,14 +128021,14 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
127637
128021
 
127638
128022
  /**
127639
128023
  * Contains the [[DateFolder]] class
127640
- * @packageDocumentation
128024
+ * This tracks data stored in dated folders and sub-folders
128025
+ *
127641
128026
  */
127642
128027
  // pull in first avoid cross-refs
127643
- var kb = _logic.store;
128028
+
127644
128029
  /**
127645
128030
  * Track back through the YYYY/MM/DD tree to find the previous/next day
127646
128031
  */
127647
-
127648
128032
  var DateFolder = /*#__PURE__*/function () {
127649
128033
  function DateFolder(rootThing, leafFileName, membershipProperty) {
127650
128034
  (0, _classCallCheck2["default"])(this, DateFolder);
@@ -127668,7 +128052,7 @@ var DateFolder = /*#__PURE__*/function () {
127668
128052
  var path = isoDate.split('T')[0].replace(/-/g, '/'); // Like "2018/05/07"
127669
128053
 
127670
128054
  path = this.root.dir().uri + path + '/' + this.leafFileName;
127671
- return kb.sym(path);
128055
+ return _logic.store.sym(path);
127672
128056
  }
127673
128057
  /* Generate a date object from the leaf file name
127674
128058
  */
@@ -127730,12 +128114,12 @@ var DateFolder = /*#__PURE__*/function () {
127730
128114
  }
127731
128115
 
127732
128116
  _folder = siblings.pop();
127733
- leafDocument = kb.sym(_folder.uri + thisDateFolder.leafFileName);
128117
+ leafDocument = _logic.store.sym(_folder.uri + thisDateFolder.leafFileName);
127734
128118
  _context.next = 10;
127735
- return kb.fetcher.load(leafDocument);
128119
+ return _logic.store.fetcher.load(leafDocument);
127736
128120
 
127737
128121
  case 10:
127738
- if (!(kb.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
128122
+ if (!(_logic.store.statementsMatching(null, ns.dct('created'), null, leafDocument).length > 0)) {
127739
128123
  _context.next = 12;
127740
128124
  break;
127741
128125
  }
@@ -127779,10 +128163,10 @@ var DateFolder = /*#__PURE__*/function () {
127779
128163
  // debug.log(' previousPeriod level' + level + ' file ' + file)
127780
128164
  parent = file.dir();
127781
128165
  _context2.next = 7;
127782
- return kb.fetcher.load(parent);
128166
+ return _logic.store.fetcher.load(parent);
127783
128167
 
127784
128168
  case 7:
127785
- siblings = kb.each(parent, ns.ldp('contains'));
128169
+ siblings = _logic.store.each(parent, ns.ldp('contains'));
127786
128170
  siblings = siblings.filter(younger);
127787
128171
  _context2.next = 11;
127788
128172
  return lastNonEmpty(siblings);
@@ -127821,10 +128205,10 @@ var DateFolder = /*#__PURE__*/function () {
127821
128205
 
127822
128206
  case 21:
127823
128207
  _context2.next = 23;
127824
- return kb.fetcher.load(uncle);
128208
+ return _logic.store.fetcher.load(uncle);
127825
128209
 
127826
128210
  case 23:
127827
- cousins = kb.each(uncle, ns.ldp('contains'));
128211
+ cousins = _logic.store.each(uncle, ns.ldp('contains'));
127828
128212
  _context2.next = 26;
127829
128213
  return lastNonEmpty(cousins);
127830
128214
 
@@ -127860,7 +128244,7 @@ var DateFolder = /*#__PURE__*/function () {
127860
128244
  break;
127861
128245
  }
127862
128246
 
127863
- doc = kb.sym(found.uri + this.leafFileName);
128247
+ doc = _logic.store.sym(found.uri + this.leafFileName);
127864
128248
  return _context3.abrupt("return", this.dateFromLeafDocument(doc));
127865
128249
 
127866
128250
  case 10:
@@ -128031,152 +128415,53 @@ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_m
128031
128415
  Object.defineProperty(exports, "__esModule", {
128032
128416
  value: true
128033
128417
  });
128034
- exports.createIfNotExists = createIfNotExists;
128035
128418
  exports.desktopNotification = desktopNotification;
128036
128419
  exports.infiniteMessageArea = infiniteMessageArea;
128420
+ exports.insertMessageIntoTable = insertMessageIntoTable;
128037
128421
 
128038
128422
  var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/regenerator/index.js"));
128039
128423
 
128040
128424
  var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
128041
128425
 
128042
- var _index = __webpack_require__(/*! ../authn/index */ "./node_modules/solid-ui/lib/authn/index.js");
128043
-
128044
128426
  var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./node_modules/solid-ui/lib/debug.js"));
128045
128427
 
128046
128428
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./node_modules/solid-ui/lib/iconBase.js");
128047
128429
 
128048
128430
  var _logic = __webpack_require__(/*! ../logic */ "./node_modules/solid-ui/lib/logic.js");
128049
128431
 
128050
- var _index2 = __webpack_require__(/*! ../media/index */ "./node_modules/solid-ui/lib/media/index.js");
128051
-
128052
128432
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./node_modules/solid-ui/lib/ns.js"));
128053
128433
 
128054
- var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./node_modules/solid-ui/lib/pad.js"));
128055
-
128056
- var _dateFolder = __webpack_require__(/*! ./dateFolder */ "./node_modules/solid-ui/lib/chat/dateFolder.js");
128434
+ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./node_modules/solid-ui/lib/chat/chatLogic.js");
128057
128435
 
128058
128436
  var _message = __webpack_require__(/*! ./message */ "./node_modules/solid-ui/lib/chat/message.js");
128059
128437
 
128060
- var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./node_modules/solid-ui/lib/chat/bookmarks.js");
128061
-
128062
128438
  var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
128063
128439
 
128064
- var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./node_modules/solid-ui/lib/style.js"));
128065
-
128066
- var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./node_modules/solid-ui/lib/utils/index.js"));
128067
-
128068
128440
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./node_modules/solid-ui/lib/widgets/index.js"));
128069
128441
 
128070
128442
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
128071
128443
 
128072
128444
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
128073
128445
 
128074
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
128075
-
128076
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
128077
-
128078
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
128079
-
128080
- var UI = {
128081
- authn: _index.authn,
128082
- icons: _iconBase.icons,
128083
- ns: ns,
128084
- media: _index2.media,
128085
- pad: pad,
128086
- $rdf: $rdf,
128087
- store: _logic.store,
128088
- style: style,
128089
- utils: utils,
128090
- widgets: widgets
128091
- };
128092
- /* global alert */
128093
-
128094
- var SERVER_MKDIRP_BUG = false; // Set false timbl 2021-10-31 should be fixed by now
128095
-
128096
- function createIfNotExists(_x) {
128097
- return _createIfNotExists.apply(this, arguments);
128098
- }
128099
-
128100
- function _createIfNotExists() {
128101
- _createIfNotExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(doc) {
128102
- var contentType,
128103
- data,
128104
- fetcher,
128105
- response,
128106
- _args = arguments;
128107
- return _regenerator["default"].wrap(function _callee$(_context) {
128108
- while (1) {
128109
- switch (_context.prev = _context.next) {
128110
- case 0:
128111
- contentType = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'text/turtle';
128112
- data = _args.length > 2 && _args[2] !== undefined ? _args[2] : '';
128113
- fetcher = UI.store.fetcher;
128114
- _context.prev = 3;
128115
- _context.next = 6;
128116
- return fetcher.load(doc);
128117
-
128118
- case 6:
128119
- response = _context.sent;
128120
- _context.next = 29;
128121
- break;
128122
-
128123
- case 9:
128124
- _context.prev = 9;
128125
- _context.t0 = _context["catch"](3);
128126
-
128127
- if (!(_context.t0.response.status === 404)) {
128128
- _context.next = 27;
128129
- break;
128130
- }
128131
-
128132
- debug.log('createIfNotExists: doc does NOT exist, will create... ' + doc);
128133
- _context.prev = 13;
128134
- _context.next = 16;
128135
- return fetcher.webOperation('PUT', doc.uri, {
128136
- data: data,
128137
- contentType: contentType
128138
- });
128139
-
128140
- case 16:
128141
- response = _context.sent;
128142
- _context.next = 23;
128143
- break;
128144
-
128145
- case 19:
128146
- _context.prev = 19;
128147
- _context.t1 = _context["catch"](13);
128148
- debug.log('createIfNotExists doc FAILED: ' + doc + ': ' + _context.t1);
128149
- throw _context.t1;
128150
-
128151
- case 23:
128152
- delete fetcher.requested[doc.uri]; // delete cached 404 error
128153
- // debug.log('createIfNotExists doc created ok ' + doc)
128154
-
128155
- return _context.abrupt("return", response);
128156
-
128157
- case 27:
128158
- debug.log('createIfNotExists doc load error NOT 404: ' + doc + ': ' + _context.t0);
128159
- throw _context.t0;
128160
-
128161
- case 29:
128162
- return _context.abrupt("return", response);
128163
-
128164
- case 30:
128165
- case "end":
128166
- return _context.stop();
128167
- }
128168
- }
128169
- }, _callee, null, [[3, 9], [13, 19]]);
128170
- }));
128171
- return _createIfNotExists.apply(this, arguments);
128172
- }
128173
-
128446
+ /**
128447
+ * Contains the [[infiniteMessageArea]] class
128448
+ * @packageDocumentation
128449
+ */
128450
+ // import { authn } from '../authn/index'
128451
+ // import { media } from '../media/index'
128452
+ // import * as pad from '../pad'
128453
+ // import { DateFolder } from './dateFolder'
128454
+ // import { findBookmarkDocument } from './bookmarks'
128455
+ // pull in first avoid cross-refs
128456
+ // import * as style from '../style'
128457
+ // import * as utils from '../utils'
128458
+ // const UI = { authn, icons, ns, media, pad, $rdf, store, style, utils, widgets }
128174
128459
  function desktopNotification(str) {
128175
128460
  // Let's check if the browser supports notifications
128176
128461
  if (!('Notification' in window)) {
128177
- debug.warn('This browser does not support desktop notification');
128462
+ debug.warn('This browser does no t support desktop notification');
128178
128463
  } else if (Notification.permission === 'granted') {
128179
- // Let's check whether notification permissions have already been granted
128464
+ // Let's check whether notificatio n permissions have already been granted
128180
128465
  // eslint-disable-next-line no-new
128181
128466
  new Notification(str);
128182
128467
  } else if (Notification.permission !== 'denied') {
@@ -128192,33 +128477,84 @@ function desktopNotification(str) {
128192
128477
  // want to be respectful there is no need to bother them any more.
128193
128478
 
128194
128479
  }
128480
+ /**
128481
+ * Renders a chat message inside a `messageTable`
128482
+ */
128483
+
128484
+
128485
+ function insertMessageIntoTable(channelObject, messageTable, message, fresh, options, userContext) {
128486
+ var messageRow = (0, _message.renderMessageRow)(channelObject, message, fresh, options, userContext); // const message = messageRow.AJAR_subject
128487
+
128488
+ if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
128489
+ messageRow.style.backgroundColor = 'yellow';
128490
+ options.selectedElement = messageRow;
128491
+ messageTable.selectedElement = messageRow;
128492
+ }
128493
+
128494
+ var done = false;
128495
+
128496
+ for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
128497
+ if (!ele) {
128498
+ // empty
128499
+ break;
128500
+ }
128501
+
128502
+ var newestFirst = options.newestfirst === true;
128503
+ var dateString = messageRow.AJAR_date;
128504
+
128505
+ if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
128506
+ messageTable.insertBefore(messageRow, ele);
128507
+ done = true;
128508
+ break;
128509
+ }
128510
+ }
128511
+
128512
+ if (!done) {
128513
+ messageTable.appendChild(messageRow);
128514
+ }
128515
+ }
128195
128516
  /**
128196
128517
  * Common code for a chat (discussion area of messages about something)
128197
128518
  * This version runs over a series of files for different time periods
128198
128519
  *
128199
128520
  * Parameters for the whole chat like its title are stored on
128200
128521
  * index.ttl#this and the chats messages are stored in YYYY/MM/DD/chat.ttl
128522
+ *
128523
+ * Use to import store as param 2, now ignores it and uses the UI main store
128524
+ *
128525
+ * Options include:
128526
+
128527
+ - shiftEnterSendsMessage: Use shift/enter to send message, Enter to add newline, instead of the reverse.
128528
+ - authorDateOnLeft: Display the author's anme and date of the message in the left column instead of first above the content
128529
+ - selectedMessage: Display one message highlighted with the chat around it
128530
+ - solo: By itelf on a webpage, so user scroll anywhere in the web page scan scroll the chat.
128531
+ - newestFirst: Arrange the chat messages chronologically newest at the top insted of at the bottom
128532
+ - infinite: Use infinite scroll
128533
+ - showDeletedMessages: Show messages which have been delted as "deleted message". Otherwise hide them.
128534
+ - expandImagesInline: If a URI by itself in a message looks like an image URI, replace it with the image
128535
+ - inlineImageHeightEms: The height (in ems) of images expaned from their URIs in the chat.
128536
+
128201
128537
  */
128202
128538
 
128203
128539
 
128204
- function infiniteMessageArea(_x2, _x3, _x4, _x5) {
128540
+ function infiniteMessageArea(_x, _x2, _x3, _x4) {
128205
128541
  return _infiniteMessageArea.apply(this, arguments);
128206
128542
  }
128207
128543
 
128208
128544
  function _infiniteMessageArea() {
128209
- _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee17(dom, kb, chatChannel, options) {
128210
- var ns, WF, DCT, newestFirst, dateFolder, messageBodyStyle, div, menuButton, statusArea, userContext, me, updater, newMessageForm, syncMessages, addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, addNewTableIfNewDay, _addNewTableIfNewDay, appendCurrentMessages, _appendCurrentMessages, liveMessageTable, earliest, latest, lock, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent;
128545
+ _infiniteMessageArea = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(dom, wasStore, chatChannel, options) {
128546
+ var syncMessages, addMessage, insertPreviousMessages, _insertPreviousMessages, removePreviousMessages, createMessageTable, _createMessageTable, renderMessageTable, addNewChatDocumentIfNewDay, _addNewChatDocumentIfNewDay, appendCurrentMessages, _appendCurrentMessages, loadMoreWhereNeeded, _loadMoreWhereNeeded, loadInitialContent, _loadInitialContent, newestFirst, channelObject, dateFolder, div, statusArea, userContext, liveMessageTable, earliest, latest, lock;
128211
128547
 
128212
- return _regenerator["default"].wrap(function _callee17$(_context17) {
128548
+ return _regenerator["default"].wrap(function _callee12$(_context12) {
128213
128549
  while (1) {
128214
- switch (_context17.prev = _context17.next) {
128550
+ switch (_context12.prev = _context12.next) {
128215
128551
  case 0:
128216
128552
  _loadInitialContent = function _loadInitialContent3() {
128217
- _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16() {
128553
+ _loadInitialContent = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
128218
128554
  var yank, fixScroll, live, selectedDocument, now, todayDocument, selectedMessageTable, selectedDate;
128219
- return _regenerator["default"].wrap(function _callee16$(_context16) {
128555
+ return _regenerator["default"].wrap(function _callee11$(_context11) {
128220
128556
  while (1) {
128221
- switch (_context16.prev = _context16.next) {
128557
+ switch (_context11.prev = _context11.next) {
128222
128558
  case 0:
128223
128559
  fixScroll = function _fixScroll() {
128224
128560
  if (options.selectedElement) {
@@ -128246,27 +128582,27 @@ function _infiniteMessageArea() {
128246
128582
  }
128247
128583
 
128248
128584
  if (!(options.selectedMessage && !live)) {
128249
- _context16.next = 15;
128585
+ _context11.next = 15;
128250
128586
  break;
128251
128587
  }
128252
128588
 
128253
128589
  selectedDate = dateFolder.dateFromLeafDocument(selectedDocument);
128254
- _context16.next = 7;
128590
+ _context11.next = 7;
128255
128591
  return createMessageTable(selectedDate, live);
128256
128592
 
128257
128593
  case 7:
128258
- selectedMessageTable = _context16.sent;
128594
+ selectedMessageTable = _context11.sent;
128259
128595
  div.appendChild(selectedMessageTable);
128260
128596
  earliest.messageTable = selectedMessageTable;
128261
128597
  latest.messageTable = selectedMessageTable;
128262
128598
  yank();
128263
128599
  setTimeout(yank, 1000); // @@ kludge - restore position distubed by other cHANGES
128264
128600
 
128265
- _context16.next = 19;
128601
+ _context11.next = 19;
128266
128602
  break;
128267
128603
 
128268
128604
  case 15:
128269
- _context16.next = 17;
128605
+ _context11.next = 17;
128270
128606
  return appendCurrentMessages();
128271
128607
 
128272
128608
  case 17:
@@ -128274,7 +128610,7 @@ function _infiniteMessageArea() {
128274
128610
  latest.messageTable = liveMessageTable;
128275
128611
 
128276
128612
  case 19:
128277
- _context16.next = 21;
128613
+ _context11.next = 21;
128278
128614
  return loadMoreWhereNeeded(null, fixScroll);
128279
128615
 
128280
128616
  case 21:
@@ -128286,10 +128622,10 @@ function _infiniteMessageArea() {
128286
128622
 
128287
128623
  case 23:
128288
128624
  case "end":
128289
- return _context16.stop();
128625
+ return _context11.stop();
128290
128626
  }
128291
128627
  }
128292
- }, _callee16);
128628
+ }, _callee11);
128293
128629
  }));
128294
128630
  return _loadInitialContent.apply(this, arguments);
128295
128631
  };
@@ -128299,18 +128635,18 @@ function _infiniteMessageArea() {
128299
128635
  };
128300
128636
 
128301
128637
  _loadMoreWhereNeeded = function _loadMoreWhereNeeded3() {
128302
- _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(event, fixScroll) {
128638
+ _loadMoreWhereNeeded = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(event, fixScroll) {
128303
128639
  var freeze, magicZone, done, scrollBottom, scrollTop;
128304
- return _regenerator["default"].wrap(function _callee15$(_context15) {
128640
+ return _regenerator["default"].wrap(function _callee10$(_context10) {
128305
128641
  while (1) {
128306
- switch (_context15.prev = _context15.next) {
128642
+ switch (_context10.prev = _context10.next) {
128307
128643
  case 0:
128308
128644
  if (!lock) {
128309
- _context15.next = 2;
128645
+ _context10.next = 2;
128310
128646
  break;
128311
128647
  }
128312
128648
 
128313
- return _context15.abrupt("return");
128649
+ return _context10.abrupt("return");
128314
128650
 
128315
128651
  case 2:
128316
128652
  lock = true;
@@ -128320,12 +128656,12 @@ function _infiniteMessageArea() {
128320
128656
 
128321
128657
  case 5:
128322
128658
  if (!(div.scrollTop < magicZone && earliest.messageTable && !earliest.messageTable.initial && earliest.messageTable.extendBackwards)) {
128323
- _context15.next = 21;
128659
+ _context10.next = 21;
128324
128660
  break;
128325
128661
  }
128326
128662
 
128327
128663
  if (!(div.scrollHeight === 0)) {
128328
- _context15.next = 10;
128664
+ _context10.next = 10;
128329
128665
  break;
128330
128666
  }
128331
128667
 
@@ -128333,17 +128669,17 @@ function _infiniteMessageArea() {
128333
128669
  setTimeout(loadMoreWhereNeeded, 2000); // couple be less
128334
128670
 
128335
128671
  lock = false;
128336
- return _context15.abrupt("return");
128672
+ return _context10.abrupt("return");
128337
128673
 
128338
128674
  case 10:
128339
128675
  // console.log(' chat/loadMoreWhereNeeded: Going now')
128340
128676
  scrollBottom = div.scrollHeight - div.scrollTop;
128341
128677
  debug.log('infinite scroll: adding above: top ' + div.scrollTop);
128342
- _context15.next = 14;
128678
+ _context10.next = 14;
128343
128679
  return earliest.messageTable.extendBackwards();
128344
128680
 
128345
128681
  case 14:
128346
- done = _context15.sent;
128682
+ done = _context10.sent;
128347
128683
 
128348
128684
  if (freeze) {
128349
128685
  div.scrollTop = div.scrollHeight - scrollBottom;
@@ -128352,14 +128688,14 @@ function _infiniteMessageArea() {
128352
128688
  if (fixScroll) fixScroll();
128353
128689
 
128354
128690
  if (!done) {
128355
- _context15.next = 19;
128691
+ _context10.next = 19;
128356
128692
  break;
128357
128693
  }
128358
128694
 
128359
- return _context15.abrupt("break", 21);
128695
+ return _context10.abrupt("break", 21);
128360
128696
 
128361
128697
  case 19:
128362
- _context15.next = 5;
128698
+ _context10.next = 5;
128363
128699
  break;
128364
128700
 
128365
128701
  case 21:
@@ -128367,17 +128703,17 @@ function _infiniteMessageArea() {
128367
128703
  div.scrollHeight - div.scrollTop - div.clientHeight < magicZone && // we are scrolled right to the bottom
128368
128704
  latest.messageTable && !latest.messageTable["final"] && // there is more data to come
128369
128705
  latest.messageTable.extendForwards)) {
128370
- _context15.next = 33;
128706
+ _context10.next = 33;
128371
128707
  break;
128372
128708
  }
128373
128709
 
128374
128710
  scrollTop = div.scrollTop;
128375
128711
  debug.log('infinite scroll: adding below: bottom: ' + (div.scrollHeight - div.scrollTop - div.clientHeight));
128376
- _context15.next = 26;
128712
+ _context10.next = 26;
128377
128713
  return latest.messageTable.extendForwards();
128378
128714
 
128379
128715
  case 26:
128380
- done = _context15.sent;
128716
+ done = _context10.sent;
128381
128717
 
128382
128718
  // then add more data on the bottom
128383
128719
  if (freeze) {
@@ -128387,14 +128723,14 @@ function _infiniteMessageArea() {
128387
128723
  if (fixScroll) fixScroll();
128388
128724
 
128389
128725
  if (!done) {
128390
- _context15.next = 31;
128726
+ _context10.next = 31;
128391
128727
  break;
128392
128728
  }
128393
128729
 
128394
- return _context15.abrupt("break", 33);
128730
+ return _context10.abrupt("break", 33);
128395
128731
 
128396
128732
  case 31:
128397
- _context15.next = 21;
128733
+ _context10.next = 21;
128398
128734
  break;
128399
128735
 
128400
128736
  case 33:
@@ -128402,72 +128738,68 @@ function _infiniteMessageArea() {
128402
128738
 
128403
128739
  case 34:
128404
128740
  case "end":
128405
- return _context15.stop();
128741
+ return _context10.stop();
128406
128742
  }
128407
128743
  }
128408
- }, _callee15);
128744
+ }, _callee10);
128409
128745
  }));
128410
128746
  return _loadMoreWhereNeeded.apply(this, arguments);
128411
128747
  };
128412
128748
 
128413
- loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x18, _x19) {
128749
+ loadMoreWhereNeeded = function _loadMoreWhereNeeded2(_x10, _x11) {
128414
128750
  return _loadMoreWhereNeeded.apply(this, arguments);
128415
128751
  };
128416
128752
 
128417
128753
  _appendCurrentMessages = function _appendCurrentMessage2() {
128418
- _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14() {
128754
+ _appendCurrentMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
128419
128755
  var now, chatDocument, messageTable;
128420
- return _regenerator["default"].wrap(function _callee14$(_context14) {
128756
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
128421
128757
  while (1) {
128422
- switch (_context14.prev = _context14.next) {
128758
+ switch (_context9.prev = _context9.next) {
128423
128759
  case 0:
128424
128760
  now = new Date();
128425
- chatDocument = dateFolder.leafDocumentFromDate(now);
128426
- /* Don't actually make the documemnt until a message is sent @@@@@ WHEN SERVER FIXED
128427
- * currently server won't patch to a file ina non-existent directory
128428
- */
128761
+ chatDocument = dateFolder.leafDocumentFromDate(now); /// ///////////////////////////////////////////////////////////
128429
128762
 
128430
- /*
128431
- if (SERVER_MKDIRP_BUG) {
128432
- try {
128433
- await createIfNotExists(chatDocument)
128434
- } catch (e) {
128435
- div.appendChild(UI.widgets.errorMessageBlock(
128436
- dom, 'Problem accessing chat file: ' + e))
128437
- return
128438
- }
128439
- }
128440
- */
128441
- /// ///////////////////////////////////////////////////////////
128442
-
128443
- _context14.next = 4;
128763
+ _context9.next = 4;
128444
128764
  return createMessageTable(now, true);
128445
128765
 
128446
128766
  case 4:
128447
- messageTable = _context14.sent;
128767
+ messageTable = _context9.sent;
128448
128768
  div.appendChild(messageTable);
128769
+ div.refresh = /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
128770
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
128771
+ while (1) {
128772
+ switch (_context8.prev = _context8.next) {
128773
+ case 0:
128774
+ _context8.next = 2;
128775
+ return addNewChatDocumentIfNewDay(new Date());
128776
+
128777
+ case 2:
128778
+ syncMessages(chatChannel, messageTable); // @@ livemessagetable??
128779
+
128780
+ desktopNotification(chatChannel);
128781
+
128782
+ case 4:
128783
+ case "end":
128784
+ return _context8.stop();
128785
+ }
128786
+ }
128787
+ }, _callee8);
128788
+ })); // The short chat version the live update listening is done in the pane but we do it in the widget @@
128449
128789
 
128450
- div.refresh = function () {
128451
- // only the last messageTable is live
128452
- addNewTableIfNewDay(new Date()).then(function () {
128453
- syncMessages(chatChannel, messageTable);
128454
- desktopNotification(chatChannel);
128455
- });
128456
- }; // The short chat version fors live update in the pane but we do it in the widget
128457
-
128790
+ _logic.store.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
128458
128791
 
128459
- kb.updater.addDownstreamChangeListener(chatDocument, div.refresh); // Live update
128460
128792
 
128461
128793
  liveMessageTable = messageTable;
128462
128794
  latest.messageTable = liveMessageTable;
128463
- return _context14.abrupt("return", messageTable);
128795
+ return _context9.abrupt("return", messageTable);
128464
128796
 
128465
128797
  case 11:
128466
128798
  case "end":
128467
- return _context14.stop();
128799
+ return _context9.stop();
128468
128800
  }
128469
128801
  }
128470
- }, _callee14);
128802
+ }, _callee9);
128471
128803
  }));
128472
128804
  return _appendCurrentMessages.apply(this, arguments);
128473
128805
  };
@@ -128476,19 +128808,18 @@ function _infiniteMessageArea() {
128476
128808
  return _appendCurrentMessages.apply(this, arguments);
128477
128809
  };
128478
128810
 
128479
- _addNewTableIfNewDay = function _addNewTableIfNewDay3() {
128480
- _addNewTableIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(now) {
128811
+ _addNewChatDocumentIfNewDay = function _addNewChatDocumentIf2() {
128812
+ _addNewChatDocumentIfNewDay = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
128481
128813
  var newChatDocument, oldChatDocument, sts;
128482
- return _regenerator["default"].wrap(function _callee13$(_context13) {
128814
+ return _regenerator["default"].wrap(function _callee7$(_context7) {
128483
128815
  while (1) {
128484
- switch (_context13.prev = _context13.next) {
128816
+ switch (_context7.prev = _context7.next) {
128485
128817
  case 0:
128486
- // let now = new Date()
128487
128818
  // @@ Remove listener from previous table as it is now static
128488
- newChatDocument = dateFolder.leafDocumentFromDate(now);
128819
+ newChatDocument = dateFolder.leafDocumentFromDate(new Date());
128489
128820
 
128490
128821
  if (newChatDocument.sameTerm(latest.messageTable.chatDocument)) {
128491
- _context13.next = 7;
128822
+ _context7.next = 7;
128492
128823
  break;
128493
128824
  }
128494
128825
 
@@ -128499,36 +128830,37 @@ function _infiniteMessageArea() {
128499
128830
  }
128500
128831
 
128501
128832
  oldChatDocument = latest.messageTable.chatDocument;
128502
- _context13.next = 6;
128833
+ _context7.next = 6;
128503
128834
  return appendCurrentMessages();
128504
128835
 
128505
128836
  case 6:
128506
128837
  // Adding a link in the document will ping listeners to add the new block too
128507
- if (!kb.holds(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)) {
128838
+ if (!_logic.store.holds(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)) {
128508
128839
  sts = [$rdf.st(oldChatDocument, ns.rdfs('seeAlso'), newChatDocument, oldChatDocument)];
128509
- updater.update([], sts, function (ok, body) {
128510
- if (!ok) {
128511
- alert('Unable to link old message block to new one.' + body);
128512
- }
128513
- });
128840
+
128841
+ try {
128842
+ _logic.store.updater.update([], sts);
128843
+ } catch (err) {
128844
+ alert('Unable to link old chat file to new one:' + err);
128845
+ }
128514
128846
  }
128515
128847
 
128516
128848
  case 7:
128517
128849
  case "end":
128518
- return _context13.stop();
128850
+ return _context7.stop();
128519
128851
  }
128520
128852
  }
128521
- }, _callee13);
128853
+ }, _callee7);
128522
128854
  }));
128523
- return _addNewTableIfNewDay.apply(this, arguments);
128855
+ return _addNewChatDocumentIfNewDay.apply(this, arguments);
128524
128856
  };
128525
128857
 
128526
- addNewTableIfNewDay = function _addNewTableIfNewDay2(_x17) {
128527
- return _addNewTableIfNewDay.apply(this, arguments);
128858
+ addNewChatDocumentIfNewDay = function _addNewChatDocumentIf() {
128859
+ return _addNewChatDocumentIfNewDay.apply(this, arguments);
128528
128860
  };
128529
128861
 
128530
128862
  renderMessageTable = function _renderMessageTable(date, live) {
128531
- var scrollBackButton;
128863
+ var scrollBackbutton;
128532
128864
  var scrollForwardButton; /// ///////////////// Scroll down adding more above
128533
128865
 
128534
128866
  function extendBackwards() {
@@ -128536,23 +128868,23 @@ function _infiniteMessageArea() {
128536
128868
  }
128537
128869
 
128538
128870
  function _extendBackwards() {
128539
- _extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
128871
+ _extendBackwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
128540
128872
  var done;
128541
- return _regenerator["default"].wrap(function _callee7$(_context7) {
128873
+ return _regenerator["default"].wrap(function _callee$(_context) {
128542
128874
  while (1) {
128543
- switch (_context7.prev = _context7.next) {
128875
+ switch (_context.prev = _context.next) {
128544
128876
  case 0:
128545
- _context7.next = 2;
128877
+ _context.next = 2;
128546
128878
  return insertPreviousMessages(true);
128547
128879
 
128548
128880
  case 2:
128549
- done = _context7.sent;
128881
+ done = _context.sent;
128550
128882
 
128551
128883
  if (done) {
128552
- if (scrollBackButton) {
128553
- scrollBackButton.firstChild.setAttribute('src', UI.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
128884
+ if (scrollBackbutton) {
128885
+ scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg'); // T
128554
128886
 
128555
- scrollBackButton.disabled = true;
128887
+ scrollBackbutton.disabled = true;
128556
128888
  }
128557
128889
 
128558
128890
  messageTable.initial = true;
@@ -128560,67 +128892,67 @@ function _infiniteMessageArea() {
128560
128892
  messageTable.extendedBack = true;
128561
128893
  }
128562
128894
 
128563
- setScrollBackButtonIcon();
128564
- return _context7.abrupt("return", done);
128895
+ setScrollBackbuttonIcon();
128896
+ return _context.abrupt("return", done);
128565
128897
 
128566
128898
  case 6:
128567
128899
  case "end":
128568
- return _context7.stop();
128900
+ return _context.stop();
128569
128901
  }
128570
128902
  }
128571
- }, _callee7);
128903
+ }, _callee);
128572
128904
  }));
128573
128905
  return _extendBackwards.apply(this, arguments);
128574
128906
  }
128575
128907
 
128576
- function setScrollBackButtonIcon() {
128577
- if (!scrollBackButton) {
128908
+ function setScrollBackbuttonIcon() {
128909
+ if (!scrollBackbutton) {
128578
128910
  return;
128579
128911
  }
128580
128912
 
128581
128913
  var sense = messageTable.extendedBack ? !newestFirst : newestFirst;
128582
128914
  var scrollBackIcon = messageTable.initial ? 'noun_T-Block_1114655_000000.svg' : getScrollbackIcon(sense);
128583
- scrollBackButton.firstChild.setAttribute('src', UI.icons.iconBase + scrollBackIcon);
128915
+ scrollBackbutton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollBackIcon);
128584
128916
 
128585
128917
  function getScrollbackIcon(sense) {
128586
128918
  return sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
128587
128919
  }
128588
128920
  }
128589
128921
 
128590
- function scrollBackButtonHandler(_x15) {
128591
- return _scrollBackButtonHandler.apply(this, arguments);
128922
+ function scrollBackbuttonHandler(_x8) {
128923
+ return _scrollBackbuttonHandler.apply(this, arguments);
128592
128924
  } /// ////////////// Scroll up adding more below
128593
128925
 
128594
128926
 
128595
- function _scrollBackButtonHandler() {
128596
- _scrollBackButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(_event) {
128597
- return _regenerator["default"].wrap(function _callee8$(_context8) {
128927
+ function _scrollBackbuttonHandler() {
128928
+ _scrollBackbuttonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
128929
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
128598
128930
  while (1) {
128599
- switch (_context8.prev = _context8.next) {
128931
+ switch (_context2.prev = _context2.next) {
128600
128932
  case 0:
128601
128933
  if (!messageTable.extendedBack) {
128602
- _context8.next = 6;
128934
+ _context2.next = 6;
128603
128935
  break;
128604
128936
  }
128605
128937
 
128606
128938
  removePreviousMessages(true, messageTable);
128607
128939
  messageTable.extendedBack = false;
128608
- setScrollBackButtonIcon();
128609
- _context8.next = 8;
128940
+ setScrollBackbuttonIcon();
128941
+ _context2.next = 8;
128610
128942
  break;
128611
128943
 
128612
128944
  case 6:
128613
- _context8.next = 8;
128945
+ _context2.next = 8;
128614
128946
  return extendBackwards();
128615
128947
 
128616
128948
  case 8:
128617
128949
  case "end":
128618
- return _context8.stop();
128950
+ return _context2.stop();
128619
128951
  }
128620
128952
  }
128621
- }, _callee8);
128953
+ }, _callee2);
128622
128954
  }));
128623
- return _scrollBackButtonHandler.apply(this, arguments);
128955
+ return _scrollBackbuttonHandler.apply(this, arguments);
128624
128956
  }
128625
128957
 
128626
128958
  function extendForwards() {
@@ -128628,20 +128960,20 @@ function _infiniteMessageArea() {
128628
128960
  }
128629
128961
 
128630
128962
  function _extendForwards() {
128631
- _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
128963
+ _extendForwards = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
128632
128964
  var done;
128633
- return _regenerator["default"].wrap(function _callee9$(_context9) {
128965
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
128634
128966
  while (1) {
128635
- switch (_context9.prev = _context9.next) {
128967
+ switch (_context3.prev = _context3.next) {
128636
128968
  case 0:
128637
- _context9.next = 2;
128969
+ _context3.next = 2;
128638
128970
  return insertPreviousMessages(false);
128639
128971
 
128640
128972
  case 2:
128641
- done = _context9.sent;
128973
+ done = _context3.sent;
128642
128974
 
128643
128975
  if (done) {
128644
- scrollForwardButton.firstChild.setAttribute('src', UI.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
128976
+ scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + 'noun_T-Block_1114655_000000.svg');
128645
128977
  scrollForwardButton.disabled = true;
128646
128978
  messageTable["final"] = true;
128647
128979
  } else {
@@ -128649,14 +128981,14 @@ function _infiniteMessageArea() {
128649
128981
  }
128650
128982
 
128651
128983
  setScrollForwardButtonIcon();
128652
- return _context9.abrupt("return", done);
128984
+ return _context3.abrupt("return", done);
128653
128985
 
128654
128986
  case 6:
128655
128987
  case "end":
128656
- return _context9.stop();
128988
+ return _context3.stop();
128657
128989
  }
128658
128990
  }
128659
- }, _callee9);
128991
+ }, _callee3);
128660
128992
  }));
128661
128993
  return _extendForwards.apply(this, arguments);
128662
128994
  }
@@ -128665,37 +128997,48 @@ function _infiniteMessageArea() {
128665
128997
  var sense = messageTable.extendedForwards ? !newestFirst : newestFirst; // noun_T-Block_1114657_000000.svg
128666
128998
 
128667
128999
  var scrollForwardIcon = messageTable["final"] ? 'noun_T-Block_1114657_000000.svg' : getScrollForwardButtonIcon(sense);
128668
- scrollForwardButton.firstChild.setAttribute('src', UI.icons.iconBase + scrollForwardIcon);
129000
+ scrollForwardButton.firstChild.setAttribute('src', _iconBase.icons.iconBase + scrollForwardIcon);
128669
129001
 
128670
129002
  function getScrollForwardButtonIcon(sense) {
128671
129003
  return !sense ? 'noun_1369241.svg' : 'noun_1369237.svg';
128672
129004
  }
128673
129005
  }
128674
129006
 
128675
- function scrollForwardButtonHandler(_x16) {
129007
+ function scrollForwardButtonHandler(_x9) {
128676
129008
  return _scrollForwardButtonHandler.apply(this, arguments);
128677
129009
  } /// ///////////////////////
128678
129010
 
129011
+ /*
129012
+ options = options || {}
129013
+ options.authorDateOnLeft = true
129014
+ const newestFirst = options.newestFirst === '1' || options.newestFirst === true // hack for now
129015
+ const channelObject = new ChatChannel(chatChannel, options)
129016
+ const dateFolder = channelObject.dateFolder
129017
+ const div = dom.createElement('div')
129018
+ const statusArea = div.appendChild(dom.createElement('div'))
129019
+ const userContext = { dom, statusArea, div: statusArea } // logged on state, pointers to user's stuff
129020
+ */
129021
+
128679
129022
 
128680
129023
  function _scrollForwardButtonHandler() {
128681
- _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(_event) {
128682
- return _regenerator["default"].wrap(function _callee10$(_context10) {
129024
+ _scrollForwardButtonHandler = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(_event) {
129025
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
128683
129026
  while (1) {
128684
- switch (_context10.prev = _context10.next) {
129027
+ switch (_context4.prev = _context4.next) {
128685
129028
  case 0:
128686
129029
  if (!messageTable.extendedForwards) {
128687
- _context10.next = 6;
129030
+ _context4.next = 6;
128688
129031
  break;
128689
129032
  }
128690
129033
 
128691
129034
  removePreviousMessages(false, messageTable);
128692
129035
  messageTable.extendedForwards = false;
128693
129036
  setScrollForwardButtonIcon();
128694
- _context10.next = 9;
129037
+ _context4.next = 9;
128695
129038
  break;
128696
129039
 
128697
129040
  case 6:
128698
- _context10.next = 8;
129041
+ _context4.next = 8;
128699
129042
  return extendForwards();
128700
129043
 
128701
129044
  case 8:
@@ -128704,10 +129047,10 @@ function _infiniteMessageArea() {
128704
129047
 
128705
129048
  case 9:
128706
129049
  case "end":
128707
- return _context10.stop();
129050
+ return _context4.stop();
128708
129051
  }
128709
129052
  }
128710
- }, _callee10);
129053
+ }, _callee4);
128711
129054
  }));
128712
129055
  return _scrollForwardButtonHandler.apply(this, arguments);
128713
129056
  }
@@ -128727,7 +129070,7 @@ function _infiniteMessageArea() {
128727
129070
  messageTable["final"] = true;
128728
129071
  liveMessageTable = messageTable;
128729
129072
  latest.messageTable = messageTable;
128730
- var tr = newMessageForm(messageTable);
129073
+ var tr = (0, _message.renderMessageEditor)(channelObject, messageTable, userContext, options);
128731
129074
 
128732
129075
  if (newestFirst) {
128733
129076
  messageTable.insertBefore(tr, messageTable.firstChild); // If newestFirst
@@ -128742,27 +129085,27 @@ function _infiniteMessageArea() {
128742
129085
 
128743
129086
 
128744
129087
  if (options.infinite) {
128745
- var scrollBackButtonTR = dom.createElement('tr');
128746
- var scrollBackButtonCell = scrollBackButtonTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
129088
+ var scrollBackbuttonTR = dom.createElement('tr');
129089
+ var scrollBackbuttonCell = scrollBackbuttonTR.appendChild(dom.createElement('td')); // up traingles: noun_1369237.svg
128747
129090
  // down triangles: noun_1369241.svg
128748
129091
 
128749
129092
  var scrollBackIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
128750
129093
 
128751
- scrollBackButton = UI.widgets.button(dom, UI.icons.iconBase + scrollBackIcon, 'Previous messages ...');
128752
- scrollBackButtonCell.style = 'width:3em; height:3em;';
128753
- scrollBackButton.addEventListener('click', scrollBackButtonHandler, false);
129094
+ scrollBackbutton = widgets.button(dom, _iconBase.icons.iconBase + scrollBackIcon, 'Previous messages ...');
129095
+ scrollBackbuttonCell.style = 'width:3em; height:3em;';
129096
+ scrollBackbutton.addEventListener('click', scrollBackbuttonHandler, false);
128754
129097
  messageTable.extendedBack = false;
128755
- scrollBackButtonCell.appendChild(scrollBackButton);
128756
- setScrollBackButtonIcon();
128757
- var dateCell = scrollBackButtonTR.appendChild(dom.createElement('td'));
129098
+ scrollBackbuttonCell.appendChild(scrollBackbutton);
129099
+ setScrollBackbuttonIcon();
129100
+ var dateCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
128758
129101
  dateCell.style = 'text-align: center; vertical-align: middle; color: #888; font-style: italic;';
128759
- dateCell.textContent = UI.widgets.shortDate(date.toISOString(), true); // no time, only date
129102
+ dateCell.textContent = widgets.shortDate(date.toISOString(), true); // no time, only date
128760
129103
  // @@@@@@@@@@@ todo move this button to other end of message cell, o
128761
129104
 
128762
- var scrollForwardButtonCell = scrollBackButtonTR.appendChild(dom.createElement('td'));
129105
+ var scrollForwardButtonCell = scrollBackbuttonTR.appendChild(dom.createElement('td'));
128763
129106
  var scrollForwardIcon = newestFirst ? 'noun_1369241.svg' : 'noun_1369237.svg'; // down and up arrows respoctively
128764
129107
 
128765
- scrollForwardButton = UI.widgets.button(dom, UI.icons.iconBase + scrollForwardIcon, 'Later messages ...');
129108
+ scrollForwardButton = widgets.button(dom, _iconBase.icons.iconBase + scrollForwardIcon, 'Later messages ...');
128766
129109
  scrollForwardButtonCell.appendChild(scrollForwardButton);
128767
129110
  scrollForwardButtonCell.style = 'width:3em; height:3em;';
128768
129111
  scrollForwardButton.addEventListener('click', scrollForwardButtonHandler, false);
@@ -128772,13 +129115,13 @@ function _infiniteMessageArea() {
128772
129115
 
128773
129116
  if (!newestFirst) {
128774
129117
  // opposite end from the entry field
128775
- messageTable.insertBefore(scrollBackButtonTR, messageTable.firstChild); // If not newestFirst
129118
+ messageTable.insertBefore(scrollBackbuttonTR, messageTable.firstChild); // If not newestFirst
128776
129119
  } else {
128777
- messageTable.appendChild(scrollBackButtonTR); // newestFirst
129120
+ messageTable.appendChild(scrollBackbuttonTR); // newestFirst
128778
129121
  }
128779
129122
  }
128780
129123
 
128781
- var sts = kb.statementsMatching(null, WF('message'), null, chatDocument);
129124
+ var sts = _logic.store.statementsMatching(null, ns.wf('message'), null, chatDocument);
128782
129125
 
128783
129126
  if (!live && sts.length === 0) {// not todays
128784
129127
  // no need buttomns at the moment
@@ -128795,57 +129138,57 @@ function _infiniteMessageArea() {
128795
129138
  };
128796
129139
 
128797
129140
  _createMessageTable = function _createMessageTable3() {
128798
- _createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(date, live) {
129141
+ _createMessageTable = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(date, live) {
128799
129142
  var chatDocument, messageTable, statusTR;
128800
- return _regenerator["default"].wrap(function _callee12$(_context12) {
129143
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
128801
129144
  while (1) {
128802
- switch (_context12.prev = _context12.next) {
129145
+ switch (_context6.prev = _context6.next) {
128803
129146
  case 0:
128804
129147
  debug.log(' createMessageTable for ' + date);
128805
129148
  chatDocument = dateFolder.leafDocumentFromDate(date);
128806
- _context12.prev = 2;
128807
- _context12.next = 5;
128808
- return kb.fetcher.load(chatDocument);
129149
+ _context6.prev = 2;
129150
+ _context6.next = 5;
129151
+ return _logic.store.fetcher.load(chatDocument);
128809
129152
 
128810
129153
  case 5:
128811
- _context12.next = 19;
129154
+ _context6.next = 19;
128812
129155
  break;
128813
129156
 
128814
129157
  case 7:
128815
- _context12.prev = 7;
128816
- _context12.t0 = _context12["catch"](2);
129158
+ _context6.prev = 7;
129159
+ _context6.t0 = _context6["catch"](2);
128817
129160
  messageTable = dom.createElement('table');
128818
129161
  statusTR = messageTable.appendChild(dom.createElement('tr')); // ### find status in exception
128819
129162
 
128820
- if (!(_context12.t0.response && _context12.t0.response.status && _context12.t0.response.status === 404)) {
128821
- _context12.next = 16;
129163
+ if (!(_context6.t0.response && _context6.t0.response.status && _context6.t0.response.status === 404)) {
129164
+ _context6.next = 16;
128822
129165
  break;
128823
129166
  }
128824
129167
 
128825
129168
  debug.log('Error 404 for chat file ' + chatDocument);
128826
- return _context12.abrupt("return", renderMessageTable(date, live));
129169
+ return _context6.abrupt("return", renderMessageTable(date, live));
128827
129170
 
128828
129171
  case 16:
128829
129172
  debug.log('*** Error NON 404 for chat file ' + chatDocument);
128830
- statusTR.appendChild(UI.widgets.errorMessageBlock(dom, _context12.t0, 'pink'));
129173
+ statusTR.appendChild(widgets.errorMessageBlock(dom, _context6.t0, 'pink'));
128831
129174
 
128832
129175
  case 18:
128833
- return _context12.abrupt("return", statusTR);
129176
+ return _context6.abrupt("return", statusTR);
128834
129177
 
128835
129178
  case 19:
128836
- return _context12.abrupt("return", renderMessageTable(date, live));
129179
+ return _context6.abrupt("return", renderMessageTable(date, live));
128837
129180
 
128838
129181
  case 20:
128839
129182
  case "end":
128840
- return _context12.stop();
129183
+ return _context6.stop();
128841
129184
  }
128842
129185
  }
128843
- }, _callee12, null, [[2, 7]]);
129186
+ }, _callee6, null, [[2, 7]]);
128844
129187
  }));
128845
129188
  return _createMessageTable.apply(this, arguments);
128846
129189
  };
128847
129190
 
128848
- createMessageTable = function _createMessageTable2(_x13, _x14) {
129191
+ createMessageTable = function _createMessageTable2(_x6, _x7) {
128849
129192
  return _createMessageTable.apply(this, arguments);
128850
129193
  };
128851
129194
 
@@ -128867,38 +129210,38 @@ function _infiniteMessageArea() {
128867
129210
  };
128868
129211
 
128869
129212
  _insertPreviousMessages = function _insertPreviousMessag2() {
128870
- _insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(backwards) {
129213
+ _insertPreviousMessages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(backwards) {
128871
129214
  var extremity, date, live, todayDoc, doc, newMessageTable;
128872
- return _regenerator["default"].wrap(function _callee11$(_context11) {
129215
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
128873
129216
  while (1) {
128874
- switch (_context11.prev = _context11.next) {
129217
+ switch (_context5.prev = _context5.next) {
128875
129218
  case 0:
128876
129219
  extremity = backwards ? earliest : latest;
128877
129220
  date = extremity.messageTable.date; // day in mssecs
128878
129221
 
128879
- _context11.next = 4;
129222
+ _context5.next = 4;
128880
129223
  return dateFolder.loadPrevious(date, backwards);
128881
129224
 
128882
129225
  case 4:
128883
- date = _context11.sent;
129226
+ date = _context5.sent;
128884
129227
  // backwards
128885
129228
  debug.log("insertPreviousMessages: from ".concat(backwards ? 'backwards' : 'forwards', " loadPrevious: ").concat(date));
128886
129229
 
128887
129230
  if (!(!date && !backwards && !liveMessageTable)) {
128888
- _context11.next = 9;
129231
+ _context5.next = 9;
128889
129232
  break;
128890
129233
  }
128891
129234
 
128892
- _context11.next = 9;
129235
+ _context5.next = 9;
128893
129236
  return appendCurrentMessages();
128894
129237
 
128895
129238
  case 9:
128896
129239
  if (date) {
128897
- _context11.next = 11;
129240
+ _context5.next = 11;
128898
129241
  break;
128899
129242
  }
128900
129243
 
128901
- return _context11.abrupt("return", true);
129244
+ return _context5.abrupt("return", true);
128902
129245
 
128903
129246
  case 11:
128904
129247
  // done
@@ -128910,11 +129253,11 @@ function _infiniteMessageArea() {
128910
129253
  live = doc.sameTerm(todayDoc); // Is this todays?
128911
129254
  }
128912
129255
 
128913
- _context11.next = 15;
129256
+ _context5.next = 15;
128914
129257
  return createMessageTable(date, live);
128915
129258
 
128916
129259
  case 15:
128917
- newMessageTable = _context11.sent;
129260
+ newMessageTable = _context5.sent;
128918
129261
  extremity.messageTable = newMessageTable; // move pointer to earliest
128919
129262
 
128920
129263
  if (backwards ? newestFirst : !newestFirst) {
@@ -128925,30 +129268,30 @@ function _infiniteMessageArea() {
128925
129268
  div.insertBefore(newMessageTable, div.firstChild);
128926
129269
  }
128927
129270
 
128928
- return _context11.abrupt("return", live);
129271
+ return _context5.abrupt("return", live);
128929
129272
 
128930
129273
  case 19:
128931
129274
  case "end":
128932
- return _context11.stop();
129275
+ return _context5.stop();
128933
129276
  }
128934
129277
  }
128935
- }, _callee11);
129278
+ }, _callee5);
128936
129279
  }));
128937
129280
  return _insertPreviousMessages.apply(this, arguments);
128938
129281
  };
128939
129282
 
128940
- insertPreviousMessages = function _insertPreviousMessag(_x12) {
129283
+ insertPreviousMessages = function _insertPreviousMessag(_x5) {
128941
129284
  return _insertPreviousMessages.apply(this, arguments);
128942
129285
  };
128943
129286
 
128944
129287
  addMessage = function _addMessage(message, messageTable) {
128945
- var bindings = {
128946
- '?msg': message,
128947
- '?creator': kb.any(message, ns.foaf('maker')),
128948
- '?date': kb.any(message, DCT('created')),
128949
- '?content': kb.any(message, ns.sioc('content'))
128950
- };
128951
- (0, _message.renderMessage)(messageTable, bindings, messageTable.fresh, options, userContext); // fresh from elsewhere
129288
+ var latest = (0, _chatLogic.mostRecentVersion)(message); // const content = store.any(latest, ns.sioc('content'))
129289
+
129290
+ if ((0, _chatLogic.isDeleted)(latest) && !options.showDeletedMessages) {
129291
+ return; // ignore deleted messaged -- @@ could also leave a placeholder
129292
+ }
129293
+
129294
+ insertMessageIntoTable(channelObject, messageTable, message, messageTable.fresh, options, userContext); // fresh from elsewhere
128952
129295
  };
128953
129296
 
128954
129297
  syncMessages = function _syncMessages(about, messageTable) {
@@ -128961,9 +129304,10 @@ function _infiniteMessageArea() {
128961
129304
  }
128962
129305
  }
128963
129306
 
128964
- var messages = kb.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
129307
+ var messages = _logic.store.statementsMatching(about, ns.wf('message'), null, messageTable.chatDocument).map(function (st) {
128965
129308
  return st.object;
128966
129309
  });
129310
+
128967
129311
  var stored = {};
128968
129312
  messages.forEach(function (m) {
128969
129313
  stored[m.uri] = true;
@@ -128986,368 +129330,28 @@ function _infiniteMessageArea() {
128986
129330
  for (ele = messageTable.firstChild; ele; ele = ele.nextSibling) {
128987
129331
  if (ele.AJAR_subject) {
128988
129332
  // Refresh thumbs up etc
128989
- UI.widgets.refreshTree(ele); // Things inside may have changed too
129333
+ widgets.refreshTree(ele); // Things inside may have changed too
128990
129334
  }
128991
129335
  }
128992
129336
  };
128993
129337
 
128994
- newMessageForm = function _newMessageForm(messageTable) {
128995
- var form = dom.createElement('tr');
128996
- var lhs = dom.createElement('td');
128997
- var middle = dom.createElement('td');
128998
- var rhs = dom.createElement('td');
128999
- form.appendChild(lhs);
129000
- form.appendChild(middle);
129001
- form.appendChild(rhs);
129002
- form.AJAR_date = '9999-01-01T00:00:00Z'; // ISO format for field sort
129003
-
129004
- var field, sendButton;
129005
-
129006
- function sendMessage(_x6) {
129007
- return _sendMessage.apply(this, arguments);
129008
- } // sendMessage
129009
-
129010
-
129011
- function _sendMessage() {
129012
- _sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text) {
129013
- var now, sts, timestamp, dateStamp, chatDocument, message, content, sendComplete;
129014
- return _regenerator["default"].wrap(function _callee6$(_context6) {
129015
- while (1) {
129016
- switch (_context6.prev = _context6.next) {
129017
- case 0:
129018
- sendComplete = function _sendComplete() {
129019
- var bindings = {
129020
- '?msg': message,
129021
- '?content': content,
129022
- '?date': dateStamp,
129023
- '?creator': me
129024
- };
129025
- (0, _message.renderMessage)(liveMessageTable, bindings, false, options, userContext); // not green
129026
-
129027
- if (!text) {
129028
- field.value = ''; // clear from out for reuse
129029
-
129030
- field.setAttribute('style', messageBodyStyle);
129031
- field.disabled = false;
129032
- field.scrollIntoView(newestFirst); // allign bottom (top)
129033
-
129034
- field.focus(); // Start typing next line immediately
129035
-
129036
- field.select();
129037
- }
129038
- };
129039
-
129040
- now = new Date();
129041
- _context6.next = 4;
129042
- return addNewTableIfNewDay(now);
129043
-
129044
- case 4:
129045
- if (!text) {
129046
- field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
129047
-
129048
- field.disabled = true;
129049
- }
129050
-
129051
- sts = [];
129052
- timestamp = '' + now.getTime();
129053
- dateStamp = $rdf.term(now);
129054
- chatDocument = dateFolder.leafDocumentFromDate(now);
129055
- message = kb.sym(chatDocument.uri + '#' + 'Msg' + timestamp);
129056
- content = kb.literal(text || field.value); // if (text) field.value = text No - don't destroy half-finsihed user input
129057
-
129058
- sts.push(new $rdf.Statement(chatChannel, ns.wf('message'), message, chatDocument));
129059
- sts.push(new $rdf.Statement(message, ns.sioc('content'), content, chatDocument));
129060
- sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, chatDocument));
129061
-
129062
- if (me) {
129063
- sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, chatDocument));
129064
- }
129065
-
129066
- if (!(SERVER_MKDIRP_BUG && (kb.fetcher.requested[chatDocument.uri] === undefined || kb.fetcher.requested[chatDocument.uri] === 404))) {
129067
- _context6.next = 19;
129068
- break;
129069
- }
129070
-
129071
- debug.log('@@@ SERVER_MKDIRP_BUG: Should only happen once: create chat file: ' + chatDocument);
129072
- _context6.next = 19;
129073
- return createIfNotExists(chatDocument);
129074
-
129075
- case 19:
129076
- _context6.prev = 19;
129077
- _context6.next = 22;
129078
- return updater.update([], sts);
129079
-
129080
- case 22:
129081
- _context6.next = 28;
129082
- break;
129083
-
129084
- case 24:
129085
- _context6.prev = 24;
129086
- _context6.t0 = _context6["catch"](19);
129087
- form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + _context6.t0));
129088
- return _context6.abrupt("return");
129089
-
129090
- case 28:
129091
- sendComplete();
129092
-
129093
- case 29:
129094
- case "end":
129095
- return _context6.stop();
129096
- }
129097
- }
129098
- }, _callee6, null, [[19, 24]]);
129099
- }));
129100
- return _sendMessage.apply(this, arguments);
129101
- }
129102
-
129103
- form.appendChild(dom.createElement('br')); // DRAG AND DROP
129104
-
129105
- function droppedFileHandler(files) {
129106
- var base = messageTable.chatDocument.dir().uri;
129107
- UI.widgets.uploadFiles(kb.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
129108
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(theFile, destURI) {
129109
- return _regenerator["default"].wrap(function _callee2$(_context2) {
129110
- while (1) {
129111
- switch (_context2.prev = _context2.next) {
129112
- case 0:
129113
- _context2.next = 2;
129114
- return sendMessage(destURI);
129115
-
129116
- case 2:
129117
- case "end":
129118
- return _context2.stop();
129119
- }
129120
- }
129121
- }, _callee2);
129122
- }));
129123
-
129124
- return function (_x7, _x8) {
129125
- return _ref.apply(this, arguments);
129126
- };
129127
- }());
129128
- } // When a set of URIs are dropped on the field
129129
-
129130
-
129131
- var droppedURIHandler = /*#__PURE__*/function () {
129132
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(uris) {
129133
- var _iterator, _step, uri;
129134
-
129135
- return _regenerator["default"].wrap(function _callee3$(_context3) {
129136
- while (1) {
129137
- switch (_context3.prev = _context3.next) {
129138
- case 0:
129139
- _iterator = _createForOfIteratorHelper(uris);
129140
- _context3.prev = 1;
129141
-
129142
- _iterator.s();
129143
-
129144
- case 3:
129145
- if ((_step = _iterator.n()).done) {
129146
- _context3.next = 9;
129147
- break;
129148
- }
129149
-
129150
- uri = _step.value;
129151
- _context3.next = 7;
129152
- return sendMessage(uri);
129153
-
129154
- case 7:
129155
- _context3.next = 3;
129156
- break;
129157
-
129158
- case 9:
129159
- _context3.next = 14;
129160
- break;
129161
-
129162
- case 11:
129163
- _context3.prev = 11;
129164
- _context3.t0 = _context3["catch"](1);
129165
-
129166
- _iterator.e(_context3.t0);
129167
-
129168
- case 14:
129169
- _context3.prev = 14;
129170
-
129171
- _iterator.f();
129172
-
129173
- return _context3.finish(14);
129174
-
129175
- case 17:
129176
- case "end":
129177
- return _context3.stop();
129178
- }
129179
- }
129180
- }, _callee3, null, [[1, 11, 14, 17]]);
129181
- }));
129182
-
129183
- return function droppedURIHandler(_x9) {
129184
- return _ref2.apply(this, arguments);
129185
- };
129186
- }(); // When we are actually logged on
129187
-
129188
-
129189
- function turnOnInput() {
129190
- if (options.menuHandler && menuButton) {
129191
- var menuOptions = {
129192
- me: me,
129193
- dom: dom,
129194
- div: div,
129195
- newBase: messageTable.chatDocument.dir().uri
129196
- };
129197
- menuButton.addEventListener('click', function (event) {
129198
- options.menuHandler(event, chatChannel, menuOptions);
129199
- }, false);
129200
- } // Turn on message input
129201
-
129202
-
129203
- (0, _message.creatorAndDate)(lhs, me, '', null);
129204
- field = dom.createElement('textarea');
129205
- middle.innerHTML = '';
129206
- middle.appendChild(field);
129207
- field.rows = 3; // field.cols = 40
129208
-
129209
- field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
129210
-
129211
- field.addEventListener('keydown', /*#__PURE__*/function () {
129212
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(e) {
129213
- return _regenerator["default"].wrap(function _callee4$(_context4) {
129214
- while (1) {
129215
- switch (_context4.prev = _context4.next) {
129216
- case 0:
129217
- if (!(e.keyCode === 13)) {
129218
- _context4.next = 4;
129219
- break;
129220
- }
129221
-
129222
- if (e.altKey) {
129223
- _context4.next = 4;
129224
- break;
129225
- }
129226
-
129227
- _context4.next = 4;
129228
- return sendMessage();
129229
-
129230
- case 4:
129231
- case "end":
129232
- return _context4.stop();
129233
- }
129234
- }
129235
- }, _callee4);
129236
- }));
129237
-
129238
- return function (_x10) {
129239
- return _ref3.apply(this, arguments);
129240
- };
129241
- }(), false);
129242
- UI.widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
129243
- rhs.innerHTML = '';
129244
- sendButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_383448.svg', 'Send');
129245
- sendButton.setAttribute('style', UI.style.buttonStyle + 'float: right;');
129246
- sendButton.addEventListener('click', function (_event) {
129247
- return sendMessage();
129248
- }, false);
129249
- rhs.appendChild(sendButton);
129250
- var chatDocument = dateFolder.leafDocumentFromDate(new Date());
129251
- var imageDoc;
129252
-
129253
- function getImageDoc() {
129254
- imageDoc = kb.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
129255
- return imageDoc;
129256
- }
129257
-
129258
- function tookPicture(_x11) {
129259
- return _tookPicture.apply(this, arguments);
129260
- }
129261
-
129262
- function _tookPicture() {
129263
- _tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(imageDoc) {
129264
- return _regenerator["default"].wrap(function _callee5$(_context5) {
129265
- while (1) {
129266
- switch (_context5.prev = _context5.next) {
129267
- case 0:
129268
- if (!imageDoc) {
129269
- _context5.next = 3;
129270
- break;
129271
- }
129272
-
129273
- _context5.next = 3;
129274
- return sendMessage(imageDoc.uri);
129275
-
129276
- case 3:
129277
- case "end":
129278
- return _context5.stop();
129279
- }
129280
- }
129281
- }, _callee5);
129282
- }));
129283
- return _tookPicture.apply(this, arguments);
129284
- }
129285
-
129286
- middle.appendChild(UI.media.cameraButton(dom, kb, getImageDoc, tookPicture));
129287
- UI.pad.recordParticipation(chatChannel, chatChannel.doc()); // participation =
129288
- } // turn on inpuut
129289
-
129290
-
129291
- var context = {
129292
- div: middle,
129293
- dom: dom
129294
- };
129295
- UI.authn.logIn(context).then(function (context) {
129296
- me = context.me;
129297
- turnOnInput();
129298
- Object.assign(context, userContext);
129299
- (0, _bookmarks.findBookmarkDocument)(context).then(function (context) {
129300
- debug.log('Bookmark file: ' + context.bookmarkDocument);
129301
- });
129302
- });
129303
- return form;
129304
- };
129305
-
129306
- kb = kb || UI.store;
129307
- ns = UI.ns;
129308
- WF = $rdf.Namespace('http://www.w3.org/2005/01/wf/flow#');
129309
- DCT = $rdf.Namespace('http://purl.org/dc/terms/'); // const POSIX = $rdf.Namespace('http://www.w3.org/ns/posix/stat#')
129310
-
129338
+ // Body of main function
129311
129339
  options = options || {};
129312
- newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
129340
+ options.authorDateOnLeft = false; // @@ make a user optiosn
129313
129341
 
129314
- dateFolder = new _dateFolder.DateFolder(chatChannel, 'chat.ttl');
129315
- options.authorAboveContent = true; // var participation // An object tracking users use and prefs
129316
-
129317
- messageBodyStyle = UI.style.messageBodyStyle; // var messageBodyStyle = 'white-space: pre-wrap; width: 90%; font-size:100%; border: 0.07em solid #eee; padding: .2em 0.5em; margin: 0.1em 1em 0.1em 1em;'
129318
- // 'font-size: 100%; margin: 0.1em 1em 0.1em 1em; background-color: white; white-space: pre-wrap; padding: 0.1em;'
129342
+ newestFirst = options.newestFirst === '1' || options.newestFirst === true; // hack for now
129319
129343
 
129344
+ channelObject = new _chatLogic.ChatChannel(chatChannel, options);
129345
+ dateFolder = channelObject.dateFolder;
129320
129346
  div = dom.createElement('div');
129347
+ channelObject.div = div;
129321
129348
  statusArea = div.appendChild(dom.createElement('div'));
129322
129349
  userContext = {
129323
129350
  dom: dom,
129324
129351
  statusArea: statusArea,
129325
129352
  div: statusArea
129326
129353
  }; // logged on state, pointers to user's stuff
129327
-
129328
- updater = UI.store.updater;
129329
- /** Does a file exist on the web?
129330
- * @returns {Boolean}
129331
- */
129332
-
129333
- /*
129334
- async function documentExists (doc) {
129335
- try {
129336
- await kb.fetcher.load(doc)
129337
- } catch (err) {
129338
- if (err.response.status === 404) {
129339
- return false
129340
- } else {
129341
- debug.log('documentExists: doc load error NOT 404: ' + doc + ': ' + err)
129342
- throw err
129343
- }
129344
- }
129345
- return true
129346
- }
129347
- */
129348
-
129349
- /* Form for a new message
129350
- */
129354
+ // const messageTable = dom.createElement('table') // @@ check does this go in renderMessageTable
129351
129355
 
129352
129356
  earliest = {
129353
129357
  messageTable: null
@@ -129357,18 +129361,18 @@ function _infiniteMessageArea() {
129357
129361
  messageTable: null
129358
129362
  };
129359
129363
  lock = false;
129360
- _context17.next = 35;
129364
+ _context12.next = 30;
129361
129365
  return loadInitialContent();
129362
129366
 
129363
- case 35:
129364
- return _context17.abrupt("return", div);
129367
+ case 30:
129368
+ return _context12.abrupt("return", div);
129365
129369
 
129366
- case 36:
129370
+ case 31:
129367
129371
  case "end":
129368
- return _context17.stop();
129372
+ return _context12.stop();
129369
129373
  }
129370
129374
  }
129371
- }, _callee17);
129375
+ }, _callee12);
129372
129376
  }));
129373
129377
  return _infiniteMessageArea.apply(this, arguments);
129374
129378
  }
@@ -129386,6 +129390,8 @@ function _infiniteMessageArea() {
129386
129390
  "use strict";
129387
129391
 
129388
129392
 
129393
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/interopRequireDefault.js");
129394
+
129389
129395
  var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/typeof.js");
129390
129396
 
129391
129397
  Object.defineProperty(exports, "__esModule", {
@@ -129394,10 +129400,24 @@ Object.defineProperty(exports, "__esModule", {
129394
129400
  exports.creatorAndDate = creatorAndDate;
129395
129401
  exports.creatorAndDateHorizontal = creatorAndDateHorizontal;
129396
129402
  exports.elementForImageURI = elementForImageURI;
129397
- exports.renderMessage = renderMessage;
129403
+ exports.renderMessageEditor = renderMessageEditor;
129404
+ exports.renderMessageRow = renderMessageRow;
129405
+ exports.switchToEditor = switchToEditor;
129406
+
129407
+ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/regenerator/index.js"));
129408
+
129409
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
129410
+
129411
+ var _infinite = __webpack_require__(/*! ./infinite */ "./node_modules/solid-ui/lib/chat/infinite.js");
129398
129412
 
129399
129413
  var _messageTools = __webpack_require__(/*! ./messageTools */ "./node_modules/solid-ui/lib/chat/messageTools.js");
129400
129414
 
129415
+ var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./node_modules/solid-ui/lib/chat/bookmarks.js");
129416
+
129417
+ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./node_modules/solid-ui/lib/chat/chatLogic.js");
129418
+
129419
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./node_modules/solid-ui/lib/debug.js"));
129420
+
129401
129421
  var _index = __webpack_require__(/*! ../authn/index */ "./node_modules/solid-ui/lib/authn/index.js");
129402
129422
 
129403
129423
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./node_modules/solid-ui/lib/iconBase.js");
@@ -129410,8 +129430,6 @@ var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./node_module
129410
129430
 
129411
129431
  var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./node_modules/solid-ui/lib/pad.js"));
129412
129432
 
129413
- var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
129414
-
129415
129433
  var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./node_modules/solid-ui/lib/style.js"));
129416
129434
 
129417
129435
  var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./node_modules/solid-ui/lib/utils/index.js"));
@@ -129422,31 +129440,17 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
129422
129440
 
129423
129441
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
129424
129442
 
129425
- /**
129426
- * Contains the [[renderMessage]] function,
129427
- * along with [[elementForImageURI]],
129428
- * [[creatorAndDate]], and [[creatorAndDateHorizontal]]
129429
- * @packageDocumentation
129430
- */
129443
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
129431
129444
 
129432
- /* global $rdf */
129433
- // pull in first avoid cross-refs
129434
- var UI = {
129435
- authn: _index.authn,
129436
- icons: _iconBase.icons,
129437
- ns: ns,
129438
- media: _index2.media,
129439
- pad: pad,
129440
- rdf: rdf,
129441
- store: _logic.store,
129442
- style: style,
129443
- utils: utils,
129444
- widgets: widgets
129445
- };
129446
- var dom = UI.dom || window.document; // const kb = UI.store
129445
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
129446
+
129447
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
129447
129448
 
129448
- var messageBodyStyle = UI.style.messageBodyStyle;
129449
- var label = UI.utils.label;
129449
+ // const UI = { authn, icons, ns, media, pad, rdf, store, style, utils, widgets }
129450
+ var dom = window.document; // const store = store
129451
+
129452
+ var messageBodyStyle = style.messageBodyStyle;
129453
+ var label = utils.label;
129450
129454
  /**
129451
129455
  * HTML component for an image
129452
129456
  */
@@ -129459,14 +129463,14 @@ function elementForImageURI(imageUri, options) {
129459
129463
  height = ('' + options.inlineImageHeightEms).trim();
129460
129464
  }
129461
129465
 
129462
- img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); // UI.widgets.makeDropTarget(img, handleURIsDroppedOnMugshot, droppedFileHandler)
129466
+ img.setAttribute('style', 'max-height: ' + height + 'em; border-radius: 1em; margin: 0.7em;'); // widgets.makeDropTarget(img, handleURIsDroppedOnMugshot, droppedFileHandler)
129463
129467
 
129464
129468
  if (imageUri) img.setAttribute('src', imageUri);
129465
129469
  var anchor = dom.createElement('a');
129466
129470
  anchor.setAttribute('href', imageUri);
129467
129471
  anchor.setAttribute('target', 'images');
129468
129472
  anchor.appendChild(img);
129469
- UI.widgets.makeDraggable(img, $rdf.sym(imageUri));
129473
+ widgets.makeDraggable(img, $rdf.sym(imageUri));
129470
129474
  return anchor;
129471
129475
  }
129472
129476
 
@@ -129476,7 +129480,7 @@ var anchor = function anchor(text, term) {
129476
129480
 
129477
129481
  if (term && term.uri) {
129478
129482
  a.setAttribute('href', term.uri);
129479
- a.addEventListener('click', UI.widgets.openHrefInOutlineMode, true);
129483
+ a.addEventListener('click', widgets.openHrefInOutlineMode, true);
129480
129484
  a.setAttribute('style', 'color: #3B5998; text-decoration: none; '); // font-weight: bold
129481
129485
  }
129482
129486
 
@@ -129485,7 +129489,8 @@ var anchor = function anchor(text, term) {
129485
129489
  };
129486
129490
 
129487
129491
  function nick(person) {
129488
- var s = UI.store.any(person, UI.ns.foaf('nick'));
129492
+ var s = _logic.store.any(person, ns.foaf('nick'));
129493
+
129489
129494
  if (s) return '' + s.value;
129490
129495
  return '' + label(person);
129491
129496
  }
@@ -129499,7 +129504,7 @@ function creatorAndDate(td1, creator, date, message) {
129499
129504
  var nickAnchor = td1.appendChild(anchor(nick(creator), creator));
129500
129505
 
129501
129506
  if (creator.uri) {
129502
- UI.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
129507
+ _logic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
129503
129508
  nickAnchor.textContent = nick(creator);
129504
129509
  });
129505
129510
  }
@@ -129517,7 +129522,7 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
129517
129522
  var nickAnchor = td1.appendChild(anchor(label(creator), creator));
129518
129523
 
129519
129524
  if (creator.uri) {
129520
- UI.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
129525
+ _logic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
129521
129526
  nickAnchor.textContent = nick(creator);
129522
129527
  });
129523
129528
  }
@@ -129528,65 +129533,54 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
129528
129533
  td1.appendChild(dom.createElement('br'));
129529
129534
  }
129530
129535
  /**
129531
- * Renders a chat message inside a `messageTable`
129536
+ * Renders a chat message, read-only mode
129532
129537
  */
129533
129538
 
129534
129539
 
129535
- function renderMessage(messageTable, bindings, fresh, options, userContext) {
129540
+ function renderMessageRow(channelObject, message, fresh, options, userContext) {
129536
129541
  var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
129537
- var creator = bindings['?creator'];
129538
- var message = bindings['?msg'];
129539
- var date = bindings['?date'];
129540
- var content = bindings['?content'];
129541
- var dateString = date.value;
129542
- var messageRow = dom.createElement('tr');
129543
- messageRow.AJAR_date = dateString;
129544
- messageRow.AJAR_subject = message;
129545
129542
 
129546
- if (options.selectedMessage && options.selectedMessage.sameTerm(message)) {
129547
- messageRow.style.backgroundColor = 'yellow';
129548
- options.selectedElement = messageRow;
129549
- messageTable.selectedElement = messageRow;
129550
- }
129543
+ var creator = _logic.store.any(message, ns.foaf('maker'));
129551
129544
 
129552
- var done = false;
129545
+ var date = _logic.store.any(message, ns.dct('created'));
129553
129546
 
129554
- for (var ele = messageTable.firstChild;; ele = ele.nextSibling) {
129555
- if (!ele) {
129556
- // empty
129557
- break;
129558
- }
129547
+ var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
129559
129548
 
129560
- var newestFirst = options.newestfirst === true;
129549
+ var content = _logic.store.any(latestVersion, ns.sioc('content'));
129561
129550
 
129562
- if (dateString > ele.AJAR_date && newestFirst || dateString < ele.AJAR_date && !newestFirst) {
129563
- messageTable.insertBefore(messageRow, ele);
129564
- done = true;
129565
- break;
129566
- }
129567
- }
129551
+ var originalMessage = (0, _chatLogic.originalVersion)(message);
129552
+ var edited = !message.sameTerm(originalMessage);
129553
+
129554
+ var sortDate = _logic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
129568
129555
 
129569
- if (!done) {
129570
- messageTable.appendChild(messageRow);
129571
- }
129572
129556
 
129557
+ var messageRow = dom.createElement('tr');
129558
+ messageRow.AJAR_date = sortDate.value;
129559
+ messageRow.AJAR_subject = message;
129573
129560
  var td1 = dom.createElement('td');
129574
129561
  messageRow.appendChild(td1);
129575
129562
 
129576
- if (options.authorAboveContent) {
129563
+ if (!options.authorDateOnLeft) {
129577
129564
  var img = dom.createElement('img');
129578
129565
  img.setAttribute('style', 'max-height: 2.5em; max-width: 2.5em; border-radius: 0.5em; margin: auto;');
129579
- UI.widgets.setImage(img, creator);
129566
+ widgets.setImage(img, creator);
129580
129567
  td1.appendChild(img);
129581
129568
  } else {
129582
- creatorAndDate(td1, creator, UI.widgets.shortDate(dateString), message);
129569
+ creatorAndDate(td1, creator, widgets.shortDate(sortDate.value), message);
129570
+ }
129571
+
129572
+ var bothDates = widgets.shortDate(sortDate.value);
129573
+
129574
+ if (edited) {
129575
+ bothDates += ' ... ' + widgets.shortDate(date.value);
129583
129576
  } // Render the content ot the message itself
129584
129577
 
129585
129578
 
129586
129579
  var td2 = messageRow.appendChild(dom.createElement('td'));
129587
129580
 
129588
- if (options.authorAboveContent) {
129589
- creatorAndDateHorizontal(td2, creator, UI.widgets.shortDate(dateString), message);
129581
+ if (!options.authorDateOnLeft) {
129582
+ creatorAndDateHorizontal(td2, creator, bothDates, // widgets.shortDate(dateString)
129583
+ message);
129590
129584
  }
129591
129585
 
129592
129586
  var text = content.value.trim();
@@ -129616,7 +129610,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
129616
129610
  }
129617
129611
 
129618
129612
  if (para) {
129619
- var bgcolor = colorizeByAuthor ? UI.pad.lightColorHash(creator) : getBgColor(fresh);
129613
+ var bgcolor = colorizeByAuthor ? pad.lightColorHash(creator) : getBgColor(fresh);
129620
129614
  para.setAttribute('style', messageBodyStyle + 'background-color: ' + bgcolor + ';');
129621
129615
  }
129622
129616
 
@@ -129635,7 +129629,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
129635
129629
 
129636
129630
  var td3 = dom.createElement('td');
129637
129631
  messageRow.appendChild(td3);
129638
- var toolsButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_243787.svg', '...');
129632
+ var toolsButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', '...');
129639
129633
  td3.appendChild(toolsButton);
129640
129634
  toolsButton.addEventListener('click', function (_event) {
129641
129635
  if (messageRow.toolTR) {
@@ -129646,7 +129640,7 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
129646
129640
  }
129647
129641
 
129648
129642
  var toolsTR = dom.createElement('tr');
129649
- var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext);
129643
+ var tools = (0, _messageTools.messageToolbar)(message, messageRow, userContext, channelObject);
129650
129644
  tools.style = 'border: 0.05em solid #888; border-radius: 0 0 0.7em 0.7em; border-top: 0; height:3.5em; background-color: #fff;'; // @@ fix
129651
129645
 
129652
129646
  if (messageRow.nextSibling) {
@@ -129665,6 +129659,390 @@ function renderMessage(messageTable, bindings, fresh, options, userContext) {
129665
129659
  });
129666
129660
  return messageRow;
129667
129661
  }
129662
+
129663
+ function switchToEditor(messageRow, message, channelObject, userContext) {
129664
+ var messageTable = messageRow.parentNode;
129665
+ var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
129666
+ messageTable.insertBefore(editRow, messageRow);
129667
+ editRow.originalRow = messageRow;
129668
+ messageRow.style.visibility = 'hidden'; // Hide the original message. unhide if user cancels edit
129669
+ }
129670
+ /* Control for a new message -- or editing an old message ***************
129671
+ *
129672
+ */
129673
+
129674
+
129675
+ function renderMessageEditor(channelObject, messageTable, userContext, options, originalMessage) {
129676
+ function revertEditing(messageEditor) {
129677
+ messageEditor.originalRow.style.visibility = 'visible'; // restore read-only version
129678
+
129679
+ messageEditor.parentNode.removeChild(messageEditor);
129680
+ }
129681
+
129682
+ function handleFieldInput(_x) {
129683
+ return _handleFieldInput.apply(this, arguments);
129684
+ }
129685
+
129686
+ function _handleFieldInput() {
129687
+ _handleFieldInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_event) {
129688
+ return _regenerator["default"].wrap(function _callee5$(_context6) {
129689
+ while (1) {
129690
+ switch (_context6.prev = _context6.next) {
129691
+ case 0:
129692
+ _context6.next = 2;
129693
+ return sendMessage(field.value, true);
129694
+
129695
+ case 2:
129696
+ case "end":
129697
+ return _context6.stop();
129698
+ }
129699
+ }
129700
+ }, _callee5);
129701
+ }));
129702
+ return _handleFieldInput.apply(this, arguments);
129703
+ }
129704
+
129705
+ function sendMessage(_x2, _x3) {
129706
+ return _sendMessage.apply(this, arguments);
129707
+ } // sendMessage
129708
+ // DRAG AND DROP
129709
+
129710
+
129711
+ function _sendMessage() {
129712
+ _sendMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(text, fromMainField) {
129713
+ var sendComplete, message, statusArea;
129714
+ return _regenerator["default"].wrap(function _callee6$(_context7) {
129715
+ while (1) {
129716
+ switch (_context7.prev = _context7.next) {
129717
+ case 0:
129718
+ sendComplete = function _sendComplete(message, _text2) {
129719
+ // const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
129720
+ // const content = $rdf.literal(text2)
129721
+ (0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
129722
+
129723
+ if (originalMessage) {
129724
+ // editing another message
129725
+ var oldRow = messageEditor.originalRow; // oldRow.style.display = '' // restore read-only version, re-attack
129726
+
129727
+ if (oldRow.parentNode) {
129728
+ oldRow.parentNode.removeChild(oldRow); // No longer needed old version
129729
+ } else {
129730
+ debug.warn('No parentNode on old message ' + oldRow.textContent);
129731
+ oldRow.style.backgroundColor = '#fee';
129732
+ oldRow.style.visibility = 'hidden'; // @@ FIX THIS AND REMOVE FROM DOM INSTEAD
129733
+ }
129734
+
129735
+ messageEditor.parentNode.removeChild(messageEditor); // no longer need editor
129736
+ } else {
129737
+ if (fromMainField) {
129738
+ field.value = ''; // clear from out for reuse
129739
+
129740
+ field.setAttribute('style', messageBodyStyle);
129741
+ field.disabled = false;
129742
+ field.scrollIntoView(options.newestFirst); // allign bottom (top)
129743
+
129744
+ field.focus(); // Start typing next line immediately
129745
+
129746
+ field.select();
129747
+ }
129748
+ } // await channelObject.div.refresh() // Add new day if nec @@ add back
129749
+
129750
+ };
129751
+
129752
+ // const me = authn.currentUser() // Must be logged on or wuld have got login button
129753
+ if (fromMainField) {
129754
+ field.setAttribute('style', messageBodyStyle + 'color: #bbb;'); // pendingedit
129755
+
129756
+ field.disabled = true;
129757
+ }
129758
+
129759
+ _context7.prev = 2;
129760
+ _context7.next = 5;
129761
+ return channelObject.updateMessage(text, originalMessage);
129762
+
129763
+ case 5:
129764
+ message = _context7.sent;
129765
+ _context7.next = 13;
129766
+ break;
129767
+
129768
+ case 8:
129769
+ _context7.prev = 8;
129770
+ _context7.t0 = _context7["catch"](2);
129771
+ statusArea = userContext.statusArea || messageEditor;
129772
+ statusArea.appendChild(widgets.errorMessageBlock(dom, 'Error writing message: ' + _context7.t0));
129773
+ return _context7.abrupt("return");
129774
+
129775
+ case 13:
129776
+ sendComplete(message, text);
129777
+
129778
+ case 14:
129779
+ case "end":
129780
+ return _context7.stop();
129781
+ }
129782
+ }
129783
+ }, _callee6, null, [[2, 8]]);
129784
+ }));
129785
+ return _sendMessage.apply(this, arguments);
129786
+ }
129787
+
129788
+ function droppedFileHandler(files) {
129789
+ var base = messageTable.chatDocument.dir().uri;
129790
+ widgets.uploadFiles(_logic.store.fetcher, files, base + 'Files', base + 'Pictures', /*#__PURE__*/function () {
129791
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(theFile, destURI) {
129792
+ return _regenerator["default"].wrap(function _callee$(_context2) {
129793
+ while (1) {
129794
+ switch (_context2.prev = _context2.next) {
129795
+ case 0:
129796
+ _context2.next = 2;
129797
+ return sendMessage(destURI);
129798
+
129799
+ case 2:
129800
+ case "end":
129801
+ return _context2.stop();
129802
+ }
129803
+ }
129804
+ }, _callee);
129805
+ }));
129806
+
129807
+ return function (_x4, _x5) {
129808
+ return _ref.apply(this, arguments);
129809
+ };
129810
+ }());
129811
+ } // When a set of URIs are dropped on the field
129812
+
129813
+
129814
+ var droppedURIHandler = /*#__PURE__*/function () {
129815
+ var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(uris) {
129816
+ var _iterator, _step, uri;
129817
+
129818
+ return _regenerator["default"].wrap(function _callee2$(_context3) {
129819
+ while (1) {
129820
+ switch (_context3.prev = _context3.next) {
129821
+ case 0:
129822
+ _iterator = _createForOfIteratorHelper(uris);
129823
+ _context3.prev = 1;
129824
+
129825
+ _iterator.s();
129826
+
129827
+ case 3:
129828
+ if ((_step = _iterator.n()).done) {
129829
+ _context3.next = 9;
129830
+ break;
129831
+ }
129832
+
129833
+ uri = _step.value;
129834
+ _context3.next = 7;
129835
+ return sendMessage(uri);
129836
+
129837
+ case 7:
129838
+ _context3.next = 3;
129839
+ break;
129840
+
129841
+ case 9:
129842
+ _context3.next = 14;
129843
+ break;
129844
+
129845
+ case 11:
129846
+ _context3.prev = 11;
129847
+ _context3.t0 = _context3["catch"](1);
129848
+
129849
+ _iterator.e(_context3.t0);
129850
+
129851
+ case 14:
129852
+ _context3.prev = 14;
129853
+
129854
+ _iterator.f();
129855
+
129856
+ return _context3.finish(14);
129857
+
129858
+ case 17:
129859
+ case "end":
129860
+ return _context3.stop();
129861
+ }
129862
+ }
129863
+ }, _callee2, null, [[1, 11, 14, 17]]);
129864
+ }));
129865
+
129866
+ return function droppedURIHandler(_x6) {
129867
+ return _ref2.apply(this, arguments);
129868
+ };
129869
+ }(); // When we are actually logged on
129870
+
129871
+
129872
+ function turnOnInput() {
129873
+ function getImageDoc() {
129874
+ imageDoc = $rdf.sym(chatDocument.dir().uri + 'Image_' + Date.now() + '.png');
129875
+ return imageDoc;
129876
+ }
129877
+
129878
+ function tookPicture(_x7) {
129879
+ return _tookPicture.apply(this, arguments);
129880
+ } // Body of turnOnInput
129881
+
129882
+
129883
+ function _tookPicture() {
129884
+ _tookPicture = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(imageDoc) {
129885
+ return _regenerator["default"].wrap(function _callee4$(_context5) {
129886
+ while (1) {
129887
+ switch (_context5.prev = _context5.next) {
129888
+ case 0:
129889
+ if (!imageDoc) {
129890
+ _context5.next = 3;
129891
+ break;
129892
+ }
129893
+
129894
+ _context5.next = 3;
129895
+ return sendMessage(imageDoc.uri);
129896
+
129897
+ case 3:
129898
+ case "end":
129899
+ return _context5.stop();
129900
+ }
129901
+ }
129902
+ }, _callee4);
129903
+ }));
129904
+ return _tookPicture.apply(this, arguments);
129905
+ }
129906
+
129907
+ var menuButton;
129908
+
129909
+ if (options.menuHandler) {
129910
+ var _menuButton = widgets.button(dom, _iconBase.icons.iconBase + 'noun_243787.svg', 'More');
129911
+
129912
+ _menuButton.setAttribute('style', style.buttonStyle + 'float: right;'); // menuButton.addEventListener('click', _event => sendMessage(), false) (done in turnoninput)
129913
+
129914
+
129915
+ rhs.appendChild(_menuButton);
129916
+ }
129917
+
129918
+ if (options.menuHandler && menuButton) {
129919
+ var _me = _index.authn.currentUser();
129920
+
129921
+ var menuOptions = {
129922
+ me: _me,
129923
+ dom: dom,
129924
+ div: null,
129925
+ // @@ was: div
129926
+ newBase: messageTable.chatDocument.dir().uri
129927
+ };
129928
+ menuButton.addEventListener('click', function (event) {
129929
+ options.menuHandler(event, channelObject.chatChannel, menuOptions);
129930
+ }, false);
129931
+ }
129932
+
129933
+ var me = _index.authn.currentUser(); // If already logged on
129934
+
129935
+
129936
+ creatorAndDate(lhs, me, '', null);
129937
+ field = dom.createElement('textarea');
129938
+ middle.innerHTML = '';
129939
+ middle.appendChild(field);
129940
+ field.rows = 3;
129941
+
129942
+ if (originalMessage) {
129943
+ field.value = _logic.store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc());
129944
+ } // field.cols = 40
129945
+
129946
+
129947
+ field.setAttribute('style', messageBodyStyle + 'background-color: #eef;'); // Trap the Enter BEFORE it is used ti make a newline
129948
+
129949
+ field.addEventListener('keydown', /*#__PURE__*/function () {
129950
+ var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(e) {
129951
+ return _regenerator["default"].wrap(function _callee3$(_context4) {
129952
+ while (1) {
129953
+ switch (_context4.prev = _context4.next) {
129954
+ case 0:
129955
+ if (!(e.code === 'Enter')) {
129956
+ _context4.next = 4;
129957
+ break;
129958
+ }
129959
+
129960
+ if (!(!e.shiftKey && !options.shiftEnterSendsMessage || e.shiftKey && options.shiftEnterSendsMessage)) {
129961
+ _context4.next = 4;
129962
+ break;
129963
+ }
129964
+
129965
+ _context4.next = 4;
129966
+ return handleFieldInput(e);
129967
+
129968
+ case 4:
129969
+ case "end":
129970
+ return _context4.stop();
129971
+ }
129972
+ }
129973
+ }, _callee3);
129974
+ }));
129975
+
129976
+ return function (_x8) {
129977
+ return _ref3.apply(this, arguments);
129978
+ };
129979
+ }(), false);
129980
+ widgets.makeDropTarget(field, droppedURIHandler, droppedFileHandler);
129981
+ rhs.innerHTML = '';
129982
+ sendButton = widgets.button(dom, sendIcon, 'Send');
129983
+ sendButton.style["float"] = 'right';
129984
+ sendButton.addEventListener('click', function (_event) {
129985
+ return handleFieldInput();
129986
+ }, false);
129987
+ rhs.appendChild(sendButton);
129988
+
129989
+ if (originalMessage) {
129990
+ // Are we editing another message?
129991
+ var cancelButton = rhs.appendChild(widgets.cancelButton(dom));
129992
+ cancelButton.style["float"] = 'left'; // cancelButton.firstChild.style.opacity = '0.3' // moved to buttons
129993
+
129994
+ cancelButton.addEventListener('click', function (_event) {
129995
+ return revertEditing(messageEditor);
129996
+ }, false);
129997
+ rhs.appendChild(cancelButton);
129998
+ }
129999
+
130000
+ var chatDocument = channelObject.dateFolder.leafDocumentFromDate(new Date());
130001
+ var imageDoc;
130002
+ middle.appendChild(_index2.media.cameraButton(dom, _logic.store, getImageDoc, tookPicture));
130003
+ pad.recordParticipation(channelObject.channel, channelObject.channel.doc()); // participation =
130004
+ } // turn on inpuut
130005
+ // Body of renderMessageEditor
130006
+
130007
+
130008
+ var sortDate, sendIcon;
130009
+
130010
+ if (originalMessage) {
130011
+ sortDate = _logic.store.anyValue(originalMessage, ns.dct('created'), null, originalMessage.doc()); // text = store.anyValue(originalMessage, ns.sioc('content'), null, originalMessage.doc())
130012
+
130013
+ sendIcon = _iconBase.icons.iconBase + 'noun_1180158.svg'; // Green check
130014
+ // cancelIcon = icons.iconBase + 'noun_1180156.svg' // Black cross
130015
+ } else {
130016
+ sendIcon = _iconBase.icons.iconBase + 'noun_383448.svg';
130017
+ sortDate = '9999-01-01T00:00:00Z'; // ISO format for field sort
130018
+ // text = ''
130019
+ }
130020
+
130021
+ var messageEditor = dom.createElement('tr');
130022
+ var lhs = dom.createElement('td');
130023
+ var middle = dom.createElement('td');
130024
+ var rhs = dom.createElement('td');
130025
+ messageEditor.appendChild(lhs);
130026
+ messageEditor.appendChild(middle);
130027
+ messageEditor.appendChild(rhs);
130028
+ messageEditor.AJAR_date = sortDate; // messageEditor.appendChild(dom.createElement('br'))
130029
+
130030
+ var field, sendButton;
130031
+ var context = {
130032
+ div: middle,
130033
+ dom: dom
130034
+ };
130035
+
130036
+ _index.authn.logIn(context).then(function (context) {
130037
+ // me = context.me
130038
+ turnOnInput();
130039
+ Object.assign(context, userContext);
130040
+ (0, _bookmarks.findBookmarkDocument)(context).then(function (_context) {// console.log('Bookmark file: ' + context.bookmarkDocument)
130041
+ });
130042
+ });
130043
+
130044
+ return messageEditor;
130045
+ } // renderMessageEditor
129668
130046
  //# sourceMappingURL=message.js.map
129669
130047
 
129670
130048
  /***/ }),
@@ -129696,28 +130074,28 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
129696
130074
 
129697
130075
  var _slicedToArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ "./node_modules/solid-ui/node_modules/@babel/runtime/helpers/slicedToArray.js"));
129698
130076
 
130077
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./node_modules/solid-ui/lib/debug.js"));
130078
+
129699
130079
  var _index = __webpack_require__(/*! ../authn/index */ "./node_modules/solid-ui/lib/authn/index.js");
129700
130080
 
129701
130081
  var _iconBase = __webpack_require__(/*! ../iconBase */ "./node_modules/solid-ui/lib/iconBase.js");
129702
130082
 
129703
130083
  var _logic = __webpack_require__(/*! ../logic */ "./node_modules/solid-ui/lib/logic.js");
129704
130084
 
129705
- var _index2 = __webpack_require__(/*! ../media/index */ "./node_modules/solid-ui/lib/media/index.js");
129706
-
129707
130085
  var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./node_modules/solid-ui/lib/ns.js"));
129708
130086
 
129709
- var pad = _interopRequireWildcard(__webpack_require__(/*! ../pad */ "./node_modules/solid-ui/lib/pad.js"));
129710
-
129711
130087
  var rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
129712
130088
 
129713
- var style = _interopRequireWildcard(__webpack_require__(/*! ../style */ "./node_modules/solid-ui/lib/style.js"));
129714
-
129715
130089
  var utils = _interopRequireWildcard(__webpack_require__(/*! ../utils */ "./node_modules/solid-ui/lib/utils/index.js"));
129716
130090
 
129717
130091
  var widgets = _interopRequireWildcard(__webpack_require__(/*! ../widgets */ "./node_modules/solid-ui/lib/widgets/index.js"));
129718
130092
 
129719
130093
  var _bookmarks = __webpack_require__(/*! ./bookmarks */ "./node_modules/solid-ui/lib/chat/bookmarks.js");
129720
130094
 
130095
+ var _chatLogic = __webpack_require__(/*! ./chatLogic */ "./node_modules/solid-ui/lib/chat/chatLogic.js");
130096
+
130097
+ var _message = __webpack_require__(/*! ./message */ "./node_modules/solid-ui/lib/chat/message.js");
130098
+
129721
130099
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
129722
130100
 
129723
130101
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -129731,52 +130109,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
129731
130109
  * If you made it originally: edit, delete, attach
129732
130110
  * @packageDocumentation
129733
130111
  */
129734
-
129735
- /* global $rdf */
130112
+ // import { media } from '../media/index'
130113
+ // import * as pad from '../pad'
129736
130114
  // pull in first avoid cross-refs
129737
- var UI = {
129738
- authn: _index.authn,
129739
- icons: _iconBase.icons,
129740
- ns: ns,
129741
- media: _index2.media,
129742
- pad: pad,
129743
- rdf: rdf,
129744
- store: _logic.store,
129745
- style: style,
129746
- utils: utils,
129747
- widgets: widgets
129748
- };
129749
- var dom = window.document;
129750
- var kb = _logic.store; // const label = UI.utils.label
129751
- // THE UNUSED ICONS are here as reminders for possible future functionality
130115
+ // import * as style from '../style'
130116
+ // import { infiniteMessageArea } from './infinite.js'
130117
+ // import { renderMessage, creatorAndDate } from './message'
130118
+ // import * as debug from '../debug'
130119
+ var dom = window.document; // THE UNUSED ICONS are here as reminders for possible future functionality
129752
130120
  // const BOOKMARK_ICON = 'noun_45961.svg'
129753
130121
  // const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites
129754
130122
  // const MENU_ICON = 'noun_897914.svg'
129755
130123
  // const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message
129756
130124
  // const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI
129757
- // const PENCIL_ICON = 'noun_253504.svg'
130125
+
130126
+ var PENCIL_ICON = 'noun_253504.svg'; // edit a message
129758
130127
  // const SPANNER_ICON = 'noun_344563.svg' -> settings
129759
130128
 
129760
130129
  var THUMBS_UP_ICON = 'noun_1384132.svg';
129761
- var THUMBS_DOWN_ICON = 'noun_1384135.svg'; // module.export = { messageTools, sentimentStripLinked, sentimentStrip }
129762
- // @@@@ use the one in rdflib.js when it is avaiable and delete this
129763
-
129764
- function updatePromise(del, ins) {
129765
- return new Promise(function (resolve, reject) {
129766
- kb.updater.update(del, ins, function (uri, ok, errorBody) {
129767
- if (!ok) {
129768
- reject(new Error(errorBody));
129769
- } else {
129770
- resolve();
129771
- }
129772
- }); // callback
129773
- }); // promise
129774
- }
130130
+ var THUMBS_DOWN_ICON = 'noun_1384135.svg';
129775
130131
  /**
129776
130132
  * Emoji in Unicode
129777
130133
  */
129778
130134
 
129779
-
129780
130135
  var emoji = {};
129781
130136
  emoji[ns.schema('AgreeAction')] = '👍';
129782
130137
  emoji[ns.schema('DisagreeAction')] = '👎';
@@ -129787,9 +130142,11 @@ emoji[ns.schema('LikeAction')] = '❤️';
129787
130142
  */
129788
130143
 
129789
130144
  function sentimentStrip(target, doc) {
129790
- var actions = kb.each(null, ns.schema('target'), target, doc);
130145
+ // alain seems not used
130146
+ var latest = (0, _chatLogic.mostRecentVersion)(target);
130147
+ var actions = _logic.store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? _logic.store.each(null, ns.schema('target'), target, doc) : [];
129791
130148
  var sentiments = actions.map(function (a) {
129792
- return kb.any(a, ns.rdf('type'), null, doc);
130149
+ return _logic.store.any(a, ns.rdf('type'), null, doc);
129793
130150
  });
129794
130151
  sentiments.sort();
129795
130152
  var strings = sentiments.map(function (x) {
@@ -129810,9 +130167,9 @@ function sentimentStripLinked(target, doc) {
129810
130167
 
129811
130168
  function refresh() {
129812
130169
  strip.innerHTML = '';
129813
- var actions = kb.each(null, ns.schema('target'), target, doc);
130170
+ var actions = (0, _chatLogic.mostRecentVersion)(target).uri !== ns.schema('dateDeleted').uri ? _logic.store.each(null, ns.schema('target'), target, doc) : [];
129814
130171
  var sentiments = actions.map(function (a) {
129815
- return [kb.any(a, ns.rdf('type'), null, doc), kb.any(a, ns.schema('agent'), null, doc)];
130172
+ return [_logic.store.any(a, ns.rdf('type'), null, doc), _logic.store.any(a, ns.schema('agent'), null, doc)];
129816
130173
  });
129817
130174
  sentiments.sort();
129818
130175
  sentiments.forEach(function (ss) {
@@ -129843,60 +130200,142 @@ function sentimentStripLinked(target, doc) {
129843
130200
  */
129844
130201
 
129845
130202
 
129846
- function messageToolbar(message, messageRow, userContext) {
129847
- var div = dom.createElement('div');
130203
+ function messageToolbar(message, messageRow, userContext, channelObject) {
130204
+ function deleteMessage() {
130205
+ return _deleteMessage.apply(this, arguments);
130206
+ }
129848
130207
 
129849
- function closeToolbar() {
129850
- div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
130208
+ function _deleteMessage() {
130209
+ _deleteMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
130210
+ var author, msg, area;
130211
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
130212
+ while (1) {
130213
+ switch (_context2.prev = _context2.next) {
130214
+ case 0:
130215
+ author = _logic.store.any(message, ns.foaf('maker'));
130216
+
130217
+ if (me) {
130218
+ _context2.next = 5;
130219
+ break;
130220
+ }
130221
+
130222
+ alert('You can\'t delete the message, you are not logged in.');
130223
+ _context2.next = 22;
130224
+ break;
130225
+
130226
+ case 5:
130227
+ if (!me.sameTerm(author)) {
130228
+ _context2.next = 21;
130229
+ break;
130230
+ }
130231
+
130232
+ _context2.prev = 6;
130233
+ _context2.next = 9;
130234
+ return channelObject.deleteMessage(message);
130235
+
130236
+ case 9:
130237
+ _context2.next = 18;
130238
+ break;
130239
+
130240
+ case 11:
130241
+ _context2.prev = 11;
130242
+ _context2.t0 = _context2["catch"](6);
130243
+ msg = 'Error deleting messaage ' + _context2.t0;
130244
+ debug.warn(msg);
130245
+ alert(msg);
130246
+ area = userContext.statusArea || messageRow.parentNode;
130247
+ area.appendChild(widgets.errorMessageBlock(dom, msg));
130248
+
130249
+ case 18:
130250
+ messageRow.parentNode.removeChild(messageRow);
130251
+ _context2.next = 22;
130252
+ break;
130253
+
130254
+ case 21:
130255
+ alert('You can\'t delete the message, you are not logged in as the author, ' + author);
130256
+
130257
+ case 22:
130258
+ closeToolbar();
130259
+
130260
+ case 23:
130261
+ case "end":
130262
+ return _context2.stop();
130263
+ }
130264
+ }
130265
+ }, _callee2, null, [[6, 11]]);
130266
+ }));
130267
+ return _deleteMessage.apply(this, arguments);
129851
130268
  }
129852
130269
 
129853
- function deleteThingThen(_x) {
129854
- return _deleteThingThen.apply(this, arguments);
129855
- } // Things only the original author can do
130270
+ function editMessage(_x) {
130271
+ return _editMessage.apply(this, arguments);
130272
+ } // alain TODO allow chat owner to fully delete message + sentiments and replacing messages
129856
130273
 
129857
130274
 
129858
- function _deleteThingThen() {
129859
- _deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(x) {
130275
+ function _editMessage() {
130276
+ _editMessage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(messageRow) {
129860
130277
  return _regenerator["default"].wrap(function _callee3$(_context3) {
129861
130278
  while (1) {
129862
130279
  switch (_context3.prev = _context3.next) {
129863
130280
  case 0:
129864
- _context3.next = 2;
129865
- return updatePromise(kb.connectedStatements(x), []);
130281
+ if (me.value === _logic.store.any(message, ns.foaf('maker')).value) {
130282
+ closeToolbar(); // edit is a one-off action
129866
130283
 
129867
- case 2:
130284
+ (0, _message.switchToEditor)(messageRow, message, channelObject, userContext);
130285
+ }
130286
+
130287
+ case 1:
129868
130288
  case "end":
129869
130289
  return _context3.stop();
129870
130290
  }
129871
130291
  }
129872
130292
  }, _callee3);
129873
130293
  }));
129874
- return _deleteThingThen.apply(this, arguments);
130294
+ return _editMessage.apply(this, arguments);
129875
130295
  }
129876
130296
 
129877
- var me = UI.authn.currentUser(); // If already logged on
130297
+ var div = dom.createElement('div'); // is message deleted ?
129878
130298
 
129879
- if (me && kb.holds(message, ns.foaf('maker'), me)) {
129880
- // button to delete the message
129881
- var deleteButton = UI.widgets.deleteButtonWithCheck(dom, div, 'message', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
129882
- return _regenerator["default"].wrap(function _callee$(_context) {
130299
+ if ((0, _chatLogic.mostRecentVersion)(message).value === ns.schema('dateDeleted').value) return div;
130300
+
130301
+ function closeToolbar() {
130302
+ div.parentElement.parentElement.removeChild(div.parentElement); // remive the TR
130303
+ }
130304
+
130305
+ function deleteThingThen(_x2) {
130306
+ return _deleteThingThen.apply(this, arguments);
130307
+ } // Things only the original author can do
130308
+
130309
+
130310
+ function _deleteThingThen() {
130311
+ _deleteThingThen = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(x) {
130312
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
129883
130313
  while (1) {
129884
- switch (_context.prev = _context.next) {
130314
+ switch (_context4.prev = _context4.next) {
129885
130315
  case 0:
129886
- _context.next = 2;
129887
- return kb.updater.update(kb.connectedStatements[message], []);
130316
+ _context4.next = 2;
130317
+ return _logic.store.updater.update(_logic.store.connectedStatements(x), []);
129888
130318
 
129889
130319
  case 2:
129890
- closeToolbar();
129891
-
129892
- case 3:
129893
130320
  case "end":
129894
- return _context.stop();
130321
+ return _context4.stop();
129895
130322
  }
129896
130323
  }
129897
- }, _callee);
129898
- })));
129899
- div.appendChild(deleteButton);
130324
+ }, _callee4);
130325
+ }));
130326
+ return _deleteThingThen.apply(this, arguments);
130327
+ }
130328
+
130329
+ var me = _index.authn.currentUser(); // If already logged on
130330
+
130331
+
130332
+ if (me && _logic.store.holds(message, ns.foaf('maker'), me)) {
130333
+ // button to delete the message
130334
+ div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage)); // button to edit the message
130335
+
130336
+ div.appendChild(widgets.button(dom, _iconBase.icons.iconBase + PENCIL_ICON, 'edit', function () {
130337
+ return editMessage(messageRow);
130338
+ }));
129900
130339
  } // if mine
129901
130340
  // Things anyone can do if they have a bookmark list async
129902
130341
 
@@ -129927,39 +130366,39 @@ function messageToolbar(message, messageRow, userContext) {
129927
130366
  button.style.backgroundColor = action ? 'yellow' : 'white';
129928
130367
  }
129929
130368
 
129930
- var button = UI.widgets.button(dom, icon, UI.utils.label(actionClass), /*#__PURE__*/function () {
129931
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(_event) {
130369
+ var button = widgets.button(dom, icon, utils.label(actionClass), /*#__PURE__*/function () {
130370
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(_event) {
129932
130371
  var insertMe, dirty, i, a;
129933
- return _regenerator["default"].wrap(function _callee2$(_context2) {
130372
+ return _regenerator["default"].wrap(function _callee$(_context) {
129934
130373
  while (1) {
129935
- switch (_context2.prev = _context2.next) {
130374
+ switch (_context.prev = _context.next) {
129936
130375
  case 0:
129937
130376
  if (!action) {
129938
- _context2.next = 7;
130377
+ _context.next = 7;
129939
130378
  break;
129940
130379
  }
129941
130380
 
129942
- _context2.next = 3;
130381
+ _context.next = 3;
129943
130382
  return deleteThingThen(action);
129944
130383
 
129945
130384
  case 3:
129946
130385
  action = null;
129947
130386
  setColor();
129948
- _context2.next = 25;
130387
+ _context.next = 25;
129949
130388
  break;
129950
130389
 
129951
130390
  case 7:
129952
130391
  // no action
129953
- action = UI.widgets.newThing(doc);
129954
- insertMe = [$rdf.st(action, ns.schema('agent'), context.me, doc), $rdf.st(action, ns.rdf('type'), actionClass, doc), $rdf.st(action, ns.schema('target'), target, doc)];
129955
- _context2.next = 11;
129956
- return updatePromise([], insertMe);
130392
+ action = widgets.newThing(doc);
130393
+ insertMe = [rdf.st(action, ns.schema('agent'), context.me, doc), rdf.st(action, ns.rdf('type'), actionClass, doc), rdf.st(action, ns.schema('target'), target, doc)];
130394
+ _context.next = 11;
130395
+ return _logic.store.updater.update([], insertMe);
129957
130396
 
129958
130397
  case 11:
129959
130398
  setColor();
129960
130399
 
129961
130400
  if (!mutuallyExclusive) {
129962
- _context2.next = 25;
130401
+ _context.next = 25;
129963
130402
  break;
129964
130403
  }
129965
130404
 
@@ -129969,18 +130408,18 @@ function messageToolbar(message, messageRow, userContext) {
129969
130408
 
129970
130409
  case 15:
129971
130410
  if (!(i < mutuallyExclusive.length)) {
129972
- _context2.next = 24;
130411
+ _context.next = 24;
129973
130412
  break;
129974
130413
  }
129975
130414
 
129976
130415
  a = existingAction(mutuallyExclusive[i]);
129977
130416
 
129978
130417
  if (!a) {
129979
- _context2.next = 21;
130418
+ _context.next = 21;
129980
130419
  break;
129981
130420
  }
129982
130421
 
129983
- _context2.next = 20;
130422
+ _context.next = 20;
129984
130423
  return deleteThingThen(a);
129985
130424
 
129986
130425
  case 20:
@@ -129989,34 +130428,35 @@ function messageToolbar(message, messageRow, userContext) {
129989
130428
 
129990
130429
  case 21:
129991
130430
  i++;
129992
- _context2.next = 15;
130431
+ _context.next = 15;
129993
130432
  break;
129994
130433
 
129995
130434
  case 24:
129996
130435
  if (dirty) {
129997
- // UI.widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
129998
- UI.widgets.refreshTree(messageRow); // requires them all to be immediate siblings
130436
+ // widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings
130437
+ widgets.refreshTree(messageRow); // requires them all to be immediate siblings
129999
130438
  }
130000
130439
 
130001
130440
  case 25:
130002
130441
  case "end":
130003
- return _context2.stop();
130442
+ return _context.stop();
130004
130443
  }
130005
130444
  }
130006
- }, _callee2);
130445
+ }, _callee);
130007
130446
  }));
130008
130447
 
130009
- return function (_x2) {
130010
- return _ref2.apply(this, arguments);
130448
+ return function (_x3) {
130449
+ return _ref.apply(this, arguments);
130011
130450
  };
130012
130451
  }());
130013
130452
 
130014
130453
  function existingAction(actionClass) {
130015
- var actions = kb.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
130016
- return kb.holds(x, ns.rdf('type'), actionClass, doc);
130454
+ var actions = _logic.store.each(null, ns.schema('agent'), context.me, doc).filter(function (x) {
130455
+ return _logic.store.holds(x, ns.rdf('type'), actionClass, doc);
130017
130456
  }).filter(function (x) {
130018
- return kb.holds(x, ns.schema('target'), target, doc);
130457
+ return _logic.store.holds(x, ns.schema('target'), target, doc);
130019
130458
  });
130459
+
130020
130460
  return actions.length ? actions[0] : null;
130021
130461
  }
130022
130462
 
@@ -130034,23 +130474,23 @@ function messageToolbar(message, messageRow, userContext) {
130034
130474
  // https://schema.org/AgreeAction
130035
130475
 
130036
130476
 
130037
- me = UI.authn.currentUser(); // If already logged on
130477
+ me = _index.authn.currentUser(); // If already logged on
130478
+ // debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))
130038
130479
 
130039
- if (me) {
130040
- // Things you mnust be logged in for
130480
+ if (me && (0, _chatLogic.mostRecentVersion)(message).value !== ns.schema('dateDeleted').value) {
130041
130481
  var context1 = {
130042
130482
  me: me,
130043
130483
  dom: dom,
130044
130484
  div: div
130045
130485
  };
130046
- div.appendChild(sentimentButton(context1, message, // @@ TODO use UI.widgets.sentimentButton
130047
- UI.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')])); // Thumbs down
130486
+ div.appendChild(sentimentButton(context1, message, // @@ TODO use widgets.sentimentButton
130487
+ _iconBase.icons.iconBase + THUMBS_UP_ICON, ns.schema('AgreeAction'), message.doc(), [ns.schema('DisagreeAction')])); // Thumbs down
130048
130488
 
130049
- div.appendChild(sentimentButton(context1, message, UI.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
130489
+ div.appendChild(sentimentButton(context1, message, _iconBase.icons.iconBase + THUMBS_DOWN_ICON, ns.schema('DisagreeAction'), message.doc(), [ns.schema('AgreeAction')]));
130050
130490
  } // X button to remove the tool UI itself
130051
130491
 
130052
130492
 
130053
- var cancelButton = div.appendChild(UI.widgets.cancelButton(dom));
130493
+ var cancelButton = div.appendChild(widgets.cancelButton(dom));
130054
130494
  cancelButton.style["float"] = 'right';
130055
130495
  cancelButton.firstChild.style.opacity = '0.3';
130056
130496
  cancelButton.addEventListener('click', closeToolbar);
@@ -137683,10 +138123,10 @@ Object.defineProperty(exports, "__esModule", {
137683
138123
  });
137684
138124
  exports["default"] = void 0;
137685
138125
  var _default = {
137686
- buildTime: '2022-01-27T19:22:56Z',
137687
- commit: 'fb2b21e1e0c28c850c52cb27596b0bd4d509a104',
138126
+ buildTime: '2022-01-28T22:55:43Z',
138127
+ commit: '9d83fb1702a1835b5d82fb97bc51b3cb98285373',
137688
138128
  npmInfo: {
137689
- 'solid-ui': '2.4.15',
138129
+ 'solid-ui': '2.4.16',
137690
138130
  npm: '6.14.15',
137691
138131
  ares: '1.18.1',
137692
138132
  brotli: '1.0.9',
@@ -138405,7 +138845,14 @@ function button(dom, iconURI, text, handler) {
138405
138845
 
138406
138846
 
138407
138847
  function cancelButton(dom, handler) {
138408
- return button(dom, cancelIconURI, 'Cancel', handler);
138848
+ var b = button(dom, cancelIconURI, 'Cancel', handler);
138849
+
138850
+ if (b.firstChild) {
138851
+ // sigh for tsc
138852
+ b.firstChild.style.opacity = '0.3'; // Black X is too harsh: current language is grey X
138853
+ }
138854
+
138855
+ return b;
138409
138856
  }
138410
138857
  /* Make a continue button
138411
138858
  *
@@ -148644,25 +149091,25 @@ __webpack_require__.r(__webpack_exports__);
148644
149091
  "use strict";
148645
149092
  __webpack_require__.r(__webpack_exports__);
148646
149093
  /* harmony default export */ __webpack_exports__["default"] = ({
148647
- buildTime: '2022-01-28T10:38:24Z',
148648
- commit: '276e51de4e74a2af05c93703391d461c3bdc82f2',
149094
+ buildTime: '2022-02-09T18:53:32Z',
149095
+ commit: 'b5d50d307d8a17759ad5479106f370bab2910de6',
148649
149096
  npmInfo: {
148650
- mashlib: '1.7.17',
148651
- npm: '6.14.13',
148652
- ares: '1.17.1',
149097
+ mashlib: '1.7.18-alpha',
149098
+ npm: '6.14.15',
149099
+ ares: '1.18.1',
148653
149100
  brotli: '1.0.9',
148654
149101
  cldr: '39.0',
148655
149102
  icu: '69.1',
148656
- llhttp: '2.1.3',
149103
+ llhttp: '2.1.4',
148657
149104
  modules: '83',
148658
149105
  napi: '8',
148659
149106
  nghttp2: '1.42.0',
148660
- node: '14.17.3',
148661
- openssl: '1.1.1k',
149107
+ node: '14.18.3',
149108
+ openssl: '1.1.1l',
148662
149109
  tz: '2021a',
148663
149110
  unicode: '13.0',
148664
- uv: '1.41.0',
148665
- v8: '8.4.371.23-node.67',
149111
+ uv: '1.42.0',
149112
+ v8: '8.4.371.23-node.85',
148666
149113
  zlib: '1.2.11'
148667
149114
  }
148668
149115
  });