@pod-os/elements 0.26.1-rc.e49d800.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/dist/cjs/{BrokenFile-26f83028.js → BrokenFile-a5fc0832.js} +22 -6
  2. package/dist/cjs/BrokenFile-a5fc0832.js.map +1 -0
  3. package/dist/cjs/app-globals-97a7ec18.js +23 -0
  4. package/dist/cjs/app-globals-97a7ec18.js.map +1 -0
  5. package/dist/cjs/elements.cjs.js +2 -2
  6. package/dist/cjs/ion-badge_5.cjs.entry.js +1 -1
  7. package/dist/cjs/ion-icon_32.cjs.entry.js +9150 -0
  8. package/dist/cjs/ion-icon_32.cjs.entry.js.map +1 -0
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/pos-app-generic.cjs.entry.js +1 -1
  11. package/dist/cjs/pos-app-ldp-container.cjs.entry.js +1 -1
  12. package/dist/cjs/pos-app-rdf-document.cjs.entry.js +1 -1
  13. package/dist/cjs/pos-document.cjs.entry.js +1 -1
  14. package/dist/collection/apps/pos-app-browser/pos-app-browser.js +2 -1
  15. package/dist/collection/apps/pos-app-browser/pos-app-browser.js.map +1 -1
  16. package/dist/collection/apps/pos-app-dashboard/pos-app-dashboard.js +1 -1
  17. package/dist/collection/apps/pos-app-dashboard/pos-example-resources/pos-example-resources.js +1 -1
  18. package/dist/collection/apps/pos-app-dashboard/pos-getting-started/pos-getting-started.js +1 -1
  19. package/dist/collection/apps/pos-app-generic/pos-app-generic.js +1 -1
  20. package/dist/collection/apps/pos-app-ldp-container/pos-app-ldp-container.js +1 -1
  21. package/dist/collection/apps/pos-app-rdf-document/pos-app-rdf-document.js +1 -1
  22. package/dist/collection/apps/pos-app-settings/pos-app-settings.js +1 -1
  23. package/dist/collection/apps/pos-app-settings/pos-setting-offline-cache/pos-setting-offline-cache.js +1 -1
  24. package/dist/collection/collection-manifest.json +1 -0
  25. package/dist/collection/components/pos-add-new-thing/pos-add-new-thing.js +1 -1
  26. package/dist/collection/components/pos-app/pos-app.js +1 -1
  27. package/dist/collection/components/pos-dialog/pos-dialog.js +15 -5
  28. package/dist/collection/components/pos-dialog/pos-dialog.js.map +1 -1
  29. package/dist/collection/components/pos-error-toast/pos-error-toast.js +1 -1
  30. package/dist/collection/components/pos-literals/pos-literals.js +1 -1
  31. package/dist/collection/components/pos-login/pos-login.js +21 -2
  32. package/dist/collection/components/pos-login/pos-login.js.map +1 -1
  33. package/dist/collection/components/pos-login-form/pos-login-form.js +1 -1
  34. package/dist/collection/components/pos-make-findable/pos-make-findable.css +2 -55
  35. package/dist/collection/components/pos-make-findable/pos-make-findable.js +15 -26
  36. package/dist/collection/components/pos-make-findable/pos-make-findable.js.map +1 -1
  37. package/dist/collection/components/pos-make-findable/shoelace.js +4 -0
  38. package/dist/collection/components/pos-make-findable/shoelace.js.map +1 -0
  39. package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.js +1 -1
  40. package/dist/collection/components/pos-navigation/pos-navigation.js +1 -1
  41. package/dist/collection/components/pos-new-thing-form/pos-new-thing-form.js +1 -1
  42. package/dist/collection/components/pos-picture/pos-picture.js +1 -1
  43. package/dist/collection/components/pos-picture/pos-picture.js.map +1 -1
  44. package/dist/collection/components/pos-rich-link/pos-rich-link.js +2 -2
  45. package/dist/collection/components/pos-router/pos-router.js +1 -1
  46. package/dist/collection/components/pos-select-term/pos-select-term.js +1 -1
  47. package/dist/collection/components/pos-user-menu/pos-user-menu.css +23 -0
  48. package/dist/collection/components/pos-user-menu/pos-user-menu.js +102 -0
  49. package/dist/collection/components/pos-user-menu/pos-user-menu.js.map +1 -0
  50. package/dist/collection/components/pos-user-menu/shoelace.js +6 -0
  51. package/dist/collection/components/pos-user-menu/shoelace.js.map +1 -0
  52. package/dist/collection/global.js +6 -0
  53. package/dist/collection/global.js.map +1 -1
  54. package/dist/components/chunk.HVTXQL7M.js +4775 -0
  55. package/dist/components/chunk.HVTXQL7M.js.map +1 -0
  56. package/dist/components/index.js +7 -0
  57. package/dist/components/index.js.map +1 -1
  58. package/dist/components/index11.js +21 -5
  59. package/dist/components/index11.js.map +1 -1
  60. package/dist/components/pos-add-new-thing2.js +1 -1
  61. package/dist/components/pos-app-browser.js +68 -61
  62. package/dist/components/pos-app-browser.js.map +1 -1
  63. package/dist/components/pos-app-dashboard2.js +1 -1
  64. package/dist/components/pos-app-generic.js +1 -1
  65. package/dist/components/pos-app-ldp-container.js +1 -1
  66. package/dist/components/pos-app-rdf-document.js +1 -1
  67. package/dist/components/pos-app-settings2.js +1 -1
  68. package/dist/components/pos-app2.js +1 -1
  69. package/dist/components/pos-dialog2.js +3 -3
  70. package/dist/components/pos-dialog2.js.map +1 -1
  71. package/dist/components/pos-error-toast2.js +1 -1
  72. package/dist/components/pos-example-resources2.js +1 -1
  73. package/dist/components/pos-getting-started2.js +1 -1
  74. package/dist/components/pos-literals2.js +1 -1
  75. package/dist/components/pos-login-form2.js +1 -1
  76. package/dist/components/pos-login2.js +16 -3
  77. package/dist/components/pos-login2.js.map +1 -1
  78. package/dist/components/pos-make-findable2.js +16 -21
  79. package/dist/components/pos-make-findable2.js.map +1 -1
  80. package/dist/components/pos-navigation-bar2.js +1 -1
  81. package/dist/components/pos-navigation2.js +1 -1
  82. package/dist/components/pos-new-thing-form2.js +1 -1
  83. package/dist/components/pos-picture2.js +1 -1
  84. package/dist/components/pos-picture2.js.map +1 -1
  85. package/dist/components/pos-rich-link2.js +2 -2
  86. package/dist/components/pos-router2.js +1 -1
  87. package/dist/components/pos-select-term2.js +1 -1
  88. package/dist/components/pos-setting-offline-cache2.js +1 -1
  89. package/dist/components/pos-user-menu.d.ts +11 -0
  90. package/dist/components/pos-user-menu.js +8 -0
  91. package/dist/components/pos-user-menu.js.map +1 -0
  92. package/dist/components/pos-user-menu2.js +293 -0
  93. package/dist/components/pos-user-menu2.js.map +1 -0
  94. package/dist/elements/elements.css +8 -2
  95. package/dist/elements/elements.esm.js +1 -1
  96. package/dist/elements/elements.esm.js.map +1 -1
  97. package/dist/elements/{p-650db824.entry.js → p-38edfa6d.entry.js} +2 -2
  98. package/dist/elements/p-61cd1259.js +2 -0
  99. package/dist/elements/p-61cd1259.js.map +1 -0
  100. package/dist/elements/p-74bdf05f.entry.js +652 -0
  101. package/dist/elements/p-74bdf05f.entry.js.map +1 -0
  102. package/dist/elements/p-93f5c8ec.js +2 -0
  103. package/dist/elements/p-93f5c8ec.js.map +1 -0
  104. package/dist/elements/p-b1de75a4.entry.js +2 -0
  105. package/dist/elements/{p-178b3852.entry.js → p-c466d5bf.entry.js} +2 -2
  106. package/dist/elements/{p-2cda3231.entry.js → p-dbb94429.entry.js} +2 -2
  107. package/dist/elements/p-ff684bff.entry.js +2 -0
  108. package/dist/esm/{BrokenFile-0b9882ef.js → BrokenFile-a47d9850.js} +22 -6
  109. package/dist/esm/BrokenFile-a47d9850.js.map +1 -0
  110. package/dist/esm/app-globals-fd9221d0.js +21 -0
  111. package/dist/esm/app-globals-fd9221d0.js.map +1 -0
  112. package/dist/esm/elements.js +2 -2
  113. package/dist/esm/ion-badge_5.entry.js +1 -1
  114. package/dist/esm/ion-icon_32.entry.js +9115 -0
  115. package/dist/esm/ion-icon_32.entry.js.map +1 -0
  116. package/dist/esm/loader.js +2 -2
  117. package/dist/esm/pos-app-generic.entry.js +1 -1
  118. package/dist/esm/pos-app-ldp-container.entry.js +1 -1
  119. package/dist/esm/pos-app-rdf-document.entry.js +1 -1
  120. package/dist/esm/pos-document.entry.js +1 -1
  121. package/dist/types/components/pos-dialog/pos-dialog.d.ts +2 -2
  122. package/dist/types/components/pos-login/pos-login.d.ts +4 -0
  123. package/dist/types/components/pos-make-findable/pos-make-findable.d.ts +6 -3
  124. package/dist/types/components/pos-make-findable/shoelace.d.ts +3 -0
  125. package/dist/types/components/pos-user-menu/pos-user-menu.d.ts +13 -0
  126. package/dist/types/components/pos-user-menu/shoelace.d.ts +5 -0
  127. package/dist/types/components.d.ts +33 -0
  128. package/package.json +5 -4
  129. package/dist/cjs/BrokenFile-26f83028.js.map +0 -1
  130. package/dist/cjs/app-globals-1c06b5ae.js +0 -16
  131. package/dist/cjs/app-globals-1c06b5ae.js.map +0 -1
  132. package/dist/cjs/ion-icon_31.cjs.entry.js +0 -4144
  133. package/dist/cjs/ion-icon_31.cjs.entry.js.map +0 -1
  134. package/dist/elements/p-5e8a3893.js +0 -2
  135. package/dist/elements/p-5e8a3893.js.map +0 -1
  136. package/dist/elements/p-b80dbf24.entry.js +0 -20
  137. package/dist/elements/p-b80dbf24.entry.js.map +0 -1
  138. package/dist/elements/p-c27a94bc.entry.js +0 -2
  139. package/dist/elements/p-e1957ea1.entry.js +0 -2
  140. package/dist/elements/p-ec7a6c44.js +0 -2
  141. package/dist/elements/p-ec7a6c44.js.map +0 -1
  142. package/dist/esm/BrokenFile-0b9882ef.js.map +0 -1
  143. package/dist/esm/app-globals-31ecda4c.js +0 -14
  144. package/dist/esm/app-globals-31ecda4c.js.map +0 -1
  145. package/dist/esm/ion-icon_31.entry.js +0 -4110
  146. package/dist/esm/ion-icon_31.entry.js.map +0 -1
  147. /package/dist/elements/{p-650db824.entry.js.map → p-38edfa6d.entry.js.map} +0 -0
  148. /package/dist/elements/{p-e1957ea1.entry.js.map → p-b1de75a4.entry.js.map} +0 -0
  149. /package/dist/elements/{p-178b3852.entry.js.map → p-c466d5bf.entry.js.map} +0 -0
  150. /package/dist/elements/{p-2cda3231.entry.js.map → p-dbb94429.entry.js.map} +0 -0
  151. /package/dist/elements/{p-c27a94bc.entry.js.map → p-ff684bff.entry.js.map} +0 -0
