solid-ui 2.4.27-2ebac088 → 2.4.27-2f08a162

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"messageTools.js","names":["debug","_interopRequireWildcard","require","_iconBase","ns","rdf","utils","widgets","_bookmarks","_solidLogic","_chatLogic","_message","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","dom","window","document","PENCIL_ICON","THUMBS_UP_ICON","THUMBS_DOWN_ICON","REPLY_ICON","emojiMap","schema","emojiFromActionClass","action","ActionClassFromEmoji","emoji","a","sym","slice","emojiFromAction","content","store","any","sioc","doc","klass","em","sentimentStrip","_x","_x2","_sentimentStrip","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","target","versions","actions","strings","wrap","_callee$","_context","prev","next","allVersions","sent","log","map","version","each","flat","abrupt","createTextNode","join","stop","sentimentStripLinked","_x3","_x4","_sentimentStripLinked","_callee3","strip","refresh","_refresh","_callee3$","_context3","_refresh3","_callee2","sentiments","_callee2$","_context2","innerHTML","isDeleted","length","sort","forEach","ss","_ss","_slicedToArray2","theClass","agent","res","createElement","setAttribute","uri","textContent","appendChild","_refresh2","then","messageToolbar","_x5","_x6","_x7","_x8","_messageToolbar","_callee10","message","messageRow","userContext","channelObject","deleteMessage","_deleteMessage","editMessage","_editMessage","replyInThread","_replyInThread","div","closeToolbar","deleteThingThen","_deleteThingThen","me","sentimentButton","context1","cancelButton","_callee10$","_context10","_sentimentButton","context","icon","actionClass","mutuallyExclusive","setColor","button","style","backgroundColor","label","_ref","_callee4","_event","insertMe","dirty","i","_callee4$","_context4","newThing","st","updater","update","existingAction","refreshTree","_x11","filter","x","holds","_deleteThingThen3","_callee9","_callee9$","_context9","connectedStatements","_deleteThingThen2","_x10","_closeToolbar","parentElement","removeChild","_replyInThread3","_callee8","thread","options","_callee8$","_context8","createThread","chatOptions","Error","showThread","_replyInThread2","_editMessage3","_callee7","_callee7$","_context7","value","foaf","switchToEditor","_editMessage2","_x9","_deleteMessage3","_callee6","author","msg","area","_callee6$","_context6","alert","sameTerm","t0","warn","statusArea","parentNode","errorMessageBlock","_deleteMessage2","mostRecentVersion","t1","authn","currentUser","deleteButtonWithCheck","icons","iconBase","renderBookmarksButton","bookmarkButton","t2","t3","t4","dct","_callee5","_callee5$","_context5","firstChild","opacity","addEventListener"],"sources":["../../src/chat/messageTools.js"],"sourcesContent":["/**\n * Tools for doing things with a message\n * Let us be creative here. Allow all sorts of things to\n * be done to a message - linking to new or old objects in an open way\n *\n * Ideas: Bookmark, Like, star, pin at top of chat, reply as new thread,\n * If you made it originally: edit, delete, attach\n * @packageDocumentation\n */\nimport * as debug from '../debug'\nimport { icons } from '../iconBase'\n// import { media } from '../media/index'\nimport * as ns from '../ns'\n// import * as pad from '../pad'\nimport * as rdf from 'rdflib' // pull in first avoid cross-refs\n// import * as style from '../style'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { renderBookmarksButton } from './bookmarks'\nimport { authn, store } from 'solid-logic'\n\nimport { allVersions, mostRecentVersion, isDeleted } from './chatLogic'\nimport { switchToEditor } from './message'\n\nconst dom = window.document\n\n// THE UNUSED ICONS are here as reminders for possible future functionality\n// const BOOKMARK_ICON = 'noun_45961.svg'\n// const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites\n// const MENU_ICON = 'noun_897914.svg'\n// const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message\n// const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI\nconst PENCIL_ICON = 'noun_253504.svg' // edit a message\n// const SPANNER_ICON = 'noun_344563.svg' -> settings\nconst THUMBS_UP_ICON = 'noun_1384132.svg'\nconst THUMBS_DOWN_ICON = 'noun_1384135.svg'\nconst REPLY_ICON = 'noun-reply-5506924.svg'\n/**\n * Emoji in Unicode\n */\nconst emojiMap = {}\nemojiMap[ns.schema('AgreeAction')] = '👍'\nemojiMap[ns.schema('DisagreeAction')] = '👎'\nemojiMap[ns.schema('EndorseAction')] = '⭐️'\nemojiMap[ns.schema('LikeAction')] = '❤️'\n\nexport function emojiFromActionClass (action) {\n return emojiMap[action] || null\n}\n\nexport function ActionClassFromEmoji (emoji) {\n for (const a in emojiMap) {\n if (emojiMap[a] === emoji) {\n return rdf.sym(a.slice(1, -1)) // remove < >\n }\n }\n return null\n}\n\n// Allow the action to give its own emoji as content,\n// or get the emoji from the class of action.\nexport function emojiFromAction (action) {\n const content = store.any(action, ns.sioc('content'), null, action.doc())\n if (content) return content\n const klass = store.any(action, ns.rdf('type'), null, action.doc())\n if (klass) {\n const em = emojiFromActionClass(klass)\n if (em) return em\n }\n return '⬜️'\n}\n\n/**\n * Create strip of sentiments expressed\n */\nexport async function sentimentStrip (target, doc) { // alain seems not used\n const versions = await allVersions(target)\n debug.log('sentimentStrip Versions for ' + target, versions)\n const actions = versions.map(version => store.each(null, ns.schema('target'), version, doc)).flat()\n debug.log('sentimentStrip: Actions for ' + target, actions)\n const strings = actions.map(action => emojiFromAction(action) || '')\n return dom.createTextNode(strings.join(' '))\n}\n/**\n * Create strip of sentiments expressed, with hyperlinks\n *\n * @param target {NamedNode} - The thing about which they are expressed\n * @param doc {NamedNode} - The document in which they are expressed\n */\nexport async function sentimentStripLinked (target, doc) {\n const strip = dom.createElement('span')\n async function refresh () {\n strip.innerHTML = ''\n if (isDeleted(target)) return strip\n const versions = await allVersions(target)\n debug.log('sentimentStripLinked: Versions for ' + target, versions)\n const actions = versions.map(version => store.each(null, ns.schema('target'), version, doc)).flat()\n debug.log('sentimentStripLinked: Actions for ' + target, actions)\n if (actions.length === 0) return strip\n const sentiments = actions.map(a => [\n store.any(a, ns.rdf('type'), null, doc),\n store.any(a, ns.sioc('content'), null, doc),\n store.any(a, ns.schema('agent'), null, doc)\n ])\n debug.log(' Actions sentiments ', sentiments)\n sentiments.sort()\n sentiments.forEach(ss => {\n const [theClass, content, agent] = ss\n let res\n if (agent) {\n res = dom.createElement('a')\n res.setAttribute('href', agent.uri)\n } else {\n res = dom.createTextNode('')\n }\n res.textContent = content || emojiMap[theClass] || '⬜️'\n strip.appendChild(res)\n })\n debug.log(' Actions strip ', strip)\n }\n refresh().then(debug.log('sentimentStripLinked: sentimentStripLinked async refreshed'))\n strip.refresh = refresh\n return strip\n}\n/**\n * Creates a message toolbar component\n */\nexport async function messageToolbar (message, messageRow, userContext, channelObject) {\n async function deleteMessage () {\n const author = store.any(message, ns.foaf('maker'))\n if (!me) {\n alert('You can\\'t delete the message, you are not logged in.')\n } else if (me.sameTerm(author)) {\n try {\n await channelObject.deleteMessage(message)\n } catch (err) {\n const msg = 'Error deleting messaage ' + err\n debug.warn(msg)\n alert(msg)\n const area = userContext.statusArea || messageRow.parentNode\n area.appendChild(widgets.errorMessageBlock(dom, msg))\n }\n messageRow.parentNode.removeChild(messageRow)\n } else {\n alert('You can\\'t delete the message, you are not logged in as the author, ' + author)\n }\n closeToolbar()\n }\n\n async function editMessage (messageRow) {\n if (me.value === store.any(message, ns.foaf('maker')).value) {\n closeToolbar() // edit is a one-off action\n await switchToEditor(messageRow, message, channelObject, userContext)\n }\n }\n\n async function replyInThread () {\n const thread = await channelObject.createThread(message)\n const options = userContext.chatOptions\n if (!options) throw new Error('replyInThread: missing options')\n options.showThread(thread, options)\n closeToolbar() // a one-off action\n }\n\n // alain: TODO allow chat owner to fully delete message + sentiments and replacing messages\n\n const div = dom.createElement('div')\n // is message deleted ?\n if (await mostRecentVersion(message).value === ns.schema('dateDeleted').value) return div\n function closeToolbar () {\n div.parentElement.parentElement.removeChild(div.parentElement) // remive the TR\n }\n\n async function deleteThingThen (x) {\n await store.updater.update(store.connectedStatements(x), [])\n }\n\n // Things only the original author can do\n let me = authn.currentUser() // If already logged on\n if (me && store.holds(message, ns.foaf('maker'), me)) {\n // button to delete the message\n div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage))\n // button to edit the message\n div.appendChild(widgets.button(dom, icons.iconBase + PENCIL_ICON, 'edit', () => editMessage(messageRow)))\n } // if mine\n // Things anyone can do if they have a bookmark list async\n /*\n var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)\n if (bookmarkButton) {\n div.appendChild(bookmarkButton)\n }\n */\n // Things anyone can do if they have a bookmark list\n\n renderBookmarksButton(userContext).then(bookmarkButton => {\n if (bookmarkButton) div.appendChild(bookmarkButton)\n })\n\n /** Button to allow user to express a sentiment (like, endorse, etc) about a target\n *\n * @param context {Object} - Provide dom and me\n * @param target {NamedNode} - The thing the user expresses an opnion about\n * @param icon {uristring} - The icon to be used for the button\n * @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action\n * @param doc - {NamedNode} - the Solid document iunto which the data should be written\n * @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive\n */\n function sentimentButton (\n context,\n target,\n icon,\n actionClass,\n doc,\n mutuallyExclusive\n ) {\n function setColor () {\n button.style.backgroundColor = action ? 'yellow' : 'white'\n }\n const button = widgets.button(\n dom,\n icon,\n utils.label(actionClass),\n async function (_event) {\n if (action) {\n await deleteThingThen(action)\n action = null\n setColor()\n } else {\n // no action\n action = widgets.newThing(doc)\n const insertMe = [\n rdf.st(action, ns.schema('agent'), context.me, doc),\n rdf.st(action, ns.rdf('type'), actionClass, doc),\n rdf.st(action, ns.schema('target'), target, doc)\n ]\n await store.updater.update([], insertMe)\n setColor()\n\n if (mutuallyExclusive) {\n // Delete incompative sentiments\n let dirty = false\n for (let i = 0; i < mutuallyExclusive.length; i++) {\n const a = existingAction(mutuallyExclusive[i])\n if (a) {\n await deleteThingThen(a) // but how refresh? refreshTree the parent?\n dirty = true\n }\n }\n if (dirty) {\n // widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings\n widgets.refreshTree(messageRow) // requires them all to be immediate siblings\n }\n }\n }\n }\n )\n function existingAction (actionClass) {\n const actions = store\n .each(null, ns.schema('agent'), context.me, doc)\n .filter(x => store.holds(x, ns.rdf('type'), actionClass, doc))\n .filter(x => store.holds(x, ns.schema('target'), target, doc))\n return actions.length ? actions[0] : null\n }\n function refresh () {\n action = existingAction(actionClass)\n setColor()\n }\n let action\n button.refresh = refresh // If the file changes, refresh live\n refresh()\n return button\n }\n\n // THUMBS_UP_ICON\n // https://schema.org/AgreeAction\n me = authn.currentUser() // If already logged on\n\n if (me && (await mostRecentVersion(message).value !== ns.schema('dateDeleted').value)) {\n const context1 = { me, dom, div }\n div.appendChild(\n sentimentButton(\n context1,\n message, // @@ TODO use widgets.sentimentButton\n icons.iconBase + THUMBS_UP_ICON,\n ns.schema('AgreeAction'),\n message.doc(),\n [ns.schema('DisagreeAction')]\n )\n )\n // Thumbs down\n div.appendChild(\n sentimentButton(\n context1,\n message,\n icons.iconBase + THUMBS_DOWN_ICON,\n ns.schema('DisagreeAction'),\n message.doc(),\n [ns.schema('AgreeAction')]\n )\n )\n }\n // Reply buttton\n\n if (store.any(message, ns.dct('created'))) { // Looks like a messsage? Bar can be used for other things\n div.appendChild(widgets.button(dom, icons.iconBase + REPLY_ICON, 'Reply in thread', async () => {\n await replyInThread()\n }))\n }\n // X button to remove the tool UI itself\n const cancelButton = div.appendChild(widgets.cancelButton(dom))\n cancelButton.style.float = 'right'\n cancelButton.firstChild.style.opacity = '0.3'\n cancelButton.addEventListener('click', closeToolbar)\n return div\n}\n"],"mappings":";;;;;;;;;;;;;;;;AASA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,EAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,IAAAG,GAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAEA,IAAAI,KAAA,GAAAL,uBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,uBAAA,CAAAC,OAAA;AACA,IAAAM,UAAA,G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,CAAC4F,UAAU,CAAClF,KAAK,CAACmF,OAAO,GAAG,KAAK;UAC7C7F,YAAY,CAAC8F,gBAAgB,CAAC,OAAO,EAAEpG,YAAY,CAAC;UAAA,OAAAQ,UAAA,CAAA/D,MAAA,WAC7CsD,GAAG;QAAA;QAAA;UAAA,OAAAS,UAAA,CAAA5D,IAAA;MAAA;IAAA,GAAAwC,SAAA;EAAA,CACX;EAAA,OAAAD,eAAA,CAAAhE,KAAA,OAAAC,SAAA;AAAA"}
1
+ {"version":3,"file":"messageTools.js","names":["debug","_interopRequireWildcard","require","_iconBase","ns","rdf","utils","widgets","_bookmarks","_solidLogic","_chatLogic","_message","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","dom","window","document","PENCIL_ICON","THUMBS_UP_ICON","THUMBS_DOWN_ICON","emoji","schema","sentimentStrip","target","doc","latest","mostRecentVersion","actions","store","holds","value","each","sentiments","map","a","any","sort","strings","x","createTextNode","join","sentimentStripLinked","strip","createElement","refresh","innerHTML","uri","forEach","ss","_ss","_slicedToArray2","theClass","agent","res","setAttribute","textContent","appendChild","messageToolbar","message","messageRow","userContext","channelObject","deleteMessage","_deleteMessage","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee2","author","msg","area","wrap","_callee2$","_context2","prev","next","foaf","me","alert","sameTerm","t0","warn","statusArea","parentNode","errorMessageBlock","removeChild","closeToolbar","stop","editMessage","_x","_editMessage","_callee3","_callee3$","_context3","switchToEditor","div","parentElement","deleteThingThen","_x2","_deleteThingThen","_callee4","_callee4$","_context4","updater","update","connectedStatements","authn","currentUser","deleteButtonWithCheck","button","icons","iconBase","renderBookmarksButton","then","bookmarkButton","sentimentButton","context","icon","actionClass","mutuallyExclusive","setColor","style","backgroundColor","action","label","_ref","_callee","_event","insertMe","dirty","i","_callee$","_context","newThing","st","length","existingAction","refreshTree","_x3","filter","context1","cancelButton","firstChild","opacity","addEventListener"],"sources":["../../src/chat/messageTools.js"],"sourcesContent":["/**\n * Tools for doing things with a message\n * Let us be creative here. Allow all sorts of things to\n * be done to a message - linking to new or old objects in an open way\n *\n * Ideas: Bookmark, Like, star, pin at top of chat, reply as new thread,\n * If you made it originally: edit, delete, attach\n * @packageDocumentation\n */\nimport * as debug from '../debug'\nimport { icons } from '../iconBase'\n// import { media } from '../media/index'\nimport * as ns from '../ns'\n// import * as pad from '../pad'\nimport * as rdf from 'rdflib' // pull in first avoid cross-refs\n// import * as style from '../style'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { renderBookmarksButton } from './bookmarks'\nimport { authn, store } from 'solid-logic'\n\nimport { mostRecentVersion } from './chatLogic'\nimport { switchToEditor } from './message'\n\nconst dom = window.document\n\n// THE UNUSED ICONS are here as reminders for possible future functionality\n// const BOOKMARK_ICON = 'noun_45961.svg'\n// const HEART_ICON = 'noun_130259.svg' -> Add this to my (private) favorites\n// const MENU_ICON = 'noun_897914.svg'\n// const PAPERCLIP_ICON = 'noun_25830.svg' -> add attachments to this message\n// const PIN_ICON = 'noun_562340.svg' -> pin this message permanently in the chat UI\nconst PENCIL_ICON = 'noun_253504.svg' // edit a message\n// const SPANNER_ICON = 'noun_344563.svg' -> settings\nconst THUMBS_UP_ICON = 'noun_1384132.svg'\nconst THUMBS_DOWN_ICON = 'noun_1384135.svg'\n/**\n * Emoji in Unicode\n */\nconst emoji = {}\nemoji[ns.schema('AgreeAction')] = '👍'\nemoji[ns.schema('DisagreeAction')] = '👎'\nemoji[ns.schema('EndorseAction')] = '⭐️'\nemoji[ns.schema('LikeAction')] = '❤️'\n\n/**\n * Create strip of sentiments expressed\n */\nexport function sentimentStrip (target, doc) { // alain seems not used\n const latest = mostRecentVersion(target)\n const actions = store.holds(latest, ns.schema('dateDeleted').value, null, latest.doc()) ? store.each(null, ns.schema('target'), target, doc) : []\n const sentiments = actions.map(a => store.any(a, ns.rdf('type'), null, doc))\n sentiments.sort()\n const strings = sentiments.map(x => emoji[x] || '')\n return dom.createTextNode(strings.join(' '))\n}\n/**\n * Create strip of sentiments expressed, with hyperlinks\n *\n * @param target {NamedNode} - The thing about which they are expressed\n * @param doc {NamedNode} - The document in which they are expressed\n */\nexport function sentimentStripLinked (target, doc) {\n const strip = dom.createElement('span')\n function refresh () {\n strip.innerHTML = ''\n const actions = (mostRecentVersion(target).uri !== ns.schema('dateDeleted').uri) ? store.each(null, ns.schema('target'), target, doc) : []\n const sentiments = actions.map(a => [\n store.any(a, ns.rdf('type'), null, doc),\n store.any(a, ns.schema('agent'), null, doc)\n ])\n sentiments.sort()\n sentiments.forEach(ss => {\n const [theClass, agent] = ss\n let res\n if (agent) {\n res = dom.createElement('a')\n res.setAttribute('href', agent.uri)\n } else {\n res = dom.createTextNode('')\n }\n res.textContent = emoji[theClass] || '*'\n strip.appendChild(res)\n })\n }\n refresh()\n strip.refresh = refresh\n return strip\n}\n/**\n * Creates a message toolbar component\n */\nexport function messageToolbar (message, messageRow, userContext, channelObject) {\n async function deleteMessage () {\n const author = store.any(message, ns.foaf('maker'))\n if (!me) {\n alert('You can\\'t delete the message, you are not logged in.')\n } else if (me.sameTerm(author)) {\n try {\n await channelObject.deleteMessage(message)\n } catch (err) {\n const msg = 'Error deleting messaage ' + err\n debug.warn(msg)\n alert(msg)\n const area = userContext.statusArea || messageRow.parentNode\n area.appendChild(widgets.errorMessageBlock(dom, msg))\n }\n messageRow.parentNode.removeChild(messageRow)\n } else {\n alert('You can\\'t delete the message, you are not logged in as the author, ' + author)\n }\n closeToolbar()\n }\n\n async function editMessage (messageRow) {\n if (me.value === store.any(message, ns.foaf('maker')).value) {\n closeToolbar() // edit is a one-off action\n switchToEditor(messageRow, message, channelObject, userContext)\n }\n }\n\n // alain TODO allow chat owner to fully delete message + sentiments and replacing messages\n\n const div = dom.createElement('div')\n // is message deleted ?\n if (mostRecentVersion(message).value === ns.schema('dateDeleted').value) return div\n function closeToolbar () {\n div.parentElement.parentElement.removeChild(div.parentElement) // remive the TR\n }\n\n async function deleteThingThen (x) {\n await store.updater.update(store.connectedStatements(x), [])\n }\n\n // Things only the original author can do\n let me = authn.currentUser() // If already logged on\n if (me && store.holds(message, ns.foaf('maker'), me)) {\n // button to delete the message\n div.appendChild(widgets.deleteButtonWithCheck(dom, div, 'message', deleteMessage))\n // button to edit the message\n div.appendChild(widgets.button(dom, icons.iconBase + PENCIL_ICON, 'edit', () => editMessage(messageRow)))\n } // if mine\n // Things anyone can do if they have a bookmark list async\n /*\n var bookmarkButton = await bookmarks.renderBookmarksButton(userContext)\n if (bookmarkButton) {\n div.appendChild(bookmarkButton)\n }\n */\n // Things anyone can do if they have a bookmark list\n\n renderBookmarksButton(userContext).then(bookmarkButton => {\n if (bookmarkButton) div.appendChild(bookmarkButton)\n })\n\n /** Button to allow user to express a sentiment (like, endorse, etc) about a target\n *\n * @param context {Object} - Provide dom and me\n * @param target {NamedNode} - The thing the user expresses an opnion about\n * @param icon {uristring} - The icon to be used for the button\n * @param actionClass {NamedNode} - The RDF class - typically a subclass of schema:Action\n * @param doc - {NamedNode} - the Solid document iunto which the data should be written\n * @param mutuallyExclusive {Array<NamedNode>} - Any RDF classes of sentimentswhich are mutiually exclusive\n */\n function sentimentButton (\n context,\n target,\n icon,\n actionClass,\n doc,\n mutuallyExclusive\n ) {\n function setColor () {\n button.style.backgroundColor = action ? 'yellow' : 'white'\n }\n const button = widgets.button(\n dom,\n icon,\n utils.label(actionClass),\n async function (_event) {\n if (action) {\n await deleteThingThen(action)\n action = null\n setColor()\n } else {\n // no action\n action = widgets.newThing(doc)\n const insertMe = [\n rdf.st(action, ns.schema('agent'), context.me, doc),\n rdf.st(action, ns.rdf('type'), actionClass, doc),\n rdf.st(action, ns.schema('target'), target, doc)\n ]\n await store.updater.update([], insertMe)\n setColor()\n\n if (mutuallyExclusive) {\n // Delete incompative sentiments\n let dirty = false\n for (let i = 0; i < mutuallyExclusive.length; i++) {\n const a = existingAction(mutuallyExclusive[i])\n if (a) {\n await deleteThingThen(a) // but how refresh? refreshTree the parent?\n dirty = true\n }\n }\n if (dirty) {\n // widgets.refreshTree(button.parentNode) // requires them all to be immediate siblings\n widgets.refreshTree(messageRow) // requires them all to be immediate siblings\n }\n }\n }\n }\n )\n function existingAction (actionClass) {\n const actions = store\n .each(null, ns.schema('agent'), context.me, doc)\n .filter(x => store.holds(x, ns.rdf('type'), actionClass, doc))\n .filter(x => store.holds(x, ns.schema('target'), target, doc))\n return actions.length ? actions[0] : null\n }\n function refresh () {\n action = existingAction(actionClass)\n setColor()\n }\n let action\n button.refresh = refresh // If the file changes, refresh live\n refresh()\n return button\n }\n\n // THUMBS_UP_ICON\n // https://schema.org/AgreeAction\n me = authn.currentUser() // If already logged on\n // debug.log('Actions 3' + mostRecentVersion(message).value + ' ' + ns.schema('dateDeleted').value + ' ' + (mostRecentVersion(message).value !== ns.schema('dateDeleted').value))\n\n if (me && (mostRecentVersion(message).value !== ns.schema('dateDeleted').value)) {\n const context1 = { me, dom, div }\n div.appendChild(\n sentimentButton(\n context1,\n message, // @@ TODO use widgets.sentimentButton\n icons.iconBase + THUMBS_UP_ICON,\n ns.schema('AgreeAction'),\n message.doc(),\n [ns.schema('DisagreeAction')]\n )\n )\n // Thumbs down\n div.appendChild(\n sentimentButton(\n context1,\n message,\n icons.iconBase + THUMBS_DOWN_ICON,\n ns.schema('DisagreeAction'),\n message.doc(),\n [ns.schema('AgreeAction')]\n )\n )\n }\n // X button to remove the tool UI itself\n const cancelButton = div.appendChild(widgets.cancelButton(dom))\n cancelButton.style.float = 'right'\n cancelButton.firstChild.style.opacity = '0.3'\n cancelButton.addEventListener('click', closeToolbar)\n return div\n}\n"],"mappings":";;;;;;;;;;;;;AASA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAAE,EAAA,GAAAH,uBAAA,CAAAC,OAAA;AAEA,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C,WAAW,CAACrE,OAAO,CAAC4J,YAAY,CAACjI,GAAG,CAAC,CAAC;EAC/DiI,YAAY,CAACpB,KAAK,SAAM,GAAG,OAAO;EAClCoB,YAAY,CAACC,UAAU,CAACrB,KAAK,CAACsB,OAAO,GAAG,KAAK;EAC7CF,YAAY,CAACG,gBAAgB,CAAC,OAAO,EAAE1D,YAAY,CAAC;EACpD,OAAOS,GAAG;AACZ"}
@@ -53,7 +53,8 @@ function thread(dom, kb, subject, messageStore, options) {
53
53
 
54
54
  var div = dom.createElement('div');
55
55
  // eslint-disable-next-line prefer-const
56
- var messageTable;
56
+ var messageTable; // Shared by initial build and addMessageFromBindings
57
+
57
58
  var me;
58
59
  var updater = _solidLogic.store.updater;
59
60
  var anchor = function anchor(text, term) {
@@ -100,51 +101,34 @@ function thread(dom, kb, subject, messageStore, options) {
100
101
  form.appendChild(rhs);
101
102
  form.AJAR_date = '9999-01-01T00:00:00Z'; // ISO format for field sort
102
103
 
103
- var sendMessage = /*#__PURE__*/function () {
104
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
105
- var _yield$appendMsg, message, dateStamp, sts, sendComplete;
106
- return _regenerator["default"].wrap(function _callee$(_context) {
107
- while (1) switch (_context.prev = _context.next) {
108
- case 0:
109
- // titlefield.setAttribute('class','pendingedit')
110
- // titlefield.disabled = true
111
- field.setAttribute('class', 'pendingedit');
112
- field.disabled = true;
113
- _context.next = 4;
114
- return appendMsg(field.value);
115
- case 4:
116
- _yield$appendMsg = _context.sent;
117
- message = _yield$appendMsg.message;
118
- dateStamp = _yield$appendMsg.dateStamp;
119
- sts = _yield$appendMsg.sts;
120
- sendComplete = function sendComplete(uri, success, body) {
121
- if (!success) {
122
- form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body));
123
- } else {
124
- var bindings = {
125
- '?msg': message,
126
- '?content': _solidLogic.store.literal(field.value),
127
- '?date': dateStamp,
128
- '?creator': me
129
- };
130
- renderMessage(bindings, false); // not green
104
+ var sendMessage = function sendMessage() {
105
+ // titlefield.setAttribute('class','pendingedit')
106
+ // titlefield.disabled = true
107
+ field.setAttribute('class', 'pendingedit');
108
+ field.disabled = true;
109
+ var _appendMsg = appendMsg(field.value),
110
+ message = _appendMsg.message,
111
+ dateStamp = _appendMsg.dateStamp,
112
+ sts = _appendMsg.sts;
113
+ var sendComplete = function sendComplete(uri, success, body) {
114
+ if (!success) {
115
+ form.appendChild(UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body));
116
+ } else {
117
+ var bindings = {
118
+ '?msg': message,
119
+ '?content': _solidLogic.store.literal(field.value),
120
+ '?date': dateStamp,
121
+ '?creator': me
122
+ };
123
+ renderMessage(bindings, false); // not green
131
124
 
132
- field.value = ''; // clear from out for reuse
133
- field.setAttribute('class', '');
134
- field.disabled = false;
135
- }
136
- };
137
- updater.update([], sts, sendComplete);
138
- case 10:
139
- case "end":
140
- return _context.stop();
141
- }
142
- }, _callee);
143
- }));
144
- return function sendMessage() {
145
- return _ref.apply(this, arguments);
125
+ field.value = ''; // clear from out for reuse
126
+ field.setAttribute('class', '');
127
+ field.disabled = false;
128
+ }
146
129
  };
