profile-pane 3.2.0 → 3.2.2-test.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 +50 -0
- package/icons-png/discord.png +0 -0
- package/icons-png/dribbble.png +0 -0
- package/icons-png/facebook.png +0 -0
- package/icons-png/instagram.png +0 -0
- package/icons-png/linkedin.png +0 -0
- package/icons-png/pinterest.png +0 -0
- package/icons-png/sharechat.png +0 -0
- package/icons-png/signup.png +0 -0
- package/icons-png/snapchat.png +0 -0
- package/icons-png/spotify.png +0 -0
- package/icons-png/telegram.png +0 -0
- package/icons-png/tiktok.png +0 -0
- package/icons-png/whatsapp.png +0 -0
- package/icons-png/x.png +0 -0
- package/icons-png/youtube.png +0 -0
- package/lib/303.profile-pane.js +1362 -0
- package/lib/303.profile-pane.js.map +1 -0
- package/lib/303.profile-pane.min.js +2 -0
- package/lib/303.profile-pane.min.js.map +1 -0
- package/lib/ProfileView.css +1090 -0
- package/lib/ProfileView.d.ts +2 -1
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +64 -36
- package/lib/buttonsHelper.d.ts +1 -1
- package/lib/buttonsHelper.d.ts.map +1 -1
- package/lib/buttonsHelper.js +2 -1
- package/lib/editProfilePane/EditCVCard.js +1 -1
- package/lib/editProfilePane/EditCommunitiesCard.js +1 -1
- package/lib/editProfilePane/EditFriendsCard.js +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts +1 -1
- package/lib/editProfilePane/EditProfileView.d.ts.map +1 -1
- package/lib/editProfilePane/EditProfileView.js +4 -5
- package/lib/editProfilePane/editProfilePresenter.d.ts.map +1 -1
- package/lib/editProfilePane/editProfilePresenter.js +5 -4
- package/lib/icons-svg/profileIcons.d.ts +1 -1
- package/lib/icons-svg/profileIcons.d.ts.map +1 -1
- package/lib/icons-svg/profileIcons.js +9 -17
- package/lib/index.d.ts +1 -8
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +74 -40
- package/lib/ontology/otherPreferencesForm.ttl +32 -0
- package/lib/ontology/resumeForm.ttl +349 -0
- package/lib/ontology/socialMedia.ttl +433 -0
- package/lib/profile-pane.js +32266 -13247
- package/lib/profile-pane.js.map +1 -1
- package/lib/profile-pane.min.js +2315 -935
- package/lib/profile-pane.min.js.map +1 -1
- package/lib/rdfFormsHelper.d.ts +13 -1
- package/lib/rdfFormsHelper.d.ts.map +1 -1
- package/lib/rdfFormsHelper.js +13 -1
- package/lib/sections/bio/BioEditDialog.d.ts.map +1 -1
- package/lib/sections/bio/BioEditDialog.js +7 -7
- package/lib/sections/bio/BioSection.css +300 -0
- package/lib/sections/bio/BioSection.d.ts +3 -2
- package/lib/sections/bio/BioSection.d.ts.map +1 -1
- package/lib/sections/bio/BioSection.js +26 -19
- package/lib/sections/bio/mutations.d.ts.map +1 -1
- package/lib/sections/bio/mutations.js +14 -3
- package/lib/sections/contactInfo/ContactInfoEditDialog.css +354 -0
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts +3 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoEditDialog.js +183 -98
- package/lib/sections/contactInfo/ContactInfoSection.css +125 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts +2 -0
- package/lib/sections/contactInfo/ContactInfoSection.d.ts.map +1 -1
- package/lib/sections/contactInfo/ContactInfoSection.js +64 -41
- package/lib/sections/contactInfo/mutations.d.ts.map +1 -1
- package/lib/sections/contactInfo/mutations.js +51 -16
- package/lib/sections/education/EducationEditDialog.d.ts +3 -1
- package/lib/sections/education/EducationEditDialog.d.ts.map +1 -1
- package/lib/sections/education/EducationEditDialog.js +170 -92
- package/lib/sections/education/EducationSection.css +133 -0
- package/lib/sections/education/EducationSection.d.ts +3 -2
- package/lib/sections/education/EducationSection.d.ts.map +1 -1
- package/lib/sections/education/EducationSection.js +32 -25
- package/lib/sections/education/mutations.d.ts.map +1 -1
- package/lib/sections/education/mutations.js +14 -3
- package/lib/sections/heading/HeadingEditDialog.d.ts +4 -1
- package/lib/sections/heading/HeadingEditDialog.d.ts.map +1 -1
- package/lib/sections/heading/HeadingEditDialog.js +287 -162
- package/lib/sections/heading/HeadingSection.css +862 -0
- package/lib/sections/heading/HeadingSection.d.ts +3 -2
- package/lib/sections/heading/HeadingSection.d.ts.map +1 -1
- package/lib/sections/heading/HeadingSection.js +63 -32
- package/lib/sections/heading/imageHelpers.d.ts +1 -0
- package/lib/sections/heading/imageHelpers.d.ts.map +1 -1
- package/lib/sections/heading/imageHelpers.js +40 -1
- package/lib/sections/heading/mutations.d.ts.map +1 -1
- package/lib/sections/heading/mutations.js +86 -23
- package/lib/sections/heading/selectors.d.ts.map +1 -1
- package/lib/sections/heading/selectors.js +14 -3
- package/lib/sections/heading/types.d.ts +1 -2
- package/lib/sections/heading/types.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts +3 -1
- package/lib/sections/languages/LanguageEditDialog.d.ts.map +1 -1
- package/lib/sections/languages/LanguageEditDialog.js +202 -119
- package/lib/sections/languages/LanguageSection.css +53 -0
- package/lib/sections/languages/LanguageSection.d.ts +2 -0
- package/lib/sections/languages/LanguageSection.d.ts.map +1 -1
- package/lib/sections/languages/LanguageSection.js +42 -31
- package/lib/sections/languages/mutations.d.ts.map +1 -1
- package/lib/sections/languages/mutations.js +60 -161
- package/lib/sections/languages/selectors.d.ts.map +1 -1
- package/lib/sections/languages/selectors.js +1 -2
- package/lib/sections/projects/ProjectEditDialog.d.ts +2 -1
- package/lib/sections/projects/ProjectEditDialog.d.ts.map +1 -1
- package/lib/sections/projects/ProjectEditDialog.js +13 -24
- package/lib/sections/projects/ProjectSection.css +368 -0
- package/lib/sections/projects/ProjectSection.d.ts +2 -1
- package/lib/sections/projects/ProjectSection.d.ts.map +1 -1
- package/lib/sections/projects/ProjectSection.js +116 -34
- package/lib/sections/projects/mutations.d.ts.map +1 -1
- package/lib/sections/projects/mutations.js +109 -132
- package/lib/sections/projects/selectors.d.ts.map +1 -1
- package/lib/sections/projects/selectors.js +4 -45
- package/lib/{QRCodeCard.d.ts → sections/qrcode/QRCodeCard.d.ts} +2 -1
- package/lib/sections/qrcode/QRCodeCard.d.ts.map +1 -0
- package/lib/{QRCodeCard.js → sections/qrcode/QRCodeCard.js} +59 -11
- package/lib/sections/qrcode/QRCodeSection.css +108 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts +4 -0
- package/lib/sections/qrcode/QRCodeSection.d.ts.map +1 -0
- package/lib/sections/qrcode/QRCodeSection.js +17 -0
- package/lib/sections/resume/ResumeEditDialog.d.ts +10 -1
- package/lib/sections/resume/ResumeEditDialog.d.ts.map +1 -1
- package/lib/sections/resume/ResumeEditDialog.js +531 -149
- package/lib/sections/resume/ResumeSection.css +350 -0
- package/lib/sections/resume/ResumeSection.d.ts +3 -2
- package/lib/sections/resume/ResumeSection.d.ts.map +1 -1
- package/lib/sections/resume/ResumeSection.js +78 -49
- package/lib/sections/resume/mutations.d.ts.map +1 -1
- package/lib/sections/resume/mutations.js +17 -3
- package/lib/sections/resume/selectors.d.ts.map +1 -1
- package/lib/sections/resume/selectors.js +1 -0
- package/lib/sections/resume/types.d.ts +1 -0
- package/lib/sections/resume/types.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.d.ts.map +1 -1
- package/lib/sections/shared/collapsibleSection.js +1 -0
- package/lib/sections/shared/phoneCountries.d.ts +1 -1
- package/lib/sections/shared/phoneCountries.d.ts.map +1 -1
- package/lib/sections/shared/phoneCountries.js +2 -2
- package/lib/sections/shared/projectCommunityNodes.d.ts +6 -0
- package/lib/sections/shared/projectCommunityNodes.d.ts.map +1 -0
- package/lib/sections/shared/projectCommunityNodes.js +56 -0
- package/lib/sections/shared/rdfMutationHelpers.d.ts +35 -2
- package/lib/sections/shared/rdfMutationHelpers.d.ts.map +1 -1
- package/lib/sections/shared/rdfMutationHelpers.js +290 -14
- package/lib/sections/shared/sectionCardHelpers.d.ts.map +1 -1
- package/lib/sections/shared/sectionCardHelpers.js +80 -11
- package/lib/sections/shared/types.d.ts +24 -0
- package/lib/sections/shared/types.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts +3 -1
- package/lib/sections/skills/SkillsEditDialog.d.ts.map +1 -1
- package/lib/sections/skills/SkillsEditDialog.js +136 -115
- package/lib/sections/skills/SkillsSection.css +173 -0
- package/lib/sections/skills/SkillsSection.d.ts +2 -0
- package/lib/sections/skills/SkillsSection.d.ts.map +1 -1
- package/lib/sections/skills/SkillsSection.js +107 -47
- package/lib/sections/skills/mutations.d.ts.map +1 -1
- package/lib/sections/skills/mutations.js +25 -21
- package/lib/sections/skills/selectors.d.ts.map +1 -1
- package/lib/sections/skills/selectors.js +5 -3
- package/lib/sections/social/SocialEditDialog.d.ts +3 -1
- package/lib/sections/social/SocialEditDialog.d.ts.map +1 -1
- package/lib/sections/social/SocialEditDialog.js +170 -62
- package/lib/sections/social/SocialSection.css +194 -0
- package/lib/sections/social/SocialSection.d.ts +4 -3
- package/lib/sections/social/SocialSection.d.ts.map +1 -1
- package/lib/sections/social/SocialSection.js +59 -43
- package/lib/sections/social/mutations.d.ts.map +1 -1
- package/lib/sections/social/mutations.js +23 -132
- package/lib/specialButtons/AddMeToYourFriends.css +54 -0
- package/lib/specialButtons/addContact/AddMeToYourContacts.css +1118 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts +10 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.d.ts.map +1 -0
- package/lib/specialButtons/addContact/ContactCreationDialog.js +1123 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts +16 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.d.ts.map +1 -0
- package/lib/specialButtons/addContact/addMeToYourContacts.js +136 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts +8 -0
- package/lib/specialButtons/addContact/contactsErrors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsErrors.js +106 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts +43 -0
- package/lib/specialButtons/addContact/contactsTypes.d.ts.map +1 -0
- package/lib/specialButtons/addContact/contactsTypes.js +5 -0
- package/lib/specialButtons/addContact/helpers.d.ts +7 -0
- package/lib/specialButtons/addContact/helpers.d.ts.map +1 -0
- package/lib/specialButtons/addContact/helpers.js +103 -0
- package/lib/specialButtons/addContact/mutations.d.ts +16 -0
- package/lib/specialButtons/addContact/mutations.d.ts.map +1 -0
- package/lib/specialButtons/addContact/mutations.js +300 -0
- package/lib/specialButtons/addContact/selectors.d.ts +10 -0
- package/lib/specialButtons/addContact/selectors.d.ts.map +1 -0
- package/lib/specialButtons/addContact/selectors.js +163 -0
- package/lib/{addMeToYourFriends.d.ts → specialButtons/addMeToYourFriends.d.ts} +6 -4
- package/lib/specialButtons/addMeToYourFriends.d.ts.map +1 -0
- package/lib/{addMeToYourFriends.js → specialButtons/addMeToYourFriends.js} +46 -11
- package/lib/styles/CollapsibleSection.css +519 -0
- package/lib/styles/EditDialogs.css +506 -686
- package/lib/styles/EditDialogs.responsive.css +989 -0
- package/lib/texts/buttonTexts.d.ts +9 -0
- package/lib/texts/buttonTexts.d.ts.map +1 -0
- package/lib/texts/buttonTexts.js +14 -0
- package/lib/texts/dialogTexts.d.ts +14 -0
- package/lib/texts/dialogTexts.d.ts.map +1 -0
- package/lib/texts/dialogTexts.js +19 -0
- package/lib/texts/messageTexts.d.ts +42 -0
- package/lib/texts/messageTexts.d.ts.map +1 -0
- package/lib/texts/messageTexts.js +47 -0
- package/lib/texts/profileTexts.d.ts +14 -0
- package/lib/texts/profileTexts.d.ts.map +1 -0
- package/lib/texts/profileTexts.js +19 -0
- package/lib/texts/qrCodeTexts.d.ts +2 -0
- package/lib/texts/qrCodeTexts.d.ts.map +1 -0
- package/lib/texts/qrCodeTexts.js +7 -0
- package/lib/texts.d.ts +5 -60
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +55 -70
- package/lib/ui/dialog.css +233 -0
- package/lib/ui/dialog.d.ts +15 -1
- package/lib/ui/dialog.d.ts.map +1 -1
- package/lib/ui/dialog.js +245 -45
- package/lib/ui/dialog.responsive.css +195 -0
- package/lib/ui/errors.d.ts.map +1 -1
- package/lib/ui/errors.js +2 -1
- package/lib/ui/spinner.d.ts +3 -0
- package/lib/ui/spinner.d.ts.map +1 -0
- package/lib/ui/spinner.js +13 -0
- package/lib/utils/debug.d.ts +5 -0
- package/lib/utils/debug.d.ts.map +1 -0
- package/lib/utils/debug.js +23 -0
- package/lib/utils/errorDisplay.d.ts +2 -0
- package/lib/utils/errorDisplay.d.ts.map +1 -0
- package/lib/utils/errorDisplay.js +19 -0
- package/package.json +34 -26
- package/lib/ChatWithMe.d.ts +0 -7
- package/lib/ChatWithMe.d.ts.map +0 -1
- package/lib/ChatWithMe.js +0 -90
- package/lib/QRCodeCard.d.ts.map +0 -1
- package/lib/addMeToYourFriends.d.ts.map +0 -1
- package/lib/sections/heading/camera.d.ts +0 -19
- package/lib/sections/heading/camera.d.ts.map +0 -1
- package/lib/sections/heading/camera.js +0 -199
- package/lib/styles/BioSection.css +0 -77
- package/lib/styles/CVCard.css +0 -142
- package/lib/styles/ChatWithMe.css +0 -6
- package/lib/styles/ContactInfoEditDialog.css +0 -153
- package/lib/styles/EducationCard.css +0 -103
- package/lib/styles/HeadingSection.css +0 -309
- package/lib/styles/ProfileCard.css +0 -66
- package/lib/styles/ProfileView.css +0 -65
- package/lib/styles/ProjectsCard.css +0 -206
- package/lib/styles/QRCodeCard.css +0 -43
- package/lib/styles/SocialCard.css +0 -89
- package/lib/styles/dialog.css +0 -209
- package/lib/styles/utilities.css +0 -740
|
@@ -14,6 +14,7 @@ function toggleCollapsibleSection(event) {
|
|
|
14
14
|
section.setAttribute('data-expanded', String(nextExpanded));
|
|
15
15
|
button.setAttribute('aria-expanded', String(nextExpanded));
|
|
16
16
|
panel.setAttribute('aria-hidden', String(!nextExpanded));
|
|
17
|
+
panel.hidden = !nextExpanded;
|
|
17
18
|
if (nextExpanded && typeof window !== 'undefined') {
|
|
18
19
|
window.requestAnimationFrame(() => {
|
|
19
20
|
window.requestAnimationFrame(() => {
|
|
@@ -3,7 +3,7 @@ export type CountryDialOption = {
|
|
|
3
3
|
dialCode: string;
|
|
4
4
|
name: string;
|
|
5
5
|
};
|
|
6
|
-
export declare const DEFAULT_DIAL_CODE = "
|
|
6
|
+
export declare const DEFAULT_DIAL_CODE = "";
|
|
7
7
|
export declare const COUNTRY_DIAL_OPTIONS: CountryDialOption[];
|
|
8
8
|
export declare const COUNTRY_DIAL_OPTIONS_ASC: {
|
|
9
9
|
dialCode: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phoneCountries.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/phoneCountries.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"phoneCountries.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/phoneCountries.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAEnC,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,EAyPnD,CAAA;AA2BD,eAAO,MAAM,wBAAwB;;UA3R7B,MAAM;UAEN,MAAM;GA8RZ,CAAA;AAOF,eAAO,MAAM,sBAAsB,qBAelC,CAAA;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM;;;EAoB1C;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAK/E"}
|
|
@@ -7,7 +7,7 @@ exports.DEFAULT_DIAL_CODE = exports.COUNTRY_PREFIX_OPTIONS = exports.COUNTRY_DIA
|
|
|
7
7
|
exports.combinePhoneValue = combinePhoneValue;
|
|
8
8
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
9
9
|
exports.splitPhoneValue = splitPhoneValue;
|
|
10
|
-
const DEFAULT_DIAL_CODE = exports.DEFAULT_DIAL_CODE = '
|
|
10
|
+
const DEFAULT_DIAL_CODE = exports.DEFAULT_DIAL_CODE = '';
|
|
11
11
|
const COUNTRY_DIAL_OPTIONS = exports.COUNTRY_DIAL_OPTIONS = [{
|
|
12
12
|
iso2: 'EG',
|
|
13
13
|
dialCode: '+20',
|
|
@@ -1076,5 +1076,5 @@ function combinePhoneValue(dialCode, localNumber) {
|
|
|
1076
1076
|
const trimmed = localNumber.trim();
|
|
1077
1077
|
if (!trimmed) return '';
|
|
1078
1078
|
if (trimmed.startsWith('+')) return trimmed;
|
|
1079
|
-
return `${dialCode}${trimmed}
|
|
1079
|
+
return dialCode ? `${dialCode}${trimmed}` : trimmed;
|
|
1080
1080
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { LiveStore, NamedNode, Node } from 'rdflib';
|
|
2
|
+
export declare function isRdfListNode(store: LiveStore, node: unknown, doc?: NamedNode | null): boolean;
|
|
3
|
+
export declare function expandCommunityNodes(store: LiveStore, node: Node, doc?: NamedNode | null): Node[];
|
|
4
|
+
export declare function linkedProjectNodeFromCommunityNode(node: Node, store: LiveStore): NamedNode | null;
|
|
5
|
+
export declare function projectUrlFromCommunityNode(node: Node, store: LiveStore): string;
|
|
6
|
+
//# sourceMappingURL=projectCommunityNodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectCommunityNodes.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/projectCommunityNodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAO,MAAM,QAAQ,CAAA;AAIxD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,OAAO,CAG9F;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,EAAE,CAEjG;AAED,wBAAgB,kCAAkC,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CA6CjG;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAGhF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.expandCommunityNodes = expandCommunityNodes;
|
|
7
|
+
exports.isRdfListNode = isRdfListNode;
|
|
8
|
+
exports.linkedProjectNodeFromCommunityNode = linkedProjectNodeFromCommunityNode;
|
|
9
|
+
exports.projectUrlFromCommunityNode = projectUrlFromCommunityNode;
|
|
10
|
+
var _rdflib = require("rdflib");
|
|
11
|
+
var _solidUi = require("solid-ui");
|
|
12
|
+
var _rdfList = require("./rdfList");
|
|
13
|
+
function isRdfListNode(store, node, doc) {
|
|
14
|
+
if (node?.elements?.length) return true;
|
|
15
|
+
return Boolean(store.any(node, _solidUi.ns.rdf('first'), null, doc || null));
|
|
16
|
+
}
|
|
17
|
+
function expandCommunityNodes(store, node, doc) {
|
|
18
|
+
return isRdfListNode(store, node, doc) ? (0, _rdfList.expandRdfList)(store, node) : [node];
|
|
19
|
+
}
|
|
20
|
+
function linkedProjectNodeFromCommunityNode(node, store) {
|
|
21
|
+
if (!node) return null;
|
|
22
|
+
if (node.termType === 'NamedNode') return node;
|
|
23
|
+
if (node.termType === 'Literal') {
|
|
24
|
+
try {
|
|
25
|
+
return (0, _rdflib.sym)(node.value);
|
|
26
|
+
} catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (node.termType !== 'BlankNode') return null;
|
|
31
|
+
const candidatePredicates = [_solidUi.ns.solid('publicId'), _solidUi.ns.schema('url'), _solidUi.ns.foaf('homepage'), _solidUi.ns.rdfs('seeAlso'), _solidUi.ns.schema('sameAs'), _solidUi.ns.schema('mainEntityOfPage')];
|
|
32
|
+
for (const predicate of candidatePredicates) {
|
|
33
|
+
const linked = store.any(node, predicate);
|
|
34
|
+
if (!linked?.value) continue;
|
|
35
|
+
if (linked.termType === 'NamedNode') {
|
|
36
|
+
return linked;
|
|
37
|
+
}
|
|
38
|
+
if (linked.termType === 'Literal') {
|
|
39
|
+
try {
|
|
40
|
+
return (0, _rdflib.sym)(linked.value);
|
|
41
|
+
} catch {
|
|
42
|
+
// Keep trying the next predicate.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const outgoing = store.statementsMatching(node, null, null, null);
|
|
47
|
+
const firstNamedNode = outgoing.find(statement => statement.object.termType === 'NamedNode');
|
|
48
|
+
if (firstNamedNode?.object?.value) {
|
|
49
|
+
return firstNamedNode.object;
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function projectUrlFromCommunityNode(node, store) {
|
|
54
|
+
const linkedProjectNode = linkedProjectNodeFromCommunityNode(node, store);
|
|
55
|
+
return linkedProjectNode?.value || node.value || '';
|
|
56
|
+
}
|
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
import { LiveStore, NamedNode, Node } from 'rdflib';
|
|
2
|
-
|
|
2
|
+
import { PrefixCapable, RdfStatement } from './types';
|
|
3
|
+
export type MutationDocumentTextCache = Map<string, string>;
|
|
4
|
+
type ForceDocumentPutCheckOptions = {
|
|
5
|
+
documentText?: string;
|
|
6
|
+
documentTextCache?: MutationDocumentTextCache;
|
|
7
|
+
};
|
|
8
|
+
export declare function registerStorePrefix(target: PrefixCapable | undefined, prefix: string, uri: string): void;
|
|
9
|
+
export declare function ensureStandardMutationPrefixes(store: LiveStore | undefined): void;
|
|
10
|
+
export declare function statementKey(statement: RdfStatement): string;
|
|
11
|
+
export declare function uniqueStatements(statements: RdfStatement[]): RdfStatement[];
|
|
12
|
+
export declare function applyStatementsToStore(store: LiveStore, deletions: RdfStatement[], insertions: RdfStatement[]): void;
|
|
13
|
+
export declare function sanitizePatchStatements(store: LiveStore, deletions: RdfStatement[], insertions: RdfStatement[], requireStoredDelete?: boolean): {
|
|
14
|
+
safeDeletions: import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
15
|
+
safeInsertions: import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
16
|
+
};
|
|
17
|
+
export declare function shouldForceDocumentPutForStatements(store: LiveStore, doc: NamedNode, statements: RdfStatement[], candidateNamespaceUris?: string[], options?: ForceDocumentPutCheckOptions): Promise<boolean>;
|
|
18
|
+
export declare function isPatchFailureMessage(message: string): boolean;
|
|
19
|
+
export declare function isMissingGetRecordErrorMessage(message: string): boolean;
|
|
20
|
+
export declare function runDirectUpdaterUpdate(store: LiveStore, deletions: RdfStatement[], insertions: RdfStatement[], failureMessage?: string): Promise<void>;
|
|
21
|
+
export declare function putResourceWithStatements(store: LiveStore, doc: NamedNode, deletions: RdfStatement[], insertions: RdfStatement[], unsupportedMessage: string, documentTextCache?: MutationDocumentTextCache): Promise<void>;
|
|
22
|
+
type UpdateTransportOptions = {
|
|
23
|
+
unsupportedMessage: string;
|
|
24
|
+
failureMessage?: string;
|
|
25
|
+
requireStoredDelete?: boolean;
|
|
26
|
+
forcePut?: boolean;
|
|
27
|
+
documentTextCache?: MutationDocumentTextCache;
|
|
28
|
+
useDavFallback?: boolean;
|
|
29
|
+
usePutFallback?: boolean;
|
|
30
|
+
patchFailureMatcher?: (message: string) => boolean;
|
|
31
|
+
missingGetRecordMatcher?: (message: string) => boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function runUpdateTransport(store: LiveStore, doc: NamedNode | null, deletions: RdfStatement[], insertions: RdfStatement[], options: UpdateTransportOptions): Promise<void>;
|
|
34
|
+
export declare function applyUpdaterPatch(store: LiveStore, deletions: RdfStatement[], insertions: RdfStatement[]): Promise<void>;
|
|
3
35
|
export declare function collectNodeStatements(store: LiveStore, node: Node, doc: NamedNode): import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
4
36
|
export declare function collectLinkStatements(store: LiveStore, subject: NamedNode, predicate: NamedNode, node: Node, doc: NamedNode): import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
5
|
-
export declare function replacePredicateStatements(store: LiveStore, subject: NamedNode, predicate: NamedNode, doc: NamedNode, deletions:
|
|
37
|
+
export declare function replacePredicateStatements(store: LiveStore, subject: NamedNode, predicate: NamedNode, doc: NamedNode, deletions: RdfStatement[], insertions: RdfStatement[], nextObject?: Node | null): void;
|
|
6
38
|
export declare function collectLinkedNodeStatements(store: LiveStore, sourceNode: Node, predicate: NamedNode, doc: NamedNode): {
|
|
7
39
|
linkedNodes: Node[];
|
|
8
40
|
linkedStatements: import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
9
41
|
linkStatements: import("rdflib").Statement<import("rdflib/lib/types").SubjectType, import("rdflib/lib/types").PredicateType, import("rdflib/lib/types").ObjectType, import("rdflib/lib/types").GraphType>[];
|
|
10
42
|
};
|
|
11
43
|
export declare function findExistingNode(nodes: Node[], entryNode: string): Node;
|
|
44
|
+
export {};
|
|
12
45
|
//# sourceMappingURL=rdfMutationHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rdfMutationHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/rdfMutationHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"rdfMutationHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/rdfMutationHelpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,47 +3,323 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.applyStatementsToStore = applyStatementsToStore;
|
|
6
7
|
exports.applyUpdaterPatch = applyUpdaterPatch;
|
|
7
8
|
exports.collectLinkStatements = collectLinkStatements;
|
|
8
9
|
exports.collectLinkedNodeStatements = collectLinkedNodeStatements;
|
|
9
10
|
exports.collectNodeStatements = collectNodeStatements;
|
|
11
|
+
exports.ensureStandardMutationPrefixes = ensureStandardMutationPrefixes;
|
|
10
12
|
exports.findExistingNode = findExistingNode;
|
|
13
|
+
exports.isMissingGetRecordErrorMessage = isMissingGetRecordErrorMessage;
|
|
14
|
+
exports.isPatchFailureMessage = isPatchFailureMessage;
|
|
15
|
+
exports.putResourceWithStatements = putResourceWithStatements;
|
|
16
|
+
exports.registerStorePrefix = registerStorePrefix;
|
|
11
17
|
exports.replacePredicateStatements = replacePredicateStatements;
|
|
18
|
+
exports.runDirectUpdaterUpdate = runDirectUpdaterUpdate;
|
|
19
|
+
exports.runUpdateTransport = runUpdateTransport;
|
|
20
|
+
exports.sanitizePatchStatements = sanitizePatchStatements;
|
|
21
|
+
exports.shouldForceDocumentPutForStatements = shouldForceDocumentPutForStatements;
|
|
22
|
+
exports.statementKey = statementKey;
|
|
23
|
+
exports.uniqueStatements = uniqueStatements;
|
|
12
24
|
var _rdflib = require("rdflib");
|
|
13
25
|
var _texts = require("../../texts");
|
|
26
|
+
/* Some of the code below was generated by AI Model: GPT-5.4.
|
|
27
|
+
Prompt: can you add types to rdfMutationHelpers.ts and consolidate mutation logic
|
|
28
|
+
where appropriate. */
|
|
29
|
+
|
|
30
|
+
const STANDARD_MUTATION_PREFIXES = {
|
|
31
|
+
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
32
|
+
vcard: 'http://www.w3.org/2006/vcard/ns#',
|
|
33
|
+
foaf: 'http://xmlns.com/foaf/0.1/',
|
|
34
|
+
solid: 'http://www.w3.org/ns/solid/terms#',
|
|
35
|
+
schema: 'http://schema.org/',
|
|
36
|
+
org: 'http://www.w3.org/ns/org#',
|
|
37
|
+
owl: 'http://www.w3.org/2002/07/owl#',
|
|
38
|
+
dc: 'http://purl.org/dc/elements/1.1/'
|
|
39
|
+
};
|
|
40
|
+
const STANDARD_MUTATION_NAMESPACE_URIS = Object.values(STANDARD_MUTATION_PREFIXES);
|
|
14
41
|
function normalizeNodeId(value) {
|
|
15
42
|
return value.startsWith('_:') ? value.slice(2) : value;
|
|
16
43
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
44
|
+
function isCompleteStatement(statement) {
|
|
45
|
+
return Boolean(statement?.subject && statement?.predicate && statement?.object);
|
|
46
|
+
}
|
|
47
|
+
function statementTermKey(term) {
|
|
48
|
+
if (!term) return '';
|
|
49
|
+
if (typeof term.toNT === 'function') return term.toNT();
|
|
50
|
+
return term.value || '';
|
|
51
|
+
}
|
|
52
|
+
function registerStorePrefix(target, prefix, uri) {
|
|
53
|
+
if (!target) return;
|
|
54
|
+
if (typeof target.setPrefixForURI === 'function') {
|
|
55
|
+
target.setPrefixForURI(prefix, uri);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (!target.namespaces) {
|
|
59
|
+
target.namespaces = {};
|
|
20
60
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
61
|
+
target.namespaces[prefix] = uri;
|
|
62
|
+
}
|
|
63
|
+
function ensureStandardMutationPrefixes(store) {
|
|
64
|
+
if (!store) return;
|
|
65
|
+
const updater = getStoreUpdater(store);
|
|
66
|
+
const targets = [store, updater, updater?.store];
|
|
67
|
+
Object.entries(STANDARD_MUTATION_PREFIXES).forEach(([prefix, uri]) => {
|
|
68
|
+
targets.forEach(target => {
|
|
69
|
+
registerStorePrefix(target, prefix, uri);
|
|
70
|
+
});
|
|
25
71
|
});
|
|
26
|
-
|
|
27
|
-
|
|
72
|
+
}
|
|
73
|
+
function statementKey(statement) {
|
|
74
|
+
return `${statementTermKey(statement.subject)} ${statementTermKey(statement.predicate)} ${statementTermKey(statement.object)} ${statementTermKey(statement.why)}`;
|
|
75
|
+
}
|
|
76
|
+
function uniqueStatements(statements) {
|
|
77
|
+
return Array.from(new Map((statements || []).map(statement => [statementKey(statement), statement])).values());
|
|
78
|
+
}
|
|
79
|
+
function applyStatementsToStore(store, deletions, insertions) {
|
|
80
|
+
store.remove(deletions);
|
|
81
|
+
insertions.forEach(statement => {
|
|
82
|
+
store.add(statement.subject, statement.predicate, statement.object, statement.why);
|
|
28
83
|
});
|
|
29
|
-
|
|
30
|
-
|
|
84
|
+
}
|
|
85
|
+
function sanitizePatchStatements(store, deletions, insertions, requireStoredDelete = false) {
|
|
86
|
+
const safeDeletions = uniqueStatements((deletions || []).filter(statement => {
|
|
87
|
+
if (!isCompleteStatement(statement)) return false;
|
|
88
|
+
if (store.holds(statement.subject, statement.predicate, statement.object, statement.why)) return true;
|
|
89
|
+
return requireStoredDelete ? false : store.statementsMatching(statement.subject, statement.predicate, statement.object, statement.why).length > 0;
|
|
90
|
+
}));
|
|
91
|
+
const safeInsertions = uniqueStatements((insertions || []).filter(isCompleteStatement));
|
|
92
|
+
return {
|
|
93
|
+
safeDeletions,
|
|
94
|
+
safeInsertions
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function getStoreUpdater(store) {
|
|
98
|
+
return store.updater;
|
|
99
|
+
}
|
|
100
|
+
function getStoreFetcher(store) {
|
|
101
|
+
return store.fetcher;
|
|
102
|
+
}
|
|
103
|
+
async function bestEffortLoadDocIfStoreEmpty(store, doc) {
|
|
104
|
+
if (!doc) return;
|
|
105
|
+
const fetcher = getStoreFetcher(store);
|
|
106
|
+
if (typeof fetcher?.load !== 'function') return;
|
|
107
|
+
if (store.statementsMatching(undefined, undefined, undefined, doc).length > 0) return;
|
|
108
|
+
try {
|
|
109
|
+
await fetcher.load(doc);
|
|
110
|
+
} catch {
|
|
111
|
+
// Continue with current in-memory statements if the pre-load fails.
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function escapeRegex(text) {
|
|
115
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
116
|
+
}
|
|
117
|
+
function statementNamespaceUris(statement, candidateNamespaceUris) {
|
|
118
|
+
const uris = new Set();
|
|
119
|
+
const terms = [statement.subject, statement.predicate, statement.object];
|
|
120
|
+
terms.forEach(term => {
|
|
121
|
+
if (!term) return;
|
|
122
|
+
if (typeof term.value === 'string') {
|
|
123
|
+
candidateNamespaceUris.forEach(namespaceUri => {
|
|
124
|
+
if (term.value.startsWith(namespaceUri)) {
|
|
125
|
+
uris.add(namespaceUri);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
if (term.termType === 'Literal' && typeof term.datatype?.value === 'string') {
|
|
130
|
+
candidateNamespaceUris.forEach(namespaceUri => {
|
|
131
|
+
if (term.datatype.value.startsWith(namespaceUri)) {
|
|
132
|
+
uris.add(namespaceUri);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return [...uris];
|
|
138
|
+
}
|
|
139
|
+
function documentDeclaresNamespacePrefix(documentText, namespaceUri) {
|
|
140
|
+
const escapedNamespaceUri = escapeRegex(namespaceUri);
|
|
141
|
+
const prefixPattern = new RegExp(`(^|\\n)\\s*(?:@prefix|PREFIX)\\s+[A-Za-z][\\w-]*:\\s*<${escapedNamespaceUri}>`, 'i');
|
|
142
|
+
return prefixPattern.test(documentText);
|
|
143
|
+
}
|
|
144
|
+
async function shouldForceDocumentPutForStatements(store, doc, statements, candidateNamespaceUris = STANDARD_MUTATION_NAMESPACE_URIS, options = {}) {
|
|
145
|
+
const updater = getStoreUpdater(store);
|
|
146
|
+
const fetcher = getStoreFetcher(store);
|
|
147
|
+
if (typeof updater?.serialize !== 'function' || typeof fetcher?.webOperation !== 'function') {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
const neededNamespaceUris = Array.from(new Set((statements || []).flatMap(statement => statementNamespaceUris(statement, candidateNamespaceUris))));
|
|
151
|
+
if (neededNamespaceUris.length === 0) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
const cachedDocumentText = options.documentTextCache?.get(doc.value);
|
|
155
|
+
const existingDocumentText = typeof options.documentText === 'string' ? options.documentText : cachedDocumentText;
|
|
156
|
+
if (typeof existingDocumentText === 'string') {
|
|
157
|
+
return neededNamespaceUris.some(namespaceUri => {
|
|
158
|
+
return !documentDeclaresNamespacePrefix(existingDocumentText, namespaceUri);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
const response = await fetcher.webOperation('GET', doc.value, {
|
|
163
|
+
noMeta: true,
|
|
164
|
+
headers: {
|
|
165
|
+
accept: 'text/turtle'
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
if (!response?.ok || typeof response.responseText !== 'string') {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
options.documentTextCache?.set(doc.value, response.responseText);
|
|
172
|
+
return neededNamespaceUris.some(namespaceUri => {
|
|
173
|
+
return !documentDeclaresNamespacePrefix(response.responseText || '', namespaceUri);
|
|
174
|
+
});
|
|
175
|
+
} catch {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function isPatchFailureMessage(message) {
|
|
180
|
+
const text = (message || '').toLowerCase();
|
|
181
|
+
return text.includes('fetch error for patch') || text.includes('failed to fetch') || text.includes(' on patch ') || text.includes('web error: 400') || text.includes('web error: 405') || text.includes('web error: 500') || text.includes('web error: 501');
|
|
182
|
+
}
|
|
183
|
+
function isMissingGetRecordErrorMessage(message) {
|
|
184
|
+
return (message || '').toLowerCase().includes('no record of our http get request for document');
|
|
185
|
+
}
|
|
186
|
+
function runUpdaterUpdate(updater, deletions, insertions, failureMessage) {
|
|
187
|
+
if (typeof updater.update !== 'function') {
|
|
188
|
+
throw new Error(_texts.updaterUnsupportedStoreErrorMessageText);
|
|
31
189
|
}
|
|
32
190
|
return new Promise((resolve, reject) => {
|
|
33
191
|
try {
|
|
34
|
-
|
|
35
|
-
store.updater.update(safeDeletions, safeInsertions, (_uri, ok, message) => {
|
|
192
|
+
updater.update(deletions, insertions, (_uri, ok, message) => {
|
|
36
193
|
if (ok === true) {
|
|
37
194
|
resolve();
|
|
38
195
|
return;
|
|
39
196
|
}
|
|
40
|
-
reject(new Error(message ||
|
|
197
|
+
reject(new Error(message || failureMessage));
|
|
41
198
|
});
|
|
42
199
|
} catch (error) {
|
|
43
200
|
reject(error instanceof Error ? error : new Error(String(error)));
|
|
44
201
|
}
|
|
45
202
|
});
|
|
46
203
|
}
|
|
204
|
+
async function runDirectUpdaterUpdate(store, deletions, insertions, failureMessage = _texts.fallbackSaveUpdatesErrorMessageText) {
|
|
205
|
+
ensureStandardMutationPrefixes(store);
|
|
206
|
+
const updater = getStoreUpdater(store);
|
|
207
|
+
if (!updater) {
|
|
208
|
+
throw new Error(_texts.updaterUnsupportedStoreErrorMessageText);
|
|
209
|
+
}
|
|
210
|
+
await runUpdaterUpdate(updater, deletions, insertions, failureMessage);
|
|
211
|
+
}
|
|
212
|
+
async function putResourceWithStatements(store, doc, deletions, insertions, unsupportedMessage, documentTextCache) {
|
|
213
|
+
ensureStandardMutationPrefixes(store);
|
|
214
|
+
const updater = getStoreUpdater(store);
|
|
215
|
+
const fetcher = getStoreFetcher(store);
|
|
216
|
+
if (!updater || typeof updater.serialize !== 'function' || !fetcher || typeof fetcher.webOperation !== 'function') {
|
|
217
|
+
throw new Error(unsupportedMessage);
|
|
218
|
+
}
|
|
219
|
+
await bestEffortLoadDocIfStoreEmpty(store, doc);
|
|
220
|
+
const currentStatements = store.statementsMatching(undefined, undefined, undefined, doc).slice();
|
|
221
|
+
const deletionKeys = new Set((deletions || []).map(statement => statementKey(statement)));
|
|
222
|
+
const nextStatements = currentStatements.filter(statement => !deletionKeys.has(statementKey(statement))).concat(insertions || []);
|
|
223
|
+
const serializationStore = (0, _rdflib.graph)();
|
|
224
|
+
nextStatements.forEach(statement => {
|
|
225
|
+
serializationStore.add(statement.subject, statement.predicate, statement.object, statement.why);
|
|
226
|
+
});
|
|
227
|
+
const contentType = 'text/turtle';
|
|
228
|
+
const body = updater.serialize(doc.value, serializationStore.statementsMatching(undefined, undefined, undefined, doc), contentType);
|
|
229
|
+
const response = await fetcher.webOperation('PUT', doc.value, {
|
|
230
|
+
noMeta: true,
|
|
231
|
+
contentType,
|
|
232
|
+
body
|
|
233
|
+
});
|
|
234
|
+
if (!response || response.ok !== true) {
|
|
235
|
+
const status = response?.status || 'unknown';
|
|
236
|
+
throw new Error(`Web error: ${status} on PUT of <${doc.value}>`);
|
|
237
|
+
}
|
|
238
|
+
documentTextCache?.set(doc.value, body);
|
|
239
|
+
applyStatementsToStore(store, deletions, insertions);
|
|
240
|
+
}
|
|
241
|
+
async function runUpdateTransport(store, doc, deletions, insertions, options) {
|
|
242
|
+
ensureStandardMutationPrefixes(store);
|
|
243
|
+
const updater = getStoreUpdater(store);
|
|
244
|
+
if (!updater) {
|
|
245
|
+
throw new Error(options.unsupportedMessage);
|
|
246
|
+
}
|
|
247
|
+
if (options.forcePut) {
|
|
248
|
+
await bestEffortLoadDocIfStoreEmpty(store, doc);
|
|
249
|
+
}
|
|
250
|
+
const {
|
|
251
|
+
safeDeletions,
|
|
252
|
+
safeInsertions
|
|
253
|
+
} = sanitizePatchStatements(store, deletions, insertions, options.requireStoredDelete === true);
|
|
254
|
+
if (safeDeletions.length === 0 && safeInsertions.length === 0) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (options.forcePut) {
|
|
258
|
+
if (!doc) {
|
|
259
|
+
throw new Error(options.unsupportedMessage);
|
|
260
|
+
}
|
|
261
|
+
await putResourceWithStatements(store, doc, safeDeletions, safeInsertions, options.unsupportedMessage, options.documentTextCache);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const failureMessage = options.failureMessage || _texts.fallbackSaveUpdatesErrorMessageText;
|
|
265
|
+
const isPatchFailure = options.patchFailureMatcher || isPatchFailureMessage;
|
|
266
|
+
const isMissingGetRecord = options.missingGetRecordMatcher || isMissingGetRecordErrorMessage;
|
|
267
|
+
try {
|
|
268
|
+
await runUpdaterUpdate(updater, safeDeletions, safeInsertions, failureMessage);
|
|
269
|
+
return;
|
|
270
|
+
} catch (error) {
|
|
271
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
272
|
+
if (!isPatchFailure(message)) {
|
|
273
|
+
throw error;
|
|
274
|
+
}
|
|
275
|
+
if (options.useDavFallback && typeof updater.updateDav === 'function') {
|
|
276
|
+
if (doc && getStoreFetcher(store)?.load) {
|
|
277
|
+
try {
|
|
278
|
+
await getStoreFetcher(store)?.load?.(doc);
|
|
279
|
+
} catch {
|
|
280
|
+
// Continue to DAV fallback and then PUT fallback if needed.
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
try {
|
|
284
|
+
await new Promise((resolve, reject) => {
|
|
285
|
+
updater.updateDav?.(doc, safeDeletions, safeInsertions, (_uri, ok, body) => {
|
|
286
|
+
if (ok === true) {
|
|
287
|
+
resolve();
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
reject(new Error(body || message || failureMessage));
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
return;
|
|
294
|
+
} catch (davError) {
|
|
295
|
+
const davMessage = davError instanceof Error ? davError.message : String(davError);
|
|
296
|
+
if (!options.usePutFallback || !isMissingGetRecord(davMessage)) {
|
|
297
|
+
throw davError;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (options.usePutFallback) {
|
|
302
|
+
if (!doc) {
|
|
303
|
+
throw new Error(options.unsupportedMessage);
|
|
304
|
+
}
|
|
305
|
+
await putResourceWithStatements(store, doc, safeDeletions, safeInsertions, options.unsupportedMessage, options.documentTextCache);
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
throw error;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function applyUpdaterPatch(store, deletions, insertions) {
|
|
312
|
+
if (!store.updater) {
|
|
313
|
+
throw new Error(_texts.updaterUnsupportedStoreErrorMessageText);
|
|
314
|
+
}
|
|
315
|
+
return runUpdateTransport(store, null, deletions, insertions, {
|
|
316
|
+
unsupportedMessage: _texts.updaterUnsupportedStoreErrorMessageText,
|
|
317
|
+
failureMessage: _texts.fallbackSaveUpdatesErrorMessageText,
|
|
318
|
+
requireStoredDelete: true,
|
|
319
|
+
useDavFallback: false,
|
|
320
|
+
usePutFallback: false
|
|
321
|
+
});
|
|
322
|
+
}
|
|
47
323
|
function collectNodeStatements(store, node, doc) {
|
|
48
324
|
return store.statementsMatching(node, null, null, doc);
|
|
49
325
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sectionCardHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/sectionCardHelpers.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"sectionCardHelpers.d.ts","sourceRoot":"","sources":["../../../src/sections/shared/sectionCardHelpers.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,MAAM,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,CAAA;AAuE9D,wBAAgB,yBAAyB,CAAC,IAAI,GAAE,UAAqB,QAwDpE;AAED,wBAAgB,gCAAgC,SAU/C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,QA6B7C;AAID,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,CAcvD;AAED,wBAAgB,WAAW,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAO5E;AAED,wBAAgB,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAInE"}
|
|
@@ -10,6 +10,52 @@ exports.toMonthDateTime = toMonthDateTime;
|
|
|
10
10
|
exports.toggleDescription = toggleDescription;
|
|
11
11
|
exports.updateDescriptionOverflow = updateDescriptionOverflow;
|
|
12
12
|
let descriptionResizeBound = false;
|
|
13
|
+
const DESCRIPTION_MAX_LINES = 2;
|
|
14
|
+
function getLineHeightPx(computed) {
|
|
15
|
+
const parsedLineHeight = Number.parseFloat(computed.lineHeight);
|
|
16
|
+
if (Number.isFinite(parsedLineHeight)) {
|
|
17
|
+
return parsedLineHeight;
|
|
18
|
+
}
|
|
19
|
+
const parsedFontSize = Number.parseFloat(computed.fontSize);
|
|
20
|
+
if (Number.isFinite(parsedFontSize)) {
|
|
21
|
+
return parsedFontSize * 1.5;
|
|
22
|
+
}
|
|
23
|
+
return 24;
|
|
24
|
+
}
|
|
25
|
+
function getExpandedTextHeight(textEl) {
|
|
26
|
+
const previousDisplay = textEl.style.display;
|
|
27
|
+
const previousOverflow = textEl.style.overflow;
|
|
28
|
+
const previousPaddingRight = textEl.style.paddingRight;
|
|
29
|
+
const previousLineClamp = textEl.style.getPropertyValue('-webkit-line-clamp');
|
|
30
|
+
const previousBoxOrient = textEl.style.getPropertyValue('-webkit-box-orient');
|
|
31
|
+
textEl.style.display = 'block';
|
|
32
|
+
textEl.style.overflow = 'visible';
|
|
33
|
+
textEl.style.paddingRight = '0';
|
|
34
|
+
textEl.style.setProperty('-webkit-line-clamp', 'unset');
|
|
35
|
+
textEl.style.setProperty('-webkit-box-orient', 'initial');
|
|
36
|
+
const naturalHeight = textEl.getBoundingClientRect().height;
|
|
37
|
+
textEl.style.display = previousDisplay;
|
|
38
|
+
textEl.style.overflow = previousOverflow;
|
|
39
|
+
textEl.style.paddingRight = previousPaddingRight;
|
|
40
|
+
if (previousLineClamp) {
|
|
41
|
+
textEl.style.setProperty('-webkit-line-clamp', previousLineClamp);
|
|
42
|
+
} else {
|
|
43
|
+
textEl.style.removeProperty('-webkit-line-clamp');
|
|
44
|
+
}
|
|
45
|
+
if (previousBoxOrient) {
|
|
46
|
+
textEl.style.setProperty('-webkit-box-orient', previousBoxOrient);
|
|
47
|
+
} else {
|
|
48
|
+
textEl.style.removeProperty('-webkit-box-orient');
|
|
49
|
+
}
|
|
50
|
+
return naturalHeight;
|
|
51
|
+
}
|
|
52
|
+
function isTextOverflowingClamp(textEl, maxLines) {
|
|
53
|
+
const computed = window.getComputedStyle(textEl);
|
|
54
|
+
const lineHeight = getLineHeightPx(computed);
|
|
55
|
+
const maxCollapsedHeight = lineHeight * maxLines;
|
|
56
|
+
const naturalHeight = getExpandedTextHeight(textEl);
|
|
57
|
+
return naturalHeight > maxCollapsedHeight + 1;
|
|
58
|
+
}
|
|
13
59
|
function toDateValue(date) {
|
|
14
60
|
if (!date) return '';
|
|
15
61
|
if (typeof date === 'string') return date;
|
|
@@ -21,41 +67,63 @@ function toDateValue(date) {
|
|
|
21
67
|
please generate code for this. */
|
|
22
68
|
function updateDescriptionOverflow(root = document) {
|
|
23
69
|
const selectorGroups = [{
|
|
24
|
-
wrap: '.
|
|
25
|
-
text: '.
|
|
26
|
-
toggle: '.
|
|
70
|
+
wrap: '.resume-card__description-wrap',
|
|
71
|
+
text: '.resume-card__description-text',
|
|
72
|
+
toggle: '.resume-card__description-toggle',
|
|
73
|
+
expanded: 'resume-card__description-text--expanded',
|
|
74
|
+
overflowing: 'resume-card__description-text--overflowing'
|
|
75
|
+
}, {
|
|
76
|
+
wrap: '.education-card__description-wrap',
|
|
77
|
+
text: '.education-card__description-text',
|
|
78
|
+
toggle: '.education-card__description-toggle',
|
|
79
|
+
expanded: 'education-card__description-text--expanded',
|
|
80
|
+
overflowing: 'education-card__description-text--overflowing'
|
|
27
81
|
}, {
|
|
28
|
-
wrap: '.
|
|
29
|
-
text: '.
|
|
30
|
-
toggle: '.
|
|
82
|
+
wrap: '.bio-card__description-wrap',
|
|
83
|
+
text: '.bio-card__description-text',
|
|
84
|
+
toggle: '.bio-card__description-toggle',
|
|
85
|
+
expanded: 'bio-card__description-text--expanded',
|
|
86
|
+
overflowing: 'bio-card__description-text--overflowing'
|
|
31
87
|
}];
|
|
32
88
|
selectorGroups.forEach(({
|
|
33
89
|
wrap,
|
|
34
90
|
text,
|
|
35
|
-
toggle
|
|
91
|
+
toggle,
|
|
92
|
+
expanded,
|
|
93
|
+
overflowing
|
|
36
94
|
}) => {
|
|
37
95
|
const wraps = root.querySelectorAll(wrap);
|
|
38
96
|
wraps.forEach(container => {
|
|
97
|
+
if (!(container instanceof HTMLElement)) return;
|
|
39
98
|
const textEl = container.querySelector(text);
|
|
40
99
|
const button = container.querySelector(toggle);
|
|
41
100
|
if (!textEl || !button) return;
|
|
42
|
-
|
|
101
|
+
textEl.classList.remove(overflowing);
|
|
102
|
+
if (textEl.clientHeight === 0 || textEl.clientWidth === 0) {
|
|
103
|
+
button.hidden = true;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const isExpanded = textEl.classList.contains(expanded);
|
|
43
107
|
if (isExpanded) {
|
|
44
108
|
button.hidden = false;
|
|
45
109
|
return;
|
|
46
110
|
}
|
|
47
|
-
const isOverflowing = textEl
|
|
111
|
+
const isOverflowing = isTextOverflowingClamp(textEl, DESCRIPTION_MAX_LINES);
|
|
112
|
+
textEl.classList.toggle(overflowing, isOverflowing);
|
|
48
113
|
button.hidden = !isOverflowing;
|
|
49
114
|
if (!isOverflowing) {
|
|
50
115
|
button.setAttribute('aria-expanded', 'false');
|
|
51
116
|
button.textContent = '...more';
|
|
117
|
+
return;
|
|
52
118
|
}
|
|
53
119
|
});
|
|
54
120
|
});
|
|
55
121
|
}
|
|
56
122
|
function scheduleDescriptionOverflowCheck() {
|
|
57
123
|
if (typeof window === 'undefined') return;
|
|
58
|
-
window.requestAnimationFrame(() =>
|
|
124
|
+
window.requestAnimationFrame(() => {
|
|
125
|
+
window.requestAnimationFrame(() => updateDescriptionOverflow(window.document));
|
|
126
|
+
});
|
|
59
127
|
if (!descriptionResizeBound) {
|
|
60
128
|
window.addEventListener('resize', () => scheduleDescriptionOverflowCheck());
|
|
61
129
|
descriptionResizeBound = true;
|
|
@@ -71,7 +139,8 @@ function toggleDescription(event) {
|
|
|
71
139
|
if (!descriptionId) return;
|
|
72
140
|
const textEl = document.getElementById(descriptionId);
|
|
73
141
|
if (!textEl) return;
|
|
74
|
-
const
|
|
142
|
+
const expandedClass = textEl.matches('.resume-card__description-text') ? 'resume-card__description-text--expanded' : textEl.matches('.education-card__description-text') ? 'education-card__description-text--expanded' : textEl.matches('.bio-card__description-text') ? 'bio-card__description-text--expanded' : 'isExpanded';
|
|
143
|
+
const isExpanded = textEl.classList.toggle(expandedClass);
|
|
75
144
|
button.setAttribute('aria-expanded', isExpanded ? 'true' : 'false');
|
|
76
145
|
button.textContent = isExpanded ? '...less' : '...more';
|
|
77
146
|
if (!isExpanded) {
|