@@ -2,11 +2,13 @@ import { h, Host } from "@stencil/core";
2
2
  import session from "../../store/session";
3
3
  export class PosLogin {
4
4
  constructor() {
5
+ this.customLoggedInComponent = false;
5
6
  this.setOs = async (os) => {
6
7
  this.os = os;
7
8
  };
8
9
  }
9
10
  componentWillLoad() {
11
+ this.customLoggedInComponent = !!this.host.querySelector('[slot="if-logged-in"]');
10
12
  this.initializeOsEmitter.emit(this.setOs);
11
13
  }
12
14
  login(event) {
@@ -23,7 +25,16 @@ export class PosLogin {
23
25
  this.dialog.showModal();
24
26
  }
25
27
  render() {
26
- return (h(Host, { key: '3a9b64d2fde82e4067095067d852f3a793c9c6a2' }, h("div", { key: '36ce0bb0f9d85b90f5faf9dc47c64c8d0dcf88e9', class: "container" }, session.state.isLoggedIn ? (h("pos-resource", { uri: session.state.webId }, h("span", { class: "user-data" }, h("pos-picture", null), h("pos-label", null)))) : (''), !session.state.isLoggedIn && (h("button", { key: '228a4dd94d2497acc6f3ecd13f70e2ff40daf8dc', id: "login", onClick: () => this.openDialog() }, "Login")), session.state.isLoggedIn && (h("button", { key: '2212c8e0c939656179a66c2b3ff74227dab42476', id: "logout", onClick: () => this.logout() }, "Logout"))), h("pos-dialog", { key: '2cd9a1060b1494606848d3dcaea21cad2ede8103', ref: el => (this.dialog = el) }, h("span", { key: '4852dc345b9271c6aca71d4615627d76985d548d', slot: "title" }, "Sign in to your Pod"), h("pos-login-form", { key: 'f6919d6a8863d3c8535ba786a5334741550bc8a5', "onPod-os:idp-url-selected": ev => this.login(ev), slot: "content" }))));
28
+ return (h(Host, { key: 'dded3af9b4a95f30b9eda0414ff90ef77503f730' }, h("div", { key: 'd97326a13eb116bf47e7bd2c0887cfca59b792ad', class: "container" }, !session.state.isLoggedIn ? (h("button", { id: "login", onClick: () => this.openDialog() }, "Login")) : (this.loggedInComponents())), h("pos-dialog", { key: 'fd361fd4961fb96d74e402c4f41288a191c56bd5', ref: el => (this.dialog = el) }, h("span", { key: '2254d45b88f06dab5b3c5ce593c01fb3b35bd935', slot: "title" }, "Sign in to your Pod"), h("pos-login-form", { key: '70a0080686c1f8064887b918273451c65c9a7813', "onPod-os:idp-url-selected": ev => this.login(ev), slot: "content" }))));
29
+ }
30
+ loggedInComponents() {
31
+ return this.customLoggedInComponent ? h("slot", { name: "if-logged-in" }) : this.defaultLoggedInComponents();
32
+ }
33
+ defaultLoggedInComponents() {
34
+ return [
35
+ h("pos-resource", { uri: session.state.webId }, h("span", { class: "user-data" }, h("pos-picture", null), h("pos-label", null))),
36
+ h("button", { id: "logout", onClick: () => this.logout() }, "Logout"),
37
+ ];
27
38
  }
28
39
  static get is() { return "pos-login"; }
29
40
  static get encapsulation() { return "shadow"; }
@@ -39,7 +50,8 @@ export class PosLogin {
39
50
  }
40
51
  static get states() {
41
52
  return {
42
- "os": {}
53
+ "os": {},
54
+ "customLoggedInComponent": {}
43
55
  };
44
56
  }
45
57
  static get events() {
@@ -60,8 +72,15 @@ export class PosLogin {
60
72
  }
61
73
  }];
62
74
  }
