solid-ui 2.4.30 → 2.4.31-7c0461b3

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.
Files changed (74) hide show
  1. package/dist/805.solid-ui.min.js +1 -1
  2. package/dist/805.solid-ui.min.js.map +1 -1
  3. package/dist/solid-ui.js +6264 -2826
  4. package/dist/solid-ui.js.map +1 -1
  5. package/dist/solid-ui.min.js +1 -1
  6. package/dist/solid-ui.min.js.LICENSE.txt +1 -1
  7. package/dist/solid-ui.min.js.map +1 -1
  8. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js +1965 -1965
  9. package/dist/vendors-node_modules_jsonld_lib_jsonld_js.solid-ui.js.map +1 -1
  10. package/lib/chat/bookmarks.js +6 -7
  11. package/lib/chat/bookmarks.js.map +1 -1
  12. package/lib/chat/chatLogic.js +251 -66
  13. package/lib/chat/chatLogic.js.map +1 -1
  14. package/lib/chat/dateFolder.js +131 -126
  15. package/lib/chat/dateFolder.js.map +1 -1
  16. package/lib/chat/infinite.js +611 -416
  17. package/lib/chat/infinite.js.map +1 -1
  18. package/lib/chat/message.js +328 -191
  19. package/lib/chat/message.js.map +1 -1
  20. package/lib/chat/messageTools.js +462 -276
  21. package/lib/chat/messageTools.js.map +1 -1
  22. package/lib/chat/thread.js +299 -208
  23. package/lib/chat/thread.js.map +1 -1
  24. package/lib/login/login.d.ts.map +1 -1
  25. package/lib/login/login.js +14 -18
  26. package/lib/login/login.js.map +1 -1
  27. package/lib/media/media-capture.d.ts +2 -2
  28. package/lib/media/media-capture.d.ts.map +1 -1
  29. package/lib/media/media-capture.js +11 -15
  30. package/lib/media/media-capture.js.map +1 -1
  31. package/lib/pad.d.ts +2 -2
  32. package/lib/pad.d.ts.map +1 -1
  33. package/lib/pad.js +15 -39
  34. package/lib/pad.js.map +1 -1
  35. package/lib/participation.d.ts +7 -7
  36. package/lib/participation.d.ts.map +1 -1
  37. package/lib/participation.js +26 -24
  38. package/lib/participation.js.map +1 -1
  39. package/lib/preferences.js +4 -0
  40. package/lib/preferences.js.map +1 -1
  41. package/lib/style.js +93 -85
  42. package/lib/style.js.map +1 -1
  43. package/lib/styleConstants.js +35 -0
  44. package/lib/styleConstants.js.map +1 -0
  45. package/lib/tabs.d.ts +0 -125
  46. package/lib/tabs.d.ts.map +1 -1
  47. package/lib/tabs.js +15 -8
  48. package/lib/tabs.js.map +1 -1
  49. package/lib/utils/keyHelpers/accessData.d.ts +2 -2
  50. package/lib/utils/keyHelpers/accessData.d.ts.map +1 -1
  51. package/lib/utils/keyHelpers/accessData.js +59 -115
  52. package/lib/utils/keyHelpers/accessData.js.map +1 -1
  53. package/lib/utils/keyHelpers/otherHelpers.d.ts +3 -0
  54. package/lib/utils/keyHelpers/otherHelpers.d.ts.map +1 -0
  55. package/lib/utils/keyHelpers/otherHelpers.js +22 -0
  56. package/lib/utils/keyHelpers/otherHelpers.js.map +1 -0
  57. package/lib/versionInfo.js +3 -3
  58. package/lib/versionInfo.js.map +1 -1
  59. package/lib/widgets/dragAndDrop.js +11 -19
  60. package/lib/widgets/dragAndDrop.js.map +1 -1
  61. package/lib/widgets/error.d.ts.map +1 -1
  62. package/lib/widgets/error.js +9 -2
  63. package/lib/widgets/error.js.map +1 -1
  64. package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
  65. package/lib/widgets/forms/autocomplete/autocompletePicker.js +2 -1
  66. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  67. package/lib/widgets/forms/basic.d.ts.map +1 -1
  68. package/lib/widgets/forms/basic.js +5 -4
  69. package/lib/widgets/forms/basic.js.map +1 -1
  70. package/lib/widgets/forms/fieldParams.js +2 -2
  71. package/lib/widgets/forms/fieldParams.js.map +1 -1
  72. package/lib/widgets/forms.js +9 -8
  73. package/lib/widgets/forms.js.map +1 -1
  74. package/package.json +5 -5
