profile-pane 2.0.0 → 3.0.0-10071733

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/lib/CVCard.d.ts +2 -3
  2. package/lib/CVCard.d.ts.map +1 -1
  3. package/lib/CVCard.js +84 -69
  4. package/lib/ChatWithMe.d.ts +1 -0
  5. package/lib/ChatWithMe.d.ts.map +1 -1
  6. package/lib/ChatWithMe.js +56 -9
  7. package/lib/FriendList.d.ts +3 -2
  8. package/lib/FriendList.d.ts.map +1 -1
  9. package/lib/FriendList.js +37 -28
  10. package/lib/ProfileCard.d.ts +4 -2
  11. package/lib/ProfileCard.d.ts.map +1 -1
  12. package/lib/ProfileCard.js +44 -25
  13. package/lib/ProfileView.d.ts +1 -0
  14. package/lib/ProfileView.d.ts.map +1 -1
  15. package/lib/ProfileView.js +117 -38
  16. package/lib/QRCodeCard.d.ts +2 -2
  17. package/lib/QRCodeCard.d.ts.map +1 -1
  18. package/lib/QRCodeCard.js +89 -36
  19. package/lib/SocialCard.d.ts +2 -2
  20. package/lib/SocialCard.d.ts.map +1 -1
  21. package/lib/SocialCard.js +38 -51
  22. package/lib/SocialPresenter.js +4 -3
  23. package/lib/StuffCard.d.ts +4 -0
  24. package/lib/StuffCard.d.ts.map +1 -1
  25. package/lib/StuffCard.js +27 -38
  26. package/lib/StuffPresenter.d.ts.map +1 -1
  27. package/lib/addMeToYourFriends.d.ts +2 -2
  28. package/lib/addMeToYourFriends.d.ts.map +1 -1
  29. package/lib/addMeToYourFriends.js +23 -23
  30. package/lib/{addMeToYourFriendsHelper.d.ts → buttonsHelper.d.ts} +4 -2
  31. package/lib/buttonsHelper.d.ts.map +1 -0
  32. package/lib/buttonsHelper.js +44 -0
  33. package/lib/editProfilePane/editProfile.view.js +2 -2
  34. package/lib/index.d.ts +9 -0
  35. package/lib/index.d.ts.map +1 -1
  36. package/lib/index.js +11 -2
  37. package/lib/profile-pane.js +5925 -0
  38. package/lib/profile-pane.js.map +1 -0
  39. package/lib/profile-pane.min.js +300 -0
  40. package/lib/profile-pane.min.js.map +1 -0
  41. package/lib/styles/CVCard.css +37 -0
  42. package/lib/styles/ChatWithMe.css +6 -0
  43. package/lib/styles/FriendList.css +12 -0
  44. package/lib/styles/ProfileCard.css +92 -0
  45. package/lib/styles/ProfileView.css +22 -0
  46. package/lib/styles/QRCodeCard.css +24 -0
  47. package/lib/styles/SocialCard.css +61 -0
  48. package/lib/styles/StuffCard.css +23 -0
  49. package/lib/styles/utilities.css +312 -0
  50. package/lib/texts.d.ts +5 -3
  51. package/lib/texts.d.ts.map +1 -1
  52. package/lib/texts.js +7 -4
  53. package/package.json +40 -30
  54. package/lib/0SAVED-CVCard.d.ts +0 -5
  55. package/lib/0SAVED-CVCard.d.ts.map +0 -1
  56. package/lib/0SAVED-CVCard.js +0 -90
  57. package/lib/addMeToYourFriendsHelper.d.ts.map +0 -1
  58. package/lib/addMeToYourFriendsHelper.js +0 -26
  59. package/lib/baseStyles.d.ts +0 -71
  60. package/lib/baseStyles.d.ts.map +0 -1
  61. package/lib/baseStyles.js +0 -92
