solid-ui 2.4.23 → 2.4.24

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 (136) hide show
  1. package/dist/main.js +2159 -5039
  2. package/dist/main.js.map +1 -1
  3. package/lib/acl/access-controller.js +4 -67
  4. package/lib/acl/access-controller.js.map +1 -1
  5. package/lib/acl/access-groups.js +59 -137
  6. package/lib/acl/access-groups.js.map +1 -1
  7. package/lib/acl/acl-control.js +14 -54
  8. package/lib/acl/acl-control.js.map +1 -1
  9. package/lib/acl/acl.js +32 -107
  10. package/lib/acl/acl.js.map +1 -1
  11. package/lib/acl/add-agent-buttons.js +0 -92
  12. package/lib/acl/add-agent-buttons.js.map +1 -1
  13. package/lib/acl/index.js +1 -3
  14. package/lib/acl/index.js.map +1 -1
  15. package/lib/acl/styles.js +1 -2
  16. package/lib/acl/styles.js.map +1 -1
  17. package/lib/chat/bookmarks.js +8 -80
  18. package/lib/chat/bookmarks.js.map +1 -1
  19. package/lib/chat/chatLogic.js +109 -180
  20. package/lib/chat/chatLogic.js.map +1 -1
  21. package/lib/chat/dateFolder.js +6 -91
  22. package/lib/chat/dateFolder.js.map +1 -1
  23. package/lib/chat/infinite.js +33 -185
  24. package/lib/chat/infinite.js.map +1 -1
  25. package/lib/chat/message.js +37 -150
  26. package/lib/chat/message.js.map +1 -1
  27. package/lib/chat/messageTools.js +23 -96
  28. package/lib/chat/messageTools.js.map +1 -1
  29. package/lib/chat/thread.js +33 -91
  30. package/lib/chat/thread.js.map +1 -1
  31. package/lib/create/create.js +19 -51
  32. package/lib/create/create.js.map +1 -1
  33. package/lib/create/index.js +0 -2
  34. package/lib/create/index.js.map +1 -1
  35. package/lib/debug.js +0 -8
  36. package/lib/debug.js.map +1 -1
  37. package/lib/folders.js +4 -27
  38. package/lib/folders.js.map +1 -1
  39. package/lib/footer/index.js +2 -24
  40. package/lib/footer/index.js.map +1 -1
  41. package/lib/footer/styleMap.js.map +1 -1
  42. package/lib/header/empty-profile.js.map +1 -1
  43. package/lib/header/index.js +3 -72
  44. package/lib/header/index.js.map +1 -1
  45. package/lib/header/styleMap.js +4 -3
  46. package/lib/header/styleMap.js.map +1 -1
  47. package/lib/iconBase.js +3 -4
  48. package/lib/iconBase.js.map +1 -1
  49. package/lib/index.js +5 -46
  50. package/lib/index.js.map +1 -1
  51. package/lib/jss/index.js +3 -9
  52. package/lib/jss/index.js.map +1 -1
  53. package/lib/log.js +15 -51
  54. package/lib/log.js.map +1 -1
  55. package/lib/login/login.js +74 -303
  56. package/lib/login/login.js.map +1 -1
  57. package/lib/matrix/index.js +0 -2
  58. package/lib/matrix/index.js.map +1 -1
  59. package/lib/matrix/matrix.js +7 -55
  60. package/lib/matrix/matrix.js.map +1 -1
  61. package/lib/media/index.js +0 -2
  62. package/lib/media/index.js.map +1 -1
  63. package/lib/media/media-capture.js +13 -33
  64. package/lib/media/media-capture.js.map +1 -1
  65. package/lib/messageArea.js +23 -64
  66. package/lib/messageArea.js.map +1 -1
  67. package/lib/noun_Camera_1618446_000000.js.map +1 -1
  68. package/lib/ns.js +5 -7
  69. package/lib/ns.js.map +1 -1
  70. package/lib/pad.js +48 -234
  71. package/lib/pad.js.map +1 -1
  72. package/lib/participation.js +10 -65
  73. package/lib/participation.js.map +1 -1
  74. package/lib/preferences.js +21 -42
  75. package/lib/preferences.js.map +1 -1
  76. package/lib/signup/config-default.js +1 -8
  77. package/lib/signup/config-default.js.map +1 -1
  78. package/lib/signup/signup.js +6 -13
  79. package/lib/signup/signup.js.map +1 -1
  80. package/lib/stories/decorators.js +0 -2
  81. package/lib/stories/decorators.js.map +1 -1
  82. package/lib/style.js +8 -5
  83. package/lib/style.js.map +1 -1
  84. package/lib/style_multiSelect.js +1 -5
  85. package/lib/style_multiSelect.js.map +1 -1
  86. package/lib/table.js +309 -322
  87. package/lib/table.js.map +1 -1
  88. package/lib/tabs.js +20 -100
  89. package/lib/tabs.js.map +1 -1
  90. package/lib/utils/headerFooterHelpers.js +4 -52
  91. package/lib/utils/headerFooterHelpers.js.map +1 -1
  92. package/lib/utils/index.js +41 -135
  93. package/lib/utils/index.js.map +1 -1
  94. package/lib/utils/label.js +13 -34
  95. package/lib/utils/label.js.map +1 -1
  96. package/lib/versionInfo.js +4 -4
  97. package/lib/versionInfo.js.map +1 -1
  98. package/lib/widgets/buttons/iconLinks.js +0 -8
  99. package/lib/widgets/buttons/iconLinks.js.map +1 -1
  100. package/lib/widgets/buttons.js +115 -291
  101. package/lib/widgets/buttons.js.map +1 -1
  102. package/lib/widgets/dragAndDrop.js +12 -41
  103. package/lib/widgets/dragAndDrop.js.map +1 -1
  104. package/lib/widgets/error.js +3 -9
  105. package/lib/widgets/error.js.map +1 -1
  106. package/lib/widgets/forms/autocomplete/autocompleteBar.js +8 -71
  107. package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
  108. package/lib/widgets/forms/autocomplete/autocompleteField.js +13 -65
  109. package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
  110. package/lib/widgets/forms/autocomplete/autocompletePicker.js +15 -107
  111. package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
  112. package/lib/widgets/forms/autocomplete/language.js +6 -55
  113. package/lib/widgets/forms/autocomplete/language.js.map +1 -1
  114. package/lib/widgets/forms/autocomplete/publicData.js +12 -131
  115. package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
  116. package/lib/widgets/forms/basic.js +12 -55
  117. package/lib/widgets/forms/basic.js.map +1 -1
  118. package/lib/widgets/forms/comment.js +1 -15
  119. package/lib/widgets/forms/comment.js.map +1 -1
  120. package/lib/widgets/forms/fieldFunction.js +3 -16
  121. package/lib/widgets/forms/fieldFunction.js.map +1 -1
  122. package/lib/widgets/forms/fieldParams.js +0 -12
  123. package/lib/widgets/forms/fieldParams.js.map +1 -1
  124. package/lib/widgets/forms/formStyle.js +1 -14
  125. package/lib/widgets/forms/formStyle.js.map +1 -1
  126. package/lib/widgets/forms.js +70 -474
  127. package/lib/widgets/forms.js.map +1 -1
  128. package/lib/widgets/index.js +0 -21
  129. package/lib/widgets/index.js.map +1 -1
  130. package/lib/widgets/multiSelect.js +48 -171
  131. package/lib/widgets/multiSelect.js.map +1 -1
  132. package/lib/widgets/peoplePicker.js +20 -90
  133. package/lib/widgets/peoplePicker.js.map +1 -1
  134. package/lib/widgets/widgetHelpers.js +2 -9
  135. package/lib/widgets/widgetHelpers.js.map +1 -1
  136. package/package.json +28 -28
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","names":["store","solidLogicSingleton","profile","loadPreferences","loadProfile","typeIndex","getScopedAppInstances","getRegistrations","loadAllTypeIndexes","getScopedAppsFromIndex","deleteTypeIndexRegistration","ensureLoggedIn","context","me","authn","currentUser","saveUser","Promise","resolve","checkUser","then","webId","debug","log","div","dom","box","loginStatusBox","webIdUri","appendChild","ensureLoadedPreferences","complain","message","statusArea","widgets","errorMessageBlock","preferencesFile","ensureLoadedProfile","progressDisplay","parentNode","removeChild","UnauthorizedError","m2","alert","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotEditableError","WebOperationError","FetchError","status","Error","publicProfile","logInContext","findAppInstances","theClass","isPublic","items","filter","item","scope","label","instances","map","instance","scopeLabel","mine","sameTerm","agent","name","utils","registrationControl","registrationStatements","renderScopeCheckbox","statements","index","noun","buildCheckboxForm","form","registrations","reg","length","newThing","st","ns","solid","createElement","innerHTML","scopes","msg","textContent","setAttribute","tbody","children","BlankNode","row","renderScopeHeadingRow","backgroundColor","cell","style","backgoundColor","header","textAlign","registrationList","options","table","firstChild","headingRow","type","display","personTR","deleteFunction","paddingLeft","getDefaultSignInButtonStyle","signInOrSignUpBox","setUserCallback","signInButtonStyle","buttonStyle","magicClassName","signInPopUpButton","authSession","onLogin","webIdURI","uri","divs","getElementsByClassName","i","parent","e","addEventListener","offline","offlineTestID","renderSignInPopup","signupButton","_event","signupMgr","Signup","signup","issuerPopup","body","issuerPopupBox","issuerPopupBoxTopMenu","issuerPopupBoxLabel","innerText","issuerPopupBoxCloseButton","remove","loginToIssuer","issuerUri","preLoginRedirectHash","URL","href","hash","localStorage","setItem","login","redirectUrl","oidcIssuer","issuerTextContainer","issuerTextInputContainer","issuerTextLabel","issuerTextInput","value","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","getSuggestedIssuers","forEach","issuerInfo","issuerButton","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","err","logoutButton","logoutLabel","nick","any","foaf","signOutButton","sessionInfo","info","isLoggedIn","sym","clearElement","trackSession","onLogout","issuer","wellKnownUri","pathname","fetch","toString","wellKnownResult","json","openidConfiguration","end_session_endpoint","credentials","reload","selectWorkspace","appDetails","callbackWS","appPathSegment","say","s","background","figureOutBase","ws","newBaseNode","space","newBaseString","split","slice","now","Date","getTime","displayOptions","makeNewWorkspace","padding","encodeURI","askName","newBase","newWs","newData","updater","update","id","w","each","undefined","storages","concat","ldp","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","holds","rdf","col1","col2","col3","tr","comment","cellStyle","deselectedStyle","anyValue","ui","reduce","a","b","charCodeAt","bgcolor","target","rdfs","disabled","trLast","newAppInstance","callback","gotWS","base","getUserRoles","doc","filterAvailablePanes","panes","userRoles","pane","isMatchingAudience","audience","isMatch","audienceRole","find","role","equals"],"sources":["../../src/login/login.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/**\n * Signing in, signing up, profile and preferences reloading\n * Type index management\n *\n * Many functions in this module take a context object which\n * holds various RDF symbols, add to it, and return a promise of it.\n *\n * * `me` RDF symbol for the user's WebID\n * * `publicProfile` The user's public profile, iff loaded\n * * `preferencesFile` The user's personal preference file, iff loaded\n * * `index.public` The user's public type index file\n * * `index.private` The user's private type index file\n *\n * Not RDF symbols:\n * * `noun` A string in english for the type of thing -- like \"address book\"\n * * `instance` An array of nodes which are existing instances\n * * `containers` An array of nodes of containers of instances\n * * `div` A DOM element where UI can be displayed\n * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages\n * *\n * * Vocabulary: \"load\" loads a file if it exists;\n * * 'Ensure\" CREATES the file if it does not exist (if it can) and then loads it.\n * @packageDocumentation\n */\nimport { PaneDefinition } from 'pane-registry'\nimport { BlankNode, NamedNode, st } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n authn,\n authSession,\n CrossOriginForbiddenError,\n FetchError,\n getSuggestedIssuers,\n NotEditableError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError,\n WebOperationError\n} from 'solid-logic'\nimport * as debug from '../debug'\nimport { alert } from '../log'\nimport * as ns from '../ns.js'\nimport { Signup } from '../signup/signup.js'\nimport { buttonStyle, commentStyle, textInputStyle } from '../style'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\n\nconst store = solidLogicSingleton.store\n\nconst {\n loadPreferences,\n loadProfile\n} = solidLogicSingleton.profile\n\nconst {\n getScopedAppInstances,\n getRegistrations,\n loadAllTypeIndexes,\n getScopedAppsFromIndex,\n deleteTypeIndexRegistration\n} = solidLogicSingleton.typeIndex\n\n/**\n * Resolves with the logged in user's WebID\n *\n * @param context\n */\n// used to be logIn\nexport function ensureLoggedIn (context: AuthenticationContext): Promise<AuthenticationContext> {\n const me = authn.currentUser()\n if (me) {\n authn.saveUser(me, context)\n return Promise.resolve(context)\n }\n\n return new Promise((resolve) => {\n authn.checkUser().then((webId) => {\n // Already logged in?\n if (webId) {\n debug.log(`logIn: Already logged in as ${webId}`)\n return resolve(context)\n }\n if (!context.div || !context.dom) {\n return resolve(context)\n }\n const box = loginStatusBox(context.dom, (webIdUri) => {\n authn.saveUser(webIdUri, context)\n resolve(context) // always pass growing context\n })\n context.div.appendChild(box)\n })\n })\n}\n\n/**\n * Loads preference file\n * Do this after having done log in and load profile\n *\n * @private\n *\n * @param context\n */\n// used to be logInLoadPreferences\nexport async function ensureLoadedPreferences (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.preferencesFile) return Promise.resolve(context) // already done\n\n const statusArea = context.statusArea || context.div || null\n let progressDisplay\n function complain (message) {\n message = `ensureLoadedPreferences: ${message}`\n if (statusArea) {\n // statusArea.innerHTML = ''\n statusArea.appendChild(widgets.errorMessageBlock(context.dom, message))\n }\n debug.log(message)\n // reject(new Error(message))\n }\n try {\n context = await ensureLoadedProfile(context)\n\n // console.log('back in Solid UI after logInLoadProfile', context)\n const preferencesFile = await loadPreferences(context.me as NamedNode)\n if (progressDisplay) {\n progressDisplay.parentNode.removeChild(progressDisplay)\n }\n context.preferencesFile = preferencesFile\n } catch (err) {\n let m2: string\n if (err instanceof UnauthorizedError) {\n m2 =\n 'Ooops - you are not authenticated (properly logged in) to for me to read your preference file. Try loggin out and logging in?'\n alert(m2)\n } else if (err instanceof CrossOriginForbiddenError) {\n m2 = `Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`\n context.preferencesFileError = m2\n return context\n } else if (err instanceof SameOriginForbiddenError) {\n m2 =\n 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof NotEditableError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof WebOperationError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n } else if (err instanceof FetchError) {\n m2 = `Strange: Error ${err.status} trying to read your preference file.${err.message}`\n alert(m2)\n } else {\n throw new Error(`(via loadPrefs) ${err}`)\n }\n }\n return context\n}\n\n/**\n * Logs the user in and loads their WebID profile document into the store\n *\n * @param context\n *\n * @returns Resolves with the context after login / fetch\n */\n// used to be logInLoadProfile\nexport async function ensureLoadedProfile (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.publicProfile) {\n return context\n } // already done\n try {\n const logInContext = await ensureLoggedIn(context)\n if (!logInContext.me) {\n throw new Error('Could not log in')\n }\n context.publicProfile = await loadProfile(logInContext.me)\n } catch (err) {\n if (context.div && context.dom) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, err.message))\n }\n throw new Error(`Can't log in: ${err}`)\n }\n return context\n}\n\n/**\n * Returns promise of context with arrays of symbols\n *\n * leaving the `isPublic` param undefined will bring in community index things, too\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n let items = context.me ? await getScopedAppInstances(theClass, context.me) : []\n if (isPublic === true) { // old API - not recommended!\n items = items.filter(item => item.scope.label === 'public')\n } else if (isPublic === false) {\n items = items.filter(item => item.scope.label === 'private')\n }\n context.instances = items.map(item => item.instance)\n return context\n}\n\nexport function scopeLabel (context, scope) {\n const mine = context.me && context.me.sameTerm(scope.agent)\n const name = mine ? '' : utils.label(scope.agent) + ' '\n return `${name}${scope.label}`\n}\n/**\n * UI to control registration of instance\n */\nexport async function registrationControl (\n context: AuthenticationContext,\n instance,\n theClass\n): Promise<AuthenticationContext | void> {\n function registrationStatements (index) {\n const registrations = getRegistrations(instance, theClass)\n const reg = registrations.length ? registrations[0] : widgets.newThing(index)\n return [\n st(reg, ns.solid('instance'), instance, index),\n st(reg, ns.solid('forClass'), theClass, index)\n ]\n }\n\n function renderScopeCheckbox (scope) {\n const statements = registrationStatements(scope.index)\n const name = scopeLabel(context, scope)\n const label = `${name} link to this ${context.noun}`\n return widgets.buildCheckboxForm(\n context.dom,\n solidLogicSingleton.store,\n label,\n null,\n statements,\n form,\n scope.index\n )\n }\n /// / body of registrationControl\n const dom = context.dom\n if (!dom || !context.div) {\n throw new Error('registrationControl: need dom and div')\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n const me = context.me\n if (!me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let scopes // @@ const\n try {\n scopes = await loadAllTypeIndexes(me)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Lists of stuff not available)'\n context.div.appendChild(dom.createElement('p')).textContent = msg\n } else if (context.div) {\n msg = `registrationControl: Type indexes not available: ${e}`\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n return context\n }\n\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;')\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n for (const scope of scopes) {\n const row = tbody.appendChild(dom.createElement('tr'))\n row.appendChild(renderScopeCheckbox(scope)) // @@ index\n }\n return context\n}\n\nexport function renderScopeHeadingRow (context, store, scope) {\n const backgroundColor = { private: '#fee', public: '#efe' }\n const { dom } = context\n const name = scopeLabel(context, scope)\n const row = dom.createElement('tr')\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.backgoundColor = backgroundColor[scope.label] || 'white'\n const header = cell.appendChild(dom.createElement('h3'))\n header.textContent = name + ' links'\n header.style.textAlign = 'left'\n return row\n}\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (context: AuthenticationContext, options: {\n private?: boolean\n public?: boolean\n type?: NamedNode\n}): Promise<AuthenticationContext> {\n const dom = context.dom as HTMLDocument\n const div = context.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context\n }\n\n const scopes = await loadAllTypeIndexes(context.me) // includes community indexes\n\n // console.log('@@ registrationList ', scopes)\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;')\n const table = box.firstChild as HTMLElement\n const tbody = table.firstChild as HTMLElement\n\n for (const scope of scopes) { // need some predicate for listing/adding agents\n const headingRow = renderScopeHeadingRow(context, store, scope)\n tbody.appendChild(headingRow)\n const items = await getScopedAppsFromIndex(scope, options.type || null) // any class\n if (items.length === 0) headingRow.style.display = 'none'\n // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)\n for (const item of items) {\n const row = widgets.personTR(dom, ns.solid('instance'), item.instance, {\n deleteFunction: async () => {\n await deleteTypeIndexRegistration(item)\n tbody.removeChild(row)\n }\n })\n row.children[0].style.paddingLeft = '3em'\n\n tbody.appendChild(row)\n }\n }\n return context\n} // registrationList\n\nfunction getDefaultSignInButtonStyle (): string {\n return 'padding: 1em; border-radius:0.5em; font-size: 100%;'\n}\n\n/**\n * Bootstrapping identity\n * (Called by `loginStatusBox()`)\n *\n * @param dom\n * @param setUserCallback\n *\n * @returns\n */\nfunction signInOrSignUpBox (\n dom: HTMLDocument,\n setUserCallback: (user: string) => void,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n options = options || {}\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n\n // @@ TODO Remove the need to cast HTML element to any\n const box: any = dom.createElement('div')\n const magicClassName = 'SolidSignInOrSignUpBox'\n debug.log('widgets.signInOrSignUpBox')\n box.setUserCallback = setUserCallback\n box.setAttribute('class', magicClassName);\n (box as any).style = 'display:flex;' // @@ fix all typecasts like this\n\n // Sign in button with PopUP\n const signInPopUpButton = dom.createElement('input') // multi\n box.appendChild(signInPopUpButton)\n signInPopUpButton.setAttribute('type', 'button')\n signInPopUpButton.setAttribute('value', 'Log in')\n signInPopUpButton.setAttribute('style', `${signInButtonStyle}background-color: #eef;`)\n\n authSession.onLogin(() => {\n const me = authn.currentUser()\n // const sessionInfo = authSession.info\n // if (sessionInfo && sessionInfo.isLoggedIn) {\n if (me) {\n // const webIdURI = sessionInfo.webId\n const webIdURI = me.uri\n // setUserCallback(webIdURI)\n const divs = dom.getElementsByClassName(magicClassName)\n debug.log(`Logged in, ${divs.length} panels to be serviced`)\n // At the same time, satisfy all the other login boxes\n for (let i = 0; i < divs.length; i++) {\n const div: any = divs[i]\n // @@ TODO Remove the need to manipulate HTML elements\n if (div.setUserCallback) {\n try {\n div.setUserCallback(webIdURI)\n const parent = div.parentNode\n if (parent) {\n parent.removeChild(div)\n }\n } catch (e) {\n debug.log(`## Error satisfying login box: ${e}`)\n div.appendChild(widgets.errorMessageBlock(dom, e))\n }\n }\n }\n }\n })\n\n signInPopUpButton.addEventListener(\n 'click',\n () => {\n const offline = offlineTestID()\n if (offline) return setUserCallback(offline.uri)\n\n renderSignInPopup(dom)\n },\n false\n )\n\n // Sign up button\n const signupButton = dom.createElement('input')\n box.appendChild(signupButton)\n signupButton.setAttribute('type', 'button')\n signupButton.setAttribute('value', 'Sign Up for Solid')\n signupButton.setAttribute('style', `${signInButtonStyle}background-color: #efe;`)\n\n signupButton.addEventListener(\n 'click',\n function (_event) {\n const signupMgr = new Signup()\n signupMgr.signup().then(function (uri) {\n debug.log('signInOrSignUpBox signed up ' + uri)\n setUserCallback(uri)\n })\n },\n false\n )\n return box\n}\n\nexport function renderSignInPopup (dom: HTMLDocument) {\n /**\n * Issuer Menu\n */\n const issuerPopup = dom.createElement('div')\n issuerPopup.setAttribute(\n 'style',\n 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;'\n )\n dom.body.appendChild(issuerPopup)\n const issuerPopupBox = dom.createElement('div')\n issuerPopupBox.setAttribute(\n 'style',\n `\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n `\n )\n issuerPopup.appendChild(issuerPopupBox)\n const issuerPopupBoxTopMenu = dom.createElement('div')\n issuerPopupBoxTopMenu.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n `\n )\n issuerPopupBox.appendChild(issuerPopupBoxTopMenu)\n const issuerPopupBoxLabel = dom.createElement('label')\n issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800')\n issuerPopupBoxLabel.innerText = 'Select an identity provider'\n const issuerPopupBoxCloseButton = dom.createElement('button')\n issuerPopupBoxCloseButton.innerHTML =\n '<img src=\"https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg\" style=\"width: 2em; height: 2em;\" title=\"Cancel\">'\n issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;')\n issuerPopupBoxCloseButton.addEventListener('click', () => {\n issuerPopup.remove()\n })\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxLabel)\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton)\n\n const loginToIssuer = async (issuerUri: string) => {\n try {\n // Save hash\n const preLoginRedirectHash = new URL(window.location.href).hash\n if (preLoginRedirectHash) {\n window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash)\n }\n window.localStorage.setItem('loginIssuer', issuerUri)\n // Login\n await authSession.login({\n redirectUrl: window.location.href,\n oidcIssuer: issuerUri\n })\n } catch (err) {\n alert(err.message)\n }\n }\n\n /**\n * Text-based idp selection\n */\n const issuerTextContainer = dom.createElement('div')\n issuerTextContainer.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerTextInputContainer = dom.createElement('div')\n issuerTextInputContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: row;\n `\n )\n const issuerTextLabel = dom.createElement('label')\n issuerTextLabel.innerText = 'Enter the URL of your identity provider:'\n issuerTextLabel.setAttribute('style', 'color: #888')\n const issuerTextInput = dom.createElement('input')\n issuerTextInput.setAttribute('type', 'text')\n issuerTextInput.setAttribute(\n 'style',\n 'margin-left: 0 !important; flex: 1; margin-right: 5px !important'\n )\n issuerTextInput.setAttribute('placeholder', 'https://example.com')\n issuerTextInput.value = localStorage.getItem('loginIssuer') || ''\n const issuerTextGoButton = dom.createElement('button')\n issuerTextGoButton.innerText = 'Go'\n issuerTextGoButton.setAttribute('style', 'margin-top: 12px; margin-bottom: 12px;')\n issuerTextGoButton.addEventListener('click', () => {\n loginToIssuer(issuerTextInput.value)\n })\n issuerTextContainer.appendChild(issuerTextLabel)\n issuerTextInputContainer.appendChild(issuerTextInput)\n issuerTextInputContainer.appendChild(issuerTextGoButton)\n issuerTextContainer.appendChild(issuerTextInputContainer)\n issuerPopupBox.appendChild(issuerTextContainer)\n\n /**\n * Button-based idp selection\n */\n const issuerButtonContainer = dom.createElement('div')\n issuerButtonContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerBottonLabel = dom.createElement('label')\n issuerBottonLabel.innerText = 'Or pick an identity provider from the list below:'\n issuerBottonLabel.setAttribute('style', 'color: #888')\n issuerButtonContainer.appendChild(issuerBottonLabel)\n getSuggestedIssuers().forEach((issuerInfo) => {\n const issuerButton = dom.createElement('button')\n issuerButton.innerText = issuerInfo.name\n issuerButton.setAttribute('style', 'height: 38px; margin-top: 10px')\n issuerButton.addEventListener('click', () => {\n loginToIssuer(issuerInfo.uri)\n })\n issuerButtonContainer.appendChild(issuerButton)\n })\n issuerPopupBox.appendChild(issuerButtonContainer)\n}\n\n/**\n * Login status box\n *\n * A big sign-up/sign in box or a logout box depending on the state\n *\n * @param dom\n * @param listener\n *\n * @returns\n */\nexport function loginStatusBox (\n dom: HTMLDocument,\n listener: ((uri: string | null) => void) | null = null,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n // 20190630\n let me = offlineTestID()\n // @@ TODO Remove the need to cast HTML element to any\n const box: any = dom.createElement('div')\n\n function setIt (newidURI) {\n if (!newidURI) {\n return\n }\n\n // const uri = newidURI.uri || newidURI\n // me = sym(uri)\n me = authn.saveUser(newidURI)\n box.refresh()\n if (listener) listener(me!.uri)\n }\n\n function logoutButtonHandler (_event) {\n const oldMe = me\n authSession.logout().then(\n function () {\n const message = `Your WebID was ${oldMe}. It has been forgotten.`\n me = null\n try {\n alert(message)\n } catch (e) {\n window.alert(message)\n }\n box.refresh()\n if (listener) listener(null)\n },\n (err) => {\n alert('Fail to log out:' + err)\n }\n )\n }\n\n function logoutButton (me, options) {\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n let logoutLabel = 'WebID logout'\n if (me) {\n const nick =\n solidLogicSingleton.store.any(me, ns.foaf('nick')) ||\n solidLogicSingleton.store.any(me, ns.foaf('name'))\n if (nick) {\n logoutLabel = 'Logout ' + nick.value\n }\n }\n const signOutButton = dom.createElement('input')\n // signOutButton.className = 'WebIDCancelButton'\n signOutButton.setAttribute('type', 'button')\n signOutButton.setAttribute('value', logoutLabel)\n signOutButton.setAttribute('style', `${signInButtonStyle}background-color: #eee;`)\n signOutButton.addEventListener('click', logoutButtonHandler, false)\n return signOutButton\n }\n\n box.refresh = function () {\n const sessionInfo = authSession.info\n if (sessionInfo && sessionInfo.webId && sessionInfo.isLoggedIn) {\n me = solidLogicSingleton.store.sym(sessionInfo.webId)\n } else {\n me = null\n }\n if ((me && box.me !== me.uri) || (!me && box.me)) {\n widgets.clearElement(box)\n if (me) {\n box.appendChild(logoutButton(me, options))\n } else {\n box.appendChild(signInOrSignUpBox(dom, setIt, options))\n }\n }\n box.me = me ? me.uri : null\n }\n box.refresh()\n\n function trackSession () {\n me = authn.currentUser()\n box.refresh()\n }\n trackSession()\n\n authSession.onLogin(trackSession)\n authSession.onLogout(trackSession)\n box.me = '99999' // Force refresh\n box.refresh()\n return box\n}\n\nauthSession.onLogout(async () => {\n const issuer = window.localStorage.getItem('loginIssuer')\n if (issuer) {\n try {\n const wellKnownUri = new URL(issuer)\n wellKnownUri.pathname = '/.well-known/openid-configuration'\n const wellKnownResult = await fetch(wellKnownUri.toString())\n if (wellKnownResult.status === 200) {\n const openidConfiguration = await wellKnownResult.json()\n if (openidConfiguration && openidConfiguration.end_session_endpoint) {\n await fetch(openidConfiguration.end_session_endpoint, { credentials: 'include' })\n }\n }\n } catch (err) {\n // Do nothing\n }\n }\n window.location.reload()\n})\n\n/**\n * Workspace selection etc\n * See https://github.com/solidos/userguide/issues/16\n */\n\n/**\n * Returns a UI object which, if it selects a workspace,\n * will callback(workspace, newBase).\n * See https://github.com/solidos/userguide/issues/16 for more info on workspaces.\n *\n * If necessary, will get an account, preference file, etc. In sequence:\n *\n * - If not logged in, log in.\n * - Load preference file\n * - Prompt user for workspaces\n * - Allows the user to just type in a URI by hand\n *\n * Calls back with the workspace and the base URI\n *\n * @param dom\n * @param appDetails\n * @param callbackWS\n */\nexport function selectWorkspace (\n dom: HTMLDocument,\n appDetails: AppDetails,\n callbackWS: (workspace: string | null, newBase: string) => void\n): HTMLElement {\n const noun = appDetails.noun\n const appPathSegment = appDetails.appPathSegment\n\n const me = offlineTestID()\n const box = dom.createElement('div')\n const context: AuthenticationContext = { me, dom, div: box }\n\n function say (s, background) {\n box.appendChild(widgets.errorMessageBlock(dom, s, background))\n }\n\n function figureOutBase (ws) {\n const newBaseNode: NamedNode = solidLogicSingleton.store.any(\n ws,\n ns.space('uriPrefix')\n ) as NamedNode\n let newBaseString: string\n if (!newBaseNode) {\n newBaseString = ws.uri.split('#')[0]\n } else {\n newBaseString = newBaseNode.value\n }\n if (newBaseString.slice(-1) !== '/') {\n debug.log(`${appPathSegment}: No / at end of uriPrefix ${newBaseString}`) // @@ paramater?\n newBaseString = `${newBaseString}/`\n }\n const now = new Date()\n newBaseString += `${appPathSegment}/id${now.getTime()}/` // unique id\n return newBaseString\n }\n\n function displayOptions (context) {\n // console.log('displayOptions!', context)\n async function makeNewWorkspace (_event) {\n const row = table.appendChild(dom.createElement('tr'))\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.padding = '0.5em'\n const newBase = encodeURI(\n await widgets.askName(\n dom,\n solidLogicSingleton.store,\n cell,\n ns.solid('URL'),\n ns.space('Workspace'),\n 'Workspace'\n )\n )\n const newWs = widgets.newThing(context.preferencesFile)\n const newData = [\n st(context.me, ns.space('workspace'), newWs, context.preferencesFile),\n // eslint-disable-next-line camelcase\n st(\n newWs,\n ns.space('uriPrefix'),\n newBase as unknown as Quad_Object,\n context.preferencesFile\n )\n ]\n if (!solidLogicSingleton.store.updater) {\n throw new Error('store has no updater')\n }\n await solidLogicSingleton.store.updater.update([], newData)\n // @@ now refresh list of workspaces\n }\n\n // const status = ''\n const id = context.me\n const preferencesFile = context.preferencesFile\n let newBase: any = null\n\n // A workspace specifically defined in the private preference file:\n let w: any = solidLogicSingleton.store.each(\n id,\n ns.space('workspace'),\n undefined,\n preferencesFile\n ) // Only trust preference file here\n\n // A workspace in a storage in the public profile:\n const storages = solidLogicSingleton.store.each(id, ns.space('storage')) // @@ No provenance requirement at the moment\n if (w.length === 0 && storages) {\n say(\n `You don't seem to have any workspaces. You have ${storages.length} storage spaces.`,\n 'white'\n )\n storages\n .map(function (s: any) {\n w = w.concat(solidLogicSingleton.store.each(s, ns.ldp('contains')))\n return w\n })\n .filter((file) => {\n return file.id ? ['public', 'private'].includes(file.id().toLowerCase()) : ''\n })\n }\n\n if (w.length === 1) {\n say(`Workspace used: ${w[0].uri}`, 'white') // @@ allow user to see URI\n newBase = figureOutBase(w[0])\n // callbackWS(w[0], newBase)\n // } else if (w.length === 0) {\n }\n\n // Prompt for ws selection or creation\n // say( w.length + \" workspaces for \" + id + \"Choose one.\");\n const table = dom.createElement('table')\n table.setAttribute('style', 'border-collapse:separate; border-spacing: 0.5em;')\n\n // const popup = window.open(undefined, '_blank', { height: 300, width:400 }, false)\n box.appendChild(table)\n\n // Add a field for directly adding the URI yourself\n\n // const hr = box.appendChild(dom.createElement('hr')) // @@\n box.appendChild(dom.createElement('hr')) // @@\n\n const p = box.appendChild(dom.createElement('p'));\n (p as any).style = commentStyle\n p.textContent = `Where would you like to store the data for the ${noun}?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea.`\n // @@ TODO Remove the need to cast baseField to any\n const baseField: any = box.appendChild(dom.createElement('input'))\n baseField.setAttribute('type', 'text');\n (baseField as any).style = textInputStyle\n baseField.size = 80 // really a string\n baseField.label = 'base URL'\n baseField.autocomplete = 'on'\n if (newBase) {\n // set to default\n baseField.value = newBase\n }\n\n context.baseField = baseField\n\n box.appendChild(dom.createElement('br')) // @@\n\n const button = box.appendChild(dom.createElement('button'));\n (button as any).style = buttonStyle\n button.textContent = `Start new ${noun} at this URI`\n button.addEventListener('click', function (_event) {\n let newBase = baseField.value.replace(' ', '%20') // do not re-encode in general, as % encodings may exist\n if (newBase.slice(-1) !== '/') {\n newBase += '/'\n }\n callbackWS(null, newBase)\n })\n\n // Now go set up the table of spaces\n\n // const row = 0\n w = w.filter(function (x) {\n return !solidLogicSingleton.store.holds(\n x,\n ns.rdf('type'), // Ignore master workspaces\n ns.space('MasterWorkspace')\n )\n })\n let col1, col2, col3, tr, ws, style, comment\n const cellStyle = 'height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;'\n const deselectedStyle = `${cellStyle}border: 0px;`\n // const selectedStyle = cellStyle + 'border: 1px solid black;'\n for (let i = 0; i < w.length; i++) {\n ws = w[i]\n tr = dom.createElement('tr')\n if (i === 0) {\n col1 = dom.createElement('td')\n col1.setAttribute('rowspan', `${w.length}`)\n col1.textContent = 'Choose a workspace for this:'\n col1.setAttribute('style', 'vertical-align:middle;')\n tr.appendChild(col1)\n }\n col2 = dom.createElement('td')\n style = solidLogicSingleton.store.anyValue(ws, ns.ui('style'))\n if (!style) {\n // Otherwise make up arbitrary colour\n const hash = function (x) {\n return x.split('').reduce(function (a, b) {\n a = (a << 5) - a + b.charCodeAt(0)\n return a & a\n }, 0)\n }\n const bgcolor = `#${((hash(ws.uri) & 0xffffff) | 0xc0c0c0).toString(16)}` // c0c0c0 forces pale\n style = `color: black ; background-color: ${bgcolor};`\n }\n col2.setAttribute('style', deselectedStyle + style)\n tr.target = ws.uri\n let label = solidLogicSingleton.store.any(ws, ns.rdfs('label'))\n if (!label) {\n label = ws.uri.split('/').slice(-1)[0] || ws.uri.split('/').slice(-2)[0]\n }\n col2.textContent = label || '???'\n tr.appendChild(col2)\n if (i === 0) {\n col3 = dom.createElement('td')\n col3.setAttribute('rowspan', `${w.length}1`)\n // col3.textContent = '@@@@@ remove';\n col3.setAttribute('style', 'width:50%;')\n tr.appendChild(col3)\n }\n table.appendChild(tr)\n\n comment = solidLogicSingleton.store.any(ws, ns.rdfs('comment'))\n comment = comment ? comment.value : 'Use this workspace'\n col2.addEventListener(\n 'click',\n function (_event) {\n col3.textContent = comment ? comment.value : ''\n col3.setAttribute('style', deselectedStyle + style)\n const button = dom.createElement('button')\n button.textContent = 'Continue'\n // button.setAttribute('style', style);\n const newBase = figureOutBase(ws)\n baseField.value = newBase // show user proposed URI\n\n button.addEventListener(\n 'click',\n function (_event) {\n button.disabled = true\n callbackWS(ws, newBase)\n button.textContent = '---->'\n },\n true\n ) // capture vs bubble\n col3.appendChild(button)\n },\n true\n ) // capture vs bubble\n }\n\n // last line with \"Make new workspace\"\n const trLast = dom.createElement('tr')\n col2 = dom.createElement('td')\n col2.setAttribute('style', cellStyle)\n col2.textContent = '+ Make a new workspace'\n col2.addEventListener('click', makeNewWorkspace)\n trLast.appendChild(col2)\n table.appendChild(trLast)\n } // displayOptions\n\n // console.log('kicking off async operation')\n ensureLoadedPreferences(context) // kick off async operation\n .then(displayOptions)\n .catch((err) => {\n // console.log(\"err from async op\")\n box.appendChild(widgets.errorMessageBlock(context.dom, err))\n })\n\n return box // return the box element, while login proceeds\n} // selectWorkspace\n\n/**\n * Creates a new instance of an app.\n *\n * An instance of an app could be e.g. an issue tracker for a given project,\n * or a chess game, or calendar, or a health/fitness record for a person.\n *\n * Note that this use of the term 'app' refers more to entries in the user's\n * type index than to actual software applications that use the personal data\n * to which these entries point.\n *\n * @param dom\n * @param appDetails\n * @param callback\n *\n * @returns A div with a button in it for making a new app instance\n */\nexport function newAppInstance (\n dom: HTMLDocument,\n appDetails: AppDetails,\n callback: (workspace: string | null, newBase: string) => void\n): HTMLElement {\n const gotWS = function (ws, base) {\n // log.debug(\"newAppInstance: Selected workspace = \" + (ws? ws.uri : 'none'))\n callback(ws, base)\n }\n const div = dom.createElement('div')\n const b = dom.createElement('button')\n b.setAttribute('type', 'button')\n div.appendChild(b)\n b.innerHTML = `Make new ${appDetails.noun}`\n b.addEventListener(\n 'click',\n (_event) => {\n div.appendChild(selectWorkspace(dom, appDetails, gotWS))\n },\n false\n )\n div.appendChild(b)\n return div\n}\n/**\n * Retrieves whether the currently logged in user is a power user\n * and/or a developer\n */\nexport async function getUserRoles (): Promise<Array<NamedNode>> {\n try {\n const { me, preferencesFile, preferencesFileError } = await ensureLoadedPreferences({})\n if (!preferencesFile || preferencesFileError) {\n throw new Error(preferencesFileError)\n }\n return solidLogicSingleton.store.each(\n me,\n ns.rdf('type'),\n null,\n preferencesFile.doc()\n ) as NamedNode[]\n } catch (error) {\n debug.warn('Unable to fetch your preferences - this was the error: ', error)\n }\n return []\n}\n\n/**\n * Filters which panes should be available, based on the result of [[getUserRoles]]\n */\nexport async function filterAvailablePanes (\n panes: Array<PaneDefinition>\n): Promise<Array<PaneDefinition>> {\n const userRoles = await getUserRoles()\n return panes.filter((pane) => isMatchingAudience(pane, userRoles))\n}\n\nfunction isMatchingAudience (pane: PaneDefinition, userRoles: Array<NamedNode>): boolean {\n const audience = pane.audience || []\n return audience.reduce(\n (isMatch, audienceRole) => isMatch && !!userRoles.find((role) => role.equals(audienceRole)),\n true as boolean\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;AAGA;;AAeA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;AAEA,IAAMA,KAAK,GAAGC,+BAAA,CAAoBD,KAAlC;AAEA,4BAGIC,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A;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;SAqBeoO,oB;;;;;wGAAf,mBACLC,KADK;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAGmBH,YAAY,EAH/B;;UAAA;YAGCI,SAHD;YAAA,mCAIED,KAAK,CAACzN,MAAN,CAAa,UAAC2N,IAAD;cAAA,OAAUC,kBAAkB,CAACD,IAAD,EAAOD,SAAP,CAA5B;YAAA,CAAb,CAJF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAOP,SAASE,kBAAT,CAA6BD,IAA7B,EAAmDD,SAAnD,EAAyF;EACvF,IAAMG,QAAQ,GAAGF,IAAI,CAACE,QAAL,IAAiB,EAAlC;EACA,OAAOA,QAAQ,CAACpB,MAAT,CACL,UAACqB,OAAD,EAAUC,YAAV;IAAA,OAA2BD,OAAO,IAAI,CAAC,CAACJ,SAAS,CAACM,IAAV,CAAe,UAACC,IAAD;MAAA,OAAUA,IAAI,CAACC,MAAL,CAAYH,YAAZ,CAAV;IAAA,CAAf,CAAxC;EAAA,CADK,EAEL,IAFK,CAAP;AAID"}
1
+ {"version":3,"file":"login.js","names":["store","solidLogicSingleton","profile","loadPreferences","loadProfile","typeIndex","getScopedAppInstances","getRegistrations","loadAllTypeIndexes","getScopedAppsFromIndex","deleteTypeIndexRegistration","ensureLoggedIn","context","me","authn","currentUser","saveUser","Promise","resolve","checkUser","then","webId","debug","log","div","dom","box","loginStatusBox","webIdUri","appendChild","ensureLoadedPreferences","complain","message","statusArea","widgets","errorMessageBlock","preferencesFile","ensureLoadedProfile","progressDisplay","parentNode","removeChild","UnauthorizedError","m2","alert","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotEditableError","WebOperationError","FetchError","status","Error","publicProfile","logInContext","findAppInstances","theClass","isPublic","items","filter","item","scope","label","instances","map","instance","scopeLabel","mine","sameTerm","agent","name","utils","registrationControl","registrationStatements","renderScopeCheckbox","statements","index","noun","buildCheckboxForm","form","registrations","reg","length","newThing","st","ns","solid","createElement","innerHTML","scopes","msg","textContent","setAttribute","tbody","children","BlankNode","row","renderScopeHeadingRow","backgroundColor","cell","style","backgoundColor","header","textAlign","registrationList","options","table","firstChild","headingRow","type","display","personTR","deleteFunction","paddingLeft","getDefaultSignInButtonStyle","signInOrSignUpBox","setUserCallback","signInButtonStyle","buttonStyle","magicClassName","signInPopUpButton","authSession","onLogin","webIdURI","uri","divs","getElementsByClassName","i","parent","e","addEventListener","offline","offlineTestID","renderSignInPopup","signupButton","_event","signupMgr","Signup","signup","issuerPopup","body","issuerPopupBox","issuerPopupBoxTopMenu","issuerPopupBoxLabel","innerText","issuerPopupBoxCloseButton","remove","loginToIssuer","issuerUri","preLoginRedirectHash","URL","href","hash","localStorage","setItem","login","redirectUrl","oidcIssuer","issuerTextContainer","issuerTextInputContainer","issuerTextLabel","issuerTextInput","value","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","getSuggestedIssuers","forEach","issuerInfo","issuerButton","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","err","logoutButton","logoutLabel","nick","any","foaf","signOutButton","sessionInfo","info","isLoggedIn","sym","clearElement","trackSession","onLogout","issuer","wellKnownUri","pathname","fetch","toString","wellKnownResult","json","openidConfiguration","end_session_endpoint","credentials","reload","selectWorkspace","appDetails","callbackWS","appPathSegment","say","s","background","figureOutBase","ws","newBaseNode","space","newBaseString","split","slice","now","Date","getTime","displayOptions","makeNewWorkspace","padding","encodeURI","askName","newBase","newWs","newData","updater","update","id","w","each","undefined","storages","concat","ldp","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","holds","rdf","col1","col2","col3","tr","comment","cellStyle","deselectedStyle","anyValue","ui","reduce","a","b","charCodeAt","bgcolor","target","rdfs","disabled","trLast","newAppInstance","callback","gotWS","base","getUserRoles","doc","filterAvailablePanes","panes","userRoles","pane","isMatchingAudience","audience","isMatch","audienceRole","find","role","equals"],"sources":["../../src/login/login.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/**\n * Signing in, signing up, profile and preferences reloading\n * Type index management\n *\n * Many functions in this module take a context object which\n * holds various RDF symbols, add to it, and return a promise of it.\n *\n * * `me` RDF symbol for the user's WebID\n * * `publicProfile` The user's public profile, iff loaded\n * * `preferencesFile` The user's personal preference file, iff loaded\n * * `index.public` The user's public type index file\n * * `index.private` The user's private type index file\n *\n * Not RDF symbols:\n * * `noun` A string in english for the type of thing -- like \"address book\"\n * * `instance` An array of nodes which are existing instances\n * * `containers` An array of nodes of containers of instances\n * * `div` A DOM element where UI can be displayed\n * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages\n * *\n * * Vocabulary: \"load\" loads a file if it exists;\n * * 'Ensure\" CREATES the file if it does not exist (if it can) and then loads it.\n * @packageDocumentation\n */\nimport { PaneDefinition } from 'pane-registry'\nimport { BlankNode, NamedNode, st } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n authn,\n authSession,\n CrossOriginForbiddenError,\n FetchError,\n getSuggestedIssuers,\n NotEditableError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError,\n WebOperationError\n} from 'solid-logic'\nimport * as debug from '../debug'\nimport { alert } from '../log'\nimport * as ns from '../ns.js'\nimport { Signup } from '../signup/signup.js'\nimport { buttonStyle, commentStyle, textInputStyle } from '../style'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\n\nconst store = solidLogicSingleton.store\n\nconst {\n loadPreferences,\n loadProfile\n} = solidLogicSingleton.profile\n\nconst {\n getScopedAppInstances,\n getRegistrations,\n loadAllTypeIndexes,\n getScopedAppsFromIndex,\n deleteTypeIndexRegistration\n} = solidLogicSingleton.typeIndex\n\n/**\n * Resolves with the logged in user's WebID\n *\n * @param context\n */\n// used to be logIn\nexport function ensureLoggedIn (context: AuthenticationContext): Promise<AuthenticationContext> {\n const me = authn.currentUser()\n if (me) {\n authn.saveUser(me, context)\n return Promise.resolve(context)\n }\n\n return new Promise((resolve) => {\n authn.checkUser().then((webId) => {\n // Already logged in?\n if (webId) {\n debug.log(`logIn: Already logged in as ${webId}`)\n return resolve(context)\n }\n if (!context.div || !context.dom) {\n return resolve(context)\n }\n const box = loginStatusBox(context.dom, (webIdUri) => {\n authn.saveUser(webIdUri, context)\n resolve(context) // always pass growing context\n })\n context.div.appendChild(box)\n })\n })\n}\n\n/**\n * Loads preference file\n * Do this after having done log in and load profile\n *\n * @private\n *\n * @param context\n */\n// used to be logInLoadPreferences\nexport async function ensureLoadedPreferences (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.preferencesFile) return Promise.resolve(context) // already done\n\n const statusArea = context.statusArea || context.div || null\n let progressDisplay\n function complain (message) {\n message = `ensureLoadedPreferences: ${message}`\n if (statusArea) {\n // statusArea.innerHTML = ''\n statusArea.appendChild(widgets.errorMessageBlock(context.dom, message))\n }\n debug.log(message)\n // reject(new Error(message))\n }\n try {\n context = await ensureLoadedProfile(context)\n\n // console.log('back in Solid UI after logInLoadProfile', context)\n const preferencesFile = await loadPreferences(context.me as NamedNode)\n if (progressDisplay) {\n progressDisplay.parentNode.removeChild(progressDisplay)\n }\n context.preferencesFile = preferencesFile\n } catch (err) {\n let m2: string\n if (err instanceof UnauthorizedError) {\n m2 =\n 'Ooops - you are not authenticated (properly logged in) to for me to read your preference file. Try loggin out and logging in?'\n alert(m2)\n } else if (err instanceof CrossOriginForbiddenError) {\n m2 = `Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`\n context.preferencesFileError = m2\n return context\n } else if (err instanceof SameOriginForbiddenError) {\n m2 =\n 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof NotEditableError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof WebOperationError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n } else if (err instanceof FetchError) {\n m2 = `Strange: Error ${err.status} trying to read your preference file.${err.message}`\n alert(m2)\n } else {\n throw new Error(`(via loadPrefs) ${err}`)\n }\n }\n return context\n}\n\n/**\n * Logs the user in and loads their WebID profile document into the store\n *\n * @param context\n *\n * @returns Resolves with the context after login / fetch\n */\n// used to be logInLoadProfile\nexport async function ensureLoadedProfile (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.publicProfile) {\n return context\n } // already done\n try {\n const logInContext = await ensureLoggedIn(context)\n if (!logInContext.me) {\n throw new Error('Could not log in')\n }\n context.publicProfile = await loadProfile(logInContext.me)\n } catch (err) {\n if (context.div && context.dom) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, err.message))\n }\n throw new Error(`Can't log in: ${err}`)\n }\n return context\n}\n\n/**\n * Returns promise of context with arrays of symbols\n *\n * leaving the `isPublic` param undefined will bring in community index things, too\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n let items = context.me ? await getScopedAppInstances(theClass, context.me) : []\n if (isPublic === true) { // old API - not recommended!\n items = items.filter(item => item.scope.label === 'public')\n } else if (isPublic === false) {\n items = items.filter(item => item.scope.label === 'private')\n }\n context.instances = items.map(item => item.instance)\n return context\n}\n\nexport function scopeLabel (context, scope) {\n const mine = context.me && context.me.sameTerm(scope.agent)\n const name = mine ? '' : utils.label(scope.agent) + ' '\n return `${name}${scope.label}`\n}\n/**\n * UI to control registration of instance\n */\nexport async function registrationControl (\n context: AuthenticationContext,\n instance,\n theClass\n): Promise<AuthenticationContext | void> {\n function registrationStatements (index) {\n const registrations = getRegistrations(instance, theClass)\n const reg = registrations.length ? registrations[0] : widgets.newThing(index)\n return [\n st(reg, ns.solid('instance'), instance, index),\n st(reg, ns.solid('forClass'), theClass, index)\n ]\n }\n\n function renderScopeCheckbox (scope) {\n const statements = registrationStatements(scope.index)\n const name = scopeLabel(context, scope)\n const label = `${name} link to this ${context.noun}`\n return widgets.buildCheckboxForm(\n context.dom,\n solidLogicSingleton.store,\n label,\n null,\n statements,\n form,\n scope.index\n )\n }\n /// / body of registrationControl\n const dom = context.dom\n if (!dom || !context.div) {\n throw new Error('registrationControl: need dom and div')\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n const me = context.me\n if (!me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let scopes // @@ const\n try {\n scopes = await loadAllTypeIndexes(me)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Lists of stuff not available)'\n context.div.appendChild(dom.createElement('p')).textContent = msg\n } else if (context.div) {\n msg = `registrationControl: Type indexes not available: ${e}`\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n return context\n }\n\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;')\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n for (const scope of scopes) {\n const row = tbody.appendChild(dom.createElement('tr'))\n row.appendChild(renderScopeCheckbox(scope)) // @@ index\n }\n return context\n}\n\nexport function renderScopeHeadingRow (context, store, scope) {\n const backgroundColor = { private: '#fee', public: '#efe' }\n const { dom } = context\n const name = scopeLabel(context, scope)\n const row = dom.createElement('tr')\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.backgoundColor = backgroundColor[scope.label] || 'white'\n const header = cell.appendChild(dom.createElement('h3'))\n header.textContent = name + ' links'\n header.style.textAlign = 'left'\n return row\n}\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (context: AuthenticationContext, options: {\n private?: boolean\n public?: boolean\n type?: NamedNode\n}): Promise<AuthenticationContext> {\n const dom = context.dom as HTMLDocument\n const div = context.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context\n }\n\n const scopes = await loadAllTypeIndexes(context.me) // includes community indexes\n\n // console.log('@@ registrationList ', scopes)\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;')\n const table = box.firstChild as HTMLElement\n const tbody = table.firstChild as HTMLElement\n\n for (const scope of scopes) { // need some predicate for listing/adding agents\n const headingRow = renderScopeHeadingRow(context, store, scope)\n tbody.appendChild(headingRow)\n const items = await getScopedAppsFromIndex(scope, options.type || null) // any class\n if (items.length === 0) headingRow.style.display = 'none'\n // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)\n for (const item of items) {\n const row = widgets.personTR(dom, ns.solid('instance'), item.instance, {\n deleteFunction: async () => {\n await deleteTypeIndexRegistration(item)\n tbody.removeChild(row)\n }\n })\n row.children[0].style.paddingLeft = '3em'\n\n tbody.appendChild(row)\n }\n }\n return context\n} // registrationList\n\nfunction getDefaultSignInButtonStyle (): string {\n return 'padding: 1em; border-radius:0.5em; font-size: 100%;'\n}\n\n/**\n * Bootstrapping identity\n * (Called by `loginStatusBox()`)\n *\n * @param dom\n * @param setUserCallback\n *\n * @returns\n */\nfunction signInOrSignUpBox (\n dom: HTMLDocument,\n setUserCallback: (user: string) => void,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n options = options || {}\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n\n // @@ TODO Remove the need to cast HTML element to any\n const box: any = dom.createElement('div')\n const magicClassName = 'SolidSignInOrSignUpBox'\n debug.log('widgets.signInOrSignUpBox')\n box.setUserCallback = setUserCallback\n box.setAttribute('class', magicClassName);\n (box as any).style = 'display:flex;' // @@ fix all typecasts like this\n\n // Sign in button with PopUP\n const signInPopUpButton = dom.createElement('input') // multi\n box.appendChild(signInPopUpButton)\n signInPopUpButton.setAttribute('type', 'button')\n signInPopUpButton.setAttribute('value', 'Log in')\n signInPopUpButton.setAttribute('style', `${signInButtonStyle}background-color: #eef;`)\n\n authSession.onLogin(() => {\n const me = authn.currentUser()\n // const sessionInfo = authSession.info\n // if (sessionInfo && sessionInfo.isLoggedIn) {\n if (me) {\n // const webIdURI = sessionInfo.webId\n const webIdURI = me.uri\n // setUserCallback(webIdURI)\n const divs = dom.getElementsByClassName(magicClassName)\n debug.log(`Logged in, ${divs.length} panels to be serviced`)\n // At the same time, satisfy all the other login boxes\n for (let i = 0; i < divs.length; i++) {\n const div: any = divs[i]\n // @@ TODO Remove the need to manipulate HTML elements\n if (div.setUserCallback) {\n try {\n div.setUserCallback(webIdURI)\n const parent = div.parentNode\n if (parent) {\n parent.removeChild(div)\n }\n } catch (e) {\n debug.log(`## Error satisfying login box: ${e}`)\n div.appendChild(widgets.errorMessageBlock(dom, e))\n }\n }\n }\n }\n })\n\n signInPopUpButton.addEventListener(\n 'click',\n () => {\n const offline = offlineTestID()\n if (offline) return setUserCallback(offline.uri)\n\n renderSignInPopup(dom)\n },\n false\n )\n\n // Sign up button\n const signupButton = dom.createElement('input')\n box.appendChild(signupButton)\n signupButton.setAttribute('type', 'button')\n signupButton.setAttribute('value', 'Sign Up for Solid')\n signupButton.setAttribute('style', `${signInButtonStyle}background-color: #efe;`)\n\n signupButton.addEventListener(\n 'click',\n function (_event) {\n const signupMgr = new Signup()\n signupMgr.signup().then(function (uri) {\n debug.log('signInOrSignUpBox signed up ' + uri)\n setUserCallback(uri)\n })\n },\n false\n )\n return box\n}\n\nexport function renderSignInPopup (dom: HTMLDocument) {\n /**\n * Issuer Menu\n */\n const issuerPopup = dom.createElement('div')\n issuerPopup.setAttribute(\n 'style',\n 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;'\n )\n dom.body.appendChild(issuerPopup)\n const issuerPopupBox = dom.createElement('div')\n issuerPopupBox.setAttribute(\n 'style',\n `\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n `\n )\n issuerPopup.appendChild(issuerPopupBox)\n const issuerPopupBoxTopMenu = dom.createElement('div')\n issuerPopupBoxTopMenu.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n `\n )\n issuerPopupBox.appendChild(issuerPopupBoxTopMenu)\n const issuerPopupBoxLabel = dom.createElement('label')\n issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800')\n issuerPopupBoxLabel.innerText = 'Select an identity provider'\n const issuerPopupBoxCloseButton = dom.createElement('button')\n issuerPopupBoxCloseButton.innerHTML =\n '<img src=\"https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg\" style=\"width: 2em; height: 2em;\" title=\"Cancel\">'\n issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;')\n issuerPopupBoxCloseButton.addEventListener('click', () => {\n issuerPopup.remove()\n })\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxLabel)\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton)\n\n const loginToIssuer = async (issuerUri: string) => {\n try {\n // Save hash\n const preLoginRedirectHash = new URL(window.location.href).hash\n if (preLoginRedirectHash) {\n window.localStorage.setItem('preLoginRedirectHash', preLoginRedirectHash)\n }\n window.localStorage.setItem('loginIssuer', issuerUri)\n // Login\n await authSession.login({\n redirectUrl: window.location.href,\n oidcIssuer: issuerUri\n })\n } catch (err) {\n alert(err.message)\n }\n }\n\n /**\n * Text-based idp selection\n */\n const issuerTextContainer = dom.createElement('div')\n issuerTextContainer.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerTextInputContainer = dom.createElement('div')\n issuerTextInputContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: row;\n `\n )\n const issuerTextLabel = dom.createElement('label')\n issuerTextLabel.innerText = 'Enter the URL of your identity provider:'\n issuerTextLabel.setAttribute('style', 'color: #888')\n const issuerTextInput = dom.createElement('input')\n issuerTextInput.setAttribute('type', 'text')\n issuerTextInput.setAttribute(\n 'style',\n 'margin-left: 0 !important; flex: 1; margin-right: 5px !important'\n )\n issuerTextInput.setAttribute('placeholder', 'https://example.com')\n issuerTextInput.value = localStorage.getItem('loginIssuer') || ''\n const issuerTextGoButton = dom.createElement('button')\n issuerTextGoButton.innerText = 'Go'\n issuerTextGoButton.setAttribute('style', 'margin-top: 12px; margin-bottom: 12px;')\n issuerTextGoButton.addEventListener('click', () => {\n loginToIssuer(issuerTextInput.value)\n })\n issuerTextContainer.appendChild(issuerTextLabel)\n issuerTextInputContainer.appendChild(issuerTextInput)\n issuerTextInputContainer.appendChild(issuerTextGoButton)\n issuerTextContainer.appendChild(issuerTextInputContainer)\n issuerPopupBox.appendChild(issuerTextContainer)\n\n /**\n * Button-based idp selection\n */\n const issuerButtonContainer = dom.createElement('div')\n issuerButtonContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerBottonLabel = dom.createElement('label')\n issuerBottonLabel.innerText = 'Or pick an identity provider from the list below:'\n issuerBottonLabel.setAttribute('style', 'color: #888')\n issuerButtonContainer.appendChild(issuerBottonLabel)\n getSuggestedIssuers().forEach((issuerInfo) => {\n const issuerButton = dom.createElement('button')\n issuerButton.innerText = issuerInfo.name\n issuerButton.setAttribute('style', 'height: 38px; margin-top: 10px')\n issuerButton.addEventListener('click', () => {\n loginToIssuer(issuerInfo.uri)\n })\n issuerButtonContainer.appendChild(issuerButton)\n })\n issuerPopupBox.appendChild(issuerButtonContainer)\n}\n\n/**\n * Login status box\n *\n * A big sign-up/sign in box or a logout box depending on the state\n *\n * @param dom\n * @param listener\n *\n * @returns\n */\nexport function loginStatusBox (\n dom: HTMLDocument,\n listener: ((uri: string | null) => void) | null = null,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n // 20190630\n let me = offlineTestID()\n // @@ TODO Remove the need to cast HTML element to any\n const box: any = dom.createElement('div')\n\n function setIt (newidURI) {\n if (!newidURI) {\n return\n }\n\n // const uri = newidURI.uri || newidURI\n // me = sym(uri)\n me = authn.saveUser(newidURI)\n box.refresh()\n if (listener) listener(me!.uri)\n }\n\n function logoutButtonHandler (_event) {\n const oldMe = me\n authSession.logout().then(\n function () {\n const message = `Your WebID was ${oldMe}. It has been forgotten.`\n me = null\n try {\n alert(message)\n } catch (e) {\n window.alert(message)\n }\n box.refresh()\n if (listener) listener(null)\n },\n (err) => {\n alert('Fail to log out:' + err)\n }\n )\n }\n\n function logoutButton (me, options) {\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n let logoutLabel = 'WebID logout'\n if (me) {\n const nick =\n solidLogicSingleton.store.any(me, ns.foaf('nick')) ||\n solidLogicSingleton.store.any(me, ns.foaf('name'))\n if (nick) {\n logoutLabel = 'Logout ' + nick.value\n }\n }\n const signOutButton = dom.createElement('input')\n // signOutButton.className = 'WebIDCancelButton'\n signOutButton.setAttribute('type', 'button')\n signOutButton.setAttribute('value', logoutLabel)\n signOutButton.setAttribute('style', `${signInButtonStyle}background-color: #eee;`)\n signOutButton.addEventListener('click', logoutButtonHandler, false)\n return signOutButton\n }\n\n box.refresh = function () {\n const sessionInfo = authSession.info\n if (sessionInfo && sessionInfo.webId && sessionInfo.isLoggedIn) {\n me = solidLogicSingleton.store.sym(sessionInfo.webId)\n } else {\n me = null\n }\n if ((me && box.me !== me.uri) || (!me && box.me)) {\n widgets.clearElement(box)\n if (me) {\n box.appendChild(logoutButton(me, options))\n } else {\n box.appendChild(signInOrSignUpBox(dom, setIt, options))\n }\n }\n box.me = me ? me.uri : null\n }\n box.refresh()\n\n function trackSession () {\n me = authn.currentUser()\n box.refresh()\n }\n trackSession()\n\n authSession.onLogin(trackSession)\n authSession.onLogout(trackSession)\n box.me = '99999' // Force refresh\n box.refresh()\n return box\n}\n\nauthSession.onLogout(async () => {\n const issuer = window.localStorage.getItem('loginIssuer')\n if (issuer) {\n try {\n const wellKnownUri = new URL(issuer)\n wellKnownUri.pathname = '/.well-known/openid-configuration'\n const wellKnownResult = await fetch(wellKnownUri.toString())\n if (wellKnownResult.status === 200) {\n const openidConfiguration = await wellKnownResult.json()\n if (openidConfiguration && openidConfiguration.end_session_endpoint) {\n await fetch(openidConfiguration.end_session_endpoint, { credentials: 'include' })\n }\n }\n } catch (err) {\n // Do nothing\n }\n }\n window.location.reload()\n})\n\n/**\n * Workspace selection etc\n * See https://github.com/solidos/userguide/issues/16\n */\n\n/**\n * Returns a UI object which, if it selects a workspace,\n * will callback(workspace, newBase).\n * See https://github.com/solidos/userguide/issues/16 for more info on workspaces.\n *\n * If necessary, will get an account, preference file, etc. In sequence:\n *\n * - If not logged in, log in.\n * - Load preference file\n * - Prompt user for workspaces\n * - Allows the user to just type in a URI by hand\n *\n * Calls back with the workspace and the base URI\n *\n * @param dom\n * @param appDetails\n * @param callbackWS\n */\nexport function selectWorkspace (\n dom: HTMLDocument,\n appDetails: AppDetails,\n callbackWS: (workspace: string | null, newBase: string) => void\n): HTMLElement {\n const noun = appDetails.noun\n const appPathSegment = appDetails.appPathSegment\n\n const me = offlineTestID()\n const box = dom.createElement('div')\n const context: AuthenticationContext = { me, dom, div: box }\n\n function say (s, background) {\n box.appendChild(widgets.errorMessageBlock(dom, s, background))\n }\n\n function figureOutBase (ws) {\n const newBaseNode: NamedNode = solidLogicSingleton.store.any(\n ws,\n ns.space('uriPrefix')\n ) as NamedNode\n let newBaseString: string\n if (!newBaseNode) {\n newBaseString = ws.uri.split('#')[0]\n } else {\n newBaseString = newBaseNode.value\n }\n if (newBaseString.slice(-1) !== '/') {\n debug.log(`${appPathSegment}: No / at end of uriPrefix ${newBaseString}`) // @@ paramater?\n newBaseString = `${newBaseString}/`\n }\n const now = new Date()\n newBaseString += `${appPathSegment}/id${now.getTime()}/` // unique id\n return newBaseString\n }\n\n function displayOptions (context) {\n // console.log('displayOptions!', context)\n async function makeNewWorkspace (_event) {\n const row = table.appendChild(dom.createElement('tr'))\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.padding = '0.5em'\n const newBase = encodeURI(\n await widgets.askName(\n dom,\n solidLogicSingleton.store,\n cell,\n ns.solid('URL'),\n ns.space('Workspace'),\n 'Workspace'\n )\n )\n const newWs = widgets.newThing(context.preferencesFile)\n const newData = [\n st(context.me, ns.space('workspace'), newWs, context.preferencesFile),\n // eslint-disable-next-line camelcase\n st(\n newWs,\n ns.space('uriPrefix'),\n newBase as unknown as Quad_Object,\n context.preferencesFile\n )\n ]\n if (!solidLogicSingleton.store.updater) {\n throw new Error('store has no updater')\n }\n await solidLogicSingleton.store.updater.update([], newData)\n // @@ now refresh list of workspaces\n }\n\n // const status = ''\n const id = context.me\n const preferencesFile = context.preferencesFile\n let newBase: any = null\n\n // A workspace specifically defined in the private preference file:\n let w: any = solidLogicSingleton.store.each(\n id,\n ns.space('workspace'),\n undefined,\n preferencesFile\n ) // Only trust preference file here\n\n // A workspace in a storage in the public profile:\n const storages = solidLogicSingleton.store.each(id, ns.space('storage')) // @@ No provenance requirement at the moment\n if (w.length === 0 && storages) {\n say(\n `You don't seem to have any workspaces. You have ${storages.length} storage spaces.`,\n 'white'\n )\n storages\n .map(function (s: any) {\n w = w.concat(solidLogicSingleton.store.each(s, ns.ldp('contains')))\n return w\n })\n .filter((file) => {\n return file.id ? ['public', 'private'].includes(file.id().toLowerCase()) : ''\n })\n }\n\n if (w.length === 1) {\n say(`Workspace used: ${w[0].uri}`, 'white') // @@ allow user to see URI\n newBase = figureOutBase(w[0])\n // callbackWS(w[0], newBase)\n // } else if (w.length === 0) {\n }\n\n // Prompt for ws selection or creation\n // say( w.length + \" workspaces for \" + id + \"Choose one.\");\n const table = dom.createElement('table')\n table.setAttribute('style', 'border-collapse:separate; border-spacing: 0.5em;')\n\n // const popup = window.open(undefined, '_blank', { height: 300, width:400 }, false)\n box.appendChild(table)\n\n // Add a field for directly adding the URI yourself\n\n // const hr = box.appendChild(dom.createElement('hr')) // @@\n box.appendChild(dom.createElement('hr')) // @@\n\n const p = box.appendChild(dom.createElement('p'));\n (p as any).style = commentStyle\n p.textContent = `Where would you like to store the data for the ${noun}?\n Give the URL of the folder where you would like the data stored.\n It can be anywhere in solid world - this URI is just an idea.`\n // @@ TODO Remove the need to cast baseField to any\n const baseField: any = box.appendChild(dom.createElement('input'))\n baseField.setAttribute('type', 'text');\n (baseField as any).style = textInputStyle\n baseField.size = 80 // really a string\n baseField.label = 'base URL'\n baseField.autocomplete = 'on'\n if (newBase) {\n // set to default\n baseField.value = newBase\n }\n\n context.baseField = baseField\n\n box.appendChild(dom.createElement('br')) // @@\n\n const button = box.appendChild(dom.createElement('button'));\n (button as any).style = buttonStyle\n button.textContent = `Start new ${noun} at this URI`\n button.addEventListener('click', function (_event) {\n let newBase = baseField.value.replace(' ', '%20') // do not re-encode in general, as % encodings may exist\n if (newBase.slice(-1) !== '/') {\n newBase += '/'\n }\n callbackWS(null, newBase)\n })\n\n // Now go set up the table of spaces\n\n // const row = 0\n w = w.filter(function (x) {\n return !solidLogicSingleton.store.holds(\n x,\n ns.rdf('type'), // Ignore master workspaces\n ns.space('MasterWorkspace')\n )\n })\n let col1, col2, col3, tr, ws, style, comment\n const cellStyle = 'height: 3em; margin: 1em; padding: 1em white; border-radius: 0.3em;'\n const deselectedStyle = `${cellStyle}border: 0px;`\n // const selectedStyle = cellStyle + 'border: 1px solid black;'\n for (let i = 0; i < w.length; i++) {\n ws = w[i]\n tr = dom.createElement('tr')\n if (i === 0) {\n col1 = dom.createElement('td')\n col1.setAttribute('rowspan', `${w.length}`)\n col1.textContent = 'Choose a workspace for this:'\n col1.setAttribute('style', 'vertical-align:middle;')\n tr.appendChild(col1)\n }\n col2 = dom.createElement('td')\n style = solidLogicSingleton.store.anyValue(ws, ns.ui('style'))\n if (!style) {\n // Otherwise make up arbitrary colour\n const hash = function (x) {\n return x.split('').reduce(function (a, b) {\n a = (a << 5) - a + b.charCodeAt(0)\n return a & a\n }, 0)\n }\n const bgcolor = `#${((hash(ws.uri) & 0xffffff) | 0xc0c0c0).toString(16)}` // c0c0c0 forces pale\n style = `color: black ; background-color: ${bgcolor};`\n }\n col2.setAttribute('style', deselectedStyle + style)\n tr.target = ws.uri\n let label = solidLogicSingleton.store.any(ws, ns.rdfs('label'))\n if (!label) {\n label = ws.uri.split('/').slice(-1)[0] || ws.uri.split('/').slice(-2)[0]\n }\n col2.textContent = label || '???'\n tr.appendChild(col2)\n if (i === 0) {\n col3 = dom.createElement('td')\n col3.setAttribute('rowspan', `${w.length}1`)\n // col3.textContent = '@@@@@ remove';\n col3.setAttribute('style', 'width:50%;')\n tr.appendChild(col3)\n }\n table.appendChild(tr)\n\n comment = solidLogicSingleton.store.any(ws, ns.rdfs('comment'))\n comment = comment ? comment.value : 'Use this workspace'\n col2.addEventListener(\n 'click',\n function (_event) {\n col3.textContent = comment ? comment.value : ''\n col3.setAttribute('style', deselectedStyle + style)\n const button = dom.createElement('button')\n button.textContent = 'Continue'\n // button.setAttribute('style', style);\n const newBase = figureOutBase(ws)\n baseField.value = newBase // show user proposed URI\n\n button.addEventListener(\n 'click',\n function (_event) {\n button.disabled = true\n callbackWS(ws, newBase)\n button.textContent = '---->'\n },\n true\n ) // capture vs bubble\n col3.appendChild(button)\n },\n true\n ) // capture vs bubble\n }\n\n // last line with \"Make new workspace\"\n const trLast = dom.createElement('tr')\n col2 = dom.createElement('td')\n col2.setAttribute('style', cellStyle)\n col2.textContent = '+ Make a new workspace'\n col2.addEventListener('click', makeNewWorkspace)\n trLast.appendChild(col2)\n table.appendChild(trLast)\n } // displayOptions\n\n // console.log('kicking off async operation')\n ensureLoadedPreferences(context) // kick off async operation\n .then(displayOptions)\n .catch((err) => {\n // console.log(\"err from async op\")\n box.appendChild(widgets.errorMessageBlock(context.dom, err))\n })\n\n return box // return the box element, while login proceeds\n} // selectWorkspace\n\n/**\n * Creates a new instance of an app.\n *\n * An instance of an app could be e.g. an issue tracker for a given project,\n * or a chess game, or calendar, or a health/fitness record for a person.\n *\n * Note that this use of the term 'app' refers more to entries in the user's\n * type index than to actual software applications that use the personal data\n * to which these entries point.\n *\n * @param dom\n * @param appDetails\n * @param callback\n *\n * @returns A div with a button in it for making a new app instance\n */\nexport function newAppInstance (\n dom: HTMLDocument,\n appDetails: AppDetails,\n callback: (workspace: string | null, newBase: string) => void\n): HTMLElement {\n const gotWS = function (ws, base) {\n // log.debug(\"newAppInstance: Selected workspace = \" + (ws? ws.uri : 'none'))\n callback(ws, base)\n }\n const div = dom.createElement('div')\n const b = dom.createElement('button')\n b.setAttribute('type', 'button')\n div.appendChild(b)\n b.innerHTML = `Make new ${appDetails.noun}`\n b.addEventListener(\n 'click',\n (_event) => {\n div.appendChild(selectWorkspace(dom, appDetails, gotWS))\n },\n false\n )\n div.appendChild(b)\n return div\n}\n/**\n * Retrieves whether the currently logged in user is a power user\n * and/or a developer\n */\nexport async function getUserRoles (): Promise<Array<NamedNode>> {\n try {\n const { me, preferencesFile, preferencesFileError } = await ensureLoadedPreferences({})\n if (!preferencesFile || preferencesFileError) {\n throw new Error(preferencesFileError)\n }\n return solidLogicSingleton.store.each(\n me,\n ns.rdf('type'),\n null,\n preferencesFile.doc()\n ) as NamedNode[]\n } catch (error) {\n debug.warn('Unable to fetch your preferences - this was the error: ', error)\n }\n return []\n}\n\n/**\n * Filters which panes should be available, based on the result of [[getUserRoles]]\n */\nexport async function filterAvailablePanes (\n panes: Array<PaneDefinition>\n): Promise<Array<PaneDefinition>> {\n const userRoles = await getUserRoles()\n return panes.filter((pane) => isMatchingAudience(pane, userRoles))\n}\n\nfunction isMatchingAudience (pane: PaneDefinition, userRoles: Array<NamedNode>): boolean {\n const audience = pane.audience || []\n return audience.reduce(\n (isMatch, audienceRole) => isMatch && !!userRoles.find((role) => role.equals(audienceRole)),\n true as boolean\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA;AAGA;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AAAqC;AAAA;AAAA;AAAA;AAAA;AAErC,IAAMA,KAAK,GAAGC,+BAAmB,CAACD,KAAK;AAEvC,4BAGIC,+BAAmB,CAACC,OAAO;EAF7BC,eAAe,yBAAfA,eAAe;EACfC,WAAW,yBAAXA,WAAW;AAGb,6BAMIH,+BAAmB,CAACI,SAAS;EAL/BC,qBAAqB,0BAArBA,qBAAqB;EACrBC,gBAAgB,0BAAhBA,gBAAgB;EAChBC,kBAAkB,0BAAlBA,kBAAkB;EAClBC,sBAAsB,0BAAtBA,sBAAsB;EACtBC,2BAA2B,0BAA3BA,2BAA2B;;AAG7B;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,cAAc,CAAEC,OAA8B,EAAkC;EAC9F,IAAMC,EAAE,GAAGC,iBAAK,CAACC,WAAW,EAAE;EAC9B,IAAIF,EAAE,EAAE;IACNC,iBAAK,CAACE,QAAQ,CAACH,EAAE,EAAED,OAAO,CAAC;IAC3B,OAAOK,OAAO,CAACC,OAAO,CAACN,OAAO,CAAC;EACjC;EAEA,OAAO,IAAIK,OAAO,CAAC,UAACC,OAAO,EAAK;IAC9BJ,iBAAK,CAACK,SAAS,EAAE,CAACC,IAAI,CAAC,UAACC,KAAK,EAAK;MAChC;MACA,IAAIA,KAAK,EAAE;QACTC,KAAK,CAACC,GAAG,uCAAgCF,KAAK,EAAG;QACjD,OAAOH,OAAO,CAACN,OAAO,CAAC;MACzB;MACA,IAAI,CAACA,OAAO,CAACY,GAAG,IAAI,CAACZ,OAAO,C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A,mCAEvE,EAAE;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACV;EAAA;AAAA;AAAA,SAKqBoO,oBAAoB;EAAA;AAAA;AAAA;EAAA,sGAAnC,mBACLC,KAA4B;IAAA;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAEJH,YAAY,EAAE;UAAA;YAAhCI,SAAS;YAAA,mCACRD,KAAK,CAACzN,MAAM,CAAC,UAAC2N,IAAI;cAAA,OAAKC,kBAAkB,CAACD,IAAI,EAAED,SAAS,CAAC;YAAA,EAAC;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACnE;EAAA;AAAA;AAED,SAASE,kBAAkB,CAAED,IAAoB,EAAED,SAA2B,EAAW;EACvF,IAAMG,QAAQ,GAAGF,IAAI,CAACE,QAAQ,IAAI,EAAE;EACpC,OAAOA,QAAQ,CAACpB,MAAM,CACpB,UAACqB,OAAO,EAAEC,YAAY;IAAA,OAAKD,OAAO,IAAI,CAAC,CAACJ,SAAS,CAACM,IAAI,CAAC,UAACC,IAAI;MAAA,OAAKA,IAAI,CAACC,MAAM,CAACH,YAAY,CAAC;IAAA,EAAC;EAAA,GAC3F,IAAI,CACL;AACH"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.matrix = void 0;
7
-
8
7
  var _matrix = require("./matrix");
9
-
10
8
  var matrix = {
11
9
  matrixForQuery: _matrix.matrixForQuery
12
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["matrix","matrixForQuery"],"sources":["../../src/matrix/index.ts"],"sourcesContent":["import {\n matrixForQuery\n} from './matrix'\n\nexport const matrix = {\n matrixForQuery\n}\n"],"mappings":";;;;;;;AAAA;;AAIO,IAAMA,MAAM,GAAG;EACpBC,cAAc,EAAdA;AADoB,CAAf"}
1
+ {"version":3,"file":"index.js","names":["matrix","matrixForQuery"],"sources":["../../src/matrix/index.ts"],"sourcesContent":["import {\n matrixForQuery\n} from './matrix'\n\nexport const matrix = {\n matrixForQuery\n}\n"],"mappings":";;;;;;AAAA;AAIO,IAAMA,MAAM,GAAG;EACpBC,cAAc,EAAdA;AACF,CAAC;AAAA"}
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _typeof = require("@babel/runtime/helpers/typeof");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.matrixForQuery = matrixForQuery;
9
-
10
8
  var utils = _interopRequireWildcard(require("../utils"));
11
-
12
9
  var $rdf = _interopRequireWildcard(require("rdflib"));
13
-
14
10
  var _solidLogic = require("solid-logic");
15
-
16
11
  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); }
