profile-pane 3.1.4 → 3.2.0
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/README.md +16 -0
- package/lib/04567ff683933c35c465.png +0 -0
- package/lib/10163fd9b5a0e00d63a0.png +0 -0
- package/lib/1234dcb2eec2e45f252b.png +0 -0
- package/lib/20899934157df4db56cb.png +0 -0
- package/lib/33760bf79f097f449da5.png +0 -0
- package/lib/578d2b6ed32e7624164e.png +0 -0
- package/lib/5f62a5b2b7e99b9640c7.png +0 -0
- package/lib/6525766ecd288ec60129.png +0 -0
- package/lib/7800be6f6c4b5b0f4f20.png +0 -0
- package/lib/976473cf5fe24d657d4b.png +0 -0
- package/lib/ChatWithMe.d.ts +2 -1
- package/lib/ChatWithMe.d.ts.map +1 -1
- package/lib/ChatWithMe.js +3 -3
- package/lib/ProfileView.d.ts +1 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +71 -131
- package/lib/ProfileViewModelPresenter.d.ts +23 -0
- package/lib/ProfileViewModelPresenter.d.ts.map +1 -0
- package/lib/ProfileViewModelPresenter.js +37 -0
- package/lib/QRCodeCard.d.ts +3 -1
- package/lib/QRCodeCard.d.ts.map +1 -1
- package/lib/QRCodeCard.js +86 -66
- package/lib/addMeToYourFriends.d.ts +3 -3
- package/lib/addMeToYourFriends.d.ts.map +1 -1
- package/lib/addMeToYourFriends.js +14 -30
- package/lib/bda84f59e7216675a208.png +0 -0
- package/lib/buttonsHelper.js +1 -1
- package/lib/cd68e8f3990ba8b2139e.png +0 -0
- package/lib/e7074a7e2cb69e51cfd3.png +0 -0
- package/lib/editProfilePane/EditCVCard.d.ts +1 -0
- package/lib/editProfilePane/EditCVCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCVCard.js +2 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +2 -1
- package/lib/editProfilePane/EditContactsCard.d.ts +1 -0
- package/lib/editProfilePane/EditContactsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditContactsCard.js +2 -0
- package/lib/editProfilePane/EditFriendsCard.d.ts +1 -1
- package/lib/editProfilePane/EditFriendsCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +2 -1
- package/lib/editProfilePane/EditOtherPreferences.d.ts +1 -0
- package/lib/editProfilePane/EditOtherPreferences.d.ts.map +1 -1
- package/lib/editProfilePane/EditOtherPreferences.js +1 -0
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +1 -1
- package/lib/editProfilePane/EditSocialCard.d.ts +1 -0
- package/lib/editProfilePane/EditSocialCard.d.ts.map +1 -1
- package/lib/editProfilePane/EditSocialCard.js +2 -1
- package/lib/editProfilePane/editProfilePresenter.d.ts +1 -0
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +2 -0
- package/lib/f3772696fb7ee53c23d8.png +0 -0
- package/lib/icons-svg/contactIcons.d.ts +3 -0
- package/lib/icons-svg/contactIcons.d.ts.map +1 -0
- package/lib/icons-svg/contactIcons.js +32 -0
- package/lib/icons-svg/profileIcons.d.ts +22 -0
- package/lib/icons-svg/profileIcons.d.ts.map +1 -0
- package/lib/icons-svg/profileIcons.js +309 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +42 -19
- package/lib/profile-pane.js +15629 -5666
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2171 -230
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +1 -0
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +2 -0
- package/lib/sections/bio/BioEditDialog.d.ts +6 -0
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -0
- package/lib/sections/bio/BioEditDialog.js +119 -0
- package/lib/sections/bio/BioSection.d.ts +7 -0
- package/lib/sections/bio/BioSection.d.ts.map +1 -0
- package/lib/sections/bio/BioSection.js +131 -0
- package/lib/sections/bio/mutations.d.ts +4 -0
- package/lib/sections/bio/mutations.d.ts.map +1 -0
- package/lib/sections/bio/mutations.js +43 -0
- package/lib/sections/bio/selectors.d.ts +4 -0
- package/lib/sections/bio/selectors.d.ts.map +1 -0
- package/lib/sections/bio/selectors.js +15 -0
- package/lib/sections/bio/types.d.ts +15 -0
- package/lib/sections/bio/types.d.ts.map +1 -0
- package/lib/sections/bio/types.js +5 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +7 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +658 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +5 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -0
- package/lib/sections/contactInfo/ContactInfoSection.js +229 -0
- package/lib/sections/contactInfo/mutations.d.ts +4 -0
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -0
- package/lib/sections/contactInfo/mutations.js +150 -0
- package/lib/sections/contactInfo/selectors.d.ts +4 -0
- package/lib/sections/contactInfo/selectors.d.ts.map +1 -0
- package/lib/sections/contactInfo/selectors.js +104 -0
- package/lib/sections/contactInfo/types.d.ts +44 -0
- package/lib/sections/contactInfo/types.d.ts.map +1 -0
- package/lib/sections/contactInfo/types.js +5 -0
- package/lib/sections/education/EducationEditDialog.d.ts +7 -0
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -0
- package/lib/sections/education/EducationEditDialog.js +459 -0
- package/lib/sections/education/EducationSection.d.ts +7 -0
- package/lib/sections/education/EducationSection.d.ts.map +1 -0
- package/lib/sections/education/EducationSection.js +126 -0
- package/lib/sections/education/mutations.d.ts +4 -0
- package/lib/sections/education/mutations.d.ts.map +1 -0
- package/lib/sections/education/mutations.js +60 -0
- package/lib/sections/education/selectors.d.ts +4 -0
- package/lib/sections/education/selectors.d.ts.map +1 -0
- package/lib/sections/education/selectors.js +64 -0
- package/lib/sections/education/types.d.ts +20 -0
- package/lib/sections/education/types.d.ts.map +1 -0
- package/lib/sections/education/types.js +5 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts +6 -0
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -0
- package/lib/sections/heading/HeadingEditDialog.js +742 -0
- package/lib/sections/heading/HeadingSection.d.ts +9 -0
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -0
- package/lib/sections/heading/HeadingSection.js +97 -0
- package/lib/sections/heading/camera.d.ts +19 -0
- package/lib/sections/heading/camera.d.ts.map +1 -0
- package/lib/sections/heading/camera.js +199 -0
- package/lib/sections/heading/dateHelpers.d.ts +4 -0
- package/lib/sections/heading/dateHelpers.d.ts.map +1 -0
- package/lib/sections/heading/dateHelpers.js +48 -0
- package/lib/sections/heading/imageHelpers.d.ts +4 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -0
- package/lib/sections/heading/imageHelpers.js +81 -0
- package/lib/sections/heading/mutations.d.ts +4 -0
- package/lib/sections/heading/mutations.d.ts.map +1 -0
- package/lib/sections/heading/mutations.js +190 -0
- package/lib/sections/heading/selectors.d.ts +5 -0
- package/lib/sections/heading/selectors.d.ts.map +1 -0
- package/lib/sections/heading/selectors.js +157 -0
- package/lib/sections/heading/types.d.ts +36 -0
- package/lib/sections/heading/types.d.ts.map +1 -0
- package/lib/sections/heading/types.js +5 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts +7 -0
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -0
- package/lib/sections/languages/LanguageEditDialog.js +457 -0
- package/lib/sections/languages/LanguageSection.d.ts +5 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -0
- package/lib/sections/languages/LanguageSection.js +137 -0
- package/lib/sections/languages/mutations.d.ts +6 -0
- package/lib/sections/languages/mutations.d.ts.map +1 -0
- package/lib/sections/languages/mutations.js +296 -0
- package/lib/sections/languages/selectors.d.ts +5 -0
- package/lib/sections/languages/selectors.d.ts.map +1 -0
- package/lib/sections/languages/selectors.js +146 -0
- package/lib/sections/languages/types.d.ts +15 -0
- package/lib/sections/languages/types.d.ts.map +1 -0
- package/lib/sections/languages/types.js +5 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts +7 -0
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -0
- package/lib/sections/projects/ProjectEditDialog.js +182 -0
- package/lib/sections/projects/ProjectSection.d.ts +6 -0
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -0
- package/lib/sections/projects/ProjectSection.js +220 -0
- package/lib/sections/projects/mutations.d.ts +4 -0
- package/lib/sections/projects/mutations.d.ts.map +1 -0
- package/lib/sections/projects/mutations.js +188 -0
- package/lib/sections/projects/selectors.d.ts +5 -0
- package/lib/sections/projects/selectors.d.ts.map +1 -0
- package/lib/sections/projects/selectors.js +163 -0
- package/lib/sections/projects/types.d.ts +28 -0
- package/lib/sections/projects/types.d.ts.map +1 -0
- package/lib/sections/projects/types.js +8 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +7 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -0
- package/lib/sections/resume/ResumeEditDialog.js +629 -0
- package/lib/sections/resume/ResumeSection.d.ts +7 -0
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -0
- package/lib/sections/resume/ResumeSection.js +160 -0
- package/lib/sections/resume/mutations.d.ts +6 -0
- package/lib/sections/resume/mutations.d.ts.map +1 -0
- package/lib/sections/resume/mutations.js +172 -0
- package/lib/sections/resume/selectors.d.ts +4 -0
- package/lib/sections/resume/selectors.d.ts.map +1 -0
- package/lib/sections/resume/selectors.js +142 -0
- package/lib/sections/resume/types.d.ts +33 -0
- package/lib/sections/resume/types.d.ts.map +1 -0
- package/lib/sections/resume/types.js +8 -0
- package/lib/sections/shared/collapsibleSection.d.ts +2 -0
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -0
- package/lib/sections/shared/collapsibleSection.js +24 -0
- package/lib/sections/shared/contactTypeUtils.d.ts +7 -0
- package/lib/sections/shared/contactTypeUtils.d.ts.map +1 -0
- package/lib/sections/shared/contactTypeUtils.js +48 -0
- package/lib/sections/shared/idNodeFactory.d.ts +3 -0
- package/lib/sections/shared/idNodeFactory.d.ts.map +1 -0
- package/lib/sections/shared/idNodeFactory.js +14 -0
- package/lib/sections/shared/phoneCountries.d.ts +20 -0
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -0
- package/lib/sections/shared/phoneCountries.js +1080 -0
- package/lib/sections/shared/rdfList.d.ts +3 -0
- package/lib/sections/shared/rdfList.d.ts.map +1 -0
- package/lib/sections/shared/rdfList.js +34 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +12 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -0
- package/lib/sections/shared/rdfMutationHelpers.js +82 -0
- package/lib/sections/shared/rowState.d.ts +21 -0
- package/lib/sections/shared/rowState.d.ts.map +1 -0
- package/lib/sections/shared/rowState.js +52 -0
- package/lib/sections/shared/sanitizeUtils.d.ts +5 -0
- package/lib/sections/shared/sanitizeUtils.d.ts.map +1 -0
- package/lib/sections/shared/sanitizeUtils.js +22 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts +11 -0
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -0
- package/lib/sections/shared/sectionCardHelpers.js +105 -0
- package/lib/sections/shared/types.d.ts +7 -0
- package/lib/sections/shared/types.d.ts.map +1 -0
- package/lib/sections/shared/types.js +5 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts +7 -0
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -0
- package/lib/sections/skills/SkillsEditDialog.js +340 -0
- package/lib/sections/skills/SkillsSection.d.ts +5 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -0
- package/lib/sections/skills/SkillsSection.js +169 -0
- package/lib/sections/skills/mutations.d.ts +6 -0
- package/lib/sections/skills/mutations.d.ts.map +1 -0
- package/lib/sections/skills/mutations.js +110 -0
- package/lib/sections/skills/selectors.d.ts +6 -0
- package/lib/sections/skills/selectors.d.ts.map +1 -0
- package/lib/sections/skills/selectors.js +37 -0
- package/lib/sections/skills/types.d.ts +14 -0
- package/lib/sections/skills/types.d.ts.map +1 -0
- package/lib/sections/skills/types.js +5 -0
- package/lib/sections/social/SocialEditDialog.d.ts +7 -0
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -0
- package/lib/sections/social/SocialEditDialog.js +362 -0
- package/lib/sections/social/SocialSection.d.ts +8 -0
- package/lib/sections/social/SocialSection.d.ts.map +1 -0
- package/lib/sections/social/SocialSection.js +201 -0
- package/lib/sections/social/constants.d.ts +3 -0
- package/lib/sections/social/constants.d.ts.map +1 -0
- package/lib/sections/social/constants.js +16 -0
- package/lib/sections/social/helpers.d.ts +15 -0
- package/lib/sections/social/helpers.d.ts.map +1 -0
- package/lib/sections/social/helpers.js +316 -0
- package/lib/sections/social/mutations.d.ts +4 -0
- package/lib/sections/social/mutations.d.ts.map +1 -0
- package/lib/sections/social/mutations.js +298 -0
- package/lib/sections/social/selectors.d.ts +4 -0
- package/lib/sections/social/selectors.d.ts.map +1 -0
- package/lib/sections/social/selectors.js +43 -0
- package/lib/sections/social/types.d.ts +19 -0
- package/lib/sections/social/types.d.ts.map +1 -0
- package/lib/sections/social/types.js +5 -0
- package/lib/styles/BioSection.css +77 -0
- package/lib/styles/CVCard.css +107 -2
- package/lib/styles/ContactInfoEditDialog.css +153 -0
- package/lib/styles/EditDialogs.css +1028 -0
- package/lib/styles/EducationCard.css +103 -0
- package/lib/styles/HeadingSection.css +309 -0
- package/lib/styles/ProfileCard.css +10 -42
- package/lib/styles/ProfileView.css +53 -8
- package/lib/styles/ProjectsCard.css +206 -0
- package/lib/styles/QRCodeCard.css +29 -10
- package/lib/styles/SocialCard.css +41 -13
- package/lib/styles/dialog.css +209 -0
- package/lib/styles/utilities.css +638 -256
- package/lib/textUtils.d.ts +6 -0
- package/lib/textUtils.d.ts.map +1 -0
- package/lib/textUtils.js +44 -0
- package/lib/texts.d.ts +45 -4
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +46 -5
- package/lib/types.d.ts +2 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +5 -0
- package/lib/ui/dialog.d.ts +29 -0
- package/lib/ui/dialog.d.ts.map +1 -0
- package/lib/ui/dialog.js +269 -0
- package/lib/ui/errors.d.ts +2 -0
- package/lib/ui/errors.d.ts.map +1 -0
- package/lib/ui/errors.js +10 -0
- package/package.json +8 -6
- package/lib/CVCard.d.ts +0 -4
- package/lib/CVCard.d.ts.map +0 -1
- package/lib/CVCard.js +0 -114
- package/lib/CVPresenter.d.ts +0 -25
- package/lib/CVPresenter.d.ts.map +0 -1
- package/lib/CVPresenter.js +0 -119
- package/lib/FriendList.d.ts +0 -6
- package/lib/FriendList.d.ts.map +0 -1
- package/lib/FriendList.js +0 -27
- package/lib/ProfileCard.d.ts +0 -6
- package/lib/ProfileCard.d.ts.map +0 -1
- package/lib/ProfileCard.js +0 -62
- package/lib/SocialCard.d.ts +0 -5
- package/lib/SocialCard.d.ts.map +0 -1
- package/lib/SocialCard.js +0 -51
- package/lib/SocialPresenter.d.ts +0 -11
- package/lib/SocialPresenter.d.ts.map +0 -1
- package/lib/SocialPresenter.js +0 -117
- package/lib/StuffCard.d.ts +0 -10
- package/lib/StuffCard.d.ts.map +0 -1
- package/lib/StuffCard.js +0 -52
- package/lib/StuffPresenter.d.ts +0 -14
- package/lib/StuffPresenter.d.ts.map +0 -1
- package/lib/StuffPresenter.js +0 -53
- package/lib/presenter.d.ts +0 -14
- package/lib/presenter.d.ts.map +0 -1
- package/lib/presenter.js +0 -68
- package/lib/styles/FriendList.css +0 -12
- package/lib/styles/StuffCard.css +0 -23
- package/lib/styles/editProfile.css +0 -62
- package/lib/styles/profileRDFFormsEnforced.css +0 -427
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import '../../styles/HeadingSection.css';
|
|
3
|
+
import { ProfileDetails } from './types';
|
|
4
|
+
import { DataBrowserContext } from 'pane-registry';
|
|
5
|
+
import { NamedNode } from 'rdflib';
|
|
6
|
+
import { ViewerMode } from '../../types';
|
|
7
|
+
export declare const renderHeadingSection: (context: DataBrowserContext, subject: NamedNode, profileData: ProfileDetails, viewerMode: ViewerMode, onSaved?: () => Promise<void> | void) => TemplateResult<1>;
|
|
8
|
+
export declare const Image: (src: any, alt: any) => TemplateResult<1>;
|
|
9
|
+
//# sourceMappingURL=HeadingSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadingSection.d.ts","sourceRoot":"","sources":["../../../src/sections/heading/HeadingSection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,MAAM,UAAU,CAAA;AACxD,OAAO,iCAAiC,CAAA;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAOxC,eAAO,MAAM,oBAAoB,GAC/B,SAAS,kBAAkB,EAC3B,SAAS,SAAS,EAClB,aAAa,cAAc,EAC3B,YAAY,UAAU,EACtB,UAAU,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,sBA2DrC,CAAA;AAaD,eAAO,MAAM,KAAK,GAAI,QAAG,EAAE,QAAG,sBAgBvB,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.renderHeadingSection = exports.Image = void 0;
|
|
7
|
+
var _litHtml = require("lit-html");
|
|
8
|
+
require("../../styles/HeadingSection.css");
|
|
9
|
+
var _HeadingEditDialog = require("./HeadingEditDialog");
|
|
10
|
+
var _textUtils = require("../../textUtils");
|
|
11
|
+
var _dateHelpers = require("./dateHelpers");
|
|
12
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
13
|
+
var _contactIcons = require("../../icons-svg/contactIcons");
|
|
14
|
+
const renderHeadingSection = (context, subject, profileData, viewerMode, onSaved) => {
|
|
15
|
+
const {
|
|
16
|
+
name,
|
|
17
|
+
pronouns,
|
|
18
|
+
jobTitle,
|
|
19
|
+
dateOfBirth,
|
|
20
|
+
location,
|
|
21
|
+
primaryPhone,
|
|
22
|
+
primaryEmail,
|
|
23
|
+
imageSrc
|
|
24
|
+
} = profileData;
|
|
25
|
+
const isOwner = viewerMode === 'owner';
|
|
26
|
+
const phoneValue = (0, _textUtils.toText)(primaryPhone?.valueNode).replace(/^tel:/i, '');
|
|
27
|
+
const emailValue = (0, _textUtils.toText)(primaryEmail?.valueNode).replace(/^mailto:/i, '');
|
|
28
|
+
const dateOfBirthDisplay = (0, _dateHelpers.toDisplayDateDMY)((0, _textUtils.toText)(dateOfBirth), 'DD-MM-YYYY');
|
|
29
|
+
return (0, _litHtml.html)`
|
|
30
|
+
<section class="profile__section border-lighter" aria-labelledby="profile-name">
|
|
31
|
+
<div class="profile__heading-top">
|
|
32
|
+
<div class="profile__avatar">
|
|
33
|
+
${Image(imageSrc, name)}
|
|
34
|
+
</div>
|
|
35
|
+
<div class="profile__info">
|
|
36
|
+
<header class="profile__header-bar mb-md">
|
|
37
|
+
<div class="profile__identity" role="group" aria-label="Name and pronouns">
|
|
38
|
+
<h1 id="profile-name" class="profile__name">${name}</h1>
|
|
39
|
+
<span class="profile__pronouns">${pronouns ? `(${pronouns})` : ''}</span>
|
|
40
|
+
</div>
|
|
41
|
+
${jobTitle ? (0, _litHtml.html)`<div class="profile__role-org">${jobTitle}</div>` : _litHtml.nothing}
|
|
42
|
+
</header>
|
|
43
|
+
</div>
|
|
44
|
+
${isOwner ? (0, _litHtml.html)`
|
|
45
|
+
<div class="profile__actions profile__heading-actions" aria-label="Profile actions">
|
|
46
|
+
<button
|
|
47
|
+
type="button"
|
|
48
|
+
class="profile__action-button profile__heading-action-button profile-action-text flex-center"
|
|
49
|
+
aria-label="Add or edit heading information"
|
|
50
|
+
@click=${event => {
|
|
51
|
+
return (0, _HeadingEditDialog.createHeadingEditDialog)(event, context.session.store, subject, profileData, viewerMode, onSaved);
|
|
52
|
+
}}
|
|
53
|
+
>
|
|
54
|
+
<span class="profile-section-collapsible__edit-label">${_profileIcons.editIcon} Edit</span>
|
|
55
|
+
<span class="profile-section-collapsible__edit-icon" aria-hidden="true">${_profileIcons.editIcon}</span>
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
58
|
+
` : _litHtml.nothing}
|
|
59
|
+
<div class="profile__details">
|
|
60
|
+
<div class="profile__meta-row" role="group" aria-label="Additional profile information">
|
|
61
|
+
${Line(dateOfBirthDisplay, _profileIcons.birthdayIcon, '')}
|
|
62
|
+
${Line(location, _profileIcons.locationIcon, '')}
|
|
63
|
+
</div>
|
|
64
|
+
<div class="profile__contact-row" role="group" aria-label="Contact information">
|
|
65
|
+
${Line(phoneValue, _contactIcons.phoneIcon, '')}
|
|
66
|
+
${Line(emailValue, _contactIcons.emailIcon, '')}
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</section>
|
|
71
|
+
`;
|
|
72
|
+
};
|
|
73
|
+
exports.renderHeadingSection = renderHeadingSection;
|
|
74
|
+
const Line = (value, prefix = _litHtml.nothing, label = '') => value ? (0, _litHtml.html)`
|
|
75
|
+
<div class="profile__item ${label ? '' : 'profile__item--valueOnly'}">
|
|
76
|
+
${label ? (0, _litHtml.html)`<span class="profile__label">${label}</span>` : _litHtml.nothing}
|
|
77
|
+
<span class="profile__value">
|
|
78
|
+
${prefix !== '' && prefix !== _litHtml.nothing ? (0, _litHtml.html)`<span class="profile__prefix-icon" aria-hidden="true">${prefix}</span>` : _litHtml.nothing}
|
|
79
|
+
<span class="profile__value-text">${value}</span>
|
|
80
|
+
</span>
|
|
81
|
+
</div>
|
|
82
|
+
` : _litHtml.nothing;
|
|
83
|
+
const Image = (src, alt) => src ? (0, _litHtml.html)`
|
|
84
|
+
<img
|
|
85
|
+
class="profile__hero"
|
|
86
|
+
src=${src}
|
|
87
|
+
alt="${alt}"
|
|
88
|
+
width="140"
|
|
89
|
+
height="140"
|
|
90
|
+
loading="eager"
|
|
91
|
+
/>
|
|
92
|
+
` : (0, _litHtml.html)`
|
|
93
|
+
<div class="profile__hero-alt flex-center" role="img" aria-label="${alt}" tabindex="0">
|
|
94
|
+
<span class="profile__hero-icon">${_profileIcons.personInCircleIcon}</span>
|
|
95
|
+
</div>
|
|
96
|
+
`;
|
|
97
|
+
exports.Image = Image;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IndexedFormula, NamedNode } from 'rdflib';
|
|
2
|
+
/** A control to capture a picture using camera
|
|
3
|
+
* @param {Docuemnt} dom - The Document object
|
|
4
|
+
* @param {IndexedForumla} store - The quadstore to store data in
|
|
5
|
+
* @param {NamedNode} getImageDoc() - NN of the image file to be created
|
|
6
|
+
* @param {function} doneCallback - Called when a picture has been taken
|
|
7
|
+
*/
|
|
8
|
+
export declare function cameraCaptureControl(dom: HTMLDocument, store: IndexedFormula, getImageDoc: () => NamedNode, doneCallback: (imageDoc: NamedNode | null) => Promise<void>): HTMLDivElement;
|
|
9
|
+
/** A button to capture a picture using camera
|
|
10
|
+
* @param {Docuemnt} dom - The Document object
|
|
11
|
+
* @param {IndexedForumla} store - The quadstore to store data in
|
|
12
|
+
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
13
|
+
* @param {function<Node>} doneCallback - called with the image taken
|
|
14
|
+
* @returns {DomElement} - A div element with the button in it
|
|
15
|
+
*
|
|
16
|
+
* This expands the button to a large control when it is pressed
|
|
17
|
+
*/
|
|
18
|
+
export declare function cameraButton(dom: HTMLDocument, store: IndexedFormula, getImageDoc: () => NamedNode, doneCallback: (imageDoc: NamedNode | null) => Promise<void>): HTMLElement;
|
|
19
|
+
//# sourceMappingURL=camera.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../../src/sections/heading/camera.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AASlD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,kBA2J5D;AAED;;;;;;;;GAQG;AAEH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,cAAc,EACrB,WAAW,EAAE,MAAM,SAAS,EAC5B,YAAY,EAAE,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,GAC1D,WAAW,CAqBb"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.cameraButton = cameraButton;
|
|
7
|
+
exports.cameraCaptureControl = cameraCaptureControl;
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
var _litHtml = require("lit-html");
|
|
10
|
+
var _profileIcons = require("../../icons-svg/profileIcons");
|
|
11
|
+
//
|
|
12
|
+
// Media input widget
|
|
13
|
+
//
|
|
14
|
+
//
|
|
15
|
+
// Workflow:
|
|
16
|
+
// The HTML5 functionality (on mobile) is to prompt for either
|
|
17
|
+
// a realtime camera capture, OR a selection from images already on the device
|
|
18
|
+
// (eg camera roll).
|
|
19
|
+
//
|
|
20
|
+
// The solid alternative is to either take a photo
|
|
21
|
+
// or access camera roll (etc) OR to access solid cloud storage of favorite photo albums.
|
|
22
|
+
// (Especially latest taken ones)
|
|
23
|
+
//
|
|
24
|
+
|
|
25
|
+
// Copied from solid-ui needed to change somethings, have made a PR in solid-ui
|
|
26
|
+
|
|
27
|
+
const cameraIcon = _solidUi.icons.iconBase + 'noun_Camera_1618446_000000.svg'; // Get it from github
|
|
28
|
+
const retakeIcon = _solidUi.icons.iconBase + 'noun_479395.svg'; // Get it from github
|
|
29
|
+
|
|
30
|
+
const contentType = 'image/png';
|
|
31
|
+
|
|
32
|
+
/** A control to capture a picture using camera
|
|
33
|
+
* @param {Docuemnt} dom - The Document object
|
|
34
|
+
* @param {IndexedForumla} store - The quadstore to store data in
|
|
35
|
+
* @param {NamedNode} getImageDoc() - NN of the image file to be created
|
|
36
|
+
* @param {function} doneCallback - Called when a picture has been taken
|
|
37
|
+
*/
|
|
38
|
+
function cameraCaptureControl(dom, store, getImageDoc, doneCallback) {
|
|
39
|
+
const div = dom.createElement('div');
|
|
40
|
+
div.className = 'profile-edit-dialog__camera-control flex-column-center';
|
|
41
|
+
let destination, imageBlob, player, canvas;
|
|
42
|
+
const setButtonVisible = (button, visible) => {
|
|
43
|
+
button.style.display = visible ? 'inline-flex' : 'none';
|
|
44
|
+
};
|
|
45
|
+
const table = div.appendChild(dom.createElement('table'));
|
|
46
|
+
const mainTR = table.appendChild(dom.createElement('tr'));
|
|
47
|
+
const main = mainTR.appendChild(dom.createElement('td'));
|
|
48
|
+
main.setAttribute('colspan', '4');
|
|
49
|
+
main.style.textAlign = 'center';
|
|
50
|
+
const actionBar = div.appendChild(dom.createElement('div'));
|
|
51
|
+
actionBar.className = 'profile-edit-dialog__camera-control-actions';
|
|
52
|
+
|
|
53
|
+
/* Had to move away from widgets.button because of styling */
|
|
54
|
+
const cancelButton = div.appendChild(dom.createElement('button'));
|
|
55
|
+
cancelButton.type = 'button';
|
|
56
|
+
cancelButton.classList.add('profile-edit-dialog__camera-control-cancel');
|
|
57
|
+
cancelButton.setAttribute('aria-label', 'Close camera');
|
|
58
|
+
cancelButton.setAttribute('title', 'Close');
|
|
59
|
+
(0, _litHtml.render)(_profileIcons.closeIcon, cancelButton);
|
|
60
|
+
cancelButton.addEventListener('click', _event => {
|
|
61
|
+
stopVideo();
|
|
62
|
+
doneCallback(null);
|
|
63
|
+
});
|
|
64
|
+
const retakeButton = actionBar.appendChild(_solidUi.widgets.button(dom, retakeIcon, 'Retake'));
|
|
65
|
+
retakeButton.classList.add('profile-edit-dialog__camera-control-action');
|
|
66
|
+
retakeButton.addEventListener('click', _event => {
|
|
67
|
+
retake();
|
|
68
|
+
});
|
|
69
|
+
retakeButton.textContent = 'Retake';
|
|
70
|
+
setButtonVisible(retakeButton, false);
|
|
71
|
+
const shutterButton = actionBar.appendChild(_solidUi.widgets.button(dom, _solidUi.icons.iconBase + 'noun_10636.svg', 'Snap'));
|
|
72
|
+
shutterButton.classList.add('profile-edit-dialog__camera-control-action');
|
|
73
|
+
shutterButton.addEventListener('click', grabCanvas);
|
|
74
|
+
shutterButton.textContent = 'Take Photo';
|
|
75
|
+
setButtonVisible(shutterButton, false);
|
|
76
|
+
const sendButton = actionBar.appendChild(_solidUi.widgets.continueButton(dom));
|
|
77
|
+
sendButton.classList.add('profile-edit-dialog__camera-control-action');
|
|
78
|
+
sendButton.addEventListener('click', _event => {
|
|
79
|
+
saveBlob(imageBlob, destination);
|
|
80
|
+
});
|
|
81
|
+
sendButton.textContent = 'Use Photo';
|
|
82
|
+
setButtonVisible(sendButton, false);
|
|
83
|
+
function displayPlayer() {
|
|
84
|
+
player = main.appendChild(dom.createElement('video'));
|
|
85
|
+
player.setAttribute('controls', '1');
|
|
86
|
+
player.setAttribute('autoplay', '1');
|
|
87
|
+
player.setAttribute('style', _solidUi.style.controlStyle);
|
|
88
|
+
if (!navigator.mediaDevices) {
|
|
89
|
+
throw new Error('navigator.mediaDevices not available');
|
|
90
|
+
}
|
|
91
|
+
navigator.mediaDevices.getUserMedia(constraints).then(stream => {
|
|
92
|
+
player.srcObject = stream;
|
|
93
|
+
setButtonVisible(shutterButton, true);
|
|
94
|
+
setButtonVisible(sendButton, false);
|
|
95
|
+
setButtonVisible(retakeButton, false);
|
|
96
|
+
}).catch(err => {
|
|
97
|
+
console.error('Unable to start camera preview', err);
|
|
98
|
+
doneCallback(null);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const constraints = {
|
|
102
|
+
video: {
|
|
103
|
+
facingMode: {
|
|
104
|
+
ideal: 'environment'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function retake() {
|
|
109
|
+
main.removeChild(canvas);
|
|
110
|
+
displayPlayer(); // Make new one as old one is stuck black
|
|
111
|
+
}
|
|
112
|
+
function grabCanvas() {
|
|
113
|
+
// Draw the video frame to the canvas.
|
|
114
|
+
canvas = dom.createElement('canvas');
|
|
115
|
+
canvas.setAttribute('width', _solidUi.style.canvasWidth);
|
|
116
|
+
canvas.setAttribute('height', _solidUi.style.canvasHeight);
|
|
117
|
+
canvas.setAttribute('style', _solidUi.style.controlStyle);
|
|
118
|
+
main.appendChild(canvas);
|
|
119
|
+
const context = canvas.getContext('2d');
|
|
120
|
+
if (!context) {
|
|
121
|
+
throw new Error('Could not get canvas context for camera snapshot');
|
|
122
|
+
}
|
|
123
|
+
context.drawImage(player, 0, 0, canvas.width, canvas.height);
|
|
124
|
+
stopVideo();
|
|
125
|
+
player.parentNode.removeChild(player);
|
|
126
|
+
canvas.toBlob(blob => {
|
|
127
|
+
if (!blob) {
|
|
128
|
+
throw new Error('Camera snapshot failed: no image blob produced');
|
|
129
|
+
}
|
|
130
|
+
const msg = `got blob type ${blob.type} size ${blob.size}`;
|
|
131
|
+
console.debug(msg);
|
|
132
|
+
destination = getImageDoc();
|
|
133
|
+
imageBlob = blob; // save for review
|
|
134
|
+
reviewImage();
|
|
135
|
+
// alert(msg)
|
|
136
|
+
}, contentType); // toBlob
|
|
137
|
+
}
|
|
138
|
+
function reviewImage() {
|
|
139
|
+
setButtonVisible(sendButton, true);
|
|
140
|
+
setButtonVisible(retakeButton, true);
|
|
141
|
+
setButtonVisible(shutterButton, false);
|
|
142
|
+
}
|
|
143
|
+
function stopVideo() {
|
|
144
|
+
if (player && player.srcObject) {
|
|
145
|
+
player.srcObject.getVideoTracks().forEach(track => track.stop());
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function saveBlob(blob, destination) {
|
|
149
|
+
if (!blob || !destination) return;
|
|
150
|
+
const contentType = blob.type;
|
|
151
|
+
// if (!confirm('Save picture to ' + destination + ' ?')) return
|
|
152
|
+
console.debug('Putting ' + blob.size + ' bytes of ' + contentType + ' to ' + destination)
|
|
153
|
+
// @@ TODO Remove casting
|
|
154
|
+
;
|
|
155
|
+
store.fetcher.webOperation('PUT', destination.uri, {
|
|
156
|
+
data: blob,
|
|
157
|
+
contentType
|
|
158
|
+
}).then(_resp => {
|
|
159
|
+
console.debug('ok saved ' + destination);
|
|
160
|
+
stopVideo();
|
|
161
|
+
doneCallback(destination);
|
|
162
|
+
}, err => {
|
|
163
|
+
stopVideo();
|
|
164
|
+
alert(err);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Attach the video stream to the video element and autoplay.
|
|
169
|
+
displayPlayer();
|
|
170
|
+
return div;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** A button to capture a picture using camera
|
|
174
|
+
* @param {Docuemnt} dom - The Document object
|
|
175
|
+
* @param {IndexedForumla} store - The quadstore to store data in
|
|
176
|
+
* @param {fuunction} getImageDoc - returns NN of the image file to be created
|
|
177
|
+
* @param {function<Node>} doneCallback - called with the image taken
|
|
178
|
+
* @returns {DomElement} - A div element with the button in it
|
|
179
|
+
*
|
|
180
|
+
* This expands the button to a large control when it is pressed
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
function cameraButton(dom, store, getImageDoc, doneCallback) {
|
|
184
|
+
const div = dom.createElement('div');
|
|
185
|
+
const but = _solidUi.widgets.button(dom, cameraIcon, 'Take picture');
|
|
186
|
+
let control;
|
|
187
|
+
async function restoreButton(imageDoc) {
|
|
188
|
+
div.removeChild(control);
|
|
189
|
+
div.appendChild(but);
|
|
190
|
+
await doneCallback(imageDoc);
|
|
191
|
+
}
|
|
192
|
+
div.appendChild(but);
|
|
193
|
+
but.addEventListener('click', _event => {
|
|
194
|
+
div.removeChild(but);
|
|
195
|
+
control = cameraCaptureControl(dom, store, getImageDoc, restoreButton);
|
|
196
|
+
div.appendChild(control);
|
|
197
|
+
});
|
|
198
|
+
return div;
|
|
199
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function toDisplayDateDMY(value: string | undefined, emptyFallback?: string): string;
|
|
2
|
+
export declare function toEditableDateDMY(value: string | undefined): string;
|
|
3
|
+
export declare function toStorageDateISO(value: string | undefined): string;
|
|
4
|
+
//# sourceMappingURL=dateHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dateHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/heading/dateHelpers.ts"],"names":[],"mappings":"AAQA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,aAAa,SAAK,GAAG,MAAM,CActF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAWnE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAclE"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toDisplayDateDMY = toDisplayDateDMY;
|
|
7
|
+
exports.toEditableDateDMY = toEditableDateDMY;
|
|
8
|
+
exports.toStorageDateISO = toStorageDateISO;
|
|
9
|
+
function normalizeDmy(value) {
|
|
10
|
+
const dmyMatch = value.match(/^(\d{2})[/-](\d{2})[/-](\d{4})$/);
|
|
11
|
+
if (!dmyMatch) return '';
|
|
12
|
+
const [, day, month, year] = dmyMatch;
|
|
13
|
+
return `${day}-${month}-${year}`;
|
|
14
|
+
}
|
|
15
|
+
function toDisplayDateDMY(value, emptyFallback = '') {
|
|
16
|
+
const raw = (value || '').trim();
|
|
17
|
+
if (!raw) return emptyFallback;
|
|
18
|
+
const isoMatch = raw.match(/^(\d{4})-(\d{2})-(\d{2})/);
|
|
19
|
+
if (isoMatch) {
|
|
20
|
+
const [, year, month, day] = isoMatch;
|
|
21
|
+
return `${day}-${month}-${year}`;
|
|
22
|
+
}
|
|
23
|
+
const normalizedDmy = normalizeDmy(raw);
|
|
24
|
+
if (normalizedDmy) return normalizedDmy;
|
|
25
|
+
return raw;
|
|
26
|
+
}
|
|
27
|
+
function toEditableDateDMY(value) {
|
|
28
|
+
const raw = (value || '').trim();
|
|
29
|
+
if (!raw) return '';
|
|
30
|
+
const isoMatch = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
31
|
+
if (isoMatch) {
|
|
32
|
+
const [, year, month, day] = isoMatch;
|
|
33
|
+
return `${day}-${month}-${year}`;
|
|
34
|
+
}
|
|
35
|
+
return normalizeDmy(raw);
|
|
36
|
+
}
|
|
37
|
+
function toStorageDateISO(value) {
|
|
38
|
+
const raw = (value || '').trim();
|
|
39
|
+
if (!raw) return '';
|
|
40
|
+
const isoMatch = raw.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
41
|
+
if (isoMatch) return raw;
|
|
42
|
+
const dmyMatch = raw.match(/^(\d{2})[/-](\d{2})[/-](\d{4})$/);
|
|
43
|
+
if (dmyMatch) {
|
|
44
|
+
const [, day, month, year] = dmyMatch;
|
|
45
|
+
return `${year}-${month}-${day}`;
|
|
46
|
+
}
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
2
|
+
export declare function uploadPhotoFile(store: LiveStore, subject: NamedNode, file: File): Promise<string>;
|
|
3
|
+
export declare function deletePhotoFile(store: LiveStore, subject: NamedNode, photoUri: string): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=imageHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imageHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/heading/imageHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAO,MAAM,QAAQ,CAAA;AAoClD,wBAAsB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAsCvG;AAED,wBAAsB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3G"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deletePhotoFile = deletePhotoFile;
|
|
7
|
+
exports.uploadPhotoFile = uploadPhotoFile;
|
|
8
|
+
var _rdflib = require("rdflib");
|
|
9
|
+
var _solidUi = require("solid-ui");
|
|
10
|
+
/* Code copied from contact-pane/src/mugshotGallery and modified to fit the needs of the new design */
|
|
11
|
+
const mimeMap = {
|
|
12
|
+
'image/png': 'png',
|
|
13
|
+
'image/jpeg': 'jpg',
|
|
14
|
+
'image/gif': 'gif',
|
|
15
|
+
'image/svg+xml': 'svg',
|
|
16
|
+
'image/webp': 'webp',
|
|
17
|
+
'image/bmp': 'bmp',
|
|
18
|
+
'image/tiff': 'tiff',
|
|
19
|
+
'application/pdf': 'pdf',
|
|
20
|
+
'text/plain': 'txt',
|
|
21
|
+
'text/html': 'html',
|
|
22
|
+
'application/json': 'json',
|
|
23
|
+
'application/octet-stream': 'bin'
|
|
24
|
+
};
|
|
25
|
+
const extMap = Object.fromEntries(Object.entries(mimeMap).map(([contentType, extension]) => [extension, contentType]));
|
|
26
|
+
const mime = {
|
|
27
|
+
extension: contentType => mimeMap[contentType] || false,
|
|
28
|
+
lookup: filename => {
|
|
29
|
+
const ext = filename.split('.').pop()?.toLowerCase() || '';
|
|
30
|
+
return extMap[ext] || false;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function subjectDirectoryUri(subject) {
|
|
34
|
+
const docUri = subject.doc().uri;
|
|
35
|
+
const lastSlash = docUri.lastIndexOf('/');
|
|
36
|
+
return lastSlash >= 0 ? docUri.slice(0, lastSlash + 1) : docUri;
|
|
37
|
+
}
|
|
38
|
+
async function uploadPhotoFile(store, subject, file) {
|
|
39
|
+
if (!store.fetcher) {
|
|
40
|
+
throw new Error('Store has no fetcher.');
|
|
41
|
+
}
|
|
42
|
+
const detectedContentType = file.type || mime.lookup(file.name) || 'application/octet-stream';
|
|
43
|
+
if (!detectedContentType.startsWith('image/')) {
|
|
44
|
+
throw new Error('Selected file is not an image.');
|
|
45
|
+
}
|
|
46
|
+
const extension = mime.extension(detectedContentType) || 'bin';
|
|
47
|
+
let filename = encodeURIComponent(file.name || `image.${extension}`);
|
|
48
|
+
if (detectedContentType !== mime.lookup(file.name || '')) {
|
|
49
|
+
filename += `_.${extension}`;
|
|
50
|
+
}
|
|
51
|
+
const directoryUri = subjectDirectoryUri(subject);
|
|
52
|
+
let candidateUri = `${directoryUri}${filename}`;
|
|
53
|
+
for (let index = 0; store.holds(subject, _solidUi.ns.vcard('hasPhoto'), (0, _rdflib.sym)(candidateUri)); index++) {
|
|
54
|
+
const fallbackName = `image_${index}.${extension}`;
|
|
55
|
+
candidateUri = `${directoryUri}${fallbackName}`;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
const data = await file.arrayBuffer();
|
|
59
|
+
const response = await store.fetcher.webOperation('PUT', candidateUri, {
|
|
60
|
+
data: data,
|
|
61
|
+
contentType: detectedContentType
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) {
|
|
64
|
+
throw new Error(`Error uploading picture: ${response.status} ${response.statusText}`);
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
throw new Error(`Error uploading picture: ${error}`);
|
|
68
|
+
}
|
|
69
|
+
return candidateUri;
|
|
70
|
+
}
|
|
71
|
+
async function deletePhotoFile(store, subject, photoUri) {
|
|
72
|
+
void subject;
|
|
73
|
+
if (!photoUri) return;
|
|
74
|
+
if (store.fetcher) {
|
|
75
|
+
try {
|
|
76
|
+
await store.fetcher.webOperation('DELETE', photoUri);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(`Error deleting picture: ${error}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { LiveStore, NamedNode } from 'rdflib';
|
|
2
|
+
import { HeadingMutationPlan } from './types';
|
|
3
|
+
export declare function processHeadingMutations(store: LiveStore, subject: NamedNode, mutationPlan: HeadingMutationPlan): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/sections/heading/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAA0B,MAAM,QAAQ,CAAA;AAErE,OAAO,EAAmB,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAgO9D,wBAAsB,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,mBAAmB,iBAUpH"}
|