solid-ui 5.0.2-7 → 5.0.2-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acl/add-agent-buttons.cjs.js +1 -1
- package/dist/acl/add-agent-buttons.cjs.js.map +1 -1
- package/dist/acl/add-agent-buttons.d.ts.map +1 -1
- package/dist/acl/add-agent-buttons.esm.js +22 -20
- package/dist/acl/add-agent-buttons.esm.js.map +1 -1
- package/dist/chunks/{DialogProvider-CcyasSmM.js → DialogProvider-DwymaGN5.js} +3 -3
- package/dist/chunks/{DialogProvider-CcyasSmM.js.map → DialogProvider-DwymaGN5.js.map} +1 -1
- package/dist/chunks/{ResourceActionsMenu-Dm1hvIj5.js → ResourceActionsMenu-mLMf4fAa.js} +9 -9
- package/dist/chunks/{ResourceActionsMenu-Dm1hvIj5.js.map → ResourceActionsMenu-mLMf4fAa.js.map} +1 -1
- package/dist/chunks/{access-control-modal-XJm3Czd5.js → access-control-modal-BR7HhqpN.js} +29 -29
- package/dist/chunks/{access-control-modal-XJm3Czd5.js.map → access-control-modal-BR7HhqpN.js.map} +1 -1
- package/dist/chunks/{account-BqJdA0tO.js → account-Dtv8-QEH.js} +10 -10
- package/dist/chunks/{account-BqJdA0tO.js.map → account-Dtv8-QEH.js.map} +1 -1
- package/dist/chunks/{auth-CCrvazv_.js → auth-Cj-J-3Nf.js} +26 -26
- package/dist/chunks/auth-Cj-J-3Nf.js.map +1 -0
- package/dist/chunks/{avatar-DHC_B7vJ.js → avatar-D_bHMV5F.js} +3 -3
- package/dist/chunks/{avatar-DHC_B7vJ.js.map → avatar-D_bHMV5F.js.map} +1 -1
- package/dist/chunks/{button-DFgsOHBh.js → button-D7XurXfj.js} +2 -2
- package/dist/chunks/{button-DFgsOHBh.js.map → button-D7XurXfj.js.map} +1 -1
- package/dist/chunks/{chunk.UEBQI7VV-DVcxHNfV.js → chunk.UEBQI7VV-CrSDe9uN.js} +2 -2
- package/dist/chunks/{chunk.UEBQI7VV-DVcxHNfV.js.map → chunk.UEBQI7VV-CrSDe9uN.js.map} +1 -1
- package/dist/chunks/{combobox-CtFy7qwi.js → combobox-CHli5LVO.js} +3 -3
- package/dist/chunks/{combobox-CtFy7qwi.js.map → combobox-CHli5LVO.js.map} +1 -1
- package/dist/chunks/{combobox-option-B8b1khQy.js → combobox-option-lOJdg5cD.js} +2 -2
- package/dist/chunks/{combobox-option-B8b1khQy.js.map → combobox-option-lOJdg5cD.js.map} +1 -1
- package/dist/chunks/{components-CmnPlcEi.js → components-CVuqsI0R.js} +2 -2
- package/dist/chunks/{components-CmnPlcEi.js.map → components-CVuqsI0R.js.map} +1 -1
- package/dist/chunks/{context-Dr-MkMP6.js → context-0sxUfxf7.js} +2 -2
- package/dist/chunks/{context-Dr-MkMP6.js.map → context-0sxUfxf7.js.map} +1 -1
- package/dist/chunks/{dialog-BY_pM7CM.js → dialog-BTlq_YfO.js} +4 -4
- package/dist/chunks/{dialog-BY_pM7CM.js.map → dialog-BTlq_YfO.js.map} +1 -1
- package/dist/chunks/{dialog-content-DfTs9gaK.js → dialog-content-DHim135-.js} +2 -2
- package/dist/chunks/{dialog-content-DfTs9gaK.js.map → dialog-content-DHim135-.js.map} +1 -1
- package/dist/chunks/{dialog-footer-oZsrnodi.js → dialog-footer-B8uRmp3J.js} +2 -2
- package/dist/chunks/{dialog-footer-oZsrnodi.js.map → dialog-footer-B8uRmp3J.js.map} +1 -1
- package/dist/chunks/{dialog-header-_6It5zCM.js → dialog-header-CQ2jzzUd.js} +2 -2
- package/dist/chunks/{dialog-header-_6It5zCM.js.map → dialog-header-CQ2jzzUd.js.map} +1 -1
- package/dist/chunks/{dialogs-DP4-6e8A.js → dialogs-gEIIeLi6.js} +2 -2
- package/dist/chunks/{dialogs-DP4-6e8A.js.map → dialogs-gEIIeLi6.js.map} +1 -1
- package/dist/chunks/{dialogs-root-B-yfITRL.js → dialogs-root-DuRAjRjg.js} +3 -3
- package/dist/chunks/{dialogs-root-B-yfITRL.js.map → dialogs-root-DuRAjRjg.js.map} +1 -1
- package/dist/chunks/{error-state-CaxNmA0L.js → error-state-Y-Fe0JiX.js} +3 -3
- package/dist/chunks/{error-state-CaxNmA0L.js.map → error-state-Y-Fe0JiX.js.map} +1 -1
- package/dist/chunks/{file-explorer-header-Bu06_N7G.js → file-explorer-header-DGcG6Agk.js} +8 -8
- package/dist/chunks/{file-explorer-header-Bu06_N7G.js.map → file-explorer-header-DGcG6Agk.js.map} +1 -1
- package/dist/chunks/{file-explorer-provider-DqZDDpUX.js → file-explorer-provider-CIAJV8hq.js} +4 -4
- package/dist/chunks/{file-explorer-provider-DqZDDpUX.js.map → file-explorer-provider-CIAJV8hq.js.map} +1 -1
- package/dist/chunks/{guard-R26Y08Rq.js → guard-53kvhglh.js} +3 -3
- package/dist/chunks/{guard-R26Y08Rq.js.map → guard-53kvhglh.js.map} +1 -1
- package/dist/chunks/index.esm-BYrQu5rV.js +6 -0
- package/dist/chunks/index.esm-BYrQu5rV.js.map +1 -0
- package/dist/chunks/{input-BlwhSsYC.js → input-MtTyDieA.js} +2 -2
- package/dist/chunks/{input-BlwhSsYC.js.map → input-MtTyDieA.js.map} +1 -1
- package/dist/chunks/{jsonld-C6IOQ1Tg.js → jsonld-lAxnRr2L.js} +2 -2
- package/dist/chunks/{jsonld-C6IOQ1Tg.js.map → jsonld-lAxnRr2L.js.map} +1 -1
- package/dist/chunks/{login-button-BZH27kcX.js → login-button-Dx58UUyH.js} +4 -4
- package/dist/chunks/{login-button-BZH27kcX.js.map → login-button-Dx58UUyH.js.map} +1 -1
- package/dist/chunks/{logout-button-CrTKHw_t.js → logout-button-Vrn0nLVQ.js} +4 -4
- package/dist/chunks/{logout-button-CrTKHw_t.js.map → logout-button-Vrn0nLVQ.js.map} +1 -1
- package/dist/chunks/{menu-item-DmQ4ZQQ2.js → menu-item-EARrOY8C.js} +2 -2
- package/dist/chunks/{menu-item-DmQ4ZQQ2.js.map → menu-item-EARrOY8C.js.map} +1 -1
- package/dist/chunks/{menu-clQ0N3ba.js → menu-pe4NxtfD.js} +3 -3
- package/dist/chunks/{menu-clQ0N3ba.js.map → menu-pe4NxtfD.js.map} +1 -1
- package/dist/chunks/{photo-capture-KYEqSWFH.js → photo-capture-B8ponMpE.js} +4 -4
- package/dist/chunks/{photo-capture-KYEqSWFH.js.map → photo-capture-B8ponMpE.js.map} +1 -1
- package/dist/chunks/{photo-capture-modal-YmzRHhUg.js → photo-capture-modal-SOcYsArw.js} +6 -6
- package/dist/chunks/{photo-capture-modal-YmzRHhUg.js.map → photo-capture-modal-SOcYsArw.js.map} +1 -1
- package/dist/chunks/{provide-1sJJkgCO.js → provide-BQN7o60i.js} +2 -2
- package/dist/chunks/{provide-1sJJkgCO.js.map → provide-BQN7o60i.js.map} +1 -1
- package/dist/chunks/{provider-DC-qEkao.js → provider-CnOHE-B-.js} +5 -5
- package/dist/chunks/{provider-DC-qEkao.js.map → provider-CnOHE-B-.js.map} +1 -1
- package/dist/chunks/{rdf-form-BhevRpHy.js → rdf-form-CtskuSp2.js} +4 -4
- package/dist/chunks/{rdf-form-BhevRpHy.js.map → rdf-form-CtskuSp2.js.map} +1 -1
- package/dist/chunks/{rdf-input-2s3O54hm.js → rdf-input-DfTBeaCB.js} +8 -8
- package/dist/chunks/{rdf-input-2s3O54hm.js.map → rdf-input-DfTBeaCB.js.map} +1 -1
- package/dist/chunks/{select-DQtYJhLc.js → select-BKXrVwJC.js} +2 -2
- package/dist/chunks/{select-DQtYJhLc.js.map → select-BKXrVwJC.js.map} +1 -1
- package/dist/chunks/{select-option-BdE45Q3h.js → select-option-SlgG53he.js} +2 -2
- package/dist/chunks/{select-option-BdE45Q3h.js.map → select-option-SlgG53he.js.map} +1 -1
- package/dist/chunks/{signup-button-yONuztWR.js → signup-button-C-dLsqr8.js} +4 -4
- package/dist/chunks/{signup-button-yONuztWR.js.map → signup-button-C-dLsqr8.js.map} +1 -1
- package/dist/chunks/{solid-emblem-Dc1cwhXb.js → solid-emblem-BmFc2G2B.js} +2 -2
- package/dist/chunks/{solid-emblem-Dc1cwhXb.js.map → solid-emblem-BmFc2G2B.js.map} +1 -1
- package/dist/chunks/{solidLogicSingleton.esm-Bvt7E7Vl.js → solidLogicSingleton.esm-CKYdvLzf.js} +12317 -4363
- package/dist/chunks/solidLogicSingleton.esm-CKYdvLzf.js.map +1 -0
- package/dist/chunks/{src-BUfVUeNt.js → src-CiHeLI_K.js} +2302 -2301
- package/dist/chunks/src-CiHeLI_K.js.map +1 -0
- package/dist/chunks/{style-Dlw9-wPn.js → style-Du-nyh8u.js} +7 -7
- package/dist/chunks/{style-Dlw9-wPn.js.map → style-Du-nyh8u.js.map} +1 -1
- package/dist/chunks/widgets-CTH3oXJI.js +2762 -0
- package/dist/chunks/widgets-CTH3oXJI.js.map +1 -0
- package/dist/components/access-control-modal.js +1 -1
- package/dist/components/account.js +1 -1
- package/dist/components/avatar.js +1 -1
- package/dist/components/button.js +1 -1
- package/dist/components/combobox-option.js +1 -1
- package/dist/components/combobox.js +1 -1
- package/dist/components/dialog-content.js +1 -1
- package/dist/components/dialog-footer.js +1 -1
- package/dist/components/dialog-header.js +1 -1
- package/dist/components/dialog-provider.js +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/dialogs-root.js +1 -1
- package/dist/components/error-state.js +1 -1
- package/dist/components/file-explorer-header.js +1 -1
- package/dist/components/file-explorer-provider.js +1 -1
- package/dist/components/guard.js +1 -1
- package/dist/components/input.js +1 -1
- package/dist/components/login-button.js +1 -1
- package/dist/components/login-modal.js +1 -1
- package/dist/components/logout-button.js +1 -1
- package/dist/components/menu-item.js +1 -1
- package/dist/components/menu.js +1 -1
- package/dist/components/photo-capture-modal.js +1 -1
- package/dist/components/photo-capture.js +1 -1
- package/dist/components/provider.js +1 -1
- package/dist/components/rdf-form.js +1 -1
- package/dist/components/rdf-input.js +1 -1
- package/dist/components/resource-actions-menu.js +1 -1
- package/dist/components/select-option.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/signup-button.js +1 -1
- package/dist/components/solid-emblem.js +1 -1
- package/dist/components.js +30 -30
- package/dist/index.js +8 -8
- package/dist/lib/components/web-component/WebComponent.styles.cjs.js +1 -1
- package/dist/lib/components/web-component/WebComponent.styles.esm.js +1 -1
- package/dist/loader.js +8 -8
- package/dist/solid-ui.js +2 -2
- package/dist/solid-ui.min.js +2 -2
- package/dist/solid-ui.min.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunks/auth-CCrvazv_.js.map +0 -1
- package/dist/chunks/index.esm-BQrkxchZ.js +0 -6
- package/dist/chunks/index.esm-BQrkxchZ.js.map +0 -1
- package/dist/chunks/solidLogicSingleton.esm-Bvt7E7Vl.js.map +0 -1
- package/dist/chunks/src-BUfVUeNt.js.map +0 -1
- package/dist/chunks/widgets-C92ihtlF.js +0 -10628
- package/dist/chunks/widgets-C92ihtlF.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("../lib/debug.cjs.js"),t=require("../utils/label.cjs.js"),n=require("../lib/iconBase.cjs.js"),r=require("../login/login.cjs.js"),i=require("../lib/ns.cjs.js");require("../utils/index.cjs.js");const
|
|
1
|
+
const e=require("../lib/debug.cjs.js"),t=require("../utils/label.cjs.js"),n=require("../lib/iconBase.cjs.js"),r=require("../login/login.cjs.js"),i=require("../lib/ns.cjs.js"),a=require("../widgets/dragAndDrop.cjs.js");require("../utils/index.cjs.js");const o=require("../widgets/buttons.cjs.js");require("../widgets/index.cjs.js");const s=require("../lib/style.cjs.js");var c=class{groupList;rootElement;barElement;isExpanded=!1;constructor(e){this.groupList=e,this.rootElement=e.controller.dom.createElement(`div`),this.barElement=e.controller.dom.createElement(`div`)}render(){return this.rootElement.innerHTML=``,this.rootElement.appendChild(this.renderAddButton()),this.rootElement.appendChild(this.barElement),this.rootElement}renderAddButton(){return o.button(this.groupList.controller.dom,`${n.icons.iconBase}noun_34653_green.svg`,`Add ...`,()=>{this.toggleBar(),this.renderBar()})}renderBar(){this.barElement.innerHTML=``,this.isExpanded&&(this.barElement.appendChild(this.renderPersonButton()),this.barElement.appendChild(this.renderGroupButton()),this.barElement.appendChild(this.renderPublicButton()),this.barElement.appendChild(this.renderAuthenticatedAgentButton()),this.barElement.appendChild(this.renderBotButton()),this.barElement.appendChild(this.renderAppsButton()))}renderSimplifiedBar(e){Array.from(this.barElement.children).filter(t=>t!==e).forEach(e=>this.barElement.removeChild(e))}renderPersonButton(){return o.button(this.groupList.controller.dom,n.icons.iconBase+o.iconForClass[`vcard:Individual`],`Add Person`,e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(i.default.vcard(`Individual`),`person`).then(e=>this.addPerson(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderGroupButton(){return o.button(this.groupList.controller.dom,n.icons.iconBase+o.iconForClass[`vcard:Group`],`Add Group`,e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(i.default.vcard(`Group`),`group`).then(e=>this.addGroup(e)).then(()=>this.renderCleanup()).catch(e=>this.groupList.controller.renderStatus(e))})}renderNameForm(e,t){return o.askName(this.groupList.controller.dom,this.groupList.store,this.barElement,i.default.vcard(`URI`),e,t)}renderPublicButton(){let e=o.button(this.groupList.controller.dom,n.icons.iconBase+o.iconForClass[`foaf:Agent`],`Add Everyone`,()=>this.addAgent(i.default.foaf(`Agent`).uri).then(()=>this.groupList.controller.renderTemporaryStatus(`Adding the general public to those who can read. Drag the globe to a different level to give them more access.`)).then(()=>this.renderCleanup()));return e.querySelector(`img`)?.setAttribute(`draggable`,`false`),a.makeDraggable(e,i.default.foaf(`Agent`)),e}renderAuthenticatedAgentButton(){return o.button(this.groupList.controller.dom,`${n.icons.iconBase}noun_99101.svg`,`Anyone logged In`,()=>this.addAgent(i.default.acl(`AuthenticatedAgent`).uri).then(()=>this.groupList.controller.renderTemporaryStatus(`Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.`)).then(()=>this.renderCleanup()))}renderBotButton(){return o.button(this.groupList.controller.dom,n.icons.iconBase+`noun_Robot_849764.svg`,`A Software Agent (bot)`,e=>{this.renderSimplifiedBar(e.target),this.renderNameForm(i.default.schema(`Application`),`bot`).then(e=>this.addBot(e)).then(()=>this.renderCleanup())})}renderAppsButton(){return o.button(this.groupList.controller.dom,`${n.icons.iconBase}noun_15177.svg`,`A Web App (origin)`,e=>{this.renderSimplifiedBar(e.target);let t={div:this.barElement,dom:this.groupList.controller.dom},n=this.renderAppsTable(t).catch(e=>this.groupList.controller.renderStatus(e));this.renderAppsView();let r=this.renderNameForm(i.default.schema(`WebApplication`),`webapp domain`).then(e=>this.getOriginFromName(e));Promise.race([n,r]).then(e=>{e&&this.groupList.addNewURI(e)}).then(()=>this.renderCleanup())})}renderAppsView(){let e=this.groupList.controller.context.session.paneRegistry.byName(`trustedApplications`);if(e){let t=e.render(null,this.groupList.controller.context);t.setAttribute(`style`,s.style.trustedAppController);let n=o.cancelButton(this.groupList.controller.dom,()=>this.renderCleanup());n.setAttribute(`style`,s.style.trustedAppCancelButton),t.insertBefore(n,t.firstChild),this.barElement.appendChild(t)}}async renderAppsTable(e){await r.ensureLoadedProfile(e);let n=this.groupList.store.each(e.me,i.default.acl(`trustedApp`)),a=n.flatMap(e=>this.groupList.store.each(e,i.default.acl(`origin`)));return this.barElement.appendChild(this.groupList.controller.dom.createElement(`p`)).textContent=`You have ${a.length} selected web apps.`,new Promise((e,r)=>{let a=this.barElement.appendChild(this.groupList.controller.dom.createElement(`table`));a.setAttribute(`style`,s.style.trustedAppAddApplicationsTable),n.forEach(n=>{let s=this.groupList.store.any(n,i.default.acl(`origin`));s||r(Error(`Unable to pick app: ${n.value}`));let c=o.personTR(this.groupList.controller.dom,i.default.acl(`origin`),s,{}),l=this.groupList.controller.dom.createElement(`table`),u=l.appendChild(this.groupList.controller.dom.createElement(`tr`));u.appendChild(this.groupList.controller.dom.createElement(`td`)).appendChild(c);let d=u.appendChild(this.groupList.controller.dom.createElement(`td`));d.textContent=`Give access to ${this.groupList.controller.noun} ${t.label(this.groupList.controller.subject)}?`,u.appendChild(this.groupList.controller.dom.createElement(`td`)).appendChild(o.continueButton(this.groupList.controller.dom,()=>e(s.value))),a.appendChild(l)})})}renderCleanup(){this.renderBar(),this.groupList.render()}async addPerson(t){if(!t)return this.toggleBar();if(!t.match(/^https?:/i))return Promise.reject(Error(`Not a http URI`));e.log(`Adding to ACL person: ${t}`),await this.groupList.addNewURI(t),this.toggleBar()}async addGroup(t){if(!t)return this.toggleBar();if(!t.match(/^https?:/i))return Promise.reject(Error(`Not a http URI`));e.log(`Adding to ACL group: `+t),await this.groupList.addNewURI(t),this.toggleBar()}async addAgent(e){await this.groupList.addNewURI(e),this.toggleBar()}async addBot(t){if(!t)return this.toggleBar();if(!t.match(/^https?:/i))return Promise.reject(Error(`Not a http URI`));e.log(`Adding to ACL bot: `+t),await this.groupList.addNewURI(t),this.toggleBar()}async getOriginFromName(t){if(!t)return Promise.resolve();if(!t.match(/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i))return Promise.reject(Error(`Not a domain name`));let n=`https://`+t;return e.log(`Adding to ACL origin: `+n),this.toggleBar(),n}toggleBar(){this.isExpanded=!this.isExpanded}};exports.AddAgentButtons=c;
|
|
2
2
|
//# sourceMappingURL=add-agent-buttons.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-agent-buttons.cjs.js","names":["icons","ns","style","cancelButton","ensureLoadedProfile","require_debug","require_label","require_iconBase","require_login","require_ns","require_buttons","require_style","AddAgentButtons","groupList","element","button","event","name","error","type","noun","eventContext","existingApps","newApp","origin","trustedApplications","trustedApplicationsElement","cancelButton$1","trustedApps","trustedOrigins","app","appsTable","reject","thingTR","innerTable","innerRow","innerMiddleColumn","resolve","agentUri"],"sources":["../../src/acl/add-agent-buttons.ts"],"sourcesContent":["/**\n * Contains the [[AddAgentButtons]] class\n * @packageDocumentation\n */\n\nimport { NamedNode, Store } from 'rdflib'\nimport { AuthenticationContext } from 'solid-logic'\nimport * as debug from '../lib/debug'\nimport { icons } from '../lib/iconBase'\nimport { ensureLoadedProfile } from '../login/login'\nimport ns from '../lib/ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { style } from '../lib/style'\nimport { AccessGroups } from './access-groups'\n\n/**\n * Renders the Sharing pane's \"+\" button and the menus behind it,\n * see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#add\n */\nexport class AddAgentButtons {\n private readonly rootElement: HTMLElement\n private readonly barElement: HTMLElement\n private isExpanded: boolean = false\n\n constructor (private groupList: AccessGroups) {\n this.rootElement = groupList.controller.dom.createElement('div')\n this.barElement = groupList.controller.dom.createElement('div')\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.rootElement.appendChild(this.renderAddButton())\n this.rootElement.appendChild(this.barElement)\n return this.rootElement\n }\n\n private renderAddButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_34653_green.svg`,\n 'Add ...',\n () => {\n this.toggleBar()\n this.renderBar()\n }\n )\n }\n\n private renderBar (): void {\n this.barElement.innerHTML = ''\n if (!this.isExpanded) {\n return\n }\n this.barElement.appendChild(this.renderPersonButton())\n this.barElement.appendChild(this.renderGroupButton())\n this.barElement.appendChild(this.renderPublicButton())\n this.barElement.appendChild(this.renderAuthenticatedAgentButton())\n this.barElement.appendChild(this.renderBotButton())\n this.barElement.appendChild(this.renderAppsButton())\n }\n\n private renderSimplifiedBar (button: EventTarget | null) {\n Array.from(this.barElement.children)\n .filter(element => element !== button)\n .forEach(element => this.barElement.removeChild(element))\n }\n\n private renderPersonButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Individual'],\n 'Add Person',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Individual'), 'person')\n .then(name => this.addPerson(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderGroupButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Group'],\n 'Add Group',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Group'), 'group')\n .then(name => this.addGroup(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderNameForm (type: NamedNode, noun: string): Promise<string | undefined> {\n return widgets.askName(\n this.groupList.controller.dom,\n this.groupList.store,\n this.barElement,\n ns.vcard('URI'),\n type,\n noun\n )\n }\n\n private renderPublicButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['foaf:Agent'],\n 'Add Everyone',\n () => this.addAgent(ns.foaf('Agent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderAuthenticatedAgentButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_99101.svg`,\n 'Anyone logged In',\n () => this.addAgent(ns.acl('AuthenticatedAgent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderBotButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + 'noun_Robot_849764.svg',\n 'A Software Agent (bot)',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.schema('Application'), 'bot')\n .then(name => this.addBot(name))\n .then(() => this.renderCleanup())\n })\n }\n\n private renderAppsButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_15177.svg`,\n 'A Web App (origin)',\n event => {\n this.renderSimplifiedBar(event.target)\n const eventContext = {\n div: this.barElement,\n dom: this.groupList.controller.dom\n }\n const existingApps = this.renderAppsTable(eventContext)\n .catch(error => this.groupList.controller.renderStatus(error))\n this.renderAppsView()\n const newApp = this.renderNameForm(ns.schema('WebApplication'), 'webapp domain')\n .then(name => this.getOriginFromName(name))\n Promise.race([\n existingApps,\n newApp\n ])\n .then(origin => {\n if (origin) {\n this.groupList.addNewURI(origin)\n }\n })\n .then(() => this.renderCleanup())\n }\n )\n }\n\n private renderAppsView (): void {\n const trustedApplications = this.groupList.controller.context.session.paneRegistry.byName('trustedApplications')\n if (trustedApplications) {\n const trustedApplicationsElement = trustedApplications.render(null, this.groupList.controller.context)\n trustedApplicationsElement.setAttribute('style', style.trustedAppController)\n\n const cancelButton = widgets.cancelButton(this.groupList.controller.dom, () => this.renderCleanup())\n cancelButton.setAttribute('style', style.trustedAppCancelButton)\n trustedApplicationsElement.insertBefore(cancelButton, trustedApplicationsElement.firstChild)\n\n this.barElement.appendChild(trustedApplicationsElement)\n }\n }\n\n private async renderAppsTable (eventContext: AuthenticationContext): Promise<string> {\n await ensureLoadedProfile(eventContext)\n const trustedApps = (this.groupList.store as Store).each(eventContext.me, ns.acl('trustedApp')) as Array<NamedNode> // @@ TODO fix as\n const trustedOrigins = trustedApps.flatMap(app => (this.groupList.store as Store).each(app, ns.acl('origin'))) // @@ TODO fix as\n\n this.barElement.appendChild(this.groupList.controller.dom.createElement('p')).textContent = `You have ${trustedOrigins.length} selected web apps.`\n return new Promise((resolve, reject) => {\n const appsTable = this.barElement.appendChild(this.groupList.controller.dom.createElement('table'))\n appsTable.setAttribute('style', style.trustedAppAddApplicationsTable)\n trustedApps.forEach(app => {\n const origin = (this.groupList.store as Store).any(app, ns.acl('origin')) // @@ TODO fix as\n if (!origin) {\n reject(new Error(`Unable to pick app: ${app.value}`))\n }\n const thingTR = widgets.personTR(this.groupList.controller.dom, ns.acl('origin'), origin, {})\n const innerTable = this.groupList.controller.dom.createElement('table')\n const innerRow = innerTable.appendChild(this.groupList.controller.dom.createElement('tr'))\n\n const innerLeftColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerLeftColumn.appendChild(thingTR)\n\n const innerMiddleColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerMiddleColumn.textContent = `Give access to ${this.groupList.controller.noun} ${utils.label(this.groupList.controller.subject)}?`\n\n const innerRightColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerRightColumn.appendChild(widgets.continueButton(this.groupList.controller.dom, () => resolve(origin!.value)))\n\n appsTable.appendChild(innerTable)\n })\n })\n }\n\n private renderCleanup (): void {\n this.renderBar()\n this.groupList.render()\n }\n\n private async addPerson (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a person and has an owner who agrees they own it\n debug.log(`Adding to ACL person: ${name}`)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addGroup (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a group and has an owner who agrees they own it\n debug.log('Adding to ACL group: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addAgent (agentUri: string): Promise<void> {\n await this.groupList.addNewURI(agentUri)\n this.toggleBar()\n }\n\n private async addBot (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a bot and has an owner who agrees they own it\n debug.log('Adding to ACL bot: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async getOriginFromName (name?: string): Promise<string | void> {\n if (!name) return Promise.resolve() // user cancelled\n const domainNameRegexp = /^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$/i\n // https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a domain name'))\n }\n const origin = 'https://' + name\n debug.log('Adding to ACL origin: ' + origin)\n this.toggleBar()\n return origin\n }\n\n private toggleBar (): void {\n this.isExpanded = !this.isExpanded\n }\n}\n"],"mappings":"A,uUAoBA,IAAaY,EAAb,KAA6B,CAKN,UAJrB,YACA,WACA,WAA8B,GAE9B,YAAa,EAAiC,CAAzB,KAAA,UAAAC,EACnB,KAAK,YAAcA,EAAU,WAAW,IAAI,cAAc,KAAK,EAC/D,KAAK,WAAaA,EAAU,WAAW,IAAI,cAAc,KAAK,CAChE,CAEA,QAA8B,CAI5B,MAHA,MAAK,YAAY,UAAY,GAC7B,KAAK,YAAY,YAAY,KAAK,gBAAgB,CAAC,EACnD,KAAK,YAAY,YAAY,KAAK,UAAU,EACrC,KAAK,WACd,CAEA,iBAAwC,CACtC,OAAAH,EAAA,OACE,KAAK,UAAU,WAAW,IAC1B,GAAGV,EAAAA,MAAM,SAAS,sBAClB,cACM,CACJ,KAAK,UAAU,EACf,KAAK,UAAU,CACjB,CACF,CACF,CAEA,WAA2B,CACzB,KAAK,WAAW,UAAY,GACvB,KAAK,aAGV,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,EACrD,KAAK,WAAW,YAAY,KAAK,kBAAkB,CAAC,EACpD,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,EACrD,KAAK,WAAW,YAAY,KAAK,+BAA+B,CAAC,EACjE,KAAK,WAAW,YAAY,KAAK,gBAAgB,CAAC,EAClD,KAAK,WAAW,YAAY,KAAK,iBAAiB,CAAC,EACrD,CAEA,oBAA6B,EAA4B,CACvD,MAAM,KAAK,KAAK,WAAW,QAAQ,CAAC,CACjC,OAAO,GAAWc,IAAYC,CAAM,CAAC,CACrC,QAAQ,GAAW,KAAK,W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AQ,EAA8B,CAClD,GAAI,CAACrB,EAAM,OAAO,KAAK,UAAU,EAEjC,GAAI,CAACA,EAAK,MAAM,WAAgB,EAE9B,OAAO,QAAQ,OAAW,MAAM,gBAAgB,CAAC,EAGnDZ,EAAA,IAAU,sBAAwBY,CAAI,EACtC,MAAM,KAAK,UAAU,UAAUA,CAAI,EACnC,KAAK,UAAU,CACjB,CAEA,MAAc,kBAAmB,EAAuC,CACtE,GAAI,CAACA,EAAM,OAAO,QAAQ,QAAQ,EAGlC,GAAI,CAACA,EAAK,MAAM,yCAAgB,EAE9B,OAAO,QAAQ,OAAW,MAAM,mBAAmB,CAAC,EAEtD,IAAMO,EAAS,WAAaP,EAG5B,OAFAZ,EAAA,IAAU,yBAA2BmB,CAAM,EAC3C,KAAK,UAAU,EACRA,CACT,CAEA,WAA2B,CACzB,KAAK,WAAa,CAAC,KAAK,UAC1B,CACF,E"}
|
|
1
|
+
{"version":3,"file":"add-agent-buttons.cjs.js","names":["icons","ns","button","style","cancelButton","ensureLoadedProfile","require_debug","require_label","require_iconBase","require_login","require_ns","require_dragAndDrop","require_buttons","require_style","AddAgentButtons","groupList","element","button","event","name","error","type","noun","button$1","eventContext","existingApps","newApp","origin","trustedApplications","trustedApplicationsElement","cancelButton$1","trustedApps","trustedOrigins","app","appsTable","reject","thingTR","innerTable","innerRow","innerMiddleColumn","resolve","agentUri"],"sources":["../../src/acl/add-agent-buttons.ts"],"sourcesContent":["/**\n * Contains the [[AddAgentButtons]] class\n * @packageDocumentation\n */\n\nimport { NamedNode, Store } from 'rdflib'\nimport { AuthenticationContext } from 'solid-logic'\nimport * as debug from '../lib/debug'\nimport { icons } from '../lib/iconBase'\nimport { ensureLoadedProfile } from '../login/login'\nimport ns from '../lib/ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { style } from '../lib/style'\nimport { AccessGroups } from './access-groups'\n\n/**\n * Renders the Sharing pane's \"+\" button and the menus behind it,\n * see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#add\n */\nexport class AddAgentButtons {\n private readonly rootElement: HTMLElement\n private readonly barElement: HTMLElement\n private isExpanded: boolean = false\n\n constructor (private groupList: AccessGroups) {\n this.rootElement = groupList.controller.dom.createElement('div')\n this.barElement = groupList.controller.dom.createElement('div')\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.rootElement.appendChild(this.renderAddButton())\n this.rootElement.appendChild(this.barElement)\n return this.rootElement\n }\n\n private renderAddButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_34653_green.svg`,\n 'Add ...',\n () => {\n this.toggleBar()\n this.renderBar()\n }\n )\n }\n\n private renderBar (): void {\n this.barElement.innerHTML = ''\n if (!this.isExpanded) {\n return\n }\n this.barElement.appendChild(this.renderPersonButton())\n this.barElement.appendChild(this.renderGroupButton())\n this.barElement.appendChild(this.renderPublicButton())\n this.barElement.appendChild(this.renderAuthenticatedAgentButton())\n this.barElement.appendChild(this.renderBotButton())\n this.barElement.appendChild(this.renderAppsButton())\n }\n\n private renderSimplifiedBar (button: EventTarget | null) {\n Array.from(this.barElement.children)\n .filter(element => element !== button)\n .forEach(element => this.barElement.removeChild(element))\n }\n\n private renderPersonButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Individual'],\n 'Add Person',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Individual'), 'person')\n .then(name => this.addPerson(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderGroupButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Group'],\n 'Add Group',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Group'), 'group')\n .then(name => this.addGroup(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderNameForm (type: NamedNode, noun: string): Promise<string | undefined> {\n return widgets.askName(\n this.groupList.controller.dom,\n this.groupList.store,\n this.barElement,\n ns.vcard('URI'),\n type,\n noun\n )\n }\n\n private renderPublicButton (): HTMLElement {\n const button = widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['foaf:Agent'],\n 'Add Everyone',\n () => this.addAgent(ns.foaf('Agent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n // Drag the ACL agent class, not the globe image's URL.\n button.querySelector('img')?.setAttribute('draggable', 'false')\n widgets.makeDraggable(button, ns.foaf('Agent'))\n return button\n }\n\n private renderAuthenticatedAgentButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_99101.svg`,\n 'Anyone logged In',\n () => this.addAgent(ns.acl('AuthenticatedAgent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderBotButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + 'noun_Robot_849764.svg',\n 'A Software Agent (bot)',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.schema('Application'), 'bot')\n .then(name => this.addBot(name))\n .then(() => this.renderCleanup())\n })\n }\n\n private renderAppsButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_15177.svg`,\n 'A Web App (origin)',\n event => {\n this.renderSimplifiedBar(event.target)\n const eventContext = {\n div: this.barElement,\n dom: this.groupList.controller.dom\n }\n const existingApps = this.renderAppsTable(eventContext)\n .catch(error => this.groupList.controller.renderStatus(error))\n this.renderAppsView()\n const newApp = this.renderNameForm(ns.schema('WebApplication'), 'webapp domain')\n .then(name => this.getOriginFromName(name))\n Promise.race([\n existingApps,\n newApp\n ])\n .then(origin => {\n if (origin) {\n this.groupList.addNewURI(origin)\n }\n })\n .then(() => this.renderCleanup())\n }\n )\n }\n\n private renderAppsView (): void {\n const trustedApplications = this.groupList.controller.context.session.paneRegistry.byName('trustedApplications')\n if (trustedApplications) {\n const trustedApplicationsElement = trustedApplications.render(null, this.groupList.controller.context)\n trustedApplicationsElement.setAttribute('style', style.trustedAppController)\n\n const cancelButton = widgets.cancelButton(this.groupList.controller.dom, () => this.renderCleanup())\n cancelButton.setAttribute('style', style.trustedAppCancelButton)\n trustedApplicationsElement.insertBefore(cancelButton, trustedApplicationsElement.firstChild)\n\n this.barElement.appendChild(trustedApplicationsElement)\n }\n }\n\n private async renderAppsTable (eventContext: AuthenticationContext): Promise<string> {\n await ensureLoadedProfile(eventContext)\n const trustedApps = (this.groupList.store as Store).each(eventContext.me, ns.acl('trustedApp')) as Array<NamedNode> // @@ TODO fix as\n const trustedOrigins = trustedApps.flatMap(app => (this.groupList.store as Store).each(app, ns.acl('origin'))) // @@ TODO fix as\n\n this.barElement.appendChild(this.groupList.controller.dom.createElement('p')).textContent = `You have ${trustedOrigins.length} selected web apps.`\n return new Promise((resolve, reject) => {\n const appsTable = this.barElement.appendChild(this.groupList.controller.dom.createElement('table'))\n appsTable.setAttribute('style', style.trustedAppAddApplicationsTable)\n trustedApps.forEach(app => {\n const origin = (this.groupList.store as Store).any(app, ns.acl('origin')) // @@ TODO fix as\n if (!origin) {\n reject(new Error(`Unable to pick app: ${app.value}`))\n }\n const thingTR = widgets.personTR(this.groupList.controller.dom, ns.acl('origin'), origin, {})\n const innerTable = this.groupList.controller.dom.createElement('table')\n const innerRow = innerTable.appendChild(this.groupList.controller.dom.createElement('tr'))\n\n const innerLeftColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerLeftColumn.appendChild(thingTR)\n\n const innerMiddleColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerMiddleColumn.textContent = `Give access to ${this.groupList.controller.noun} ${utils.label(this.groupList.controller.subject)}?`\n\n const innerRightColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerRightColumn.appendChild(widgets.continueButton(this.groupList.controller.dom, () => resolve(origin!.value)))\n\n appsTable.appendChild(innerTable)\n })\n })\n }\n\n private renderCleanup (): void {\n this.renderBar()\n this.groupList.render()\n }\n\n private async addPerson (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a person and has an owner who agrees they own it\n debug.log(`Adding to ACL person: ${name}`)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addGroup (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a group and has an owner who agrees they own it\n debug.log('Adding to ACL group: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addAgent (agentUri: string): Promise<void> {\n await this.groupList.addNewURI(agentUri)\n this.toggleBar()\n }\n\n private async addBot (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a bot and has an owner who agrees they own it\n debug.log('Adding to ACL bot: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async getOriginFromName (name?: string): Promise<string | void> {\n if (!name) return Promise.resolve() // user cancelled\n const domainNameRegexp = /^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$/i\n // https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a domain name'))\n }\n const origin = 'https://' + name\n debug.log('Adding to ACL origin: ' + origin)\n this.toggleBar()\n return origin\n }\n\n private toggleBar (): void {\n this.isExpanded = !this.isExpanded\n }\n}\n"],"mappings":"A,kXAoBA,IAAac,EAAb,KAA6B,CAKN,UAJrB,YACA,WACA,WAA8B,GAE9B,YAAa,EAAiC,CAAzB,KAAA,UAAAC,EACnB,KAAK,YAAcA,EAAU,WAAW,IAAI,cAAc,KAAK,EAC/D,KAAK,WAAaA,EAAU,WAAW,IAAI,cAAc,KAAK,CAChE,CAEA,QAA8B,CAI5B,MAHA,MAAK,YAAY,UAAY,GAC7B,KAAK,YAAY,YAAY,KAAK,gBAAgB,CAAC,EACnD,KAAK,YAAY,YAAY,KAAK,UAAU,EACrC,KAAK,WACd,CAEA,iBAAwC,CACtC,OAAAH,EAAA,OACE,KAAK,UAAU,WAAW,IAC1B,GAAGZ,EAAAA,MAAM,SAAS,sBAClB,cACM,CACJ,KAAK,UAAU,EACf,KAAK,UAAU,CACjB,CACF,CACF,CAEA,WAA2B,CACzB,KAAK,WAAW,UAAY,GACvB,KAAK,aAGV,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,EACrD,KAAK,WAAW,YAAY,KAAK,kBAAkB,CAAC,EACpD,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,EACrD,KAAK,WAAW,YAAY,KAAK,+BAA+B,CAAC,EACjE,KAAK,WAAW,YAAY,KAAK,gBAAgB,CAAC,EAClD,KAAK,WAAW,YAAY,KAAK,iBAAiB,CAAC,EACrD,CAEA,oBAA6B,EAA4B,CACvD,MAAM,KAAK,KAAK,WAAW,QAAQ,CAAC,CACjC,OAAO,GAAWgB,IAAYC,CAAM,CAAC,CACrC,QAAQ,GAAW,KAAK,WAAW,YAAYD,CAAO,CAAC,CAC5D,CAEA,oBAA2C,CACzC,OAAAJ,EAAA,OACE,KAAK,UAAU,WAAW,IAC1BZ,EAAAA,MAAM,SAAAY,EAAA,aAAgC,oBACtC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B,CAEA,MAAc,OAAQ,EAA8B,CAClD,GAAI,CAACtB,EAAM,OAAO,KAAK,UAAU,EAEjC,GAAI,CAACA,EAAK,MAAM,WAAgB,EAE9B,OAAO,QAAQ,OAAW,MAAM,gBAAgB,CAAC,EAGnDb,EAAA,IAAU,sBAAwBa,CAAI,EACtC,MAAM,KAAK,UAAU,UAAUA,CAAI,EACnC,KAAK,UAAU,CACjB,CAEA,MAAc,kBAAmB,EAAuC,CACtE,GAAI,CAACA,EAAM,OAAO,QAAQ,QAAQ,EAGlC,GAAI,CAACA,EAAK,MAAM,yCAAgB,EAE9B,OAAO,QAAQ,OAAW,MAAM,mBAAmB,CAAC,EAEtD,IAAMQ,EAAS,WAAaR,EAG5B,OAFAb,EAAA,IAAU,yBAA2BqB,CAAM,EAC3C,KAAK,UAAU,EACRA,CACT,CAEA,WAA2B,CACzB,KAAK,WAAa,CAAC,KAAK,UAC1B,CACF,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-agent-buttons.d.ts","sourceRoot":"","sources":["../../src/acl/add-agent-buttons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,qBAAa,eAAe;IAKb,OAAO,CAAC,SAAS;IAJ9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,UAAU,CAAiB;gBAEd,SAAS,EAAE,YAAY;IAKrC,MAAM,IAAK,WAAW;IAO7B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"add-agent-buttons.d.ts","sourceRoot":"","sources":["../../src/acl/add-agent-buttons.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C;;;GAGG;AACH,qBAAa,eAAe;IAKb,OAAO,CAAC,SAAS;IAJ9B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,UAAU,CAAiB;gBAEd,SAAS,EAAE,YAAY;IAKrC,MAAM,IAAK,WAAW;IAO7B,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,SAAS;IAajB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAe1B,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,8BAA8B;IAUtC,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,gBAAgB;IA8BxB,OAAO,CAAC,cAAc;YAcR,eAAe;IAgC7B,OAAO,CAAC,aAAa;YAKP,SAAS;YAaT,QAAQ;YAcR,QAAQ;YAKR,MAAM;YAaN,iBAAiB;IAc/B,OAAO,CAAC,SAAS;CAGlB"}
|
|
@@ -3,12 +3,13 @@ import { label as t } from "../utils/label.esm.js";
|
|
|
3
3
|
import { icons as n } from "../lib/iconBase.esm.js";
|
|
4
4
|
import { ensureLoadedProfile as r } from "../login/login.esm.js";
|
|
5
5
|
import i from "../lib/ns.esm.js";
|
|
6
|
+
import { makeDraggable as a } from "../widgets/dragAndDrop.esm.js";
|
|
6
7
|
import "../utils/index.esm.js";
|
|
7
|
-
import { askName as
|
|
8
|
+
import { askName as o, button as s, cancelButton as c, continueButton as l, iconForClass as u, personTR as d } from "../widgets/buttons.esm.js";
|
|
8
9
|
import "../widgets/index.esm.js";
|
|
9
|
-
import { style as
|
|
10
|
+
import { style as f } from "../lib/style.esm.js";
|
|
10
11
|
// src/acl/add-agent-buttons.ts
|
|
11
|
-
var
|
|
12
|
+
var p = class {
|
|
12
13
|
groupList;
|
|
13
14
|
rootElement;
|
|
14
15
|
barElement;
|
|
@@ -20,7 +21,7 @@ var f = class {
|
|
|
20
21
|
return this.rootElement.innerHTML = "", this.rootElement.appendChild(this.renderAddButton()), this.rootElement.appendChild(this.barElement), this.rootElement;
|
|
21
22
|
}
|
|
22
23
|
renderAddButton() {
|
|
23
|
-
return
|
|
24
|
+
return s(this.groupList.controller.dom, `${n.iconBase}noun_34653_green.svg`, "Add ...", () => {
|
|
24
25
|
this.toggleBar(), this.renderBar();
|
|
25
26
|
});
|
|
26
27
|
}
|
|
@@ -31,31 +32,32 @@ var f = class {
|
|
|
31
32
|
Array.from(this.barElement.children).filter((t) => t !== e).forEach((e) => this.barElement.removeChild(e));
|
|
32
33
|
}
|
|
33
34
|
renderPersonButton() {
|
|
34
|
-
return
|
|
35
|
+
return s(this.groupList.controller.dom, n.iconBase + u["vcard:Individual"], "Add Person", (e) => {
|
|
35
36
|
this.renderSimplifiedBar(e.target), this.renderNameForm(i.vcard("Individual"), "person").then((e) => this.addPerson(e)).then(() => this.renderCleanup()).catch((e) => this.groupList.controller.renderStatus(e));
|
|
36
37
|
});
|
|
37
38
|
}
|
|
38
39
|
renderGroupButton() {
|
|
39
|
-
return
|
|
40
|
+
return s(this.groupList.controller.dom, n.iconBase + u["vcard:Group"], "Add Group", (e) => {
|
|
40
41
|
this.renderSimplifiedBar(e.target), this.renderNameForm(i.vcard("Group"), "group").then((e) => this.addGroup(e)).then(() => this.renderCleanup()).catch((e) => this.groupList.controller.renderStatus(e));
|
|
41
42
|
});
|
|
42
43
|
}
|
|
43
44
|
renderNameForm(e, t) {
|
|
44
|
-
return
|
|
45
|
+
return o(this.groupList.controller.dom, this.groupList.store, this.barElement, i.vcard("URI"), e, t);
|
|
45
46
|
}
|
|
46
47
|
renderPublicButton() {
|
|
47
|
-
|
|
48
|
+
let e = s(this.groupList.controller.dom, n.iconBase + u["foaf:Agent"], "Add Everyone", () => this.addAgent(i.foaf("Agent").uri).then(() => this.groupList.controller.renderTemporaryStatus("Adding the general public to those who can read. Drag the globe to a different level to give them more access.")).then(() => this.renderCleanup()));
|
|
49
|
+
return e.querySelector("img")?.setAttribute("draggable", "false"), a(e, i.foaf("Agent")), e;
|
|
48
50
|
}
|
|
49
51
|
renderAuthenticatedAgentButton() {
|
|
50
|
-
return
|
|
52
|
+
return s(this.groupList.controller.dom, `${n.iconBase}noun_99101.svg`, "Anyone logged In", () => this.addAgent(i.acl("AuthenticatedAgent").uri).then(() => this.groupList.controller.renderTemporaryStatus("Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.")).then(() => this.renderCleanup()));
|
|
51
53
|
}
|
|
52
54
|
renderBotButton() {
|
|
53
|
-
return
|
|
55
|
+
return s(this.groupList.controller.dom, n.iconBase + "noun_Robot_849764.svg", "A Software Agent (bot)", (e) => {
|
|
54
56
|
this.renderSimplifiedBar(e.target), this.renderNameForm(i.schema("Application"), "bot").then((e) => this.addBot(e)).then(() => this.renderCleanup());
|
|
55
57
|
});
|
|
56
58
|
}
|
|
57
59
|
renderAppsButton() {
|
|
58
|
-
return
|
|
60
|
+
return s(this.groupList.controller.dom, `${n.iconBase}noun_15177.svg`, "A Web App (origin)", (e) => {
|
|
59
61
|
this.renderSimplifiedBar(e.target);
|
|
60
62
|
let t = {
|
|
61
63
|
div: this.barElement,
|
|
@@ -72,9 +74,9 @@ var f = class {
|
|
|
72
74
|
let e = this.groupList.controller.context.session.paneRegistry.byName("trustedApplications");
|
|
73
75
|
if (e) {
|
|
74
76
|
let t = e.render(null, this.groupList.controller.context);
|
|
75
|
-
t.setAttribute("style",
|
|
76
|
-
let n =
|
|
77
|
-
n.setAttribute("style",
|
|
77
|
+
t.setAttribute("style", f.trustedAppController);
|
|
78
|
+
let n = c(this.groupList.controller.dom, () => this.renderCleanup());
|
|
79
|
+
n.setAttribute("style", f.trustedAppCancelButton), t.insertBefore(n, t.firstChild), this.barElement.appendChild(t);
|
|
78
80
|
}
|
|
79
81
|
}
|
|
80
82
|
async renderAppsTable(e) {
|
|
@@ -82,13 +84,13 @@ var f = class {
|
|
|
82
84
|
let n = this.groupList.store.each(e.me, i.acl("trustedApp")), a = n.flatMap((e) => this.groupList.store.each(e, i.acl("origin")));
|
|
83
85
|
return this.barElement.appendChild(this.groupList.controller.dom.createElement("p")).textContent = `You have ${a.length} selected web apps.`, new Promise((e, r) => {
|
|
84
86
|
let a = this.barElement.appendChild(this.groupList.controller.dom.createElement("table"));
|
|
85
|
-
a.setAttribute("style",
|
|
87
|
+
a.setAttribute("style", f.trustedAppAddApplicationsTable), n.forEach((n) => {
|
|
86
88
|
let o = this.groupList.store.any(n, i.acl("origin"));
|
|
87
89
|
o || r(/* @__PURE__ */ Error(`Unable to pick app: ${n.value}`));
|
|
88
|
-
let s =
|
|
89
|
-
|
|
90
|
-
let f =
|
|
91
|
-
f.textContent = `Give access to ${this.groupList.controller.noun} ${t(this.groupList.controller.subject)}?`,
|
|
90
|
+
let s = d(this.groupList.controller.dom, i.acl("origin"), o, {}), c = this.groupList.controller.dom.createElement("table"), u = c.appendChild(this.groupList.controller.dom.createElement("tr"));
|
|
91
|
+
u.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(s);
|
|
92
|
+
let f = u.appendChild(this.groupList.controller.dom.createElement("td"));
|
|
93
|
+
f.textContent = `Give access to ${this.groupList.controller.noun} ${t(this.groupList.controller.subject)}?`, u.appendChild(this.groupList.controller.dom.createElement("td")).appendChild(l(this.groupList.controller.dom, () => e(o.value))), a.appendChild(c);
|
|
92
94
|
});
|
|
93
95
|
});
|
|
94
96
|
}
|
|
@@ -123,6 +125,6 @@ var f = class {
|
|
|
123
125
|
this.isExpanded = !this.isExpanded;
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
|
-
export {
|
|
128
|
+
export { p as AddAgentButtons };
|
|
127
129
|
|
|
128
130
|
//# sourceMappingURL=add-agent-buttons.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-agent-buttons.esm.js","names":["widgets.button","ns","widgets.askName","cancelButton","widgets.cancelButton","widgets.personTR","utils.label","widgets.continueButton","ns_default","AddAgentButtons","groupList","button","icons","element","iconForClass","event","name","error","askName","type","noun","eventContext","existingApps","newApp","origin","trustedApplications","trustedApplicationsElement","style","cancelButton$1","cancelButton","ensureLoadedProfile","trustedApps","trustedOrigins","app","appsTable","reject","thingTR","personTR","innerTable","innerRow","innerMiddleColumn","label","continueButton","resolve","log","agentUri"],"sources":["../../src/acl/add-agent-buttons.ts"],"sourcesContent":["/**\n * Contains the [[AddAgentButtons]] class\n * @packageDocumentation\n */\n\nimport { NamedNode, Store } from 'rdflib'\nimport { AuthenticationContext } from 'solid-logic'\nimport * as debug from '../lib/debug'\nimport { icons } from '../lib/iconBase'\nimport { ensureLoadedProfile } from '../login/login'\nimport ns from '../lib/ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { style } from '../lib/style'\nimport { AccessGroups } from './access-groups'\n\n/**\n * Renders the Sharing pane's \"+\" button and the menus behind it,\n * see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#add\n */\nexport class AddAgentButtons {\n private readonly rootElement: HTMLElement\n private readonly barElement: HTMLElement\n private isExpanded: boolean = false\n\n constructor (private groupList: AccessGroups) {\n this.rootElement = groupList.controller.dom.createElement('div')\n this.barElement = groupList.controller.dom.createElement('div')\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.rootElement.appendChild(this.renderAddButton())\n this.rootElement.appendChild(this.barElement)\n return this.rootElement\n }\n\n private renderAddButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_34653_green.svg`,\n 'Add ...',\n () => {\n this.toggleBar()\n this.renderBar()\n }\n )\n }\n\n private renderBar (): void {\n this.barElement.innerHTML = ''\n if (!this.isExpanded) {\n return\n }\n this.barElement.appendChild(this.renderPersonButton())\n this.barElement.appendChild(this.renderGroupButton())\n this.barElement.appendChild(this.renderPublicButton())\n this.barElement.appendChild(this.renderAuthenticatedAgentButton())\n this.barElement.appendChild(this.renderBotButton())\n this.barElement.appendChild(this.renderAppsButton())\n }\n\n private renderSimplifiedBar (button: EventTarget | null) {\n Array.from(this.barElement.children)\n .filter(element => element !== button)\n .forEach(element => this.barElement.removeChild(element))\n }\n\n private renderPersonButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Individual'],\n 'Add Person',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Individual'), 'person')\n .then(name => this.addPerson(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderGroupButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Group'],\n 'Add Group',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Group'), 'group')\n .then(name => this.addGroup(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderNameForm (type: NamedNode, noun: string): Promise<string | undefined> {\n return widgets.askName(\n this.groupList.controller.dom,\n this.groupList.store,\n this.barElement,\n ns.vcard('URI'),\n type,\n noun\n )\n }\n\n private renderPublicButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['foaf:Agent'],\n 'Add Everyone',\n () => this.addAgent(ns.foaf('Agent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderAuthenticatedAgentButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_99101.svg`,\n 'Anyone logged In',\n () => this.addAgent(ns.acl('AuthenticatedAgent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderBotButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + 'noun_Robot_849764.svg',\n 'A Software Agent (bot)',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.schema('Application'), 'bot')\n .then(name => this.addBot(name))\n .then(() => this.renderCleanup())\n })\n }\n\n private renderAppsButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_15177.svg`,\n 'A Web App (origin)',\n event => {\n this.renderSimplifiedBar(event.target)\n const eventContext = {\n div: this.barElement,\n dom: this.groupList.controller.dom\n }\n const existingApps = this.renderAppsTable(eventContext)\n .catch(error => this.groupList.controller.renderStatus(error))\n this.renderAppsView()\n const newApp = this.renderNameForm(ns.schema('WebApplication'), 'webapp domain')\n .then(name => this.getOriginFromName(name))\n Promise.race([\n existingApps,\n newApp\n ])\n .then(origin => {\n if (origin) {\n this.groupList.addNewURI(origin)\n }\n })\n .then(() => this.renderCleanup())\n }\n )\n }\n\n private renderAppsView (): void {\n const trustedApplications = this.groupList.controller.context.session.paneRegistry.byName('trustedApplications')\n if (trustedApplications) {\n const trustedApplicationsElement = trustedApplications.render(null, this.groupList.controller.context)\n trustedApplicationsElement.setAttribute('style', style.trustedAppController)\n\n const cancelButton = widgets.cancelButton(this.groupList.controller.dom, () => this.renderCleanup())\n cancelButton.setAttribute('style', style.trustedAppCancelButton)\n trustedApplicationsElement.insertBefore(cancelButton, trustedApplicationsElement.firstChild)\n\n this.barElement.appendChild(trustedApplicationsElement)\n }\n }\n\n private async renderAppsTable (eventContext: AuthenticationContext): Promise<string> {\n await ensureLoadedProfile(eventContext)\n const trustedApps = (this.groupList.store as Store).each(eventContext.me, ns.acl('trustedApp')) as Array<NamedNode> // @@ TODO fix as\n const trustedOrigins = trustedApps.flatMap(app => (this.groupList.store as Store).each(app, ns.acl('origin'))) // @@ TODO fix as\n\n this.barElement.appendChild(this.groupList.controller.dom.createElement('p')).textContent = `You have ${trustedOrigins.length} selected web apps.`\n return new Promise((resolve, reject) => {\n const appsTable = this.barElement.appendChild(this.groupList.controller.dom.createElement('table'))\n appsTable.setAttribute('style', style.trustedAppAddApplicationsTable)\n trustedApps.forEach(app => {\n const origin = (this.groupList.store as Store).any(app, ns.acl('origin')) // @@ TODO fix as\n if (!origin) {\n reject(new Error(`Unable to pick app: ${app.value}`))\n }\n const thingTR = widgets.personTR(this.groupList.controller.dom, ns.acl('origin'), origin, {})\n const innerTable = this.groupList.controller.dom.createElement('table')\n const innerRow = innerTable.appendChild(this.groupList.controller.dom.createElement('tr'))\n\n const innerLeftColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerLeftColumn.appendChild(thingTR)\n\n const innerMiddleColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerMiddleColumn.textContent = `Give access to ${this.groupList.controller.noun} ${utils.label(this.groupList.controller.subject)}?`\n\n const innerRightColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerRightColumn.appendChild(widgets.continueButton(this.groupList.controller.dom, () => resolve(origin!.value)))\n\n appsTable.appendChild(innerTable)\n })\n })\n }\n\n private renderCleanup (): void {\n this.renderBar()\n this.groupList.render()\n }\n\n private async addPerson (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a person and has an owner who agrees they own it\n debug.log(`Adding to ACL person: ${name}`)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addGroup (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a group and has an owner who agrees they own it\n debug.log('Adding to ACL group: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addAgent (agentUri: string): Promise<void> {\n await this.groupList.addNewURI(agentUri)\n this.toggleBar()\n }\n\n private async addBot (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a bot and has an owner who agrees they own it\n debug.log('Adding to ACL bot: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async getOriginFromName (name?: string): Promise<string | void> {\n if (!name) return Promise.resolve() // user cancelled\n const domainNameRegexp = /^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$/i\n // https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a domain name'))\n }\n const origin = 'https://' + name\n debug.log('Adding to ACL origin: ' + origin)\n this.toggleBar()\n return origin\n }\n\n private toggleBar (): void {\n this.isExpanded = !this.isExpanded\n }\n}\n"],"mappings":";;;;;;;;;;AAoBA,IAAaS,IAAb,MAA6B;CAKN;CAJrB;CACA;CACA,aAA8B;CAE9B,YAAa,GAAiC;EAE5C,AAFmB,KAAA,YAAAC,GACnB,KAAK,cAAcA,EAAU,WAAW,IAAI,cAAc,KAAK,GAC/D,KAAK,aAAaA,EAAU,WAAW,IAAI,cAAc,KAAK;CAChE;CAEA,SAA8B;EAI5B,OAHA,KAAK,YAAY,YAAY,IAC7B,KAAK,YAAY,YAAY,KAAK,gBAAgB,CAAC,GACnD,KAAK,YAAY,YAAY,KAAK,UAAU,GACrC,KAAK;CACd;CAEA,kBAAwC;EACtC,OAAOV,EACL,KAAK,UAAU,WAAW,KAC1B,GAAGY,EAAM,SAAS,uBAClB,iBACM;GAEJ,AADA,KAAK,UAAU,GACf,KAAK,UAAU;EACj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EAGjC,IAAI,CAACA,EAAK,MAAM,WAAgB,GAE9B,OAAO,QAAQ,OAAO,gBAAI,MAAM,gBAAgB,CAAC;EAKnD,AAFA4B,EAAU,0BAA0B5B,CAAI,GACxC,MAAM,KAAK,UAAU,UAAUA,CAAI,GACnC,KAAK,UAAU;CACjB;CAEA,MAAc,SAAU,GAAiC;EAEvD,AADA,MAAM,KAAK,UAAU,UAAU6B,CAAQ,GACvC,KAAK,UAAU;CACjB;CAEA,MAAc,OAAQ,GAA8B;EAClD,IAAI,CAAC7B,GAAM,OAAO,KAAK,UAAU;EAEjC,IAAI,CAACA,EAAK,MAAM,WAAgB,GAE9B,OAAO,QAAQ,OAAO,gBAAI,MAAM,gBAAgB,CAAC;EAKnD,AAFA4B,EAAU,wBAAwB5B,CAAI,GACtC,MAAM,KAAK,UAAU,UAAUA,CAAI,GACnC,KAAK,UAAU;CACjB;CAEA,MAAc,kBAAmB,GAAuC;EACtE,IAAI,CAACA,GAAM,OAAO,QAAQ,QAAQ;EAGlC,IAAI,CAACA,EAAK,MAAM,yCAAgB,GAE9B,OAAO,QAAQ,OAAO,gBAAI,MAAM,mBAAmB,CAAC;EAEtD,IAAMQ,IAAS,aAAaR;EAG5B,OAFA4B,EAAU,2BAA2BpB,CAAM,GAC3C,KAAK,UAAU,GACRA;CACT;CAEA,YAA2B;EACzB,KAAK,aAAa,CAAC,KAAK;CAC1B;AACF"}
|
|
1
|
+
{"version":3,"file":"add-agent-buttons.esm.js","names":["widgets.button","ns","widgets.askName","button","cancelButton","widgets.cancelButton","widgets.personTR","utils.label","widgets.continueButton","ns_default","AddAgentButtons","groupList","button","icons","element","iconForClass","event","name","error","askName","type","noun","button$1","makeDraggable","eventContext","existingApps","newApp","origin","trustedApplications","trustedApplicationsElement","style","cancelButton$1","cancelButton","ensureLoadedProfile","trustedApps","trustedOrigins","app","appsTable","reject","thingTR","personTR","innerTable","innerRow","innerMiddleColumn","label","continueButton","resolve","log","agentUri"],"sources":["../../src/acl/add-agent-buttons.ts"],"sourcesContent":["/**\n * Contains the [[AddAgentButtons]] class\n * @packageDocumentation\n */\n\nimport { NamedNode, Store } from 'rdflib'\nimport { AuthenticationContext } from 'solid-logic'\nimport * as debug from '../lib/debug'\nimport { icons } from '../lib/iconBase'\nimport { ensureLoadedProfile } from '../login/login'\nimport ns from '../lib/ns'\nimport * as utils from '../utils'\nimport * as widgets from '../widgets'\nimport { style } from '../lib/style'\nimport { AccessGroups } from './access-groups'\n\n/**\n * Renders the Sharing pane's \"+\" button and the menus behind it,\n * see https://github.com/solidos/userguide/blob/main/views/sharing/userguide.md#add\n */\nexport class AddAgentButtons {\n private readonly rootElement: HTMLElement\n private readonly barElement: HTMLElement\n private isExpanded: boolean = false\n\n constructor (private groupList: AccessGroups) {\n this.rootElement = groupList.controller.dom.createElement('div')\n this.barElement = groupList.controller.dom.createElement('div')\n }\n\n public render (): HTMLElement {\n this.rootElement.innerHTML = ''\n this.rootElement.appendChild(this.renderAddButton())\n this.rootElement.appendChild(this.barElement)\n return this.rootElement\n }\n\n private renderAddButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_34653_green.svg`,\n 'Add ...',\n () => {\n this.toggleBar()\n this.renderBar()\n }\n )\n }\n\n private renderBar (): void {\n this.barElement.innerHTML = ''\n if (!this.isExpanded) {\n return\n }\n this.barElement.appendChild(this.renderPersonButton())\n this.barElement.appendChild(this.renderGroupButton())\n this.barElement.appendChild(this.renderPublicButton())\n this.barElement.appendChild(this.renderAuthenticatedAgentButton())\n this.barElement.appendChild(this.renderBotButton())\n this.barElement.appendChild(this.renderAppsButton())\n }\n\n private renderSimplifiedBar (button: EventTarget | null) {\n Array.from(this.barElement.children)\n .filter(element => element !== button)\n .forEach(element => this.barElement.removeChild(element))\n }\n\n private renderPersonButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Individual'],\n 'Add Person',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Individual'), 'person')\n .then(name => this.addPerson(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderGroupButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['vcard:Group'],\n 'Add Group',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.vcard('Group'), 'group')\n .then(name => this.addGroup(name))\n .then(() => this.renderCleanup())\n .catch(error => this.groupList.controller.renderStatus(error))\n }\n )\n }\n\n private renderNameForm (type: NamedNode, noun: string): Promise<string | undefined> {\n return widgets.askName(\n this.groupList.controller.dom,\n this.groupList.store,\n this.barElement,\n ns.vcard('URI'),\n type,\n noun\n )\n }\n\n private renderPublicButton (): HTMLElement {\n const button = widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + widgets.iconForClass['foaf:Agent'],\n 'Add Everyone',\n () => this.addAgent(ns.foaf('Agent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding the general public to those who can read. Drag the globe to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n // Drag the ACL agent class, not the globe image's URL.\n button.querySelector('img')?.setAttribute('draggable', 'false')\n widgets.makeDraggable(button, ns.foaf('Agent'))\n return button\n }\n\n private renderAuthenticatedAgentButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_99101.svg`,\n 'Anyone logged In',\n () => this.addAgent(ns.acl('AuthenticatedAgent').uri)\n .then(() => this.groupList.controller.renderTemporaryStatus('Adding anyone logged in to those who can read. Drag the ID icon to a different level to give them more access.'))\n .then(() => this.renderCleanup()))\n }\n\n private renderBotButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n icons.iconBase + 'noun_Robot_849764.svg',\n 'A Software Agent (bot)',\n event => {\n this.renderSimplifiedBar(event.target)\n this.renderNameForm(ns.schema('Application'), 'bot')\n .then(name => this.addBot(name))\n .then(() => this.renderCleanup())\n })\n }\n\n private renderAppsButton (): HTMLElement {\n return widgets.button(\n this.groupList.controller.dom,\n `${icons.iconBase}noun_15177.svg`,\n 'A Web App (origin)',\n event => {\n this.renderSimplifiedBar(event.target)\n const eventContext = {\n div: this.barElement,\n dom: this.groupList.controller.dom\n }\n const existingApps = this.renderAppsTable(eventContext)\n .catch(error => this.groupList.controller.renderStatus(error))\n this.renderAppsView()\n const newApp = this.renderNameForm(ns.schema('WebApplication'), 'webapp domain')\n .then(name => this.getOriginFromName(name))\n Promise.race([\n existingApps,\n newApp\n ])\n .then(origin => {\n if (origin) {\n this.groupList.addNewURI(origin)\n }\n })\n .then(() => this.renderCleanup())\n }\n )\n }\n\n private renderAppsView (): void {\n const trustedApplications = this.groupList.controller.context.session.paneRegistry.byName('trustedApplications')\n if (trustedApplications) {\n const trustedApplicationsElement = trustedApplications.render(null, this.groupList.controller.context)\n trustedApplicationsElement.setAttribute('style', style.trustedAppController)\n\n const cancelButton = widgets.cancelButton(this.groupList.controller.dom, () => this.renderCleanup())\n cancelButton.setAttribute('style', style.trustedAppCancelButton)\n trustedApplicationsElement.insertBefore(cancelButton, trustedApplicationsElement.firstChild)\n\n this.barElement.appendChild(trustedApplicationsElement)\n }\n }\n\n private async renderAppsTable (eventContext: AuthenticationContext): Promise<string> {\n await ensureLoadedProfile(eventContext)\n const trustedApps = (this.groupList.store as Store).each(eventContext.me, ns.acl('trustedApp')) as Array<NamedNode> // @@ TODO fix as\n const trustedOrigins = trustedApps.flatMap(app => (this.groupList.store as Store).each(app, ns.acl('origin'))) // @@ TODO fix as\n\n this.barElement.appendChild(this.groupList.controller.dom.createElement('p')).textContent = `You have ${trustedOrigins.length} selected web apps.`\n return new Promise((resolve, reject) => {\n const appsTable = this.barElement.appendChild(this.groupList.controller.dom.createElement('table'))\n appsTable.setAttribute('style', style.trustedAppAddApplicationsTable)\n trustedApps.forEach(app => {\n const origin = (this.groupList.store as Store).any(app, ns.acl('origin')) // @@ TODO fix as\n if (!origin) {\n reject(new Error(`Unable to pick app: ${app.value}`))\n }\n const thingTR = widgets.personTR(this.groupList.controller.dom, ns.acl('origin'), origin, {})\n const innerTable = this.groupList.controller.dom.createElement('table')\n const innerRow = innerTable.appendChild(this.groupList.controller.dom.createElement('tr'))\n\n const innerLeftColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerLeftColumn.appendChild(thingTR)\n\n const innerMiddleColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerMiddleColumn.textContent = `Give access to ${this.groupList.controller.noun} ${utils.label(this.groupList.controller.subject)}?`\n\n const innerRightColumn = innerRow.appendChild(this.groupList.controller.dom.createElement('td'))\n innerRightColumn.appendChild(widgets.continueButton(this.groupList.controller.dom, () => resolve(origin!.value)))\n\n appsTable.appendChild(innerTable)\n })\n })\n }\n\n private renderCleanup (): void {\n this.renderBar()\n this.groupList.render()\n }\n\n private async addPerson (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a person and has an owner who agrees they own it\n debug.log(`Adding to ACL person: ${name}`)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addGroup (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a group and has an owner who agrees they own it\n debug.log('Adding to ACL group: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async addAgent (agentUri: string): Promise<void> {\n await this.groupList.addNewURI(agentUri)\n this.toggleBar()\n }\n\n private async addBot (name?: string): Promise<void> {\n if (!name) return this.toggleBar() // user cancelled\n const domainNameRegexp = /^https?:/i\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a http URI'))\n }\n // @@ check it actually is a bot and has an owner who agrees they own it\n debug.log('Adding to ACL bot: ' + name)\n await this.groupList.addNewURI(name)\n this.toggleBar()\n }\n\n private async getOriginFromName (name?: string): Promise<string | void> {\n if (!name) return Promise.resolve() // user cancelled\n const domainNameRegexp = /^([a-z0-9]+(-[a-z0-9]+)*\\.)+[a-z]{2,}$/i\n // https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html\n if (!name.match(domainNameRegexp)) {\n // @@ enforce in user input live like a form element\n return Promise.reject(new Error('Not a domain name'))\n }\n const origin = 'https://' + name\n debug.log('Adding to ACL origin: ' + origin)\n this.toggleBar()\n return origin\n }\n\n private toggleBar (): void {\n this.isExpanded = !this.isExpanded\n }\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAaU,IAAb,MAA6B;CAKN;CAJrB;CACA;CACA,aAA8B;CAE9B,YAAa,GAAiC;EAE5C,AAFmB,KAAA,YAAAC,GACnB,KAAK,cAAcA,EAAU,WAAW,IAAI,cAAc,KAAK,GAC/D,KAAK,aAAaA,EAAU,WAAW,IAAI,cAAc,KAAK;CAChE;CAEA,SAA8B;EAI5B,OAHA,KAAK,YAAY,YAAY,IAC7B,KAAK,YAAY,YAAY,KAAK,gBAAgB,CAAC,GACnD,KAAK,YAAY,YAAY,KAAK,UAAU,GACrC,KAAK;CACd;CAEA,kBAAwC;EACtC,OAAOX,EACL,KAAK,UAAU,WAAW,KAC1B,GAAGa,EAAM,SAAS,uBAClB,iBACM;GAEJ,AADA,KAAK,UAAU,GACf,KAAK,UAAU;EACjB,CACF;CACF;CAEA,YAA2B;EAEzB,AADA,KAAK,WAAW,YAAY,IACvB,KAAK,eAGV,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,GACrD,KAAK,WAAW,YAAY,KAAK,kBAAkB,CAAC,GACpD,KAAK,WAAW,YAAY,KAAK,mBAAmB,CAAC,GACrD,KAAK,WAAW,YAAY,KAAK,+BAA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,AAFA8B,EAAU,0BAA0B9B,CAAI,GACxC,MAAM,KAAK,UAAU,UAAUA,CAAI,GACnC,KAAK,UAAU;CACjB;CAEA,MAAc,SAAU,GAAiC;EAEvD,AADA,MAAM,KAAK,UAAU,UAAU+B,CAAQ,GACvC,KAAK,UAAU;CACjB;CAEA,MAAc,OAAQ,GAA8B;EAClD,IAAI,CAAC/B,GAAM,OAAO,KAAK,UAAU;EAEjC,IAAI,CAACA,EAAK,MAAM,WAAgB,GAE9B,OAAO,QAAQ,OAAO,gBAAI,MAAM,gBAAgB,CAAC;EAKnD,AAFA8B,EAAU,wBAAwB9B,CAAI,GACtC,MAAM,KAAK,UAAU,UAAUA,CAAI,GACnC,KAAK,UAAU;CACjB;CAEA,MAAc,kBAAmB,GAAuC;EACtE,IAAI,CAACA,GAAM,OAAO,QAAQ,QAAQ;EAGlC,IAAI,CAACA,EAAK,MAAM,yCAAgB,GAE9B,OAAO,QAAQ,OAAO,gBAAI,MAAM,mBAAmB,CAAC;EAEtD,IAAMU,IAAS,aAAaV;EAG5B,OAFA8B,EAAU,2BAA2BpB,CAAM,GAC3C,KAAK,UAAU,GACRA;CACT;CAEA,YAA2B;EACzB,KAAK,aAAa,CAAC,KAAK;CAC1B;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as e, i as t, o as n, v as r } from "./components-
|
|
2
|
-
import { t as i } from "./provide-
|
|
1
|
+
import { g as e, i as t, o as n, v as r } from "./components-CVuqsI0R.js";
|
|
2
|
+
import { t as i } from "./provide-BQN7o60i.js";
|
|
3
3
|
// src/components/dialog-provider/DialogProvider.ts
|
|
4
4
|
var a, o, s, c, l, u, d, f, p;
|
|
5
5
|
function m(e, t, n) {
|
|
@@ -205,4 +205,4 @@ p = (l = t({
|
|
|
205
205
|
]], c, 0, void 0, n), s();
|
|
206
206
|
export { w as t };
|
|
207
207
|
|
|
208
|
-
//# sourceMappingURL=DialogProvider-
|
|
208
|
+
//# sourceMappingURL=DialogProvider-DwymaGN5.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogProvider-
|
|
1
|
+
{"version":3,"file":"DialogProvider-DwymaGN5.js","names":["customElement","WebComponent","provide","property","dialogContext","_classDecs","_DialogProvider","_A","WeakMap","_B","_ref","_dialogIdDecs","type","String","reflect","_dialogDecs","context","DialogProvider","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_dialogId","_init_dialog","id","_classPrivateFieldGet","dialogId","v","_classPrivateFieldSet","dialog","willUpdate","changedProperties","has","firstUpdated","slot","shadowRoot","querySelector","dispatchEvent","CustomEvent","bubbles","composed","detail","assignedElements","_DialogProvider2","e","c","_initClass","_applyDecs","default","property","provide","customElement","n","WebComponent","dialogContext","e","_DialogProvider2","_initProto","_initClass","_classDecs","_dialogIdDecs","_init_dialogId","_dialogDecs","_init_dialog","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_applyDecs","i","o","c","applyDec","m","h","y","v","g","b","u","w","S","A","d","p","_setFunctionName","P","j","D","E","I","O","k","F","l","f","N","_checkInRHS","_toPropertyKey","_toPrimitive","t","_DialogProvider","_A","_B","args","changedProperties","slot"],"sources":["../../src/components/dialog-provider/DialogProvider.ts"],"sourcesContent":["import { customElement, WebComponent } from '@/lib/components'\nimport { provide } from '@lit/context'\nimport { property } from 'lit/decorators.js'\nimport { DialogContext, dialogContext } from '@/lib/dialogs/context'\nimport type { PropertyValues } from 'lit'\n\n@customElement('solid-ui-dialog-provider')\nexport default class DialogProvider extends WebComponent {\n @property({ type: String, reflect: true })\n accessor dialogId: string | undefined\n\n @provide({ context: dialogContext })\n private accessor dialog: DialogContext = { id: '' }\n\n protected willUpdate (changedProperties: PropertyValues<this>) {\n super.willUpdate(changedProperties)\n\n if (changedProperties.has('dialogId') && this.dialogId) {\n this.dialog = { id: this.dialogId }\n }\n }\n\n protected firstUpdated () {\n const slot = this.shadowRoot?.querySelector('sl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cAAc,MAAM;EAElD,KAAKC,cAAc,IAAIC,YAAY,WAAW;GAAEC,SAAS;GAAMC,UAAU;GAAMC,QAAQP,GAAMQ,iBAAiB,CAAC,CAAC;EAAG,CAAC,CAAC;CACvH;AACF,GAAC,CAAAE,GAAA,CAAAtB,GAAAC,GAAAF,IAAAwB,GAAA,CAAAvC,GAAAwC,MAAAC,EAAAJ,GAAA,CAAA;CAAAhC;CAAA;CAAA;AAAA,GAAA;CAAAI;CAAA;CAAA;AAAA,CAAA,GAAAV,GAAA,GAAA,KAAA,GApB2CJ,CAAY,GAAA6C,EAAA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as e, g as t, i as n, o as r, p as i, u as a } from "./components-
|
|
2
|
-
import "./button-
|
|
3
|
-
import "./menu-
|
|
4
|
-
import "./menu-item-
|
|
1
|
+
import { c as e, g as t, i as n, o as r, p as i, u as a } from "./components-CVuqsI0R.js";
|
|
2
|
+
import "./button-D7XurXfj.js";
|
|
3
|
+
import "./menu-pe4NxtfD.js";
|
|
4
|
+
import "./menu-item-EARrOY8C.js";
|
|
5
5
|
import "./square-arrow-out-up-right-DaALlpHo.js";
|
|
6
|
-
import {
|
|
6
|
+
import { b as o, t as s } from "./solidLogicSingleton.esm-CKYdvLzf.js";
|
|
7
7
|
// ~icons/lucide/pencil
|
|
8
8
|
var c = class extends HTMLElement {
|
|
9
9
|
constructor() {
|
|
@@ -22,14 +22,14 @@ customElements.get("icon-lucide-ellipsis-vertical") || customElements.define("ic
|
|
|
22
22
|
function u(e, t) {
|
|
23
23
|
if (!e || !t) return !1;
|
|
24
24
|
let n = e.sym(t), r = e.findTypeURIs(n);
|
|
25
|
-
return !!(r[
|
|
25
|
+
return !!(r[o.ldp("Container").uri] || r[o.ldp("BasicContainer").uri] || n.uri.endsWith("/"));
|
|
26
26
|
}
|
|
27
27
|
function d(e, t) {
|
|
28
28
|
if (!e || !t) return 0;
|
|
29
29
|
let n = e.sym(t), r = /* @__PURE__ */ new Set();
|
|
30
|
-
for (let t of e.each(n,
|
|
30
|
+
for (let t of e.each(n, o.ldp("contains"))) if (t.termType === "NamedNode") {
|
|
31
31
|
let e = t;
|
|
32
|
-
|
|
32
|
+
s.resource.isHiddenFile(e) || r.add(e.uri);
|
|
33
33
|
}
|
|
34
34
|
return r.size;
|
|
35
35
|
}
|
|
@@ -384,4 +384,4 @@ new (q = (_ = /*#__PURE__*/ new WeakMap(), v = /*#__PURE__*/ new WeakMap(), y =
|
|
|
384
384
|
}, Q(h, q, void 0), h)();
|
|
385
385
|
export { d as n, u as r, $ as t };
|
|
386
386
|
|
|
387
|
-
//# sourceMappingURL=ResourceActionsMenu-
|
|
387
|
+
//# sourceMappingURL=ResourceActionsMenu-mLMf4fAa.js.map
|
package/dist/chunks/{ResourceActionsMenu-Dm1hvIj5.js.map → ResourceActionsMenu-mLMf4fAa.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResourceActionsMenu-Dm1hvIj5.js","names":["solidLogicSingleton","store","ns","parse","isWebIdUri","getPodStorages","url","fetcher","load","doc","err","console","warn","uri","podStorages","each","space","results","Promise","all","map","pod","isPodStorage","filter","storage","findPodStorageFromUrl","error","podStorage","URL","value","pathStorage","pathname","length","substring","lastIndexOf","candidate","sym","origin","loadContainerRepresentation","holds","rdf","subject","any","ldp","undefined","response","webOperation","initFetchOptions","headers","accept","containerTurtle","responseText","isContainerSubject","subjectUri","typeUris","findTypeURIs","Boolean","endsWith","getContainerItemCount","seen","Set","item","termType","resource","isHiddenFile","add","size","ns","solidLogicSingleton","customElement","WebComponent","property","html","nothing","styles","isContainerSubject","_classDecs","_ResourceActionsMenu","_ResourceActionsMenu2","_A","WeakMap","_B","_C","_D","_E","_F","_G","_H","_I","_J","_ref","_storeDecs","attribute","_subjectUriDecs","type","String","_handleAccessClickDecs","_handleEditingClickDecs","_paneSupportsEditingDecs","Boolean","_canEditDecs","_canManageAccessDecs","_isMobileDecs","_showAccessInMenuDecs","_menuItemsDecs","_ResourceActionsMenu3","ResourceActionsMenu","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_store","_init_subjectUri","_init_handleAccessClick","undefined","_init_handleEditingClick","_init_paneSupportsEditing","_init_canEdit","_init_canManageAccess","_init_isMobile","_init_showAccessInMenu","_init_menuItems","_defineProperty","subjectUri","window","open","_classPrivateFieldGet","store","v","_classPrivateFieldSet","handleAccessClick","handleEditingClick","paneSupportsEditing","canEdit","canManageAccess","isMobile","showAccessInMenu","menuItems","render","isContainerResource","actionableMenuItems","filter","item","action","map","event","icon","label","handleOpenInNewTab","e","c","_initClass","_applyDecs","_Class","_identity","default","property","nothing","styles","A","customElement","WebComponent","b","c","ns_default","iconlucidepencil","iconlucideellipsisvertical","isContainerSubject","store","subjectUri","subject","typeUris","getContainerItemCount","seen","item","resource","iconlucideuserroundcog","iconlucidefile","ResourceActionsMenu_styles_default","_Class","_ResourceActionsMenu3","_A","_B","_C","_D","_E","_F","_G","_H","_I","_J","_initProto","_initClass","_classDecs","_storeDecs","_init_store","_subjectUriDecs","_init_subjectUri","_handleAccessClickDecs","_init_handleAccessClick","_handleEditingClickDecs","_init_handleEditingClick","_paneSupportsEditingDecs","_init_paneSupportsEditing","_canEditDecs","_init_canEdit","_canManageAccessDecs","_init_canManageAccess","_isMobileDecs","_init_isMobile","_showAccessInMenuDecs","_init_showAccessInMenu","_menuItemsDecs","_init_menuItems","_ResourceActionsMenu2","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_defineProperty","_toPropertyKey","t","_applyDecs","i","n","o","applyDec","m","h","y","v","g","u","w","S","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","e","_identity","_ResourceActionsMenu","args","canEdit","canManageAccess","actionableMenuItems","event"],"sources":["../../src/utils/podUtils.ts","../../src/components/resource-actions-menu/ResourceActionsMenu.styles.css","../../src/components/resource-actions-menu/ResourceActionsMenu.ts"],"sourcesContent":["import { solidLogicSingleton, store } from 'solid-logic'\nimport ns from '@/lib/ns'\nimport { LiveStore, NamedNode, parse } from 'rdflib'\nimport { isWebIdUri } from './webIdUtils'\n\nexport async function getPodStorages (url: NamedNode): Promise<NamedNode[]> {\n if (isWebIdUri(url)) {\n try {\n await store.fetcher.load(url.doc())\n } catch (err) {\n console.warn('Unable to load profile document for WebID', url.doc().uri, err)\n }\n const podStorages = store.each(url, ns.space('storage'))\n const results = await Promise.all(podStorages.map(async pod => await isPodStorage(pod as NamedNode) ? pod as NamedNode : null))\n return results.filter(pod => pod !== null) as NamedNode[]\n }\n try {\n const storage = await findPodStorageFromUrl(url)\n return storage ? [storage] : []\n } catch (err) {\n console.error('cannot load container', err)\n return []\n }\n}\n\nasync function findPodStorageFromUrl (url: NamedNode): Promise<NamedNode | null> {\n const podStorage = new URL(url.value || url.uri)\n let pathStorage = podStorage.pathname\n\n while (pathStorage.length) {\n pathStorage = pathStorage.substring(0, pathStorage.lastIndexOf('/'))\n const candidate = store.sym(`${podStorage.origin}${pathStorage}/`)\n if (await isPodStorage(candidate)) return candidate\n }\n\n // TODO should url.origin be added to pods list when there are no pim:Storage ???\n return null\n}\n\nasync function isPodStorage (pod: NamedNode): Promise<boolean> {\n await loadContainerRepresentation(pod)\n return store.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())\n}\n\nexport async function loadContainerRepresentation (subject) {\n // force reload for index.html with RDFa\n if (!store.any(subject, ns.ldp('contains'), undefined, subject.doc())) {\n try {\n const response = await store.fetcher.webOperation('GET', subject.uri, store.fetcher.initFetchOptions(subject.uri, { headers: { accept: 'text/turtle' } }))\n const containerTurtle = response.responseText\n if (subject.uri && containerTurtle) {\n parse(containerTurtle, store, subject.uri, 'text/turtle')\n }\n } catch (err) {\n console.warn('Unable to load container representation for', subject.uri, err)\n }\n }\n}\n\nexport function isContainerSubject (store: LiveStore | undefined, subjectUri: string | undefined): boolean {\n if (!store || !subjectUri) return false\n\n const subject = store.sym(subjectUri)\n const typeUris = store.findTypeURIs(subject)\n return Boolean(\n typeUris[ns.ldp('Container').uri] ||\n typeUris[ns.ldp('BasicContainer').uri] ||\n subject.uri.endsWith('/')\n )\n}\n\n// The shared rdflib store can hold duplicate ldp:contains statements for the\n// same child resource when the container and companion metadata are both loaded.\n// Count unique visible children here so the header summary matches the list UI.\nexport function getContainerItemCount (store: LiveStore | undefined, subjectUri: string | undefined): number {\n if (!store || !subjectUri) return 0\n\n const subject = store.sym(subjectUri)\n const seen = new Set<string>()\n\n for (const item of store.each(subject, ns.ldp('contains'))) {\n if (item.termType === 'NamedNode') {\n const resource = item as NamedNode\n if (!solidLogicSingleton.resource.isHiddenFile(resource)) {\n seen.add(resource.uri)\n }\n }\n }\n return seen.size\n}\n",":host {\n .file-explorer-header-more-button {\n width: var(--solid-ui-clickable-area, 42px);\n height: var(--solid-ui-clickable-area, 42px);\n padding: 0;\n }\n\n .ellipsisIcon {\n width: 16px;\n height: 16px;\n }\n}\n","import { customElement, WebComponent } from '@/lib/components'\nimport { property } from 'lit/decorators.js'\nimport { html, nothing } from 'lit'\nimport '@/components/button'\nimport '@/components/menu'\nimport '@/components/menu-item'\nimport '~icons/lucide/ellipsis-vertical'\nimport '~icons/lucide/user-round-cog'\nimport '~icons/lucide/pencil'\nimport '~icons/lucide/file'\nimport '~icons/lucide/square-arrow-out-up-right'\nimport { LiveStore } from 'rdflib'\nimport styles from './ResourceActionsMenu.styles.css'\nimport { isContainerSubject } from '@/utils/podUtils'\n\ntype ResourceActionMenuItem = {\n label: string\n icon?: HTMLElement | string\n action?: (event: Event) => void\n}\n\ntype ActionableResourceActionMenuItem = ResourceActionMenuItem & {\n action: (event: Event) => void\n}\n\n@customElement('solid-ui-resource-actions-menu')\nexport default class ResourceActionsMenu extends WebComponent {\n static styles = styles\n\n @property({ attribute: false })\n accessor store: LiveStore | undefined\n\n @property({ type: String })\n accessor subjectUri: string | undefined\n\n @property({ attribute: false })\n accessor handleAccessClick: (() => void) | undefined = undefined\n\n @property({ attribute: false })\n accessor handleEditingClick: (() => void) | undefined = undefined\n\n @property({ type: Boolean })\n accessor paneSupportsEditing = false\n\n @property({ type: Boolean })\n accessor canEdit = false\n\n @property({ type: Boolean })\n accessor canManageAccess = false\n\n @property({ type: Boolean })\n accessor isMobile = false\n\n @property({ type: Boolean, attribute: 'show-access-in-menu' })\n accessor showAccessInMenu = false\n\n @property({ attribute: false })\n accessor menuItems: ResourceActionMenuItem[] = []\n\n private handleOpenInNewTab = () => {\n if (!this.subjectUri) return\n window.open(this.subjectUri, '_blank', 'noopener,noreferrer')\n }\n\n render () {\n const isContainerResource = isContainerSubject(this.store, this.subjectUri)\n const canEdit = !isContainerResource && this.isMobile && this.paneSupportsEditing && this.canEdit && !!this.handleEditingClick\n const canManageAccess = this.canManageAccess && !!this.handleAccessClick &&\n (this.showAccessInMenu || this.isMobile)\n const actionableMenuItems = this.menuItems.filter((item): item is ActionableResourceActionMenuItem => typeof item.action === 'function')\n return html`\n <solid-ui-menu>\n <solid-ui-button slot=\"trigger\" class=\"file-explorer-header-more-button\" variant=\"ghost\" title=\"More options\">\n <icon-lucide-ellipsis-vertical slot=\"icon\" class=\"ellipsisIcon\"></icon-lucide-ellipsis-vertical>\n <span class=\"sr-only\">More options</span>\n </solid-ui-button>\n ${actionableMenuItems.map(item => html`\n <solid-ui-menu-item @solid-ui-select=${(event: Event) => item.action(event)}>\n ${typeof item.icon === 'string'\n ? html`<img slot=\"left-icon\" src=${item.icon} alt=\"\">`\n : item.icon ?? html`<icon-lucide-file slot=\"left-icon\" aria-hidden=\"true\"></icon-lucide-file>`}\n ${item.label}\n </solid-ui-menu-item>\n `)}\n ${this.subjectUri\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleOpenInNewTab}>\n <icon-lucide-square-arrow-out-up-right slot=\"left-icon\"></icon-lucide-square-arrow-out-up-right>\n Open in New Tab\n </solid-ui-menu-item>\n `\n : nothing}\n ${canEdit\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleEditingClick}>\n <icon-lucide-pencil slot=\"left-icon\"></icon-lucide-pencil>\n Edit\n </solid-ui-menu-item>\n `\n : nothing}\n ${canManageAccess\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleAccessClick}>\n <icon-lucide-user-round-cog slot=\"left-icon\"></icon-lucide-user-round-cog>\n Manage Access\n </solid-ui-menu-item>\n `\n : nothing}\n </solid-ui-menu>\n `\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBoD,EAAoBnD,GAA8BoD,GAAyC;CACzG,IAAI,CAACpD,KAAS,CAACoD,GAAY,OAAO;CAElC,IAAMZ,IAAUxC,EAAMmC,IAAIiB,CAAU,GAC9BC,IAAWrD,EAAMsD,aAAad,CAAO;CAC3C,OAAOe,GACLF,EAASpD,EAAGyC,IAAI,WAAW,CAAC,CAAC9B,QAC7ByC,EAASpD,EAAGyC,IAAI,gBAAgB,CAAC,CAAC9B,QAClC4B,EAAQ5B,IAAI4C,SAAS,GAAG;AAE5B;AAKA,SAAgBC,EAAuBzD,GAA8BoD,GAAwC;CAC3G,IAAI,CAACpD,KAAS,CAACoD,GAAY,OAAO;CAElC,IAAMZ,IAAUxC,EAAMmC,IAAIiB,CAAU,GAC9BM,oBAAO,IAAIC,IAAY;CAE7B,KAAK,IAAMC,KAAQ5D,EAAMc,KAAK0B,GAASvC,EAAGyC,IAAI,UAAU,CAAC,GACvD,IAAIkB,EAAKC,aAAa,aAAa;EACjC,IAAMC,IAAWF;EACjB,AAAK7D,EAAoB+D,SAASC,aAAaD,CAAQ,KACrDJ,EAAKM,IAAIF,EAASlD,GAAG;CAEzB;CAEF,OAAO8C,EAAKO;AACd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D,EAAO;UACT6D,IACE9D,CAAI;qDACqC,KAAK0D,kBAAiB;;;;gBAK/DzD,EAAO;;;CAGjB;AACF,GAAC,CAAA4E,GAAA,CAAAtC,GAAAC,GAAAC,IAAAE,IAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAC,GAAAX,IAAAwC,GAAA,CAAAzE,GAAA0E,MAAAC,GAAA/C,GAAA;CAAA;EAAAd;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAG;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAE;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;CAAA;EAAAC;EAAA;EAAA;CAAA;AAAA,GAAA5B,GAAA,GAAA,KAAA,GArFgDN,CAAY,GAAAmC,IAAAgD,IAAA,cAAAC,GAAA;CAAA/C,cAAA;EAAA,MAAA9B,CAAA,GAAA6C,EAAA,MAAA,UAC3ChD,CAAM,GAAA6E,EAAA;CAAA;AAAA,GAAA7B,EAAA+B,GAAA3E,GAAA,KAAA,CAAA,GAAA2E,GAAA"}
|
|
1
|
+
{"version":3,"file":"ResourceActionsMenu-mLMf4fAa.js","names":["solidLogicSingleton","store","ns","parse","isWebIdUri","getPodStorages","url","fetcher","load","doc","err","console","warn","uri","podStorages","each","space","results","Promise","all","map","pod","isPodStorage","filter","storage","findPodStorageFromUrl","error","podStorage","URL","value","pathStorage","pathname","length","substring","lastIndexOf","candidate","sym","origin","loadContainerRepresentation","holds","rdf","subject","any","ldp","undefined","response","webOperation","initFetchOptions","headers","accept","containerTurtle","responseText","isContainerSubject","subjectUri","typeUris","findTypeURIs","Boolean","endsWith","getContainerItemCount","seen","Set","item","termType","resource","isHiddenFile","add","size","ns","solidLogicSingleton","customElement","WebComponent","property","html","nothing","styles","isContainerSubject","_classDecs","_ResourceActionsMenu","_ResourceActionsMenu2","_A","WeakMap","_B","_C","_D","_E","_F","_G","_H","_I","_J","_ref","_storeDecs","attribute","_subjectUriDecs","type","String","_handleAccessClickDecs","_handleEditingClickDecs","_paneSupportsEditingDecs","Boolean","_canEditDecs","_canManageAccessDecs","_isMobileDecs","_showAccessInMenuDecs","_menuItemsDecs","_ResourceActionsMenu3","ResourceActionsMenu","constructor","args","_classPrivateFieldInitSpec","_initProto","_init_store","_init_subjectUri","_init_handleAccessClick","undefined","_init_handleEditingClick","_init_paneSupportsEditing","_init_canEdit","_init_canManageAccess","_init_isMobile","_init_showAccessInMenu","_init_menuItems","_defineProperty","subjectUri","window","open","_classPrivateFieldGet","store","v","_classPrivateFieldSet","handleAccessClick","handleEditingClick","paneSupportsEditing","canEdit","canManageAccess","isMobile","showAccessInMenu","menuItems","render","isContainerResource","actionableMenuItems","filter","item","action","map","event","icon","label","handleOpenInNewTab","e","c","_initClass","_applyDecs","_Class","_identity","default","property","nothing","styles","A","customElement","WebComponent","b","ns_default","c","iconlucidepencil","iconlucideellipsisvertical","isContainerSubject","store","subjectUri","subject","typeUris","getContainerItemCount","seen","item","resource","iconlucideuserroundcog","iconlucidefile","ResourceActionsMenu_styles_default","_Class","_ResourceActionsMenu3","_A","_B","_C","_D","_E","_F","_G","_H","_I","_J","_initProto","_initClass","_classDecs","_storeDecs","_init_store","_subjectUriDecs","_init_subjectUri","_handleAccessClickDecs","_init_handleAccessClick","_handleEditingClickDecs","_init_handleEditingClick","_paneSupportsEditingDecs","_init_paneSupportsEditing","_canEditDecs","_init_canEdit","_canManageAccessDecs","_init_canManageAccess","_isMobileDecs","_init_isMobile","_showAccessInMenuDecs","_init_showAccessInMenu","_menuItemsDecs","_init_menuItems","_ResourceActionsMenu2","_ref","_classPrivateFieldInitSpec","a","_checkPrivateRedeclaration","_classPrivateFieldSet","s","_assertClassBrand","r","_classPrivateFieldGet","_defineProperty","_toPropertyKey","t","_applyDecs","i","n","o","applyDec","m","h","y","v","g","u","w","S","d","p","_setFunctionName","P","j","D","I","F","l","f","N","_checkInRHS","_toPrimitive","e","_identity","_ResourceActionsMenu","args","canEdit","canManageAccess","actionableMenuItems","event"],"sources":["../../src/utils/podUtils.ts","../../src/components/resource-actions-menu/ResourceActionsMenu.styles.css","../../src/components/resource-actions-menu/ResourceActionsMenu.ts"],"sourcesContent":["import { solidLogicSingleton, store } from 'solid-logic'\nimport ns from '@/lib/ns'\nimport { LiveStore, NamedNode, parse } from 'rdflib'\nimport { isWebIdUri } from './webIdUtils'\n\nexport async function getPodStorages (url: NamedNode): Promise<NamedNode[]> {\n if (isWebIdUri(url)) {\n try {\n await store.fetcher.load(url.doc())\n } catch (err) {\n console.warn('Unable to load profile document for WebID', url.doc().uri, err)\n }\n const podStorages = store.each(url, ns.space('storage'))\n const results = await Promise.all(podStorages.map(async pod => await isPodStorage(pod as NamedNode) ? pod as NamedNode : null))\n return results.filter(pod => pod !== null) as NamedNode[]\n }\n try {\n const storage = await findPodStorageFromUrl(url)\n return storage ? [storage] : []\n } catch (err) {\n console.error('cannot load container', err)\n return []\n }\n}\n\nasync function findPodStorageFromUrl (url: NamedNode): Promise<NamedNode | null> {\n const podStorage = new URL(url.value || url.uri)\n let pathStorage = podStorage.pathname\n\n while (pathStorage.length) {\n pathStorage = pathStorage.substring(0, pathStorage.lastIndexOf('/'))\n const candidate = store.sym(`${podStorage.origin}${pathStorage}/`)\n if (await isPodStorage(candidate)) return candidate\n }\n\n // TODO should url.origin be added to pods list when there are no pim:Storage ???\n return null\n}\n\nasync function isPodStorage (pod: NamedNode): Promise<boolean> {\n await loadContainerRepresentation(pod)\n return store.holds(pod, ns.rdf('type'), ns.space('Storage'), pod.doc())\n}\n\nexport async function loadContainerRepresentation (subject) {\n // force reload for index.html with RDFa\n if (!store.any(subject, ns.ldp('contains'), undefined, subject.doc())) {\n try {\n const response = await store.fetcher.webOperation('GET', subject.uri, store.fetcher.initFetchOptions(subject.uri, { headers: { accept: 'text/turtle' } }))\n const containerTurtle = response.responseText\n if (subject.uri && containerTurtle) {\n parse(containerTurtle, store, subject.uri, 'text/turtle')\n }\n } catch (err) {\n console.warn('Unable to load container representation for', subject.uri, err)\n }\n }\n}\n\nexport function isContainerSubject (store: LiveStore | undefined, subjectUri: string | undefined): boolean {\n if (!store || !subjectUri) return false\n\n const subject = store.sym(subjectUri)\n const typeUris = store.findTypeURIs(subject)\n return Boolean(\n typeUris[ns.ldp('Container').uri] ||\n typeUris[ns.ldp('BasicContainer').uri] ||\n subject.uri.endsWith('/')\n )\n}\n\n// The shared rdflib store can hold duplicate ldp:contains statements for the\n// same child resource when the container and companion metadata are both loaded.\n// Count unique visible children here so the header summary matches the list UI.\nexport function getContainerItemCount (store: LiveStore | undefined, subjectUri: string | undefined): number {\n if (!store || !subjectUri) return 0\n\n const subject = store.sym(subjectUri)\n const seen = new Set<string>()\n\n for (const item of store.each(subject, ns.ldp('contains'))) {\n if (item.termType === 'NamedNode') {\n const resource = item as NamedNode\n if (!solidLogicSingleton.resource.isHiddenFile(resource)) {\n seen.add(resource.uri)\n }\n }\n }\n return seen.size\n}\n",":host {\n .file-explorer-header-more-button {\n width: var(--solid-ui-clickable-area, 42px);\n height: var(--solid-ui-clickable-area, 42px);\n padding: 0;\n }\n\n .ellipsisIcon {\n width: 16px;\n height: 16px;\n }\n}\n","import { customElement, WebComponent } from '@/lib/components'\nimport { property } from 'lit/decorators.js'\nimport { html, nothing } from 'lit'\nimport '@/components/button'\nimport '@/components/menu'\nimport '@/components/menu-item'\nimport '~icons/lucide/ellipsis-vertical'\nimport '~icons/lucide/user-round-cog'\nimport '~icons/lucide/pencil'\nimport '~icons/lucide/file'\nimport '~icons/lucide/square-arrow-out-up-right'\nimport { LiveStore } from 'rdflib'\nimport styles from './ResourceActionsMenu.styles.css'\nimport { isContainerSubject } from '@/utils/podUtils'\n\ntype ResourceActionMenuItem = {\n label: string\n icon?: HTMLElement | string\n action?: (event: Event) => void\n}\n\ntype ActionableResourceActionMenuItem = ResourceActionMenuItem & {\n action: (event: Event) => void\n}\n\n@customElement('solid-ui-resource-actions-menu')\nexport default class ResourceActionsMenu extends WebComponent {\n static styles = styles\n\n @property({ attribute: false })\n accessor store: LiveStore | undefined\n\n @property({ type: String })\n accessor subjectUri: string | undefined\n\n @property({ attribute: false })\n accessor handleAccessClick: (() => void) | undefined = undefined\n\n @property({ attribute: false })\n accessor handleEditingClick: (() => void) | undefined = undefined\n\n @property({ type: Boolean })\n accessor paneSupportsEditing = false\n\n @property({ type: Boolean })\n accessor canEdit = false\n\n @property({ type: Boolean })\n accessor canManageAccess = false\n\n @property({ type: Boolean })\n accessor isMobile = false\n\n @property({ type: Boolean, attribute: 'show-access-in-menu' })\n accessor showAccessInMenu = false\n\n @property({ attribute: false })\n accessor menuItems: ResourceActionMenuItem[] = []\n\n private handleOpenInNewTab = () => {\n if (!this.subjectUri) return\n window.open(this.subjectUri, '_blank', 'noopener,noreferrer')\n }\n\n render () {\n const isContainerResource = isContainerSubject(this.store, this.subjectUri)\n const canEdit = !isContainerResource && this.isMobile && this.paneSupportsEditing && this.canEdit && !!this.handleEditingClick\n const canManageAccess = this.canManageAccess && !!this.handleAccessClick &&\n (this.showAccessInMenu || this.isMobile)\n const actionableMenuItems = this.menuItems.filter((item): item is ActionableResourceActionMenuItem => typeof item.action === 'function')\n return html`\n <solid-ui-menu>\n <solid-ui-button slot=\"trigger\" class=\"file-explorer-header-more-button\" variant=\"ghost\" title=\"More options\">\n <icon-lucide-ellipsis-vertical slot=\"icon\" class=\"ellipsisIcon\"></icon-lucide-ellipsis-vertical>\n <span class=\"sr-only\">More options</span>\n </solid-ui-button>\n ${actionableMenuItems.map(item => html`\n <solid-ui-menu-item @solid-ui-select=${(event: Event) => item.action(event)}>\n ${typeof item.icon === 'string'\n ? html`<img slot=\"left-icon\" src=${item.icon} alt=\"\">`\n : item.icon ?? html`<icon-lucide-file slot=\"left-icon\" aria-hidden=\"true\"></icon-lucide-file>`}\n ${item.label}\n </solid-ui-menu-item>\n `)}\n ${this.subjectUri\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleOpenInNewTab}>\n <icon-lucide-square-arrow-out-up-right slot=\"left-icon\"></icon-lucide-square-arrow-out-up-right>\n Open in New Tab\n </solid-ui-menu-item>\n `\n : nothing}\n ${canEdit\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleEditingClick}>\n <icon-lucide-pencil slot=\"left-icon\"></icon-lucide-pencil>\n Edit\n </solid-ui-menu-item>\n `\n : nothing}\n ${canManageAccess\n ? html`\n <solid-ui-menu-item @solid-ui-select=${this.handleAccessClick}>\n <icon-lucide-user-round-cog slot=\"left-icon\"></icon-lucide-user-round-cog>\n Manage Access\n </solid-ui-menu-item>\n `\n : nothing}\n </solid-ui-menu>\n `\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2DA,SAAgBoD,EAAoBnD,GAA8BoD,GAAyC;CACzG,IAAI,CAACpD,KAAS,CAACoD,GAAY,OAAO;CAElC,IAAMZ,IAAUxC,EAAMmC,IAAIiB,CAAU,GAC9BC,IAAWrD,EAAMsD,aAAad,CAAO;CAC3C,OAAOe,GACLF,EAASpD,EAAGyC,IAAI,WAAW,CAAC,CAAC9B,QAC7ByC,EAASpD,EAAGyC,IAAI,gBAAgB,CAAC,CAAC9B,QAClC4B,EAAQ5B,IAAI4C,SAAS,GAAG;AAE5B;AAKA,SAAgBC,EAAuBzD,GAA8BoD,GAAwC;CAC3G,IAAI,CAACpD,KAAS,CAACoD,GAAY,OAAO;CAElC,IAAMZ,IAAUxC,EAAMmC,IAAIiB,CAAU,GAC9BM,oBAAO,IAAIC,IAAY;CAE7B,KAAK,IAAMC,KAAQ5D,EAAMc,KAAK0B,GAASvC,EAAGyC,IAAI,UAAU,CAAC,GACvD,IAAIkB,EAAKC,aAAa,aAAa;EACjC,IAAMC,IAAWF;EACjB,AAAK7D,EAAoB+D,SAASC,aAAaD,CAAQ,KACrDJ,EAAKM,IAAI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