solid-ui 2.4.30 → 2.4.31
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/solid-ui.js +1520 -1074
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/login/login.d.ts.map +1 -1
- package/lib/login/login.js +14 -18
- package/lib/login/login.js.map +1 -1
- package/lib/media/media-capture.d.ts +2 -2
- package/lib/media/media-capture.d.ts.map +1 -1
- package/lib/media/media-capture.js +11 -15
- package/lib/media/media-capture.js.map +1 -1
- package/lib/pad.d.ts +2 -2
- package/lib/pad.d.ts.map +1 -1
- package/lib/pad.js +15 -39
- package/lib/pad.js.map +1 -1
- package/lib/participation.d.ts +7 -7
- package/lib/participation.d.ts.map +1 -1
- package/lib/participation.js +26 -24
- package/lib/participation.js.map +1 -1
- package/lib/style.js +93 -85
- package/lib/style.js.map +1 -1
- package/lib/styleConstants.js +35 -0
- package/lib/styleConstants.js.map +1 -0
- package/lib/tabs.d.ts +0 -125
- package/lib/tabs.d.ts.map +1 -1
- package/lib/tabs.js +15 -8
- package/lib/tabs.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/lib/widgets/dragAndDrop.js +11 -19
- package/lib/widgets/dragAndDrop.js.map +1 -1
- package/lib/widgets/error.d.ts.map +1 -1
- package/lib/widgets/error.js +9 -2
- package/lib/widgets/error.js.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.d.ts.map +1 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js +2 -1
- package/lib/widgets/forms/autocomplete/autocompletePicker.js.map +1 -1
- package/lib/widgets/forms/basic.d.ts.map +1 -1
- package/lib/widgets/forms/basic.js +5 -4
- package/lib/widgets/forms/basic.js.map +1 -1
- package/lib/widgets/forms/fieldParams.js +2 -2
- package/lib/widgets/forms/fieldParams.js.map +1 -1
- package/lib/widgets/forms.js +9 -8
- package/lib/widgets/forms.js.map +1 -1
- package/package.json +4 -4
package/lib/login/login.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/login/login.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EAAa,SAAS,EAAM,MAAM,QAAQ,CAAA;AAGjD,OAAO,EACL,UAAU,EACV,qBAAqB,EAYtB,MAAM,aAAa,CAAA;AAwBpB;;;;GAIG;AAEH,wBAAgB,cAAc,CAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAwB9F;AAED;;;;;;;GAOG;AAEH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAwDhC;AAED;;;;;;GAMG;AAEH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,qBAAqB,CAAC,CAiBhC;AAED;;;;IAII;AACJ,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,SAAS,EACnB,QAAQ,CAAC,EAAE,OAAO,GACjB,OAAO,CAAC,qBAAqB,CAAC,CAShC;AAED,wBAAgB,UAAU,CAAE,OAAO,KAAA,EAAE,KAAK,KAAA,UAIzC;AACD;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,KAAA,EACR,QAAQ,KAAA,GACP,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAgEvC;AAED,wBAAgB,qBAAqB,CAAE,OAAO,KAAA,EAAE,KAAK,KAAA,EAAE,KAAK,KAAA,OAY3D;AACD;;IAEI;AACJ,wBAAsB,gBAAgB,CAAE,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAA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ope) {
|
|
|
425
425
|
function registrationList(_x9, _x10) {
|
|
426
426
|
return _registrationList.apply(this, arguments);
|
|
427
427
|
} // registrationList
|
|
428
|
+
/**
|
|
429
|
+
* Bootstrapping identity
|
|
430
|
+
* (Called by `loginStatusBox()`)
|
|
431
|
+
*
|
|
432
|
+
* @param dom
|
|
433
|
+
* @param setUserCallback
|
|
434
|
+
*
|
|
435
|
+
* @returns
|
|
436
|
+
*/
|
|
428
437
|
function _registrationList() {
|
|
429
438
|
_registrationList = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(context, options) {
|
|
430
439
|
var dom, div, box, scopes, table, tbody, _iterator2, _step2, scope, headingRow, items, _iterator3, _step3, _loop;
|
|
@@ -556,23 +565,10 @@ function _registrationList() {
|
|
|
556
565
|
}));
|
|
557
566
|
return _registrationList.apply(this, arguments);
|
|
558
567
|
}
|
|
559
|
-
function getDefaultSignInButtonStyle() {
|
|
560
|
-
return 'padding: 1em; border-radius:0.5em; font-size: 100%;';
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* Bootstrapping identity
|
|
565
|
-
* (Called by `loginStatusBox()`)
|
|
566
|
-
*
|
|
567
|
-
* @param dom
|
|
568
|
-
* @param setUserCallback
|
|
569
|
-
*
|
|
570
|
-
* @returns
|
|
571
|
-
*/
|
|
572
568
|
function signInOrSignUpBox(dom, setUserCallback) {
|
|
573
569
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
574
570
|
options = options || {};
|
|
575
|
-
var signInButtonStyle = options.buttonStyle ||
|
|
571
|
+
var signInButtonStyle = options.buttonStyle || style.signInAndUpButtonStyle;
|
|
576
572
|
var box = dom.createElement('div');
|
|
577
573
|
var magicClassName = 'SolidSignInOrSignUpBox';
|
|
578
574
|
debug.log('widgets.signInOrSignUpBox');
|
|
@@ -585,7 +581,7 @@ function signInOrSignUpBox(dom, setUserCallback) {
|
|
|
585
581
|
box.appendChild(signInPopUpButton);
|
|
586
582
|
signInPopUpButton.setAttribute('type', 'button');
|
|
587
583
|
signInPopUpButton.setAttribute('value', 'Log in');
|
|
588
|
-
signInPopUpButton.setAttribute('style', "".concat(signInButtonStyle
|
|
584
|
+
signInPopUpButton.setAttribute('style', "".concat(signInButtonStyle).concat(style.headerBannerLoginInput) + style.signUpBackground);
|
|
589
585
|
_solidLogic.authSession.onLogin(function () {
|
|
590
586
|
var me = _solidLogic.authn.currentUser();
|
|
591
587
|
// const sessionInfo = authSession.info
|
|
@@ -626,7 +622,7 @@ function signInOrSignUpBox(dom, setUserCallback) {
|
|
|
626
622
|
box.appendChild(signupButton);
|
|
627
623
|
signupButton.setAttribute('type', 'button');
|
|
628
624
|
signupButton.setAttribute('value', 'Sign Up for Solid');
|
|
629
|
-
signupButton.setAttribute('style', "".concat(signInButtonStyle
|
|
625
|
+
signupButton.setAttribute('style', "".concat(signInButtonStyle).concat(style.headerBannerLoginInput) + style.signInBackground);
|
|
630
626
|
signupButton.addEventListener('click', function (_event) {
|
|
631
627
|
var signupMgr = new _signup.Signup();
|
|
632
628
|
signupMgr.signup().then(function (uri) {
|
|
@@ -794,7 +790,7 @@ function loginStatusBox(dom) {
|
|
|
794
790
|
});
|
|
795
791
|
}
|
|
796
792
|
function logoutButton(me, options) {
|
|
797
|
-
var signInButtonStyle = options.buttonStyle ||
|
|
793
|
+
var signInButtonStyle = options.buttonStyle || style.signInAndUpButtonStyle;
|
|
798
794
|
var logoutLabel = 'WebID logout';
|
|
799
795
|
if (me) {
|
|
800
796
|
var nick = _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('nick')) || _solidLogic.solidLogicSingleton.store.any(me, ns.foaf('name'));
|
|
@@ -806,7 +802,7 @@ function loginStatusBox(dom) {
|
|
|
806
802
|
// signOutButton.className = 'WebIDCancelButton'
|
|
807
803
|
signOutButton.setAttribute('type', 'button');
|
|
808
804
|
signOutButton.setAttribute('value', logoutLabel);
|
|
809
|
-
signOutButton.setAttribute('style', "".concat(signInButtonStyle
|
|
805
|
+
signOutButton.setAttribute('style', "".concat(signInButtonStyle));
|
|
810
806
|
signOutButton.addEventListener('click', logoutButtonHandler, false);
|
|
811
807
|
return signOutButton;
|
|
812
808
|
}
|
package/lib/login/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","names":["_rdflib","require","_solidLogic","debug","_interopRequireWildcard","style","_log","ns","_signup","utils","widgets","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","F","s","done","value","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","store","solidLogicSingleton","_solidLogicSingleton$","profile","loadPreferences","loadProfile","_solidLogicSingleton$2","typeIndex","getScopedAppInstances","getRegistrations","loadAllTypeIndexes","getScopedAppsFromIndex","deleteTypeIndexRegistration","ensureLoggedIn","context","me","authn","currentUser","saveUser","Promise","resolve","checkUser","then","webId","log","concat","div","dom","box","loginStatusBox","webIdUri","appendChild","ensureLoadedPreferences","_x","_ensureLoadedPreferences","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee4","progressDisplay","preferencesFile","m2","wrap","_callee4$","_context4","prev","abrupt","ensureLoadedProfile","sent","parentNode","removeChild","t0","UnauthorizedError","alert","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotEditableError","WebOperationError","FetchError","status","message","Error","stop","_x2","_ensureLoadedProfile","_callee5","logInContext","_callee5$","_context5","publicProfile","errorMessageBlock","findAppInstances","_x3","_x4","_x5","_findAppInstances","_callee6","theClass","isPublic","items","_callee6$","_context6","filter","item","scope","label","instances","map","instance","scopeLabel","mine","sameTerm","agent","registrationControl","_x6","_x7","_x8","_registrationControl","_callee7","registrationStatements","renderScopeCheckbox","scopes","msg","tbody","form","_iterator","_step","row","_callee7$","_context7","_renderScopeCheckbox","statements","index","noun","buildCheckboxForm","_registrationStatemen","registrations","reg","newThing","st","solid","createElement","innerHTML","textContent","setAttribute","children","BlankNode","renderScopeHeadingRow","backgroundColor","cell","backgoundColor","header","textAlign","registrationList","_x9","_x10","_registrationList","_callee9","options","table","_iterator2","_step2","headingRow","_iterator3","_step3","_loop","_callee9$","_context10","firstChild","type","display","_loop$","_context9","personTR","deleteFunction","_deleteFunction","_callee8","_callee8$","_context8","paddingLeft","delegateYield","t1","finish","t2","getDefaultSignInButtonStyle","signInOrSignUpBox","setUserCallback","undefined","signInButtonStyle","buttonStyle","magicClassName","signInPopUpButton","headerBannerLoginInput","authSession","onLogin","webIdURI","uri","divs","getElementsByClassName","parent","addEventListener","offline","offlineTestID","renderSignInPopup","signupButton","_event","signupMgr","Signup","signup","issuerPopup","body","issuerPopupBox","issuerPopupBoxTopMenu","issuerPopupBoxLabel","innerText","issuerPopupBoxCloseButton","remove","loginToIssuer","_ref","_callee","issuerUri","preLoginRedirectHash","locationUrl","_callee$","_context","updater","flagAuthorizationMetadata","URL","href","hash","localStorage","setItem","login","redirectUrl","oidcIssuer","_x11","issuerTextContainer","issuerTextInputContainer","issuerTextLabel","issuerTextInput","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","getSuggestedIssuers","forEach","issuerInfo","issuerButton","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","logoutButton","logoutLabel","nick","any","foaf","signOutButton","sessionInfo","info","isLoggedIn","sym","clearElement","trackSession","onLogout","_callee2","issuer","wellKnownUri","wellKnownResult","openidConfiguration","_callee2$","_context2","pathname","fetch","json","end_session_endpoint","credentials","reload","selectWorkspace","appDetails","callbackWS","appPathSegment","say","background","figureOutBase","ws","newBaseNode","space","newBaseString","split","now","Date","getTime","displayOptions","makeNewWorkspace","_x12","_makeNewWorkspace","_callee3","newBase","newWs","newData","_callee3$","_context3","padding","encodeURI","askName","update","id","w","each","storages","ldp","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","holds","rdf","col1","col2","col3","tr","localStyle","comment","cellStyle","deselectedStyle","anyValue","ui","reduce","b","charCodeAt","bgcolor","target","rdfs","disabled","trLast","newAppInstance","callback","gotWS","base","getUserRoles","_getUserRoles","_callee10","_yield$ensureLoadedPr","_callee10$","_context11","doc","filterAvailablePanes","_x13","_filterAvailablePanes","_callee11","panes","userRoles","_callee11$","_context12","pane","isMatchingAudience","audience","isMatch","audienceRole","find","role","equals"],"sources":["../../src/login/login.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/**\n * Signing in, signing up, profile and preferences reloading\n * Type index management\n *\n * Many functions in this module take a context object which\n * holds various RDF symbols, add to it, and return a promise of it.\n *\n * * `me` RDF symbol for the user's WebID\n * * `publicProfile` The user's public profile, iff loaded\n * * `preferencesFile` The user's personal preference file, iff loaded\n * * `index.public` The user's public type index file\n * * `index.private` The user's private type index file\n *\n * Not RDF symbols:\n * * `noun` A string in english for the type of thing -- like \"address book\"\n * * `instance` An array of nodes which are existing instances\n * * `containers` An array of nodes of containers of instances\n * * `div` A DOM element where UI can be displayed\n * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages\n * *\n * * Vocabulary: \"load\" loads a file if it exists;\n * * 'Ensure\" CREATES the file if it does not exist (if it can) and then loads it.\n * @packageDocumentation\n */\nimport { PaneDefinition } from 'pane-registry'\nimport { BlankNode, NamedNode, st } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n authn,\n authSession,\n CrossOriginForbiddenError,\n FetchError,\n getSuggestedIssuers,\n NotEditableError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError,\n WebOperationError\n} from 'solid-logic'\nimport * as debug from '../debug'\nimport * as style from '../style'\nimport { alert } from '../log'\nimport * as ns from '../ns.js'\nimport { Signup } from '../signup/signup.js'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\n\nconst store = solidLogicSingleton.store\n\nconst {\n loadPreferences,\n loadProfile\n} = solidLogicSingleton.profile\n\nconst {\n getScopedAppInstances,\n getRegistrations,\n loadAllTypeIndexes,\n getScopedAppsFromIndex,\n deleteTypeIndexRegistration\n} = solidLogicSingleton.typeIndex\n\n/**\n * Resolves with the logged in user's WebID\n *\n * @param context\n */\n// used to be logIn\nexport function ensureLoggedIn (context: AuthenticationContext): Promise<AuthenticationContext> {\n const me = authn.currentUser()\n if (me) {\n authn.saveUser(me, context)\n return Promise.resolve(context)\n }\n\n return new Promise((resolve) => {\n authn.checkUser().then((webId) => {\n // Already logged in?\n if (webId) {\n debug.log(`logIn: Already logged in as ${webId}`)\n return resolve(context)\n }\n if (!context.div || !context.dom) {\n return resolve(context)\n }\n const box = loginStatusBox(context.dom, (webIdUri) => {\n authn.saveUser(webIdUri, context)\n resolve(context) // always pass growing context\n })\n context.div.appendChild(box)\n })\n })\n}\n\n/**\n * Loads preference file\n * Do this after having done log in and load profile\n *\n * @private\n *\n * @param context\n */\n// used to be logInLoadPreferences\nexport async function ensureLoadedPreferences (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.preferencesFile) return Promise.resolve(context) // already done\n\n // const statusArea = context.statusArea || context.div || null\n let progressDisplay\n /* COMPLAIN FUNCTION NOT USED/TAKING IT OUT FOR NOW\n function complain (message) {\n message = `ensureLoadedPreferences: ${message}`\n if (statusArea) {\n // statusArea.innerHTML = ''\n statusArea.appendChild(widgets.errorMessageBlock(context.dom, message))\n }\n debug.log(message)\n // reject(new Error(message))\n } */\n try {\n context = await ensureLoadedProfile(context)\n\n // console.log('back in Solid UI after logInLoadProfile', context)\n const preferencesFile = await loadPreferences(context.me as NamedNode)\n if (progressDisplay) {\n progressDisplay.parentNode.removeChild(progressDisplay)\n }\n context.preferencesFile = preferencesFile\n } catch (err) {\n let m2: string\n if (err instanceof UnauthorizedError) {\n m2 =\n 'Ooops - you are not authenticated (properly logged in) to for me to read your preference file. Try loggin out and logging in?'\n alert(m2)\n } else if (err instanceof CrossOriginForbiddenError) {\n m2 = `Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`\n context.preferencesFileError = m2\n return context\n } else if (err instanceof SameOriginForbiddenError) {\n m2 =\n 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof NotEditableError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof WebOperationError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n } else if (err instanceof FetchError) {\n m2 = `Strange: Error ${err.status} trying to read your preference file.${err.message}`\n alert(m2)\n } else {\n throw new Error(`(via loadPrefs) ${err}`)\n }\n }\n return context\n}\n\n/**\n * Logs the user in and loads their WebID profile document into the store\n *\n * @param context\n *\n * @returns Resolves with the context after login / fetch\n */\n// used to be logInLoadProfile\nexport async function ensureLoadedProfile (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.publicProfile) {\n return context\n } // already done\n try {\n const logInContext = await ensureLoggedIn(context)\n if (!logInContext.me) {\n throw new Error('Could not log in')\n }\n context.publicProfile = await loadProfile(logInContext.me)\n } catch (err) {\n if (context.div && context.dom) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, err.message))\n }\n throw new Error(`Can't log in: ${err}`)\n }\n return context\n}\n\n/**\n * Returns promise of context with arrays of symbols\n *\n * leaving the `isPublic` param undefined will bring in community index things, too\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n let items = context.me ? await getScopedAppInstances(theClass, context.me) : []\n if (isPublic === true) { // old API - not recommended!\n items = items.filter(item => item.scope.label === 'public')\n } else if (isPublic === false) {\n items = items.filter(item => item.scope.label === 'private')\n }\n context.instances = items.map(item => item.instance)\n return context\n}\n\nexport function scopeLabel (context, scope) {\n const mine = context.me && context.me.sameTerm(scope.agent)\n const name = mine ? '' : utils.label(scope.agent) + ' '\n return `${name}${scope.label}`\n}\n/**\n * UI to control registration of instance\n */\nexport async function registrationControl (\n context: AuthenticationContext,\n instance,\n theClass\n): Promise<AuthenticationContext | void> {\n function registrationStatements (index) {\n const registrations = getRegistrations(instance, theClass)\n const reg = registrations.length ? registrations[0] : widgets.newThing(index)\n return [\n st(reg, ns.solid('instance'), instance, index),\n st(reg, ns.solid('forClass'), theClass, index)\n ]\n }\n\n function renderScopeCheckbox (scope) {\n const statements = registrationStatements(scope.index)\n const name = scopeLabel(context, scope)\n const label = `${name} link to this ${context.noun}`\n return widgets.buildCheckboxForm(\n context.dom,\n solidLogicSingleton.store,\n label,\n null,\n statements,\n form,\n scope.index\n )\n }\n /// / body of registrationControl\n const dom = context.dom\n if (!dom || !context.div) {\n throw new Error('registrationControl: need dom and div')\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n const me = context.me\n if (!me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let scopes // @@ const\n try {\n scopes = await loadAllTypeIndexes(me)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Lists of stuff not available)'\n context.div.appendChild(dom.createElement('p')).textContent = msg\n } else if (context.div) {\n msg = `registrationControl: Type indexes not available: ${e}`\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n return context\n }\n\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;')\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n for (const scope of scopes) {\n const row = tbody.appendChild(dom.createElement('tr'))\n row.appendChild(renderScopeCheckbox(scope)) // @@ index\n }\n return context\n}\n\nexport function renderScopeHeadingRow (context, store, scope) {\n const backgroundColor = { private: '#fee', public: '#efe' }\n const { dom } = context\n const name = scopeLabel(context, scope)\n const row = dom.createElement('tr')\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.backgoundColor = backgroundColor[scope.label] || 'white'\n const header = cell.appendChild(dom.createElement('h3'))\n header.textContent = name + ' links'\n header.style.textAlign = 'left'\n return row\n}\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (context: AuthenticationContext, options: {\n private?: boolean\n public?: boolean\n type?: NamedNode\n}): Promise<AuthenticationContext> {\n const dom = context.dom as HTMLDocument\n const div = context.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context\n }\n\n const scopes = await loadAllTypeIndexes(context.me) // includes community indexes\n\n // console.log('@@ registrationList ', scopes)\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;')\n const table = box.firstChild as HTMLElement\n const tbody = table.firstChild as HTMLElement\n\n for (const scope of scopes) { // need some predicate for listing/adding agents\n const headingRow = renderScopeHeadingRow(context, store, scope)\n tbody.appendChild(headingRow)\n const items = await getScopedAppsFromIndex(scope, options.type || null) // any class\n if (items.length === 0) headingRow.style.display = 'none'\n // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)\n for (const item of items) {\n const row = widgets.personTR(dom, ns.solid('instance'), item.instance, {\n deleteFunction: async () => {\n await deleteTypeIndexRegistration(item)\n tbody.removeChild(row)\n }\n })\n row.children[0].style.paddingLeft = '3em'\n\n tbody.appendChild(row)\n }\n }\n return context\n} // registrationList\n\nfunction getDefaultSignInButtonStyle (): string {\n return 'padding: 1em; border-radius:0.5em; font-size: 100%;'\n}\n\n/**\n * Bootstrapping identity\n * (Called by `loginStatusBox()`)\n *\n * @param dom\n * @param setUserCallback\n *\n * @returns\n */\nfunction signInOrSignUpBox (\n dom: HTMLDocument,\n setUserCallback: (user: string) => void,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n options = options || {}\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n\n 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.setAttribute('style', 'display:flex;')\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;${style.headerBannerLoginInput}`)\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;${style.headerBannerLoginInput}`)\n\n signupButton.addEventListener(\n 'click',\n function (_event) {\n const signupMgr = new Signup()\n signupMgr.signup().then(function (uri) {\n debug.log('signInOrSignUpBox signed up ' + uri)\n setUserCallback(uri)\n })\n },\n false\n )\n return box\n}\n\nexport function renderSignInPopup (dom: HTMLDocument) {\n /**\n * Issuer Menu\n */\n const issuerPopup = dom.createElement('div')\n issuerPopup.setAttribute(\n 'style',\n 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;'\n )\n dom.body.appendChild(issuerPopup)\n const issuerPopupBox = dom.createElement('div')\n issuerPopupBox.setAttribute(\n 'style',\n `\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n `\n )\n issuerPopup.appendChild(issuerPopupBox)\n const issuerPopupBoxTopMenu = dom.createElement('div')\n issuerPopupBoxTopMenu.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n `\n )\n issuerPopupBox.appendChild(issuerPopupBoxTopMenu)\n const issuerPopupBoxLabel = dom.createElement('label')\n issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800')\n issuerPopupBoxLabel.innerText = 'Select an identity provider'\n const issuerPopupBoxCloseButton = dom.createElement('button')\n issuerPopupBoxCloseButton.innerHTML =\n '<img src=\"https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg\" style=\"width: 2em; height: 2em;\" title=\"Cancel\">'\n issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;')\n issuerPopupBoxCloseButton.addEventListener('click', () => {\n issuerPopup.remove()\n })\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxLabel)\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton)\n\n const loginToIssuer = async (issuerUri: string) => {\n try {\n // clear authorization metadata from store\n solidLogicSingleton.store.updater.flagAuthorizationMetadata() as any\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 const locationUrl = new URL(window.location.href)\n locationUrl.hash = '' // remove hash part\n await authSession.login({\n redirectUrl: locationUrl.href,\n oidcIssuer: issuerUri\n })\n } catch (err) {\n alert(err.message)\n }\n }\n\n /**\n * Text-based idp selection\n */\n const issuerTextContainer = dom.createElement('div')\n issuerTextContainer.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerTextInputContainer = dom.createElement('div')\n issuerTextInputContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: row;\n `\n )\n const issuerTextLabel = dom.createElement('label')\n issuerTextLabel.innerText = 'Enter the URL of your identity provider:'\n issuerTextLabel.setAttribute('style', 'color: #888')\n const issuerTextInput = dom.createElement('input')\n issuerTextInput.setAttribute('type', 'text')\n issuerTextInput.setAttribute(\n 'style',\n 'margin-left: 0 !important; flex: 1; margin-right: 5px !important'\n )\n issuerTextInput.setAttribute('placeholder', 'https://example.com')\n issuerTextInput.value = localStorage.getItem('loginIssuer') || ''\n const issuerTextGoButton = dom.createElement('button')\n issuerTextGoButton.innerText = 'Go'\n issuerTextGoButton.setAttribute('style', 'margin-top: 12px; margin-bottom: 12px;')\n issuerTextGoButton.addEventListener('click', () => {\n loginToIssuer(issuerTextInput.value)\n })\n issuerTextContainer.appendChild(issuerTextLabel)\n issuerTextInputContainer.appendChild(issuerTextInput)\n issuerTextInputContainer.appendChild(issuerTextGoButton)\n issuerTextContainer.appendChild(issuerTextInputContainer)\n issuerPopupBox.appendChild(issuerTextContainer)\n\n /**\n * Button-based idp selection\n */\n const issuerButtonContainer = dom.createElement('div')\n issuerButtonContainer.setAttribute(\n 'style',\n `\n display: flex;\n flex-direction: column;\n padding-top: 10px;\n `\n )\n const issuerBottonLabel = dom.createElement('label')\n issuerBottonLabel.innerText = 'Or pick an identity provider from the list below:'\n issuerBottonLabel.setAttribute('style', 'color: #888')\n issuerButtonContainer.appendChild(issuerBottonLabel)\n getSuggestedIssuers().forEach((issuerInfo) => {\n const issuerButton = dom.createElement('button')\n issuerButton.innerText = issuerInfo.name\n issuerButton.setAttribute('style', 'height: 38px; margin-top: 10px')\n issuerButton.addEventListener('click', () => {\n loginToIssuer(issuerInfo.uri)\n })\n issuerButtonContainer.appendChild(issuerButton)\n })\n issuerPopupBox.appendChild(issuerButtonContainer)\n}\n\n/**\n * Login status box\n *\n * A big sign-up/sign in box or a logout box depending on the state\n *\n * @param dom\n * @param listener\n *\n * @returns\n */\nexport function loginStatusBox (\n dom: HTMLDocument,\n listener: ((uri: string | null) => void) | null = null,\n options: {\n buttonStyle?: string;\n } = {}\n): HTMLElement {\n // 20190630\n let me = offlineTestID()\n // @@ TODO Remove the need to cast HTML element to any\n const box: any = dom.createElement('div')\n\n function setIt (newidURI) {\n if (!newidURI) {\n return\n }\n\n // const uri = newidURI.uri || newidURI\n // me = sym(uri)\n me = authn.saveUser(newidURI)\n box.refresh()\n if (listener) listener(me!.uri)\n }\n\n function logoutButtonHandler (_event) {\n const oldMe = me\n authSession.logout().then(\n function () {\n const message = `Your WebID was ${oldMe}. It has been forgotten.`\n me = null\n try {\n alert(message)\n } catch (e) {\n window.alert(message)\n }\n box.refresh()\n if (listener) listener(null)\n },\n (err) => {\n alert('Fail to log out:' + err)\n }\n )\n }\n\n function logoutButton (me, options) {\n const signInButtonStyle = options.buttonStyle || getDefaultSignInButtonStyle()\n let logoutLabel = 'WebID logout'\n if (me) {\n const nick =\n solidLogicSingleton.store.any(me, ns.foaf('nick')) ||\n solidLogicSingleton.store.any(me, ns.foaf('name'))\n if (nick) {\n logoutLabel = 'Logout ' + nick.value\n }\n }\n const signOutButton = dom.createElement('input')\n // signOutButton.className = 'WebIDCancelButton'\n signOutButton.setAttribute('type', 'button')\n signOutButton.setAttribute('value', logoutLabel)\n signOutButton.setAttribute('style', `${signInButtonStyle}background-color: #eee;`)\n signOutButton.addEventListener('click', logoutButtonHandler, false)\n return signOutButton\n }\n\n box.refresh = function () {\n const sessionInfo = authSession.info\n if (sessionInfo && sessionInfo.webId && sessionInfo.isLoggedIn) {\n me = solidLogicSingleton.store.sym(sessionInfo.webId)\n } else {\n me = null\n }\n if ((me && box.me !== me.uri) || (!me && box.me)) {\n widgets.clearElement(box)\n if (me) {\n box.appendChild(logoutButton(me, options))\n } else {\n box.appendChild(signInOrSignUpBox(dom, setIt, options))\n }\n }\n box.me = me ? me.uri : null\n }\n box.refresh()\n\n function trackSession () {\n me = authn.currentUser()\n box.refresh()\n }\n trackSession()\n\n authSession.onLogin(trackSession)\n authSession.onLogout(trackSession)\n box.me = '99999' // Force refresh\n box.refresh()\n return box\n}\n\nauthSession.onLogout(async () => {\n const issuer = window.localStorage.getItem('loginIssuer')\n if (issuer) {\n try {\n // clear authorization metadata from store\n solidLogicSingleton.store.updater.flagAuthorizationMetadata() as any\n\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.setAttribute('style', 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.setAttribute('style', 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.setAttribute('style', 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, localStyle, 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 localStyle = solidLogicSingleton.store.anyValue(ws, ns.ui('style'))\n if (!localStyle) {\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 localStyle = `color: black ; background-color: ${bgcolor};`\n }\n col2.setAttribute('style', deselectedStyle + localStyle)\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 + localStyle)\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,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAAC,WAAA,GAAAD,OAAA;AAeA,IAAAE,KAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,uBAAA,CAAAH,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,EAAA,GAAAH,uBAAA,CAAAH,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,KAAA,GAAAL,uBAAA,CAAAH,OAAA;AACA,IAAAS,OAAA,GAAAN,uBAAA,CAAAH,OAAA;AAAqC,SAAAU,yBAAAC,C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,CAACpQ,MAAM,CAAC,UAACwQ,IAAI;YAAA,OAAKC,kBAAkB,CAACD,IAAI,EAAEH,SAAS,CAAC;UAAA,EAAC;QAAA;QAAA;UAAA,OAAAE,UAAA,CAAA3R,IAAA;MAAA;IAAA,GAAAuR,SAAA;EAAA,CACnE;EAAA,OAAAD,qBAAA,CAAAxT,KAAA,OAAAC,SAAA;AAAA;AAED,SAAS8T,kBAAkBA,CAAED,IAAoB,EAAEH,SAA2B,EAAW;EACvF,IAAMK,QAAQ,GAAGF,IAAI,CAACE,QAAQ,IAAI,EAAE;EACpC,OAAOA,QAAQ,CAAC7B,MAAM,CACpB,UAAC8B,OAAO,EAAEC,YAAY;IAAA,OAAKD,OAAO,IAAI,CAAC,CAACN,SAAS,CAACQ,IAAI,CAAC,UAACC,IAAI;MAAA,OAAKA,IAAI,CAACC,MAAM,CAACH,YAAY,CAAC;IAAA,EAAC;EAAA,GAC3F,IACF,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"login.js","names":["_rdflib","require","_solidLogic","debug","_interopRequireWildcard","style","_log","ns","_signup","utils","widgets","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","_createForOfIteratorHelper","o","allowArrayLike","it","Symbol","iterator","Array","isArray","_unsupportedIterableToArray","length","F","s","done","value","_e","f","TypeError","normalCompletion","didErr","err","step","next","_e2","minLen","_arrayLikeToArray","toString","slice","constructor","name","from","test","arr","len","arr2","store","solidLogicSingleton","_solidLogicSingleton$","profile","loadPreferences","loadProfile","_solidLogicSingleton$2","typeIndex","getScopedAppInstances","getRegistrations","loadAllTypeIndexes","getScopedAppsFromIndex","deleteTypeIndexRegistration","ensureLoggedIn","context","me","authn","currentUser","saveUser","Promise","resolve","checkUser","then","webId","log","concat","div","dom","box","loginStatusBox","webIdUri","appendChild","ensureLoadedPreferences","_x","_ensureLoadedPreferences","apply","arguments","_asyncToGenerator2","_regenerator","mark","_callee4","progressDisplay","preferencesFile","m2","wrap","_callee4$","_context4","prev","abrupt","ensureLoadedProfile","sent","parentNode","removeChild","t0","UnauthorizedError","alert","CrossOriginForbiddenError","window","location","origin","preferencesFileError","SameOriginForbiddenError","warn","NotEditableError","WebOperationError","FetchError","status","message","Error","stop","_x2","_ensureLoadedProfile","_callee5","logInContext","_callee5$","_context5","publicProfile","errorMessageBlock","findAppInstances","_x3","_x4","_x5","_findAppInstances","_callee6","theClass","isPublic","items","_callee6$","_context6","filter","item","scope","label","instances","map","instance","scopeLabel","mine","sameTerm","agent","registrationControl","_x6","_x7","_x8","_registrationControl","_callee7","registrationStatements","renderScopeCheckbox","scopes","msg","tbody","form","_iterator","_step","row","_callee7$","_context7","_renderScopeCheckbox","statements","index","noun","buildCheckboxForm","_registrationStatemen","registrations","reg","newThing","st","solid","createElement","innerHTML","textContent","setAttribute","children","BlankNode","renderScopeHeadingRow","backgroundColor","cell","backgoundColor","header","textAlign","registrationList","_x9","_x10","_registrationList","_callee9","options","table","_iterator2","_step2","headingRow","_iterator3","_step3","_loop","_callee9$","_context10","firstChild","type","display","_loop$","_context9","personTR","deleteFunction","_deleteFunction","_callee8","_callee8$","_context8","paddingLeft","delegateYield","t1","finish","t2","signInOrSignUpBox","setUserCallback","undefined","signInButtonStyle","buttonStyle","signInAndUpButtonStyle","magicClassName","signInPopUpButton","headerBannerLoginInput","signUpBackground","authSession","onLogin","webIdURI","uri","divs","getElementsByClassName","parent","addEventListener","offline","offlineTestID","renderSignInPopup","signupButton","signInBackground","_event","signupMgr","Signup","signup","issuerPopup","body","issuerPopupBox","issuerPopupBoxTopMenu","issuerPopupBoxLabel","innerText","issuerPopupBoxCloseButton","remove","loginToIssuer","_ref","_callee","issuerUri","preLoginRedirectHash","locationUrl","_callee$","_context","updater","flagAuthorizationMetadata","URL","href","hash","localStorage","setItem","login","redirectUrl","oidcIssuer","_x11","issuerTextContainer","issuerTextInputContainer","issuerTextLabel","issuerTextInput","getItem","issuerTextGoButton","issuerButtonContainer","issuerBottonLabel","getSuggestedIssuers","forEach","issuerInfo","issuerButton","listener","setIt","newidURI","refresh","logoutButtonHandler","oldMe","logout","logoutButton","logoutLabel","nick","any","foaf","signOutButton","sessionInfo","info","isLoggedIn","sym","clearElement","trackSession","onLogout","_callee2","issuer","wellKnownUri","wellKnownResult","openidConfiguration","_callee2$","_context2","pathname","fetch","json","end_session_endpoint","credentials","reload","selectWorkspace","appDetails","callbackWS","appPathSegment","say","background","figureOutBase","ws","newBaseNode","space","newBaseString","split","now","Date","getTime","displayOptions","makeNewWorkspace","_x12","_makeNewWorkspace","_callee3","newBase","newWs","newData","_callee3$","_context3","padding","encodeURI","askName","update","id","w","each","storages","ldp","file","includes","toLowerCase","p","commentStyle","baseField","textInputStyle","size","autocomplete","button","replace","x","holds","rdf","col1","col2","col3","tr","localStyle","comment","cellStyle","deselectedStyle","anyValue","ui","reduce","b","charCodeAt","bgcolor","target","rdfs","disabled","trLast","newAppInstance","callback","gotWS","base","getUserRoles","_getUserRoles","_callee10","_yield$ensureLoadedPr","_callee10$","_context11","doc","filterAvailablePanes","_x13","_filterAvailablePanes","_callee11","panes","userRoles","_callee11$","_context12","pane","isMatchingAudience","audience","isMatch","audienceRole","find","role","equals"],"sources":["../../src/login/login.ts"],"sourcesContent":["/* eslint-disable camelcase */\n/**\n * Signing in, signing up, profile and preferences reloading\n * Type index management\n *\n * Many functions in this module take a context object which\n * holds various RDF symbols, add to it, and return a promise of it.\n *\n * * `me` RDF symbol for the user's WebID\n * * `publicProfile` The user's public profile, iff loaded\n * * `preferencesFile` The user's personal preference file, iff loaded\n * * `index.public` The user's public type index file\n * * `index.private` The user's private type index file\n *\n * Not RDF symbols:\n * * `noun` A string in english for the type of thing -- like \"address book\"\n * * `instance` An array of nodes which are existing instances\n * * `containers` An array of nodes of containers of instances\n * * `div` A DOM element where UI can be displayed\n * * `statusArea` A DOM element (opt) progress stuff can be displayed, or error messages\n * *\n * * Vocabulary: \"load\" loads a file if it exists;\n * * 'Ensure\" CREATES the file if it does not exist (if it can) and then loads it.\n * @packageDocumentation\n */\nimport { PaneDefinition } from 'pane-registry'\nimport { BlankNode, NamedNode, st } from 'rdflib'\n// eslint-disable-next-line camelcase\nimport { Quad_Object } from 'rdflib/lib/tf-types'\nimport {\n AppDetails,\n AuthenticationContext,\n authn,\n authSession,\n CrossOriginForbiddenError,\n FetchError,\n getSuggestedIssuers,\n NotEditableError,\n offlineTestID,\n SameOriginForbiddenError,\n solidLogicSingleton,\n UnauthorizedError,\n WebOperationError\n} from 'solid-logic'\nimport * as debug from '../debug'\nimport * as style from '../style'\nimport { alert } from '../log'\nimport * as ns from '../ns.js'\nimport { Signup } from '../signup/signup.js'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\n\nconst store = solidLogicSingleton.store\n\nconst {\n loadPreferences,\n loadProfile\n} = solidLogicSingleton.profile\n\nconst {\n getScopedAppInstances,\n getRegistrations,\n loadAllTypeIndexes,\n getScopedAppsFromIndex,\n deleteTypeIndexRegistration\n} = solidLogicSingleton.typeIndex\n\n/**\n * Resolves with the logged in user's WebID\n *\n * @param context\n */\n// used to be logIn\nexport function ensureLoggedIn (context: AuthenticationContext): Promise<AuthenticationContext> {\n const me = authn.currentUser()\n if (me) {\n authn.saveUser(me, context)\n return Promise.resolve(context)\n }\n\n return new Promise((resolve) => {\n authn.checkUser().then((webId) => {\n // Already logged in?\n if (webId) {\n debug.log(`logIn: Already logged in as ${webId}`)\n return resolve(context)\n }\n if (!context.div || !context.dom) {\n return resolve(context)\n }\n const box = loginStatusBox(context.dom, (webIdUri) => {\n authn.saveUser(webIdUri, context)\n resolve(context) // always pass growing context\n })\n context.div.appendChild(box)\n })\n })\n}\n\n/**\n * Loads preference file\n * Do this after having done log in and load profile\n *\n * @private\n *\n * @param context\n */\n// used to be logInLoadPreferences\nexport async function ensureLoadedPreferences (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.preferencesFile) return Promise.resolve(context) // already done\n\n // const statusArea = context.statusArea || context.div || null\n let progressDisplay\n /* COMPLAIN FUNCTION NOT USED/TAKING IT OUT FOR NOW\n function complain (message) {\n message = `ensureLoadedPreferences: ${message}`\n if (statusArea) {\n // statusArea.innerHTML = ''\n statusArea.appendChild(widgets.errorMessageBlock(context.dom, message))\n }\n debug.log(message)\n // reject(new Error(message))\n } */\n try {\n context = await ensureLoadedProfile(context)\n\n // console.log('back in Solid UI after logInLoadProfile', context)\n const preferencesFile = await loadPreferences(context.me as NamedNode)\n if (progressDisplay) {\n progressDisplay.parentNode.removeChild(progressDisplay)\n }\n context.preferencesFile = preferencesFile\n } catch (err) {\n let m2: string\n if (err instanceof UnauthorizedError) {\n m2 =\n 'Ooops - you are not authenticated (properly logged in) to for me to read your preference file. Try loggin out and logging in?'\n alert(m2)\n } else if (err instanceof CrossOriginForbiddenError) {\n m2 = `Unauthorized: Assuming preference file blocked for origin ${window.location.origin}`\n context.preferencesFileError = m2\n return context\n } else if (err instanceof SameOriginForbiddenError) {\n m2 =\n 'You are not authorized to read your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof NotEditableError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n return context\n } else if (err instanceof WebOperationError) {\n m2 =\n 'You are not authorized to edit your preference file. This may be because you are using an untrusted web app.'\n debug.warn(m2)\n } else if (err instanceof FetchError) {\n m2 = `Strange: Error ${err.status} trying to read your preference file.${err.message}`\n alert(m2)\n } else {\n throw new Error(`(via loadPrefs) ${err}`)\n }\n }\n return context\n}\n\n/**\n * Logs the user in and loads their WebID profile document into the store\n *\n * @param context\n *\n * @returns Resolves with the context after login / fetch\n */\n// used to be logInLoadProfile\nexport async function ensureLoadedProfile (\n context: AuthenticationContext\n): Promise<AuthenticationContext> {\n if (context.publicProfile) {\n return context\n } // already done\n try {\n const logInContext = await ensureLoggedIn(context)\n if (!logInContext.me) {\n throw new Error('Could not log in')\n }\n context.publicProfile = await loadProfile(logInContext.me)\n } catch (err) {\n if (context.div && context.dom) {\n context.div.appendChild(widgets.errorMessageBlock(context.dom, err.message))\n }\n throw new Error(`Can't log in: ${err}`)\n }\n return context\n}\n\n/**\n * Returns promise of context with arrays of symbols\n *\n * leaving the `isPublic` param undefined will bring in community index things, too\n */\nexport async function findAppInstances (\n context: AuthenticationContext,\n theClass: NamedNode,\n isPublic?: boolean\n): Promise<AuthenticationContext> {\n let items = context.me ? await getScopedAppInstances(theClass, context.me) : []\n if (isPublic === true) { // old API - not recommended!\n items = items.filter(item => item.scope.label === 'public')\n } else if (isPublic === false) {\n items = items.filter(item => item.scope.label === 'private')\n }\n context.instances = items.map(item => item.instance)\n return context\n}\n\nexport function scopeLabel (context, scope) {\n const mine = context.me && context.me.sameTerm(scope.agent)\n const name = mine ? '' : utils.label(scope.agent) + ' '\n return `${name}${scope.label}`\n}\n/**\n * UI to control registration of instance\n */\nexport async function registrationControl (\n context: AuthenticationContext,\n instance,\n theClass\n): Promise<AuthenticationContext | void> {\n function registrationStatements (index) {\n const registrations = getRegistrations(instance, theClass)\n const reg = registrations.length ? registrations[0] : widgets.newThing(index)\n return [\n st(reg, ns.solid('instance'), instance, index),\n st(reg, ns.solid('forClass'), theClass, index)\n ]\n }\n\n function renderScopeCheckbox (scope) {\n const statements = registrationStatements(scope.index)\n const name = scopeLabel(context, scope)\n const label = `${name} link to this ${context.noun}`\n return widgets.buildCheckboxForm(\n context.dom,\n solidLogicSingleton.store,\n label,\n null,\n statements,\n form,\n scope.index\n )\n }\n /// / body of registrationControl\n const dom = context.dom\n if (!dom || !context.div) {\n throw new Error('registrationControl: need dom and div')\n }\n const box = dom.createElement('div')\n context.div.appendChild(box)\n context.me = authn.currentUser() // @@\n const me = context.me\n if (!me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in to save a link to this)</p>'\n return context\n }\n\n let scopes // @@ const\n try {\n scopes = await loadAllTypeIndexes(me)\n } catch (e) {\n let msg\n if (context.div && context.preferencesFileError) {\n msg = '(Lists of stuff not available)'\n context.div.appendChild(dom.createElement('p')).textContent = msg\n } else if (context.div) {\n msg = `registrationControl: Type indexes not available: ${e}`\n context.div.appendChild(widgets.errorMessageBlock(context.dom, e))\n }\n debug.log(msg)\n return context\n }\n\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid gray 0.05em;')\n const tbody = box.children[0].children[0]\n const form = new BlankNode() // @@ say for now\n\n for (const scope of scopes) {\n const row = tbody.appendChild(dom.createElement('tr'))\n row.appendChild(renderScopeCheckbox(scope)) // @@ index\n }\n return context\n}\n\nexport function renderScopeHeadingRow (context, store, scope) {\n const backgroundColor = { private: '#fee', public: '#efe' }\n const { dom } = context\n const name = scopeLabel(context, scope)\n const row = dom.createElement('tr')\n const cell = row.appendChild(dom.createElement('td'))\n cell.setAttribute('colspan', '3')\n cell.style.backgoundColor = backgroundColor[scope.label] || 'white'\n const header = cell.appendChild(dom.createElement('h3'))\n header.textContent = name + ' links'\n header.style.textAlign = 'left'\n return row\n}\n/**\n * UI to List at all registered things\n */\nexport async function registrationList (context: AuthenticationContext, options: {\n private?: boolean\n public?: boolean\n type?: NamedNode\n}): Promise<AuthenticationContext> {\n const dom = context.dom as HTMLDocument\n const div = context.div as HTMLElement\n\n const box = dom.createElement('div')\n div.appendChild(box)\n context.me = authn.currentUser() // @@\n if (!context.me) {\n box.innerHTML = '<p style=\"margin:2em;\">(Log in list your stuff)</p>'\n return context\n }\n\n const scopes = await loadAllTypeIndexes(context.me) // includes community indexes\n\n // console.log('@@ registrationList ', scopes)\n box.innerHTML = '<table><tbody></tbody></table>' // tbody will be inserted anyway\n box.setAttribute('style', 'font-size: 120%; text-align: right; padding: 1em; border: solid #eee 0.5em;')\n const table = box.firstChild as HTMLElement\n const tbody = table.firstChild as HTMLElement\n\n for (const scope of scopes) { // need some predicate for listing/adding agents\n const headingRow = renderScopeHeadingRow(context, store, scope)\n tbody.appendChild(headingRow)\n const items = await getScopedAppsFromIndex(scope, options.type || null) // any class\n if (items.length === 0) headingRow.style.display = 'none'\n // console.log(`registrationList: @@ instance items for class ${options.type || 'undefined' }:`, items)\n for (const item of items) {\n const row = widgets.personTR(dom, ns.solid('instance'), item.instance, {\n deleteFunction: async () => {\n await deleteTypeIndexRegistration(item)\n tbody.removeChild(row)\n }\n })\n row.children[0].style.paddingLeft = '3em'\n\n tbody.appendChild(row)\n }\n }\n return context\n} // registrationList\n\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 || style.signInAndUpButtonStyle\n\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.setAttribute('style', 'display:flex;')\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}${style.headerBannerLoginInput}` + style.signUpBackground)\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}${style.headerBannerLoginInput}` + style.signInBackground)\n\n signupButton.addEventListener(\n 'click',\n function (_event) {\n const signupMgr = new Signup()\n signupMgr.signup().then(function (uri) {\n debug.log('signInOrSignUpBox signed up ' + uri)\n setUserCallback(uri)\n })\n },\n false\n )\n return box\n}\n\nexport function renderSignInPopup (dom: HTMLDocument) {\n /**\n * Issuer Menu\n */\n const issuerPopup = dom.createElement('div')\n issuerPopup.setAttribute(\n 'style',\n 'position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center;'\n )\n dom.body.appendChild(issuerPopup)\n const issuerPopupBox = dom.createElement('div')\n issuerPopupBox.setAttribute(\n 'style',\n `\n background-color: white;\n box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -webkit-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -moz-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n -o-box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.2);\n border-radius: 4px;\n min-width: 400px;\n padding: 10px;\n z-index : 10;\n `\n )\n issuerPopup.appendChild(issuerPopupBox)\n const issuerPopupBoxTopMenu = dom.createElement('div')\n issuerPopupBoxTopMenu.setAttribute(\n 'style',\n `\n border-bottom: 1px solid #DDD;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n `\n )\n issuerPopupBox.appendChild(issuerPopupBoxTopMenu)\n const issuerPopupBoxLabel = dom.createElement('label')\n issuerPopupBoxLabel.setAttribute('style', 'margin-right: 5px; font-weight: 800')\n issuerPopupBoxLabel.innerText = 'Select an identity provider'\n const issuerPopupBoxCloseButton = dom.createElement('button')\n issuerPopupBoxCloseButton.innerHTML =\n '<img src=\"https://solidos.github.io/solid-ui/src/icons/noun_1180156.svg\" style=\"width: 2em; height: 2em;\" title=\"Cancel\">'\n issuerPopupBoxCloseButton.setAttribute('style', 'background-color: transparent; border: none;')\n issuerPopupBoxCloseButton.addEventListener('click', () => {\n issuerPopup.remove()\n })\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxLabel)\n issuerPopupBoxTopMenu.appendChild(issuerPopupBoxCloseButton)\n\n const loginToIssuer = async (issuerUri: string) => {\n try {\n // clear authorization metadata from store\n solidLogicSingleton.store.updater.flagAuthorizationMetadata() as any\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 const locationUrl = new URL(window.location.href)\n locationUrl.hash = '' // remove hash part\n await authSession.login({\n redirectUrl: locationUrl.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 || style.signInAndUpButtonStyle\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}`)\n signOutButton.addEventListener('click', logoutButtonHandler, false)\n return signOutButton\n }\n\n box.refresh = function () {\n const sessionInfo = authSession.info\n if (sessionInfo && sessionInfo.webId && sessionInfo.isLoggedIn) {\n me = solidLogicSingleton.store.sym(sessionInfo.webId)\n } else {\n me = null\n }\n if ((me && box.me !== me.uri) || (!me && box.me)) {\n widgets.clearElement(box)\n if (me) {\n box.appendChild(logoutButton(me, options))\n } else {\n box.appendChild(signInOrSignUpBox(dom, setIt, options))\n }\n }\n box.me = me ? me.uri : null\n }\n box.refresh()\n\n function trackSession () {\n me = authn.currentUser()\n box.refresh()\n }\n trackSession()\n\n authSession.onLogin(trackSession)\n authSession.onLogout(trackSession)\n box.me = '99999' // Force refresh\n box.refresh()\n return box\n}\n\nauthSession.onLogout(async () => {\n const issuer = window.localStorage.getItem('loginIssuer')\n if (issuer) {\n try {\n // clear authorization metadata from store\n solidLogicSingleton.store.updater.flagAuthorizationMetadata() as any\n\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.setAttribute('style', 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.setAttribute('style', 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.setAttribute('style', 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, localStyle, 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 localStyle = solidLogicSingleton.store.anyValue(ws, ns.ui('style'))\n if (!localStyle) {\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 localStyle = `color: black ; background-color: ${bgcolor};`\n }\n col2.setAttribute('style', deselectedStyle + localStyle)\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 + localStyle)\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,IAAAA,OAAA,GAAAC,OAAA;AAGA,IAAAC,WA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UACLC,KAA4B;IAAA,IAAAC,SAAA;IAAA,OAAA1T,YAAA,YAAAM,IAAA,UAAAqT,WAAAC,UAAA;MAAA,kBAAAA,UAAA,CAAAnT,IAAA,GAAAmT,UAAA,CAAA/W,IAAA;QAAA;UAAA+W,UAAA,CAAA/W,IAAA;UAAA,OAEJiW,YAAY,CAAC,CAAC;QAAA;UAAhCY,SAAS,GAAAE,UAAA,CAAAhT,IAAA;UAAA,OAAAgT,UAAA,CAAAlT,MAAA,WACR+S,KAAK,CAACtQ,MAAM,CAAC,UAAC0Q,IAAI;YAAA,OAAKC,kBAAkB,CAACD,IAAI,EAAEH,SAAS,CAAC;UAAA,EAAC;QAAA;QAAA;UAAA,OAAAE,UAAA,CAAA7R,IAAA;MAAA;IAAA,GAAAyR,SAAA;EAAA,CACnE;EAAA,OAAAD,qBAAA,CAAA1T,KAAA,OAAAC,SAAA;AAAA;AAED,SAASgU,kBAAkBA,CAAED,IAAoB,EAAEH,SAA2B,EAAW;EACvF,IAAMK,QAAQ,GAAGF,IAAI,CAACE,QAAQ,IAAI,EAAE;EACpC,OAAOA,QAAQ,CAAC7B,MAAM,CACpB,UAAC8B,OAAO,EAAEC,YAAY;IAAA,OAAKD,OAAO,IAAI,CAAC,CAACN,SAAS,CAACQ,IAAI,CAAC,UAACC,IAAI;MAAA,OAAKA,IAAI,CAACC,MAAM,CAACH,YAAY,CAAC;IAAA,EAAC;EAAA,GAC3F,IACF,CAAC;AACH"}
|
|
@@ -11,9 +11,9 @@ export declare function cameraCaptureControl(dom: HTMLDocument, store: IndexedFo
|
|
|
11
11
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
12
12
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
13
13
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
14
|
-
* @returns {DomElement} - A div element with the
|
|
14
|
+
* @returns {DomElement} - A div element with the button in it
|
|
15
15
|
*
|
|
16
|
-
* This
|
|
16
|
+
* This expands the button to a large control when it is pressed
|
|
17
17
|
*/
|
|
18
18
|
export declare function cameraButton(dom: HTMLDocument, store: IndexedFormula, getImageDoc: () => NamedNode, doneCallback: (imageDoc: any) => Promise<void>): HTMLElement;
|
|
19
19
|
//# sourceMappingURL=media-capture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-capture.d.ts","sourceRoot":"","sources":["../../src/media/media-capture.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"media-capture.d.ts","sourceRoot":"","sources":["../../src/media/media-capture.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAOlD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,KAAA,KAAK,OAAO,CAAC,IAAI,CAAC,kBAmI1C;AAED;;;;;;;;GAQG;AAEH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,KAAA,KAAK,OAAO,CAAC,IAAI,CAAC,GACxC,WAAW,CAqBb"}
|
|
@@ -11,21 +11,21 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
11
11
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
12
|
var debug = _interopRequireWildcard(require("../debug"));
|
|
13
13
|
var _iconBase = require("../iconBase");
|
|
14
|
+
var style = _interopRequireWildcard(require("../style"));
|
|
14
15
|
var widgets = _interopRequireWildcard(require("../widgets"));
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
-
/// /////////////////////////////////////////////
|
|
18
18
|
//
|
|
19
19
|
// Media input widget
|
|
20
20
|
//
|
|
21
21
|
//
|
|
22
22
|
// Workflow:
|
|
23
|
-
// The HTML5 functionality (on
|
|
24
|
-
// a realtime camera capture
|
|
23
|
+
// The HTML5 functionality (on mobile) is to prompt for either
|
|
24
|
+
// a realtime camera capture, OR a selection from images already on the device
|
|
25
25
|
// (eg camera roll).
|
|
26
26
|
//
|
|
27
|
-
// The solid alternative is to either take a
|
|
28
|
-
// or access
|
|
27
|
+
// The solid alternative is to either take a photo
|
|
28
|
+
// or access camera roll (etc) OR to access solid cloud storage of favorite photo albums.
|
|
29
29
|
// (Especially latest taken ones)
|
|
30
30
|
//
|
|
31
31
|
|
|
@@ -34,10 +34,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
34
34
|
var cameraIcon = _iconBase.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
|
|
35
35
|
var retakeIcon = _iconBase.icons.iconBase + 'noun_479395.svg'; // Get it from github
|
|
36
36
|
|
|
37
|
-
var canvasWidth = '640';
|
|
38
|
-
var canvasHeight = '480';
|
|
39
|
-
var controlStyle = "border-radius: 0.5em; margin: 0.8em; width: ".concat(canvasWidth, "; height:").concat(canvasHeight, ";");
|
|
40
|
-
// const controlStyle = 'border-radius: 0.5em; margin: 0.8em; width: 320; height:240;'
|
|
41
37
|
var contentType = 'image/png';
|
|
42
38
|
|
|
43
39
|
/** A control to capture a picture using camera
|
|
@@ -82,7 +78,7 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
82
78
|
player = main.appendChild(dom.createElement('video'));
|
|
83
79
|
player.setAttribute('controls', '1');
|
|
84
80
|
player.setAttribute('autoplay', '1');
|
|
85
|
-
player.setAttribute('style', controlStyle);
|
|
81
|
+
player.setAttribute('style', style.controlStyle);
|
|
86
82
|
if (!navigator.mediaDevices) {
|
|
87
83
|
throw new Error('navigator.mediaDevices not available');
|
|
88
84
|
}
|
|
@@ -103,9 +99,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
103
99
|
function grabCanvas() {
|
|
104
100
|
// Draw the video frame to the canvas.
|
|
105
101
|
canvas = dom.createElement('canvas');
|
|
106
|
-
canvas.setAttribute('width', canvasWidth);
|
|
107
|
-
canvas.setAttribute('height', canvasHeight);
|
|
108
|
-
canvas.setAttribute('style', controlStyle);
|
|
102
|
+
canvas.setAttribute('width', style.canvasWidth);
|
|
103
|
+
canvas.setAttribute('height', style.canvasHeight);
|
|
104
|
+
canvas.setAttribute('style', style.controlStyle);
|
|
109
105
|
main.appendChild(canvas);
|
|
110
106
|
var context = canvas.getContext('2d');
|
|
111
107
|
context.drawImage(player, 0, 0, canvas.width, canvas.height);
|
|
@@ -160,9 +156,9 @@ function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
|
160
156
|
* @param {IndexedForumla} store - The quadstore to store data in
|
|
161
157
|
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
162
158
|
* @param {function<Node>} doneCallback - called with the image taken
|
|
163
|
-
* @returns {DomElement} - A div element with the
|
|
159
|
+
* @returns {DomElement} - A div element with the button in it
|
|
164
160
|
*
|
|
165
|
-
* This
|
|
161
|
+
* This expands the button to a large control when it is pressed
|
|
166
162
|
*/
|
|
167
163
|
|
|
168
164
|
function cameraButton(dom, store, getImageDoc, doneCallback) {
|