solid-ui 2.4.16-9d8eda18 → 2.4.16-a9604219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/acl/add-agent-buttons.js +1 -1
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/chat/message.js +3 -3
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/thread.js +1 -1
- package/lib/chat/thread.js.map +1 -1
- package/lib/create/create.js +1 -1
- package/lib/create/create.js.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -8
- package/lib/index.js.map +1 -1
- package/lib/login/login.d.ts +3 -3
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +28 -25
- package/lib/login/login.js.map +1 -1
- package/lib/messageArea.js +1 -1
- package/lib/messageArea.js.map +1 -1
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +59 -30
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js +1 -1
- package/lib/preferences.js.map +1 -1
- package/lib/utils/label.js +1 -2
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.js +9 -9
- package/lib/versionInfo.js.map +1 -1
- package/lib/webpack-bundle.js +877 -674
- package/lib/webpack-bundle.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +3 -1
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +14 -7
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/package.json +12 -4
package/lib/create/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/create/create.ts"],"names":["kb","solidLogicSingleton","store","newThingUI","createContext","dataBrowserContext","thePanes","dom","div","me","uri","Error","iconStyle","star","appendChild","createElement","visible","setAttribute","icons","iconBase","complain","message","pre","createTextNode","styleTheIcons","style","i","iconArray","length","st","disabled","selectTool","icon","selectNewTool","_event","addEventListener","makeNewAppInstance","options","Promise","resolve","reject","selectUI","callbackWS","ws","newBase","then","_context","newPaneOptions","Object","assign","folder","undefined","workspace","opt","debug","log","pane","name","mintNew","newInstance","tail","slice","isPackage","includes","add","ns","ldp","sym","doc","refreshTarget","refresh","p","innerHTML","noun","err","pa","mintClass","utils","label","appPathSegment","toUpperCase","gotName","endsWith","encodeURIComponent","widgets","askName","foaf","mintingPanes","values","filter","mintingClassMap","reduce","classMap","forEach","push","e","event","iconEle","noIndexHTML"],"mappings":";;;;;;;;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;AAYA,IAAMA,EAAE,GAAGC,gCAAoBC,KAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,UAAT,CACLC,aADK,EAELC,kBAFK,EAGLC,QAHK,EAIC;AACN,MAAMC,GAAG,GAAGH,aAAa,CAACG,GAA1B;AACA,MAAMC,GAAG,GAAGJ,aAAa,CAACI,GAA1B;;AACA,MAAIJ,aAAa,CAACK,EAAd,IAAoB,CAACL,aAAa,CAACK,EAAd,CAAiBC,GAA1C,EAA+C;AAC7C,UAAM,IAAIC,KAAJ,CAAU,kCAAkCP,aAAa,CAACK,EAA1D,CAAN;AACD;;AAED,MAAMG,SAAS,GAAG,0CAAlB,CAPM,CAOuD;;AAC7D,MAAMC,IAAI,GAAGL,GAAG,CAACM,WAAJ,CAAgBP,GAAG,CAACQ,aAAJ,CAAkB,KAAlB,CAAhB,CAAb;AACA,MAAIC,OAAO,GAAG,KAAd,CATM,CASc;AACpB;AACA;;AACAH,EAAAA,IAAI,CAACI,YAAL,CAAkB,KAAlB,EAAyBC,gBAAMC,QAAN,GAAiB,sBAA1C;AACAN,EAAAA,IAAI,CAACI,YAAL,CAAkB,OAAlB,EAA2BL,SAA3B;AACAC,EAAAA,IAAI,CAACI,YAAL,CAAkB,OAAlB,EAA2B,kBAA3B;;AAEA,MAAMG,QAAQ,GAAG,SAASA,QA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A;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","sourcesContent":["/* create.js UI to craete new objects in the solid-app-set world\n **\n */\n\nimport { DataBrowserContext, NewPaneOptions, PaneDefinition } from 'pane-registry'\nimport { solidLogicSingleton } from 'solid-logic'\nimport * as debug from '../debug'\nimport { icons } from '../iconBase'\nimport { logInLoadProfile, selectWorkspace } from '../login/login'\nimport * as ns from '../ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { CreateContext, NewAppInstanceOptions } from './types'\n\nconst kb = solidLogicSingleton.store\n\n/* newThingUI -- return UI for user to select a new object, folder, etc\n **\n ** context must include: dom, div,\n ** optional: folder: NamedNode -- the folder where the thing is bring put\n ** (suppresses asking for a full URI or workspace)\n **\n */\nexport function newThingUI (\n createContext: CreateContext,\n dataBrowserContext: DataBrowserContext,\n thePanes: Array<PaneDefinition>\n): void {\n const dom = createContext.dom\n const div = createContext.div\n if (createContext.me && !createContext.me.uri) {\n throw new Error('newThingUI: Invalid userid: ' + createContext.me)\n }\n\n const iconStyle = 'padding: 0.7em; width: 2em; height: 2em;' // was: 'padding: 1em; width: 3em; height: 3em;'\n const star = div.appendChild(dom.createElement('img'))\n let visible = false // the inividual tools tools\n // noun_272948.svg = black star\n // noun_34653_green.svg = green plus\n star.setAttribute('src', icons.iconBase + 'noun_34653_green.svg')\n star.setAttribute('style', iconStyle)\n star.setAttribute('title', 'Add another tool')\n\n const complain = function complain (message) {\n const pre = div.appendChild(dom.createElement('pre'))\n pre.setAttribute('style', 'background-color: pink')\n pre.appendChild(dom.createTextNode(message))\n }\n\n function styleTheIcons (style) {\n for (let i = 0; i < iconArray.length; i++) {\n let st = iconStyle + style\n if (iconArray[i].disabled) {\n // @@ unused\n st += 'opacity: 0.3;'\n }\n iconArray[i].setAttribute('style', st) // eg 'background-color: #ccc;'\n }\n }\n\n function selectTool (icon) {\n styleTheIcons('display: none;') // 'background-color: #ccc;'\n icon.setAttribute('style', iconStyle + 'background-color: yellow;')\n }\n\n function selectNewTool (_event?) {\n visible = !visible\n star.setAttribute(\n 'style',\n iconStyle + (visible ? 'background-color: yellow;' : '')\n )\n styleTheIcons(visible ? '' : 'display: none;')\n }\n\n star.addEventListener('click', selectNewTool)\n\n function makeNewAppInstance (options: NewAppInstanceOptions) {\n return new Promise(function (resolve, reject) {\n let selectUI // , selectUIParent\n function callbackWS (ws, newBase) {\n logInLoadProfile(createContext).then(\n _context => {\n const newPaneOptions: NewPaneOptions = Object.assign({\n newBase: newBase,\n folder: options.folder || undefined,\n workspace: ws\n }, options)\n for (const opt in options) {\n // get div, dom, me, folder, pane, refreshTable\n newPaneOptions[opt] = options[opt]\n }\n debug.log(`newThingUI: Minting new ${newPaneOptions.pane.name} at ${newPaneOptions.newBase}`)\n options.pane\n .mintNew!(dataBrowserContext, newPaneOptions)\n .then(function (newPaneOptions) {\n if (!newPaneOptions || !newPaneOptions.newInstance) {\n throw new Error('Cannot mint new - missing newInstance')\n }\n if (newPaneOptions.folder) {\n const tail = newPaneOptions.newInstance.uri.slice(\n newPaneOptions.folder.uri.length\n )\n const isPackage = tail.includes('/')\n debug.log(' new thing is packge? ' + isPackage)\n if (isPackage) {\n kb.add(\n newPaneOptions.folder,\n ns.ldp('contains'),\n kb.sym(newPaneOptions.newBase),\n newPaneOptions.folder.doc()\n )\n } else {\n // single file\n kb.add(\n newPaneOptions.folder,\n ns.ldp('contains'),\n newPaneOptions.newInstance,\n newPaneOptions.folder.doc()\n ) // Ping the patch system?\n }\n // @ts-ignore @@ TODO check whether refresh can exist here. Either fix type or remove unreachable code\n if (newPaneOptions.refreshTarget && newPaneOptions.refreshTarget.refresh) {\n // @@ TODO Remove the need to cast as any\n ;(newPaneOptions.refreshTarget as any).refresh() // Refresh the containing display\n }\n // selectUI.parentNode.removeChild(selectUI) It removes itself\n } else {\n const p = options.div.appendChild(dom.createElement('p'))\n p.setAttribute('style', 'font-size: 120%;')\n // Make link to new thing\n p.innerHTML =\n \"Your <a target='_blank' href='\" +\n newPaneOptions.newInstance.uri +\n \"'><b>new \" +\n options.noun +\n '</b></a> is ready to be set up. ' +\n \"<br/><br/><a target='_blank' href='\" +\n newPaneOptions.newInstance.uri +\n \"'>Go to your new \" +\n options.noun +\n '.</a>'\n // selectUI.parentNode.removeChild(selectUI) // Clean up\n // selectUIParent.removeChild(selectUI) // Clean up\n }\n selectNewTool() // toggle star to plain and menu vanish again\n })\n .catch(function (err) {\n complain(err)\n reject(err)\n })\n },\n err => {\n // login fails\n complain('Error logging on: ' + err)\n }\n )\n } // callbackWS\n\n const pa = options.pane\n // options.appPathSegment = pa.name // was 'edu.mit.solid.pane.'\n options.noun = pa.mintClass ? utils.label(pa.mintClass) : pa.name\n options.appPathSegment = options.noun.slice(0, 1).toUpperCase() + options.noun.slice(1)\n\n if (!options.folder) {\n // No folder given? Ask user for full URI\n selectUI = selectWorkspace(dom, {\n noun: options.noun,\n appPathSegment: options.appPathSegment\n }, callbackWS)\n options.div.appendChild(selectUI)\n // selectUIParent = options.div\n } else {\n const gotName = function (name) {\n if (!name) {\n // selectUIParent.removeChild(selectUI) itremves itself if cancelled\n selectNewTool() // toggle star to plain and menu vanish again\n } else {\n let uri = options.folder!.uri\n if (!uri.endsWith('/')) {\n uri = uri + '/'\n }\n uri = uri + encodeURIComponent(name) + '/'\n callbackWS(null, uri)\n }\n }\n widgets\n .askName(\n dom,\n kb,\n options.div,\n ns.foaf('name'),\n null,\n options.noun\n )\n .then(gotName)\n // selectUI = getNameForm(dom, kb, options.noun, gotName)\n // options.div.appendChild(selectUI)\n // selectUIParent = options.div\n }\n })\n } // makeNewAppInstance\n\n const iconArray: Array<any> = []\n const mintingPanes = Object.values(thePanes).filter(pane => pane.mintNew)\n const mintingClassMap = mintingPanes.reduce((classMap, pane) => {\n if (pane.mintClass) {\n classMap[pane.mintClass.uri] = (classMap[pane.mintClass.uri] || 0) + 1\n }\n return classMap\n }, {})\n mintingPanes.forEach(pane => {\n // @@ TODO Remove the need to cast to any\n const icon: any = createContext.div.appendChild(dom.createElement('img'))\n icon.setAttribute('src', pane.icon)\n const noun = pane.mintClass\n ? mintingClassMap[pane.mintClass.uri] > 1\n ? `${utils.label(pane.mintClass)} (using ${pane.name} pane)`\n : utils.label(pane.mintClass)\n : pane.name + ' @@'\n icon.setAttribute('title', 'Make new ' + noun)\n icon.setAttribute('style', iconStyle + 'display: none;')\n iconArray.push(icon)\n if (!icon.disabled) {\n icon.addEventListener('click', function (e) {\n selectTool(icon)\n makeNewAppInstance({\n event: e,\n folder: createContext.folder || null,\n iconEle: icon,\n pane,\n noun,\n noIndexHTML: true, // do NOT @@ for now write a HTML file\n div: createContext.div,\n me: createContext.me,\n dom: createContext.dom,\n refreshTarget: createContext.refreshTarget\n })\n })\n }\n })\n}\n\n// Form to get the name of a new thing before we create it\n//\n// Used in contacts for new groups, individuals.\n//\n/*\nfunction getNameForm (dom, kb, classLabel, gotNameCallback) {\n const form = dom.createElement('div') // form is broken as HTML behaviour can resurface on js error\n form.innerHTML = '<p>Name of new ' + classLabel + ':</p>'\n const namefield = dom.createElement('input')\n namefield.setAttribute('type', 'text')\n namefield.setAttribute('size', '30')\n namefield.setAttribute('style', style.textInputStyle)\n namefield.setAttribute('maxLength', '2048') // No arbitrary limits\n namefield.select() // focus next user input\n\n const gotName = function () {\n namefield.setAttribute('class', 'pendingedit')\n namefield.disabled = true\n continueButton.disabled = true\n cancel.disabled = true\n gotNameCallback(true, namefield.value)\n }\n\n namefield.addEventListener('keyup', function (e) {\n if (e.keyCode === 13) {\n gotName()\n }\n }, false)\n form.appendChild(namefield)\n\n form.appendChild(dom.createElement('br'))\n\n const cancel = form.appendChild(widgets.cancelButton(dom))\n cancel.addEventListener('click', function (e) {\n form.parentNode.removeChild(form)\n gotNameCallback(false)\n }, false)\n\n const continueButton = form.appendChild(widgets.continueButton(dom))\n continueButton.addEventListener('click', function (e) {\n gotName()\n }, false)\n\n return form\n}\n*/\n"],"file":"create.js"}
|
|
1
|
+
{"version":3,"sources":["../../src/create/create.ts"],"names":["kb","solidLogicSingleton","store","newThingUI","createContext","dataBrowserContext","thePanes","dom","div","me","uri","Error","iconStyle","star","appendChild","createElement","visible","setAttribute","icons","iconBase","complain","message","pre","createTextNode","styleTheIcons","style","i","iconArray","length","st","disabled","selectTool","icon","selectNewTool","_event","addEventListener","makeNewAppInstance","options","Promise","resolve","reject","selectUI","callbackWS","ws","newBase","then","_context","newPaneOptions","Object","assign","folder","undefined","workspace","opt","debug","log","pane","name","mintNew","newInstance","tail","slice","isPackage","includes","add","ns","ldp","sym","doc","refreshTarget","refresh","p","innerHTML","noun","err","pa","mintClass","utils","label","appPathSegment","toUpperCase","gotName","endsWith","encodeURIComponent","widgets","askName","foaf","mintingPanes","values","filter","mintingClassMap","reduce","classMap","forEach","push","e","event","iconEle","noIndexHTML"],"mappings":";;;;;;;;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAXA;AACA;AACA;AAYA,IAAMA,EAAE,GAAGC,gCAAoBC,KAA/B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,SAASC,UAAT,CACLC,aADK,EAELC,kBAFK,EAGLC,QAHK,EAIC;AACN,MAAMC,GAAG,GAAGH,aAAa,CAACG,GAA1B;AACA,MAAMC,GAAG,GAAGJ,aAAa,CAACI,GAA1B;;AACA,MAAIJ,aAAa,CAACK,EAAd,IAAoB,CAACL,aAAa,CAACK,EAAd,CAAiBC,GAA1C,EAA+C;AAC7C,UAAM,IAAIC,KAAJ,CAAU,kCAAkCP,aAAa,CAACK,EAA1D,CAAN;AACD;;AAED,MAAMG,SAAS,GAAG,0CAAlB,CAPM,CAOuD;;AAC7D,MAAMC,IAAI,GAAGL,GAAG,CAACM,WAAJ,CAAgBP,GAAG,CAACQ,aAAJ,CAAkB,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UAAAA,WAAW,EAAE,IANI;AAME;AACnB1F,UAAAA,GAAG,EAAEJ,aAAa,CAACI,GAPF;AAQjBC,UAAAA,EAAE,EAAEL,aAAa,CAACK,EARD;AASjBF,UAAAA,GAAG,EAAEH,aAAa,CAACG,GATF;AAUjB8D,UAAAA,aAAa,EAAEjE,aAAa,CAACiE;AAVZ,SAAD,CAAlB;AAYD,OAdD;AAeD;AACF,GA7BD;AA8BD,C,CAED;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","sourcesContent":["/* create.js UI to craete new objects in the solid-app-set world\n **\n */\n\nimport { DataBrowserContext, NewPaneOptions, PaneDefinition } from 'pane-registry'\nimport { solidLogicSingleton } from 'solid-logic'\nimport * as debug from '../debug'\nimport { icons } from '../iconBase'\nimport { ensureLoadedProfile, selectWorkspace } from '../login/login'\nimport * as ns from '../ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { CreateContext, NewAppInstanceOptions } from './types'\n\nconst kb = solidLogicSingleton.store\n\n/* newThingUI -- return UI for user to select a new object, folder, etc\n **\n ** context must include: dom, div,\n ** optional: folder: NamedNode -- the folder where the thing is bring put\n ** (suppresses asking for a full URI or workspace)\n **\n */\nexport function newThingUI (\n createContext: CreateContext,\n dataBrowserContext: DataBrowserContext,\n thePanes: Array<PaneDefinition>\n): void {\n const dom = createContext.dom\n const div = createContext.div\n if (createContext.me && !createContext.me.uri) {\n throw new Error('newThingUI: Invalid userid: ' + createContext.me)\n }\n\n const iconStyle = 'padding: 0.7em; width: 2em; height: 2em;' // was: 'padding: 1em; width: 3em; height: 3em;'\n const star = div.appendChild(dom.createElement('img'))\n let visible = false // the inividual tools tools\n // noun_272948.svg = black star\n // noun_34653_green.svg = green plus\n star.setAttribute('src', icons.iconBase + 'noun_34653_green.svg')\n star.setAttribute('style', iconStyle)\n star.setAttribute('title', 'Add another tool')\n\n const complain = function complain (message) {\n const pre = div.appendChild(dom.createElement('pre'))\n pre.setAttribute('style', 'background-color: pink')\n pre.appendChild(dom.createTextNode(message))\n }\n\n function styleTheIcons (style) {\n for (let i = 0; i < iconArray.length; i++) {\n let st = iconStyle + style\n if (iconArray[i].disabled) {\n // @@ unused\n st += 'opacity: 0.3;'\n }\n iconArray[i].setAttribute('style', st) // eg 'background-color: #ccc;'\n }\n }\n\n function selectTool (icon) {\n styleTheIcons('display: none;') // 'background-color: #ccc;'\n icon.setAttribute('style', iconStyle + 'background-color: yellow;')\n }\n\n function selectNewTool (_event?) {\n visible = !visible\n star.setAttribute(\n 'style',\n iconStyle + (visible ? 'background-color: yellow;' : '')\n )\n styleTheIcons(visible ? '' : 'display: none;')\n }\n\n star.addEventListener('click', selectNewTool)\n\n function makeNewAppInstance (options: NewAppInstanceOptions) {\n return new Promise(function (resolve, reject) {\n let selectUI // , selectUIParent\n function callbackWS (ws, newBase) {\n ensureLoadedProfile(createContext).then(\n _context => {\n const newPaneOptions: NewPaneOptions = Object.assign({\n newBase: newBase,\n folder: options.folder || undefined,\n workspace: ws\n }, options)\n for (const opt in options) {\n // get div, dom, me, folder, pane, refreshTable\n newPaneOptions[opt] = options[opt]\n }\n debug.log(`newThingUI: Minting new ${newPaneOptions.pane.name} at ${newPaneOptions.newBase}`)\n options.pane\n .mintNew!(dataBrowserContext, newPaneOptions)\n .then(function (newPaneOptions) {\n if (!newPaneOptions || !newPaneOptions.newInstance) {\n throw new Error('Cannot mint new - missing newInstance')\n }\n if (newPaneOptions.folder) {\n const tail = newPaneOptions.newInstance.uri.slice(\n newPaneOptions.folder.uri.length\n )\n const isPackage = tail.includes('/')\n debug.log(' new thing is packge? ' + isPackage)\n if (isPackage) {\n kb.add(\n newPaneOptions.folder,\n ns.ldp('contains'),\n kb.sym(newPaneOptions.newBase),\n newPaneOptions.folder.doc()\n )\n } else {\n // single file\n kb.add(\n newPaneOptions.folder,\n ns.ldp('contains'),\n newPaneOptions.newInstance,\n newPaneOptions.folder.doc()\n ) // Ping the patch system?\n }\n // @ts-ignore @@ TODO check whether refresh can exist here. Either fix type or remove unreachable code\n if (newPaneOptions.refreshTarget && newPaneOptions.refreshTarget.refresh) {\n // @@ TODO Remove the need to cast as any\n ;(newPaneOptions.refreshTarget as any).refresh() // Refresh the containing display\n }\n // selectUI.parentNode.removeChild(selectUI) It removes itself\n } else {\n const p = options.div.appendChild(dom.createElement('p'))\n p.setAttribute('style', 'font-size: 120%;')\n // Make link to new thing\n p.innerHTML =\n \"Your <a target='_blank' href='\" +\n newPaneOptions.newInstance.uri +\n \"'><b>new \" +\n options.noun +\n '</b></a> is ready to be set up. ' +\n \"<br/><br/><a target='_blank' href='\" +\n newPaneOptions.newInstance.uri +\n \"'>Go to your new \" +\n options.noun +\n '.</a>'\n // selectUI.parentNode.removeChild(selectUI) // Clean up\n // selectUIParent.removeChild(selectUI) // Clean up\n }\n selectNewTool() // toggle star to plain and menu vanish again\n })\n .catch(function (err) {\n complain(err)\n reject(err)\n })\n },\n err => {\n // login fails\n complain('Error logging on: ' + err)\n }\n )\n } // callbackWS\n\n const pa = options.pane\n // options.appPathSegment = pa.name // was 'edu.mit.solid.pane.'\n options.noun = pa.mintClass ? utils.label(pa.mintClass) : pa.name\n options.appPathSegment = options.noun.slice(0, 1).toUpperCase() + options.noun.slice(1)\n\n if (!options.folder) {\n // No folder given? Ask user for full URI\n selectUI = selectWorkspace(dom, {\n noun: options.noun,\n appPathSegment: options.appPathSegment\n }, callbackWS)\n options.div.appendChild(selectUI)\n // selectUIParent = options.div\n } else {\n const gotName = function (name) {\n if (!name) {\n // selectUIParent.removeChild(selectUI) itremves itself if cancelled\n selectNewTool() // toggle star to plain and menu vanish again\n } else {\n let uri = options.folder!.uri\n if (!uri.endsWith('/')) {\n uri = uri + '/'\n }\n uri = uri + encodeURIComponent(name) + '/'\n callbackWS(null, uri)\n }\n }\n widgets\n .askName(\n dom,\n kb,\n options.div,\n ns.foaf('name'),\n null,\n options.noun\n )\n .then(gotName)\n // selectUI = getNameForm(dom, kb, options.noun, gotName)\n // options.div.appendChild(selectUI)\n // selectUIParent = options.div\n }\n })\n } // makeNewAppInstance\n\n const iconArray: Array<any> = []\n const mintingPanes = Object.values(thePanes).filter(pane => pane.mintNew)\n const mintingClassMap = mintingPanes.reduce((classMap, pane) => {\n if (pane.mintClass) {\n classMap[pane.mintClass.uri] = (classMap[pane.mintClass.uri] || 0) + 1\n }\n return classMap\n }, {})\n mintingPanes.forEach(pane => {\n // @@ TODO Remove the need to cast to any\n const icon: any = createContext.div.appendChild(dom.createElement('img'))\n icon.setAttribute('src', pane.icon)\n const noun = pane.mintClass\n ? mintingClassMap[pane.mintClass.uri] > 1\n ? `${utils.label(pane.mintClass)} (using ${pane.name} pane)`\n : utils.label(pane.mintClass)\n : pane.name + ' @@'\n icon.setAttribute('title', 'Make new ' + noun)\n icon.setAttribute('style', iconStyle + 'display: none;')\n iconArray.push(icon)\n if (!icon.disabled) {\n icon.addEventListener('click', function (e) {\n selectTool(icon)\n makeNewAppInstance({\n event: e,\n folder: createContext.folder || null,\n iconEle: icon,\n pane,\n noun,\n noIndexHTML: true, // do NOT @@ for now write a HTML file\n div: createContext.div,\n me: createContext.me,\n dom: createContext.dom,\n refreshTarget: createContext.refreshTarget\n })\n })\n }\n })\n}\n\n// Form to get the name of a new thing before we create it\n//\n// Used in contacts for new groups, individuals.\n//\n/*\nfunction getNameForm (dom, kb, classLabel, gotNameCallback) {\n const form = dom.createElement('div') // form is broken as HTML behaviour can resurface on js error\n form.innerHTML = '<p>Name of new ' + classLabel + ':</p>'\n const namefield = dom.createElement('input')\n namefield.setAttribute('type', 'text')\n namefield.setAttribute('size', '30')\n namefield.setAttribute('style', style.textInputStyle)\n namefield.setAttribute('maxLength', '2048') // No arbitrary limits\n namefield.select() // focus next user input\n\n const gotName = function () {\n namefield.setAttribute('class', 'pendingedit')\n namefield.disabled = true\n continueButton.disabled = true\n cancel.disabled = true\n gotNameCallback(true, namefield.value)\n }\n\n namefield.addEventListener('keyup', function (e) {\n if (e.keyCode === 13) {\n gotName()\n }\n }, false)\n form.appendChild(namefield)\n\n form.appendChild(dom.createElement('br'))\n\n const cancel = form.appendChild(widgets.cancelButton(dom))\n cancel.addEventListener('click', function (e) {\n form.parentNode.removeChild(form)\n gotNameCallback(false)\n }, false)\n\n const continueButton = form.appendChild(widgets.continueButton(dom))\n continueButton.addEventListener('click', function (e) {\n gotName()\n }, false)\n\n return form\n}\n*/\n"],"file":"create.js"}
|
package/lib/index.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ import versionInfo from './versionInfo';
|
|
|
31
31
|
import { initHeader } from './header';
|
|
32
32
|
import { initFooter } from './footer';
|
|
33
33
|
import * as createTypes from './create/types';
|
|
34
|
-
import * as solidLogicLib from 'solid-logic';
|
|
35
34
|
declare const dom: Document | null;
|
|
36
|
-
export {
|
|
35
|
+
export { ns, rdf, acl, aclControl, create, createTypes, dom, icons, language, log, login, matrix, media, messageArea, infiniteMessageArea, pad, participation, preferences, style, table, tabs, utils, widgets, versionInfo, initHeader, initFooter };
|
|
37
36
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA;;;;GAIG;AAEH;;;GAGG;AAGH,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,KAAK,EAAE,MAAM,MAAM,CAAA;AAC1B,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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,GAAG,EACH,GAAG,EACH,UAAU,EACV,MAAM,EACN,WAAW,EACX,GAAG,EACH,KAAK,EACL,QAAQ,EACR,GAAG,EACH,KAAK,EACL,MAAM,EACN,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,GAAG,EACH,aAAa,EACb,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,EACJ,KAAK,EACL,OAAO,EACP,WAAW,EACX,UAAU,EACV,UAAU,EACX,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -106,7 +106,7 @@ Object.defineProperty(exports, "messageArea", {
|
|
|
106
106
|
return _messageArea.messageArea;
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
exports.style = exports.
|
|
109
|
+
exports.style = exports.rdf = exports.preferences = exports.participation = exports.pad = exports.ns = void 0;
|
|
110
110
|
Object.defineProperty(exports, "table", {
|
|
111
111
|
enumerable: true,
|
|
112
112
|
get: function get() {
|
|
@@ -196,9 +196,7 @@ var createTypes = _interopRequireWildcard(require("./create/types"));
|
|
|
196
196
|
|
|
197
197
|
exports.createTypes = createTypes;
|
|
198
198
|
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
exports.solidLogicLib = solidLogicLib;
|
|
199
|
+
var _solidLogic = require("solid-logic");
|
|
202
200
|
|
|
203
201
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
204
202
|
|
|
@@ -207,9 +205,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
207
205
|
// pull in first avoid cross-refs
|
|
208
206
|
// @ts-ignore
|
|
209
207
|
// @ts-ignore
|
|
210
|
-
// import * as debug from '../debug'
|
|
211
|
-
// @ts-ignore
|
|
212
|
-
// @ts-ignore
|
|
213
208
|
// @ts-ignore
|
|
214
209
|
// @ts-ignore
|
|
215
210
|
// @ts-ignore
|
|
@@ -225,7 +220,9 @@ exports.dom = dom;
|
|
|
225
220
|
if (typeof window !== 'undefined') {
|
|
226
221
|
;
|
|
227
222
|
window.UI = {
|
|
228
|
-
|
|
223
|
+
authn: _solidLogic.authn,
|
|
224
|
+
store: _solidLogic.store,
|
|
225
|
+
authSession: _solidLogic.authSession,
|
|
229
226
|
ns: ns,
|
|
230
227
|
rdf: rdf,
|
|
231
228
|
acl: _index.acl,
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["dom","window","document","UI","
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["dom","window","document","UI","authn","store","authSession","ns","rdf","acl","aclControl","create","createTypes","icons","language","log","login","matrix","media","messageArea","infiniteMessageArea","pad","participation","preferences","style","table","tabs","utils","widgets","versionInfo","initHeader","initFooter"],"mappings":"AAAA;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;;AAEA;AACA;AACA;AACA;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;;;AAEA;;;;AACA;;AACA;;AAEA;;AACA;;;;AACA;;;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;;;AAEA;;;;AAEA;;;;AAEA;;;;AAEA;;AACA;;;;AAEA;;;;AACA;;;;AACA;;;;AACA;;AACA;;AACA;;AACA;;;;AACA;;;;;;AAlC8B;AAC9B;AAIA;AAMA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAGA;AAUA,IAAMA,GAAG,GAAGC,MAAM,GAAGA,MAAM,CAACC,QAAV,GAAqB,IAAvC,C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\nCopyright (c) 2015-2016 Solid\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nIf you would like to know more about the solid Solid project, please see\nhttps://github.com/solid/solid\n*/\n'use strict'\n/**\n * Provides a Solid client helper object (which exposes various static modules).\n * @module solidUi.js\n * @main solidUi.js\n */\n\n/**\n * @class SolidUi\n * @static\n */\n\n// REMOVE @ts-ignore as you migrate files to TypeScript\nimport * as rdf from 'rdflib' // pull in first avoid cross-refs\n// @ts-ignore\nimport * as ns from './ns'\nimport { acl, aclControl } from './acl/index'\nimport { create } from './create/index'\n// @ts-ignore\nimport { icons } from './iconBase'\nimport * as language from './widgets/forms/autocomplete/language'\nimport * as log from './log'\nimport { matrix } from './matrix/index'\nimport { media } from './media/index'\n// @ts-ignore\nimport { messageArea } from './messageArea'\n// @ts-ignore\nimport { infiniteMessageArea } from './chat/infinite'\n// @ts-ignore\nimport * as pad from './pad'\n// @ts-ignore\nimport * as participation from './participation'\n// @ts-ignore\nimport * as preferences from './preferences'\n// @ts-ignore\nimport * as style from './style'\n// @ts-ignore\nimport { renderTableViewPane as table } from './table'\nimport * as tabs from './tabs'\n// @ts-ignore\nimport * as utils from './utils'\nimport * as login from './login/login'\nimport * as widgets from './widgets/index'\nimport versionInfo from './versionInfo'\nimport { initHeader } from './header'\nimport { initFooter } from './footer'\nimport * as createTypes from './create/types'\nimport { authn, store, authSession } from 'solid-logic'\n\nconst dom = window ? window.document : null // Idea that UI.dom can be adapted in non-browser environments\n\nif (typeof window !== 'undefined') {\n ;(<any>window).UI = {\n authn,\n store,\n authSession,\n ns,\n rdf,\n acl,\n aclControl,\n create,\n createTypes,\n dom,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n versionInfo,\n initHeader,\n initFooter\n } // Simpler access by non-node scripts\n}\n\nexport {\n ns,\n rdf,\n acl,\n aclControl,\n create,\n createTypes,\n dom,\n icons,\n language,\n log,\n login,\n matrix,\n media,\n messageArea,\n infiniteMessageArea,\n pad,\n participation,\n preferences,\n style,\n table,\n tabs,\n utils,\n widgets,\n versionInfo,\n initHeader,\n initFooter\n}\n"],"file":"index.js"}
|
package/lib/login/login.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { AppDetails, AuthenticationContext } from 'solid-logic';
|
|
|
27
27
|
*
|
|
28
28
|
* @param context
|
|
29
29
|
*/
|
|
30
|
-
export declare function
|
|
30
|
+
export declare function ensureLoggedIn(context: AuthenticationContext): Promise<AuthenticationContext>;
|
|
31
31
|
/**
|
|
32
32
|
* Loads preference file
|
|
33
33
|
* Do this after having done log in and load profile
|
|
@@ -36,7 +36,7 @@ export declare function loggedInContext(context: AuthenticationContext): Promise
|
|
|
36
36
|
*
|
|
37
37
|
* @param context
|
|
38
38
|
*/
|
|
39
|
-
export declare function
|
|
39
|
+
export declare function ensureLoadedPreferences(context: AuthenticationContext): Promise<AuthenticationContext>;
|
|
40
40
|
/**
|
|
41
41
|
* Logs the user in and loads their WebID profile document into the store
|
|
42
42
|
*
|
|
@@ -44,7 +44,7 @@ export declare function logInLoadPreferences(context: AuthenticationContext): Pr
|
|
|
44
44
|
*
|
|
45
45
|
* @returns Resolves with the context after login / fetch
|
|
46
46
|
*/
|
|
47
|
-
export declare function
|
|
47
|
+
export declare function ensureLoadedProfile(context: AuthenticationContext): Promise<AuthenticationContext>;
|
|
48
48
|
/**
|
|
49
49
|
* Returns promise of context with arrays of symbols
|
|
50
50
|
*
|
package/lib/login/login.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAA6B,SAAS,EAAiB,MAAM,QAAQ,CAAA;AAG5E,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAgN,MAAM,aAAa,CAAA;AAS7Q;;;;IAII;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAA6B,SAAS,EAAiB,MAAM,QAAQ,CAAA;AAG5E,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAgN,MAAM,aAAa,CAAA;AAS7Q;;;;IAII;AAEJ,wBAAgB,cAAc,CAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwB9F;AAED;;;;;;;GAOG;AAEH,wBAAsB,uBAAuB,CAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CA2D7G;AAED;;;;;;GAMG;AAEH,wBAAsB,mBAAmB,CAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAmBzG;AAED;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,MAAM,KAAK,IAAI,GAC5D,WAAW,CAeb;AACD;;;GAGG;AACH,wBAAsB,YAAY,IAAK,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAe/D;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAE,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAGxG"}
|
package/lib/login/login.js
CHANGED
|
@@ -7,12 +7,12 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
+
exports.ensureLoadedPreferences = ensureLoadedPreferences;
|
|
11
|
+
exports.ensureLoadedProfile = ensureLoadedProfile;
|
|
12
|
+
exports.ensureLoggedIn = ensureLoggedIn;
|
|
10
13
|
exports.filterAvailablePanes = filterAvailablePanes;
|
|
11
14
|
exports.findAppInstances = findAppInstances;
|
|
12
15
|
exports.getUserRoles = getUserRoles;
|
|
13
|
-
exports.logInLoadPreferences = logInLoadPreferences;
|
|
14
|
-
exports.logInLoadProfile = logInLoadProfile;
|
|
15
|
-
exports.loggedInContext = loggedInContext;
|
|
16
16
|
exports.loginStatusBox = loginStatusBox;
|
|
17
17
|
exports.newAppInstance = newAppInstance;
|
|
18
18
|
exports.registrationControl = registrationControl;
|
|
@@ -73,7 +73,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
73
73
|
*
|
|
74
74
|
* @param context
|
|
75
75
|
*/
|
|
76
|
-
|
|
76
|
+
// used to be logIn
|
|
77
|
+
function ensureLoggedIn(context) {
|
|
77
78
|
var me = _solidLogic.authn.currentUser();
|
|
78
79
|
|
|
79
80
|
if (me) {
|
|
@@ -111,10 +112,11 @@ function loggedInContext(context) {
|
|
|
111
112
|
*
|
|
112
113
|
* @param context
|
|
113
114
|
*/
|
|
115
|
+
// used to be logInLoadPreferences
|
|
114
116
|
|
|
115
117
|
|
|
116
|
-
function
|
|
117
|
-
return
|
|
118
|
+
function ensureLoadedPreferences(_x2) {
|
|
119
|
+
return _ensureLoadedPreferences.apply(this, arguments);
|
|
118
120
|
}
|
|
119
121
|
/**
|
|
120
122
|
* Logs the user in and loads their WebID profile document into the store
|
|
@@ -123,17 +125,18 @@ function logInLoadPreferences(_x2) {
|
|
|
123
125
|
*
|
|
124
126
|
* @returns Resolves with the context after login / fetch
|
|
125
127
|
*/
|
|
128
|
+
// used to be logInLoadProfile
|
|
126
129
|
|
|
127
130
|
|
|
128
|
-
function
|
|
129
|
-
|
|
131
|
+
function _ensureLoadedPreferences() {
|
|
132
|
+
_ensureLoadedPreferences = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(context) {
|
|
130
133
|
var statusArea, progressDisplay, complain, preferencesFile, m2;
|
|
131
134
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
132
135
|
while (1) {
|
|
133
136
|
switch (_context4.prev = _context4.next) {
|
|
134
137
|
case 0:
|
|
135
138
|
complain = function _complain(message) {
|
|
136
|
-
message = "
|
|
139
|
+
message = "ensureLoadedPreferences: ".concat(message);
|
|
137
140
|
|
|
138
141
|
if (statusArea) {
|
|
139
142
|
// statusArea.innerHTML = ''
|
|
@@ -155,7 +158,7 @@ function _logInLoadPreferences() {
|
|
|
155
158
|
statusArea = context.statusArea || context.div || null;
|
|
156
159
|
_context4.prev = 4;
|
|
157
160
|
_context4.next = 7;
|
|
158
|
-
return
|
|
161
|
+
return ensureLoadedProfile(context);
|
|
159
162
|
|
|
160
163
|
case 7:
|
|
161
164
|
context = _context4.sent;
|
|
@@ -256,11 +259,11 @@ function _logInLoadPreferences() {
|
|
|
256
259
|
}
|
|
257
260
|
}, _callee4, null, [[4, 15]]);
|
|
258
261
|
}));
|
|
259
|
-
return
|
|
262
|
+
return _ensureLoadedPreferences.apply(this, arguments);
|
|
260
263
|
}
|
|
261
264
|
|
|
262
|
-
function
|
|
263
|
-
return
|
|
265
|
+
function ensureLoadedProfile(_x3) {
|
|
266
|
+
return _ensureLoadedProfile.apply(this, arguments);
|
|
264
267
|
}
|
|
265
268
|
/**
|
|
266
269
|
* Returns promise of context with arrays of symbols
|
|
@@ -270,8 +273,8 @@ function logInLoadProfile(_x3) {
|
|
|
270
273
|
*/
|
|
271
274
|
|
|
272
275
|
|
|
273
|
-
function
|
|
274
|
-
|
|
276
|
+
function _ensureLoadedProfile() {
|
|
277
|
+
_ensureLoadedProfile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(context) {
|
|
275
278
|
var logInContext;
|
|
276
279
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
277
280
|
while (1) {
|
|
@@ -287,7 +290,7 @@ function _logInLoadProfile() {
|
|
|
287
290
|
case 2:
|
|
288
291
|
_context5.prev = 2;
|
|
289
292
|
_context5.next = 5;
|
|
290
|
-
return
|
|
293
|
+
return ensureLoggedIn(context);
|
|
291
294
|
|
|
292
295
|
case 5:
|
|
293
296
|
logInContext = _context5.sent;
|
|
@@ -328,7 +331,7 @@ function _logInLoadProfile() {
|
|
|
328
331
|
}
|
|
329
332
|
}, _callee5, null, [[2, 13]]);
|
|
330
333
|
}));
|
|
331
|
-
return
|
|
334
|
+
return _ensureLoadedProfile.apply(this, arguments);
|
|
332
335
|
}
|
|
333
336
|
|
|
334
337
|
function findAppInstances(_x4, _x5, _x6) {
|
|
@@ -368,7 +371,7 @@ function _findAppInstances() {
|
|
|
368
371
|
case 7:
|
|
369
372
|
_context6.prev = 7;
|
|
370
373
|
_context6.next = 10;
|
|
371
|
-
return isPublic ?
|
|
374
|
+
return isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context);
|
|
372
375
|
|
|
373
376
|
case 10:
|
|
374
377
|
_context6.next = 15;
|
|
@@ -1268,7 +1271,7 @@ function selectWorkspace(dom, appDetails, callbackWS) {
|
|
|
1268
1271
|
// console.log('kicking off async operation')
|
|
1269
1272
|
|
|
1270
1273
|
|
|
1271
|
-
|
|
1274
|
+
ensureLoadedPreferences(context) // kick off async operation
|
|
1272
1275
|
.then(displayOptions)["catch"](function (err) {
|
|
1273
1276
|
// console.log("err from async op")
|
|
1274
1277
|
box.appendChild(widgets.errorMessageBlock(context.dom, err));
|
|
@@ -1327,7 +1330,7 @@ function getUserRoles() {
|
|
|
1327
1330
|
|
|
1328
1331
|
function _getUserRoles() {
|
|
1329
1332
|
_getUserRoles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
1330
|
-
var _yield$
|
|
1333
|
+
var _yield$ensureLoadedPr, me, preferencesFile, preferencesFileError;
|
|
1331
1334
|
|
|
1332
1335
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
1333
1336
|
while (1) {
|
|
@@ -1335,13 +1338,13 @@ function _getUserRoles() {
|
|
|
1335
1338
|
case 0:
|
|
1336
1339
|
_context7.prev = 0;
|
|
1337
1340
|
_context7.next = 3;
|
|
1338
|
-
return
|
|
1341
|
+
return ensureLoadedPreferences({});
|
|
1339
1342
|
|
|
1340
1343
|
case 3:
|
|
1341
|
-
_yield$
|
|
1342
|
-
me = _yield$
|
|
1343
|
-
preferencesFile = _yield$
|
|
1344
|
-
preferencesFileError = _yield$
|
|
1344
|
+
_yield$ensureLoadedPr = _context7.sent;
|
|
1345
|
+
me = _yield$ensureLoadedPr.me;
|
|
1346
|
+
preferencesFile = _yield$ensureLoadedPr.preferencesFile;
|
|
1347
|
+
preferencesFileError = _yield$ensureLoadedPr.preferencesFileError;
|
|
1345
1348
|
|
|
1346
1349
|
if (!(!preferencesFile || preferencesFileError)) {
|
|
1347
1350
|
_context7.next = 9;
|