package/lib/tabs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":["_widgets","require","_utils","_solidLogic","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","ContainerElement","_HTMLElement","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","_createClass2","_wrapNativeSuper2","HTMLElement","TabWidgetElement","exports","_HTMLElement2","_super2","_this2","_len2","_key2","TabElement","_HTMLElement3","_super3","_this3","_len3","_key3","tabWidget","options","subject","dom","document","orientation","parseInt","backgroundColor","flipped","vertical","onClose","_getColors","getColors","_getColors2","_slicedToArray2","selectedColor","color","bodyMainStyle","rootElement","createElement","setAttribute","navElement","appendChild","mainElement","tabContainer","tabElement","bodyContainer","corners","cornersPrepped","slice","cornersStyle","join","margins","marginsPrepped","marginsStyle","paddingStyle","tabStyle","unselectedStyle","selectedStyle","shownStyle","hiddenStyle","refresh","orderedSync","startEmpty","children","selectedTab","selectedTab0","from","map","tab","firstChild","find","dataset","name","selectedTabURI","uri","selectedTab1","clickMe","click","addCancelButton","onCloseSet","existingCancelButton","querySelector","removeChild","extraTab","classList","add","tabCancelButton","cancelButton","getAttribute","getItems","items","ordered","store","the","predicate","elements","each","makeNewSlot","item","ele","div","onclick","resetTabStyle","resetBodyStyle","bodyTR","bodyMain","getOrCreateContainerElement","renderMain","asSettings","innerHTML","renderTabSettings","ellipsis","textContent","renderTab","label","_ele$bodyTR","newBodyMain","slot","i","j","left","right","differ","sameTerm","insertables","newSlot","newBodyDiv","insertBefore","contains","isLight","colorBlend","a","b","mix","ca","cb","res","str","hex","res2","split","h","l","x","total"],"sources":["../src/tabs.ts"],"sourcesContent":["import { cancelButton } from './widgets'\nimport { label } from './utils'\nimport { NamedNode } from 'rdflib'\nimport { store } from 'solid-logic'\n\n/**\n * @ignore\n */\nclass ContainerElement extends HTMLElement {\n asSettings?: boolean\n}\n\ntype TabWidgetOptions = {\n backgroundColor?: string;\n dom?: HTMLDocument;\n items?: Array<NamedNode>;\n onClose?: (event: Event) => void;\n ordered?: boolean;\n orientation?: '0' | '1' | '2' | '3';\n predicate?: NamedNode;\n renderMain?: (bodyMain: HTMLElement, subject: NamedNode) => void;\n renderTab?: (tabDiv: HTMLButtonElement, subject: NamedNode) => void;\n renderTabSettings?: (bodyMain: ContainerElement, subject: NamedNode) => void;\n selectedTab?: NamedNode;\n startEmpty?: boolean;\n subject?: NamedNode;\n};\n\nexport class TabWidgetElement extends HTMLElement {\n bodyContainer?: HTMLElement\n refresh?: () => void\n tabContainer?: HTMLElement\n}\n\n/**\n * @ignore\n */\nclass TabElement extends HTMLElement {\n bodyTR?: HTMLElement\n subject?: NamedNode\n}\n\n/**\n * Use this widget to generate tabs from triples set in the global store.\n *\n * [Here you can see examples of the tabs](https://solidos.github.io/solid-ui/examples/tabs/).\n *\n * It assumes that items to use for tabs will be in a collection by default,\n * e.g.:\n *\n * ```turtle\n * :subject :predicate ( :item1 :item2 ) .\n * ```\n *\n * You can override this by setting `ordered: false`, in which case it expects\n * unordered triples:\n *\n * ```turtle\n * :subject :predicate :item1, :item 2 .\n * ```\n *\n * Triples that are not ordered in collection are in principle not sorted,\n * which means that tabs could change order every time you render the widget.\n * But in this case the widget will try to sort it in order to keep it\n * consistent.\n *\n * In both of these cases you need to define options `subject` and `predicate`\n * to tell the widget which triples it should be looking for.\n *\n * Finally you can set items manually, using the `items` option, e.g.:\n *\n * ```javascript\n * {\n * items: [\n * namedNode('https://domain.tld/#item1'),\n * namedNode('https://domain.tld/#item2')\n * ]\n * }\n * ```\n *\n * When you set items manually you do not need to set `subject` and\n * `predicate`.\n *\n * In any case you probably want to set the renderMain option to specify\n * what should be rendered for the various items, e.g.:\n *\n * ```javascript\n * {\n * renderMain: (bodyMain, subject) => {\n * bodyMain.innerHTML = renderItem(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderItem` is a custom function that you need to define yourself.\n *\n * The option `renderTabSettings` allows you to render a custom view in the\n * body container that is shown when you hold the ALT key and click on a\n * tab. It works very much like the `renderMain` option:\n *\n * ```javascript\n * {\n * renderTabSettings: (bodyMain, subject) => {\n * bodyMain.innerHTML = renderTabSettings(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderTabSettings` is a custom function that you need to define\n * yourself.\n *\n * By default the widget will try to guess the label by using the\n * [[utils.label]] function. If you want to customize this yourself, you can\n * use the `renderTab` option:\n *\n * ```javascript\n * {\n * renderTab: (tabDiv, subject) => {\n * tabDiv.innerText = renderTabText(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderTabText` is a custom function you need to define yourself.\n *\n * The option renderTab is also important if you want to set which tab should\n * be selected once the widget is rendered. By default it will simply select\n * the first tab, but you can override by setting `dataset.name` on the tab\n * and referring to the same string in `selectedTab`:\n *\n * ```javascript\n * {\n * renderTab: (tabDiv, subject) => {\n * tabDiv.dataset.name = subject.uri\n * },\n * selectedTab: item2.uri\n * }\n * ```\n *\n * You can apply a color to use for tabs and border of the container by using\n * option `background-color`. This is #ddddcc by default.\n *\n * You can override the document object that the widget uses to generate DOM\n * elements by setting the option `dom`. This is encouraged to set if you\n * intend your functionality to be used in environments that don't provide\n * a global `document` object.\n *\n * If you want to render a close button next to the tabs you can set option\n * `onClose` which takes a callback function that is triggered when the\n * button is clicked:\n *\n * ```javascript\n * {\n * onClose: (event) => {\n * // do something that hides the widget altogether\n * }\n * }\n * ```\n *\n * The option `orientation` allows you to set which side the tabs should be\n * located: `'0'` = Top, `'1'` = Left, `'2'` = Bottom, `'3'` = Right\n *\n * If you don't want to render anything in the body container by default,\n * you can set the option `startEmpty` to `true`.\n *\n * @param options\n */\nexport function tabWidget (options: TabWidgetOptions) {\n const subject = options.subject\n const dom = options.dom || document\n const orientation = parseInt(options.orientation || '0')\n const backgroundColor = options.backgroundColor || '#ddddcc'\n const flipped = orientation & 2\n const vertical = orientation & 1\n const onClose = options.onClose\n\n const [selectedColor, color] = getColors(backgroundColor)\n const bodyMainStyle = `flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`\n const rootElement: TabWidgetElement = dom.createElement('div') // 20200117a\n\n rootElement.setAttribute(\n 'style',\n 'display: flex; height: 100%; width: 100%; flex-direction: ' +\n (vertical ? 'row' : 'column') +\n (flipped ? '-reverse;' : ';')\n )\n\n const navElement = rootElement.appendChild(dom.createElement('nav'))\n navElement.setAttribute('style', 'margin: 0;')\n\n const mainElement = rootElement.appendChild(dom.createElement('main'))\n\n mainElement.setAttribute('style', 'margin: 0; width:100%; height: 100%;') // override tabbedtab.css\n const tabContainer = navElement.appendChild(dom.createElement('ul'))\n tabContainer.setAttribute(\n 'style',\n `\n list-style-type: none;\n display: flex;\n height: 100%;\n width: 100%;\n margin: 0;\n padding: 0;\n flex-direction: ${vertical ? 'column' : 'row'}\n `\n )\n\n const tabElement = 'li'\n\n const bodyContainer = mainElement\n rootElement.tabContainer = tabContainer\n rootElement.bodyContainer = bodyContainer\n\n const corners = ['0.2em', '0.2em', '0', '0'] // top left, TR, BR, BL\n const cornersPrepped = corners.concat(corners).slice(orientation, orientation + 4)\n const cornersStyle = `border-radius: ${cornersPrepped.join(' ')};`\n\n const margins = ['0.3em', '0.3em', '0', '0.3em'] // top, right, bottom, left\n const marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4)\n const marginsStyle = `margin: ${marginsPrepped.join(' ')};`\n\n const paddingStyle = `padding: ${marginsPrepped.join(' ')};`\n\n const tabStyle = cornersStyle + `position: relative; padding: 0.7em; max-width: 20em; color: ${color};`\n const unselectedStyle = `${\n tabStyle + marginsStyle\n } opacity: 50%; background-color: ${backgroundColor};`\n const selectedStyle = `${tabStyle + marginsStyle} background-color: ${selectedColor};`\n const shownStyle = 'height: 100%; width: 100%;'\n const hiddenStyle = shownStyle + 'display: none;'\n rootElement.refresh = orderedSync\n orderedSync()\n\n if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {\n const selectedTab0 = Array.from(tabContainer.children) // Version left for compatability with ??\n .map((tab) => tab.firstChild as HTMLElement)\n .find((tab) => tab.dataset.name === options.selectedTab)\n\n const selectedTabURI = options.selectedTab.uri\n const selectedTab1 = Array.from(tabContainer.children)\n // @ts-ignore\n .find(\n (tab) =>\n (tab as TabElement).subject &&\n // @ts-ignore\n (tab as TabElement).subject.uri &&\n // @ts-ignore\n (tab as TabElement).subject.uri === selectedTabURI\n )\n\n const tab = selectedTab1 || selectedTab0 || (tabContainer.children[0] as HTMLButtonElement)\n const clickMe = tab.firstChild\n // @ts-ignore\n if (clickMe) clickMe.click()\n } else if (!options.startEmpty) {\n (tabContainer.children[0].firstChild as HTMLButtonElement).click() // Open first tab\n }\n return rootElement\n\n function addCancelButton (tabContainer) {\n if (tabContainer.dataset.onCloseSet) {\n // @@ TODO: this is only here to make the browser tests work\n // Discussion at https://github.com/solidos/solid-ui/pull/110#issuecomment-527080663\n const existingCancelButton = tabContainer.querySelector('.unstyled')\n tabContainer.removeChild(existingCancelButton)\n }\n const extraTab = dom.createElement(tabElement)\n extraTab.classList.add('unstyled')\n const tabCancelButton = cancelButton(dom, onClose)\n tabCancelButton.setAttribute('style', tabCancelButton.getAttribute('style') + paddingStyle)\n extraTab.appendChild(tabCancelButton)\n tabContainer.appendChild(extraTab)\n tabContainer.dataset.onCloseSet = 'true'\n }\n\n function getItems (): Array<NamedNode> {\n if (options.items) return options.items\n if (options.ordered !== false) {\n // options.ordered defaults to true\n return (store.the(subject, options.predicate) as any).elements\n } else {\n return store.each(subject, options.predicate) as any\n }\n }\n\n function makeNewSlot (item: NamedNode) {\n const ele = dom.createElement(tabElement) as TabElement\n ele.setAttribute('style', unselectedStyle)\n ele.subject = item\n const div = ele.appendChild(dom.createElement('button'))\n div.setAttribute('style', 'background: none; border: none; font: inherit; cursor: pointer')\n\n div.onclick = function () {\n resetTabStyle()\n resetBodyStyle()\n ele.setAttribute('style', selectedStyle)\n if (!ele.bodyTR) return\n ele.bodyTR.setAttribute('style', shownStyle)\n const bodyMain = getOrCreateContainerElement(ele)\n if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {\n bodyMain.innerHTML = 'loading item ...' + item\n options.renderMain(bodyMain, ele.subject)\n bodyMain.asSettings = false\n }\n }\n\n if (options.renderTabSettings && ele.subject) {\n const ellipsis = dom.createElement('button')\n ellipsis.textContent = '...'\n ellipsis.setAttribute('style', 'position: absolute; right: 0; bottom: 0; width: 20%; background: none; color: inherit; border: none; padding: 0; font: inherit; cursor: pointer; outline: inherit;')\n\n ellipsis.onclick = function () {\n resetTabStyle()\n resetBodyStyle()\n ele.setAttribute('style', selectedStyle)\n if (!ele.bodyTR) return\n ele.bodyTR.setAttribute('style', shownStyle)\n const bodyMain = getOrCreateContainerElement(ele)\n if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {\n bodyMain.innerHTML = 'loading settings ...' + item\n options.renderTabSettings(bodyMain, ele.subject)\n bodyMain.asSettings = true\n }\n }\n ele.appendChild(ellipsis)\n }\n\n if (options.renderTab) {\n options.renderTab(div, item)\n } else {\n div.innerHTML = label(item)\n }\n return ele\n\n function getOrCreateContainerElement (ele: TabElement): ContainerElement {\n const bodyMain = ele.bodyTR?.children[0] as ContainerElement\n if (bodyMain) return bodyMain\n const newBodyMain = ele.bodyTR!.appendChild(dom.createElement('main'))\n newBodyMain.setAttribute('style', bodyMainStyle)\n return newBodyMain\n }\n }\n\n // @@ Use common one from utils?\n function orderedSync () {\n const items = getItems()\n let slot: TabElement, i, j, left, right\n let differ = false\n // Find how many match at each end\n for (left = 0; left < tabContainer.children.length; left++) {\n slot = tabContainer.children[left] as TabElement\n if (left >= items.length || (slot.subject && !slot.subject.sameTerm(items[left]))) {\n differ = true\n break\n }\n }\n if (!differ && items.length === tabContainer.children.length) {\n return // The two just match in order: a case to optimize for\n }\n for (right = tabContainer.children.length - 1; right >= 0; right--) {\n slot = tabContainer.children[right] as TabElement\n j = right - tabContainer.children.length + items.length\n if (slot.subject && !slot.subject.sameTerm(items[j])) {\n break\n }\n }\n // The elements left ... right in tabContainer.children do not match\n const insertables = items.slice(left, right - tabContainer.children.length + items.length + 1)\n while (right >= left) {\n // remove extra\n tabContainer.removeChild(tabContainer.children[left])\n bodyContainer.removeChild(bodyContainer.children[left])\n right -= 1\n }\n for (i = 0; i < insertables.length; i++) {\n const newSlot = makeNewSlot(insertables[i])\n const newBodyDiv = dom.createElement('div')\n newSlot.bodyTR = newBodyDiv\n if (left === tabContainer.children.length) {\n // None left of original on right\n tabContainer.appendChild(newSlot)\n bodyContainer.appendChild(newBodyDiv)\n } else {\n tabContainer.insertBefore(newSlot, tabContainer.children[left + i])\n bodyContainer.insertBefore(newBodyDiv, bodyContainer.children[left + i])\n }\n }\n if (onClose) {\n addCancelButton(tabContainer)\n }\n }\n\n function resetTabStyle () {\n for (let i = 0; i < tabContainer.children.length; i++) {\n const tab = tabContainer.children[i]\n if (tab.classList.contains('unstyled')) {\n continue\n } else {\n tab.setAttribute('style', unselectedStyle)\n }\n }\n }\n\n function resetBodyStyle () {\n for (let i = 0; i < bodyContainer.children.length; i++) {\n bodyContainer.children[i].setAttribute('style', hiddenStyle)\n }\n }\n}\n\n/**\n * @internal\n */\nfunction getColors (backgroundColor: string): [string, string] {\n return isLight(backgroundColor)\n ? [colorBlend(backgroundColor, '#ffffff', 0.3), '#000000']\n : [colorBlend(backgroundColor, '#000000', 0.3), '#ffffff']\n}\n\n/**\n * @internal\n */\nfunction colorBlend (a: string, b: string, mix: number): string {\n let ca, cb, res\n let str = '#'\n const hex = '0123456789abcdef'\n for (let i = 0; i < 3; i++) {\n ca = parseInt(a.slice(i * 2 + 1, i * 2 + 3), 16)\n cb = parseInt(b.slice(i * 2 + 1, i * 2 + 3), 16)\n res = ca * (1.0 - mix) + cb * mix // @@@ rounding\n const res2 = parseInt(('' + res).split('.')[0]) // @@ ugh\n const h = parseInt(('' + res2 / 16).split('.')[0]) // @@ ugh\n const l = parseInt(('' + (res2 % 16)).split('.')[0]) // @@ ugh\n str += hex[h] + hex[l]\n }\n return str\n}\n\n/**\n * @internal\n */\nfunction isLight (x: string): boolean {\n let total = 0\n for (let i = 0; i < 3; i++) {\n total += parseInt(x.slice(i * 2 + 1, i * 2 + 3), 16)\n }\n return total > 128 * 3\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEA,IAAAE,WAAA,GAAAF,OAAA;AAAmC,SAAAG,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,aAAAL,OAAA,GAAAM,MAAA,MAAAL,yBAAA,QAAAM,SAAA,OAAAF,gBAAA,mBAAAG,WAAA,EAAAF,MAAA,GAAAG,OAAA,CAAAC,SAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAJ,SAAA,YAAAD,MAAA,GAAAF,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,mBAAAP,MAAA;AAAA,SAAAJ,0BAAA,eAAAO,OAAA,qBAAAA,OAAA,CAAAC,SAAA,oBAAAD,OAAA,CAAAC,SAAA,CAAAI,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,OAAA,CAAAC,SAAA,CAAAM,OAAA,8CAAAI,CAAA;AAEnC;AACA;AACA;AAFA,IAGMC,gBAAgB,0BAAAC,YAAA;EAAA,IAAAC,UAAA,aAAAF,gBAAA,EAAAC,YAAA;EAAA,IAAAE,MAAA,GAAAzB,YAAA,CAAAsB,gBAAA;EAAA,SAAAA,iBAAA;IAAA,IAAAI,KAAA;IAAA,IAAAC,gBAAA,mBAAAL,gBAAA;IAAA,SAAAM,IAAA,GAAAhB,SAAA,CAAAiB,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAH,IAAA,GAAAI,IAAA,MAAAA,IAAA,GAAAJ,IAAA,EAAAI,IAAA;MAAA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A,WAAA;IAAA,IAAAG,MAAA;IAAA,IAAAtB,gBAAA,mBAAAmB,UAAA;IAAA,SAAAI,KAAA,GAAAtC,SAAA,CAAAiB,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAmB,KAAA,GAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;MAAArB,IAAA,CAAAqB,KAAA,IAAAvC,SAAA,CAAAuC,KAAA;IAAA;IAAAF,MAAA,GAAAD,OAAA,CAAA5B,IAAA,CAAAP,KAAA,CAAAmC,OAAA,SAAAf,MAAA,CAAAH,IAAA;IAAA,IAAAI,gBAAA,iBAAAC,uBAAA,aAAAc,MAAA;IAAA,IAAAf,gBAAA,iBAAAC,uBAAA,aAAAc,MAAA;IAAA,OAAAA,MAAA;EAAA;EAAA,WAAAb,aAAA,aAAAU,UAAA;AAAA,oBAAAT,iBAAA,aAASC,WAAW;AAKpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,SAASA,CAAEC,OAAyB,EAAE;EACpD,IAAMC,OAAO,GAAGD,OAAO,CAAC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AAG,GAAGD,GAAG,CAAC,GAAGE,EAAE,GAAGF,GAAG,EAAC;IAClC,IAAMM,IAAI,GAAGlH,QAAQ,CAAC,CAAC,EAAE,GAAG+G,GAAG,EAAEI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IAChD,IAAMC,CAAC,GAAGpH,QAAQ,CAAC,CAAC,EAAE,GAAGkH,IAAI,GAAG,EAAE,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IACnD,IAAME,CAAC,GAAGrH,QAAQ,CAAC,CAAC,EAAE,GAAIkH,IAAI,GAAG,EAAG,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IACrDH,GAAG,IAAIC,GAAG,CAACG,CAAC,CAAC,GAAGH,GAAG,CAACI,CAAC,CAAC;EACxB;EACA,OAAOL,GAAG;AACZ;;AAEA;AACA;AACA;AACA,SAASR,OAAOA,CAAEc,CAAS,EAAW;EACpC,IAAIC,KAAK,GAAG,CAAC;EACb,KAAK,IAAI1B,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1B0B,KAAK,IAAIvH,QAAQ,CAACsH,CAAC,CAAC/F,KAAK,CAACsE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;EACtD;EACA,OAAO0B,KAAK,GAAG,GAAG,GAAG,CAAC;AACxB"}
1
+ {"version":3,"file":"tabs.js","names":["_widgets","require","_utils","style","_interopRequireWildcard","_solidLogic","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","valueOf","ContainerElement","_HTMLElement","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","_createClass2","_wrapNativeSuper2","HTMLElement","TabWidgetElement","exports","_HTMLElement2","_super2","_this2","_len2","_key2","TabElement","_HTMLElement3","_super3","_this3","_len3","_key3","tabsDefaultBackgroundColor","tabWidget","options","subject","dom","document","orientation","parseInt","backgroundColor","flipped","vertical","onClose","_getColors","getColors","_getColors2","_slicedToArray2","selectedColor","color","bodyMainStyle","rootElement","createElement","setAttribute","tabsRootElement","flexDirection","navElement","appendChild","tabsNavElement","mainElement","tabsMainElement","tabContainer","tabElement","bodyContainer","corners","cornersPrepped","slice","cornersStyle","join","margins","marginsPrepped","marginsStyle","paddingStyle","tabStyle","unselectedStyle","selectedStyle","shownStyle","hiddenStyle","refresh","orderedSync","startEmpty","children","selectedTab","selectedTab0","from","map","tab","firstChild","find","dataset","name","selectedTabURI","uri","selectedTab1","clickMe","click","addCancelButton","onCloseSet","existingCancelButton","querySelector","removeChild","extraTab","classList","add","tabCancelButton","cancelButton","getAttribute","getItems","items","ordered","store","the","predicate","elements","each","makeNewSlot","item","ele","div","onclick","resetTabStyle","resetBodyStyle","bodyTR","bodyMain","getOrCreateContainerElement","renderMain","asSettings","innerHTML","renderTabSettings","ellipsis","textContent","renderTab","label","_ele$bodyTR","newBodyMain","slot","j","left","right","differ","sameTerm","insertables","newSlot","newBodyDiv","insertBefore","contains","isLight","colorBlend","b","mix","ca","cb","res","str","hex","res2","split","h","l","x","total"],"sources":["../src/tabs.ts"],"sourcesContent":["import { cancelButton } from './widgets'\nimport { label } from './utils'\nimport { NamedNode } from 'rdflib'\nimport * as style from './style'\nimport { store } from 'solid-logic'\n\n/**\n * @ignore\n */\nclass ContainerElement extends HTMLElement {\n asSettings?: boolean\n}\n\ntype TabWidgetOptions = {\n backgroundColor?: string;\n dom?: HTMLDocument;\n items?: Array<NamedNode>;\n onClose?: (event: Event) => void;\n ordered?: boolean;\n orientation?: '0' | '1' | '2' | '3';\n predicate?: NamedNode;\n renderMain?: (bodyMain: HTMLElement, subject: NamedNode) => void;\n renderTab?: (tabDiv: HTMLButtonElement, subject: NamedNode) => void;\n renderTabSettings?: (bodyMain: ContainerElement, subject: NamedNode) => void;\n selectedTab?: NamedNode;\n startEmpty?: boolean;\n subject?: NamedNode;\n};\n\nexport class TabWidgetElement extends HTMLElement {\n bodyContainer?: HTMLElement\n refresh?: () => void\n tabContainer?: HTMLElement\n}\n\n/**\n * @ignore\n */\nclass TabElement extends HTMLElement {\n bodyTR?: HTMLElement\n subject?: NamedNode\n}\n\n/**\n * Use this widget to generate tabs from triples set in the global store.\n *\n * [Here you can see examples of the tabs](https://solidos.github.io/solid-ui/examples/tabs/).\n *\n * It assumes that items to use for tabs will be in a collection by default,\n * e.g.:\n *\n * ```turtle\n * :subject :predicate ( :item1 :item2 ) .\n * ```\n *\n * You can override this by setting `ordered: false`, in which case it expects\n * unordered triples:\n *\n * ```turtle\n * :subject :predicate :item1, :item 2 .\n * ```\n *\n * Triples that are not ordered in collection are in principle not sorted,\n * which means that tabs could change order every time you render the widget.\n * But in this case the widget will try to sort it in order to keep it\n * consistent.\n *\n * In both of these cases you need to define options `subject` and `predicate`\n * to tell the widget which triples it should be looking for.\n *\n * Finally you can set items manually, using the `items` option, e.g.:\n *\n * ```javascript\n * {\n * items: [\n * namedNode('https://domain.tld/#item1'),\n * namedNode('https://domain.tld/#item2')\n * ]\n * }\n * ```\n *\n * When you set items manually you do not need to set `subject` and\n * `predicate`.\n *\n * In any case you probably want to set the renderMain option to specify\n * what should be rendered for the various items, e.g.:\n *\n * ```javascript\n * {\n * renderMain: (bodyMain, subject) => {\n * bodyMain.innerHTML = renderItem(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderItem` is a custom function that you need to define yourself.\n *\n * The option `renderTabSettings` allows you to render a custom view in the\n * body container that is shown when you hold the ALT key and click on a\n * tab. It works very much like the `renderMain` option:\n *\n * ```javascript\n * {\n * renderTabSettings: (bodyMain, subject) => {\n * bodyMain.innerHTML = renderTabSettings(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderTabSettings` is a custom function that you need to define\n * yourself.\n *\n * By default the widget will try to guess the label by using the\n * [[utils.label]] function. If you want to customize this yourself, you can\n * use the `renderTab` option:\n *\n * ```javascript\n * {\n * renderTab: (tabDiv, subject) => {\n * tabDiv.innerText = renderTabText(subject)\n * }\n * }\n * ```\n *\n * **Note:** `renderTabText` is a custom function you need to define yourself.\n *\n * The option renderTab is also important if you want to set which tab should\n * be selected once the widget is rendered. By default it will simply select\n * the first tab, but you can override by setting `dataset.name` on the tab\n * and referring to the same string in `selectedTab`:\n *\n * ```javascript\n * {\n * renderTab: (tabDiv, subject) => {\n * tabDiv.dataset.name = subject.uri\n * },\n * selectedTab: item2.uri\n * }\n * ```\n *\n * You can apply a color to use for tabs and border of the container by using\n * option `background-color`. This is #ddddcc by default.\n *\n * You can override the document object that the widget uses to generate DOM\n * elements by setting the option `dom`. This is encouraged to set if you\n * intend your functionality to be used in environments that don't provide\n * a global `document` object.\n *\n * If you want to render a close button next to the tabs you can set option\n * `onClose` which takes a callback function that is triggered when the\n * button is clicked:\n *\n * ```javascript\n * {\n * onClose: (event) => {\n * // do something that hides the widget altogether\n * }\n * }\n * ```\n *\n * The option `orientation` allows you to set which side the tabs should be\n * located: `'0'` = Top, `'1'` = Left, `'2'` = Bottom, `'3'` = Right\n *\n * If you don't want to render anything in the body container by default,\n * you can set the option `startEmpty` to `true`.\n *\n * @param options\n */\nconst tabsDefaultBackgroundColor = '#ddddcc'\n\nexport function tabWidget (options: TabWidgetOptions) {\n const subject = options.subject\n const dom = options.dom || document\n const orientation = parseInt(options.orientation || '0')\n const backgroundColor = options.backgroundColor || tabsDefaultBackgroundColor\n const flipped = orientation & 2\n const vertical = orientation & 1\n const onClose = options.onClose\n\n const [selectedColor, color] = getColors(backgroundColor)\n const bodyMainStyle = `flex: 2; width: auto; height: 100%; border: 0.1em; border-style: solid; border-color: ${selectedColor}; padding: 1em;`\n const rootElement: TabWidgetElement = dom.createElement('div') // 20200117a\n\n rootElement.setAttribute('style', style.tabsRootElement)\n rootElement.style.flexDirection = (vertical ? 'row' : 'column') + (flipped ? '-reverse;' : ';')\n\n const navElement = rootElement.appendChild(dom.createElement('nav'))\n navElement.setAttribute('style', style.tabsNavElement)\n\n const mainElement = rootElement.appendChild(dom.createElement('main'))\n\n mainElement.setAttribute('style', style.tabsMainElement) // override tabbedtab.css\n const tabContainer = navElement.appendChild(dom.createElement('ul'))\n tabContainer.setAttribute('style', style.tabContainer)\n tabContainer.style.flexDirection = `${vertical ? 'column' : 'row'}`\n\n const tabElement = 'li'\n\n const bodyContainer = mainElement\n rootElement.tabContainer = tabContainer\n rootElement.bodyContainer = bodyContainer\n\n const corners = ['0.2em', '0.2em', '0', '0'] // top left, TR, BR, BL\n const cornersPrepped = corners.concat(corners).slice(orientation, orientation + 4)\n const cornersStyle = `border-radius: ${cornersPrepped.join(' ')};`\n\n const margins = ['0.3em', '0.3em', '0', '0.3em'] // top, right, bottom, left\n const marginsPrepped = margins.concat(margins).slice(orientation, orientation + 4)\n const marginsStyle = `margin: ${marginsPrepped.join(' ')};`\n\n const paddingStyle = `padding: ${marginsPrepped.join(' ')};`\n\n const tabStyle = cornersStyle + `position: relative; padding: 0.7em; max-width: 20em; color: ${color};`\n const unselectedStyle = `${\n tabStyle + marginsStyle\n } opacity: 50%; background-color: ${backgroundColor};`\n const selectedStyle = `${tabStyle + marginsStyle} background-color: ${selectedColor};`\n const shownStyle = 'height: 100%; width: 100%;'\n const hiddenStyle = shownStyle + 'display: none;'\n rootElement.refresh = orderedSync\n orderedSync()\n\n if (!options.startEmpty && tabContainer.children.length && options.selectedTab) {\n const selectedTab0 = Array.from(tabContainer.children) // Version left for compatibility with ??\n .map((tab) => tab.firstChild as HTMLElement)\n .find((tab) => tab.dataset.name === options.selectedTab)\n\n const selectedTabURI = options.selectedTab.uri\n const selectedTab1 = Array.from(tabContainer.children)\n // @ts-ignore\n .find(\n (tab) =>\n (tab as TabElement).subject &&\n // @ts-ignore\n (tab as TabElement).subject.uri &&\n // @ts-ignore\n (tab as TabElement).subject.uri === selectedTabURI\n )\n\n const tab = selectedTab1 || selectedTab0 || (tabContainer.children[0] as HTMLButtonElement)\n const clickMe = tab.firstChild\n // @ts-ignore\n if (clickMe) clickMe.click()\n } else if (!options.startEmpty) {\n (tabContainer.children[0].firstChild as HTMLButtonElement).click() // Open first tab\n }\n return rootElement\n\n function addCancelButton (tabContainer) {\n if (tabContainer.dataset.onCloseSet) {\n // @@ TODO: this is only here to make the browser tests work\n // Discussion at https://github.com/solidos/solid-ui/pull/110#issuecomment-527080663\n const existingCancelButton = tabContainer.querySelector('.unstyled')\n tabContainer.removeChild(existingCancelButton)\n }\n const extraTab = dom.createElement(tabElement)\n extraTab.classList.add('unstyled')\n const tabCancelButton = cancelButton(dom, onClose)\n tabCancelButton.setAttribute('style', tabCancelButton.getAttribute('style') + paddingStyle)\n extraTab.appendChild(tabCancelButton)\n tabContainer.appendChild(extraTab)\n tabContainer.dataset.onCloseSet = 'true'\n }\n\n function getItems (): Array<NamedNode> {\n if (options.items) return options.items\n if (options.ordered !== false) {\n // options.ordered defaults to true\n return (store.the(subject, options.predicate) as any).elements\n } else {\n return store.each(subject, options.predicate) as any\n }\n }\n\n function makeNewSlot (item: NamedNode) {\n const ele = dom.createElement(tabElement) as TabElement\n ele.setAttribute('style', unselectedStyle)\n ele.subject = item\n const div = ele.appendChild(dom.createElement('button'))\n div.setAttribute('style', style.makeNewSlot)\n\n div.onclick = function () {\n resetTabStyle()\n resetBodyStyle()\n ele.setAttribute('style', selectedStyle)\n if (!ele.bodyTR) return\n ele.bodyTR.setAttribute('style', shownStyle)\n const bodyMain = getOrCreateContainerElement(ele)\n if (options.renderMain && ele.subject && bodyMain.asSettings !== false) {\n bodyMain.innerHTML = 'loading item ...' + item\n options.renderMain(bodyMain, ele.subject)\n bodyMain.asSettings = false\n }\n }\n\n if (options.renderTabSettings && ele.subject) {\n const ellipsis = dom.createElement('button')\n ellipsis.textContent = '...'\n ellipsis.setAttribute('style', style.ellipsis)\n\n ellipsis.onclick = function () {\n resetTabStyle()\n resetBodyStyle()\n ele.setAttribute('style', selectedStyle)\n if (!ele.bodyTR) return\n ele.bodyTR.setAttribute('style', shownStyle)\n const bodyMain = getOrCreateContainerElement(ele)\n if (options.renderTabSettings && ele.subject && bodyMain.asSettings !== true) {\n bodyMain.innerHTML = 'loading settings ...' + item\n options.renderTabSettings(bodyMain, ele.subject)\n bodyMain.asSettings = true\n }\n }\n ele.appendChild(ellipsis)\n }\n\n if (options.renderTab) {\n options.renderTab(div, item)\n } else {\n div.innerHTML = label(item)\n }\n return ele\n\n function getOrCreateContainerElement (ele: TabElement): ContainerElement {\n const bodyMain = ele.bodyTR?.children[0] as ContainerElement\n if (bodyMain) return bodyMain\n const newBodyMain = ele.bodyTR!.appendChild(dom.createElement('main'))\n newBodyMain.setAttribute('style', bodyMainStyle)\n return newBodyMain\n }\n }\n\n // @@ Use common one from utils?\n function orderedSync () {\n const items = getItems()\n let slot: TabElement, i, j, left, right\n let differ = false\n // Find how many match at each end\n for (left = 0; left < tabContainer.children.length; left++) {\n slot = tabContainer.children[left] as TabElement\n if (left >= items.length || (slot.subject && !slot.subject.sameTerm(items[left]))) {\n differ = true\n break\n }\n }\n if (!differ && items.length === tabContainer.children.length) {\n return // The two just match in order: a case to optimize for\n }\n for (right = tabContainer.children.length - 1; right >= 0; right--) {\n slot = tabContainer.children[right] as TabElement\n j = right - tabContainer.children.length + items.length\n if (slot.subject && !slot.subject.sameTerm(items[j])) {\n break\n }\n }\n // The elements left ... right in tabContainer.children do not match\n const insertables = items.slice(left, right - tabContainer.children.length + items.length + 1)\n while (right >= left) {\n // remove extra\n tabContainer.removeChild(tabContainer.children[left])\n bodyContainer.removeChild(bodyContainer.children[left])\n right -= 1\n }\n for (i = 0; i < insertables.length; i++) {\n const newSlot = makeNewSlot(insertables[i])\n const newBodyDiv = dom.createElement('div')\n newSlot.bodyTR = newBodyDiv\n if (left === tabContainer.children.length) {\n // None left of original on right\n tabContainer.appendChild(newSlot)\n bodyContainer.appendChild(newBodyDiv)\n } else {\n tabContainer.insertBefore(newSlot, tabContainer.children[left + i])\n bodyContainer.insertBefore(newBodyDiv, bodyContainer.children[left + i])\n }\n }\n if (onClose) {\n addCancelButton(tabContainer)\n }\n }\n\n function resetTabStyle () {\n for (let i = 0; i < tabContainer.children.length; i++) {\n const tab = tabContainer.children[i]\n if (tab.classList.contains('unstyled')) {\n continue\n } else {\n tab.setAttribute('style', unselectedStyle)\n }\n }\n }\n\n function resetBodyStyle () {\n for (let i = 0; i < bodyContainer.children.length; i++) {\n bodyContainer.children[i].setAttribute('style', hiddenStyle)\n }\n }\n}\n\n/**\n * @internal\n */\nfunction getColors (backgroundColor: string): [string, string] {\n return isLight(backgroundColor)\n ? [colorBlend(backgroundColor, '#ffffff', 0.3), '#000000']\n : [colorBlend(backgroundColor, '#000000', 0.3), '#ffffff']\n}\n\n/**\n * @internal\n */\nfunction colorBlend (a: string, b: string, mix: number): string {\n let ca, cb, res\n let str = '#'\n const hex = '0123456789abcdef'\n for (let i = 0; i < 3; i++) {\n ca = parseInt(a.slice(i * 2 + 1, i * 2 + 3), 16)\n cb = parseInt(b.slice(i * 2 + 1, i * 2 + 3), 16)\n res = ca * (1.0 - mix) + cb * mix // @@@ rounding\n const res2 = parseInt(('' + res).split('.')[0]) // @@ ugh\n const h = parseInt(('' + res2 / 16).split('.')[0]) // @@ ugh\n const l = parseInt(('' + (res2 % 16)).split('.')[0]) // @@ ugh\n str += hex[h] + hex[l]\n }\n return str\n}\n\n/**\n * @internal\n */\nfunction isLight (x: string): boolean {\n let total = 0\n for (let i = 0; i < 3; i++) {\n total += parseInt(x.slice(i * 2 + 1, i * 2 + 3), 16)\n }\n return total > 128 * 3\n}\n"],"mappings":";;;;;;;;;;;;;;;;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AA,GAAAD,OAAA,CAAAhD,IAAA,CAAAgB,KAAA,CAAAgC,OAAA,SAAAf,MAAA,CAAAH,IAAA;IAAA,IAAAI,gBAAA,iBAAAC,uBAAA,aAAAc,MAAA;IAAA,IAAAf,gBAAA,iBAAAC,uBAAA,aAAAc,MAAA;IAAA,OAAAA,MAAA;EAAA;EAAA,WAAAb,aAAA,aAAAU,UAAA;AAAA,oBAAAT,iBAAA,aAASC,WAAW;AAKpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMc,0BAA0B,GAAG,SAAS;AAErC,SAASC,SAASA,CAAEC,OAAyB,EAAE;EACpD,IAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO;EAC/B,IAAMC,GAAG,GAAGF,OAAO,CAACE,GAAG,IAAIC,QAAQ;EACnC,IAAMC,WAAW,GAAGC,QAAQ,CAACL,OAAO,CAACI,WAAW,IAAI,GAAG,CAAC;EACxD,IAAME,eAAe,GAAGN,OAAO,CAACM,eAAe,IAAIR,0BAA0B;EAC7E,IAAMS,OAAO,GAAGH,WAAW,GAAG,C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;IAClC,IAAMM,IAAI,GAAGpH,QAAQ,CAAC,CAAC,EAAE,GAAGiH,GAAG,EAAEI,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IAChD,IAAMC,CAAC,GAAGtH,QAAQ,CAAC,CAAC,EAAE,GAAGoH,IAAI,GAAG,EAAE,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IACnD,IAAME,CAAC,GAAGvH,QAAQ,CAAC,CAAC,EAAE,GAAIoH,IAAI,GAAG,EAAG,EAAEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAC;IACrDH,GAAG,IAAIC,GAAG,CAACG,CAAC,CAAC,GAAGH,GAAG,CAACI,CAAC,CAAC;EACxB;EACA,OAAOL,GAAG;AACZ;;AAEA;AACA;AACA;AACA,SAASP,OAAOA,CAAEa,CAAS,EAAW;EACpC,IAAIC,KAAK,GAAG,CAAC;EACb,KAAK,IAAInL,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,EAAEA,CAAC,EAAE,EAAE;IAC1BmL,KAAK,IAAIzH,QAAQ,CAACwH,CAAC,CAAC7F,KAAK,CAACrF,CAAC,GAAG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;EACtD;EACA,OAAOmL,KAAK,GAAG,GAAG,GAAG,CAAC;AACxB"}
@@ -1,7 +1,7 @@
1
1
  import { NamedNode } from 'rdflib';
2
- export declare const pubKeyUrl: (webId: NamedNode) => Promise<string>;
2
+ export declare const pubKeyUrl: (webId: NamedNode) => any;
3
+ export declare const privKeyUrl: (webId: NamedNode) => any;
3
4
  export declare function getExistingPublicKey(webId: NamedNode, publicKeyUrl: string): Promise<string | undefined>;
4
- export declare const privKeyUrl: (webId: NamedNode) => Promise<string>;
5
5
  export declare function getExistingPrivateKey(webId: NamedNode, privateKeyUrl: string): Promise<string | undefined>;
6
6
  type KeyType = 'publicKey' | 'privateKey';
7
7
  export declare function getKeyIfExists(webId: NamedNode, keyUrl: string, keyType: KeyType): Promise<string | undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"accessData.d.ts","sourceRoot":"","sources":["../../../src/utils/keyHelpers/accessData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AA2BlC,eAAO,MAAM,SAAS,UAAiB,SAAS,oBAQ/C,CAAA;AAED,wBAAsB,oBAAoB,CAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,+BAGjF;AAED,eAAO,MAAM,UAAU,UAAiB,SAAS,oBAUhD,CAAA;AAED,wBAAsB,qBAAqB,CAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,+BAGnF;AAED,KAAK,OAAO,GAAG,WAAW,GAAG,YAAY,CAAA;AAEzC,wBAAsB,cAAc,CAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,+BA2BvF"}
1
+ {"version":3,"file":"accessData.d.ts","sourceRoot":"","sources":["../../../src/utils/keyHelpers/accessData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGlC,eAAO,MAAM,SAAS,UAAW,SAAS,QASzC,CAAA;AAED,eAAO,MAAM,UAAU,UAAW,SAAS,QAS1C,CAAA;AAED,wBAAsB,oBAAoB,CAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,+BAGjF;AAED,wBAAsB,qBAAqB,CAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,+BAGnF;AAED,KAAK,OAAO,GAAG,WAAW,GAAG,YAAY,CAAA;AAEzC,wBAAsB,cAAc,CAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,+BA2BvF"}
@@ -14,174 +14,118 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
14
14
  var debug = _interopRequireWildcard(require("../../debug"));
15
15
  var _solidLogic = require("solid-logic");
16
16
  var ns = _interopRequireWildcard(require("../../ns"));
17
+ var _otherHelpers = require("./otherHelpers");
17
18
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
18
19
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
19
- /* export const getPodRoot = async (webId: NamedNode) => {
20
- const webIdURL = new URL(webId.uri)
21
- // find storages in webId document
22
- await store.fetcher.load(webId.uri)
23
- const storages = store.each(webId, ns.space('storage'), null, webId.doc())
24
- var podRoot: NamedNode | undefined
25
- if (!storages?.length) {
26
- // find storage recursively in webId URL
27
- let path = webIdURL.pathname
28
- while (path.length) {
29
- path = path.substring(0, path.lastIndexOf('/'))
30
- podRoot = store.sym(webIdURL.origin + path + '/')
31
- const res = await store.fetcher.webOperation('HEAD', podRoot.uri)
32
- if (res.headers.get('link')?.includes(ns.space('Storage').value)) break
33
- if (!path) debug.warn(`Current user storage not found for\n${webId}`)
34
- }
35
- } else {
36
- // give preference to storage in webId root
37
- podRoot = storages.find((storage) => webIdURL.origin === new URL(storage.value).origin) as NamedNode
38
- if (!podRoot) podRoot = storages[0] as NamedNode
20
+ var pubKeyUrl = exports.pubKeyUrl = function pubKeyUrl(webId) {
21
+ var url;
22
+ try {
23
+ var root = (0, _otherHelpers.getRootIfPreferencesExist)(webId);
24
+ url = "".concat(root, "/profile/keys/publicKey.ttl");
25
+ } catch (err) {
26
+ debug.error(err);
39
27
  }
40
-
41
- return podRoot as NamedNode
42
- } */
43
-
44
- var pubKeyUrl = exports.pubKeyUrl = /*#__PURE__*/function () {
45
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
46
- var _store$any, _parentSettings;
47
- var parentSettings;
48
- return _regenerator["default"].wrap(function _callee$(_context) {
49
- while (1) switch (_context.prev = _context.next) {
50
- case 0:
51
- parentSettings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
52
- parentSettings = (_parentSettings = parentSettings) === null || _parentSettings === void 0 ? void 0 : _parentSettings.split('/').slice(0, -2).join('/');
53
- if (parentSettings) {
54
- _context.next = 4;
55
- break;
56
- }
57
- throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
58
- case 4:
59
- return _context.abrupt("return", "".concat(parentSettings, "/profile/keys/publicKey.ttl"));
60
- case 5:
61
- case "end":
62
- return _context.stop();
63
- }
64
- }, _callee);
65
- }));
66
- return function pubKeyUrl(_x) {
67
- return _ref.apply(this, arguments);
68
- };
69
- }();
70
- function getExistingPublicKey(_x2, _x3) {
28
+ return url;
29
+ };
30
+ var privKeyUrl = exports.privKeyUrl = function privKeyUrl(webId) {
31
+ var url;
32
+ try {
33
+ var root = (0, _otherHelpers.getRootIfPreferencesExist)(webId);
34
+ url = "".concat(root, "/keys/privateKey.ttl");
35
+ } catch (err) {
36
+ debug.error(err);
37
+ }
38
+ return url;
39
+ };
40
+ function getExistingPublicKey(_x, _x2) {
71
41
  return _getExistingPublicKey.apply(this, arguments);
72
42
  }