75
+ static get elementRef() { return "host"; }
63
76
  static get listeners() {
64
77
  return [{
78
+ "name": "pod-os:logout",
79
+ "method": "logout",
80
+ "target": "document",
81
+ "capture": false,
82
+ "passive": false
83
+ }, {
65
84
  "name": "pod-os:login",
66
85
  "method": "onLogin",
67
86
  "target": "document",
@@ -1 +1 @@
1
- {"version":3,"file":"pos-login.js","sourceRoot":"","sources":["../../../../src/components/pos-login/pos-login.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvF,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAO1C,MAAM,OAAO,QAAQ;IALrB;QAcE,UAAK,GAAG,KAAK,EAAE,EAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC,CAAC;KAsDH;IA5DC,iBAAiB;QACf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAMD,KAAK,CAAC,KAA0B;QAC9B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC;IACnB,CAAC;IAKD,OAAO;QACL,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,UAAU;QACR,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,KAAK,EAAC,WAAW;gBACnB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAC1B,oBAAc,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;oBACpC,YAAM,KAAK,EAAC,WAAW;wBACrB,sBAAe;wBACf,oBAAa,CACR,CACM,CAChB,CAAC,CAAC,CAAC,CACF,EAAE,CACH;gBACA,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,CAC5B,+DAAQ,EAAE,EAAC,OAAO,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,YAE1C,CACV;gBACA,OAAO,CAAC,KAAK,CAAC,UAAU,IAAI,CAC3B,+DAAQ,EAAE,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,aAEvC,CACV,CACG;YACN,mEAAY,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;gBACvC,6DAAM,IAAI,EAAC,OAAO,0BAA2B;gBAC7C,oGAA2C,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,IAAI,EAAC,SAAS,GAAG,CACvE,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { PodOS } from '@pod-os/core';\nimport { Component, Event, EventEmitter, h, Host, Listen, State } from '@stencil/core';\n\nimport session from '../../store/session';\n\n@Component({\n tag: 'pos-login',\n shadow: true,\n styleUrl: 'pos-login.css',\n})\nexport class PosLogin {\n @Event({ eventName: 'pod-os:init' }) initializeOsEmitter: EventEmitter;\n\n @State() os: PodOS;\n\n componentWillLoad() {\n this.initializeOsEmitter.emit(this.setOs);\n }\n\n setOs = async (os: PodOS) => {\n this.os = os;\n };\n\n login(event: CustomEvent<string>) {\n const idpUrl = event.detail;\n this.os.login(idpUrl);\n }\n\n logout() {\n this.os.logout();\n }\n\n private dialog: HTMLPosDialogElement;\n\n @Listen('pod-os:login', { target: 'document' })\n onLogin() {\n this.openDialog();\n }\n\n openDialog() {\n this.dialog.showModal();\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\">\n {session.state.isLoggedIn ? (\n <pos-resource uri={session.state.webId}>\n <span class=\"user-data\">\n <pos-picture />\n <pos-label />\n </span>\n </pos-resource>\n ) : (\n ''\n )}\n {!session.state.isLoggedIn && (\n <button id=\"login\" onClick={() => this.openDialog()}>\n Login\n </button>\n )}\n {session.state.isLoggedIn && (\n <button id=\"logout\" onClick={() => this.logout()}>\n Logout\n </button>\n )}\n </div>\n <pos-dialog ref={el => (this.dialog = el)}>\n <span slot=\"title\">Sign in to your Pod</span>\n <pos-login-form onPod-os:idp-url-selected={ev => this.login(ev)} slot=\"content\" />\n </pos-dialog>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"pos-login.js","sourceRoot":"","sources":["../../../../src/components/pos-login/pos-login.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEhG,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAO1C,MAAM,OAAO,QAAQ;IALrB;QAaU,4BAAuB,GAAY,KAAK,CAAC;QAOjD,UAAK,GAAG,KAAK,EAAE,EAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC,CAAC;KA4DH;IAnEC,iBAAiB;QACf,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yB,EAAE,CAAC;IAC7G,CAAC;IAEO,yBAAyB;QAC/B,OAAO;YACL,oBAAc,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK;gBACpC,YAAM,KAAK,EAAC,WAAW;oBACrB,sBAAe;oBACf,oBAAa,CACR,CACM;YACf,cAAQ,EAAE,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,aAEvC;SACV,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { PodOS } from '@pod-os/core';\nimport { Component, Element, Event, EventEmitter, h, Host, Listen, State } from '@stencil/core';\n\nimport session from '../../store/session';\n\n@Component({\n tag: 'pos-login',\n shadow: true,\n styleUrl: 'pos-login.css',\n})\nexport class PosLogin {\n @Event({ eventName: 'pod-os:init' }) initializeOsEmitter: EventEmitter;\n\n @State() os: PodOS;\n\n @Element() host: HTMLElement;\n\n @State()\n private customLoggedInComponent: boolean = false;\n\n componentWillLoad() {\n this.customLoggedInComponent = !!this.host.querySelector('[slot=\"if-logged-in\"]');\n this.initializeOsEmitter.emit(this.setOs);\n }\n\n setOs = async (os: PodOS) => {\n this.os = os;\n };\n\n login(event: CustomEvent<string>) {\n const idpUrl = event.detail;\n this.os.login(idpUrl);\n }\n\n @Listen('pod-os:logout', { target: 'document' })\n logout() {\n this.os.logout();\n }\n\n private dialog: HTMLPosDialogElement;\n\n @Listen('pod-os:login', { target: 'document' })\n onLogin() {\n this.openDialog();\n }\n\n openDialog() {\n this.dialog.showModal();\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\">\n {!session.state.isLoggedIn ? (\n <button id=\"login\" onClick={() => this.openDialog()}>\n Login\n </button>\n ) : (\n this.loggedInComponents()\n )}\n </div>\n <pos-dialog ref={el => (this.dialog = el)}>\n <span slot=\"title\">Sign in to your Pod</span>\n <pos-login-form onPod-os:idp-url-selected={ev => this.login(ev)} slot=\"content\" />\n </pos-dialog>\n </Host>\n );\n }\n\n private loggedInComponents() {\n return this.customLoggedInComponent ? <slot name=\"if-logged-in\"></slot> : this.defaultLoggedInComponents();\n }\n\n private defaultLoggedInComponents() {\n return [\n <pos-resource uri={session.state.webId}>\n <span class=\"user-data\">\n <pos-picture />\n <pos-label />\n </span>\n </pos-resource>,\n <button id=\"logout\" onClick={() => this.logout()}>\n Logout\n </button>,\n ];\n }\n}\n"]}
@@ -8,7 +8,7 @@ export class PosLoginForm {
8
8
  this.canSubmit = Boolean(this.idpUrl);
9
9
  }
10
10
  render() {
11
- return (h("form", { key: '6c54aa03972bf5af3779c1e3f874b99574232821', method: "dialog", onSubmit: () => this.handleSubmit() }, h("label", { key: 'a5def7569abeb0a2591886d48fa0deb2c7f6039c', htmlFor: "idpUrl" }, "Please enter your Identity Provider"), h("input", { key: '1da8575dccea9a777f00cb8a7f96435654a582bc', id: "idpUrl", type: "url", value: this.idpUrl, required: true, onInput: e => this.handleChange(e), list: "suggestedIssuers", placeholder: "Type to search..." }), h("datalist", { key: '1818988df2f8a825194eb3503979d6c6adac3619', id: "suggestedIssuers" }, h("option", { key: '25e1b3fd84610e0664c25c3ca9cd535bf7558357', value: "https://solidcommunity.net" }, "solidcommunity.net"), h("option", { key: '5635e434dc4bf406a3664cf5cb28489b5b9218fc', value: "https://solidweb.org" }, "solidweb.org"), h("option", { key: 'd4d301023b40f84b5f445d14290ef3bc589cff56', value: "https://solidweb.me" }, "solidweb.me"), h("option", { key: '39f968af206347c83e4271724e9090543fcec43e', value: "https://inrupt.net" }, "inrupt.net"), h("option", { key: '381767d06a60e16b9323cb15b4298db2eac71d82', value: "https://login.inrupt.com" }, "Inrupt PodSpaces"), h("option", { key: 'd4461d0bb2bfba0ec97f276951b6534dee1ffd51', value: "https://trinpod.us" }, "trinpod.us"), h("option", { key: '80aa0ef7de3ec8dd53d06402c116a6c97747a24f', value: "https://use.id" }, "use.id"), h("option", { key: '794bee3c5a2b29738f25bb67bfb918754fe016ef', value: "https://solid.redpencil.io" }, "redpencil.io"), h("option", { key: '88e27225e7252c90bfb24f21a72bd70c9e3408f4', value: "https://datapod.grant.io" }, "Data Pod (grant.io)"), h("option", { key: '033b75773e898b4fed2507c5064686fb0ad56e03', value: "https://teamid.live" }, "teamid.live")), h("input", { key: 'c8dc41c5d6a892e623d42f5b1839af2728929abd', id: "login", type: "submit", value: "Login", disabled: !this.canSubmit })));
11
+ return (h("form", { key: '30eab981894b50a2681e10a68606c87e0d07a235', method: "dialog", onSubmit: () => this.handleSubmit() }, h("label", { key: '97ceb026754eba3f7b2d14b2dc47f842d601f8c0', htmlFor: "idpUrl" }, "Please enter your Identity Provider"), h("input", { key: '2c5c709ab36bbf017291e37991e3da93c150ad8a', id: "idpUrl", type: "url", value: this.idpUrl, required: true, onInput: e => this.handleChange(e), list: "suggestedIssuers", placeholder: "Type to search..." }), h("datalist", { key: '0baa3fada6f2dbb7c11cadaa52430628710fcc20', id: "suggestedIssuers" }, h("option", { key: 'b69926e6ad5e0c2d71a18ae95ef68e8ec1c1ffaa', value: "https://solidcommunity.net" }, "solidcommunity.net"), h("option", { key: '551d5bb9df7fe416e10a64f072020e1c4fdcb407', value: "https://solidweb.org" }, "solidweb.org"), h("option", { key: '5461e8bbe8c8e1a33d4cae2bb8c82e51bd78fde2', value: "https://solidweb.me" }, "solidweb.me"), h("option", { key: '8a46f5b818ca408db889abd68f6087a56db3788d', value: "https://inrupt.net" }, "inrupt.net"), h("option", { key: '533935f58b3230a223bd0f8e38a4800d6e357017', value: "https://login.inrupt.com" }, "Inrupt PodSpaces"), h("option", { key: '2e47e0832aaa3786283d4ca667efe4af246e8b0c', value: "https://trinpod.us" }, "trinpod.us"), h("option", { key: '259af90ed0e39da4ea3148643dde06125ee8e349', value: "https://use.id" }, "use.id"), h("option", { key: '2259f1ca0e0fa91ffbaa8aeddc7336bb94eed05b', value: "https://solid.redpencil.io" }, "redpencil.io"), h("option", { key: '29244565c8f61e38d7bc15039a6ec990ca8765c0', value: "https://datapod.grant.io" }, "Data Pod (grant.io)"), h("option", { key: '6be3b3c1171669fe3a9405d68623208dafc41439', value: "https://teamid.live" }, "teamid.live")), h("input", { key: '4b967c6bb05a87a007eebf4ef3495d6b342da784', id: "login", type: "submit", value: "Login", disabled: !this.canSubmit })));
12
12
  }
13
13
  handleChange(event) {
14
14
  this.validate();
@@ -40,51 +40,6 @@ button.main {
40
40
  }
41
41
  }
42
42
 
43
- .options {
44
- position: absolute;
45
- animation: fadeIn 300ms;
46
- padding: 0;
47
- margin-top: var(--size-1);
48
- z-index: var(--layer-top);
49
-
50
- ol {
51
- display: flex;
52
- flex-direction: column;
53
- box-shadow: var(--shadow-md);
54
- backdrop-filter: var(--blur-md);
55
- border-radius: var(--radius-xs);
56
- overflow: hidden;
57
- color: var(--color-grey-900);
58
- background-color: var(--color-grey-200);
59
- padding: 0;
60
- margin: 0;
61
- list-style: none;
62
- label {
63
- display: flex;
64
- justify-content: flex-start;
65
- align-items: center;
66
- transition: all 300ms var(--ease-in-out-sine);
67
- margin: 0;
68
- border: none;
69
- outline: none;
70
- padding: var(--size-2);
71
- width: var(--size-full);
72
-
73
- &:hover,
74
- &:focus {
75
- filter: brightness(80%);
76
- }
77
-
78
- &:active {
79
- filter: brightness(90%);
80
- }
81
- }
82
- }
83
- label:has(input:checked) {
84
- background-color: var(--color-green-100);
85
- }
86
- }
87
-
88
43
  svg {
89
44
  display: inline-block;
90
45
  height: var(--size-6);
@@ -94,9 +49,10 @@ svg {
94
49
  }
95
50
 
96
51
  button.main:hover,
97
- button.open {
52
+ sl-dropdown[open] button {
98
53
  &.success {
99
54
  background: var(--color-green-200);
55
+ color: var(--color-green-700);
100
56
  }
101
57
  width: var(--size-full);
102
58
  height: var(--pos-navigation-bar-height);
@@ -107,12 +63,3 @@ button.open {
107
63
  display: inline-block;
108
64
  }
109
65
  }
110
-
111
- @keyframes fadeIn {
112
- 0% {
113
- opacity: 0;
114
- }
115
- 100% {
116
- opacity: 1;
117
- }
118
- }
@@ -2,6 +2,7 @@ import { h, Host } from "@stencil/core";
2
2
  import { LabelIndex } from "@pod-os/core";
3
3
  import { subscribePodOs } from "../events/PodOsAware";
4
4
  import session from "../../store/session";
5
+ import "./shoelace";
5
6
  export class PosMakeFindable {
6
7
  constructor() {
7
8
  this.indexes = [];
@@ -22,17 +23,6 @@ export class PosMakeFindable {
22
23
  disconnectedCallback() {
23
24
  this.unsubscribeSessionChange && this.unsubscribeSessionChange();
24
25
  }
25
- hideOptions(event) {
26
- // @ts-ignore
27
- if (!this.el.contains(event.target)) {
28
- this.showOptions = false;
29
- }
30
- }
31
- handleKeyDown(ev) {
32
- if (ev.key === 'Escape') {
33
- this.showOptions = false;
34
- }
35
- }
36
26
  updateUri(uri) {
37
27
  this.thing = this.os.store.get(uri);
38
28
  this.isIndexed = this.checkIfIndexed(uri);
@@ -43,6 +33,7 @@ export class PosMakeFindable {
43
33
  getLabelIndexes(profile) {
44
34
  if (profile) {
45
35
  this.indexes = profile.getPrivateLabelIndexes().map(it => this.os.store.get(it).assume(LabelIndex));
36
+ this.showOptions = this.indexes.length > 1;
46
37
  this.isIndexed = this.checkIfIndexed(this.uri);
47
38
  }
48
39
  }
@@ -53,10 +44,7 @@ export class PosMakeFindable {
53
44
  await this.addToLabelIndex(index);
54
45
  this.indexUpdatedEmitter.emit(index);
55
46
  }
56
- else if (this.indexes.length > 1) {
57
- this.showOptions = !this.showOptions;
58
- }
59
- else {
47
+ else if (this.indexes.length === 0) {
60
48
  const index = await this.createDefaultLabelIndex();
61
49
  await this.addToLabelIndex(index);
62
50
  this.indexCreatedEmitter.emit(index);
@@ -70,7 +58,6 @@ export class PosMakeFindable {
70
58
  catch (e) {
71
59
  this.errorEmitter.emit(e);
72
60
  }
73
- this.showOptions = false;
74
61
  }
75
62
  async createDefaultLabelIndex() {
76
63
  try {
@@ -85,14 +72,22 @@ export class PosMakeFindable {
85
72
  return null;
86
73
  }
87
74
  const label = 'Make this findable';
88
- return (h(Host, null, h("button", { type: "button", "aria-label": label, class: { main: true, open: this.showOptions, success: this.isIndexed }, onClick: e => this.onClick(e), title: "" }, this.isIndexed ? h(IconSuccess, null) : h(IconMakeFindable, null), h("p", null, label)), this.showOptions && (h("div", { class: "options" }, h("ol", { role: "listbox" }, this.indexes.map((index) => (h("li", { role: "option" }, h("label", null, h("input", { type: "checkbox", checked: index.contains(this.uri), onChange: e => this.chooseOption(e, index) }), h("pos-resource", { uri: index.uri, lazy: true }, h("pos-label", null)))))))))));
75
+ const button = (h("button", { type: "button", slot: "trigger", "aria-label": label, class: { main: true, success: this.isIndexed }, onClick: e => this.onClick(e), title: "" }, this.isIndexed ? h(IconSuccess, null) : h(IconMakeFindable, null), h("p", null, label)));
76
+ if (this.showOptions) {
77
+ return (h(Host, null, h("sl-dropdown", null, button, h("sl-menu", { role: "listbox" }, this.indexes.map((index) => (h("sl-menu-item", { role: "option", value: index, type: "checkbox", checked: index.contains(this.uri) }, h("pos-resource", { uri: index.uri, lazy: true }, h("pos-label", null)))))))));
78
+ }
79
+ else {
80
+ return button;
81
+ }
89
82
  }
90
- async chooseOption(e, index) {
83
+ async onSelect(e) {
84
+ const index = e.detail.item.value;
91
85
  e.preventDefault();
92
86
  await this.addToLabelIndex(index);
93
87
  this.indexUpdatedEmitter.emit(index);
94
88
  }
95
89
  static get is() { return "pos-make-findable"; }
90
+ static get encapsulation() { return "shadow"; }
96
91
  static get originalStyleUrls() {
97
92
  return {
98
93
  "$": ["pos-make-findable.css"]
@@ -208,14 +203,8 @@ export class PosMakeFindable {
208
203
  }
209
204
  static get listeners() {
210
205
  return [{
211
- "name": "click",
212
- "method": "hideOptions",
213
- "target": "document",
214
- "capture": false,
215
- "passive": false
216
- }, {
217
- "name": "keydown",
218
- "method": "handleKeyDown",
206
+ "name": "sl-select",
207
+ "method": "onSelect",
219
208
  "target": undefined,
220
209
  "capture": false,
221
210
  "passive": false
@@ -1 +1 @@
1
- {"version":3,"file":"pos-make-findable.js","sourceRoot":"","sources":["../../../../src/components/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;;;;;;;;;;CACF;AAED,MAAM,gBAAgB,GAAG,GAAG,EAAE,CAAC,CAC7B,WACE,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,kBACN,KAAK,EAClB,MAAM,EAAC,cAAc;IAErB,8BACiB,OAAO,qBACN,OAAO,EACvB,CAAC,EAAC,wVAAwV,GAC1V,CACE,CACP,CAAC;AAEF,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,WACE,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,kBACN,KAAK,EAClB,MAAM,EAAC,cAAc;IAErB,8BACiB,OAAO,qBACN,OAAO,EACvB,CAAC,EAAC,gSAAgS,GAClS,CACE,CACP,CAAC","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Listen, Prop, State, Watch } from '@stencil/core';\nimport { LabelIndex, PodOS, Thing, WebIdProfile } from '@pod-os/core';\nimport { PodOsAware, PodOsEventEmitter, subscribePodOs } from '../events/PodOsAware';\nimport session from '../../store/session';\n\n@Component({\n tag: 'pos-make-findable',\n styleUrl: 'pos-make-findable.css',\n})\nexport class PosMakeFindable implements PodOsAware {\n @Prop() uri!: string;\n\n @State() os: PodOS;\n @State() thing: Thing;\n @State() indexes: LabelIndex[] = [];\n\n @Event({ eventName: 'pod-os:init' }) subscribePodOs: PodOsEventEmitter;\n\n @State() unsubscribeSessionChange: undefined | (() => void);\n\n @State() showOptions = false;\n @State() isIndexed = false;\n\n @Event({ eventName: 'pod-os:error' }) errorEmitter: EventEmitter;\n @Event({ eventName: 'pod-os:search:index-updated' }) indexUpdatedEmitter: EventEmitter;\n @Event({ eventName: 'pod-os:search:index-created' }) indexCreatedEmitter: EventEmitter;\n\n @Element() el: HTMLElement;\n\n componentWillLoad() {\n subscribePodOs(this);\n }\n\n disconnectedCallback() {\n this.unsubscribeSessionChange && this.unsubscribeSessionChange();\n }\n\n @Listen('click', { target: 'document' })\n hideOptions(event: MouseEvent) {\n // @ts-ignore\n if (!this.el.contains(event.target)) {\n this.showOptions = false;\n }\n }\n\n @Listen('keydown')\n handleKeyDown(ev: KeyboardEvent) {\n if (ev.key === 'Escape') {\n this.showOptions = false;\n }\n }\n\n @Watch('uri')\n updateUri(uri: string) {\n this.thing = this.os.store.get(uri);\n this.isIndexed = this.checkIfIndexed(uri);\n }\n\n private checkIfIndexed(uri: string) {\n return this.indexes.some(it => it.contains(uri));\n }\n\n receivePodOs = async (os: PodOS) => {\n this.os = os;\n this.thing = this.os.store.get(this.uri);\n this.getLabelIndexes(session.state.profile);\n this.unsubscribeSessionChange = session.onChange('profile', profile => {\n this.getLabelIndexes(profile);\n });\n };\n\n private getLabelIndexes(profile: WebIdProfile) {\n if (profile) {\n this.indexes = profile.getPrivateLabelIndexes().map(it => this.os.store.get(it).assume(LabelIndex));\n this.isIndexed = this.checkIfIndexed(this.uri);\n }\n }\n\n private async onClick(e: MouseEvent) {\n e.preventDefault();\n if (this.indexes.length === 1) {\n const index = this.indexes[0];\n await this.addToLabelIndex(index);\n this.indexUpdatedEmitter.emit(index);\n } else if (this.indexes.length > 1) {\n this.showOptions = !this.showOptions;\n } else {\n const index = await this.createDefaultLabelIndex();\n await this.addToLabelIndex(index);\n this.indexCreatedEmitter.emit(index);\n }\n }\n\n private async addToLabelIndex(index: LabelIndex) {\n try {\n await this.os.addToLabelIndex(this.thing, index);\n this.isIndexed = true;\n } catch (e) {\n this.errorEmitter.emit(e);\n }\n\n this.showOptions = false;\n }\n\n private async createDefaultLabelIndex(): Promise<LabelIndex> {\n try {\n return await this.os.createDefaultLabelIndex(session.state.profile);\n } catch (e) {\n this.errorEmitter.emit(e);\n }\n }\n\n render() {\n if (!session.state.isLoggedIn || !this.uri) {\n return null;\n }\n\n const label = 'Make this findable';\n return (\n <Host>\n <button\n type=\"button\"\n aria-label={label}\n class={{ main: true, open: this.showOptions, success: this.isIndexed }}\n onClick={e => this.onClick(e)}\n title=\"\"\n >\n {this.isIndexed ? <IconSuccess /> : <IconMakeFindable />}\n <p>{label}</p>\n </button>\n {this.showOptions && (\n <div class=\"options\">\n <ol role=\"listbox\">\n {this.indexes.map((index: LabelIndex) => (\n <li role=\"option\">\n <label>\n <input\n type=\"checkbox\"\n checked={index.contains(this.uri)}\n onChange={e => this.chooseOption(e, index)}\n />\n <pos-resource uri={index.uri} lazy={true}>\n <pos-label></pos-label>\n </pos-resource>\n </label>\n </li>\n ))}\n </ol>\n </div>\n )}\n </Host>\n );\n }\n\n private async chooseOption(e: Event, index: LabelIndex) {\n e.preventDefault();\n await this.addToLabelIndex(index);\n this.indexUpdatedEmitter.emit(index);\n }\n}\n\nconst IconMakeFindable = () => (\n <svg\n role=\"presentation\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z\"\n />\n </svg>\n);\n\nconst IconSuccess = () => (\n <svg\n role=\"presentation\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12\"\n />\n </svg>\n);\n"]}
1
+ {"version":3,"file":"pos-make-findable.js","sourceRoot":"","sources":["../../../../src/components/pos-make-findable/pos-make-findable.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAE,UAAU,EAA8B,MAAM,cAAc,CAAC;AACtE,OAAO,EAAiC,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrF,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAE1C,OAAO,YAAY,CAAC;AAOpB,MAAM,OAAO,eAAe;IAL5B;QAUW,YAAO,GAAiB,EAAE,CAAC;QAM3B,gBAAW,GAAG,KAAK,CAAC;QACpB,cAAS,GAAG,KAAK,CAAC;QA0B3B,iBAAY,GAAG,KAAK,EAAE,EAAS,EAAE,EAAE;YACjC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC5C,IAAI,CAAC,wBAAwB,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE;gBACpE,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;KAwFH;IAjHC,iBAAiB;QACf,cAAc,CAAC,I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,CAC7B,WACE,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,kBACN,KAAK,EAClB,MAAM,EAAC,cAAc;IAErB,8BACiB,OAAO,qBACN,OAAO,EACvB,CAAC,EAAC,wVAAwV,GAC1V,CACE,CACP,CAAC;AAEF,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,CACxB,WACE,IAAI,EAAC,cAAc,EACnB,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,kBACN,KAAK,EAClB,MAAM,EAAC,cAAc;IAErB,8BACiB,OAAO,qBACN,OAAO,EACvB,CAAC,EAAC,gSAAgS,GAClS,CACE,CACP,CAAC","sourcesContent":["import { Component, Element, Event, EventEmitter, h, Host, Listen, Prop, State, Watch } from '@stencil/core';\nimport { LabelIndex, PodOS, Thing, WebIdProfile } from '@pod-os/core';\nimport { PodOsAware, PodOsEventEmitter, subscribePodOs } from '../events/PodOsAware';\nimport session from '../../store/session';\n\nimport './shoelace';\n\n@Component({\n tag: 'pos-make-findable',\n styleUrl: 'pos-make-findable.css',\n shadow: true,\n})\nexport class PosMakeFindable implements PodOsAware {\n @Prop() uri!: string;\n\n @State() os: PodOS;\n @State() thing: Thing;\n @State() indexes: LabelIndex[] = [];\n\n @Event({ eventName: 'pod-os:init' }) subscribePodOs: PodOsEventEmitter;\n\n @State() unsubscribeSessionChange: undefined | (() => void);\n\n @State() showOptions = false;\n @State() isIndexed = false;\n\n @Event({ eventName: 'pod-os:error' }) errorEmitter: EventEmitter;\n @Event({ eventName: 'pod-os:search:index-updated' }) indexUpdatedEmitter: EventEmitter;\n @Event({ eventName: 'pod-os:search:index-created' }) indexCreatedEmitter: EventEmitter;\n\n @Element() el: HTMLElement;\n\n componentWillLoad() {\n subscribePodOs(this);\n }\n\n disconnectedCallback() {\n this.unsubscribeSessionChange && this.unsubscribeSessionChange();\n }\n\n @Watch('uri')\n updateUri(uri: string) {\n this.thing = this.os.store.get(uri);\n this.isIndexed = this.checkIfIndexed(uri);\n }\n\n private checkIfIndexed(uri: string) {\n return this.indexes.some(it => it.contains(uri));\n }\n\n receivePodOs = async (os: PodOS) => {\n this.os = os;\n this.thing = this.os.store.get(this.uri);\n this.getLabelIndexes(session.state.profile);\n this.unsubscribeSessionChange = session.onChange('profile', profile => {\n this.getLabelIndexes(profile);\n });\n };\n\n private getLabelIndexes(profile: WebIdProfile) {\n if (profile) {\n this.indexes = profile.getPrivateLabelIndexes().map(it => this.os.store.get(it).assume(LabelIndex));\n this.showOptions = this.indexes.length > 1;\n this.isIndexed = this.checkIfIndexed(this.uri);\n }\n }\n\n private async onClick(e: MouseEvent) {\n e.preventDefault();\n if (this.indexes.length === 1) {\n const index = this.indexes[0];\n await this.addToLabelIndex(index);\n this.indexUpdatedEmitter.emit(index);\n } else if (this.indexes.length === 0) {\n const index = await this.createDefaultLabelIndex();\n await this.addToLabelIndex(index);\n this.indexCreatedEmitter.emit(index);\n }\n }\n\n private async addToLabelIndex(index: LabelIndex) {\n try {\n await this.os.addToLabelIndex(this.thing, index);\n this.isIndexed = true;\n } catch (e) {\n this.errorEmitter.emit(e);\n }\n }\n\n private async createDefaultLabelIndex(): Promise<LabelIndex> {\n try {\n return await this.os.createDefaultLabelIndex(session.state.profile);\n } catch (e) {\n this.errorEmitter.emit(e);\n }\n }\n\n render() {\n if (!session.state.isLoggedIn || !this.uri) {\n return null;\n }\n\n const label = 'Make this findable';\n const button = (\n <button\n type=\"button\"\n slot=\"trigger\"\n aria-label={label}\n class={{ main: true, success: this.isIndexed }}\n onClick={e => this.onClick(e)}\n title=\"\"\n >\n {this.isIndexed ? <IconSuccess /> : <IconMakeFindable />}\n <p>{label}</p>\n </button>\n );\n if (this.showOptions) {\n return (\n <Host>\n <sl-dropdown>\n {button}\n <sl-menu role=\"listbox\">\n {this.indexes.map((index: LabelIndex) => (\n <sl-menu-item role=\"option\" value={index} type=\"checkbox\" checked={index.contains(this.uri)}>\n <pos-resource uri={index.uri} lazy={true}>\n <pos-label></pos-label>\n </pos-resource>\n </sl-menu-item>\n ))}\n </sl-menu>\n </sl-dropdown>\n </Host>\n );\n } else {\n return button;\n }\n }\n\n @Listen('sl-select')\n async onSelect(e: CustomEvent<{ item: { value: LabelIndex } }>) {\n const index = e.detail.item.value;\n e.preventDefault();\n await this.addToLabelIndex(index);\n this.indexUpdatedEmitter.emit(index);\n }\n}\n\nconst IconMakeFindable = () => (\n <svg\n role=\"presentation\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z\"\n />\n </svg>\n);\n\nconst IconSuccess = () => (\n <svg\n role=\"presentation\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12\"\n />\n </svg>\n);\n"]}
@@ -0,0 +1,4 @@
1
+ import "@shoelace-style/shoelace/dist/components/dropdown/dropdown.js";
2
+ import "@shoelace-style/shoelace/dist/components/menu/menu.js";
3
+ import "@shoelace-style/shoelace/dist/components/menu-item/menu-item.js";
4
+ //# sourceMappingURL=shoelace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shoelace.js","sourceRoot":"","sources":["../../../../src/components/pos-make-findable/shoelace.ts"],"names":[],"mappings":"AAAA,OAAO,+DAA+D,CAAC;AACvE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,iEAAiE,CAAC","sourcesContent":["import '@shoelace-style/shoelace/dist/components/dropdown/dropdown.js';\nimport '@shoelace-style/shoelace/dist/components/menu/menu.js';\nimport '@shoelace-style/shoelace/dist/components/menu-item/menu-item.js';\n"]}
@@ -11,7 +11,7 @@ export class PosNavigationBar {
11
11
  }
12
12
  render() {
13
13
  const ariaLabel = this.current ? `${this.current.label()} (Click to search or enter URI)` : 'Search or enter URI';
14
- return (h("section", { key: '3bdf8dfb639a32796ffec2e5f8b65d553ea7bf60', class: "current" }, this.current && this.searchIndexReady && h("pos-make-findable", { key: '4cb1e1c567be23d856564e3a7404b1be73cda8d7', uri: this.current.uri }), h("button", { key: '0b29bcc329bc9f5d053ff711109b1c06b368c33e', "aria-label": ariaLabel, onClick: () => this.onClick() }, h("div", { key: '48c7c2f062a87f8e5f7742f5839e351d56ff2c13' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon())));
14
+ return (h("section", { key: '4b942ac9ddb8c7ec9325197dc0906c8e236586d9', class: "current" }, this.current && this.searchIndexReady && h("pos-make-findable", { key: '4202379b075353cf6c0214fbc5a00b892ad948e1', uri: this.current.uri }), h("button", { key: 'e59f5644299d8eee98d3fd179a1796aa837bb0cc', "aria-label": ariaLabel, onClick: () => this.onClick() }, h("div", { key: '4a4df2d898be9c916b3fa31b00bd9bf2b3beabd1' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon())));
15
15
  }
16
16
  icon() {
17
17
  return (h("svg", { "aria-hidden": "true", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z" })));
@@ -113,7 +113,7 @@ export class PosNavigation {
113
113
  }
114
114
  }
115
115
  render() {
116
- return (h("nav", { key: '311e48ae67c07f4e04bbd0c78ae85103c937a2d6' }, h("search", { key: 'd39bad3a0e6fdd3eabb5fc019fbe9c311dc9adea' }, h("pos-navigation-bar", { key: '032bf46e40d5f857c6ce597f6c43875f054c65e7', searchIndexReady: this.searchIndex !== undefined, current: this.resource }), h("dialog", { key: '5e54d2658efb7b494fc585456e3b7c72782c8938', ref: el => (this.dialogRef = el) }, h("form", { key: '59d12120091dc9f343d006d7e01fde90c1e2e3ea', method: "dialog", onSubmit: () => this.onSubmit() }, h("input", { key: '5d415b87143ab28c8db0a003e235db63305d3094', ref: el => (this.inputRef = el), enterkeyhint: "search", "aria-label": "Search or enter URI", placeholder: "Search or enter URI", value: this.uri, onChange: e => this.onChange(e), onInput: e => this.onChange(e), role: "combobox", "aria-autocomplete": "list", "aria-expanded": this.suggestions.length > 0, "aria-controls": "suggestions-list", "aria-activedescendant": this.selectedIndex >= 0 ? `option-${this.selectedIndex}` : null }), this.suggestions.length > 0 ? (h("div", { class: "suggestions" }, h("ol", { id: "suggestions-list", role: "listbox", "aria-label": "Search results" }, this.suggestions.map((it, index) => (h("li", { id: `option-${index}`, role: "option", "aria-selected": index === this.selectedIndex ? 'true' : 'false' }, h("pos-rich-link", { uri: it.ref }))))))) : null)))));
116
+ return (h("nav", { key: 'c6f9915d7778a332aa0e2f3b19b733da63b55d3a' }, h("search", { key: '2911efe53775a82d6c87ba823adfd2f37d196994' }, h("pos-navigation-bar", { key: 'ce9d62d0fdc81df2f6c7f7750b5c4fc98e2b0240', searchIndexReady: this.searchIndex !== undefined, current: this.resource }), h("dialog", { key: 'cab1f4261e43e8318582d6b37096301a7ef987cc', ref: el => (this.dialogRef = el) }, h("form", { key: '3caed872d467ef70c3b097da4f337f492bafdc9f', method: "dialog", onSubmit: () => this.onSubmit() }, h("input", { key: '72ba8d15816608dab944f7d8541713bbf177c1c2', ref: el => (this.inputRef = el), enterkeyhint: "search", "aria-label": "Search or enter URI", placeholder: "Search or enter URI", value: this.uri, onChange: e => this.onChange(e), onInput: e => this.onChange(e), role: "combobox", "aria-autocomplete": "list", "aria-expanded": this.suggestions.length > 0, "aria-controls": "suggestions-list", "aria-activedescendant": this.selectedIndex >= 0 ? `option-${this.selectedIndex}` : null }), this.suggestions.length > 0 ? (h("div", { class: "suggestions" }, h("ol", { id: "suggestions-list", role: "listbox", "aria-label": "Search results" }, this.suggestions.map((it, index) => (h("li", { id: `option-${index}`, role: "option", "aria-selected": index === this.selectedIndex ? 'true' : 'false' }, h("pos-rich-link", { uri: it.ref }))))))) : null)))));
117
117
  }
118
118
  static get is() { return "pos-navigation"; }
119
119
  static get encapsulation() { return "shadow"; }
@@ -14,7 +14,7 @@ export class PosNewThingForm {
14
14
  subscribePodOs(this);
15
15
  }
16
16
  render() {
17
- return (h("form", { key: '1091c0db993d79f6d1f0c9ac9003c544b2894709', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h("label", { key: 'cce3f98c89a7e820556e18ea28553774324a01a1', htmlFor: "type" }, "Type"), h("pos-select-term", { key: '72708f95553609006df33b02047421599d0167f0', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h("label", { key: 'a1344f66396ec7b9a0a6a298694f832e62329ce3', htmlFor: "name" }, "Name"), h("input", { key: '5f006bac7be0734dbd39edbad0f30d392bf09bad', id: "name", type: "text", value: this.name, onInput: e => this.handleChange(e) }), this.newUri ? (h("div", { id: "new-uri", title: "This will be the URI of the new thing" }, this.newUri)) : null, h("input", { key: '91c88406fd206ba0211e75d01cca16434fe7f74a', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
17
+ return (h("form", { key: '947421a1e826b4cc59a5d92cf83d25726257c871', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h("label", { key: 'fd239a8b7c9d7b6f833acc794c4ce44d884d240f', htmlFor: "type" }, "Type"), h("pos-select-term", { key: '04b2e4bfdb8590bcb4bc4c822780bffd126488fa', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h("label", { key: 'fa363e0adf2d73c0f22ce90588504ec3b8b6cb6f', htmlFor: "name" }, "Name"), h("input", { key: 'b3c9ff73ea9b1e1e1c059287f3876935fc845699', id: "name", type: "text", value: this.name, onInput: e => this.handleChange(e) }), this.newUri ? (h("div", { id: "new-uri", title: "This will be the URI of the new thing" }, this.newUri)) : null, h("input", { key: 'a804450dd5c59ee847f736861e0eeb6616476081', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
18
18
  }
19
19
  handleChange(event) {
20
20
  this.name = event.target.value;
@@ -16,7 +16,7 @@ export class PosPicture {
16
16
  render() {
17
17
  const pic = this.resource ? this.resource.picture() : null;
18
18
  if (!pic)
19
- return null;
19
+ return h("slot", null);
20
20
  return h("pos-image", { blurredBackground: this.blurredBackground, src: pic.url, alt: this.resource.label() });
21
21
  }
22
22
  static get is() { return "pos-picture"; }
@@ -1 +1 @@
1
- {"version":3,"file":"pos-picture.js","sourceRoot":"","sources":["../../../../src/components/pos-picture/pos-picture.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAiB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO3E,MAAM,OAAO,UAAU;IALvB;QAME;;WAEG;QACK,sBAAiB,GAAY,KAAK,CAAC;QAU3C,oBAAe,GAAG,CAAC,QAAe,EAAE,EAAE;YACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,CAAC;KAOH;IAbC,iBAAiB;QACf,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAMD,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAC;QACtB,OAAO,iBAAW,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAc,CAAC;IACtH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, State, h, Prop } from '@stencil/core';\nimport { Thing } from '@pod-os/core';\nimport { ResourceAware, subscribeResource } from '../events/ResourceAware';\n\n@Component({\n tag: 'pos-picture',\n shadow: true,\n styleUrl: 'pos-picture.css',\n})\nexport class PosPicture implements ResourceAware {\n /**\n * Use a blurred version of the image as its own background, if the image is scaled down to fit into the container.\n */\n @Prop() blurredBackground: boolean = false;\n\n @State() resource: Thing;\n\n @Event({ eventName: 'pod-os:resource' }) subscribeResource: EventEmitter;\n\n componentWillLoad() {\n subscribeResource(this);\n }\n\n receiveResource = (resource: Thing) => {\n this.resource = resource;\n };\n\n render() {\n const pic = this.resource ? this.resource.picture() : null;\n if (!pic) return null;\n return <pos-image blurredBackground={this.blurredBackground} src={pic.url} alt={this.resource.label()}></pos-image>;\n }\n}\n"]}
1
+ {"version":3,"file":"pos-picture.js","sourceRoot":"","sources":["../../../../src/components/pos-picture/pos-picture.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE/E,OAAO,EAAiB,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO3E,MAAM,OAAO,UAAU;IALvB;QAME;;WAEG;QACK,sBAAiB,GAAY,KAAK,CAAC;QAU3C,oBAAe,GAAG,CAAC,QAAe,EAAE,EAAE;YACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,CAAC;KAOH;IAbC,iBAAiB;QACf,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAMD,MAAM;QACJ,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3D,IAAI,CAAC,GAAG;YAAE,OAAO,eAAa,CAAC;QAC/B,OAAO,iBAAW,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAc,CAAC;IACtH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, State, h, Prop } from '@stencil/core';\nimport { Thing } from '@pod-os/core';\nimport { ResourceAware, subscribeResource } from '../events/ResourceAware';\n\n@Component({\n tag: 'pos-picture',\n shadow: true,\n styleUrl: 'pos-picture.css',\n})\nexport class PosPicture implements ResourceAware {\n /**\n * Use a blurred version of the image as its own background, if the image is scaled down to fit into the container.\n */\n @Prop() blurredBackground: boolean = false;\n\n @State() resource: Thing;\n\n @Event({ eventName: 'pod-os:resource' }) subscribeResource: EventEmitter;\n\n componentWillLoad() {\n subscribeResource(this);\n }\n\n receiveResource = (resource: Thing) => {\n this.resource = resource;\n };\n\n render() {\n const pic = this.resource ? this.resource.picture() : null;\n if (!pic) return <slot></slot>;\n return <pos-image blurredBackground={this.blurredBackground} src={pic.url} alt={this.resource.label()}></pos-image>;\n }\n}\n"]}
@@ -1,10 +1,10 @@
1
1
  import { h } from "@stencil/core";
2
2
  export class PosRichLink {
3
3
  render() {
4
- return (h("pos-resource", { key: '95aa9fbc121e27b106845f4c6de96088f7538310', lazy: true, uri: this.uri }, h("p", { key: 'a277291f4c795c7c2e9c9e41ab899fe660ec67a9', class: "content" }, h("a", { key: 'b83e27d371214673bc8fe740573b4b65b2479af8', href: this.uri, onClick: e => {
4
+ return (h("pos-resource", { key: 'f41ba8c5430e96e47d176b4e85633bad4ee9b0a7', lazy: true, uri: this.uri }, h("p", { key: '0a92fa1df51d78c0e8d1f6d47af078cb0cbe264a', class: "content" }, h("a", { key: '27c623707a5cbc6618d5a70e0eacc2fd5552d7dd', href: this.uri, onClick: e => {
5
5
  e.preventDefault();
6
6
  this.linkEmitter.emit(this.uri);
7
- } }, h("pos-label", { key: '5c4dacc2f5b0dc18664ef5e04bc024efb2547e34' })), h("span", { key: '35cb283d89ce6f631c5e3fde3035244a0374daa0', class: "url" }, new URL(this.uri).host), h("pos-description", { key: '12d5833f05f5759c16d579d5a62742b871ff964f' }))));
7
+ } }, h("pos-label", { key: 'e8cb96334502e2f2fad85c35096baa3a6cc890cb' })), h("span", { key: '0f0feeee5e65f982d54cd474c42ed14759d2e834', class: "url" }, new URL(this.uri).host), h("pos-description", { key: '87a7cdf2c0e1f523ecdbed2e786d948f267ad303' }))));
8
8
  }
9
9
  static get is() { return "pos-rich-link"; }
10
10
  static get encapsulation() { return "shadow"; }
@@ -38,7 +38,7 @@ export class PosRouter {
38
38
  this.routeChanged.emit(this.uri);
39
39
  }
40
40
  render() {
41
- return h("slot", { key: '2775fc2835158ccd8d540e4f27edfd497eafe7a9' });
41
+ return h("slot", { key: 'e3d70ed25e70d8273a2c820bb92fec69b7f70f25' });
42
42
  }
43
43
  static get is() { return "pos-router"; }
44
44
  static get originalStyleUrls() {
@@ -19,7 +19,7 @@ export class PosSelectTerm {
19
19
  this.termSelected.emit({ uri: event.target.value });
20
20
  }
21
21
  render() {
22
- return (h(Host, { key: '87e4eddf409058ee5fc4c3da0d26f06b10814baa' }, h("input", { key: 'b7c3c9644cfd438806263a1f5cc721f8409cfe45', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h("datalist", { key: '834ad0a974db76a5295501ba7231bd190d57b98b', part: "terms", id: "terms" }, this.terms.map(term => (h("option", { value: term.uri }, term.shorthand))))));
22
+ return (h(Host, { key: 'c9529ceaf82d8aa1a3f73532e8ca0f99aa3fc4e6' }, h("input", { key: '2de0e74b99ae5dd7aa6d7bdea4289b9e25b7629e', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h("datalist", { key: '92e240a12c0d733c15b8daf971e3026a1d535561', part: "terms", id: "terms" }, this.terms.map(term => (h("option", { value: term.uri }, term.shorthand))))));
23
23
  }
24
24
  static get is() { return "pos-select-term"; }
25
25
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,23 @@
1
+ button {
2
+ display: flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ padding: 0;
6
+ margin: 0;
7
+ border: none;
8
+ background: none;
9
+ cursor: pointer;
10
+ border-radius: 50%;
11
+ pos-picture {
12
+ --width: 40px;
13
+ --height: 40px;
14
+ --border-radius: 50%;
15
+ }
16
+ sl-avatar {
17
+ --size: 40px;
18
+ }
19
+ }
20
+
21
+ sl-dropdown {
22
+ display: block;
23
+ }
@@ -0,0 +1,102 @@
1
+ import { h } from "@stencil/core";
2
+ import "./shoelace";
3
+ export class PosUserMenu {
4
+ onSelect(e) {
5
+ const { value } = e.detail.item;
6
+ if (value === 'logout') {
7
+ this.logout.emit();
8
+ }
9
+ else if (value === 'profile') {
10
+ this.link.emit(this.webId);
11
+ }
12
+ else if (value === 'dashboard') {
13
+ this.link.emit('pod-os:dashboard');
14
+ }
15
+ else if (value === 'settings') {
16
+ this.link.emit('pod-os:settings');
17
+ }
18
+ }
19
+ render() {
20
+ if (!this.webId)
21
+ return null; //?
22
+ return (h("pos-resource", { uri: this.webId }, h("sl-dropdown", null, h("button", { slot: "trigger", "aria-label": "User menu" }, h("pos-picture", null, h("sl-avatar", null))), h("sl-menu", null, h("sl-menu-item", { value: "dashboard" }, "Dashboard"), h("sl-menu-item", { value: "profile" }, h("pos-label", null)), h("sl-menu-item", { value: "settings" }, "Settings"), h("sl-divider", null), h("sl-menu-item", { value: "logout" }, "Logout")))));
23
+ }
24
+ static get is() { return "pos-user-menu"; }
25
+ static get encapsulation() { return "shadow"; }
26
+ static get originalStyleUrls() {
27
+ return {
28
+ "$": ["pos-user-menu.css"]
29
+ };
30
+ }
31
+ static get styleUrls() {
32
+ return {
33
+ "$": ["pos-user-menu.css"]
34
+ };
35
+ }
36
+ static get properties() {
37
+ return {
38
+ "webId": {
39
+ "type": "string",
40
+ "mutable": false,
41
+ "complexType": {
42
+ "original": "string",
43
+ "resolved": "string",
44
+ "references": {}
45
+ },
46
+ "required": true,
47
+ "optional": false,
48
+ "docs": {
49
+ "tags": [],
50
+ "text": ""
51
+ },
52
+ "getter": false,
53
+ "setter": false,
54
+ "attribute": "web-id",
55
+ "reflect": false
56
+ }
57
+ };
58
+ }
59
+ static get events() {
60
+ return [{
61
+ "method": "logout",
62
+ "name": "pod-os:logout",
63
+ "bubbles": true,
64
+ "cancelable": true,
65
+ "composed": true,
66
+ "docs": {
67
+ "tags": [],
68
+ "text": ""
69
+ },
70
+ "complexType": {
71
+ "original": "any",
72
+ "resolved": "any",
73
+ "references": {}
74
+ }
75
+ }, {
76
+ "method": "link",
77
+ "name": "pod-os:link",
78
+ "bubbles": true,
79
+ "cancelable": true,
80
+ "composed": true,
81
+ "docs": {
82
+ "tags": [],
83
+ "text": ""
84
+ },
85
+ "complexType": {
86
+ "original": "any",
87
+ "resolved": "any",
88
+ "references": {}
89
+ }
90
+ }];
91
+ }
92
+ static get listeners() {
93
+ return [{
94
+ "name": "sl-select",
95
+ "method": "onSelect",
96
+ "target": undefined,
97
+ "capture": false,
98
+ "passive": false
99
+ }];
100
+ }
101
+ }
102
+ //# sourceMappingURL=pos-user-menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pos-user-menu.js","sourceRoot":"","sources":["../../../../src/components/pos-user-menu/pos-user-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAEhF,OAAO,YAAY,CAAC;AAOpB,MAAM,OAAO,WAAW;IAWtB,QAAQ,CAAC,CAAuE;QAC9E,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;QAChC,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvB,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;aAAM,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;aAAM,IAAI,KAAK,KAAK,WAAW,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QACrC,CAAC;aAAM,IAAI,KAAK,KAAK,UAAU,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,CAAC,GAAG;QACjC,OAAO,CACL,oBAAc,GAAG,EAAE,IAAI,CAAC,KAAK;YAC3B;gBACE,cAAQ,IAAI,EAAC,SAAS,gBAAY,WAAW;oBAC3C;wBACE,oBAAuB,CACX,CACP;gBACT;oBACE,oBAAc,KAAK,EAAC,WAAW,gBAAyB;oBACxD,oBAAc,KAAK,EAAC,SAAS;wBAC3B,oBAAuB,CACV;oBACf,oBAAc,KAAK,EAAC,UAAU,eAAwB;oBACtD,qBAAyB;oBACzB,oBAAc,KAAK,EAAC,QAAQ,aAAsB,CAC1C,CACE,CACD,CAChB,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, h, Listen, Prop } from '@stencil/core';\n\nimport './shoelace';\n\n@Component({\n tag: 'pos-user-menu',\n shadow: true,\n styleUrl: 'pos-user-menu.css',\n})\nexport class PosUserMenu {\n @Prop()\n webId!: string;\n\n @Event({ eventName: 'pod-os:logout' })\n logout: EventEmitter;\n\n @Event({ eventName: 'pod-os:link' })\n link: EventEmitter;\n\n @Listen('sl-select')\n onSelect(e: CustomEvent<{ item: { value: 'profile' | 'logout' | 'dashboard' } }>) {\n const { value } = e.detail.item;\n if (value === 'logout') {\n this.logout.emit();\n } else if (value === 'profile') {\n this.link.emit(this.webId);\n } else if (value === 'dashboard') {\n this.link.emit('pod-os:dashboard');\n } else if (value === 'settings') {\n this.link.emit('pod-os:settings');\n }\n }\n\n render() {\n if (!this.webId) return null; //?\n return (\n <pos-resource uri={this.webId}>\n <sl-dropdown>\n <button slot=\"trigger\" aria-label=\"User menu\">\n <pos-picture>\n <sl-avatar></sl-avatar>\n </pos-picture>\n </button>\n <sl-menu>\n <sl-menu-item value=\"dashboard\">Dashboard</sl-menu-item>\n <sl-menu-item value=\"profile\">\n <pos-label></pos-label>\n </sl-menu-item>\n <sl-menu-item value=\"settings\">Settings</sl-menu-item>\n <sl-divider></sl-divider>\n <sl-menu-item value=\"logout\">Logout</sl-menu-item>\n </sl-menu>\n </sl-dropdown>\n </pos-resource>\n );\n }\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import "@shoelace-style/shoelace/dist/components/dropdown/dropdown.js";
2
+ import "@shoelace-style/shoelace/dist/components/menu/menu.js";
3
+ import "@shoelace-style/shoelace/dist/components/menu-item/menu-item.js";
4
+ import "@shoelace-style/shoelace/dist/components/avatar/avatar.js";
5
+ import "@shoelace-style/shoelace/dist/components/divider/divider.js";
6
+ //# sourceMappingURL=shoelace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shoelace.js","sourceRoot":"","sources":["../../../../src/components/pos-user-menu/shoelace.ts"],"names":[],"mappings":"AAAA,OAAO,+DAA+D,CAAC;AACvE,OAAO,uDAAuD,CAAC;AAC/D,OAAO,iEAAiE,CAAC;AACzE,OAAO,2DAA2D,CAAC;AACnE,OAAO,6DAA6D,CAAC","sourcesContent":["import '@shoelace-style/shoelace/dist/components/dropdown/dropdown.js';\nimport '@shoelace-style/shoelace/dist/components/menu/menu.js';\nimport '@shoelace-style/shoelace/dist/components/menu-item/menu-item.js';\nimport '@shoelace-style/shoelace/dist/components/avatar/avatar.js';\nimport '@shoelace-style/shoelace/dist/components/divider/divider.js';\n"]}
@@ -1,2 +1,8 @@
1
1
  import "@ionic/core";
2
+ const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
3
+ function updateTheme(e) {
4
+ document.documentElement.classList.toggle('sl-theme-dark', e.matches);
5
+ }
6
+ updateTheme(mediaQuery);
7
+ mediaQuery.addEventListener('change', updateTheme);
2
8
  //# sourceMappingURL=global.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC","sourcesContent":["import '@ionic/core';\n"]}
1
+ {"version":3,"file":"global.js","sourceRoot":"","sources":["../../src/global.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC;AAErE,SAAS,WAAW,CAAC,CAAC;IACpB,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,WAAW,CAAC,UAAU,CAAC,CAAC;AAExB,UAAU,CAAC,gBAAgB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC","sourcesContent":["import '@ionic/core';\n\nconst mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n\nfunction updateTheme(e) {\n document.documentElement.classList.toggle('sl-theme-dark', e.matches);\n}\n\nupdateTheme(mediaQuery);\n\nmediaQuery.addEventListener('change', updateTheme);\n"]}