solid-ui 2.4.22-fd0ccabe → 2.4.22-fd705c8d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +2059 -1163
- package/dist/main.js.map +1 -1
- package/lib/acl/access-controller.js +9 -14
- package/lib/acl/access-controller.js.map +1 -1
- package/lib/acl/access-groups.js +10 -15
- package/lib/acl/access-groups.js.map +1 -1
- package/lib/acl/acl-control.js +9 -13
- package/lib/acl/acl-control.js.map +1 -1
- package/lib/acl/acl.js +7 -11
- package/lib/acl/acl.js.map +1 -1
- package/lib/acl/add-agent-buttons.js +13 -19
- package/lib/acl/add-agent-buttons.js.map +1 -1
- package/lib/acl/index.js.map +1 -1
- package/lib/acl/styles.js.map +1 -1
- package/lib/acl/types.js.map +1 -1
- package/lib/chat/bookmarks.js +14 -19
- package/lib/chat/bookmarks.js.map +1 -1
- package/lib/chat/chatLogic.js +9 -15
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/dateFolder.js +12 -17
- package/lib/chat/dateFolder.js.map +1 -1
- package/lib/chat/infinite.js +29 -37
- package/lib/chat/infinite.js.map +1 -1
- package/lib/chat/message.js +14 -14
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/messageTools.js +10 -23
- package/lib/chat/messageTools.js.map +1 -1
- package/lib/chat/thread.js +4 -9
- package/lib/chat/thread.js.map +1 -1
- package/lib/create/create.js.map +1 -1
- package/lib/create/index.js.map +1 -1
- package/lib/create/types.js.map +1 -1
- package/lib/debug.js.map +1 -1
- package/lib/folders.js.map +1 -1
- package/lib/footer/index.js +8 -10
- package/lib/footer/index.js.map +1 -1
- package/lib/footer/styleMap.js.map +1 -1
- package/lib/header/empty-profile.js.map +1 -1
- package/lib/header/index.js +9 -17
- package/lib/header/index.js.map +1 -1
- package/lib/header/styleMap.js.map +1 -1
- package/lib/iconBase.js.map +1 -1
- package/lib/icons/solid_logo.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jss/index.js.map +1 -1
- package/lib/log.js.map +1 -1
- package/lib/login/login.js +21 -63
- package/lib/login/login.js.map +1 -1
- package/lib/matrix/index.js.map +1 -1
- package/lib/matrix/matrix.js.map +1 -1
- package/lib/matrix/types.js.map +1 -1
- package/lib/media/index.js.map +1 -1
- package/lib/media/media-capture.js +4 -20
- package/lib/media/media-capture.js.map +1 -1
- package/lib/messageArea.js.map +1 -1
- package/lib/noun_Camera_1618446_000000.js.map +1 -1
- package/lib/ns.js.map +1 -1
- package/lib/pad.js.map +1 -1
- package/lib/participation.js.map +1 -1
- package/lib/preferences.js.map +1 -1
- package/lib/signup/config-default.js.map +1 -1
- package/lib/signup/signup.js.map +1 -1
- package/lib/stories/decorators.js.map +1 -1
- package/lib/style.js.map +1 -1
- package/lib/style_multiSelect.js +67 -0
- package/lib/style_multiSelect.js.map +1 -0
- package/lib/table.js.map +1 -1
- package/lib/tabs.d.ts +1 -1
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +38 -22
- package/lib/tabs.js.map +1 -1
- package/lib/typings.d.js.map +1 -1
- package/lib/utils/headerFooterHelpers.js +5 -7
- package/lib/utils/headerFooterHelpers.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/label.js +1 -1
- package/lib/utils/label.js.map +1 -1
- package/lib/versionInfo.js +5 -5
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/buttons/iconLinks.js.map +1 -1
- package/lib/widgets/buttons.js.map +1 -1
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteBar.js +17 -15
- package/lib/widgets/forms/autocomplete/autocompleteBar.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompleteField.js +5 -8
- package/lib/widgets/forms/autocomplete/autocompleteField.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +21 -19
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/autocomplete/language.js +8 -15
- package/lib/widgets/forms/autocomplete/language.js.map +1 -1
- package/lib/widgets/forms/autocomplete/publicData.js +22 -27
- package/lib/widgets/forms/autocomplete/publicData.js.map +1 -1
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/comment.js.map +1 -1
- package/lib/widgets/forms/fieldFunction.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms/formStyle.js.map +1 -1
- package/lib/widgets/forms.js +504 -203
- package/lib/widgets/forms.js.map +1 -1
- package/lib/widgets/index.js.map +1 -1
- package/lib/widgets/multiSelect.js +784 -0
- package/lib/widgets/multiSelect.js.map +1 -0
- package/lib/widgets/peoplePicker.js.map +1 -1
- package/lib/widgets/widgetHelpers.js.map +1 -1
- package/package.json +5 -3
package/lib/login/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/login/login.ts"],"names":["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","solidLogicSingleton","loadPreferences","progressDisplay","parentNode","removeChild","UnauthorizedError","m2","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotFoundError","confirm","Error","FetchError","status","publicProfile","logInContext","loadProfile","findAppInstances","theClass","isPublic","unique","arr","Array","from","Set","undefined","visibility","error","index","thisIndex","registrations","map","ix","store","each","ns","solid","reduce","acc","curr","concat","instances","reg","containers","length","load","e","utils","label","i","cont","getContainerMembers","value","uri","sym","registrationControl","instance","createElement","innerHTML","context2","msg","textContent","setAttribute","tbody","children","form","BlankNode","registrationStatements","getRegistrations","newThing","statements","buildCheckboxForm","noun","registrationList","context0","options","table","firstChild","sts","vs","forEach","statementsMatching","statement","type","holds","subject","why","inst","object","personTR","deleteFunction","_x","updater","update","ok","errorBody","getDefaultSignInButtonStyle","signInOrSignUpBox","setUserCallback","signInButtonStyle","buttonStyle","magicClassName","style","signInPopUpButton","authSession","onLogin","webIdURI","divs","getElementsByClassName","parent","addEventListener","offline","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","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","issuerInfo","issuerButton","name","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","alert","err","logoutButton","logoutLabel","nick","any","foaf","signOutButton","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","row","cell","padding","encodeURI","askName","newBase","newWs","newData","id","w","storages","ldp","filter","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","rdf","col1","col2","col3","tr","comment","cellStyle","deselectedStyle","anyValue","ui","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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;AAGA;;AAgBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAnDA;;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA6BA;AACA;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AFK,EAGL,IAHK,EAILpO,eAAe,CAAC2P,GAAhB,EAJK,CANJ;;AAAA;AAAA;AAAA;AAaHzQ,YAAAA,KAAK,CAAC6B,IAAN,CAAW,yDAAX;;AAbG;AAAA,8CAeE,EAfF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;SAqBe6O,oB;;;;;wGAAf,mBACLC,KADK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAGmBH,YAAY,EAH/B;;AAAA;AAGCI,YAAAA,SAHD;AAAA,+CAIED,KAAK,CAACtC,MAAN,CAAa,UAACwC,IAAD;AAAA,qBAAUC,kBAAkB,CAACD,IAAD,EAAOD,SAAP,CAA5B;AAAA,aAAb,CAJF;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,G;;;;AAOP,SAASE,kBAAT,CAA6BD,IAA7B,EAAmDD,SAAnD,EAAyF;AACvF,MAAMG,QAAQ,GAAGF,IAAI,CAACE,QAAL,IAAiB,EAAlC;AACA,SAAOA,QAAQ,CAACrN,MAAT,CACL,UAACsN,OAAD,EAAUC,YAAV;AAAA,WAA2BD,OAAO,IAAI,CAAC,CAACJ,SAAS,CAACM,IAAV,CAAe,UAACC,IAAD;AAAA,aAAUA,IAAI,CAACC,MAAL,CAAYH,YAAZ,CAAV;AAAA,KAAf,CAAxC;AAAA,GADK,EAEL,IAFK,CAAP;AAID","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, Statement } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n loadIndex,\n authn,\n authSession,\n CrossOriginForbiddenError,\n ensureTypeIndexes,\n FetchError,\n getSuggestedIssuers,\n NotFoundError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError\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 { utils } from '../utils/index'\nimport * as widgets from '../widgets'\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 solidLogicSingleton.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 } else if (err instanceof NotFoundError) {\n if (\n confirm(\n `You do not currently have a preference file. OK for me to create an empty one? ${\n (err as any).preferencesFile || ''\n }`\n )\n ) {\n // @@@ code me ... weird to have a name of the file but no file\n alert(\n `Sorry; I am not prepared to do this. Please create an empty file at ${\n (err as any).preferencesFile || '(?)'\n }`\n )\n complain(new Error('Sorry; no code yet to create a preference file at '))\n } else {\n throw new Error(\n `User declined to create a preference file at ${(err as any).preferencesFile || '(?)'}`\n )\n }\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 solidLogicSingleton.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 * 2016-12-11 change to include forClass arc a la\n * https://github.com/solid/solid/blob/main/proposals/data-discovery.md\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n // console.log('findAppInstances', { context, theClass, isPublic })\n if (isPublic === undefined) {\n // Then both public and private\n // console.log('finding public app instance')\n await findAppInstances(context, theClass, true)\n // console.log('finding private app instance')\n await findAppInstances(context, theClass, false)\n // console.log('found public & private app instance', context)\n return context\n }\n\n // Loading preferences is more than loading profile\n try {\n // console.log('calling logInLoad', isPublic)\n await (isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context))\n // console.log('called logInLoad', isPublic)\n } catch (err) {\n widgets.complain(context, `loadIndex: login and load problem ${err}`)\n }\n // console.log('awaited LogInLoad!', context)\n const visibility = isPublic ? 'public' : 'private'\n try {\n await loadIndex(context, isPublic)\n } catch (err) {\n debug.error(err)\n }\n const index = context.index as { [key: string]: Array<NamedNode> }\n const thisIndex = index[visibility]\n const registrations = thisIndex\n .map((ix) => solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix))\n .reduce((acc, curr) => acc.concat(curr), [])\n const instances = registrations\n .map((reg) => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instance')))\n .reduce((acc, curr) => acc.concat(curr), [])\n const containers = registrations\n .map((reg) => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instanceContainer')))\n .reduce((acc, curr) => acc.concat(curr), [])\n\n function unique (arr: NamedNode[]): NamedNode[] {\n return Array.from(new Set(arr))\n }\n context.instances = context.instances || []\n context.instances = unique(context.instances.concat(instances as NamedNode[]))\n\n context.containers = context.containers || []\n context.containers = unique(context.containers.concat(containers as NamedNode[]))\n if (!containers.length) {\n return context\n }\n // If the index gives containers, then look up all things within them\n try {\n await solidLogicSingleton.load(containers as NamedNode[])\n } catch (err) {\n const e = new Error(`[FAI] Unable to load containers${err}`)\n debug.log(e) // complain\n widgets.complain(context, `Error looking for ${utils.label(theClass)}: ${err}`)\n // but then ignore it\n // throw new Error(e)\n }\n for (let i = 0; i < containers.length; i++) {\n const cont = containers[i]\n context.instances = context.instances.concat(\n (await solidLogicSingleton.getContainerMembers(cont.value)).map((uri) =>\n solidLogicSingleton.store.sym(uri)\n ) // @@ warning: uses strings not NN\n )\n }\n return context\n}\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 const dom = context.dom\n if (!dom || !context.div) {\n return context\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let context2 // @@ const\n try {\n context2 = await ensureTypeIndexes(context)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Preferences 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 }\n\n box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>' // tbody will be inserted anyway\n box.setAttribute(\n 'style',\n 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;'\n )\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n const registrationStatements = function (index) {\n const registrations = solidLogicSingleton.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 let index, statements\n\n try {\n if (context2.index && context2.index.public && context2.index.public.length > 0) {\n index = context2.index.public[0]\n statements = registrationStatements(index)\n tbody.children[0].appendChild(\n widgets.buildCheckboxForm(\n context2.dom,\n solidLogicSingleton.store,\n `Public link to this ${context2.noun}`,\n null,\n statements,\n form,\n index\n )\n )\n }\n\n if (context2.index && context2.index.private && context2.index.private.length > 0) {\n index = context2.index.private[0]\n statements = registrationStatements(index)\n tbody.children[1].appendChild(\n widgets.buildCheckboxForm(\n context2.dom,\n solidLogicSingleton.store,\n `Personal note of this ${context2.noun}`,\n null,\n statements,\n form,\n index\n )\n )\n }\n } catch (e) {\n const msg = `registrationControl: Error making panel: ${e}`\n if (context.div) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n }\n return context2\n}\n\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (\n context0: AuthenticationContext,\n options: {\n private?: boolean;\n public?: boolean;\n type?: NamedNode;\n }\n): Promise<AuthenticationContext> {\n const dom = context0.dom as HTMLDocument\n const div = context0.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context0.me = authn.currentUser() // @@\n if (!context0.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context0\n }\n\n return ensureTypeIndexes(context0).then((context) => {\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute(\n 'style',\n 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;'\n )\n const table = box.firstChild as HTMLElement\n\n let ix: Array<NamedNode> = []\n let sts: Statement[] = []\n const vs = ['private', 'public']\n vs.forEach(function (visibility) {\n if (context.index && context.index[visibility].length > 0 && options[visibility]) {\n ix = ix.concat(context.index[visibility][0])\n sts = sts.concat(\n solidLogicSingleton.store.statementsMatching(\n undefined,\n ns.solid('instance'),\n undefined,\n context.index[visibility][0]\n )\n )\n }\n })\n\n for (let i = 0; i < sts.length; i++) {\n const statement: Statement = sts[i]\n if (options.type) {\n // now check terms:forClass\n if (\n !solidLogicSingleton.store.holds(\n statement.subject,\n ns.solid('forClass'),\n options.type,\n statement.why\n )\n ) {\n continue // skip irrelevant ones\n }\n }\n // const cla = statement.subject\n const inst = statement.object\n table.appendChild(\n widgets.personTR(dom, ns.solid('instance'), inst, {\n deleteFunction: function (_x) {\n if (!solidLogicSingleton.store.updater) {\n throw new Error('Cannot delete this, store has no updater')\n }\n solidLogicSingleton.store.updater.update(\n [statement],\n [],\n function (uri, ok, errorBody) {\n if (ok) {\n debug.log(`Removed from index: ${statement.subject}`)\n } else {\n debug.log(`Error: Cannot delete ${statement}: ${errorBody}`)\n }\n }\n )\n }\n })\n )\n } // registrationList\n\n /*\n //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));\n if (containers.length) {\n fetcher.load(containers).then(function(xhrs){\n for (const i=0; i<containers.length; i++) {\n const cont = containers[i];\n instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));\n }\n });\n }\n */\n\n return context\n })\n}\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 `\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 me = authn.currentUser()\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"],"file":"login.js"}
|
|
1
|
+
{"version":3,"file":"login.js","names":["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","solidLogicSingleton","loadPreferences","progressDisplay","parentNode","removeChild","UnauthorizedError","m2","alert","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotFoundError","confirm","Error","FetchError","status","publicProfile","logInContext","loadProfile","findAppInstances","theClass","isPublic","unique","arr","Array","from","Set","undefined","visibility","loadIndex","error","index","thisIndex","registrations","map","ix","store","each","ns","solid","reduce","acc","curr","concat","instances","reg","containers","length","load","e","utils","label","i","cont","getContainerMembers","value","uri","sym","registrationControl","instance","createElement","innerHTML","ensureTypeIndexes","context2","msg","textContent","setAttribute","tbody","children","form","BlankNode","registrationStatements","getRegistrations","newThing","st","statements","buildCheckboxForm","noun","registrationList","context0","options","table","firstChild","sts","vs","forEach","statementsMatching","statement","type","holds","subject","why","inst","object","personTR","deleteFunction","_x","updater","update","ok","errorBody","getDefaultSignInButtonStyle","signInOrSignUpBox","setUserCallback","signInButtonStyle","buttonStyle","magicClassName","style","signInPopUpButton","authSession","onLogin","webIdURI","divs","getElementsByClassName","parent","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","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","getSuggestedIssuers","issuerInfo","issuerButton","name","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","err","logoutButton","logoutLabel","nick","any","foaf","signOutButton","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","row","cell","padding","encodeURI","askName","newBase","newWs","newData","id","w","storages","ldp","filter","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","rdf","col1","col2","col3","tr","comment","cellStyle","deselectedStyle","anyValue","ui","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, Statement } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n loadIndex,\n authn,\n authSession,\n CrossOriginForbiddenError,\n ensureTypeIndexes,\n FetchError,\n getSuggestedIssuers,\n NotFoundError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError\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 { utils } from '../utils/index'\nimport * as widgets from '../widgets'\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 solidLogicSingleton.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 } else if (err instanceof NotFoundError) {\n if (\n confirm(\n `You do not currently have a preference file. OK for me to create an empty one? ${\n (err as any).preferencesFile || ''\n }`\n )\n ) {\n // @@@ code me ... weird to have a name of the file but no file\n alert(\n `Sorry; I am not prepared to do this. Please create an empty file at ${\n (err as any).preferencesFile || '(?)'\n }`\n )\n complain(new Error('Sorry; no code yet to create a preference file at '))\n } else {\n throw new Error(\n `User declined to create a preference file at ${(err as any).preferencesFile || '(?)'}`\n )\n }\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 solidLogicSingleton.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 * 2016-12-11 change to include forClass arc a la\n * https://github.com/solid/solid/blob/main/proposals/data-discovery.md\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n // console.log('findAppInstances', { context, theClass, isPublic })\n if (isPublic === undefined) {\n // Then both public and private\n // console.log('finding public app instance')\n await findAppInstances(context, theClass, true)\n // console.log('finding private app instance')\n await findAppInstances(context, theClass, false)\n // console.log('found public & private app instance', context)\n return context\n }\n\n // Loading preferences is more than loading profile\n try {\n // console.log('calling logInLoad', isPublic)\n await (isPublic ? ensureLoadedProfile(context) : ensureLoadedPreferences(context))\n // console.log('called logInLoad', isPublic)\n } catch (err) {\n widgets.complain(context, `loadIndex: login and load problem ${err}`)\n }\n // console.log('awaited LogInLoad!', context)\n const visibility = isPublic ? 'public' : 'private'\n try {\n await loadIndex(context, isPublic)\n } catch (err) {\n debug.error(err)\n }\n const index = context.index as { [key: string]: Array<NamedNode> }\n const thisIndex = index[visibility]\n const registrations = thisIndex\n .map((ix) => solidLogicSingleton.store.each(undefined, ns.solid('forClass'), theClass, ix))\n .reduce((acc, curr) => acc.concat(curr), [])\n const instances = registrations\n .map((reg) => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instance')))\n .reduce((acc, curr) => acc.concat(curr), [])\n const containers = registrations\n .map((reg) => solidLogicSingleton.store.each(reg as NamedNode, ns.solid('instanceContainer')))\n .reduce((acc, curr) => acc.concat(curr), [])\n\n function unique (arr: NamedNode[]): NamedNode[] {\n return Array.from(new Set(arr))\n }\n context.instances = context.instances || []\n context.instances = unique(context.instances.concat(instances as NamedNode[]))\n\n context.containers = context.containers || []\n context.containers = unique(context.containers.concat(containers as NamedNode[]))\n if (!containers.length) {\n return context\n }\n // If the index gives containers, then look up all things within them\n try {\n await solidLogicSingleton.load(containers as NamedNode[])\n } catch (err) {\n const e = new Error(`[FAI] Unable to load containers${err}`)\n debug.log(e) // complain\n widgets.complain(context, `Error looking for ${utils.label(theClass)}: ${err}`)\n // but then ignore it\n // throw new Error(e)\n }\n for (let i = 0; i < containers.length; i++) {\n const cont = containers[i]\n context.instances = context.instances.concat(\n (await solidLogicSingleton.getContainerMembers(cont.value)).map((uri) =>\n solidLogicSingleton.store.sym(uri)\n ) // @@ warning: uses strings not NN\n )\n }\n return context\n}\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 const dom = context.dom\n if (!dom || !context.div) {\n return context\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let context2 // @@ const\n try {\n context2 = await ensureTypeIndexes(context)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Preferences 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 }\n\n box.innerHTML = '<table><tbody><tr></tr><tr></tr></tbody></table>' // tbody will be inserted anyway\n box.setAttribute(\n 'style',\n 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;'\n )\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n const registrationStatements = function (index) {\n const registrations = solidLogicSingleton.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 let index, statements\n\n try {\n if (context2.index && context2.index.public && context2.index.public.length > 0) {\n index = context2.index.public[0]\n statements = registrationStatements(index)\n tbody.children[0].appendChild(\n widgets.buildCheckboxForm(\n context2.dom,\n solidLogicSingleton.store,\n `Public link to this ${context2.noun}`,\n null,\n statements,\n form,\n index\n )\n )\n }\n\n if (context2.index && context2.index.private && context2.index.private.length > 0) {\n index = context2.index.private[0]\n statements = registrationStatements(index)\n tbody.children[1].appendChild(\n widgets.buildCheckboxForm(\n context2.dom,\n solidLogicSingleton.store,\n `Personal note of this ${context2.noun}`,\n null,\n statements,\n form,\n index\n )\n )\n }\n } catch (e) {\n const msg = `registrationControl: Error making panel: ${e}`\n if (context.div) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n }\n return context2\n}\n\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (\n context0: AuthenticationContext,\n options: {\n private?: boolean;\n public?: boolean;\n type?: NamedNode;\n }\n): Promise<AuthenticationContext> {\n const dom = context0.dom as HTMLDocument\n const div = context0.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context0.me = authn.currentUser() // @@\n if (!context0.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context0\n }\n\n return ensureTypeIndexes(context0).then((context) => {\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute(\n 'style',\n 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;'\n )\n const table = box.firstChild as HTMLElement\n\n let ix: Array<NamedNode> = []\n let sts: Statement[] = []\n const vs = ['private', 'public']\n vs.forEach(function (visibility) {\n if (context.index && context.index[visibility].length > 0 && options[visibility]) {\n ix = ix.concat(context.index[visibility][0])\n sts = sts.concat(\n solidLogicSingleton.store.statementsMatching(\n undefined,\n ns.solid('instance'),\n undefined,\n context.index[visibility][0]\n )\n )\n }\n })\n\n for (let i = 0; i < sts.length; i++) {\n const statement: Statement = sts[i]\n if (options.type) {\n // now check terms:forClass\n if (\n !solidLogicSingleton.store.holds(\n statement.subject,\n ns.solid('forClass'),\n options.type,\n statement.why\n )\n ) {\n continue // skip irrelevant ones\n }\n }\n // const cla = statement.subject\n const inst = statement.object\n table.appendChild(\n widgets.personTR(dom, ns.solid('instance'), inst, {\n deleteFunction: function (_x) {\n if (!solidLogicSingleton.store.updater) {\n throw new Error('Cannot delete this, store has no updater')\n }\n solidLogicSingleton.store.updater.update(\n [statement],\n [],\n function (uri, ok, errorBody) {\n if (ok) {\n debug.log(`Removed from index: ${statement.subject}`)\n } else {\n debug.log(`Error: Cannot delete ${statement}: ${errorBody}`)\n }\n }\n )\n }\n })\n )\n } // registrationList\n\n /*\n //const containers = solidLogicSingleton.store.each(theClass, ns.solid('instanceContainer'));\n if (containers.length) {\n fetcher.load(containers).then(function(xhrs){\n for (const i=0; i<containers.length; i++) {\n const cont = containers[i];\n instances = instances.concat(solidLogicSingleton.store.each(cont, ns.ldp('contains')));\n }\n });\n }\n */\n\n return context\n })\n}\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 `\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 me = authn.currentUser()\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;;AAgBA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;+CAlDA,oJ;;AAoDA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,cAAT,CAAyBC,OAAzB,EAAyF;EAC9F,IAAMC,EAAE,GAAGC,iBAAA,CAAMC,WAAN,EAAX;;EACA,IAAIF,EAAJ,EAAQ;IACNC,iBAAA,CAAME,QAAN,CAAeH,EAAf,EAAmBD,OAAnB;;IACA,OAAOK,OAAO,CAACC,OAAR,CAAgB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;EACA,OAAOA,QAAQ,CAACxN,MAAT,CACL,UAACyN,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"}
|
package/lib/matrix/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"}
|
package/lib/matrix/matrix.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/matrix/matrix.ts"],"names":["kb","solidLogicSingleton","store","matrixForQuery","dom","query","vx","vy","vvalue","options","whenDone","matrix","createElement","header","corner","appendChild","setAttribute","lastHeader","columns","rows","setCell","cell","x","y","value","firstChild","removeChild","style","textAlign","cellFunction","textContent","utils","label","old","rowFor","y1","toNT","tr","termType","fetcher","nowOrWhenFetched","uri","split","undefined","ok","_body","_response","i","length","$rdf","fromNT","dataValueNT","ele","nextSibling","yDecreasing","insertBefore","columnNumberFor","x1","xNT","col","xDecreasing","slice","concat","push","row","td","t","j","markOldCells","children","clearOldCells","colsUsed","rowsUsed","set_y","k","set_x","newcolumns","refresh","addCellFromBindings","bindings","toString","colNo"],"mappings":";;;;;;;;;AAqBA;;AACA;;AAEA;;;;;;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,IAAMA,EAAE,GAAGC,gCAAoBC,KAA/B;;AAEO,SA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EvE,MAAM,CAACwE,QAAP,EAAF,CAAtB;AACA,QAAMhB,GAAG,GAAG9B,MAAM,CAACX,CAAD,CAAlB;AACA,QAAM0D,KAAK,GAAGzB,eAAe,CAAClC,CAAD,CAA7B;AACA,QAAMD,IAAI,GAAG2C,GAAG,CAACK,QAAJ,CAAaY,KAAK,GAAG,CAArB,CAAb,CAN8C,CAMT;;AACrC7D,IAAAA,OAAO,CAACC,IAAD,EAAOC,CAAP,EAAUC,CAAV,EAAaC,KAAb,CAAP;AACD,GARD;;AAUA,MAAIf,OAAO,CAACgE,KAAZ,EAAmB;AACjB;AACA,SAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGjE,OAAO,CAACgE,KAAR,CAAczB,MAAlC,EAA0C0B,CAAC,EAA3C,EAA+C;AAC7CxC,MAAAA,MAAM,CAACzB,OAAO,CAACgE,KAAR,CAAcC,CAAd,CAAD,CAAN;AACD;AACF;;AACD,MAAIjE,OAAO,CAACkE,KAAZ,EAAmB;AACjB,SAAK,IAAID,GAAC,GAAG,CAAb,EAAgBA,GAAC,GAAGjE,OAAO,CAACkE,KAAR,CAAc3B,MAAlC,EAA0C0B,GAAC,EAA3C,EAA+C;AAC7ClB,MAAAA,eAAe,CAAC/C,OAAO,CAACkE,KAAR,CAAcD,GAAd,CAAD,CAAf;AACD;AACF;;AAED1E,EAAAA,EAAE,CAACK,KAAH,CAASA,KAAT,EAAgByE,mBAAhB,EAAqCnC,SAArC,EAAgDjC,QAAhD,EAnNA,CAmN0D;;AAC1D,SAAOC,MAAP;AACD","sourcesContent":["// Build a 2D matrix of values\n//\n// dom AKA document\n// query a Query object of rdflib.js with a valid pattern\n// vx A variable object, the one to be used for the X variable (horiz)\n// vy A variable object, the one to be used for the Y variable (vertical)\n// vvalue A variable object, the one to be used for the cell value\n// returns A DOM element with the matrix in it, which has a .refresh() function.\n//\n// Options:\n// cellFunction(td, x, y, value) fill the TD element of a single cell\n// xDecreasing set true for x axis to be in decreasing order.\n// yDecreasing set true for y axis to be in decreasing order.\n// set_x array of X values to be define initial rows (order irrelevant)\n// set_y array of Y values to be define initial columns\n//\n// Features:\n// Header row at top (x axis) and left (y-axis) generated automatically.\n// Extra rows and columns are inserted as needed to hold new data points\n// matrix.refresh() will re-run the query and adjust the display\n\nimport * as utils from '../utils'\nimport * as $rdf from 'rdflib'\nimport { MatrixOptions } from './types'\nimport { solidLogicSingleton } from 'solid-logic'\n\nconst kb = solidLogicSingleton.store\n\nexport function matrixForQuery (\n dom: HTMLDocument,\n query: $rdf.Query,\n vx: $rdf.Variable,\n vy: $rdf.Variable,\n vvalue: $rdf.Variable,\n options: MatrixOptions,\n whenDone: () => void\n) {\n // @@ TODO Remove need to cast to any\n const matrix: any = dom.createElement('table')\n const header = dom.createElement('tr')\n const corner = header.appendChild(dom.createElement('td'))\n corner.setAttribute('class', 'MatrixCorner')\n matrix.appendChild(header) // just one for now\n matrix.lastHeader = header // Element before data\n let columns: any[] = [] // Vector\n const rows: any[] = [] // Associative array\n\n const setCell = function (cell, x, y, value) {\n while (cell.firstChild) {\n // Empty any previous\n cell.removeChild(cell.firstChild)\n }\n cell.setAttribute('style', '')\n cell.style.textAlign = 'center'\n\n if (options.cellFunction) {\n options.cellFunction(cell, x, y, value)\n } else {\n cell.textContent = utils.label(value)\n cell.setAttribute('style', 'padding: 0.3em')\n }\n delete cell.old\n }\n\n const rowFor = function (y1) {\n const y = y1.toNT()\n if (rows[y]) return rows[y]\n // @@ TODO Remove need for casting to any\n const tr: any = dom.createElement('tr')\n const header = tr.appendChild(dom.createElement('td'))\n header.setAttribute('style', 'padding: 0.3em;')\n header.textContent = utils.label(y1) // first approximation\n if (y1.termType === 'NamedNode') {\n kb.fetcher!.nowOrWhenFetched(y1.uri.split('#')[0], undefined, function (\n ok,\n _body,\n _response\n ) {\n if (ok) header.textContent = utils.label(y1)\n })\n }\n for (let i = 0; i < columns.length; i++) {\n setCell(\n tr.appendChild(dom.createElement('td')),\n $rdf.fromNT(columns[i]),\n y1,\n null\n )\n }\n tr.dataValueNT = y\n rows[y] = tr\n for (let ele = matrix.lastHeader.nextSibling; ele; ele = ele.nextSibling) {\n // skip header\n if (\n (y > ele.dataValueNT && options && options.yDecreasing) ||\n (y < ele.dataValueNT && !(options && options.yDecreasing))\n ) {\n return matrix.insertBefore(tr, ele) // return the tr\n }\n }\n return matrix.appendChild(tr) // return the tr\n }\n\n const columnNumberFor = function (x1): number {\n const xNT: any = x1.toNT() // xNT is a NT string\n let col: any = null\n // These are data columns (not headings)\n for (let i = 0; i < columns.length; i++) {\n if (columns[i] === xNT) {\n return i\n }\n\n if (\n (xNT > columns[i] && options.xDecreasing) ||\n (xNT < columns[i] && !options.xDecreasing)\n ) {\n columns = columns\n .slice(0, i)\n .concat([xNT])\n .concat(columns.slice(i))\n col = i\n break\n }\n }\n\n if (col === null) {\n col = columns.length\n columns.push(xNT)\n }\n\n // col is the number of the new column, starting from 0\n for (let row = matrix.firstChild; row; row = row.nextSibling) {\n // For every row header or not\n const y = row.dataValueNT\n const td = dom.createElement('td') // Add a new cell\n td.style.textAlign = 'center'\n if (row === matrix.firstChild) {\n td.textContent = utils.label(x1)\n } else {\n setCell(td, x1, $rdf.fromNT(y), null)\n }\n if (col === columns.length - 1) {\n row.appendChild(td)\n } else {\n let t = row.firstChild\n for (let j = 0; j < col + 1; j++) {\n // Skip header col too\n t = t.nextSibling\n }\n row.insertBefore(td, t)\n }\n }\n return col\n }\n\n const markOldCells = function () {\n for (let i = 1; i < matrix.children.length; i++) {\n const row = matrix.children[i]\n for (let j = 1; j < row.children.length; j++) {\n row.children[j].old = true\n }\n }\n }\n\n const clearOldCells = function () {\n let row, cell\n const colsUsed: any[] = []\n const rowsUsed: any[] = []\n\n if (options.set_y) {\n // Knows y values create rows\n for (let k = 0; k < options.set_y.length; k++) {\n rowsUsed[options.set_y[k]] = true\n }\n }\n if (options.set_x) {\n for (let k = 0; k < options.set_x.length; k++) {\n colsUsed[columnNumberFor(options.set_x[k]) + 1] = true\n }\n }\n\n for (let i = 1; i < matrix.children.length; i++) {\n row = matrix.children[i]\n for (let j = 1; j < row.children.length; j++) {\n cell = row.children[j]\n if (cell.old) {\n const y = $rdf.fromNT(row.dataValueNT)\n const x = $rdf.fromNT(columns[j - 1])\n setCell(cell, x, y, null)\n } else {\n rowsUsed[row.dataValueNT] = true\n colsUsed[j] = true\n }\n }\n }\n\n for (let i = 0; i < matrix.children.length; i++) {\n row = matrix.children[i]\n if (i > 0 && !rowsUsed[row.dataValueNT]) {\n delete rows[row.dataValueNT]\n matrix.removeChild(row)\n } else {\n for (let j = row.children.length - 1; j > 0; j--) {\n // backwards\n const cell = row.children[j]\n if (!colsUsed[j]) {\n row.removeChild(cell)\n }\n }\n }\n }\n const newcolumns: any[] = []\n for (let j = 0; j < columns.length; j++) {\n if (colsUsed[j + 1]) {\n newcolumns.push(columns[j])\n }\n }\n columns = newcolumns\n }\n\n matrix.refresh = function () {\n markOldCells()\n kb.query(query, addCellFromBindings, undefined, clearOldCells)\n }\n\n const addCellFromBindings = function (bindings) {\n const x = bindings[vx.toString()]\n const y = bindings[vy.toString()]\n const value = bindings[(vvalue.toString())]\n const row = rowFor(y)\n const colNo = columnNumberFor(x)\n const cell = row.children[colNo + 1] // number of Y axis headings\n setCell(cell, x, y, value)\n }\n\n if (options.set_y) {\n // Knows y values create rows\n for (let k = 0; k < options.set_y.length; k++) {\n rowFor(options.set_y[k])\n }\n }\n if (options.set_x) {\n for (let k = 0; k < options.set_x.length; k++) {\n columnNumberFor(options.set_x[k])\n }\n }\n\n kb.query(query, addCellFromBindings, undefined, whenDone) // Populate the matrix\n return matrix\n}\n"],"file":"matrix.js"}
|
|
1
|
+
{"version":3,"file":"matrix.js","names":["kb","solidLogicSingleton","store","matrixForQuery","dom","query","vx","vy","vvalue","options","whenDone","matrix","createElement","header","corner","appendChild","setAttribute","lastHeader","columns","rows","setCell","cell","x","y","value","firstChild","removeChild","style","textAlign","cellFunction","textContent","utils","label","old","rowFor","y1","toNT","tr","termType","fetcher","nowOrWhenFetched","uri","split","undefined","ok","_body","_response","i","length","$rdf","fromNT","dataValueNT","ele","nextSibling","yDecreasing","insertBefore","columnNumberFor","x1","xNT","col","xDecreasing","slice","concat","push","row","td","t","j","markOldCells","children","clearOldCells","colsUsed","rowsUsed","set_y","k","set_x","newcolumns","refresh","addCellFromBindings","bindings","toString","colNo"],"sources":["../../src/matrix/matrix.ts"],"sourcesContent":["// Build a 2D matrix of values\n//\n// dom AKA document\n// query a Query object of rdflib.js with a valid pattern\n// vx A variable object, the one to be used for the X variable (horiz)\n// vy A variable object, the one to be used for the Y variable (vertical)\n// vvalue A variable object, the one to be used for the cell value\n// returns A DOM element with the matrix in it, which has a .refresh() function.\n//\n// Options:\n// cellFunction(td, x, y, value) fill the TD element of a single cell\n// xDecreasing set true for x axis to be in decreasing order.\n// yDecreasing set true for y axis to be in decreasing order.\n// set_x array of X values to be define initial rows (order irrelevant)\n// set_y array of Y values to be define initial columns\n//\n// Features:\n// Header row at top (x axis) and left (y-axis) generated automatically.\n// Extra rows and columns are inserted as needed to hold new data points\n// matrix.refresh() will re-run the query and adjust the display\n\nimport * as utils from '../utils'\nimport * as $rdf from 'rdflib'\nimport { MatrixOptions } from './types'\nimport { solidLogicSingleton } from 'solid-logic'\n\nconst kb = solidLogicSingleton.store\n\nexport function matrixForQuery (\n dom: HTMLDocument,\n query: $rdf.Query,\n vx: $rdf.Variable,\n vy: $rdf.Variable,\n vvalue: $rdf.Variable,\n options: MatrixOptions,\n whenDone: () => void\n) {\n // @@ TODO Remove need to cast to any\n const matrix: any = dom.createElement('table')\n const header = dom.createElement('tr')\n const corner = header.appendChild(dom.createElement('td'))\n corner.setAttribute('class', 'MatrixCorner')\n matrix.appendChild(header) // just one for now\n matrix.lastHeader = header // Element before data\n let columns: any[] = [] // Vector\n const rows: any[] = [] // Associative array\n\n const setCell = function (cell, x, y, value) {\n while (cell.firstChild) {\n // Empty any previous\n cell.removeChild(cell.firstChild)\n }\n cell.setAttribute('style', '')\n cell.style.textAlign = 'center'\n\n if (options.cellFunction) {\n options.cellFunction(cell, x, y, value)\n } else {\n cell.textContent = utils.label(value)\n cell.setAttribute('style', 'padding: 0.3em')\n }\n delete cell.old\n }\n\n const rowFor = function (y1) {\n const y = y1.toNT()\n if (rows[y]) return rows[y]\n // @@ TODO Remove need for casting to any\n const tr: any = dom.createElement('tr')\n const header = tr.appendChild(dom.createElement('td'))\n header.setAttribute('style', 'padding: 0.3em;')\n header.textContent = utils.label(y1) // first approximation\n if (y1.termType === 'NamedNode') {\n kb.fetcher!.nowOrWhenFetched(y1.uri.split('#')[0], undefined, function (\n ok,\n _body,\n _response\n ) {\n if (ok) header.textContent = utils.label(y1)\n })\n }\n for (let i = 0; i < columns.length; i++) {\n setCell(\n tr.appendChild(dom.createElement('td')),\n $rdf.fromNT(columns[i]),\n y1,\n null\n )\n }\n tr.dataValueNT = y\n rows[y] = tr\n for (let ele = matrix.lastHeader.nextSibling; ele; ele = ele.nextSibling) {\n // skip header\n if (\n (y > ele.dataValueNT && options && options.yDecreasing) ||\n (y < ele.dataValueNT && !(options && options.yDecreasing))\n ) {\n return matrix.insertBefore(tr, ele) // return the tr\n }\n }\n return matrix.appendChild(tr) // return the tr\n }\n\n const columnNumberFor = function (x1): number {\n const xNT: any = x1.toNT() // xNT is a NT string\n let col: any = null\n // These are data columns (not headings)\n for (let i = 0; i < columns.length; i++) {\n if (columns[i] === xNT) {\n return i\n }\n\n if (\n (xNT > columns[i] && options.xDecreasing) ||\n (xNT < columns[i] && !options.xDecreasing)\n ) {\n columns = columns\n .slice(0, i)\n .concat([xNT])\n .concat(columns.slice(i))\n col = i\n break\n }\n }\n\n if (col === null) {\n col = columns.length\n columns.push(xNT)\n }\n\n // col is the number of the new column, starting from 0\n for (let row = matrix.firstChild; row; row = row.nextSibling) {\n // For every row header or not\n const y = row.dataValueNT\n const td = dom.createElement('td') // Add a new cell\n td.style.textAlign = 'center'\n if (row === matrix.firstChild) {\n td.textContent = utils.label(x1)\n } else {\n setCell(td, x1, $rdf.fromNT(y), null)\n }\n if (col === columns.length - 1) {\n row.appendChild(td)\n } else {\n let t = row.firstChild\n for (let j = 0; j < col + 1; j++) {\n // Skip header col too\n t = t.nextSibling\n }\n row.insertBefore(td, t)\n }\n }\n return col\n }\n\n const markOldCells = function () {\n for (let i = 1; i < matrix.children.length; i++) {\n const row = matrix.children[i]\n for (let j = 1; j < row.children.length; j++) {\n row.children[j].old = true\n }\n }\n }\n\n const clearOldCells = function () {\n let row, cell\n const colsUsed: any[] = []\n const rowsUsed: any[] = []\n\n if (options.set_y) {\n // Knows y values create rows\n for (let k = 0; k < options.set_y.length; k++) {\n rowsUsed[options.set_y[k]] = true\n }\n }\n if (options.set_x) {\n for (let k = 0; k < options.set_x.length; k++) {\n colsUsed[columnNumberFor(options.set_x[k]) + 1] = true\n }\n }\n\n for (let i = 1; i < matrix.children.length; i++) {\n row = matrix.children[i]\n for (let j = 1; j < row.children.length; j++) {\n cell = row.children[j]\n if (cell.old) {\n const y = $rdf.fromNT(row.dataValueNT)\n const x = $rdf.fromNT(columns[j - 1])\n setCell(cell, x, y, null)\n } else {\n rowsUsed[row.dataValueNT] = true\n colsUsed[j] = true\n }\n }\n }\n\n for (let i = 0; i < matrix.children.length; i++) {\n row = matrix.children[i]\n if (i > 0 && !rowsUsed[row.dataValueNT]) {\n delete rows[row.dataValueNT]\n matrix.removeChild(row)\n } else {\n for (let j = row.children.length - 1; j > 0; j--) {\n // backwards\n const cell = row.children[j]\n if (!colsUsed[j]) {\n row.removeChild(cell)\n }\n }\n }\n }\n const newcolumns: any[] = []\n for (let j = 0; j < columns.length; j++) {\n if (colsUsed[j + 1]) {\n newcolumns.push(columns[j])\n }\n }\n columns = newcolumns\n }\n\n matrix.refresh = function () {\n markOldCells()\n kb.query(query, addCellFromBindings, undefined, clearOldCells)\n }\n\n const addCellFromBindings = function (bindings) {\n const x = bindings[vx.toString()]\n const y = bindings[vy.toString()]\n const value = bindings[(vvalue.toString())]\n const row = rowFor(y)\n const colNo = columnNumberFor(x)\n const cell = row.children[colNo + 1] // number of Y axis headings\n setCell(cell, x, y, value)\n }\n\n if (options.set_y) {\n // Knows y values create rows\n for (let k = 0; k < options.set_y.length; k++) {\n rowFor(options.set_y[k])\n }\n }\n if (options.set_x) {\n for (let k = 0; k < options.set_x.length; k++) {\n columnNumberFor(options.set_x[k])\n }\n }\n\n kb.query(query, addCellFromBindings, undefined, whenDone) // Populate the matrix\n return matrix\n}\n"],"mappings":";;;;;;;;;AAqBA;;AACA;;AAEA;;;;;;AAxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,IAAMA,EAAE,GAAGC,+BAAA,CAAoBC,KAA/B;;AAEO,SAASC,cAAT,CACLC,GADK,EAELC,KAFK,EAGLC,EAHK,EAILC,EAJK,EAKLC,MALK,EAMLC,OANK,EAOLC,QAPK,EAQL;EACA;EACA,IAAMC,MAAW,GAAGP,GAAG,CAACQ,aAAJ,CAAkB,OAAlB,CAApB;EACA,IAAMC,MAAM,GAAGT,GAAG,CAACQ,aAAJ,CAAkB,IAAlB,CAAf;EACA,IAAME,MAAM,GAAGD,MAAM,CAACE,WAAP,CAAmBX,GAAG,CAACQ,aAAJ,CAAkB,IAAlB,CAAnB,CAAf;EACAE,MAAM,CAACE,YAAP,CAAoB,OAApB,EAA6B,cAA7B;EACAL,MAAM,CAACI,WAAP,CAAmBF,MAAnB,EANA,CAM2B;;EAC3BF,MAAM,CAACM,UAAP,GAAoBJ,MAApB,CAPA,CAO2B;;EAC3B,IAAIK,OAAc,GAAG,EAArB,CARA,CAQwB;;EACxB,IAAMC,IAAW,GAAG,EAApB,CATA,CASuB;;EAEvB,IAAMC,OAAO,GAAG,SAAVA,OAAU,CAAUC,IAAV,EAAgBC,CAAhB,EAAmBC,CAAnB,EAAsBC,KAAtB,EAA6B;IAC3C,OAAOH,IAAI,CAACI,UAAZ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{"version":3,"file":"types.js","names":[],"sources":["../../src/matrix/types.ts"],"sourcesContent":["export type MatrixOptions = {\n cellFunction?: (td, x, y, value) => string\n xDecreasing?: boolean\n yDecreasing?: boolean\n // eslint-disable-next-line camelcase\n set_x: any[]\n // eslint-disable-next-line camelcase\n set_y: any[]\n}\n"],"mappings":""}
|
package/lib/media/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":["media","cameraCaptureControl","cameraButton"],"sources":["../../src/media/index.ts"],"sourcesContent":["import {\n cameraCaptureControl,\n cameraButton\n} from './media-capture'\n\nexport const media = {\n cameraCaptureControl,\n cameraButton\n}\n"],"mappings":";;;;;;;AAAA;;AAKO,IAAMA,KAAK,GAAG;EACnBC,oBAAoB,EAApBA,kCADmB;EAEnBC,YAAY,EAAZA;AAFmB,CAAd"}
|
|
@@ -10,8 +10,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
exports.cameraButton = cameraButton;
|
|
11
11
|
exports.cameraCaptureControl = cameraCaptureControl;
|
|
12
12
|
|
|
13
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
|
-
|
|
15
13
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
14
|
|
|
17
15
|
var debug = _interopRequireWildcard(require("../debug"));
|
|
@@ -24,22 +22,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
24
22
|
|
|
25
23
|
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; }
|
|
26
24
|
|
|
27
|
-
/// /////////////////////////////////////////////
|
|
28
|
-
|
|
29
|
-
// Media input widget
|
|
30
|
-
//
|
|
31
|
-
//
|
|
32
|
-
// Workflow:
|
|
33
|
-
// The HTML5 functionality (on mobille) is to prompt for either
|
|
34
|
-
// a realtime camera capture , OR a selection from images already ont the device
|
|
35
|
-
// (eg camera roll).
|
|
36
|
-
//
|
|
37
|
-
// The solid alternative is to either take a phtoto
|
|
38
|
-
// or access cemra roll (etc) OR to access solid cloud storage of favorite photo almbums.
|
|
39
|
-
// (Especially latest taken ones)
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
/** @module mediaCapture */
|
|
25
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
26
|
+
|
|
43
27
|
var cameraIcon = _iconBase.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
|
|
44
28
|
|
|
45
29
|
var retakeIcon = _iconBase.icons.iconBase + 'noun_479395.svg'; // Get it from github
|
|
@@ -194,8 +178,8 @@ function cameraButton(dom, store, getImageDoc, doneCallback) {
|
|
|
194
178
|
}
|
|
195
179
|
|
|
196
180
|
function _restoreButton() {
|
|
197
|
-
_restoreButton = (0, _asyncToGenerator2["default"])( /*#__PURE__*/
|
|
198
|
-
return
|
|
181
|
+
_restoreButton = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(imageDoc) {
|
|
182
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
199
183
|
while (1) {
|
|
200
184
|
switch (_context.prev = _context.next) {
|
|
201
185
|
case 0:
|