73
43
  function _getExistingPublicKey() {
74
- _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, publicKeyUrl) {
75
- return _regenerator["default"].wrap(function _callee3$(_context3) {
76
- while (1) switch (_context3.prev = _context3.next) {
44
+ _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId, publicKeyUrl) {
45
+ return _regenerator["default"].wrap(function _callee$(_context) {
46
+ while (1) switch (_context.prev = _context.next) {
77
47
  case 0:
78
- _context3.next = 2;
48
+ _context.next = 2;
79
49
  return getKeyIfExists(webId, publicKeyUrl, 'publicKey');
80
50
  case 2:
81
- return _context3.abrupt("return", _context3.sent);
51
+ return _context.abrupt("return", _context.sent);
82
52
  case 3:
83
53
  case "end":
84
- return _context3.stop();
54
+ return _context.stop();
85
55
  }
86
- }, _callee3);
56
+ }, _callee);
87
57
  }));
88
58
  return _getExistingPublicKey.apply(this, arguments);
89
59
  }
90
- var privKeyUrl = exports.privKeyUrl = /*#__PURE__*/function () {
91
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
92
- var _store$any2, _settings;
93
- var settings;
94
- return _regenerator["default"].wrap(function _callee2$(_context2) {
95
- while (1) switch (_context2.prev = _context2.next) {
96
- case 0:
97
- settings = (_store$any2 = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any2 === void 0 ? void 0 : _store$any2.value;
98
- settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
99
- if (settings) {
100
- _context2.next = 4;
101
- break;
102
- }
103
- throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
104
- case 4:
105
- return _context2.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
106
- case 5:
107
- case "end":
108
- return _context2.stop();
109
- }
110
- }, _callee2);
111
- }));
112
- return function privKeyUrl(_x4) {
113
- return _ref2.apply(this, arguments);
114
- };
115
- }();
116
- function getExistingPrivateKey(_x5, _x6) {
60
+ function getExistingPrivateKey(_x3, _x4) {
117
61
  return _getExistingPrivateKey.apply(this, arguments);
118
62
  }
119
63
  function _getExistingPrivateKey() {
120
- _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, privateKeyUrl) {
121
- return _regenerator["default"].wrap(function _callee4$(_context4) {
122
- while (1) switch (_context4.prev = _context4.next) {
64
+ _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId, privateKeyUrl) {
65
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
66
+ while (1) switch (_context2.prev = _context2.next) {
123
67
  case 0:
124
- _context4.next = 2;
68
+ _context2.next = 2;
125
69
  return getKeyIfExists(webId, privateKeyUrl, 'privateKey');
126
70
  case 2:
127
- return _context4.abrupt("return", _context4.sent);
71
+ return _context2.abrupt("return", _context2.sent);
128
72
  case 3:
129
73
  case "end":
130
- return _context4.stop();
74
+ return _context2.stop();
131
75
  }
132
- }, _callee4);
76
+ }, _callee2);
133
77
  }));
