solid-panes 5.1.0-3 → 5.1.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.
Files changed (174) hide show
  1. package/dist/RDFXMLPane.d.ts.map +1 -1
  2. package/dist/RDFXMLPane2.cjs.js +1 -1
  3. package/dist/RDFXMLPane2.cjs.js.map +1 -1
  4. package/dist/RDFXMLPane2.esm.js +3 -3
  5. package/dist/RDFXMLPane2.esm.js.map +1 -1
  6. package/dist/components/editor-card/EditorCard.cjs.js +2 -2
  7. package/dist/components/editor-card/EditorCard.cjs.js.map +1 -1
  8. package/dist/components/editor-card/EditorCard.d.ts +2 -0
  9. package/dist/components/editor-card/EditorCard.d.ts.map +1 -1
  10. package/dist/components/editor-card/EditorCard.esm.js +68 -43
  11. package/dist/components/editor-card/EditorCard.esm.js.map +1 -1
  12. package/dist/components/editor-card/EditorCard.styles.cjs.js.map +1 -1
  13. package/dist/components/editor-card/EditorCard.styles.esm.js.map +1 -1
  14. package/dist/components/header/Header.cjs.js.map +1 -1
  15. package/dist/components/header/Header.esm.js.map +1 -1
  16. package/dist/components/header/Header.styles.cjs.js.map +1 -1
  17. package/dist/components/header/Header.styles.esm.js.map +1 -1
  18. package/dist/components/navbar/Navbar.cjs.js.map +1 -1
  19. package/dist/components/navbar/Navbar.esm.js.map +1 -1
  20. package/dist/components/navbar/Navbar.styles.cjs.js.map +1 -1
  21. package/dist/components/navbar/Navbar.styles.esm.js.map +1 -1
  22. package/dist/components/profile-heading/ProfileHeading.cjs.js +4 -4
  23. package/dist/components/profile-heading/ProfileHeading.cjs.js.map +1 -1
  24. package/dist/components/profile-heading/ProfileHeading.d.ts +4 -0
  25. package/dist/components/profile-heading/ProfileHeading.d.ts.map +1 -1
  26. package/dist/components/profile-heading/ProfileHeading.esm.js +123 -107
  27. package/dist/components/profile-heading/ProfileHeading.esm.js.map +1 -1
  28. package/dist/components/profile-heading/ProfileHeading.styles.cjs.js.map +1 -1
  29. package/dist/components/profile-heading/ProfileHeading.styles.esm.js.map +1 -1
  30. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js +19 -19
  31. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.cjs.js.map +1 -1
  32. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js +86 -86
  33. package/dist/components/profile-heading/editor/sections/heading/HeadingEditDialog.esm.js.map +1 -1
  34. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.cjs.js.map +1 -1
  35. package/dist/components/profile-heading/editor/sections/heading/dateHelpers.esm.js.map +1 -1
  36. package/dist/components/profile-heading/editor/sections/heading/imageHelpers.cjs.js.map +1 -1
  37. package/dist/components/profile-heading/editor/sections/heading/imagePreview.cjs.js.map +1 -1
  38. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js +1 -1
  39. package/dist/components/profile-heading/editor/sections/heading/mutations.cjs.js.map +1 -1
  40. package/dist/components/profile-heading/editor/sections/heading/mutations.esm.js +61 -61
  41. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.cjs.js.map +1 -1
  42. package/dist/components/profile-heading/editor/sections/shared/contactTypeUtils.esm.js.map +1 -1
  43. package/dist/components/profile-heading/editor/sections/shared/idNodeFactory.cjs.js.map +1 -1
  44. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.cjs.js.map +1 -1
  45. package/dist/components/profile-heading/editor/sections/shared/phoneCountries.esm.js.map +1 -1
  46. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.cjs.js.map +1 -1
  47. package/dist/components/profile-heading/editor/sections/shared/rdfMutationHelpers.esm.js.map +1 -1
  48. package/dist/components/profile-heading/editor/sections/shared/rowState.cjs.js.map +1 -1
  49. package/dist/components/profile-heading/editor/sections/shared/rowState.esm.js.map +1 -1
  50. package/dist/components/profile-heading/editor/sections/shared/sanitizeUtils.cjs.js.map +1 -1
  51. package/dist/components/profile-heading/editor/textUtils.cjs.js.map +1 -1
  52. package/dist/components/profile-heading/editor/textUtils.esm.js.map +1 -1
  53. package/dist/components/profile-heading/editor/texts/dialogTexts.cjs.js.map +1 -1
  54. package/dist/components/profile-heading/editor/texts/dialogTexts.esm.js.map +1 -1
  55. package/dist/components/profile-heading/editor/texts/messageTexts.cjs.js.map +1 -1
  56. package/dist/components/profile-heading/editor/texts/messageTexts.esm.js.map +1 -1
  57. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js +1 -1
  58. package/dist/components/profile-heading/editor/ui/dialog2.cjs.js.map +1 -1
  59. package/dist/components/profile-heading/editor/ui/dialog2.esm.js +1 -1
  60. package/dist/components/profile-heading/editor/ui/dialog2.esm.js.map +1 -1
  61. package/dist/components/profile-heading/friendActions.cjs.js +1 -1
  62. package/dist/components/profile-heading/friendActions.cjs.js.map +1 -1
  63. package/dist/components/profile-heading/friendActions.esm.js +5 -5
  64. package/dist/components/profile-heading/profileHeadingData.cjs.js.map +1 -1
  65. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js +33 -0
  66. package/dist/components/resource-action-dialog/ResourceActionDialog.cjs.js.map +1 -0
  67. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts +16 -0
  68. package/dist/components/resource-action-dialog/ResourceActionDialog.d.ts.map +1 -0
  69. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js +309 -0
  70. package/dist/components/resource-action-dialog/ResourceActionDialog.esm.js.map +1 -0
  71. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js +2 -0
  72. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.cjs.js.map +1 -0
  73. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js +6 -0
  74. package/dist/components/resource-action-dialog/ResourceActionDialog.styles.esm.js.map +1 -0
  75. package/dist/dataContentPane.d.ts.map +1 -1
  76. package/dist/dataContentPane2.cjs.js +1 -1
  77. package/dist/dataContentPane2.cjs.js.map +1 -1
  78. package/dist/dataContentPane2.esm.js +90 -78
  79. package/dist/dataContentPane2.esm.js.map +1 -1
  80. package/dist/humanReadablePane.d.ts +1 -0
  81. package/dist/humanReadablePane.d.ts.map +1 -1
  82. package/dist/humanReadablePane2.cjs.js +147 -15
  83. package/dist/humanReadablePane2.cjs.js.map +1 -1
  84. package/dist/humanReadablePane2.esm.js +281 -114
  85. package/dist/humanReadablePane2.esm.js.map +1 -1
  86. package/dist/imagePane.d.ts.map +1 -1
  87. package/dist/imagePane2.cjs.js +1 -1
  88. package/dist/imagePane2.cjs.js.map +1 -1
  89. package/dist/imagePane2.esm.js +9 -7
  90. package/dist/imagePane2.esm.js.map +1 -1
  91. package/dist/index.cjs.js +1 -1
  92. package/dist/index.cjs.js.map +1 -1
  93. package/dist/index.esm.js +3 -3
  94. package/dist/internal/internalPane.d.ts.map +1 -1
  95. package/dist/internal/internalPane2.cjs.js +1 -1
  96. package/dist/internal/internalPane2.cjs.js.map +1 -1
  97. package/dist/internal/internalPane2.esm.js +55 -60
  98. package/dist/internal/internalPane2.esm.js.map +1 -1
  99. package/dist/mainPage/header.cjs.js +1 -1
  100. package/dist/mainPage/header.esm.js +2 -2
  101. package/dist/mainPage/index.cjs.js +1 -1
  102. package/dist/mainPage/index.cjs.js.map +1 -1
  103. package/dist/mainPage/index.d.ts.map +1 -1
  104. package/dist/mainPage/index.esm.js +35 -26
  105. package/dist/mainPage/index.esm.js.map +1 -1
  106. package/dist/mainPage/navbar.cjs.js +1 -1
  107. package/dist/mainPage/navbar.cjs.js.map +1 -1
  108. package/dist/mainPage/navbar.esm.js +15 -15
  109. package/dist/mainPage/navigation.cjs.js +1 -1
  110. package/dist/mainPage/navigation.cjs.js.map +1 -1
  111. package/dist/mainPage/navigation.esm.js +4 -4
  112. package/dist/mainPage/profileHeading.d.ts.map +1 -1
  113. package/dist/mainPage/profileHeading2.cjs.js +1 -1
  114. package/dist/mainPage/profileHeading2.cjs.js.map +1 -1
  115. package/dist/mainPage/profileHeading2.esm.js +14 -14
  116. package/dist/mainPage/profileHeading2.esm.js.map +1 -1
  117. package/dist/n3Pane.d.ts.map +1 -1
  118. package/dist/n3Pane2.cjs.js +1 -1
  119. package/dist/n3Pane2.cjs.js.map +1 -1
  120. package/dist/n3Pane2.esm.js +1 -1
  121. package/dist/n3Pane2.esm.js.map +1 -1
  122. package/dist/navigation/browserEvents.cjs.js +1 -1
  123. package/dist/navigation/browserEvents.cjs.js.map +1 -1
  124. package/dist/navigation/browserEvents.d.ts.map +1 -1
  125. package/dist/navigation/browserEvents.esm.js +17 -17
  126. package/dist/navigation/browserEvents.esm.js.map +1 -1
  127. package/dist/navigation/chrome.cjs.js +1 -1
  128. package/dist/navigation/chrome.cjs.js.map +1 -1
  129. package/dist/navigation/chrome.d.ts +2 -2
  130. package/dist/navigation/chrome.d.ts.map +1 -1
  131. package/dist/navigation/chrome.esm.js +2 -2
  132. package/dist/navigation/chrome.esm.js.map +1 -1
  133. package/dist/navigation/controller.cjs.js +1 -1
  134. package/dist/navigation/controller.cjs.js.map +1 -1
  135. package/dist/navigation/controller.esm.js +37 -37
  136. package/dist/navigation/podContext.cjs.js +1 -1
  137. package/dist/navigation/podContext.cjs.js.map +1 -1
  138. package/dist/navigation/podContext.esm.js +5 -5
  139. package/dist/navigation/state.cjs.js +1 -1
  140. package/dist/navigation/state.cjs.js.map +1 -1
  141. package/dist/navigation/state.d.ts +4 -0
  142. package/dist/navigation/state.d.ts.map +1 -1
  143. package/dist/navigation/state.esm.js +18 -5
  144. package/dist/navigation/state.esm.js.map +1 -1
  145. package/dist/outline/fileExplorerHelpers.cjs.js +1 -1
  146. package/dist/outline/fileExplorerHelpers.cjs.js.map +1 -1
  147. package/dist/outline/fileExplorerHelpers.d.ts +2 -5
  148. package/dist/outline/fileExplorerHelpers.d.ts.map +1 -1
  149. package/dist/outline/fileExplorerHelpers.esm.js +11 -13
  150. package/dist/outline/fileExplorerHelpers.esm.js.map +1 -1
  151. package/dist/outline/manager2.cjs.js +1 -1
  152. package/dist/outline/manager2.cjs.js.map +1 -1
  153. package/dist/outline/manager2.esm.js +355 -327
  154. package/dist/outline/manager2.esm.js.map +1 -1
  155. package/dist/registerPanes.cjs.js +1 -1
  156. package/dist/registerPanes.cjs.js.map +1 -1
  157. package/dist/registerPanes.esm.js +1 -1
  158. package/dist/registerPanes.esm.js.map +1 -1
  159. package/dist/slideshow/slideshowPane.cjs.js +1 -1
  160. package/dist/slideshow/slideshowPane.cjs.js.map +1 -1
  161. package/dist/slideshow/slideshowPane.esm.js +30 -30
  162. package/dist/slideshow/slideshowPane.esm.js.map +1 -1
  163. package/dist/social/socialPane2.cjs.js +1 -1
  164. package/dist/social/socialPane2.esm.js +1 -1
  165. package/dist/social/socialSections.cjs.js +1 -1
  166. package/dist/social/socialSections.esm.js +1 -1
  167. package/dist/utils/paneUtils.cjs.js +1 -1
  168. package/dist/utils/paneUtils.cjs.js.map +1 -1
  169. package/dist/utils/paneUtils.esm.js +15 -15
  170. package/dist/versionInfo.cjs.js +1 -1
  171. package/dist/versionInfo.cjs.js.map +1 -1
  172. package/dist/versionInfo.esm.js +9 -9
  173. package/dist/versionInfo.esm.js.map +1 -1
  174. package/package.json +11 -12