17
-
18
12
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
13
  // Build a 2D matrix of values
21
14
  //
22
15
  // dom AKA document
@@ -37,8 +30,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
37
30
  // Header row at top (x axis) and left (y-axis) generated automatically.
38
31
  // Extra rows and columns are inserted as needed to hold new data points
39
32
  // matrix.refresh() will re-run the query and adjust the display
40
- var kb = _solidLogic.solidLogicSingleton.store;
41
33
 
34
+ var kb = _solidLogic.solidLogicSingleton.store;
42
35
  function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
43
36
  // @@ TODO Remove need to cast to any
44
37
  var matrix = dom.createElement('table');
@@ -46,11 +39,8 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
46
39
  var corner = header.appendChild(dom.createElement('td'));
47
40
  corner.setAttribute('class', 'MatrixCorner');
48
41
  matrix.appendChild(header); // just one for now
49
-
50
42
  matrix.lastHeader = header; // Element before data
51
-
52
43
  var columns = []; // Vector
53
-
54
44
  var rows = []; // Associative array
55
45
 
56
46
  var setCell = function setCell(cell, x, y, value) {
@@ -58,42 +48,34 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
58
48
  // Empty any previous
59
49
  cell.removeChild(cell.firstChild);
60
50
  }
61
-
62
51
  cell.setAttribute('style', '');