134
78
  return _getExistingPrivateKey.apply(this, arguments);
135
79
  }
136
- function getKeyIfExists(_x7, _x8, _x9) {
80
+ function getKeyIfExists(_x5, _x6, _x7) {
137
81
  return _getKeyIfExists.apply(this, arguments);
138
82
  }
139
83
  function _getKeyIfExists() {
140
- _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, keyUrl, keyType) {
84
+ _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, keyUrl, keyType) {
141
85
  var key;
142
- return _regenerator["default"].wrap(function _callee5$(_context5) {
143
- while (1) switch (_context5.prev = _context5.next) {
86
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
87
+ while (1) switch (_context3.prev = _context3.next) {
144
88
  case 0:
145
- _context5.prev = 0;
146
- _context5.next = 3;
89
+ _context3.prev = 0;
90
+ _context3.next = 3;
147
91
  return _solidLogic.store.fetcher.load(keyUrl);
148
92
  case 3:
149
93
  key = _solidLogic.store.any(webId, ns.solid(keyType)); // store.sym(CERT + keyType))
150
- return _context5.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
94
+ return _context3.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
151
95
  case 7:
152
- _context5.prev = 7;
153
- _context5.t0 = _context5["catch"](0);
154
- if (!(_context5.t0.response.status === 404)) {
155
- _context5.next = 24;
96
+ _context3.prev = 7;
97
+ _context3.t0 = _context3["catch"](0);
98
+ if (!(_context3.t0.response.status === 404)) {
99
+ _context3.next = 24;
156
100
  break;
157
101
  }
158
102
  debug.log('createIfNotExists: doc does NOT exist, will create... ' + keyUrl);
159
- _context5.prev = 11;
160
- _context5.next = 14;
103
+ _context3.prev = 11;
104
+ _context3.next = 14;
161
105
  return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
162
106
  data: '',
163
107
  contentType: 'text/turtle'
164
108
  });
165
109
  case 14:
166
- _context5.next = 20;
110
+ _context3.next = 20;
167
111
  break;
168
112
  case 16:
169
- _context5.prev = 16;
170
- _context5.t1 = _context5["catch"](11);
171
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t1);
172
- throw _context5.t1;
113
+ _context3.prev = 16;
114
+ _context3.t1 = _context3["catch"](11);
115
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t1);
116
+ throw _context3.t1;
173
117
  case 20:
174
118
  delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
175
119
  // debug.log('createIfNotExists doc created ok ' + doc)
176
- return _context5.abrupt("return", undefined);
120
+ return _context3.abrupt("return", undefined);
177
121
  case 24:
178
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t0);
179
- throw _context5.t0;
122
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t0);
123
+ throw _context3.t0;
180
124
  case 26:
181
125
  case "end":
182
- return _context5.stop();
126
+ return _context3.stop();
183
127
  }