147
- }();
130
+ updater.update([], sts, sendComplete);
131
+ };
148
132
  form.appendChild(dom.createElement('br'));
149
133
  var field, sendButton;
150
134
  var turnOnInput = function turnOnInput() {
@@ -155,31 +139,15 @@ function thread(dom, kb, subject, messageStore, options) {
155
139
  field.rows = 3;
156
140
  // field.cols = 40
157
141
  field.setAttribute('style', messageBodyStyle + 'background-color: #eef;');
158
- field.addEventListener('keyup', /*#__PURE__*/function () {
159
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(e) {
160
- return _regenerator["default"].wrap(function _callee2$(_context2) {
161
- while (1) switch (_context2.prev = _context2.next) {
162
- case 0:
163
- if (!(e.keyCode === 13)) {
164
- _context2.next = 4;
165
- break;
166
- }
167
- if (e.altKey) {
168
- _context2.next = 4;
169
- break;
170
- }
171
- _context2.next = 4;
172
- return sendMessage();
173
- case 4:
174
- case "end":
175
- return _context2.stop();
176
- }
177
- }, _callee2);
178
- }));
179
- return function (_x) {
180
- return _ref2.apply(this, arguments);
181
- };
182
- }(), false);
142
+ field.addEventListener('keyup', function (e) {
143
+ // User preference?
144
+ if (e.keyCode === 13) {
145
+ if (!e.altKey) {
146
+ // Alt-Enter just adds a new line
147
+ sendMessage();
148
+ }
149
+ }
150
+ }, false);
183
151
  rhs.innerHTML = '';