63
52
  cell.style.textAlign = 'center';
64
-
65
53
  if (options.cellFunction) {
66
54
  options.cellFunction(cell, x, y, value);
67
55
  } else {
68
56
  cell.textContent = utils.label(value);
69
57
  cell.setAttribute('style', 'padding: 0.3em');
70
58
  }
71
-
72
59
  delete cell.old;
73
60
  };
74
-
75
61
  var rowFor = function rowFor(y1) {
76
62
  var y = y1.toNT();
77
- if (rows[y]) return rows[y]; // @@ TODO Remove need for casting to any
78
-
63
+ if (rows[y]) return rows[y];
64
+ // @@ TODO Remove need for casting to any
79
65
  var tr = dom.createElement('tr');
80
66
  var header = tr.appendChild(dom.createElement('td'));
81
67
  header.setAttribute('style', 'padding: 0.3em;');
82
68
  header.textContent = utils.label(y1); // first approximation
83
-
84
69
  if (y1.termType === 'NamedNode') {
85
70
  kb.fetcher.nowOrWhenFetched(y1.uri.split('#')[0], undefined, function (ok, _body, _response) {
86
71
  if (ok) header.textContent = utils.label(y1);
87
72
  });
88
73
  }
89
-
90
74
  for (var i = 0; i < columns.length; i++) {
91
75
  setCell(tr.appendChild(dom.createElement('td')), $rdf.fromNT(columns[i]), y1, null);
92
76
  }
93
-
94
77
  tr.dataValueNT = y;
95
78
  rows[y] = tr;
96
-
97
79
  for (var ele = matrix.lastHeader.nextSibling; ele; ele = ele.nextSibling) {
98
80
  // skip header
99
81
  if (y > ele.dataValueNT && options && options.yDecreasing || y < ele.dataValueNT && !(options && options.yDecreasing)) {
@@ -106,91 +88,74 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
106
88
 
107
89
  var columnNumberFor = function columnNumberFor(x1) {
108
90
  var xNT = x1.toNT(); // xNT is a NT string
109
-
110
- var col = null; // These are data columns (not headings)
111
-
91
+ var col = null;
92
+ // These are data columns (not headings)
112
93
  for (var i = 0; i < columns.length; i++) {
113
94
  if (columns[i] === xNT) {
114
95
  return i;
115
96
  }
116
-
117
97
  if (xNT > columns[i] && options.xDecreasing || xNT < columns[i] && !options.xDecreasing) {
118
98
  columns = columns.slice(0, i).concat([xNT]).concat(columns.slice(i));
119
99
  col = i;
120
100
  break;
121
101
  }
122
102
  }
123
-
124
103
  if (col === null) {
125
104
  col = columns.length;
126
105
  columns.push(xNT);
127
- } // col is the number of the new column, starting from 0
128
-
106
+ }
129
107
 
108
+ // col is the number of the new column, starting from 0
130
109
  for (var row = matrix.firstChild; row; row = row.nextSibling) {
131
110
  // For every row header or not
132
111
  var y = row.dataValueNT;
133
112
  var td = dom.createElement('td'); // Add a new cell
134
-
135
113
  td.style.textAlign = 'center';
136
-
137
114
  if (row === matrix.firstChild) {
138
115
  td.textContent = utils.label(x1);
139
116
  } else {
140
117
  setCell(td, x1, $rdf.fromNT(y), null);
141
118
  }
142
-
143
119
  if (col === columns.length - 1) {
144
120
  row.appendChild(td);
145
121
  } else {
146
122
  var t = row.firstChild;
147
-
148
123
  for (var j = 0; j < col + 1; j++) {
149
124
  // Skip header col too
150
125
  t = t.nextSibling;
151
126
  }
152
-
153
127
  row.insertBefore(td, t);
154
128
  }
155
129
  }
156
-
157
130
  return col;
158
131
  };
159
-
160
132
  var markOldCells = function markOldCells() {
161
133
  for (var i = 1; i < matrix.children.length; i++) {
162
134
  var row = matrix.children[i];
163
-
164
135
  for (var j = 1; j < row.children.length; j++) {
165
136
  row.children[j].old = true;
166
137
  }
167
138
  }
168
139
  };
169
-
170
140
  var clearOldCells = function clearOldCells() {
171
141
  var row, cell;
172
142
  var colsUsed = [];
173
143
  var rowsUsed = [];
174
-
175
144
  if (options.set_y) {
176
145
  // Knows y values create rows
177
146
  for (var k = 0; k < options.set_y.length; k++) {
178
147
  rowsUsed[options.set_y[k]] = true;
179
148
  }
180
149
  }
181
-
182
150
  if (options.set_x) {
183
151
  for (var _k = 0; _k < options.set_x.length; _k++) {
184
152
  colsUsed[columnNumberFor(options.set_x[_k]) + 1] = true;
185
153
  }
186
154
  }
187
-
188
155
  for (var i = 1; i < matrix.children.length; i++) {
189
156
  row = matrix.children[i];
190
-
191
157
  for (var j = 1; j < row.children.length; j++) {
192
158
  cell = row.children[j];
193
-
194
159
  if (cell.old) {
195
160
  var y = $rdf.fromNT(row.dataValueNT);
196
161
  var x = $rdf.fromNT(columns[j - 1]);
@@ -201,10 +166,8 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
201
166
  }
202
167
  }
203
168
  }
204
-
205
169
  for (var _i = 0; _i < matrix.children.length; _i++) {
206
170
  row = matrix.children[_i];
207
-
208
171
  if (_i > 0 && !rowsUsed[row.dataValueNT]) {
209
172
  delete rows[row.dataValueNT];
210
173
  matrix.removeChild(row);
@@ -212,30 +175,24 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
212
175
  for (var _j = row.children.length - 1; _j > 0; _j--) {
213
176
  // backwards
214
177
  var _cell = row.children[_j];
215
-
216
178
  if (!colsUsed[_j]) {
217
179
  row.removeChild(_cell);
218
180
  }
219
181
  }
220
182
  }
221
183
  }
222
-
223
184
  var newcolumns = [];
224
-
225
185
  for (var _j2 = 0; _j2 < columns.length; _j2++) {
226
186
  if (colsUsed[_j2 + 1]) {
227
187
  newcolumns.push(columns[_j2]);
228
188
  }
229
189
  }
230
-
231
190
  columns = newcolumns;
232
191
  };
233
-
234
192
  matrix.refresh = function () {
235
193
  markOldCells();
236
194
  kb.query(query, addCellFromBindings, undefined, clearOldCells);
237
195
  };
238
-
239
196
  var addCellFromBindings = function addCellFromBindings(bindings) {
240
197
  var x = bindings[vx.toString()];
241
198
  var y = bindings[vy.toString()];
@@ -243,25 +200,20 @@ function matrixForQuery(dom, query, vx, vy, vvalue, options, whenDone) {
243
200
  var row = rowFor(y);
244
201
  var colNo = columnNumberFor(x);
245
202
  var cell = row.children[colNo + 1]; // number of Y axis headings
246
-
247
203
  setCell(cell, x, y, value);
248
204
  };
249
-
250
205
  if (options.set_y) {
251
206
  // Knows y values create rows
252
207
  for (var k = 0; k < options.set_y.length; k++) {
253
208
  rowFor(options.set_y[k]);
254
209
  }
255
210
  }
256
-
257
211
  if (options.set_x) {
258
212
  for (var _k2 = 0; _k2 < options.set_x.length; _k2++) {
259
213
  columnNumberFor(options.set_x[_k2]);
260
214
  }
261
215
  }
262
-
263
216
  kb.query(query, addCellFromBindings, undefined, whenDone); // Populate the matrix
264
-
265
217
  return matrix;
266
218
  }
267
219
  //# sourceMappingURL=matrix.js.map