profile-pane 3.2.3-1 → 3.2.3-2

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 (107) hide show
  1. package/lib/ProfileView.css +73 -236
  2. package/lib/ProfileView.d.ts +2 -1
  3. package/lib/ProfileView.d.ts.map +1 -1
  4. package/lib/ProfileView.js +19 -18
  5. package/lib/index.d.ts.map +1 -1
  6. package/lib/index.js +35 -35
  7. package/lib/profile-pane.js +16896 -25053
  8. package/lib/profile-pane.js.map +1 -1
  9. package/lib/profile-pane.min.js +826 -1185
  10. package/lib/profile-pane.min.js.map +1 -1
  11. package/lib/sections/bio/BioSection.css +16 -123
  12. package/lib/sections/bio/BioSection.d.ts +2 -2
  13. package/lib/sections/bio/BioSection.d.ts.map +1 -1
  14. package/lib/sections/bio/BioSection.js +23 -32
  15. package/lib/sections/contactInfo/ContactInfoEditDialog.css +33 -66
  16. package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -1
  17. package/lib/sections/contactInfo/ContactInfoEditDialog.js +15 -39
  18. package/lib/sections/contactInfo/ContactInfoSection.css +7 -7
  19. package/lib/sections/contactInfo/ContactInfoSection.d.ts +2 -2
  20. package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -1
  21. package/lib/sections/contactInfo/ContactInfoSection.js +34 -49
  22. package/lib/sections/education/EducationSection.d.ts +1 -1
  23. package/lib/sections/education/EducationSection.d.ts.map +1 -1
  24. package/lib/sections/education/EducationSection.js +2 -3
  25. package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -1
  26. package/lib/sections/heading/HeadingEditDialog.js +1 -9
  27. package/lib/sections/heading/HeadingSection.css +122 -346
  28. package/lib/sections/heading/HeadingSection.d.ts +2 -3
  29. package/lib/sections/heading/HeadingSection.d.ts.map +1 -1
  30. package/lib/sections/heading/HeadingSection.js +13 -19
  31. package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -1
  32. package/lib/sections/languages/LanguageEditDialog.js +7 -8
  33. package/lib/sections/languages/LanguageSection.css +6 -6
  34. package/lib/sections/languages/LanguageSection.d.ts +2 -2
  35. package/lib/sections/languages/LanguageSection.d.ts.map +1 -1
  36. package/lib/sections/languages/LanguageSection.js +33 -49
  37. package/lib/sections/projects/ProjectEditDialog.d.ts +0 -1
  38. package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -1
  39. package/lib/sections/projects/ProjectEditDialog.js +2 -6
  40. package/lib/sections/projects/ProjectSection.css +36 -94
  41. package/lib/sections/projects/ProjectSection.d.ts +2 -2
  42. package/lib/sections/projects/ProjectSection.d.ts.map +1 -1
  43. package/lib/sections/projects/ProjectSection.js +28 -49
  44. package/lib/sections/resume/ResumeEditDialog.d.ts +0 -1
  45. package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -1
  46. package/lib/sections/resume/ResumeEditDialog.js +20 -40
  47. package/lib/sections/resume/ResumeSection.css +51 -133
  48. package/lib/sections/resume/ResumeSection.d.ts +3 -3
  49. package/lib/sections/resume/ResumeSection.d.ts.map +1 -1
  50. package/lib/sections/resume/ResumeSection.js +28 -42
  51. package/lib/sections/shared/sectionCardHelpers.js +15 -15
  52. package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -1
  53. package/lib/sections/skills/SkillsEditDialog.js +1 -3
  54. package/lib/sections/skills/SkillsSection.css +20 -67
  55. package/lib/sections/skills/SkillsSection.d.ts +2 -2
  56. package/lib/sections/skills/SkillsSection.d.ts.map +1 -1
  57. package/lib/sections/skills/SkillsSection.js +36 -55
  58. package/lib/sections/social/SocialEditDialog.d.ts.map +1 -1
  59. package/lib/sections/social/SocialEditDialog.js +4 -9
  60. package/lib/sections/social/SocialSection.css +19 -70
  61. package/lib/sections/social/SocialSection.d.ts +2 -2
  62. package/lib/sections/social/SocialSection.d.ts.map +1 -1
  63. package/lib/sections/social/SocialSection.js +37 -61
  64. package/lib/specialButtons/addMeToYourFriends.d.ts.map +1 -1
  65. package/lib/specialButtons/addMeToYourFriends.js +0 -2
  66. package/lib/styles/CollapsibleSection.css +39 -223
  67. package/lib/styles/EditDialogs.css +90 -284
  68. package/lib/styles/EditDialogs.responsive.css +72 -147
  69. package/lib/types.d.ts +1 -0
  70. package/lib/types.d.ts.map +1 -1
  71. package/lib/ui/dialog.css +18 -89
  72. package/lib/ui/dialog.d.ts.map +1 -1
  73. package/lib/ui/dialog.js +5 -9
  74. package/lib/ui/dialog.responsive.css +31 -34
  75. package/lib/ui/responsiveActionButton.d.ts +19 -0
  76. package/lib/ui/responsiveActionButton.d.ts.map +1 -0
  77. package/lib/ui/responsiveActionButton.js +34 -0
  78. package/lib/utils/resize.d.ts +2 -0
  79. package/lib/utils/resize.d.ts.map +1 -0
  80. package/lib/utils/resize.js +40 -0
  81. package/package.json +11 -13
  82. package/lib/303.profile-pane.js +0 -1362
  83. package/lib/303.profile-pane.js.map +0 -1
  84. package/lib/303.profile-pane.min.js +0 -2
  85. package/lib/303.profile-pane.min.js.map +0 -1
  86. package/lib/specialButtons/addContact/AddMeToYourContacts.css +0 -1118
  87. package/lib/specialButtons/addContact/ContactCreationDialog.d.ts +0 -10
  88. package/lib/specialButtons/addContact/ContactCreationDialog.d.ts.map +0 -1
  89. package/lib/specialButtons/addContact/ContactCreationDialog.js +0 -1123
  90. package/lib/specialButtons/addContact/addMeToYourContacts.d.ts +0 -16
  91. package/lib/specialButtons/addContact/addMeToYourContacts.d.ts.map +0 -1
  92. package/lib/specialButtons/addContact/addMeToYourContacts.js +0 -136
  93. package/lib/specialButtons/addContact/contactsErrors.d.ts +0 -8
  94. package/lib/specialButtons/addContact/contactsErrors.d.ts.map +0 -1
  95. package/lib/specialButtons/addContact/contactsErrors.js +0 -106
  96. package/lib/specialButtons/addContact/contactsTypes.d.ts +0 -43
  97. package/lib/specialButtons/addContact/contactsTypes.d.ts.map +0 -1
  98. package/lib/specialButtons/addContact/contactsTypes.js +0 -5
  99. package/lib/specialButtons/addContact/helpers.d.ts +0 -7
  100. package/lib/specialButtons/addContact/helpers.d.ts.map +0 -1
  101. package/lib/specialButtons/addContact/helpers.js +0 -103
  102. package/lib/specialButtons/addContact/mutations.d.ts +0 -16
  103. package/lib/specialButtons/addContact/mutations.d.ts.map +0 -1
  104. package/lib/specialButtons/addContact/mutations.js +0 -300
  105. package/lib/specialButtons/addContact/selectors.d.ts +0 -10
  106. package/lib/specialButtons/addContact/selectors.d.ts.map +0 -1
  107. package/lib/specialButtons/addContact/selectors.js +0 -163