184
152
  sendButton = UI.widgets.button(dom, UI.icons.iconBase + 'noun_383448.svg', 'Send');
185
153
  sendButton.setAttribute('style', UI.style.buttonStyle + 'float: right;');
@@ -196,64 +164,94 @@ function thread(dom, kb, subject, messageStore, options) {
196
164
  });
197
165
  return form;
198
166
  };
199
- var appendMsg = /*#__PURE__*/function () {
200
- var _ref3 = (0, _asyncToGenerator2["default"])(function (fieldValue) {
201
- var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
202
- var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
203
- return /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
204
- var sts, now, timestamp, dateStamp, message, msgBody;
205
- return _regenerator["default"].wrap(function _callee3$(_context3) {
206
- while (1) switch (_context3.prev = _context3.next) {
207
- case 0:
208
- // alain
209
- sts = [];
210
- now = new Date();
211
- timestamp = '' + now.getTime();
212
- dateStamp = $rdf.term(now); // http://www.w3schools.com/jsref/jsref_obj_date.asp
213
- message = _solidLogic.store.sym(messageStore.uri + '#' + 'Msg' + timestamp);
214
- if (!(options === 'edit' || options === 'delete')) {
215
- _context3.next = 18;
216
- break;
217
- }
218
- _context3.t0 = sts;
219
- _context3.t1 = $rdf.Statement;
220
- _context3.next = 10;
221
- return mostRecentVersion(oldMsg);
222
- case 10:
223
- _context3.t2 = _context3.sent;
224
- _context3.t3 = DCT('isReplacedBy');
225
- _context3.t4 = message;
226
- _context3.t5 = messageStore;
227
- _context3.t6 = new _context3.t1(_context3.t2, _context3.t3, _context3.t4, _context3.t5);
228
- _context3.t0.push.call(_context3.t0, _context3.t6);
229
- _context3.next = 19;
230
- break;
231
- case 18:
232
- sts.push(new $rdf.Statement(subject, ns.wf('message'), message, messageStore));
233
- case 19:
234
- // sts.push(new $rdf.Statement(message, ns.dc('title'), store.literal(titlefield.value), messageStore))
235
- msgBody = options !== 'delete' ? fieldValue : "message deleted\nby ".concat(nick(me));
236
- sts.push(new $rdf.Statement(message, ns.sioc('content'), _solidLogic.store.literal(msgBody), messageStore));
237
- sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, messageStore));
238
- if (me) {
239
- sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, messageStore));
240
- }
241
- return _context3.abrupt("return", {
242
- message: message,
243
- dateStamp: dateStamp,
244
- sts: sts
245
- });
246
- case 24:
247
- case "end":
248
- return _context3.stop();
249
- }
250
- }, _callee3);
251
- })();
252
- });
253
- return function appendMsg(_x2) {
254
- return _ref3.apply(this, arguments);
167
+
168
+ /* const sendMessage = function (oldMsg, options) { // alain
169
+ // titlefield.setAttribute('class','pendingedit')
170
+ // titlefield.disabled = true
171
+ field.setAttribute('class', 'pendingedit')
172
+ field.disabled = true
173
+ const sts = []
174
+ const now = new Date()
175
+ const timestamp = '' + now.getTime()
176
+ const dateStamp = $rdf.term(now)
177
+ // http://www.w3schools.com/jsref/jsref_obj_date.asp
178
+ const message = store.sym(messageStore.uri + '#' + 'Msg' + timestamp)
179
+ if (options === 'edit' || options === 'delete') {
180
+ sts.push(
181
+ new $rdf.Statement(mostRecentVersion(oldMsg), DCT('isReplacedBy'), message, messageStore)
182
+ )
183
+ } else {
184
+ sts.push(
185
+ new $rdf.Statement(subject, ns.wf('message'), message, messageStore)
186
+ )
187
+ }
188
+ // sts.push(new $rdf.Statement(message, ns.dc('title'), store.literal(titlefield.value), messageStore))
189
+ const msgBody = options !== 'delete' ? field.value : `message deleted\nby ${nick(me)}`
190
+ sts.push(
191
+ new $rdf.Statement(
192
+ message,
193
+ ns.sioc('content'),
194
+ store.literal(msgBody),
195
+ messageStore
196
+ )
197
+ )
198
+ sts.push(
199
+ new $rdf.Statement(message, DCT('created'), dateStamp, messageStore)
200
+ )
201
+ if (me) {
202
+ sts.push(
203
+ new $rdf.Statement(message, ns.foaf('maker'), me, messageStore)
204
+ )
205
+ }
206
+ const sendComplete = function (uri, success, body) {
207
+ if (!success) {
208
+ form.appendChild(
209
+ UI.widgets.errorMessageBlock(dom, 'Error writing message: ' + body)
210
+ )
211
+ } else {
212
+ const bindings = {
213
+ '?msg': message,
214
+ '?content': store.literal(field.value),
215
+ '?date': dateStamp,
216
+ '?creator': me
217
+ }
218
+ renderMessage(bindings, false) // not green
219
+ field.value = '' // clear from out for reuse
220
+ field.setAttribute('class', '')
221
+ field.disabled = false
222
+ }
223
+ }
224
+ updater.update([], sts, sendComplete)
225
+ } */
226
+
227
+ var appendMsg = function appendMsg(fieldValue) {
228
+ var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
229
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
230
+ // alain
231
+ var sts = [];
232
+ var now = new Date();
233
+ var timestamp = '' + now.getTime();
234
+ var dateStamp = $rdf.term(now);
235
+ // http://www.w3schools.com/jsref/jsref_obj_date.asp
236
+ var message = _solidLogic.store.sym(messageStore.uri + '#' + 'Msg' + timestamp);
237
+ if (options === 'edit' || options === 'delete') {
238
+ sts.push(new $rdf.Statement(mostRecentVersion(oldMsg), DCT('isReplacedBy'), message, messageStore));
239
+ } else {
240
+ sts.push(new $rdf.Statement(subject, ns.wf('message'), message, messageStore));
241
+ }
242
+ // sts.push(new $rdf.Statement(message, ns.dc('title'), store.literal(titlefield.value), messageStore))
243
+ var msgBody = options !== 'delete' ? fieldValue : "message deleted\nby ".concat(nick(me));
244
+ sts.push(new $rdf.Statement(message, ns.sioc('content'), _solidLogic.store.literal(msgBody), messageStore));
245
+ sts.push(new $rdf.Statement(message, DCT('created'), dateStamp, messageStore));
246
+ if (me) {
247
+ sts.push(new $rdf.Statement(message, ns.foaf('maker'), me, messageStore));
248
+ }
249
+ return {
250
+ message: message,
251
+ dateStamp: dateStamp,
252
+ sts: sts
255
253
  };
256
- }();
254
+ };
257
255
  function nick(person) {
258
256
  var s = _solidLogic.store.any(person, UI.ns.foaf('nick'));
259
257
  if (s) return '' + s.value;
@@ -308,15 +306,15 @@ function thread(dom, kb, subject, messageStore, options) {
308
306
  return msg;
309
307
  };
310
308
  var _deleteMessage = /*#__PURE__*/function () {
311
- var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(message) {
309
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(message) {
312
310
  var deletions;
313
- return _regenerator["default"].wrap(function _callee4$(_context4) {
314
- while (1) switch (_context4.prev = _context4.next) {
311
+ return _regenerator["default"].wrap(function _callee$(_context) {
312
+ while (1) switch (_context.prev = _context.next) {
315
313
  case 0:
316
- _context4.next = 2;
314
+ _context.next = 2;
317
315
  return _solidLogic.store.connectedStatements(message, messageStore);
318
316
  case 2:
319
- deletions = _context4.sent;
317
+ deletions = _context.sent;
320
318
  updater.update(deletions, [], function (uri, ok, body) {
321
319
  if (!ok) {
322
320
  announce.error('Cant delete messages:' + body);
@@ -326,12 +324,12 @@ function thread(dom, kb, subject, messageStore, options) {
326
324
  });
327
325
  case 4:
328
326
  case "end":
329
- return _context4.stop();
327
+ return _context.stop();
330
328
  }
331
- }, _callee4);
329
+ }, _callee);
332
330
  }));
333
- return function _deleteMessage(_x3) {
334
- return _ref4.apply(this, arguments);
331
+ return function _deleteMessage(_x) {
332
+ return _ref.apply(this, arguments);
335
333
  };
336
334
  }();
337
335
  var addMessage = function addMessage(message) {
@@ -396,37 +394,17 @@ function thread(dom, kb, subject, messageStore, options) {
396
394
  }, false);
397
395
  var sureButton = dom.createElement('button');
398
396
  sureButton.textContent = 'Delete message';
399
- td3.appendChild(sureButton).addEventListener('click', /*#__PURE__*/function () {
400
- var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(_event) {
401
- var _yield$appendMsg2, sts;
402
- return _regenerator["default"].wrap(function _callee5$(_context5) {
403
- while (1) switch (_context5.prev = _context5.next) {
404
- case 0:
405
- // alain test for delete or edit depending on me = maker
406
- td3.removeChild(sureButton);
407
- td3.removeChild(cancelButton);
408
- // deleteMessage(message) // alain or sendMessage(message, 'delete' or 'edit') //alain
409
- if (!(me.value === _solidLogic.store.any(message, ns.foaf('maker')).value)) {
410
- _context5.next = 8;
411
- break;
412
- }
413
- _context5.next = 5;
414
- return appendMsg();
415
- case 5:
416
- _yield$appendMsg2 = _context5.sent;
417
- sts = _yield$appendMsg2.sts;
418
- // alain
419
- updater.update([], sts);
420
- case 8:
421
- case "end":
422
- return _context5.stop();
423
- }
424
- }, _callee5);
425
- }));
426
- return function (_x4) {
427
- return _ref5.apply(this, arguments);
428
- };
429
- }(), false);
397
+ td3.appendChild(sureButton).addEventListener('click', function (_event) {
398
+ // alain test for delete or edit depending on me = maker
399
+ td3.removeChild(sureButton);
400
+ td3.removeChild(cancelButton);
401
+ // deleteMessage(message) // alain or sendMessage(message, 'delete' or 'edit') //alain
402
+ if (me.value === _solidLogic.store.any(message, ns.foaf('maker')).value) {
403
+ var _appendMsg2 = appendMsg(),
404
+ sts = _appendMsg2.sts; // alain
405
+ updater.update([], sts);
406
+ }
407
+ }, false);
430
408
  }, false);
431
409
  };
432
410