package/lib/CVCard.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { TemplateResult } from 'lit-html';
2
- import { ProfilePresentation } from './presenter';
3
1
  import { CVPresentation } from './CVPresenter';
4
- export declare const CVCard: (profileBasics: ProfilePresentation, cvData: CVPresentation) => TemplateResult;
2
+ import './styles/CVCard.css';
3
+ export declare const CVCard: (cvData: CVPresentation) => import("lit-html").TemplateResult<1>;
5
4
  //# sourceMappingURL=CVCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CVCard.d.ts","sourceRoot":"","sources":["../src/CVCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAS/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAa9C,eAAO,MAAM,MAAM,GACjB,eAAe,mBAAmB,EAClC,QAAQ,cAAc,KACrB,cAgCF,CAAA"}
1
+ {"version":3,"file":"CVCard.d.ts","sourceRoot":"","sources":["../src/CVCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,qBAAqB,CAAA;AAE5B,eAAO,MAAM,MAAM,GACjB,QAAQ,cAAc,yCAkEvB,CAAA"}
package/lib/CVCard.js CHANGED
@@ -5,85 +5,102 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.CVCard = void 0;
7
7
  var _litHtml = require("lit-html");
8
- var _baseStyles = require("./baseStyles");
9
- var _styleMap = require("lit-html/directives/style-map.js");
10
- const styles = {
11
- image: (0, _styleMap.styleMap)((0, _baseStyles.fullWidth)()),
12
- intro: (0, _styleMap.styleMap)({
13
- ...(0, _baseStyles.textGray)(),
14
- ...(0, _baseStyles.textCenter)()
15
- }),
16
- card: (0, _styleMap.styleMap)((0, _baseStyles.card)()),
17
- info: (0, _styleMap.styleMap)({
18
- ...(0, _baseStyles.paddingSmall)(),
19
- ...(0, _baseStyles.textLeft)()
20
- }),
21
- tools: (0, _styleMap.styleMap)({
22
- ...(0, _baseStyles.paddingSmall)(),
23
- ...(0, _baseStyles.textRight)()
24
- })
25
- };
26
- const CVCard = (profileBasics, cvData) => {
8
+ require("./styles/CVCard.css");
9
+ const CVCard = cvData => {
27
10
  const {
28
11
  rolesByType,
29
12
  skills,
30
13
  languages
31
14
  } = cvData;
32
- const nameStyle = (0, _styleMap.styleMap)({
33
- ...(0, _baseStyles.heading)(),
34
- // "text-decoration": "underline",
35
- color: profileBasics.highlightColor // was "text-decoration-color"
36
- });
37
- if (renderRoles(rolesByType['FutureRole']) || renderRoles(rolesByType['CurrentRole']) || renderRoles(rolesByType['PastRole']) || renderSkills(skills) || renderLanguages(languages)) {
38
- return (0, _litHtml.html)`
39
- <div>
40
- <div data-testid="curriculum-vitae" style="${styles.card}">
41
- <div style=${styles.info}>
42
- <h3 style=${nameStyle}>Bio</h3>
43
- <div style=${styles.info}>${renderRoles(rolesByType['FutureRole'])}</div>
44
- <hr />
45
- <div style=${styles.info}>${renderRoles(rolesByType['CurrentRole'])}</div>
46
- <hr />
47
- <div style=${styles.info}>${renderRoles(rolesByType['PastRole'])}</div>
48
- <hr />
49
- <h3 style=${nameStyle}>Skills</h3>
50
- <div style=${styles.info}>${renderSkills(skills)}</div>
51
- <h3 style=${nameStyle}>Languages</h3>
52
- <div style=${styles.info}>${renderLanguages(languages)}</div>
53
-
54
- </div>
55
- </div>
56
- </div>
15
+ const futureRolesArr = rolesByType['FutureRole'] || [];
16
+ const currentRolesArr = rolesByType['CurrentRole'] || [];
17
+ const pastRolesArr = rolesByType['PastRole'] || [];
18
+ const skillsArr = skills || [];
19
+ const languagesArr = languages || [];
20
+ const hasFutureRole = Array.isArray(futureRolesArr) && futureRolesArr.length > 0;
21
+ const hasCurrentRole = Array.isArray(currentRolesArr) && currentRolesArr.length > 0;
22
+ const hasPastRole = Array.isArray(pastRolesArr) && pastRolesArr.length > 0;
23
+ const hasSkills = Array.isArray(skillsArr) && skillsArr.length > 0;
24
+ const hasLanguages = Array.isArray(languagesArr) && languagesArr.length > 0;
25
+ if (!(hasFutureRole || hasCurrentRole || hasPastRole || hasSkills || hasLanguages)) return (0, _litHtml.html)``;
26
+ return (0, _litHtml.html)`
27
+ <article class="cvCard" aria-label="Professional Experience" data-testid="curriculum-vitae">
28
+ ${hasFutureRole ? (0, _litHtml.html)`
29
+ <section class="cvSection" aria-labelledby="cv-future-heading">
30
+ <h3 id="cv-future-heading">Future Roles</h3>
31
+ <ul role="list" aria-label="Upcoming professional roles">
32
+ ${renderRoles(futureRolesArr, true)}
33
+ </ul>
34
+ </section>
35
+ ` : ''}
36
+
37
+ ${hasCurrentRole ? (0, _litHtml.html)`
38
+ <section class="cvSection" aria-labelledby="cv-current-heading">
39
+ <h3 id="cv-current-heading">Current Roles</h3>
40
+ <ul role="list" aria-label="Current professional positions">
41
+ ${renderRoles(currentRolesArr, true)}
42
+ </ul>
43
+ </section>
44
+ ` : ''}
45
+
46
+ ${hasPastRole ? (0, _litHtml.html)`
47
+ <section class="cvSection" aria-labelledby="cv-past-heading">
48
+ <h3 id="cv-past-heading">Past Roles</h3>
49
+ <ul role="list" aria-label="Previous work experience">
50
+ ${renderRoles(pastRolesArr, true)}
51
+ </ul>
52
+ </section>
53
+ ` : ''}
54
+
55
+ ${hasSkills ? (0, _litHtml.html)`
56
+ <section class="cvSection" aria-labelledby="cv-skills-heading">
57
+ <h3 id="cv-skills-heading">Skills</h3>
58
+ <ul role="list" aria-label="Professional skills and competencies">
59
+ ${renderSkills(skillsArr, true)}
60
+ </ul>
61
+ </section>
62
+ ` : ''}
63
+
64
+ ${hasLanguages ? (0, _litHtml.html)`
65
+ <section class="cvSection" aria-labelledby="cv-languages-heading">
66
+ <h3 id="cv-languages-heading">Languages</h3>
67
+ <ul role="list" aria-label="Known languages">
68
+ ${renderLanguages(languagesArr, true)}
69
+ </ul>
70
+ </section>
71
+ ` : ''}
72
+ </article>
57
73
  `;
58
- }
59
- return (0, _litHtml.html)``;
60
74
  };
61
75
  exports.CVCard = CVCard;
62
- function renderRole(role) {
63
- return role ? (0, _litHtml.html)`<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
64
- <b>${role.orgName}</b>
65
- <span>${strToUpperCase(role.roleText)}</span>
66
- <span>${role.dates}</span>
67
- </div> ` : (0, _litHtml.html)``;
76
+ function renderRole(role, asList = false) {
77
+ if (!role) return (0, _litHtml.html)``;
78
+ return asList ? (0, _litHtml.html)`
79
+ <li class="cvRole" role="listitem">
80
+ <strong class="cvOrg" aria-label="Organization">${role.orgName}</strong>
81
+ <span aria-label="Role title">${strToUpperCase(role.roleText)}</span>
82
+ <time aria-label="Employment period">${role.dates}</time>
83
+ </li>` : (0, _litHtml.html)``;
68
84
  }
69
- function renderRoles(roles) {
70
- if (roles[0] > '') return (0, _litHtml.html)`${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : (0, _litHtml.html)``}`;
85
+ function renderRoles(roles, asList = false) {
86
+ if (!roles || !roles.length || !roles[0]) return (0, _litHtml.html)``;
87
+ return (0, _litHtml.html)`${renderRole(roles[0], asList)}${roles.length > 1 ? renderRoles(roles.slice(1), asList) : (0, _litHtml.html)``}`;
71
88
  }
72
- function renderSkill(skill) {
73
- return skill ? (0, _litHtml.html)`<div style="margin: 0.5em;">
74
- <p style="text-align: center;">${skill}</p>
75
- </div> ` : (0, _litHtml.html)``;
89
+ function renderSkill(skill, asList = false) {
90
+ if (!skill) return (0, _litHtml.html)``;
91
+ return asList ? (0, _litHtml.html)`<li class="cvSkill">${strToUpperCase(skill)}</li>` : (0, _litHtml.html)``;
76
92
  }
77
- function renderSkills(skills) {
78
- if (skills[0] > '') return (0, _litHtml.html)`${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : (0, _litHtml.html)``}`;
93
+ function renderSkills(skills, asList = false) {
94
+ if (!skills || !skills.length || !skills[0]) return (0, _litHtml.html)``;
95
+ return (0, _litHtml.html)`${renderSkill(skills[0], asList)}${skills.length > 1 ? renderSkills(skills.slice(1), asList) : (0, _litHtml.html)``}`;
79
96
  }
80
- function renderLan(language) {
81
- return language ? (0, _litHtml.html)`<div style="margin: 0.5em;">
82
- <p style="text-align: center;">${language}</p>
83
- </div> ` : (0, _litHtml.html)``;
97
+ function renderLan(language, asList = false) {
98
+ if (!language) return (0, _litHtml.html)``;
99
+ return asList ? (0, _litHtml.html)`<li class="cvLanguage">${language}</li>` : (0, _litHtml.html)``;
84
100
  }
85
- function renderLanguages(languages) {
86
- if (languages[0] > '') return (0, _litHtml.html)`${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : (0, _litHtml.html)``}`;
101
+ function renderLanguages(languages, asList = false) {
102
+ if (!languages || !languages.length || !languages[0]) return (0, _litHtml.html)``;
103
+ return (0, _litHtml.html)`${renderLan(languages[0], asList)}${languages.length > 1 ? renderLanguages(languages.slice(1), asList) : (0, _litHtml.html)``}`;
87
104
  }
88
105
  function strToUpperCase(str) {
89
106
  if (str && str[0] > '') {
@@ -94,6 +111,4 @@ function strToUpperCase(str) {
94
111
  return strCase.join(' ');
95
112
  }
96
113
  return '';
97
- }
98
-
99
- // ends
114
+ }
@@ -1,5 +1,6 @@
1
1
  import { TemplateResult } from 'lit-html';
2
2
  import { DataBrowserContext } from 'pane-registry';
3
3
  import { NamedNode } from 'rdflib';
4
+ import './styles/ChatWithMe.css';
4
5
  export declare const ChatWithMe: (subject: NamedNode, context: DataBrowserContext) => TemplateResult;
5
6
  //# sourceMappingURL=ChatWithMe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChatWithMe.d.ts","sourceRoot":"","sources":["../src/ChatWithMe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKlC,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,cAwCF,CAAA"}
1
+ {"version":3,"file":"ChatWithMe.d.ts","sourceRoot":"","sources":["../src/ChatWithMe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAMlC,OAAO,yBAAyB,CAAA;AAEhC,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,cA0FF,CAAA"}
package/lib/ChatWithMe.js CHANGED
@@ -6,35 +6,82 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ChatWithMe = void 0;
7
7
  var _litHtml = require("lit-html");
8
8
  var _solidUi = require("solid-ui");
9
+ var _solidLogic = require("solid-logic");
9
10
  var _asyncReplace = require("lit-html/directives/async-replace.js");
10
11
  var _texts = require("./texts");
12
+ var _buttonsHelper = require("./buttonsHelper");
13
+ require("./styles/ChatWithMe.css");
11
14
  const ChatWithMe = (subject, context) => {
12
15
  const logic = context.session.logic;
13
16
  const longChatPane = context.session.paneRegistry.byName('long chat');
14
17
  async function* chatContainer() {
15
- const chatContainer = context.dom.createElement('div');
18
+ const chatContainer = context.dom.createElement('section');
19
+ chatContainer.setAttribute('class', 'chatSection section-centered');
20
+ chatContainer.setAttribute('aria-labelledby', 'chat-section-title');
21
+ chatContainer.setAttribute('role', 'region');
22
+ chatContainer.setAttribute('data-testid', 'chat');
23
+
24
+ // Add hidden title for screen readers
25
+ const title = context.dom.createElement('h3');
26
+ title.id = 'chat-section-title';
27
+ title.className = 'sr-only';
28
+ title.textContent = 'Communication';
29
+ chatContainer.appendChild(title);
16
30
  let exists;
17
31
  try {
18
- yield _texts.loadingMessage, exists = await logic.chat.getChat(subject, false);
32
+ yield (0, _litHtml.html)`
33
+ <div class="buttonSubSection">
34
+ <div class="actionButton loading-text center" role="status" aria-live="polite">
35
+ ${_texts.loadingMessage.toUpperCase()}
36
+ </div>
37
+ </div>
38
+ `;
39
+ exists = await logic.chat.getChat(subject, false);
19
40
  } catch (e) {
20
41
  exists = false;
21
42
  }
22
43
  if (exists) {
23
- chatContainer.appendChild(longChatPane.render(exists, context, {}));
44
+ const chatArea = context.dom.createElement('div');
45
+ chatArea.setAttribute('role', 'log');
46
+ chatArea.setAttribute('aria-label', 'Chat conversation');
47
+ chatArea.appendChild(longChatPane.render(exists, context, {}));
48
+ chatContainer.appendChild(chatArea);
24
49
  yield chatContainer;
25
50
  } else {
26
- const button = _solidUi.widgets.button(context.dom, undefined, _texts.chatWithMeButtonText, async () => {
51
+ const me = _solidLogic.authn.currentUser();
52
+ let label = (0, _buttonsHelper.checkIfAnyUserLoggedIn)(me) ? _texts.chatWithMeButtonText.toUpperCase() : _texts.logInToChatWithMeButtonText.toUpperCase();
53
+ const button = _solidUi.widgets.button(context.dom, undefined, label, setButtonHandler, {
54
+ needsBorder: true
55
+ });
56
+ async function setButtonHandler(event) {
57
+ event.preventDefault();
27
58
  try {
28
59
  const chat = await logic.chat.getChat(subject, true);
29
60
  chatContainer.innerHTML = '';
30
61
  chatContainer.appendChild(longChatPane.render(chat, context, {}));
31
- } catch (e) {
32
- chatContainer.appendChild(_solidUi.widgets.errorMessageBlock(context.dom, e.message));
62
+ } catch (error) {
63
+ (0, _buttonsHelper.complain)(chatContainer, context, error);
33
64
  }
34
- }, {
35
- needsBorder: true
36
- });
65
+ }
66
+ button.refresh = refreshButton();
67
+ function refreshButton() {
68
+ const me = _solidLogic.authn.currentUser();
69
+ if ((0, _buttonsHelper.checkIfAnyUserLoggedIn)(me)) {
70
+ button.innerHTML = _texts.chatWithMeButtonText.toUpperCase();
71
+ } else {
72
+ //not logged in
73
+ button.innerHTML = _texts.logInToChatWithMeButtonText.toUpperCase();
74
+ }
75
+ }
76
+ button.setAttribute('type', 'button');
77
+ button.setAttribute('aria-describedby', 'chat-button-description');
78
+ const description = context.dom.createElement('span');
79
+ description.id = 'chat-button-description';
80
+ description.className = 'sr-only';
81
+ description.textContent = 'Start a new conversation or sign in to continue existing chat';
82
+ button.classList.add('actionButton', 'btn-primary', 'action-button-focus');
37
83
  chatContainer.appendChild(button);
84
+ chatContainer.appendChild(description);
38
85
  yield chatContainer;
39
86
  }
40
87
  }
@@ -1,6 +1,7 @@
1
1
  import { DataBrowserContext } from 'pane-registry';
2
2
  import { NamedNode } from 'rdflib';
3
3
  import { TemplateResult } from 'lit-html';
4
- import { ProfilePresentation } from './presenter';
5
- export declare const FriendList: (profileBasics: ProfilePresentation, subject: NamedNode, context: DataBrowserContext) => TemplateResult;
4
+ import './styles/FriendList.css';
5
+ export declare const FriendList: (subject: NamedNode, context: DataBrowserContext) => TemplateResult | null;
6
+ export declare const extractFriends: (subject: NamedNode, { dom }: DataBrowserContext) => HTMLDivElement;
6
7
  //# sourceMappingURL=FriendList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FriendList.d.ts","sourceRoot":"","sources":["../src/FriendList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAG/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAYjD,eAAO,MAAM,UAAU,GAAK,eAAe,mBAAmB,EAC5D,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,cAkBF,CAAA"}
1
+ {"version":3,"file":"FriendList.d.ts","sourceRoot":"","sources":["../src/FriendList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,yBAAyB,CAAA;AAGhC,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,cAAc,GAAG,IAkBnB,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,SAAS,SAAS,EAAE,SAAS,kBAAkB,mBAwB7E,CAAA"}
package/lib/FriendList.js CHANGED
@@ -3,36 +3,30 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FriendList = void 0;
6
+ exports.extractFriends = exports.FriendList = void 0;
7
7
  var _solidUi = require("solid-ui");
8
8
  var _litHtml = require("lit-html");
9
- var _styleMap = require("lit-html/directives/style-map.js");
10
- var _baseStyles = require("./baseStyles");
11
- const styles = {
12
- root: (0, _styleMap.styleMap)((0, _baseStyles.padding)()),
13
- heading: (0, _styleMap.styleMap)((0, _baseStyles.headingLight)()),
14
- card: (0, _styleMap.styleMap)((0, _baseStyles.card)())
15
- };
16
- const FriendList = (profileBasics, subject, context) => {
17
- const nameStyle = (0, _styleMap.styleMap)({
18
- ...(0, _baseStyles.heading)(),
19
- // "text-decoration": "underline",
20
- color: profileBasics.highlightColor // was "text-decoration-color"
21
- });
22
- if (createList(subject, context)) {
23
- return (0, _litHtml.html)`
24
- <div data-testid="friend-list" style="${styles.card}">
25
- <div style=${styles.root}>
26
- <h3 style=${nameStyle}>Friends</h3>
27
- ${createList(subject, context)}
28
- </div>
29
- </div>
30
- `;
31
- }
32
- return (0, _litHtml.html)``;
9
+ require("./styles/FriendList.css");
10
+ const FriendList = (subject, context) => {
11
+ const friends = extractFriends(subject, context);
12
+ if (!friends || !friends.textContent?.trim()) return null;
13
+ return (0, _litHtml.html)`
14
+ <section
15
+ class="friendListSection"
16
+ role="region"
17
+ aria-labelledby="friends-section-title"
18
+ data-testid="friend-list"
19
+ >
20
+ <nav aria-label="Friend profiles">
21
+ <ul class="list-reset zebra-stripe" role="list">
22
+ ${friends}
23
+ </ul>
24
+ </nav>
25
+ </section>
26
+ `;
33
27
  };
34
28
  exports.FriendList = FriendList;
35
- const createList = (subject, {
29
+ const extractFriends = (subject, {
36
30
  dom
37
31
  }) => {
38
32
  const target = dom.createElement('div');
@@ -42,5 +36,20 @@ const createList = (subject, {
42
36
  predicate: _solidUi.ns.foaf('knows'),
43
37
  noun: 'friend'
44
38
  });
45
- if (target.textContent === '') return null;else return target;
46
- };
39
+ if (target.textContent === '') return null;
40
+ // Add 'friendItem' class and unique aria-label to each <li> for accessibility
41
+ target.querySelectorAll('li').forEach((li, idx) => {
42
+ li.classList.add('friendItem');
43
+ // Try to find a link or text to use as a label
44
+ const link = li.querySelector('a');
45
+ if (link && link.textContent) {
46
+ li.setAttribute('aria-label', `Friend: ${link.textContent.trim()}`);
47
+ } else if (li.textContent) {
48
+ li.setAttribute('aria-label', `Friend: ${li.textContent.trim()}`);
49
+ } else {
50
+ li.setAttribute('aria-label', `Friend ${idx + 1}`);
51
+ }
52
+ });
53
+ return target;
54
+ };
55
+ exports.extractFriends = extractFriends;
@@ -1,4 +1,6 @@
1
- import { TemplateResult } from 'lit-html';
1
+ import './styles/ProfileCard.css';
2
2
  import { ProfilePresentation } from './presenter';
3
- export declare const ProfileCard: ({ name, imageSrc, introduction, location, pronouns, highlightColor, }: ProfilePresentation) => TemplateResult;
3
+ import { DataBrowserContext } from 'pane-registry';
4
+ import { NamedNode } from 'rdflib';
5
+ export declare const ProfileCard: ({ name, imageSrc, introduction, location, pronouns, highlightColor, backgroundColor }: ProfilePresentation, context: DataBrowserContext, subject: NamedNode) => import("lit-html").TemplateResult<1>;
4
6
  //# sourceMappingURL=ProfileCard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileCard.d.ts","sourceRoot":"","sources":["../src/ProfileCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,UAAU,CAAA;AASxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAQjD,eAAO,MAAM,WAAW,GAAI,uEAOzB,mBAAmB,KAAG,cAexB,CAAA"}
1
+ {"version":3,"file":"ProfileCard.d.ts","sourceRoot":"","sources":["../src/ProfileCard.ts"],"names":[],"mappings":"AACA,OAAO,0BAA0B,CAAA;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAIlC,eAAO,MAAM,WAAW,GAAI,uFAEzB,mBAAmB,EAAE,SAAS,kBAAkB,EAAE,SAAS,SAAS,yCAwBtE,CAAA"}
@@ -5,39 +5,58 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ProfileCard = void 0;
7
7
  var _litHtml = require("lit-html");
8
- var _styleMap = require("lit-html/directives/style-map.js");
9
- var _baseStyles = require("./baseStyles");
10
- const styles = {
11
- image: (0, _styleMap.styleMap)((0, _baseStyles.fullWidth)()),
12
- intro: (0, _styleMap.styleMap)({
13
- ...(0, _baseStyles.textGray)(),
14
- ...(0, _baseStyles.textCenter)()
15
- }),
16
- info: (0, _styleMap.styleMap)((0, _baseStyles.padding)())
17
- };
8
+ require("./styles/ProfileCard.css");
9
+ var _addMeToYourFriends = require("./addMeToYourFriends");
10
+ var _QRCodeCard = require("./QRCodeCard");
18
11
  const ProfileCard = ({
19
12
  name,
20
13
  imageSrc,
21
14
  introduction,
22
15
  location,
23
16
  pronouns,
24
- highlightColor
25
- }) => {
26
- const nameStyle = (0, _styleMap.styleMap)({
27
- ...(0, _baseStyles.heading)(),
28
- 'text-decoration': 'underline',
29
- 'text-decoration-color': highlightColor
30
- });
17
+ highlightColor,
18
+ backgroundColor
19
+ }, context, subject) => {
31
20
  return (0, _litHtml.html)`
32
- ${Image(imageSrc, name)}
33
- <div style=${styles.info}>
34
- <h3 style=${nameStyle}>${name}</h3>
35
- <div style=${styles.intro}>
36
- ${Line(introduction)} ${Line(location, '🌐')} ${Line(pronouns)}
21
+ <article class="profileCard" aria-labelledby="profile-name">
22
+ <h2 id="profile-name" class="sr-only">${name}</h2>
23
+ <header class="header flex-column-center mb-md" aria-label="Profile information">
24
+ ${Image(imageSrc, name)}
25
+ </header>
26
+
27
+ <section class="intro text-center" aria-label="About">
28
+ ${Line(introduction, '', 'About')}
29
+ ${Line(location, '🌐', 'Location')}
30
+ ${Line(pronouns, '', 'Pronouns')}
31
+ </section>
32
+
33
+ <section class="buttonSection text-center" aria-label="Actions">
34
+ ${(0, _addMeToYourFriends.addMeToYourFriendsDiv)(subject, context)}
35
+ </section>
36
+
37
+ <div class="qrCodeSection section-centered">
38
+ ${(0, _QRCodeCard.QRCodeCard)(highlightColor, backgroundColor, subject)}
37
39
  </div>
38
- </div>
40
+ </article>
39
41
  `;
40
42
  };
41
43
  exports.ProfileCard = ProfileCard;
42
- const Line = (value, prefix = _litHtml.nothing) => value ? (0, _litHtml.html)`<p>${prefix} ${value}</p>` : _litHtml.nothing;
43
- const Image = (src, alt) => src ? (0, _litHtml.html)`<img style=${styles.image} src=${src} alt=${alt} />` : _litHtml.nothing;
44
+ const Line = (value, prefix = _litHtml.nothing, label = '') => value ? (0, _litHtml.html)`
45
+ <div class="details" role="text" ${label ? `aria-label="${label}: ${value}"` : ''}>
46
+ ${prefix} ${value}
47
+ </div>
48
+ ` : _litHtml.nothing;
49
+ const Image = (src, alt) => src ? (0, _litHtml.html)`
50
+ <img
51
+ class="image"
52
+ src=${src}
53
+ alt="Profile photo of ${alt}"
54
+ width="160"
55
+ height="160"
56
+ loading="eager"
57
+ />
58
+ ` : (0, _litHtml.html)`
59
+ <div class="image-alt" role="img" aria-label="${alt}" tabindex="0">
60
+ ${alt}
61
+ </div>
62
+ `;
@@ -1,5 +1,6 @@
1
1
  import { TemplateResult } from 'lit-html';
2
2
  import { DataBrowserContext } from 'pane-registry';
3
3
  import { NamedNode } from 'rdflib';
4
+ import './styles/ProfileView.css';
4
5
  export declare function ProfileView(subject: NamedNode, context: DataBrowserContext): Promise<TemplateResult>;
5
6
  //# sourceMappingURL=ProfileView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProfileView.d.ts","sourceRoot":"","sources":["../src/ProfileView.ts"],"names":[],"mappings":"AAGA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AA2B7C,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAE,cAAc,CAAC,CAuC1B"}
1
+ {"version":3,"file":"ProfileView.d.ts","sourceRoot":"","sources":["../src/ProfileView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAC7C,OAAO,0BAA0B,CAAA;AAwBjC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAE,cAAc,CAAC,CAiI1B"}