@@ -1 +1 @@
1
- {"version":3,"file":"profileHeadingData.cjs.js","names":["store","getViewerRelation","ns","utils","widgets","getViewerMode","subject","relation","updater","editable","doc","error","console","warn","presentProfile","profileStore","nickname","anyValue","vcard","foaf","undefined","dateOfBirth","imageSrc","findImage","primaryPhone","selectPrimaryPoint","primaryEmail","jobTitle","selectHeadingJobTitle","addressNode","any","addressSubject","primaryAddress","entryNode","type","rdf","streetAddress","locality","region","postalCode","countryName","country","subjectPronoun","solid","objectPronoun","pronouns","name","label","location","roles","each","org","filter","membership","holds","schema","map","membershipNode","types","roleType","find","value","startsWith","split","pop","toLowerCase","roleText","escoRole","escoRoleName","endDate","title","isCurrent","selected","role","predicate","kind","candidates","nodes","statementsMatching","statement","object","seen","Set","has","add","valueNode","resolvePointValue","termType","candidate","some","typeNode","isWorkType","push","isContactValue","values","normalized","trim","test","endsWith","getViewerRelation","store","ns","widgets","utils","require_viewerUtils","solid_ui","solid_logic","getViewerMode","relation","subject","error","presentProfile","doc","nickname","profileStore","dateOfBirth","imageSrc","primaryPhone","selectPrimaryPoint","primaryEmail","jobTitle","selectHeadingJobTitle","addressNode","addressSubject","primaryAddress","country","locality","subjectPronoun","objectPronoun","pronouns","roles","membership","membershipNode","roleType","type","roleText","escoRole","escoRoleName","endDate","role","candidates","nodes","predicate","statement","seen","entryNode","valueNode","resolvePointValue","kind","types","candidate","isWorkType","typeNode","isContactValue","value","normalized"],"sources":["../../../src/components/profile-heading/profileHeadingData.ts"],"sourcesContent":["import { store } from 'solid-logic'\nimport { getViewerRelation } from '../../utils/viewerUtils'\nimport { NamedNode, type LiveStore, type Node } from 'rdflib'\nimport { ns, utils, widgets } from 'solid-ui'\nimport type { AddressDetails, PointDetails } from './editor/sections/contactInfo/types'\nimport type { ProfileDetails } from './editor/sections/heading/types'\nimport type { ViewerMode } from '../../types'\n\nexport async function getViewerMode (subject: NamedNode): Promise<ViewerMode> {\n const relation = getViewerRelation(subject)\n if (relation !== 'owner') return relation\n\n try {\n return store.updater?.editable?.(subject.doc()) ? 'owner' : 'anonymous'\n } catch (error) {\n console.warn('Failed to check profile edit permissions.', error)\n return 'anonymous'\n }\n}\n\nexport function presentProfile (subject: NamedNode, profileStore: LiveStore = store): ProfileDetails {\n const doc = subject.doc()\n const nickname = profileStore.anyValue(subject, ns.vcard('nickname')) ||\n profileStore.anyValue(subject, ns.foaf('nick')) || undefined\n const dateOfBirth = profileStore.anyValue(subject, ns.vcard('bday')) || undefined\n const imageSrc = widgets.findImage(subject) || undefined\n const primaryPhone = selectPrimaryPoint(profileStore, subject, ns.vcard('hasTelephone'), doc, 'phone')\n const primaryEmail = selectPrimaryPoint(profileStore, subject, ns.vcard('hasEmail'), doc, 'email')\n const jobTitle = selectHeadingJobTitle(profileStore, subject, doc)\n\n const addressNode = profileStore.any(subject, ns.vcard('hasAddress'), null, doc) || undefined\n const addressSubject = addressNode as NamedNode | undefined\n const primaryAddress: AddressDetails | undefined = addressNode\n ? {\n entryNode: addressNode,\n type: profileStore.any(addressSubject, ns.rdf('type'), null, doc) || undefined,\n streetAddress: profileStore.anyValue(addressSubject, ns.vcard('street-address')) || undefined,\n locality: profileStore.anyValue(addressSubject, ns.vcard('locality')) || undefined,\n region: profileStore.anyValue(addressSubject, ns.vcard('region')) || undefined,\n postalCode: profileStore.anyValue(addressSubject, ns.vcard('postal-code')) || undefined,\n countryName: profileStore.anyValue(addressSubject, ns.vcard('country-name')) || undefined\n }\n : undefined\n const country = primaryAddress?.countryName\n const locality = primaryAddress?.locality\n const subjectPronoun = profileStore.anyValue(subject, ns.solid('preferredSubjectPronoun')) || ''\n const objectPronoun = profileStore.anyValue(subject, ns.solid('preferredObjectPronoun')) || ''\n const pronouns = subjectPronoun ? `${subjectPronoun}${objectPronoun ? `/${objectPronoun}` : ''}` : undefined\n\n return {\n name: utils.label(subject),\n nickname,\n imageSrc,\n dateOfBirth,\n jobTitle,\n primaryPhone,\n primaryEmail,\n primaryAddress,\n location: country && locality ? `${locality}, ${country}` : country || locality || undefined,\n pronouns,\n entryNode: subject\n }\n}\n\nfunction selectHeadingJobTitle (profileStore: LiveStore, subject: NamedNode, doc: NamedNode): string | undefined {\n const roles = profileStore.each(null, ns.org('member'), subject, doc)\n .filter(membership =>\n !profileStore.holds(\n membership as NamedNode,\n ns.rdf('type'),\n ns.schema('EducationalOccupationalCredential'),\n doc\n )\n )\n .map(membership => {\n const membershipNode = membership as NamedNode\n const types = profileStore.each(membershipNode, ns.rdf('type'), null, doc)\n const roleType = types.find(type => type.value.startsWith(ns.solid('').value))?.value.split(/[#/]/).pop()?.toLowerCase()\n const roleText = profileStore.anyValue(membershipNode, ns.vcard('role'), null, doc) || undefined\n const escoRole = profileStore.any(membershipNode, ns.org('role'), null, doc)\n const escoRoleName = escoRole\n ? profileStore.anyValue(escoRole as NamedNode, ns.schema('name'), null, doc) || undefined\n : undefined\n const endDate = profileStore.any(membershipNode, ns.schema('endDate'), null, doc)\n const title = escoRoleName && roleText\n ? `${escoRoleName} - ${roleText}`\n : roleText || escoRoleName\n\n return {\n title,\n roleType,\n isCurrent: !endDate || roleType === 'currentrole'\n }\n })\n const selected = roles.find(role => role.isCurrent) ||\n roles.find(role => role.roleType !== 'currentrole' && role.roleType !== 'futurerole')\n return selected?.title\n}\n\nfunction selectPrimaryPoint (\n profileStore: LiveStore,\n subject: NamedNode,\n predicate: NamedNode,\n doc: NamedNode,\n kind: 'email' | 'phone'\n): PointDetails | undefined {\n const candidates: PointDetails[] = []\n const nodes = [\n ...profileStore.statementsMatching(subject, predicate, null, doc),\n ...profileStore.statementsMatching(subject, predicate)\n ].map(statement => statement.object as Node)\n const seen = new Set<string>()\n\n for (const entryNode of nodes) {\n if (seen.has(entryNode.value)) continue\n seen.add(entryNode.value)\n\n const valueNode = resolvePointValue(profileStore, entryNode, doc, kind)\n if (!valueNode) continue\n\n const types = entryNode.termType === 'NamedNode'\n ? [\n ...profileStore.each(entryNode as NamedNode, ns.rdf('type'), null, doc),\n ...profileStore.each(entryNode as NamedNode, ns.rdf('type'))\n ]\n : []\n const type = types[0] || (kind === 'email' ? ns.vcard('Internet') : ns.vcard('Voice'))\n const candidate = { entryNode, type: type as Node, valueNode }\n if (types.some(typeNode => isWorkType(typeNode.value))) return candidate\n candidates.push(candidate)\n }\n\n return candidates[0]\n}\n\nfunction resolvePointValue (\n profileStore: LiveStore,\n entryNode: Node,\n doc: NamedNode,\n kind: 'email' | 'phone'\n): Node | undefined {\n if (isContactValue(entryNode.value, kind)) return entryNode\n if (entryNode.termType !== 'NamedNode') return undefined\n\n const values = [\n ...profileStore.each(entryNode as NamedNode, ns.vcard('value'), null, doc),\n ...profileStore.each(entryNode as NamedNode, ns.vcard('value'))\n ]\n return values.find(value => isContactValue(value.value, kind))\n}\n\nfunction isContactValue (value: string, kind: 'email' | 'phone'): boolean {\n const normalized = value.trim()\n if (kind === 'email') {\n return /^mailto:/i.test(normalized) || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalized)\n }\n return /^tel:/i.test(normalized) || /^[+()\\-\\s\\d]{5,}$/.test(normalized)\n}\n\nfunction isWorkType (value: string): boolean {\n const normalized = value.trim().toLowerCase()\n return normalized === 'work' || normalized.endsWith('#work') || normalized.endsWith('/work')\n}\n"],"mappings":"A,qGAQA,eAAsBK,EAAeC,EAAyC,CAC5E,IAAMC,EAAWN,EAAAA,kBAAkBK,CAAO,EAC1C,GAAIC,IAAa,QAAS,OAAOA,EAEjC,GAAI,CACF,OAAOP,EAAAA,MAAMQ,SAASC,WAAWH,EAAQI,IAAI,CAAC,EAAI,QAAU,WAC9D,OAASC,EAAO,CAEd,OADAC,QAAQC,KAAK,4CAA6CF,CAAK,EACxD,WACT,CACF,CAEA,SAAgBG,EAAgBR,EAAoBS,EAA0Bf,EAAAA,MAAuB,CACnG,IAAMU,EAAMJ,EAAQI,IAAI,EAClBM,EAAWD,EAAaE,SAASX,EAASJ,EAAAA,GAAGgB,MAAM,UAAU,CAAC,GAClEH,EAAaE,SAASX,EAASJ,EAAAA,GAAGiB,KAAK,MAAM,CAAC,GAAKC,IAAAA,GAC/CC,EAAcN,EAAaE,SAASX,EAASJ,EAAAA,GAAGgB,MAAM,MAAM,CAAC,GAAKE,IAAAA,GAClEE,EAAWlB,EAAAA,QAAQmB,UAAUjB,CAAO,GAAKc,IAAAA,GACzCI,EAAeC,EAAmBV,EAAcT,EAASJ,EAAAA,GAAGgB,MAAM,cAAc,EAAGR,EAAK,OAAO,EAC/FgB,EAAeD,EAAmBV,EAAcT,EAASJ,EAAAA,GAAGgB,MAAM,UAAU,EAAGR,EAAK,OAAO,EAC3FiB,EAAWC,EAAsBb,EAAcT,EAASI,CAAG,EAE3DmB,EAAcd,EAAae,IAAIxB,EAASJ,EAAAA,GAAGgB,MAAM,YAAY,EAAG,KAAMR,CAAG,GAAKU,IAAAA,GAC9EW,EAAiBF,EACjBG,EAA6CH,EAC/C,CACEI,UAAWJ,EACXK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AC/D,CAEA,SAASkB,EAAgBhC,EAAec,EAAkC,CACxE,IAAMoB,EAAalC,EAAMmC,KAAK,EAI9B,OAHIrB,IAAS,QACJ,YAAYsB,KAAKF,CAAU,GAAK,6BAA6BE,KAAKF,CAAU,EAE9E,SAASE,KAAKF,CAAU,GAAK,oBAAoBE,KAAKF,CAAU,CACzE,CAEA,SAASJ,EAAY9B,EAAwB,CAC3C,IAAMkC,EAAalC,EAAMmC,KAAK,CAAC,CAAC/B,YAAY,EAC5C,OAAO8B,IAAe,QAAUA,EAAWG,SAAS,OAAO,GAAKH,EAAWG,SAAS,OAAO,CAC7F,C"}
1
+ {"version":3,"file":"profileHeadingData.cjs.js","names":["store","getViewerRelation","ns","utils","widgets","getViewerMode","subject","relation","updater","editable","doc","error","console","warn","presentProfile","profileStore","nickname","anyValue","vcard","foaf","undefined","dateOfBirth","imageSrc","findImage","primaryPhone","selectPrimaryPoint","primaryEmail","jobTitle","selectHeadingJobTitle","addressNode","any","addressSubject","primaryAddress","entryNode","type","rdf","streetAddress","locality","region","postalCode","countryName","country","subjectPronoun","solid","objectPronoun","pronouns","name","label","location","roles","each","org","filter","membership","holds","schema","map","membershipNode","types","roleType","find","value","startsWith","split","pop","toLowerCase","roleText","escoRole","escoRoleName","endDate","title","isCurrent","selected","role","predicate","kind","candidates","nodes","statementsMatching","statement","object","seen","Set","has","add","valueNode","resolvePointValue","termType","candidate","some","typeNode","isWorkType","push","isContactValue","values","normalized","trim","test","endsWith","require_viewerUtils","solid_ui","solid_logic","getViewerMode","relation","subject","error","presentProfile","doc","nickname","profileStore","dateOfBirth","imageSrc","primaryPhone","selectPrimaryPoint","primaryEmail","jobTitle","selectHeadingJobTitle","addressNode","addressSubject","primaryAddress","country","locality","subjectPronoun","objectPronoun","pronouns","roles","membership","membershipNode","roleType","type","roleText","escoRole","escoRoleName","endDate","role","candidates","nodes","predicate","statement","seen","entryNode","valueNode","resolvePointValue","kind","types","candidate","isWorkType","typeNode","isContactValue","value","normalized"],"sources":["../../../src/components/profile-heading/profileHeadingData.ts"],"sourcesContent":["import { store } from 'solid-logic'\nimport { getViewerRelation } from '../../utils/viewerUtils'\nimport { NamedNode, type LiveStore, type Node } from 'rdflib'\nimport { ns, utils, widgets } from 'solid-ui'\nimport type { AddressDetails, PointDetails } from './editor/sections/contactInfo/types'\nimport type { ProfileDetails } from './editor/sections/heading/types'\nimport type { ViewerMode } from '../../types'\n\nexport async function getViewerMode (subject: NamedNode): Promise<ViewerMode> {\n const relation = getViewerRelation(subject)\n if (relation !== 'owner') return relation\n\n try {\n return store.updater?.editable?.(subject.doc()) ? 'owner' : 'anonymous'\n } catch (error) {\n console.warn('Failed to check profile edit permissions.', error)\n return 'anonymous'\n }\n}\n\nexport function presentProfile (subject: NamedNode, profileStore: LiveStore = store): ProfileDetails {\n const doc = subject.doc()\n const nickname = profileStore.anyValue(subject, ns.vcard('nickname')) ||\n profileStore.anyValue(subject, ns.foaf('nick')) || undefined\n const dateOfBirth = profileStore.anyValue(subject, ns.vcard('bday')) || undefined\n const imageSrc = widgets.findImage(subject) || undefined\n const primaryPhone = selectPrimaryPoint(profileStore, subject, ns.vcard('hasTelephone'), doc, 'phone')\n const primaryEmail = selectPrimaryPoint(profileStore, subject, ns.vcard('hasEmail'), doc, 'email')\n const jobTitle = selectHeadingJobTitle(profileStore, subject, doc)\n\n const addressNode = profileStore.any(subject, ns.vcard('hasAddress'), null, doc) || undefined\n const addressSubject = addressNode as NamedNode | undefined\n const primaryAddress: AddressDetails | undefined = addressNode\n ? {\n entryNode: addressNode,\n type: profileStore.any(addressSubject, ns.rdf('type'), null, doc) || undefined,\n streetAddress: profileStore.anyValue(addressSubject, ns.vcard('street-address')) || undefined,\n locality: profileStore.anyValue(addressSubject, ns.vcard('locality')) || undefined,\n region: profileStore.anyValue(addressSubject, ns.vcard('region')) || undefined,\n postalCode: profileStore.anyValue(addressSubject, ns.vcard('postal-code')) || undefined,\n countryName: profileStore.anyValue(addressSubject, ns.vcard('country-name')) || undefined\n }\n : undefined\n const country = primaryAddress?.countryName\n const locality = primaryAddress?.locality\n const subjectPronoun = profileStore.anyValue(subject, ns.solid('preferredSubjectPronoun')) || ''\n const objectPronoun = profileStore.anyValue(subject, ns.solid('preferredObjectPronoun')) || ''\n const pronouns = subjectPronoun ? `${subjectPronoun}${objectPronoun ? `/${objectPronoun}` : ''}` : undefined\n\n return {\n name: utils.label(subject),\n nickname,\n imageSrc,\n dateOfBirth,\n jobTitle,\n primaryPhone,\n primaryEmail,\n primaryAddress,\n location: country && locality ? `${locality}, ${country}` : country || locality || undefined,\n pronouns,\n entryNode: subject\n }\n}\n\nfunction selectHeadingJobTitle (profileStore: LiveStore, subject: NamedNode, doc: NamedNode): string | undefined {\n const roles = profileStore.each(null, ns.org('member'), subject, doc)\n .filter(membership =>\n !profileStore.holds(\n membership as NamedNode,\n ns.rdf('type'),\n ns.schema('EducationalOccupationalCredential'),\n doc\n )\n )\n .map(membership => {\n const membershipNode = membership as NamedNode\n const types = profileStore.each(membershipNode, ns.rdf('type'), null, doc)\n const roleType = types.find(type => type.value.startsWith(ns.solid('').value))?.value.split(/[#/]/).pop()?.toLowerCase()\n const roleText = profileStore.anyValue(membershipNode, ns.vcard('role'), null, doc) || undefined\n const escoRole = profileStore.any(membershipNode, ns.org('role'), null, doc)\n const escoRoleName = escoRole\n ? profileStore.anyValue(escoRole as NamedNode, ns.schema('name'), null, doc) || undefined\n : undefined\n const endDate = profileStore.any(membershipNode, ns.schema('endDate'), null, doc)\n const title = escoRoleName && roleText\n ? `${escoRoleName} - ${roleText}`\n : roleText || escoRoleName\n\n return {\n title,\n roleType,\n isCurrent: !endDate || roleType === 'currentrole'\n }\n })\n const selected = roles.find(role => role.isCurrent) ||\n roles.find(role => role.roleType !== 'currentrole' && role.roleType !== 'futurerole')\n return selected?.title\n}\n\nfunction selectPrimaryPoint (\n profileStore: LiveStore,\n subject: NamedNode,\n predicate: NamedNode,\n doc: NamedNode,\n kind: 'email' | 'phone'\n): PointDetails | undefined {\n const candidates: PointDetails[] = []\n const nodes = [\n ...profileStore.statementsMatching(subject, predicate, null, doc),\n ...profileStore.statementsMatching(subject, predicate)\n ].map(statement => statement.object as Node)\n const seen = new Set<string>()\n\n for (const entryNode of nodes) {\n if (seen.has(entryNode.value)) continue\n seen.add(entryNode.value)\n\n const valueNode = resolvePointValue(profileStore, entryNode, doc, kind)\n if (!valueNode) continue\n\n const types = entryNode.termType === 'NamedNode'\n ? [\n ...profileStore.each(entryNode as NamedNode, ns.rdf('type'), null, doc),\n ...profileStore.each(entryNode as NamedNode, ns.rdf('type'))\n ]\n : []\n const type = types[0] || (kind === 'email' ? ns.vcard('Internet') : ns.vcard('Voice'))\n const candidate = { entryNode, type: type as Node, valueNode }\n if (types.some(typeNode => isWorkType(typeNode.value))) return candidate\n candidates.push(candidate)\n }\n\n return candidates[0]\n}\n\nfunction resolvePointValue (\n profileStore: LiveStore,\n entryNode: Node,\n doc: NamedNode,\n kind: 'email' | 'phone'\n): Node | undefined {\n if (isContactValue(entryNode.value, kind)) return entryNode\n if (entryNode.termType !== 'NamedNode') return undefined\n\n const values = [\n ...profileStore.each(entryNode as NamedNode, ns.vcard('value'), null, doc),\n ...profileStore.each(entryNode as NamedNode, ns.vcard('value'))\n ]\n return values.find(value => isContactValue(value.value, kind))\n}\n\nfunction isContactValue (value: string, kind: 'email' | 'phone'): boolean {\n const normalized = value.trim()\n if (kind === 'email') {\n return /^mailto:/i.test(normalized) || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(normalized)\n }\n return /^tel:/i.test(normalized) || /^[+()\\-\\s\\d]{5,}$/.test(normalized)\n}\n\nfunction isWorkType (value: string): boolean {\n const normalized = value.trim().toLowerCase()\n return normalized === 'work' || normalized.endsWith('#work') || normalized.endsWith('/work')\n}\n"],"mappings":"A,qGAQA,eAAsBK,EAAeC,EAAyC,CAC5E,IAAMC,EAAWN,EAAAA,kBAAkBK,CAAO,EAC1C,GAAIC,IAAa,QAAS,OAAOA,EAE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AAe,QAAUA,EAAWG,SAAS,OAAO,GAAKH,EAAWG,SAAS,OAAO,CAC7F,C"}
@@ -0,0 +1,33 @@
1
+ require("../../_virtual/~icons/lucide/x.cjs.js");const e=require("./ResourceActionDialog.styles.cjs.js");let t=require("solid-ui");require("solid-ui/components/button");let n=require("lit"),r=require("lit/decorators.js");require("solid-ui/components/dialog"),require("solid-ui/components/dialog-content"),require("solid-ui/components/dialog-footer"),require("solid-ui/components/dialog-header");var i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y;function b(e,t,n){x(e,t),t.set(e,n)}function x(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function S(e,t,n){return e.set(w(e,t),n),n}function C(e,t){return e.get(w(e,t))}function w(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function T(e,t,n){return(t=D(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e,t,n,r,i,a){function o(e,t,n){return function(r,i){return n&&n(r),e[t].call(r,i)}}function s(e,t){for(var n=0;n<e.length;n++)e[n].call(t);return t}function c(e,t,n,r){if(typeof e!=`function`&&(r||e!==void 0))throw TypeError(t+` must `+(n||`be`)+` a function`+(r?``:` or undefined`));return e}function l(e,t,n,r,i,a,s,l,u,d,f,p,m){function h(e){if(!m(e))throw TypeError(`Attempted to access private element on non-instance`)}var g,_=t[0],v=t[3],y=!l;if(!y){n||Array.isArray(_)||(_=[_]);var b={},x=[],S=i===3?`get`:i===4||p?`set`:`value`;d?(f||p?b={get:k(function(){return v(this)},r,`get`),set:function(e){t[4](this,e)}}:b[S]=v,f||k(b[S],r,i===2?``:S)):f||(b=Object.getOwnPropertyDescriptor(e,r))}for(var C=e,w=_.length-1;w>=0;w-=n?2:1){var T=_[w],E=n?_[w-1]:void 0,D={},O={kind:[`field`,`accessor`,`method`,`getter`,`setter`,`class`][i],name:r,metadata:a,addInitializer:function(e,t){if(e.v)throw Error(`attempted to call addInitializer after decoration was finished`);c(t,`An initializer`,`be`,!0),s.push(t)}.bind(null,D)};try{if(y)(g=c(T.call(E,C,O),`class decorators`,`return`))&&(C=g);else{var A,j;O.static=u,O.private=d,d?i===2?A=function(e){return h(e),b.value}:(i<4&&(A=o(b,`get`,h)),i!==3&&(j=o(b,`set`,h))):(A=function(e){return e[r]},(i<2||i===4)&&(j=function(e,t){e[r]=t}));var M=O.access={has:d?m.bind():function(e){return r in e}};if(A&&(M.get=A),j&&(M.set=j),C=T.call(E,p?{get:b.get,set:b.set}:b[S],O),p){if(typeof C==`object`&&C)(g=c(C.get,`accessor.get`))&&(b.get=g),(g=c(C.set,`accessor.set`))&&(b.set=g),(g=c(C.init,`accessor.init`))&&x.push(g);else if(C!==void 0)throw TypeError(`accessor decorators must return an object with get, set, or init properties or void 0`)}else c(C,(f?`field`:`method`)+` decorators`,`return`)&&(f?x.push(C):b[S]=C)}}finally{D.v=!0}}return(f||p)&&l.push(function(e,t){for(var n=x.length-1;n>=0;n--)t=x[n].call(e,t);return t}),f||y||(d?p?l.push(o(b,`get`),o(b,`set`)):l.push(i===2?b[S]:o.call.bind(b[S])):Object.defineProperty(e,r,b)),C}function u(e,t){return Object.defineProperty(e,Symbol.metadata||Symbol.for(`Symbol.metadata`),{configurable:!0,enumerable:!0,value:t})}if(arguments.length>=6)var d=a[Symbol.metadata||Symbol.for(`Symbol.metadata`)];var f=Object.create(d??null),p=function(e,t,n,r){var i,a,o=[],c=function(t){return A(t)===e},u=new Map;function d(e){e&&o.push(s.bind(null,e))}for(var f=0;f<t.length;f++){var p=t[f];if(Array.isArray(p)){var m=p[1],h=p[2],g=p.length>3,_=16&m,v=!!(8&m),y=(m&=7)==0,b=h+`/`+v;if(!y&&!g){var x=u.get(b);if(!0===x||x===3&&m!==4||x===4&&m!==3)throw Error(`Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: `+h);u.set(b,!(m>2)||m)}l(v?e:e.prototype,p,_,g?`#`+h:D(h),m,r,v?a||=[]:i||=[],o,v,g,y,m===1,v&&g?c:n)}}return d(i),d(a),o}(e,t,i,f);return n.length||u(e,f),{e:p,get c(){var t=[];return n.length&&[u(l(e,[n],r,e.name,5,f,t),f),s.bind(null,t,e)]}}}function D(e){var t=O(e,`string`);return typeof t==`symbol`?t:t+``}function O(e,t){if(typeof e!=`object`||!e)return e;var n;if(typeof Symbol<`u`&&(n=e[Symbol.toPrimitive])!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function k(e,t,n){typeof t==`symbol`&&(t=(t=t.description)?`[`+t+`]`:``);try{Object.defineProperty(e,"name",{configurable:!0,value:n?n+` `+t:t})}catch{}return e}function A(e){if(Object(e)!==e)throw TypeError(`right-hand side of 'in' should be an object, got `+(e===null?`null`:typeof e));return e}function j(e){return e}d=[(0,t.customElement)(`solid-panes-resource-action-dialog`)];var M;new(v=(o=new WeakMap,s=new WeakMap,c=new WeakMap,y=(f=(0,r.property)({type:String}),m=(0,r.property)({type:String}),g=(0,r.property)({type:Boolean}),`title`),a=class extends t.WebComponent{constructor(...e){super(...e),b(this,o,(l(this),p(this,``))),b(this,s,h(this,``)),b(this,c,_(this,!1)),T(this,`result`,null),T(this,`returnFocus`,null)}get[y](){return C(o,this)}set title(e){S(o,this,e)}get message(){return C(s,this)}set message(e){S(s,this,e)}get confirmation(){return C(c,this)}set confirmation(e){S(c,this,e)}open(){let e=this.ownerDocument.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return this.returnFocus=e instanceof HTMLElement?e:null,new Promise(e=>{this.result=e})}closeDialog(e){let t=(this.shadowRoot?.querySelector(`solid-ui-dialog`))?.shadowRoot?.querySelector(`dialog`);this.result?.(e),this.result=null,t?.open&&t.close(),this.remove()}disconnectedCallback(){if(super.disconnectedCallback(),this.result?.(!1),this.result=null,this.returnFocus?.isConnected)this.returnFocus.focus();else{let e=this.ownerDocument.querySelector(`main`);if(e){let t=e.getAttribute(`tabindex`);e.tabIndex=-1,e.focus(),t===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,t)}}this.returnFocus=null}async firstUpdated(){super.firstUpdated();let e=this.shadowRoot?.querySelector(`solid-ui-dialog`);await e?.updateComplete;let t=e?.shadowRoot?.querySelector(`dialog`);if(!t)throw Error(`Internal pane dialog did not render a native dialog`);t.setAttribute(`aria-label`,this.title),t.setAttribute(`aria-description`,this.message),t.addEventListener(`cancel`,e=>{e.preventDefault(),this.closeDialog(!1)}),t.addEventListener(`close`,()=>{this.isConnected&&this.closeDialog(!1)});let n=this.shadowRoot?.querySelector(`[data-initial-action]`);await n?.updateComplete,n?.shadowRoot?.querySelector(`button`)?.focus()}handleKeyDown(e){if(e.key!==`Tab`)return;let t=Array.from(this.shadowRoot?.querySelectorAll(`solid-ui-button`)??[]).map(e=>e.shadowRoot?.querySelector(`button`)).filter(e=>!!e&&!e.disabled),n=t.findIndex(e=>{let t=e.getRootNode();return t instanceof ShadowRoot&&t.activeElement===e});e.shiftKey&&n===0?(e.preventDefault(),t[t.length-1]?.focus()):!e.shiftKey&&n===t.length-1&&(e.preventDefault(),t[0]?.focus())}render(){let[e,...t]=this.message.split(`
2
+ `);return n.html`
3
+ <solid-ui-dialog @keydown=${this.handleKeyDown}>
4
+ <solid-ui-dialog-header slot="header">
5
+ <h2>${this.title}</h2>
6
+ <solid-ui-button variant="ghost" @click=${()=>this.closeDialog(!1)}>
7
+ <span class="sr-only">Close dialog</span>
8
+ <icon-lucide-x slot="icon" aria-hidden="true"></icon-lucide-x>
9
+ </solid-ui-button>
10
+ </solid-ui-dialog-header>
11
+ <solid-ui-dialog-content>
12
+ <p>
13
+ ${e}
14
+ ${t.map(e=>n.html`<span class="resource-action-dialog-emphasis">${e}</span>`)}
15
+ </p>
16
+ </solid-ui-dialog-content>
17
+ <solid-ui-dialog-footer slot="footer">
18
+ ${this.confirmation?n.html`
19
+ <solid-ui-button data-initial-action variant="secondary" @click=${()=>this.closeDialog(!1)}>
20
+ Cancel
21
+ </solid-ui-button>
22
+ <solid-ui-button @click=${()=>this.closeDialog(!0)}>
23
+ Delete
24
+ </solid-ui-button>
25
+ `:n.html`
26
+ <solid-ui-button data-initial-action @click=${()=>this.closeDialog(!1)}>
27
+ OK
28
+ </solid-ui-button>
29
+ `}
30
+ </solid-ui-dialog-footer>
31
+ </solid-ui-dialog>
32
+ `}},{e:[p,h,_,l],c:[M,u]}=E(a,[[f,1,`title`],[m,1,`message`],[g,1,`confirmation`]],d,0,void 0,t.WebComponent),a),i=class extends j{constructor(){super(M),T(this,`styles`,e.default),u()}},T(i,v,void 0),i),Object.defineProperty(exports,"default",{enumerable:!0,get:function(){return M}});
33
+ //# sourceMappingURL=ResourceActionDialog.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceActionDialog.cjs.js","names":["html","property","customElement","WebComponent","styles","_classDecs","_ResourceActionDialog","_ResourceActionDialog2","_A","WeakMap","_B","_C","_ref","_titleDecs","type","String","_messageDecs","_confirmationDecs","Boolean","_ResourceActionDialog3","ResourceActionDialog","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_title","_init_message","_init_confirmation","_defineProperty","_classPrivateFieldGet","title","v","_classPrivateFieldSet","message","confirmation","open","activeElement","ownerDocument","shadowRoot","returnFocus","HTMLElement","Promise","resolve","result","closeDialog","dialog","querySelector","nativeDialog","close","remove","disconnectedCallback","isConnected","focus","main","previousTabIndex","getAttribute","tabIndex","removeAttribute","setAttribute","firstUpdated","updateComplete","Error","addEventListener","event","preventDefault","initialAction","handleKeyDown","key","buttons","Array","from","querySelectorAll","map","component","filter","button","disabled","focusedIndex","findIndex","root","getRootNode","ShadowRoot","shiftKey","length","render","mainMessage","additionalMessages","split","e","c","_initClass","_applyDecs","_Class","_identity","require_ResourceActionDialog_styles","solid_ui","lit","lit_decorators_js","_Class","_ResourceActionDialog3","_A","_B","_C","_initProto","_initClass","_classDecs","_titleDecs","_init_title","_messageDecs","_init_message","_confirmationDecs","_init_confirmation","_ResourceActionDialog2","_ref","_classPrivateFieldInitSpec","_checkPrivateRedeclaration","a","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_defineProperty","_toPropertyKey","t","_applyDecs","i","n","o","c","applyDec","m","h","y","v","g","b","u","w","S","A","d","f","p","_setFunctionName","P","j","D","I","k","F","l","N","_checkInRHS","_toPrimitive","e","_identity","_ResourceActionDialog","args","activeElement","resolve","nativeDialog","result","main","previousTabIndex","dialog","event","initialAction","buttons","component","button","focusedIndex","root","mainMessage","additionalMessages","message"],"sources":["../../../src/components/resource-action-dialog/ResourceActionDialog.ts"],"sourcesContent":["import { html } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { customElement, WebComponent } from 'solid-ui'\nimport 'solid-ui/components/button'\nimport 'solid-ui/components/dialog'\nimport 'solid-ui/components/dialog-content'\nimport 'solid-ui/components/dialog-footer'\nimport 'solid-ui/components/dialog-header'\nimport '~icons/lucide/x'\nimport styles from './ResourceActionDialog.styles.css'\n\n@customElement('solid-panes-resource-action-dialog')\nexport default class ResourceActionDialog extends WebComponent {\n static styles = styles\n\n @property({ type: String })\n accessor title = ''\n\n @property({ type: String })\n accessor message = ''\n\n @property({ type: Boolean })\n accessor confirmation = false\n\n private result: ((value: boolean) => void) | null = null\n private returnFocus: HTMLElement | null = null\n\n public open (): Promise<boolean> {\n let activeElement = this.ownerDocument.activeElement\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement\n }\n this.returnFocus = activeElement instanceof HTMLElement ? activeElement : null\n return new Promise(resolve => {\n this.result = resolve\n })\n }\n\n private closeDialog (result: boolean) {\n const dialog = this.shadowRoot?.querySelector('solid-ui-dialog')\n const nativeDialog = dialog?.shadowRoot?.querySelector('dialog')\n this.result?.(result)\n this.result = null\n if (nativeDialog?.open) {\n nativeDialog.close()\n }\n this.remove()\n }\n\n disconnectedCallback () {\n super.disconnectedCallback()\n this.result?.(false)\n this.result = null\n if (this.returnFocus?.isConnected) {\n this.returnFocus.focus()\n } else {\n const main = this.ownerDocument.querySelector('main')\n if (main) {\n const previousTabIndex = main.getAttribute('tabindex')\n main.tabIndex = -1\n main.focus()\n if (previousTabIndex === null) main.removeAttribute('tabindex')\n else main.setAttribute('tabindex', previousTabIndex)\n }\n }\n this.returnFocus = null\n }\n\n protected async firstUpdated () {\n super.firstUpdated()\n const dialog = this.shadowRoot?.querySelector<WebComponent>('solid-ui-dialog')\n await dialog?.updateComplete\n const nativeDialog = dialog?.shadowRoot?.querySelector('dialog')\n if (!nativeDialog) throw new Error('Internal pane dialog did not render a native dialog')\n nativeDialog.setAttribute('aria-label', this.title)\n nativeDialog.setAttribute('aria-description', this.message)\n nativeDialog.addEventListener('cancel', event => {\n event.preventDefault()\n this.closeDialog(false)\n })\n nativeDialog.addEventListener('close', () => {\n if (this.isConnected) this.closeDialog(false)\n })\n const initialAction = this.shadowRoot?.querySelector<WebComponent>('[data-initial-action]')\n await initialAction?.updateComplete\n initialAction?.shadowRoot?.querySelector('button')?.focus()\n }\n\n private handleKeyDown (event: KeyboardEvent) {\n if (event.key !== 'Tab') return\n const buttons = Array.from(this.shadowRoot?.querySelectorAll('solid-ui-button') ?? [])\n .map(component => component.shadowRoot?.querySelector('button'))\n .filter((button): button is HTMLButtonElement => !!button && !button.disabled)\n const focusedIndex = buttons.findIndex(button => {\n const root = button.getRootNode()\n return root instanceof ShadowRoot && root.activeElement === button\n })\n if (event.shiftKey && focusedIndex === 0) {\n event.preventDefault()\n buttons[buttons.length - 1]?.focus()\n } else if (!event.shiftKey && focusedIndex === buttons.length - 1) {\n event.preventDefault()\n buttons[0]?.focus()\n }\n }\n\n protected render () {\n const [mainMessage, ...additionalMessages] = this.message.split('\\n')\n return html`\n <solid-ui-dialog @keydown=${this.handleKeyDown}>\n <solid-ui-dialog-header slot=\"header\">\n <h2>${this.title}</h2>\n <solid-ui-button variant=\"ghost\" @click=${() => this.closeDialog(false)}>\n <span class=\"sr-only\">Close dialog</span>\n <icon-lucide-x slot=\"icon\" aria-hidden=\"true\"></icon-lucide-x>\n </solid-ui-button>\n </solid-ui-dialog-header>\n <solid-ui-dialog-content>\n <p>\n ${mainMessage}\n ${additionalMessages.map(message => html`<span class=\"resource-action-dialog-emphasis\">${message}</span>`)}\n </p>\n </solid-ui-dialog-content>\n <solid-ui-dialog-footer slot=\"footer\">\n ${this.confirmation\n ? html`\n <solid-ui-button data-initial-action variant=\"secondary\" @click=${() => this.closeDialog(false)}>\n Cancel\n </solid-ui-button>\n <solid-ui-button @click=${() => this.closeDialog(true)}>\n Delete\n </solid-ui-button>\n `\n : html`\n <solid-ui-button data-initial-action @click=${() => this.closeDialog(false)}>\n OK\n </solid-ui-button>\n `}\n </solid-ui-dialog-footer>\n </solid-ui-dialog>\n `\n }\n}\n"],"mappings":"A,w/IASsDK,EAAA,EAAA,EAErDH,EAAAA,cAAAA,CAAc,oCAAoC,CAAC,EAAA,IAAAI,EAAA,IAAAC,GAAAC,EAAA,IAAAC,QAAAC,EAAA,IAAAD,QAAAE,EAAA,IAAAF,QAAAG,GAAAC,GAAAA,EAIjDZ,EAAAA,SAAAA,CAAS,CAAEa,KAAMC,MAAO,CAAC,EAACC,GAAAA,EAG1Bf,EAAAA,SAAAA,CAAS,CAAEa,KAAMC,MAAO,CAAC,EAACE,GAAAA,EAG1BhB,EAAAA,SAAAA,CAAS,CAAEa,KAAMI,OAAQ,CAAC,EAAC,SAAAC,EAV9B,cACkDhB,EAAAA,YAAa,CAAAkB,YAAA,GAAAC,EAAA,CAAA,MAAA,GAAAA,CAAA,EAAAC,EAAA,KAAAf,GAAAgB,EAAA,IAAA,EAAAC,EAAA,KAI5C,EAAE,EAAA,EAAAF,EAAA,KAAAb,EAAAgB,EAAA,KAGA,EAAE,CAAA,EAAAH,EAAA,KAAAZ,EAAAgB,EAAA,KAGG,EAAK,CAAA,EAAAC,EAAA,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AAe,EACrBI,EAAQ,EAAE,EAAEhB,MAAM,EAEtB,CAEUgC,QAAU,CAClB,GAAM,CAACC,EAAa,GAAGC,GAAsB,KAAKrD,QAAQsD,MAAM;CAAI,EACpE,MAAOvF,GAAAA,IAAI;kCACmB,KAAKkE,cAAa;;gBAEpC,KAAKpC,MAAK;wDACgC,KAAKc,YAAY,EAAK,EAAC;;;;;;;cAOnEyC,EAAW;cACXC,EAAmBd,IAAIvC,GAAWjC,EAAAA,IAAI,iDAAiDiC,EAAO,QAAS,EAAC;;;;YAI1G,KAAKC,aACHlC,EAAAA,IAAI;sFACsE,KAAK4C,YAAY,EAAK,EAAC;;;8CAG/D,KAAKA,YAAY,EAAI,EAAC;;;gBAIxD5C,EAAAA,IAAI;kEACkD,KAAK4C,YAAY,EAAK,EAAC;;;gBAG5E;;;KAIb,CACF,EAAC,CAAA4C,EAAA,CAAA/D,EAAAC,EAAAC,EAAAH,GAAAiE,EAAA,CAAAnF,EAAAoF,IAAAC,EAAAxE,EAAA,CAAA,CAAAN,EAAA,EAAA,OAAA,EAAA,CAAAG,EAAA,EAAA,SAAA,EAAA,CAAAC,EAAA,EAAA,cAAA,CAAA,EAAAZ,EAAA,EAAA,IAAA,GAlIiDF,EAAAA,YAAY,EAAAgB,GAAAyE,EAAA,cAAAC,CAAA,CAAAxE,aAAA,CAAA,MAAAf,CAAA,EAAAsB,EAAA,KAAA,SAC5CxB,EAAAA,OAAM,EAAAsF,EAAA,CAAA,CAAA,EAAA9D,EAAAgE,EAAArF,EAAA,IAAA,EAAA,EAAAqF,G"}
@@ -0,0 +1,16 @@
1
+ import { WebComponent } from 'solid-ui';
2
+ export default class ResourceActionDialog extends WebComponent {
3
+ static styles: any;
4
+ accessor title: string;
5
+ accessor message: string;
6
+ accessor confirmation: boolean;
7
+ private result;
8
+ private returnFocus;
9
+ open(): Promise<boolean>;
10
+ private closeDialog;
11
+ disconnectedCallback(): void;
12
+ protected firstUpdated(): Promise<void>;
13
+ private handleKeyDown;
14
+ protected render(): import('lit-html').TemplateResult<1>;
15
+ }
16
+ //# sourceMappingURL=ResourceActionDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceActionDialog.d.ts","sourceRoot":"","sources":["../../../src/components/resource-action-dialog/ResourceActionDialog.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,YAAY,EAAE,MAAM,UAAU,CAAA;AACtD,OAAO,4BAA4B,CAAA;AACnC,OAAO,4BAA4B,CAAA;AACnC,OAAO,oCAAoC,CAAA;AAC3C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,mCAAmC,CAAA;AAC1C,OAAO,iBAAiB,CAAA;AAIxB,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,YAAY;IAC5D,MAAM,CAAC,MAAM,MAAS;IAGtB,QAAQ,CAAC,KAAK,SAAK;IAGnB,QAAQ,CAAC,OAAO,SAAK;IAGrB,QAAQ,CAAC,YAAY,UAAQ;IAE7B,OAAO,CAAC,MAAM,CAA0C;IACxD,OAAO,CAAC,WAAW,CAA2B;IAEvC,IAAI,IAAK,OAAO,CAAC,OAAO,CAAC;IAWhC,OAAO,CAAC,WAAW;IAWnB,oBAAoB;cAmBJ,YAAY;IAoB5B,OAAO,CAAC,aAAa;IAkBrB,SAAS,CAAC,MAAM;CAoCjB"}
@@ -0,0 +1,309 @@
1
+ import "../../_virtual/~icons/lucide/x.esm.js";
2
+ import e from "./ResourceActionDialog.styles.esm.js";
3
+ import { WebComponent as t, customElement as n } from "solid-ui";
4
+ import "solid-ui/components/button";
5
+ import { html as r } from "lit";
6
+ import { property as i } from "lit/decorators.js";
7
+ import "solid-ui/components/dialog";
8
+ import "solid-ui/components/dialog-content";
9
+ import "solid-ui/components/dialog-footer";
10
+ import "solid-ui/components/dialog-header";
11
+ // src/components/resource-action-dialog/ResourceActionDialog.ts
12
+ var a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b;
13
+ function x(e, t, n) {
14
+ S(e, t), t.set(e, n);
15
+ }
16
+ function S(e, t) {
17
+ if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
18
+ }
19
+ function C(e, t, n) {
20
+ return e.set(T(e, t), n), n;
21
+ }
22
+ function w(e, t) {
23
+ return e.get(T(e, t));
24
+ }
25
+ function T(e, t, n) {
26
+ if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
27
+ throw TypeError("Private element is not present on this object");
28
+ }
29
+ function E(e, t, n) {
30
+ return (t = O(t)) in e ? Object.defineProperty(e, t, {
31
+ value: n,
32
+ enumerable: !0,
33
+ configurable: !0,
34
+ writable: !0
35
+ }) : e[t] = n, e;
36
+ }
37
+ function D(e, t, n, r, i, a) {
38
+ function o(e, t, n) {
39
+ return function(r, i) {
40
+ return n && n(r), e[t].call(r, i);
41
+ };
42
+ }
43
+ function s(e, t) {
44
+ for (var n = 0; n < e.length; n++) e[n].call(t);
45
+ return t;
46
+ }
47
+ function c(e, t, n, r) {
48
+ if (typeof e != "function" && (r || e !== void 0)) throw TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
49
+ return e;
50
+ }
51
+ function l(e, t, n, r, i, a, s, l, u, d, f, p, m) {
52
+ function h(e) {
53
+ if (!m(e)) throw TypeError("Attempted to access private element on non-instance");
54
+ }
55
+ var g, _ = t[0], v = t[3], y = !l;
56
+ if (!y) {
57
+ n || Array.isArray(_) || (_ = [_]);
58
+ var b = {}, x = [], S = i === 3 ? "get" : i === 4 || p ? "set" : "value";
59
+ d ? (f || p ? b = {
60
+ get: A(function() {
61
+ return v(this);
62
+ }, r, "get"),
63
+ set: function(e) {
64
+ t[4](this, e);
65
+ }
66
+ } : b[S] = v, f || A(b[S], r, i === 2 ? "" : S)) : f || (b = Object.getOwnPropertyDescriptor(e, r));
67
+ }
68
+ for (var C = e, w = _.length - 1; w >= 0; w -= n ? 2 : 1) {
69
+ var T = _[w], E = n ? _[w - 1] : void 0, D = {}, O = {
70
+ kind: [
71
+ "field",
72
+ "accessor",
73
+ "method",
74
+ "getter",
75
+ "setter",
76
+ "class"
77
+ ][i],
78
+ name: r,
79
+ metadata: a,
80
+ addInitializer: function(e, t) {
81
+ if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
82
+ c(t, "An initializer", "be", !0), s.push(t);
83
+ }.bind(null, D)
84
+ };
85
+ try {
86
+ if (y) (g = c(T.call(E, C, O), "class decorators", "return")) && (C = g);
87
+ else {
88
+ var k, j;
89
+ O.static = u, O.private = d, d ? i === 2 ? k = function(e) {
90
+ return h(e), b.value;
91
+ } : (i < 4 && (k = o(b, "get", h)), i !== 3 && (j = o(b, "set", h))) : (k = function(e) {
92
+ return e[r];
93
+ }, (i < 2 || i === 4) && (j = function(e, t) {
94
+ e[r] = t;
95
+ }));
96
+ var M = O.access = { has: d ? m.bind() : function(e) {
97
+ return r in e;
98
+ } };
99
+ if (k && (M.get = k), j && (M.set = j), C = T.call(E, p ? {
100
+ get: b.get,
101
+ set: b.set
102
+ } : b[S], O), p) {
103
+ if (typeof C == "object" && C) (g = c(C.get, "accessor.get")) && (b.get = g), (g = c(C.set, "accessor.set")) && (b.set = g), (g = c(C.init, "accessor.init")) && x.push(g);
104
+ else if (C !== void 0) throw TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
105
+ } else c(C, (f ? "field" : "method") + " decorators", "return") && (f ? x.push(C) : b[S] = C);
106
+ }
107
+ } finally {
108
+ D.v = !0;
109
+ }
110
+ }
111
+ return (f || p) && l.push(function(e, t) {
112
+ for (var n = x.length - 1; n >= 0; n--) t = x[n].call(e, t);
113
+ return t;
114
+ }), f || y || (d ? p ? l.push(o(b, "get"), o(b, "set")) : l.push(i === 2 ? b[S] : o.call.bind(b[S])) : Object.defineProperty(e, r, b)), C;
115
+ }
116
+ function u(e, t) {
117
+ return Object.defineProperty(e, Symbol.metadata || Symbol.for("Symbol.metadata"), {
118
+ configurable: !0,
119
+ enumerable: !0,
120
+ value: t
121
+ });
122
+ }
123
+ if (arguments.length >= 6) var d = a[Symbol.metadata || Symbol.for("Symbol.metadata")];
124
+ var f = Object.create(d ?? null), p = function(e, t, n, r) {
125
+ var i, a, o = [], c = function(t) {
126
+ return j(t) === e;
127
+ }, u = /* @__PURE__ */ new Map();
128
+ function d(e) {
129
+ e && o.push(s.bind(null, e));
130
+ }
131
+ for (var f = 0; f < t.length; f++) {
132
+ var p = t[f];
133
+ if (Array.isArray(p)) {
134
+ var m = p[1], h = p[2], g = p.length > 3, _ = 16 & m, v = !!(8 & m), y = (m &= 7) == 0, b = h + "/" + v;
135
+ if (!y && !g) {
136
+ var x = u.get(b);
137
+ if (!0 === x || x === 3 && m !== 4 || x === 4 && m !== 3) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + h);
138
+ u.set(b, !(m > 2) || m);
139
+ }
140
+ l(v ? e : e.prototype, p, _, g ? "#" + h : O(h), m, r, v ? a ||= [] : i ||= [], o, v, g, y, m === 1, v && g ? c : n);
141
+ }
142
+ }
143
+ return d(i), d(a), o;
144
+ }(e, t, i, f);
145
+ return n.length || u(e, f), {
146
+ e: p,
147
+ get c() {
148
+ var t = [];
149
+ return n.length && [u(l(e, [n], r, e.name, 5, f, t), f), s.bind(null, t, e)];
150
+ }
151
+ };
152
+ }
153
+ function O(e) {
154
+ var t = k(e, "string");
155
+ return typeof t == "symbol" ? t : t + "";
156
+ }
157
+ function k(e, t) {
158
+ if (typeof e != "object" || !e) return e;
159
+ var n;
160
+ if (typeof Symbol < "u" && (n = e[Symbol.toPrimitive]) !== void 0) {
161
+ var r = n.call(e, t || "default");
162
+ if (typeof r != "object") return r;
163
+ throw TypeError("@@toPrimitive must return a primitive value.");
164
+ }
165
+ return (t === "string" ? String : Number)(e);
166
+ }
167
+ function A(e, t, n) {
168
+ typeof t == "symbol" && (t = (t = t.description) ? "[" + t + "]" : "");
169
+ try {
170
+ Object.defineProperty(e, "name", {
171
+ configurable: !0,
172
+ value: n ? n + " " + t : t
173
+ });
174
+ } catch {}
175
+ return e;
176
+ }
177
+ function j(e) {
178
+ if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (e === null ? "null" : typeof e));
179
+ return e;
180
+ }
181
+ function M(e) {
182
+ return e;
183
+ }
184
+ f = [n("solid-panes-resource-action-dialog")];
185
+ var N;
186
+ new (y = (s = /*#__PURE__*/ new WeakMap(), c = /*#__PURE__*/ new WeakMap(), l = /*#__PURE__*/ new WeakMap(), b = (p = i({ type: String }), h = i({ type: String }), _ = i({ type: Boolean }), "title"), o = class extends t {
187
+ constructor(...e) {
188
+ super(...e), x(this, s, (u(this), m(this, ""))), x(this, c, g(this, "")), x(this, l, v(this, !1)), E(this, "result", null), E(this, "returnFocus", null);
189
+ }
190
+ get [b]() {
191
+ return w(s, this);
192
+ }
193
+ set title(e) {
194
+ C(s, this, e);
195
+ }
196
+ get message() {
197
+ return w(c, this);
198
+ }
199
+ set message(e) {
200
+ C(c, this, e);
201
+ }
202
+ get confirmation() {
203
+ return w(l, this);
204
+ }
205
+ set confirmation(e) {
206
+ C(l, this, e);
207
+ }
208
+ open() {
209
+ let e = this.ownerDocument.activeElement;
210
+ for (; e?.shadowRoot?.activeElement;) e = e.shadowRoot.activeElement;
211
+ return this.returnFocus = e instanceof HTMLElement ? e : null, new Promise((e) => {
212
+ this.result = e;
213
+ });
214
+ }
215
+ closeDialog(e) {
216
+ let t = (this.shadowRoot?.querySelector("solid-ui-dialog"))?.shadowRoot?.querySelector("dialog");
217
+ this.result?.(e), this.result = null, t?.open && t.close(), this.remove();
218
+ }
219
+ disconnectedCallback() {
220
+ if (super.disconnectedCallback(), this.result?.(!1), this.result = null, this.returnFocus?.isConnected) this.returnFocus.focus();
221
+ else {
222
+ let e = this.ownerDocument.querySelector("main");
223
+ if (e) {
224
+ let t = e.getAttribute("tabindex");
225
+ e.tabIndex = -1, e.focus(), t === null ? e.removeAttribute("tabindex") : e.setAttribute("tabindex", t);
226
+ }
227
+ }
228
+ this.returnFocus = null;
229
+ }
230
+ async firstUpdated() {
231
+ super.firstUpdated();
232
+ let e = this.shadowRoot?.querySelector("solid-ui-dialog");
233
+ await e?.updateComplete;
234
+ let t = e?.shadowRoot?.querySelector("dialog");
235
+ if (!t) throw Error("Internal pane dialog did not render a native dialog");
236
+ t.setAttribute("aria-label", this.title), t.setAttribute("aria-description", this.message), t.addEventListener("cancel", (e) => {
237
+ e.preventDefault(), this.closeDialog(!1);
238
+ }), t.addEventListener("close", () => {
239
+ this.isConnected && this.closeDialog(!1);
240
+ });
241
+ let n = this.shadowRoot?.querySelector("[data-initial-action]");
242
+ await n?.updateComplete, n?.shadowRoot?.querySelector("button")?.focus();
243
+ }
244
+ handleKeyDown(e) {
245
+ if (e.key !== "Tab") return;
246
+ let t = Array.from(this.shadowRoot?.querySelectorAll("solid-ui-button") ?? []).map((e) => e.shadowRoot?.querySelector("button")).filter((e) => !!e && !e.disabled), n = t.findIndex((e) => {
247
+ let t = e.getRootNode();
248
+ return t instanceof ShadowRoot && t.activeElement === e;
249
+ });
250
+ e.shiftKey && n === 0 ? (e.preventDefault(), t[t.length - 1]?.focus()) : !e.shiftKey && n === t.length - 1 && (e.preventDefault(), t[0]?.focus());
251
+ }
252
+ render() {
253
+ let [e, ...t] = this.message.split("\n");
254
+ return r`
255
+ <solid-ui-dialog @keydown=${this.handleKeyDown}>
256
+ <solid-ui-dialog-header slot="header">
257
+ <h2>${this.title}</h2>
258
+ <solid-ui-button variant="ghost" @click=${() => this.closeDialog(!1)}>
259
+ <span class="sr-only">Close dialog</span>
260
+ <icon-lucide-x slot="icon" aria-hidden="true"></icon-lucide-x>
261
+ </solid-ui-button>
262
+ </solid-ui-dialog-header>
263
+ <solid-ui-dialog-content>
264
+ <p>
265
+ ${e}
266
+ ${t.map((e) => r`<span class="resource-action-dialog-emphasis">${e}</span>`)}
267
+ </p>
268
+ </solid-ui-dialog-content>
269
+ <solid-ui-dialog-footer slot="footer">
270
+ ${this.confirmation ? r`
271
+ <solid-ui-button data-initial-action variant="secondary" @click=${() => this.closeDialog(!1)}>
272
+ Cancel
273
+ </solid-ui-button>
274
+ <solid-ui-button @click=${() => this.closeDialog(!0)}>
275
+ Delete
276
+ </solid-ui-button>
277
+ ` : r`
278
+ <solid-ui-button data-initial-action @click=${() => this.closeDialog(!1)}>
279
+ OK
280
+ </solid-ui-button>
281
+ `}
282
+ </solid-ui-dialog-footer>
283
+ </solid-ui-dialog>
284
+ `;
285
+ }
286
+ }, {e: [m, g, v, u], c: [N, d]} = D(o, [
287
+ [
288
+ p,
289
+ 1,
290
+ "title"
291
+ ],
292
+ [
293
+ h,
294
+ 1,
295
+ "message"
296
+ ],
297
+ [
298
+ _,
299
+ 1,
300
+ "confirmation"
301
+ ]
302
+ ], f, 0, void 0, t), o), a = class extends M {
303
+ constructor() {
304
+ super(N), E(this, "styles", e), d();
305
+ }
306
+ }, E(a, y, void 0), a)();
307
+ export { N as default };
308
+
309
+ //# sourceMappingURL=ResourceActionDialog.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceActionDialog.esm.js","names":["html","property","customElement","WebComponent","styles","_classDecs","_ResourceActionDialog","_ResourceActionDialog2","_A","WeakMap","_B","_C","_ref","_titleDecs","type","String","_messageDecs","_confirmationDecs","Boolean","_ResourceActionDialog3","ResourceActionDialog","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_title","_init_message","_init_confirmation","_defineProperty","_classPrivateFieldGet","title","v","_classPrivateFieldSet","message","confirmation","open","activeElement","ownerDocument","shadowRoot","returnFocus","HTMLElement","Promise","resolve","result","closeDialog","dialog","querySelector","nativeDialog","close","remove","disconnectedCallback","isConnected","focus","main","previousTabIndex","getAttribute","tabIndex","removeAttribute","setAttribute","firstUpdated","updateComplete","Error","addEventListener","event","preventDefault","initialAction","handleKeyDown","key","buttons","Array","from","querySelectorAll","map","component","filter","button","disabled","focusedIndex","findIndex","root","getRootNode","ShadowRoot","shiftKey","length","render","mainMessage","additionalMessages","split","e","c","_initClass","_applyDecs","_Class","_identity","ResourceActionDialog_styles_default","_Class","_ResourceActionDialog3","_A","_B","_C","_initProto","_initClass","_classDecs","_titleDecs","_init_title","_messageDecs","_init_message","_confirmationDecs","_init_confirmation","_ResourceActionDialog2","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_defineProperty","_toPropertyKey","t","_applyDecs","i","n","o","c","applyDec","m","h","y","v","g","b","u","w","S","A","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","e","_identity","customElement","_ResourceActionDialog","property","WebComponent","args","activeElement","resolve","nativeDialog","result","main","previousTabIndex","dialog","event","initialAction","buttons","component","button","focusedIndex","root","mainMessage","additionalMessages","message"],"sources":["../../../src/components/resource-action-dialog/ResourceActionDialog.ts"],"sourcesContent":["import { html } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { customElement, WebComponent } from 'solid-ui'\nimport 'solid-ui/components/button'\nimport 'solid-ui/components/dialog'\nimport 'solid-ui/components/dialog-content'\nimport 'solid-ui/components/dialog-footer'\nimport 'solid-ui/components/dialog-header'\nimport '~icons/lucide/x'\nimport styles from './ResourceActionDialog.styles.css'\n\n@customElement('solid-panes-resource-action-dialog')\nexport default class ResourceActionDialog extends WebComponent {\n static styles = styles\n\n @property({ type: String })\n accessor title = ''\n\n @property({ type: String })\n accessor message = ''\n\n @property({ type: Boolean })\n accessor confirmation = false\n\n private result: ((value: boolean) => void) | null = null\n private returnFocus: HTMLElement | null = null\n\n public open (): Promise<boolean> {\n let activeElement = this.ownerDocument.activeElement\n while (activeElement?.shadowRoot?.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement\n }\n this.returnFocus = activeElement instanceof HTMLElement ? activeElement : null\n return new Promise(resolve => {\n this.result = resolve\n })\n }\n\n private closeDialog (result: boolean) {\n const dialog = this.shadowRoot?.querySelector('solid-ui-dialog')\n const nativeDialog = dialog?.shadowRoot?.querySelector('dialog')\n this.result?.(result)\n this.result = null\n if (nativeDialog?.open) {\n nativeDialog.close()\n }\n this.remove()\n }\n\n disconnectedCallback () {\n super.disconnectedCallback()\n this.result?.(false)\n this.result = null\n if (this.returnFocus?.isConnected) {\n this.returnFocus.focus()\n } else {\n const main = this.ownerDocument.querySelector('main')\n if (main) {\n const previousTabIndex = main.getAttribute('tabindex')\n main.tabIndex = -1\n main.focus()\n if (previousTabIndex === null) main.removeAttribute('tabindex')\n else main.setAttribute('tabindex', previousTabIndex)\n }\n }\n this.returnFocus = null\n }\n\n protected async firstUpdated () {\n super.firstUpdated()\n const dialog = this.shadowRoot?.querySelector<WebComponent>('solid-ui-dialog')\n await dialog?.updateComplete\n const nativeDialog = dialog?.shadowRoot?.querySelector('dialog')\n if (!nativeDialog) throw new Error('Internal pane dialog did not render a native dialog')\n nativeDialog.setAttribute('aria-label', this.title)\n nativeDialog.setAttribute('aria-description', this.message)\n nativeDialog.addEventListener('cancel', event => {\n event.preventDefault()\n this.closeDialog(false)\n })\n nativeDialog.addEventListener('close', () => {\n if (this.isConnected) this.closeDialog(false)\n })\n const initialAction = this.shadowRoot?.querySelector<WebComponent>('[data-initial-action]')\n await initialAction?.updateComplete\n initialAction?.shadowRoot?.querySelector('button')?.focus()\n }\n\n private handleKeyDown (event: KeyboardEvent) {\n if (event.key !== 'Tab') return\n const buttons = Array.from(this.shadowRoot?.querySelectorAll('solid-ui-button') ?? [])\n .map(component => component.shadowRoot?.querySelector('button'))\n .filter((button): button is HTMLButtonElement => !!button && !button.disabled)\n const focusedIndex = buttons.findIndex(button => {\n const root = button.getRootNode()\n return root instanceof ShadowRoot && root.activeElement === button\n })\n if (event.shiftKey && focusedIndex === 0) {\n event.preventDefault()\n buttons[buttons.length - 1]?.focus()\n } else if (!event.shiftKey && focusedIndex === buttons.length - 1) {\n event.preventDefault()\n buttons[0]?.focus()\n }\n }\n\n protected render () {\n const [mainMessage, ...additionalMessages] = this.message.split('\\n')\n return html`\n <solid-ui-dialog @keydown=${this.handleKeyDown}>\n <solid-ui-dialog-header slot=\"header\">\n <h2>${this.title}</h2>\n <solid-ui-button variant=\"ghost\" @click=${() => this.closeDialog(false)}>\n <span class=\"sr-only\">Close dialog</span>\n <icon-lucide-x slot=\"icon\" aria-hidden=\"true\"></icon-lucide-x>\n </solid-ui-button>\n </solid-ui-dialog-header>\n <solid-ui-dialog-content>\n <p>\n ${mainMessage}\n ${additionalMessages.map(message => html`<span class=\"resource-action-dialog-emphasis\">${message}</span>`)}\n </p>\n </solid-ui-dialog-content>\n <solid-ui-dialog-footer slot=\"footer\">\n ${this.confirmation\n ? html`\n <solid-ui-button data-initial-action variant=\"secondary\" @click=${() => this.closeDialog(false)}>\n Cancel\n </solid-ui-button>\n <solid-ui-button @click=${() => this.closeDialog(true)}>\n Delete\n </solid-ui-button>\n `\n : html`\n <solid-ui-button data-initial-action @click=${() => this.closeDialog(false)}>\n OK\n </solid-ui-button>\n `}\n </solid-ui-dialog-footer>\n </solid-ui-dialog>\n `\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASsDK,IAAA,CAErDH,EAAc,oCAAoC,CAAC;AAAA,IAAAI;AAAA,KAAAC,KAAAC,kBAAA,IAAAC,QAAA,GAAAC,kBAAA,IAAAD,QAAA,GAAAE,kBAAA,IAAAF,QAAA,GAAAG,KAAAC,IAIjDZ,EAAS,EAAEa,MAAMC,OAAO,CAAC,GAACC,IAG1Bf,EAAS,EAAEa,MAAMC,OAAO,CAAC,GAACE,IAG1BhB,EAAS,EAAEa,MAAMI,QAAQ,CAAC,GAAC,UAAAC,IAV9B,cACkDhB,EAAa;CAAAkB,YAAA,GAAAC,GAAA;EAYLM,AAZK,MAAA,GAA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{flex-wrap:wrap;justify-content:flex-end}solid-ui-dialog-header h2{font:inherit;margin:0}solid-ui-dialog-content p{overflow-wrap:anywhere;white-space:pre-line}.resource-action-dialog-emphasis{text-align:center;font-weight:600;display:block}solid-ui-button{min-width:24px;min-height:24px}solid-ui-button:focus-within{outline-offset:1px;border-radius:4px;outline:1px solid}`;exports.default=e;
2
+ //# sourceMappingURL=ResourceActionDialog.styles.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceActionDialog.styles.cjs.js","names":["ResourceActionDialog_styles_default"],"sources":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import { css as e } from "lit";
2
+ // src/components/resource-action-dialog/ResourceActionDialog.styles.css
3
+ var t = e`solid-ui-dialog-footer{flex-wrap:wrap;justify-content:flex-end}solid-ui-dialog-header h2{font:inherit;margin:0}solid-ui-dialog-content p{overflow-wrap:anywhere;white-space:pre-line}.resource-action-dialog-emphasis{text-align:center;font-weight:600;display:block}solid-ui-button{min-width:24px;min-height:24px}solid-ui-button:focus-within{outline-offset:1px;border-radius:4px;outline:1px solid}`;
4
+ export { t as default };
5
+
6
+ //# sourceMappingURL=ResourceActionDialog.styles.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceActionDialog.styles.esm.js","names":["ResourceActionDialog_styles_default"],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"dataContentPane.d.ts","sourceRoot":"","sources":["../src/dataContentPane.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EACV,SAAS,EAET,SAAS,EACT,SAAS,EACV,MAAM,QAAQ,CAAA;AACf,OAAO,uBAAuB,CAAA;AAI9B,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,CAAA;AAiBxC,eAAO,MAAM,eAAe;;;;qBAOA,SAAS,WAAW,kBAAkB;8BAsBzD,SAAS,EAAE,WACP,kBAAkB,iBACZ,WAAW,EAAE,KAC3B,gBAAgB;sBA+LR,SAAS,WACT,kBAAkB,KAC1B,cAAc;CAoClB,CAAA"}
1
+ {"version":3,"file":"dataContentPane.d.ts","sourceRoot":"","sources":["../src/dataContentPane.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,kBAAkB,EAAqB,MAAM,eAAe,CAAA;AAC1E,OAAO,KAAK,EACV,SAAS,EAET,SAAS,EACT,SAAS,EACV,MAAM,QAAQ,CAAA;AACf,OAAO,uBAAuB,CAAA;AAE9B,KAAK,WAAW,GAAG,SAAS,GAAG,SAAS,CAAA;AAiCxC,eAAO,MAAM,eAAe;;;;qBAOA,SAAS,WAAW,kBAAkB;8BAiBzD,SAAS,EAAE,WACP,kBAAkB,iBACZ,WAAW,EAAE,KAC3B,gBAAgB;sBA+MR,SAAS,WACT,kBAAkB,KAC1B,cAAc;CAoClB,CAAA"}
@@ -1,2 +1,2 @@
1
- (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.data-content-pane__literal{white-space:pre-wrap}div.data-content-pane{border:1px solid var(--solid-ui-color-gray-200,#cbd5e1);padding:var(--spacing-base,.5rem) 40px;margin-bottom:var(--spacing-base,.5rem);box-sizing:border-box}div.data-content-pane table.data-content-pane__table{border-collapse:separate;border-spacing:0;width:100%}div.data-content-pane table.data-content-pane__table--root{table-layout:auto}div.data-content-pane .data-content-pane__row--root{align-items:flex-start;display:flex}div.data-content-pane .data-content-pane__row--root>td{vertical-align:top}div.data-content-pane .data-content-pane__subject-cell{flex:none;width:clamp(7rem,12%,10rem);padding-right:.8rem}div.data-content-pane .data-content-pane__details-cell{flex:0 auto;min-width:0}div.data-content-pane .data-content-pane__subject-cell,div.data-content-pane td.data-content-pane__predicate-cell,div.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell),div.data-content-pane .data-content-pane__subject-cell a,div.data-content-pane td.data-content-pane__predicate-cell a,div.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell) a{white-space:normal;overflow-wrap:anywhere;word-break:break-word}div.data-content-pane table.data-content-pane__table--property{table-layout:auto;width:auto;max-width:100%}.data-content-pane__nested-formula{border-top:solid 1px var(--color-data-pane-border-top,black);border-left:solid 1px var(--color-data-pane-border-top,black);border-bottom:solid 1px var(--color-data-pane-border-side,#777);border-right:solid 1px var(--color-data-pane-border-side,#777);padding:var(--spacing-base,.5rem);border-radius:var(--border-radius-md,.5rem)}div.data-content-pane td{padding-left:var(--spacing-xxxs,.2rem);padding-top:var(--spacing-small,.1rem);padding-right:var(--spacing-xxxs,.2rem);vertical-align:top;padding-bottom:.05rem}div.data-content-pane table.data-content-pane__table--property td{padding-top:.3rem;padding-bottom:.3rem}div.data-content-pane tr{margin-bottom:var(--spacing-2xs,.625rem);padding-top:var(--spacing-small,.1rem);padding-bottom:var(--spacing-small,.1rem)}.data-content-pane a,.data-content-pane a:link{color:var(--color-text-link,#3b5998);font-weight:700;text-decoration:none}.data-content-pane a:visited{color:var(--color-text-link-visited,#3b5998);font-weight:700;text-decoration:none}.data-content-pane a:hover{color:var(--color-text-link-hover,#3b5998);font-weight:700;text-decoration:underline}.data-content-pane a:active{color:var(--color-text-link-active,#888);text-decoration:none}.data-content-pane.embeddedText{white-space:pre-wrap}div.data-content-pane td.data-content-pane__predicate-cell{width:clamp(8.5rem,18vw,12rem);min-width:8.5rem;max-width:12rem;padding-right:var(--spacing-base,.5rem)}div.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell){padding-left:var(--spacing-xxs,.3125rem)}div.data-content-pane td.data-content-pane__predicate-cell a{color:var(--color-text-muted,#444)}.data-content-pane__row--even{background-color:var(--color-background-row-alternate,#f0f0f0)}.data-content-pane__row--odd{background-color:var(--color-background-row-default,white)}.data-content-pane__row--top-aligned{vertical-align:top;margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0}.data-content-pane__nested-table--light{background-color:var(--color-background-row-default,white)}.data-content-pane__nested-table--dark{background-color:var(--color-background-row-alternate,#f0f0f0)}div.data-content-pane[data-layout=mobile] .data-content-pane__row--root{padding-bottom:var(--spacing-xs,.75rem);align-items:flex-start;display:flex}div.data-content-pane[data-layout=mobile]{padding-left:0;padding-right:0}div.data-content-pane[data-layout=mobile] .data-content-pane__subject-cell{box-sizing:border-box;width:40%;max-width:40%;padding-right:var(--spacing-xs,.75rem);flex:0 0 40%;padding-bottom:0}div.data-content-pane[data-layout=mobile] .data-content-pane__details-cell{box-sizing:border-box;flex:0 0 60%;width:60%;min-width:0;max-width:60%}div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property>tbody>tr,div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property>tr{margin-bottom:0}div.data-content-pane[data-layout=mobile] .data-content-pane__row--top-aligned+.data-content-pane__row--top-aligned{margin-top:0}div.data-content-pane[data-layout=mobile] .data-content-pane__row--top-aligned{margin-bottom:0;padding-top:0;padding-bottom:0;display:block}div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property,div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property>tbody{width:100%;display:block}div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property td{box-sizing:border-box;width:100%;display:block}div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property td.data-content-pane__predicate-cell{width:100%;min-width:0;padding-bottom:.1rem}div.data-content-pane[data-layout=mobile] table.data-content-pane__table--property td:not(.data-content-pane__predicate-cell){padding-top:0;padding-left:.85rem}@media (width<=700px){div.data-content-pane{padding-left:0;padding-right:0}div.data-content-pane .data-content-pane__row--root{align-items:flex-start;display:flex}div.data-content-pane .data-content-pane__subject-cell{width:40%;max-width:40%;padding-right:var(--spacing-xs,.75rem);box-sizing:border-box;flex:0 0 40%;padding-bottom:0}div.data-content-pane .data-content-pane__details-cell{box-sizing:border-box;flex:0 0 60%;width:60%;max-width:60%}div.data-content-pane .data-content-pane__row--top-aligned{margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;display:block}div.data-content-pane .data-content-pane__row--top-aligned>td{box-sizing:border-box;width:100%;display:block}div.data-content-pane .data-content-pane__row--top-aligned>td.data-content-pane__predicate-cell{width:100%;min-width:0;max-width:none;padding-bottom:var(--spacing-small,.1rem)}div.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell){padding-top:0;padding-left:.85rem}}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("./_virtual/_rolldown/runtime.cjs.js");;let t=require("solid-ui");t=e.__toESM(t);let n=require("rdflib");n=e.__toESM(n);let r=require("dompurify");r=e.__toESM(r);var i=t.ns,a={icon:t.icons.originalIconBase+`rdf_flyer.24.gif`,name:`dataContents`,audience:[i.solid(`Developer`)],label:function(e,t){if(`http://www.w3.org/2007/ont/link#ProtocolEvent`in t.session.store.findTypeURIs(e))return null;let n=t.session.store.statementsMatching(void 0,void 0,void 0,e).length;return n===0?null:`Data (`+n+`)`},statementsAsTables:function(e,i,a){let o=i.dom,s=o.createElement(`table`);s.classList.add(`data-content-pane__table`,`data-content-pane__table--root`);let c=i.environment?.layout===`mobile`,l=n.Serializer(i.session.store),u=l.rootSubjects(e),d=u.roots,f=u.subjects,p=u.loopBreakers??{};for(let e in p)console.log(` dataContentPane: loopbreaker:`+e);let m={},h={};function g(e,n=0){let r=o.createElement(`table`);r.classList.add(`data-content-pane__table`,`data-content-pane__table--property`);let i=null,a=f[l.toStr(e)];if(!a)return r.appendChild(o.createTextNode(`...`)),r;a.sort();let s=0,u;for(let e=0;e<a.length;e++){let l=a[e],d=o.createElement(`tr`);if(d.classList.add(`data-content-pane__row--top-aligned`,`data-content-pane__row--property`),l.predicate.uri!==i||c){!c&&i&&s>1&&u?.setAttribute(`rowspan`,``+s),u=o.createElement(`td`),u.setAttribute(`class`,`data-content-pane__predicate-cell`);let e=o.createElement(`a`);e.setAttribute(`href`,l.predicate.uri),e.addEventListener(`click`,t.widgets.openHrefInOutlineMode,!0),e.appendChild(o.createTextNode(t.utils.predicateLabelForXML(l.predicate))),u.appendChild(e),d.appendChild(u),i=l.predicate.uri,s=0}s++;let f=o.createElement(`td`);f.classList.add(`data-content-pane__value-cell`),f.appendChild(_(l.object,n+1)),d.appendChild(f),r.appendChild(d)}return!c&&i&&s>1&&u?.setAttribute(`rowspan`,``+s),r}function _(e,n=0){let a,s;switch(e.termType){case`NamedNode`:return s=o.createElement(`a`),s.setAttribute(`href`,e.uri),s.addEventListener(`click`,t.widgets.openHrefInOutlineMode,!0),s.appendChild(o.createTextNode(t.utils.label(e))),s;case`Literal`:return!e.datatype||!e.datatype.uri?(a=o.createElement(`div`),a.classList.add(`data-content-pane__literal`),a.textContent=e.value,a):e.datatype.uri===`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`?(a=o.createElement(`div`),a.classList.add(`embeddedXHTML`),a.innerHTML=r.default.sanitize(e.value),a):o.createTextNode(e.value);case`BlankNode`:{if(e.toNT()in m){h[e.toNT()]=!0;let t=o.createElement(`a`);return t.setAttribute(`href`,`#`+e.toNT().slice(2)),t.setAttribute(`class`,`bnodeRef`),t.textContent=`*`+e.toNT().slice(3),t}m[e.toNT()]=!0;let t=g(e,n);return m[e.toNT()]=t,n%2==1?t.classList.add(`data-content-pane__nested-table--light`):t.classList.add(`data-content-pane__nested-table--dark`),t}case`Collection`:a=o.createElement(`table`),a.setAttribute(`class`,`collectionAsTables`);for(let t=0;t<e.elements.length;t++){let r=o.createElement(`tr`);a.appendChild(r),r.appendChild(_(e.elements[t],n+1))}return a;case`Graph`:return a=i.session.paneRegistry.byName(`dataContents`).statementsAsTables(e.statements,i),a.setAttribute(`class`,`data-content-pane__nested-formula`),a;case`Variable`:return o.createTextNode(`?`+e.uri)}throw Error(`Unhandled node type: `+e.termType)}a&&(d=a.concat(d.filter(function(e){for(let t=0;t<a.length;t++)if(e.sameTerm(a[t]))return!1;return!0})));for(let e=0;e<d.length;e++){let n=o.createElement(`tr`);n.classList.add(e%2==0?`data-content-pane__row--even`:`data-content-pane__row--odd`,`data-content-pane__row--root`),s.appendChild(n);let r=o.createElement(`td`);r.classList.add(`data-content-pane__subject-cell`),n.appendChild(r);let i=o.createElement(`td`);i.classList.add(`data-content-pane__details-cell`),n.appendChild(i);let a=d[e];a.termType===`BlankNode`?r.appendChild(o.createTextNode(t.utils.label(a))):r.appendChild(_(a,0)),i.appendChild(g(a,0))}for(let e in h){let t=m[e];if(t===!0)continue;let n=o.createElement(`a`);n.setAttribute(`id`,e.slice(2)),n.setAttribute(`class`,`bnodeDef`),n.textContent=e.slice(3)+`)`,t.insertBefore(n,t.firstChild)}return s},render:function(e,n){let r=n.dom;function i(e){let t=n.environment??{};e.dataset.layout=t.layout??`desktop`,e.dataset.theme=t.theme??`light`,e.dataset.inputMode=t.inputMode??`pointer`}function a(){let r=n.session.store,i=r.statementsMatching(void 0,void 0,void 0,e),a=[];r.holds(e,void 0,void 0,e)&&a.push(e);let s=r.any(e,t.ns.foaf(`primaryTopic`),void 0,e);s&&(s.termType===`NamedNode`||s.termType===`BlankNode`)&&a.push(s),o.appendChild(n.session.paneRegistry.byName(`dataContents`).statementsAsTables(i,n,a))}let o=r.createElement(`div`);return o.classList.add(`dataContentPane`,`data-content-pane`),i(o),a(),o}};exports.dataContentPane=a;
1
+ (function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`.data-content-pane__literal{white-space:pre-wrap}.data-content-pane{--color-background-row-alternate:var(--solid-ui-color-gray-150,#f0f0f0);--color-background-row-default:var(--solid-ui-color-white,#fff);border:1px solid var(--solid-ui-color-gray-200,#cbd5e1);box-sizing:border-box;margin-bottom:8px;padding:8px 40px}.data-content-pane .data-content-pane__table{border-collapse:separate;border-spacing:0;width:100%}.data-content-pane .data-content-pane__table--root{table-layout:auto}.data-content-pane .data-content-pane__row--root{align-items:flex-start;display:flex}.data-content-pane .data-content-pane__subject-cell{flex:none;width:clamp(160px,18%,240px);padding-right:12.8px}.data-content-pane .data-content-pane__details-cell{flex:0 auto;min-width:0}.data-content-pane .data-content-pane__subject-cell,.data-content-pane .data-content-pane__predicate-cell,.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell),.data-content-pane .data-content-pane__subject-cell a,.data-content-pane .data-content-pane__predicate-cell a,.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell) a{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.data-content-pane .data-content-pane__subject-cell,.data-content-pane .data-content-pane__subject-cell a{white-space:nowrap;overflow-wrap:normal;word-break:normal}.data-content-pane .data-content-pane__table--property{table-layout:auto;width:auto;max-width:100%}.data-content-pane .data-content-pane__details-cell:has(.data-content-pane__nested-formula){flex:1 1 0}.data-content-pane .data-content-pane__table--property:has(.data-content-pane__nested-formula){table-layout:fixed;width:100%}.data-content-pane__nested-formula{box-sizing:border-box;border:1px solid var(--solid-ui-color-gray-200,#cbd5e1);border-radius:8px;width:100%;max-width:100%;padding:8px;display:block;container-type:inline-size}.data-content-pane td,.data-content-pane th{vertical-align:top;padding:1.6px 3.2px .8px}.data-content-pane .data-content-pane__table--property td,.data-content-pane .data-content-pane__table--property th{padding-top:4.8px;padding-bottom:4.8px}.data-content-pane tr{margin-bottom:10px;padding-top:1.6px;padding-bottom:1.6px}.data-content-pane a,.data-content-pane a:link{color:var(--solid-ui-color-tertiary,#083575);font-weight:600;text-decoration:none}.data-content-pane a:visited{color:#3b5998}.data-content-pane a:hover{color:var(--solid-ui-color-tertiary,#083575);text-decoration:underline}.data-content-pane a:active{color:var(--solid-ui-color-gray-500,#6a7282);text-decoration:none}.data-content-pane.embeddedText{white-space:pre-wrap}.data-content-pane .data-content-pane__predicate-cell{box-sizing:border-box;background-color:inherit;width:clamp(136px,18vw,192px);min-width:136px;max-width:192px;padding-right:8px}.data-content-pane .data-content-pane__subject-cell{background-color:inherit}.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell){padding-left:5px}.data-content-pane .data-content-pane__predicate-cell a{color:var(--solid-ui-color-gray-600,#4a5565)}.data-content-pane__row--even,.data-content-pane__nested-table--dark{background-color:var(--color-background-row-alternate,#f0f0f0)}.data-content-pane__row--odd,.data-content-pane__nested-table--light,.data-content-pane .data-content-pane__table--property>tbody>tr:nth-child(odd),.data-content-pane .data-content-pane__table--property>tr:nth-child(odd){background-color:var(--color-background-row-default,white)}.data-content-pane .data-content-pane__table--property>tbody>tr:nth-child(2n),.data-content-pane .data-content-pane__table--property>tr:nth-child(2n){background-color:var(--color-background-row-alternate,#f0f0f0)}.data-content-pane__row--top-aligned{vertical-align:top;margin:0;padding:0}@container (width<=560px){.data-content-pane .data-content-pane__nested-formula .data-content-pane__row--root,.data-content-pane .data-content-pane__nested-formula .data-content-pane__table--property,.data-content-pane .data-content-pane__nested-formula .data-content-pane__table--property>tbody,.data-content-pane .data-content-pane__nested-formula .data-content-pane__row--property{box-sizing:border-box;width:100%;display:block}.data-content-pane .data-content-pane__nested-formula .data-content-pane__subject-cell,.data-content-pane .data-content-pane__nested-formula .data-content-pane__subject-cell a,.data-content-pane .data-content-pane__nested-formula .data-content-pane__details-cell,.data-content-pane .data-content-pane__nested-formula .data-content-pane__predicate-cell,.data-content-pane .data-content-pane__nested-formula .data-content-pane__value-cell{box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;width:100%;min-width:0;max-width:none;display:block}}.data-content-pane[data-layout=mobile] .data-content-pane__row--root{padding-bottom:12px;display:block}.data-content-pane[data-layout=mobile]{padding-left:0;padding-right:0}.data-content-pane[data-layout=mobile] .data-content-pane__subject-cell{box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;word-break:break-word;width:100%;max-width:100%;padding-bottom:0;padding-right:0;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__details-cell{box-sizing:border-box;width:100%;min-width:0;max-width:100%;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__table--property>tbody>tr,.data-content-pane[data-layout=mobile] .data-content-pane__table--property>tr{margin-bottom:0}.data-content-pane[data-layout=mobile] .data-content-pane__row--top-aligned{margin-bottom:0;padding-top:0;padding-bottom:0;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__table--property,.data-content-pane[data-layout=mobile] .data-content-pane__table--property>tbody{width:100%;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__table--property td{box-sizing:border-box;width:100%;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__table--property .data-content-pane__predicate-cell{width:100%;min-width:0;padding-bottom:1.6px;display:block}.data-content-pane[data-layout=mobile] .data-content-pane__table--property td:not(.data-content-pane__predicate-cell){padding-top:0;padding-left:13.6px}@media (width<=768px){.data-content-pane .data-content-pane__nested-formula .data-content-pane__table--property,.data-content-pane .data-content-pane__nested-formula .data-content-pane__table--property>tbody{width:100%;display:block}.data-content-pane{border:none;padding-left:0;padding-right:0;font-size:14px}.data-content-pane .data-content-pane__row--root{display:block}.data-content-pane .data-content-pane__subject-cell{box-sizing:border-box;width:100%;max-width:100%;padding-bottom:0;padding-right:0;display:block}.data-content-pane .data-content-pane__subject-cell a{white-space:normal;overflow-wrap:anywhere;word-break:break-word}.data-content-pane .data-content-pane__details-cell{box-sizing:border-box;width:100%;max-width:100%;display:block}.data-content-pane .data-content-pane__row--top-aligned{margin:0;padding:0;display:block}.data-content-pane .data-content-pane__row--top-aligned>td,.data-content-pane .data-content-pane__row--top-aligned>th{box-sizing:border-box;width:100%;display:block}.data-content-pane .data-content-pane__row--top-aligned>.data-content-pane__predicate-cell{width:100%;min-width:0;max-width:none;padding-bottom:1.6px}.data-content-pane .data-content-pane__row--top-aligned>td:not(.data-content-pane__predicate-cell){padding-top:0;padding-left:13.6px}}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();const e=require("./_virtual/_rolldown/runtime.cjs.js");;let t=require("solid-ui"),n=require("rdflib"),r=require("dompurify");r=e.__toESM(r);var i=0;function a(e){let n=e;if(n.metaKey||n.ctrlKey||n.shiftKey||n.altKey)return;let r=!!(typeof document<`u`?document:void 0)?.outlineManager,i=typeof window<`u`&&typeof window.panes?.getOutliner==`function`;(r||i)&&t.widgets.openHrefInOutlineMode(e)}var o={icon:t.icons.originalIconBase+`rdf_flyer.24.gif`,name:`dataContents`,audience:[t.ns.solid(`Developer`)],label:function(e,t){if(`http://www.w3.org/2007/ont/link#ProtocolEvent`in t.session.store.findTypeURIs(e))return null;let n=t.session.store.statementsMatching(void 0,void 0,void 0,e).length;return n===0?null:`Data (`+n+`)`},statementsAsTables:function(e,o,s){let c=o.dom,l=c.createElement(`table`);l.classList.add(`data-content-pane__table`,`data-content-pane__table--root`);let u=o.environment?.layout===`mobile`,d=(0,n.Serializer)(o.session.store),f=d.rootSubjects(e),p=f.roots,m=f.subjects,h=f.loopBreakers??{};for(let e in h)t.log.debug(` dataContentPane: loopbreaker:`+e);let g={},_={},v=++i,y=0;function b(e){return y++,`data-content-${v}-${e}-${y}`}function x(e,n=0){let r=c.createElement(`table`);r.classList.add(`data-content-pane__table`,`data-content-pane__table--property`),r.setAttribute(`aria-label`,`Properties`);let i=null,o=m[d.toStr(e)];if(!o)return r.appendChild(c.createTextNode(`...`)),r;o.sort();let s=0,l;for(let e=0;e<o.length;e++){let d=o[e],f=c.createElement(`tr`);if(f.classList.add(`data-content-pane__row--top-aligned`,`data-content-pane__row--property`),d.predicate.uri!==i||u){!u&&i&&s>1&&l?.setAttribute(`rowspan`,``+s),l=c.createElement(`th`),l.setAttribute(`class`,`data-content-pane__predicate-cell`),l.setAttribute(`scope`,`row`),l.id=b(`predicate`);let e=c.createElement(`a`);e.setAttribute(`href`,d.predicate.uri),e.addEventListener(`click`,a,!0),e.appendChild(c.createTextNode(t.utils.predicateLabelForXML(d.predicate))),l.appendChild(e),f.appendChild(l),i=d.predicate.uri,s=0}s++;let p=c.createElement(`td`);p.classList.add(`data-content-pane__value-cell`),p.setAttribute(`headers`,l?.id??``),p.appendChild(S(d.object,n+1)),f.appendChild(p),r.appendChild(f)}return!u&&i&&s>1&&l?.setAttribute(`rowspan`,``+s),r}function S(e,n=0){let i,s;switch(e.termType){case`NamedNode`:return s=c.createElement(`a`),s.setAttribute(`href`,e.uri),s.addEventListener(`click`,a,!0),s.appendChild(c.createTextNode(t.utils.label(e))),s;case`Literal`:return e.language||!e.datatype||!e.datatype.uri?(i=c.createElement(`div`),i.classList.add(`data-content-pane__literal`),i.textContent=e.value,e.language&&i.setAttribute(`lang`,e.language),i):e.datatype.uri===`http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral`?(i=c.createElement(`div`),i.classList.add(`embeddedXHTML`),i.setAttribute(`role`,`group`),i.setAttribute(`aria-label`,`Embedded HTML content`),i.innerHTML=r.default.sanitize(e.value),i):c.createTextNode(e.value);case`BlankNode`:{if(e.toNT()in g){_[e.toNT()]=!0;let t=c.createElement(`a`);return t.setAttribute(`href`,`#`+e.toNT().slice(2)),t.setAttribute(`class`,`bnodeRef`),t.setAttribute(`aria-label`,`Referenced blank node ${e.toNT().slice(3)}`),t.textContent=`*`+e.toNT().slice(3),t}g[e.toNT()]=!0;let t=x(e,n);return g[e.toNT()]=t,n%2==1?t.classList.add(`data-content-pane__nested-table--light`):t.classList.add(`data-content-pane__nested-table--dark`),t}case`Collection`:i=c.createElement(`ol`),i.setAttribute(`class`,`collectionAsTables`);for(let t=0;t<e.elements.length;t++){let r=c.createElement(`li`);r.appendChild(S(e.elements[t],n+1)),i.appendChild(r)}return i;case`Graph`:return i=o.session.paneRegistry.byName(`dataContents`).statementsAsTables(e.statements,o),i.classList.add(`data-content-pane__nested-formula`),i;case`Variable`:return c.createTextNode(`?`+e.uri)}throw Error(`Unhandled node type: `+e.termType)}s&&(p=s.concat(p.filter(function(e){for(let t=0;t<s.length;t++)if(e.sameTerm(s[t]))return!1;return!0})));for(let e=0;e<p.length;e++){let n=c.createElement(`tr`);n.classList.add(e%2==0?`data-content-pane__row--even`:`data-content-pane__row--odd`,`data-content-pane__row--root`),l.appendChild(n);let r=c.createElement(`th`);r.classList.add(`data-content-pane__subject-cell`),r.setAttribute(`scope`,`row`),r.id=b(`subject`),n.appendChild(r);let i=c.createElement(`td`);i.classList.add(`data-content-pane__details-cell`),i.setAttribute(`headers`,r.id),n.appendChild(i);let a=p[e];a.termType===`BlankNode`?r.appendChild(c.createTextNode(t.utils.label(a))):r.appendChild(S(a,0)),i.appendChild(x(a,0))}for(let e in _){let t=g[e];if(t===!0)continue;let n=c.createElement(`caption`),r=c.createElement(`a`);r.setAttribute(`id`,e.slice(2)),r.setAttribute(`tabindex`,`-1`),r.setAttribute(`class`,`bnodeDef`),r.setAttribute(`aria-label`,`Blank node ${e.slice(3)}`),r.textContent=e.slice(3)+`)`,n.appendChild(r),t.insertBefore(n,t.firstChild)}return l},render:function(e,n){let r=n.dom;function i(e){let t=n.environment??{};e.dataset.layout=t.layout??`desktop`,e.dataset.theme=t.theme??`light`,e.dataset.inputMode=t.inputMode??`pointer`}function a(){let r=n.session.store,i=r.statementsMatching(void 0,void 0,void 0,e),a=[];r.holds(e,void 0,void 0,e)&&a.push(e);let s=r.any(e,t.ns.foaf(`primaryTopic`),void 0,e);s&&(s.termType===`NamedNode`||s.termType===`BlankNode`)&&a.push(s);let c=n.session.paneRegistry.byName(`dataContents`).statementsAsTables(i,n,a);c.setAttribute(`aria-label`,`Data content for ${t.utils.label(e)}`),o.appendChild(c)}let o=r.createElement(`div`);return o.classList.add(`dataContentPane`,`data-content-pane`),i(o),a(),o}};exports.dataContentPane=o;
2
2
  //# sourceMappingURL=dataContentPane2.cjs.js.map