@@ -20,30 +20,31 @@ var _SocialSection = require("./sections/social/SocialSection");
20
20
  var _QRCodeSection = require("./sections/qrcode/QRCodeSection");
21
21
  function getViewerMode(subject) {
22
22
  let mode = 'anonymous';
23
- if (_solidLogic.authn.currentUser() && _solidLogic.authn.currentUser().sameTerm(subject)) mode = 'owner';
24
- if (_solidLogic.authn.currentUser() && !_solidLogic.authn.currentUser().sameTerm(subject)) mode = 'authenticated';
23
+ const currentUser = _solidLogic.authn.currentUser();
24
+ const sameTerm = currentUser ? currentUser.sameTerm(subject) : false;
25
+ if (currentUser && sameTerm) mode = 'owner';
26
+ if (currentUser && !sameTerm) mode = 'authenticated';
25
27
  return mode;
26
28
  }
27
- function renderSidebar(store, subject, accounts, skills, languages, contactInfo, viewerMode, onSaved) {
29
+ function renderSidebar(store, subject, accounts, skills, languages, contactInfo, viewerMode, layout, onSaved) {
28
30
  return (0, _litHtml.html)`
29
31
  <div
30
32
  class="profile__sidebar"
31
33
  >
32
34
  <aside class="profile__sidebar-content" aria-labelledby="profile-sidebar-heading">
33
35
  <h2 id="profile-sidebar-heading" class="sr-only">Profile sidebar</h2>
34
- ${(0, _SocialSection.renderSocialSection)(store, subject, accounts, viewerMode, onSaved)}
35
- ${(0, _SkillsSection.renderSkillsSection)(store, subject, skills, viewerMode, onSaved)}
36
- ${(0, _LanguageSection.renderLanguageSection)(store, subject, languages, viewerMode, onSaved)}
37
- ${(0, _ContactInfoSection.renderContactInfoSection)(store, subject, contactInfo, viewerMode, onSaved)}
36
+ ${(0, _SocialSection.renderSocialSection)(store, subject, accounts, viewerMode, layout, onSaved)}
37
+ ${(0, _SkillsSection.renderSkillsSection)(store, subject, skills, viewerMode, layout, onSaved)}
38
+ ${(0, _LanguageSection.renderLanguageSection)(store, subject, languages, viewerMode, layout, onSaved)}
39
+ ${(0, _ContactInfoSection.renderContactInfoSection)(store, subject, contactInfo, viewerMode, layout, onSaved)}
38
40
  ${(0, _QRCodeSection.renderQRCodeSection)(subject, store)}
39
41
  </aside>
40
42
  </div>
41
43
  `;
42
44
  }
43
- async function ProfileView(subject, context, onSaved) {
45
+ async function ProfileView(subject, context, layout, onSaved) {
44
46
  const store = context.session.store;
45
47
  const viewerMode = getViewerMode(subject);
46
- const layout = context.environment?.layout ?? 'desktop';
47
48
  const theme = context.environment?.theme ?? 'light';
48
49
  const inputMode = context.environment?.inputMode ?? 'pointer';
49
50
  const viewModel = await (0, _ProfileViewModelPresenter.presentProfileViewModel)(subject, store);
@@ -55,14 +56,14 @@ async function ProfileView(subject, context, onSaved) {
55
56
  const bioDetails = viewModel.bioDetails;
56
57
  const accounts = viewModel.social;
57
58
  const contactInfo = viewModel.contactInfo;
58
- const headingSection = await (0, _HeadingSection.renderHeadingSection)(context, subject, profileDetails, viewerMode, onSaved);
59
- const bioSection = (0, _BioSection.renderBioSection)(store, subject, bioDetails, viewerMode, onSaved);
60
- const skillsSection = (0, _SkillsSection.renderSkillsSection)(store, subject, skills, viewerMode, onSaved);
61
- const languageSection = (0, _LanguageSection.renderLanguageSection)(store, subject, languages, viewerMode, onSaved);
62
- const cvSection = (0, _ResumeSection.renderCVSection)(store, subject, rolesByType, viewerMode, onSaved);
63
- const projectSection = (0, _ProjectSection.renderProjectSection)(store, subject, projects, viewerMode, onSaved);
64
- const socialSection = (0, _SocialSection.renderSocialSection)(store, subject, accounts, viewerMode, onSaved);
65
- const contactInfoSection = (0, _ContactInfoSection.renderContactInfoSection)(store, subject, contactInfo, viewerMode, onSaved);
59
+ const headingSection = await (0, _HeadingSection.renderHeadingSection)(context, subject, profileDetails, viewerMode, layout, onSaved);
60
+ const bioSection = (0, _BioSection.renderBioSection)(store, subject, bioDetails, viewerMode, layout, onSaved);
61
+ const skillsSection = (0, _SkillsSection.renderSkillsSection)(store, subject, skills, viewerMode, layout, onSaved);
62
+ const languageSection = (0, _LanguageSection.renderLanguageSection)(store, subject, languages, viewerMode, layout, onSaved);
63
+ const cvSection = (0, _ResumeSection.renderCVSection)(store, subject, rolesByType, viewerMode, layout, onSaved);
64
+ const projectSection = (0, _ProjectSection.renderProjectSection)(store, subject, projects, viewerMode, layout, onSaved);
65
+ const socialSection = (0, _SocialSection.renderSocialSection)(store, subject, accounts, viewerMode, layout, onSaved);
66
+ const contactInfoSection = (0, _ContactInfoSection.renderContactInfoSection)(store, subject, contactInfo, viewerMode, layout, onSaved);
66
67
  const qrCodeSection = (0, _QRCodeSection.renderQRCodeSection)(subject, store);
67
68
  if (layout === 'mobile') {
68
69
  return (0, _litHtml.html)`
@@ -110,7 +111,7 @@ async function ProfileView(subject, context, onSaved) {
110
111
  ${projectSection}
111
112
 
112
113
  </section>
113
- ${renderSidebar(store, subject, accounts, skills, languages, contactInfo, viewerMode, onSaved)}
114
+ ${renderSidebar(store, subject, accounts, skills, languages, contactInfo, viewerMode, layout, onSaved)}
114
115
  </div>
115
116
  </div>
116
117
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAK7C,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EACnB,MAAM,qCAAqC,CAAA;AAsG5C,QAAA,MAAM,IAAI;;;;qBAKG,SAAS,WACT,kBAAkB,KAC1B,MAAM,GAAG,IAAI;sBAWE,SAAS,WAAW,kBAAkB,KAAG,WAAW;CAqBvE,CAAA;AAED,eAAe,IAAI,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAa,MAAM,QAAQ,CAAA;AAO7C,OAAO,EACL,qBAAqB,EACrB,8BAA8B,EAC9B,YAAY,EACZ,kBAAkB,EACnB,MAAM,qCAAqC,CAAA;AAwF5C,QAAA,MAAM,IAAI;;;;qBAKG,SAAS,WACT,kBAAkB,KAC1B,MAAM,GAAG,IAAI;sBAWE,SAAS,WAAW,kBAAkB,KAAG,WAAW;CA8BvE,CAAA;AAED,eAAe,IAAI,CAAA"}
package/lib/index.js CHANGED
@@ -32,19 +32,39 @@ var _litHtml = require("lit-html");
32
32
  var _ProfileView = require("./ProfileView");
33
33
  var _solidUi = require("solid-ui");
34
34
  var _QRCodeCard = require("./sections/qrcode/QRCodeCard");
35
+ var _resize = require("./utils/resize");
35
36
  var _addMeToYourFriends = require("./specialButtons/addMeToYourFriends");
37
+ const MOBILE_LAYOUT_MAX_WIDTH = 768;
38
+ const HEADING_SECTION_SELECTOR = '[data-profile-section="heading"]';
39
+ const SOCIAL_SECTION_SELECTOR = '[data-profile-section="social"]';
36
40
  async function loadExtendedProfile(store, subject) {
37
41
  const otherProfiles = store.each(subject, _solidUi.ns.rdfs('seeAlso'), null, subject.doc());
38
42
  if (otherProfiles.length > 0) {
39
43
  await store.fetcher.load(otherProfiles);
40
44
  }
41
45
  }
42
- const HEADING_SECTION_SELECTOR = '[data-profile-section="heading"]';
43
- const SOCIAL_SECTION_SELECTOR = '[data-profile-section="social"]';
46
+ function measureLayout(context, root) {
47
+ if (context.environment?.layout === 'mobile') {
48
+ return 'mobile';
49
+ }
50
+ if (typeof window === 'undefined') {
51
+ return 'desktop';
52
+ }
53
+ const measuredWidth = root?.getBoundingClientRect().width || window.innerWidth;
54
+ return measuredWidth <= MOBILE_LAYOUT_MAX_WIDTH ? 'mobile' : 'desktop';
55
+ }
56
+ function syncRenderedLayout(root, context, onLayoutChange) {
57
+ const updateLayout = () => {
58
+ const nextLayout = measureLayout(context, root);
59
+ if (nextLayout !== root.dataset.layout) {
60
+ onLayoutChange(nextLayout);
61
+ }
62
+ };
63
+ const grid = root.querySelector('.profile-grid');
64
+ return (0, _resize.createResizeDrivenSync)(updateLayout, [root, grid]);
65
+ }
44
66
  function syncSocialSectionHeight(root) {
45
- let animationFrameId = 0;
46
67
  const updateHeight = () => {
47
- animationFrameId = 0;
48
68
  const grid = root.querySelector('.profile-grid');
49
69
  const headingSection = root.querySelector(HEADING_SECTION_SELECTOR);
50
70
  const socialSection = root.querySelector(SOCIAL_SECTION_SELECTOR);
@@ -61,38 +81,9 @@ function syncSocialSectionHeight(root) {
61
81
  socialSection.style.minHeight = nextMinHeight;
62
82
  }
63
83
  };
64
- const scheduleUpdate = () => {
65
- if (animationFrameId !== 0) {
66
- return;
67
- }
68
- animationFrameId = window.requestAnimationFrame(updateHeight);
69
- };
70
- updateHeight();
71
- if (typeof ResizeObserver === 'undefined') {
72
- window.addEventListener('resize', scheduleUpdate);
73
- return () => {
74
- if (animationFrameId !== 0) {
75
- window.cancelAnimationFrame(animationFrameId);
76
- }
77
- window.removeEventListener('resize', scheduleUpdate);
78
- };
79
- }
80
- const resizeObserver = new ResizeObserver(scheduleUpdate);
81
- resizeObserver.observe(root);
82
84
  const headingSection = root.querySelector(HEADING_SECTION_SELECTOR);
83
85
  const socialSection = root.querySelector(SOCIAL_SECTION_SELECTOR);
84
- if (headingSection) {
85
- resizeObserver.observe(headingSection);
86
- }
87
- if (socialSection) {
88
- resizeObserver.observe(socialSection);
89
- }
90
- return () => {
91
- if (animationFrameId !== 0) {
92
- window.cancelAnimationFrame(animationFrameId);
93
- }
94
- resizeObserver.disconnect();
95
- };
86
+ return (0, _resize.createResizeDrivenSync)(updateHeight, [root, headingSection, socialSection]);
96
87
  }
97
88
  function applyEnvironmentAttributes(element, context) {
98
89
  const layout = context.environment?.layout ?? 'desktop';
@@ -118,12 +109,21 @@ const Pane = {
118
109
  const target = context.dom.createElement('div');
119
110
  const store = context.session.store;
120
111
  let cleanupSocialSectionHeightSync = null;
112
+ let cleanupLayoutSync = null;
113
+ let currentLayout = measureLayout(context, target);
121
114
  applyEnvironmentAttributes(target, context);
115
+ target.dataset.layout = currentLayout;
122
116
  const renderWithData = async () => {
123
117
  applyEnvironmentAttributes(target, context);
124
- (0, _litHtml.render)(await (0, _ProfileView.ProfileView)(subject, context, renderWithData), target);
118
+ target.dataset.layout = currentLayout;
119
+ (0, _litHtml.render)(await (0, _ProfileView.ProfileView)(subject, context, currentLayout, renderWithData), target);
125
120
  cleanupSocialSectionHeightSync?.();
126
121
  cleanupSocialSectionHeightSync = syncSocialSectionHeight(target);
122
+ cleanupLayoutSync?.();
123
+ cleanupLayoutSync = syncRenderedLayout(target, context, nextLayout => {
124
+ currentLayout = nextLayout;
125
+ void renderWithData();
126
+ });
127
127
  await (0, _QRCodeCard.hydrateQRCodes)(target);
128
128
  };
129
129
  loadExtendedProfile(store, subject).then(async () => {