184
- }, _callee5, null, [[0, 7], [11, 16]]);
128
+ }, _callee3, null, [[0, 7], [11, 16]]);
185
129
  }));
186
130
  return _getKeyIfExists.apply(this, arguments);
187
131
  }
@@ -1 +1 @@
1
- {"version":3,"file":"accessData.js","names":["debug","_interopRequireWildcard","require","_solidLogic","ns","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","pubKeyUrl","exports","_ref","_asyncToGenerator2","_regenerator","mark","_callee","webId","_store$any","_parentSettings","parentSettings","wrap","_callee$","_context","prev","next","store","any","space","doc","value","split","slice","join","Error","concat","abrupt","stop","_x","apply","arguments","getExistingPublicKey","_x2","_x3","_getExistingPublicKey","_callee3","publicKeyUrl","_callee3$","_context3","getKeyIfExists","sent","privKeyUrl","_ref2","_callee2","_store$any2","_settings","settings","_callee2$","_context2","_x4","getExistingPrivateKey","_x5","_x6","_getExistingPrivateKey","_callee4","privateKeyUrl","_callee4$","_context4","_x7","_x8","_x9","_getKeyIfExists","_callee5","keyUrl","keyType","key","_callee5$","_context5","fetcher","load","solid","t0","response","status","log","webOperation","data","contentType","t1","requested","undefined"],"sources":["../../../src/utils/keyHelpers/accessData.ts"],"sourcesContent":["import * as debug from '../../debug'\nimport { store } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { NamedNode } from 'rdflib'\n\n/* export const getPodRoot = async (webId: NamedNode) => {\n const webIdURL = new URL(webId.uri)\n // find storages in webId document\n await store.fetcher.load(webId.uri)\n const storages = store.each(webId, ns.space('storage'), null, webId.doc())\n var podRoot: NamedNode | undefined\n if (!storages?.length) {\n // find storage recursively in webId URL\n let path = webIdURL.pathname\n while (path.length) {\n path = path.substring(0, path.lastIndexOf('/'))\n podRoot = store.sym(webIdURL.origin + path + '/')\n const res = await store.fetcher.webOperation('HEAD', podRoot.uri)\n if (res.headers.get('link')?.includes(ns.space('Storage').value)) break\n if (!path) debug.warn(`Current user storage not found for\\n${webId}`)\n }\n } else {\n // give preference to storage in webId root\n podRoot = storages.find((storage) => webIdURL.origin === new URL(storage.value).origin) as NamedNode\n if (!podRoot) podRoot = storages[0] as NamedNode\n }\n\n return podRoot as NamedNode\n} */\n\nexport const pubKeyUrl = async (webId: NamedNode) => {\n let parentSettings = store.any(webId, ns.space('preferencesFile'), null, webId.doc())?.value\n parentSettings = parentSettings?.split('/').slice(0, -2).join('/')\n if (!parentSettings) throw new Error(`prefererencesFile is expected to exist in ${webId.doc}`)\n return `${parentSettings}/profile/keys/publicKey.ttl`\n /* try {\n return (await getPodRoot(webId)).value + 'profile/keys/publicKey.ttl'\n } catch (err) { throw new Error(err) } */\n}\n\nexport async function getExistingPublicKey (webId: NamedNode, publicKeyUrl: string) {\n // find publickey\n return await getKeyIfExists(webId, publicKeyUrl, 'publicKey')\n}\n\nexport const privKeyUrl = async (webId: NamedNode) => {\n let settings = store.any(webId, ns.space('preferencesFile'), null, webId.doc())?.value\n settings = settings?.split('/').slice(0, -1).join('/')\n if (!settings) throw new Error(`prefererencesFile is expected to exist in ${webId.doc}`)\n return `${settings}/keys/privateKey.ttl`\n /* try {\n const podRoot = await getPodRoot(webId)\n if (!settings?.startsWith(podRoot.value)) throw new Error(`/settings/ is expected to be in ${podRoot.value}`)\n return `${settings}/keys/privateKey.ttl`\n } catch (err) { throw new Error(err) } */\n}\n\nexport async function getExistingPrivateKey (webId: NamedNode, privateKeyUrl: string) {\n // find privateKey\n return await getKeyIfExists(webId, privateKeyUrl, 'privateKey')\n}\n\ntype KeyType = 'publicKey' | 'privateKey'\n\nexport async function getKeyIfExists (webId: NamedNode, keyUrl: string, keyType: KeyType) {\n try {\n await store.fetcher.load(keyUrl)\n const key = store.any(webId, ns.solid(keyType)) // store.sym(CERT + keyType))\n return key?.value // as NamedNode\n } catch (err) {\n if (err.response.status === 404) {\n debug.log(\n 'createIfNotExists: doc does NOT exist, will create... ' + keyUrl\n )\n try {\n await store.fetcher.webOperation('PUT', keyUrl, {\n data: '',\n contentType: 'text/turtle'\n })\n } catch (err) {\n debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + err)\n throw err\n }\n delete store.fetcher.requested[keyUrl] // delete cached 404 error\n // debug.log('createIfNotExists doc created ok ' + doc)\n return undefined // response\n } else {\n debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + err)\n throw err\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,EAAA,GAAAH,uBAAA,CAAAC,OAAA;AAA8B,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,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,CAACO,YAAY,CAAC,KAAK,EAAEZ,MAAM,EAAE;YAC9Ca,IAAI,EAAE,EAAE;YACRC,WAAW,EAAE;UACf,CAAC,CAAC;QAAA;UAAAV,SAAA,CAAApD,IAAA;UAAA;QAAA;UAAAoD,SAAA,CAAArD,IAAA;UAAAqD,SAAA,CAAAW,EAAA,GAAAX,SAAA;UAEF7F,KAAK,CAACoG,GAAG,CAAC,gCAAgC,GAAGX,MAAM,GAAG,IAAI,GAAAI,SAAA,CAAAW,EAAM,CAAC;UAAA,MAAAX,SAAA,CAAAW,EAAA;QAAA;UAGnE,OAAO9D,iBAAK,CAACoD,OAAO,CAACW,SAAS,CAAChB,MAAM,CAAC,EAAC;UACvC;UAAA,OAAAI,SAAA,CAAAzC,MAAA,WACOsD,SAAS;QAAA;UAEhB1G,KAAK,CAACoG,GAAG,CAAC,gCAAgC,GAAGX,MAAM,GAAG,IAAI,GAAAI,SAAA,CAAAI,EAAM,CAAC;UAAA,MAAAJ,SAAA,CAAAI,EAAA;QAAA;QAAA;UAAA,OAAAJ,SAAA,CAAAxC,IAAA;MAAA;IAAA,GAAAmC,QAAA;EAAA,CAItE;EAAA,OAAAD,eAAA,CAAAhC,KAAA,OAAAC,SAAA;AAAA"}
1
+ {"version":3,"file":"accessData.js","names":["debug","_interopRequireWildcard","require","_solidLogic","ns","_otherHelpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","pubKeyUrl","exports","webId","url","root","getRootIfPreferencesExist","concat","err","error","privKeyUrl","getExistingPublicKey","_x","_x2","_getExistingPublicKey","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee","publicKeyUrl","wrap","_callee$","_context","prev","next","getKeyIfExists","abrupt","sent","stop","getExistingPrivateKey","_x3","_x4","_getExistingPrivateKey","_callee2","privateKeyUrl","_callee2$","_context2","_x5","_x6","_x7","_getKeyIfExists","_callee3","keyUrl","keyType","key","_callee3$","_context3","store","fetcher","load","any","solid","value","t0","response","status","log","webOperation","data","contentType","t1","requested","undefined"],"sources":["../../../src/utils/keyHelpers/accessData.ts"],"sourcesContent":["import * as debug from '../../debug'\nimport { store } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { NamedNode } from 'rdflib'\nimport { getRootIfPreferencesExist } from './otherHelpers'\n\nexport const pubKeyUrl = (webId: NamedNode) => {\n let url\n try {\n const root = getRootIfPreferencesExist(webId)\n url = `${root}/profile/keys/publicKey.ttl`\n } catch (err) {\n debug.error(err)\n }\n return url\n}\n\nexport const privKeyUrl = (webId: NamedNode) => {\n let url\n try {\n const root = getRootIfPreferencesExist(webId)\n url = `${root}/keys/privateKey.ttl`\n } catch (err) {\n debug.error(err)\n }\n return url\n}\n\nexport async function getExistingPublicKey (webId: NamedNode, publicKeyUrl: string) {\n // find publickey\n return await getKeyIfExists(webId, publicKeyUrl, 'publicKey')\n}\n\nexport async function getExistingPrivateKey (webId: NamedNode, privateKeyUrl: string) {\n // find privateKey\n return await getKeyIfExists(webId, privateKeyUrl, 'privateKey')\n}\n\ntype KeyType = 'publicKey' | 'privateKey'\n\nexport async function getKeyIfExists (webId: NamedNode, keyUrl: string, keyType: KeyType) {\n try {\n await store.fetcher.load(keyUrl)\n const key = store.any(webId, ns.solid(keyType)) // store.sym(CERT + keyType))\n return key?.value // as NamedNode\n } catch (err) {\n if (err.response.status === 404) {\n debug.log(\n 'createIfNotExists: doc does NOT exist, will create... ' + keyUrl\n )\n try {\n await store.fetcher.webOperation('PUT', keyUrl, {\n data: '',\n contentType: 'text/turtle'\n })\n } catch (err) {\n debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + err)\n throw err\n }\n delete store.fetcher.requested[keyUrl] // delete cached 404 error\n // debug.log('createIfNotExists doc created ok ' + doc)\n return undefined // response\n } else {\n debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + err)\n throw err\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;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UAAA,OAAAP,SAAA,CAAAlB,IAAA;MAAA;IAAA,GAAAa,QAAA;EAAA,CAItE;EAAA,OAAAD,eAAA,CAAA3B,KAAA,OAAAC,SAAA;AAAA"}
@@ -0,0 +1,3 @@
1
+ import { NamedNode } from 'rdflib';
2
+ export declare const getRootIfPreferencesExist: (webId: NamedNode) => string;
3
+ //# sourceMappingURL=otherHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otherHelpers.d.ts","sourceRoot":"","sources":["../../../src/utils/keyHelpers/otherHelpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIlC,eAAO,MAAM,yBAAyB,UAAW,SAAS,WAKzD,CAAA"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.getRootIfPreferencesExist = void 0;
8
+ var _solidLogic = require("solid-logic");
9
+ var ns = _interopRequireWildcard(require("../../ns"));
10
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
12
+ // Will rename this file later. We will probably be using solid-logic anyway
13
+ // moved it out so I can mock
14
+
15
+ var getRootIfPreferencesExist = exports.getRootIfPreferencesExist = function getRootIfPreferencesExist(webId) {
16
+ var _store$any, _root;
17
+ var root = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
18
+ root = (_root = root) === null || _root === void 0 ? void 0 : _root.split('/').slice(0, -2).join('/');
19
+ if (!root) throw new Error("prefererencesFile is expected to exist in ".concat(webId));
20
+ return root;
21
+ };
22
+ //# sourceMappingURL=otherHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"otherHelpers.js","names":["_solidLogic","require","ns","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","getRootIfPreferencesExist","exports","webId","_store$any","_root","root","store","any","space","doc","value","split","slice","join","Error","concat"],"sources":["../../../src/utils/keyHelpers/otherHelpers.ts"],"sourcesContent":["import { store } from 'solid-logic'\nimport * as ns from '../../ns'\nimport { NamedNode } from 'rdflib'\n// Will rename this file later. We will probably be using solid-logic anyway\n// moved it out so I can mock\n\nexport const getRootIfPreferencesExist = (webId: NamedNode) => {\n let root = store.any(webId, ns.space('preferencesFile'), null, webId.doc())?.value\n root = root?.split('/').slice(0, -2).join('/')\n if (!root) throw new Error(`prefererencesFile is expected to exist in ${webId}`)\n return root\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,EAAA,GAAAC,uBAAA,CAAAF,OAAA;AAA8B,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eA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AK,CAAC,GAAG,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;EAC9C,IAAI,CAACR,IAAI,EAAE,MAAM,IAAIS,KAAK,8CAAAC,MAAA,CAA8Cb,KAAK,CAAE,CAAC;EAChF,OAAOG,IAAI;AACb,CAAC"}
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.versionInfo = void 0;
7
7
  var versionInfo = exports.versionInfo = {
8
- buildTime: '2023-11-30T16:45:27Z',
9
- commit: '28954ea400b5ebbd9627fdf986cadccae104a51f',
8
+ buildTime: '2023-12-02T14:09:46Z',
9
+ commit: '7c0461b3a8d7aaf07742744b102bf94a129e3067',
10
10
  npmInfo: {
11
- 'solid-ui': '2.4.30',
11
+ 'solid-ui': '2.4.31',
12
12
  npm: '8.19.4',
13
13
  node: '16.20.2',
14
14
  v8: '9.4.146.26-node.26',
@@ -1 +1 @@
1
- {"version":3,"file":"versionInfo.js","names":["versionInfo","exports","buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export const versionInfo = {\n buildTime: '2023-11-30T16:45:27Z',\n commit: '28954ea400b5ebbd9627fdf986cadccae104a51f',\n npmInfo:\n{\n 'solid-ui': '2.4.30',\n npm: '8.19.4',\n node: '16.20.2',\n v8: '9.4.146.26-node.26',\n uv: '1.43.0',\n zlib: '1.2.11',\n brotli: '1.0.9',\n ares: '1.19.1',\n modules: '93',\n nghttp2: '1.47.0',\n napi: '8',\n llhttp: '6.0.11',\n openssl: '1.1.1v+quic',\n cldr: '41.0',\n icu: '71.1',\n tz: '2022f',\n unicode: '14.0',\n ngtcp2: '0.8.1',\n nghttp3: '0.7.0'\n}\n}\n"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACT;IACE,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,IAAI;IACbC,OAAO,EAAE,QAAQ;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,aAAa;IACtBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,EAAE,EAAE,OAAO;IACXC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE;EACX;AACA,CAAC"}
1
+ {"version":3,"file":"versionInfo.js","names":["versionInfo","exports","buildTime","commit","npmInfo","npm","node","v8","uv","zlib","brotli","ares","modules","nghttp2","napi","llhttp","openssl","cldr","icu","tz","unicode","ngtcp2","nghttp3"],"sources":["../src/versionInfo.ts"],"sourcesContent":["export const versionInfo = {\n buildTime: '2023-12-02T14:09:46Z',\n commit: '7c0461b3a8d7aaf07742744b102bf94a129e3067',\n npmInfo:\n{\n 'solid-ui': '2.4.31',\n npm: '8.19.4',\n node: '16.20.2',\n v8: '9.4.146.26-node.26',\n uv: '1.43.0',\n zlib: '1.2.11',\n brotli: '1.0.9',\n ares: '1.19.1',\n modules: '93',\n nghttp2: '1.47.0',\n napi: '8',\n llhttp: '6.0.11',\n openssl: '1.1.1v+quic',\n cldr: '41.0',\n icu: '71.1',\n tz: '2022f',\n unicode: '14.0',\n ngtcp2: '0.8.1',\n nghttp3: '0.7.0'\n}\n}\n"],"mappings":";;;;;;AAAO,IAAMA,WAAW,GAAAC,OAAA,CAAAD,WAAA,GAAG;EACzBE,SAAS,EAAE,sBAAsB;EACjCC,MAAM,EAAE,0CAA0C;EAClDC,OAAO,EACT;IACE,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAE,QAAQ;IACbC,IAAI,EAAE,SAAS;IACfC,EAAE,EAAE,oBAAoB;IACxBC,EAAE,EAAE,QAAQ;IACZC,IAAI,EAAE,QAAQ;IACdC,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,OAAO,EAAE,IAAI;IACbC,OAAO,EAAE,QAAQ;IACjBC,IAAI,EAAE,GAAG;IACTC,MAAM,EAAE,QAAQ;IAChBC,OAAO,EAAE,aAAa;IACtBC,IAAI,EAAE,MAAM;IACZC,GAAG,EAAE,MAAM;IACXC,EAAE,EAAE,OAAO;IACXC,OAAO,EAAE,MAAM;IACfC,MAAM,EAAE,OAAO;IACfC,OAAO,EAAE;EACX;AACA,CAAC"}
@@ -9,39 +9,34 @@ exports.makeDropTarget = makeDropTarget;
9
9
  exports.uploadFiles = uploadFiles;
10
10
  var debug = _interopRequireWildcard(require("../debug"));
11
11
  var mime = _interopRequireWildcard(require("mime-types"));
12
+ var style = _interopRequireWildcard(require("../style"));
12
13
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
14
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
14
15
  /* Drag and drop common functionality
15
16
  *
16
17
  * It is easy to make something draggable, or to make it a drag target!
17
- * Just call the functions below. In a solid world, any part of the UI which
18
- * represent one thing which has a UR, should be made draggable using makeDraggable
18
+ * Just call the functions below. In a Solid world, any part of the UI which
19
+ * represents one thing which has a URI, should be made draggable using makeDraggable.
19
20
  * Any list of things should typically allow you to drag new members of the list
20
21
  * onto it.
21
- * The file upload function uploadFiles is provided as often of someone drags a file from the computer
22
- * desktop, you may want to upload it into the pod.
22
+ * The file upload function, uploadFiles, is provided as often as someone drags a file from the computer
23
+ * desktop. You may want to upload it into the pod.
23
24
  */
24
25
 
25
26
  /* global FileReader alert */
26
27
 
27
28
  function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
28
29
  var dragoverListener = function dragoverListener(e) {
29
- e.preventDefault(); // Neeed else drop does not work [sic]
30
+ e.preventDefault(); // Need this; otherwise, drop does not work.
30
31
  e.dataTransfer.dropEffect = 'copy';
31
32
  };
32
33
  var dragenterListener = function dragenterListener(e) {
33
34
  debug.log('dragenter event dropEffect: ' + e.dataTransfer.dropEffect);
34
- if (this.style) {
35
+ if (this.localStyle) {
35
36
  // necessary not sure when
36
37
  if (!this.savedStyle) {
37
- this.savedStyle = {};
38
- this.savedStyle.border = this.style.border;
39
- this.savedStyle.backgroundColor = this.style.backgroundColor;
40
- this.savedStyle.borderRadius = this.style.borderRadius;
38
+ this.savedStyle = style.dragEvent;
41
39
  }
42
- this.style.backgroundColor = '#ccc';
43
- this.style.border = '0.25em dashed black';
44
- this.style.borderRadius = '0.3em';
45
40
  }
46
41
  e.dataTransfer.dropEffect = 'link';
47
42
  debug.log('dragenter event dropEffect 2: ' + e.dataTransfer.dropEffect);
@@ -49,12 +44,9 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
49
44
  var dragleaveListener = function dragleaveListener(e) {
50
45
  debug.log('dragleave event dropEffect: ' + e.dataTransfer.dropEffect);
51
46
  if (this.savedStyle) {
52
- this.style.border = this.savedStyle.border;
53
- this.style.backgroundColor = this.savedStyle.backgroundColor;
54
- this.style.borderRadius = this.savedStyle.borderRadius;
47
+ this.localStyle = this.savedStyle;
55
48
  } else {
56
- this.style.backgroundColor = 'white';
57
- this.style.border = '0em solid black';
49
+ this.localStyle = style.dropEvent;
58
50
  }
59
51
  };
60
52
  var dropListener = function dropListener(e) {
@@ -93,7 +85,7 @@ function makeDropTarget(ele, droppedURIHandler, droppedFileHandler) {
93
85
  if (uris) {
94
86
  droppedURIHandler(uris);
95
87
  }
96
- this.style.backgroundColor = 'white'; // restore style
88
+ this.localStyle = style.restoreStyle; // restore style
97
89
  return false;
98
90
  }; // dropListener
99
91