@pod-os/elements 0.37.0-rc.c8b54d1.0 → 0.37.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 (144) hide show
  1. package/dist/cjs/{chunk.URTPIBTY-DdK9pL5v.js → chunk.URTPIBTY-DcQsb_nW.js} +2 -2
  2. package/dist/cjs/{chunk.XQ2OKYYA-DEkhm1i7.js → chunk.XQ2OKYYA-D224sdKt.js} +3 -3
  3. package/dist/cjs/{chunk.ZGGPD2XJ-uKZZdqOH.js → chunk.ZGGPD2XJ-Cj6xUx2M.js} +1 -1
  4. package/dist/cjs/{class-map-DAZXfKKA.js → class-map-Nx8L8ElN.js} +1 -1
  5. package/dist/cjs/elements.cjs.js +3 -3
  6. package/dist/cjs/{index-DCpu_nnH.js → index-Be_lnf0w.js} +547 -2001
  7. package/dist/cjs/{index-FUnpyb19.js → index-OR1wNkjG.js} +1052 -489
  8. package/dist/cjs/{jsonld-V2RB47OZ-BerQ9IRa.js → jsonld-V2RB47OZ-B82QNsYZ.js} +1 -1
  9. package/dist/cjs/loader.cjs.js +2 -2
  10. package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +6 -6
  11. package/dist/cjs/{pos-add-new-thing_31.cjs.entry.js → pos-add-new-thing_32.cjs.entry.js} +411 -227
  12. package/dist/cjs/pos-app-document-viewer.cjs.entry.js +1 -1
  13. package/dist/cjs/pos-app-generic.cjs.entry.js +1 -1
  14. package/dist/cjs/pos-app-image-viewer.cjs.entry.js +1 -1
  15. package/dist/cjs/pos-app-ldp-container.cjs.entry.js +1 -1
  16. package/dist/cjs/pos-app-rdf-document.cjs.entry.js +1 -1
  17. package/dist/cjs/pos-attachments.cjs.entry.js +2 -2
  18. package/dist/cjs/pos-case.cjs.entry.js +24 -0
  19. package/dist/cjs/pos-container-contents.cjs.entry.js +13 -4
  20. package/dist/cjs/pos-container-item_3.cjs.entry.js +4 -4
  21. package/dist/cjs/pos-document.cjs.entry.js +4 -4
  22. package/dist/cjs/pos-list.cjs.entry.js +1 -1
  23. package/dist/cjs/pos-markdown-document.cjs.entry.js +442 -2327
  24. package/dist/cjs/pos-relations_2.cjs.entry.js +1 -1
  25. package/dist/cjs/pos-subjects.cjs.entry.js +2 -2
  26. package/dist/cjs/pos-switch.cjs.entry.js +64 -0
  27. package/dist/cjs/pos-tool-attachments.cjs.entry.js +2 -2
  28. package/dist/cjs/pos-value.cjs.entry.js +1 -1
  29. package/dist/collection/collection-manifest.json +5 -1
  30. package/dist/collection/components/pos-app/pos-app.js +2 -1
  31. package/dist/collection/components/pos-attachments/pos-attachments.js +2 -1
  32. package/dist/collection/components/pos-container-contents/pos-container-contents.js +10 -1
  33. package/dist/collection/components/pos-container-contents/pos-create-new-container-item/pos-create-new-container-item.js +4 -2
  34. package/dist/collection/components/pos-markdown-document/pos-markdown-document.js +2 -1
  35. package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.css +42 -22
  36. package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.js +3 -2
  37. package/dist/collection/components/pos-new-thing-form/pos-new-thing-form.js +1 -1
  38. package/dist/collection/components/pos-router/pos-router.js +1 -1
  39. package/dist/collection/components/pos-select-term/pos-select-term.js +1 -1
  40. package/dist/collection/components/pos-share/openNewTab.js +3 -0
  41. package/dist/collection/components/pos-share/pos-share.css +36 -0
  42. package/dist/collection/components/pos-share/pos-share.js +111 -0
  43. package/dist/collection/components/pos-switch/pos-case/pos-case.js +88 -0
  44. package/dist/collection/components/pos-switch/pos-switch.js +89 -0
  45. package/dist/collection/components/pos-tool-select/pos-tool-select.js +6 -3
  46. package/dist/collection/components/pos-upload/pos-upload.js +7 -4
  47. package/dist/collection/components/pos-user-menu/pos-user-menu.js +1 -1
  48. package/dist/collection/tools/pos-tool-attachments/pos-tool-attachments.js +1 -1
  49. package/dist/components/chunk.IVVHNXMC.js +20 -0
  50. package/dist/components/index.js +1 -1
  51. package/dist/components/index2.js +2 -2
  52. package/dist/components/pos-add-literal-value2.js +1 -1
  53. package/dist/components/pos-app-browser.js +1 -1
  54. package/dist/components/pos-attachments2.js +1 -1
  55. package/dist/components/pos-case.d.ts +11 -0
  56. package/dist/components/pos-case.js +1 -0
  57. package/dist/components/pos-container-contents2.js +1 -1
  58. package/dist/components/pos-make-findable2.js +1 -1
  59. package/dist/components/pos-markdown-document2.js +1 -1
  60. package/dist/components/pos-navigation-bar2.js +1 -1
  61. package/dist/components/pos-navigation2.js +1 -1
  62. package/dist/components/pos-new-thing-form2.js +1 -1
  63. package/dist/components/pos-router2.js +1 -1
  64. package/dist/components/pos-select-term2.js +1 -1
  65. package/dist/components/pos-share.d.ts +11 -0
  66. package/dist/components/pos-share.js +1 -0
  67. package/dist/components/pos-share2.js +1 -0
  68. package/dist/components/pos-switch.d.ts +11 -0
  69. package/dist/components/pos-switch.js +1 -0
  70. package/dist/components/pos-tool-attachments.js +1 -1
  71. package/dist/components/pos-tool-select2.js +1 -1
  72. package/dist/components/pos-type-index-entries2.js +1 -1
  73. package/dist/components/pos-upload2.js +12 -3
  74. package/dist/components/pos-user-menu2.js +6 -25
  75. package/dist/elements/elements.esm.js +1 -1
  76. package/dist/elements/{p-6561f1b7.entry.js → p-03464a71.entry.js} +1 -1
  77. package/dist/elements/{p-52a612ed.entry.js → p-272209e3.entry.js} +1 -1
  78. package/dist/elements/{p-a9a18aa8.entry.js → p-38aa17bc.entry.js} +1 -1
  79. package/dist/elements/p-3a890f5f.entry.js +1 -0
  80. package/dist/elements/{p-9ad80b52.entry.js → p-4cd2f9da.entry.js} +1 -1
  81. package/dist/elements/{p-0e7413e6.entry.js → p-5126fb6e.entry.js} +1 -1
  82. package/dist/elements/p-53610ccd.entry.js +1 -0
  83. package/dist/elements/{p-b5d64c6f.entry.js → p-631976a8.entry.js} +1 -1
  84. package/dist/elements/{p-fe628201.entry.js → p-6d628d74.entry.js} +1 -1
  85. package/dist/elements/{p-b363349c.entry.js → p-7c3785d8.entry.js} +1 -1
  86. package/dist/elements/p-8934c5ea.entry.js +1 -0
  87. package/dist/elements/p-8e76e9dc.entry.js +1 -0
  88. package/dist/elements/{p-3e18b5dd.entry.js → p-9bf6c310.entry.js} +1 -1
  89. package/dist/elements/{p-Doy_38_j.js → p-BLUiM5OK.js} +1 -1
  90. package/dist/elements/{p-BkAnMOpW.js → p-CSTMd_cW.js} +2 -2
  91. package/dist/elements/{p-CrxYqX8r.js → p-CVwgVrbO.js} +7 -7
  92. package/dist/elements/{p-8ggjG2YF.js → p-CnIOZlf7.js} +1 -1
  93. package/dist/elements/p-DHl0QGLf.js +67 -0
  94. package/dist/elements/p-DzbCx-pP.js +2 -0
  95. package/dist/elements/{p-c8ee910c.entry.js → p-a1dd6b42.entry.js} +1 -1
  96. package/dist/elements/p-ab4eba43.entry.js +859 -0
  97. package/dist/elements/{p-dff14248.entry.js → p-c7032012.entry.js} +1 -1
  98. package/dist/elements/{p-a20b72d8.entry.js → p-d396cc56.entry.js} +1 -1
  99. package/dist/elements/p-dc4c38c8.entry.js +1 -0
  100. package/dist/elements/{p-0a087865.entry.js → p-e0660718.entry.js} +1 -1
  101. package/dist/elements/{p-8q-RA2Uq.js → p-mIPOXLnA.js} +3 -3
  102. package/dist/esm/{chunk.URTPIBTY-CNA3-SLq.js → chunk.URTPIBTY-yxgfEQ1K.js} +2 -2
  103. package/dist/esm/{chunk.XQ2OKYYA-CXNlpYUG.js → chunk.XQ2OKYYA-Cr3bMzqn.js} +3 -3
  104. package/dist/esm/{chunk.ZGGPD2XJ-BjT6fS1o.js → chunk.ZGGPD2XJ-SJISSXOc.js} +1 -1
  105. package/dist/esm/{class-map-CUYFUkXU.js → class-map-DEweE_Cr.js} +1 -1
  106. package/dist/esm/elements.js +4 -4
  107. package/dist/esm/{index-DFqG64hG.js → index-CXK32bJz.js} +1052 -489
  108. package/dist/esm/{index-VMHzF3uY.js → index-DzbCx-pP.js} +547 -2001
  109. package/dist/esm/{jsonld-V2RB47OZ-CaIJ08AA.js → jsonld-V2RB47OZ-BbN7F0s8.js} +1 -1
  110. package/dist/esm/loader.js +3 -3
  111. package/dist/esm/pos-add-literal-value_3.entry.js +6 -6
  112. package/dist/esm/{pos-add-new-thing_31.entry.js → pos-add-new-thing_32.entry.js} +411 -228
  113. package/dist/esm/pos-app-document-viewer.entry.js +1 -1
  114. package/dist/esm/pos-app-generic.entry.js +1 -1
  115. package/dist/esm/pos-app-image-viewer.entry.js +1 -1
  116. package/dist/esm/pos-app-ldp-container.entry.js +1 -1
  117. package/dist/esm/pos-app-rdf-document.entry.js +1 -1
  118. package/dist/esm/pos-attachments.entry.js +2 -2
  119. package/dist/esm/pos-case.entry.js +22 -0
  120. package/dist/esm/pos-container-contents.entry.js +12 -3
  121. package/dist/esm/pos-container-item_3.entry.js +4 -4
  122. package/dist/esm/pos-document.entry.js +4 -4
  123. package/dist/esm/pos-list.entry.js +1 -1
  124. package/dist/esm/pos-markdown-document.entry.js +442 -2327
  125. package/dist/esm/pos-relations_2.entry.js +1 -1
  126. package/dist/esm/pos-subjects.entry.js +2 -2
  127. package/dist/esm/pos-switch.entry.js +62 -0
  128. package/dist/esm/pos-tool-attachments.entry.js +2 -2
  129. package/dist/esm/pos-value.entry.js +1 -1
  130. package/dist/jest-setup.js +4 -0
  131. package/dist/types/components/pos-container-contents/pos-container-contents.d.ts +2 -0
  132. package/dist/types/components/pos-share/openNewTab.d.ts +1 -0
  133. package/dist/types/components/pos-share/pos-share.d.ts +28 -0
  134. package/dist/types/components/pos-switch/pos-case/pos-case.d.ts +22 -0
  135. package/dist/types/components/pos-switch/pos-switch.d.ts +19 -0
  136. package/dist/types/components.d.ts +300 -74
  137. package/dist/types/stencil-public-runtime.d.ts +52 -2
  138. package/package.json +13 -12
  139. package/dist/elements/p-637a38d9.entry.js +0 -1
  140. package/dist/elements/p-701f2c84.entry.js +0 -850
  141. package/dist/elements/p-9b74c400.entry.js +0 -1
  142. package/dist/elements/p-LoCE14bN.js +0 -67
  143. package/dist/elements/p-VMHzF3uY.js +0 -2
  144. package/dist/elements/p-ac17ed6a.entry.js +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DCpu_nnH.js');
3
+ var index = require('./index-Be_lnf0w.js');
4
4
  var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
5
5
 
6
6
  const posRelationsCss = () => `:host{--background-base-color:color-mix(in srgb, var(--pos-background-color), var(--color-grey-800) 10%);--background-color-even:hsl(from var(--background-base-color) h s calc(l + 7));--background-color-odd:hsl(from var(--background-base-color) h s calc(l + 10));--border-color:var(--background-base-color)}dd{padding:0;margin:0}dl{display:flex;flex-direction:column;gap:var(--size-1);padding:0;margin:0}dt{margin-bottom:var(--size-1)}.predicate-values:nth-child(odd){background-color:var(--background-color-odd)}.predicate-values:nth-child(even){background-color:var(--background-color-even)}.predicate-values{display:flex;flex-direction:column;border:var(--size-px) solid var(--border-color);padding:var(--size-2);gap:var(--size-1);.values{display:flex;flex-direction:column;gap:var(--size-3)}}pos-rich-link{--background-color:inherit}`;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DCpu_nnH.js');
4
- var index$1 = require('./index-FUnpyb19.js');
3
+ var index = require('./index-Be_lnf0w.js');
4
+ var index$1 = require('./index-OR1wNkjG.js');
5
5
  var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
6
6
 
7
7
  const posSubjectsCss = () => `:host{--background-base-color:color-mix(in srgb, var(--pos-background-color), var(--color-grey-800) 10%);--background-color-even:hsl(from var(--background-base-color) h s calc(l + 7));--background-color-odd:hsl(from var(--background-base-color) h s calc(l + 10));--border-color:var(--background-base-color)}ul{display:flex;flex-direction:column;gap:var(--size-2);margin:0;padding:0;li{border:var(--size-px) solid var(--border-color);padding:var(--size-4);list-style-type:none;&:nth-child(even){background-color:var(--background-color-even)}&:nth-child(odd){background-color:var(--background-color-odd)}}}`;
@@ -0,0 +1,64 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index-Be_lnf0w.js');
4
+ var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
5
+
6
+ const PosSwitch = class {
7
+ constructor(hostRef) {
8
+ index.registerInstance(this, hostRef);
9
+ this.subscribeResource = index.createEvent(this, "pod-os:resource", 7);
10
+ this.error = null;
11
+ this.receiveResource = (resource) => {
12
+ this.resource = resource;
13
+ };
14
+ }
15
+ componentWillLoad() {
16
+ ResourceAware.subscribeResource(this);
17
+ const caseElements = this.host.querySelectorAll('pos-case');
18
+ if (caseElements.length == 0) {
19
+ this.error = 'No pos-case elements found';
20
+ }
21
+ else {
22
+ this.caseElements = caseElements;
23
+ }
24
+ }
25
+ test(caseElement) {
26
+ let state = null;
27
+ if (caseElement.getAttribute('if-typeof') !== null) {
28
+ state = this.resource
29
+ .types()
30
+ .map(x => x.uri)
31
+ .includes(caseElement.getAttribute('if-typeof'));
32
+ }
33
+ if (caseElement.getAttribute('not') != null) {
34
+ state = !state;
35
+ }
36
+ return state;
37
+ }
38
+ render() {
39
+ if (this.error) {
40
+ return this.error;
41
+ }
42
+ if (!this.resource) {
43
+ return null;
44
+ }
45
+ let state = null;
46
+ let activeElements = [];
47
+ this.caseElements.forEach(el => {
48
+ const elemState = this.test(el);
49
+ const includeCondition = state !== true || el.getAttribute('else') === null;
50
+ if (elemState && includeCondition) {
51
+ state = elemState;
52
+ activeElements.push(el);
53
+ }
54
+ if (elemState === null && includeCondition) {
55
+ activeElements.push(el);
56
+ }
57
+ });
58
+ const activeElementsContent = activeElements.map(el => el.querySelector('template').innerHTML).join('\n');
59
+ return index.h(index.Host, { innerHTML: activeElementsContent });
60
+ }
61
+ get host() { return index.getElement(this); }
62
+ };
63
+
64
+ exports.pos_switch = PosSwitch;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DCpu_nnH.js');
3
+ var index = require('./index-Be_lnf0w.js');
4
4
  var usePodOS = require('./usePodOS-BnFzjtlx.js');
5
5
  var useResource = require('./useResource-IN7KmaP3.js');
6
6
 
@@ -20,7 +20,7 @@ const PosToolAttachments = class {
20
20
  }
21
21
  render() {
22
22
  var _a;
23
- return (index.h(index.Host, { key: 'c7670fa2c000099af02d33a702a404e9889d4552' }, index.h("section", { key: '1b3ce82d5101ec4c0b6e6df26ede473c7287b747' }, index.h("article", { key: 'b9929952d801ab53a848985af7ed08c18072a662' }, index.h("h2", { key: 'dc39c20da1730c6ea01b32a99dc8b0680a33b6c2' }, "Attachments"), index.h("pos-attachments", { key: '65fd33e592be78e1a15ac9c2238321973a3f8612', ref: it => (this.attachmentsElement = it) }))), index.h("section", { key: '4ebe089659ed2c517440a9ff06141f332e44c56d' }, ((_a = this.resource) === null || _a === void 0 ? void 0 : _a.editable) ? (index.h("pos-upload", { accept: ['*/*'], uploader: file => {
23
+ return (index.h(index.Host, { key: '90a688233dde6bed413d57c11d89833629e1e2c8' }, index.h("section", { key: 'd47427736806216b35cb5e77bcabf12b82a03b31' }, index.h("article", { key: 'a77c2f9e41165effdc6e41fed79fa6b48dcc753e' }, index.h("h2", { key: '5e4d9a23ceb3c88075ef7785ca1b6fba201714ca' }, "Attachments"), index.h("pos-attachments", { key: '6a1001d633b0cad66178818b7a32c76ebbc4e46c', ref: it => (this.attachmentsElement = it) }))), index.h("section", { key: 'ea6c933f2a5fb67d6e63ca799c14920361eafe1f' }, ((_a = this.resource) === null || _a === void 0 ? void 0 : _a.editable) ? (index.h("pos-upload", { accept: ['*/*'], uploader: file => {
24
24
  const result = this.os.attachments().uploadAndAddAttachment(this.resource, file);
25
25
  result.map(it => {
26
26
  this.attachmentsElement.addToList({
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-DCpu_nnH.js');
3
+ var index = require('./index-Be_lnf0w.js');
4
4
  var ResourceAware = require('./ResourceAware-uqh9ZRDt.js');
5
5
 
6
6
  const PosValue = class {
@@ -43,7 +43,10 @@
43
43
  "components/pos-rich-link/pos-rich-link.js",
44
44
  "components/pos-router/pos-router.js",
45
45
  "components/pos-select-term/pos-select-term.js",
46
+ "components/pos-share/pos-share.js",
46
47
  "components/pos-subjects/pos-subjects.js",
48
+ "components/pos-switch/pos-switch.js",
49
+ "components/pos-switch/pos-case/pos-case.js",
47
50
  "components/pos-tool-select/pos-tool-select.js",
48
51
  "components/pos-type-badges/pos-type-badges.js",
49
52
  "components/pos-type-index-entries/pos-type-index-entries.js",
@@ -53,9 +56,10 @@
53
56
  "components/pos-value/pos-value.js",
54
57
  "tools/pos-tool-attachments/pos-tool-attachments.js"
55
58
  ],
59
+ "mixins": [],
56
60
  "compiler": {
57
61
  "name": "@stencil/core",
58
- "version": "4.40.1",
62
+ "version": "4.43.2",
59
63
  "typescriptVersion": "5.8.3"
60
64
  },
61
65
  "collections": [],
@@ -126,7 +126,8 @@ export class PosApp {
126
126
  "PodOS": {
127
127
  "location": "import",
128
128
  "path": "@pod-os/core",
129
- "id": "../core/types/index.d.ts::PodOS"
129
+ "id": "../core/types/index.d.ts::PodOS",
130
+ "referenceLocation": "PodOS"
130
131
  }
131
132
  }
132
133
  }
@@ -63,7 +63,8 @@ export class PosAttachments {
63
63
  "Attachment": {
64
64
  "location": "import",
65
65
  "path": "@pod-os/core",
66
- "id": "../core/types/index.d.ts::Attachment"
66
+ "id": "../core/types/index.d.ts::Attachment",
67
+ "referenceLocation": "Attachment"
67
68
  }
68
69
  },
69
70
  "return": "Promise<void>"
@@ -1,15 +1,20 @@
1
1
  import { LdpContainer } from "@pod-os/core";
2
2
  import { h, Host } from "@stencil/core";
3
3
  import { subscribeResource } from "../events/ResourceAware";
4
+ import { Subject, takeUntil } from "rxjs";
4
5
  export class PosContainerContents {
5
6
  constructor() {
6
7
  this.contents = [];
7
8
  this.loading = true;
8
9
  this.createNewItem = null;
10
+ this.disconnected$ = new Subject();
9
11
  this.receiveResource = (resource) => {
10
12
  this.container = resource.assume(LdpContainer);
11
13
  this.loading = false;
12
- this.contents = this.container.contains().sort((a, b) => a.name.localeCompare(b.name));
14
+ this.container
15
+ .observeContains()
16
+ .pipe(takeUntil(this.disconnected$))
17
+ .subscribe(contains => (this.contents = contains.sort((a, b) => a.name.localeCompare(b.name))));
13
18
  };
14
19
  }
15
20
  onCreateNewFile() {
@@ -35,6 +40,10 @@ export class PosContainerContents {
35
40
  }
36
41
  return (h(Host, null, h("pos-container-toolbar", { "onPod-os:create-new-file": () => this.onCreateNewFile(), "onPod-os:create-new-folder": () => this.onCreateNewFolder() }), items.length > 0 ? h("ul", { "aria-label": "Container contents" }, items) : h("p", null, "The container is empty")));
37
42
  }
43
+ disconnectedCallback() {
44
+ this.disconnected$.next();
45
+ this.disconnected$.unsubscribe();
46
+ }
38
47
  static get is() { return "pos-container-contents"; }
39
48
  static get encapsulation() { return "shadow"; }
40
49
  static get originalStyleUrls() {
@@ -85,7 +85,8 @@ export class PosCreateNewContainerItem {
85
85
  "LdpContainer": {
86
86
  "location": "import",
87
87
  "path": "@pod-os/core",
88
- "id": "../core/types/index.d.ts::LdpContainer"
88
+ "id": "../core/types/index.d.ts::LdpContainer",
89
+ "referenceLocation": "LdpContainer"
89
90
  }
90
91
  }
91
92
  },
@@ -139,7 +140,8 @@ export class PosCreateNewContainerItem {
139
140
  "Problem": {
140
141
  "location": "import",
141
142
  "path": "@pod-os/core",
142
- "id": "../core/types/index.d.ts::Problem"
143
+ "id": "../core/types/index.d.ts::Problem",
144
+ "referenceLocation": "Problem"
143
145
  }
144
146
  }
145
147
  }
@@ -92,7 +92,8 @@ export class PosMarkdownDocument {
92
92
  "SolidFile": {
93
93
  "location": "import",
94
94
  "path": "@pod-os/core",
95
- "id": "../core/types/index.d.ts::SolidFile"
95
+ "id": "../core/types/index.d.ts::SolidFile",
96
+ "referenceLocation": "SolidFile"
96
97
  }
97
98
  }
98
99
  },
@@ -1,5 +1,8 @@
1
1
  section.current {
2
2
  display: flex;
3
+ align-items: center;
4
+ box-sizing: border-box;
5
+ padding: 0 var(--size-2) 0 0;
3
6
  height: var(--pos-navigation-bar-height);
4
7
  flex-grow: 1;
5
8
  gap: 0;
@@ -9,30 +12,47 @@ section.current {
9
12
  &:focus-within {
10
13
  outline: var(--pos-input-focus-outline);
11
14
  }
12
- }
13
15
 
14
- section.current button {
15
- cursor: pointer;
16
- font-size: var(--scale-1);
17
- display: flex;
18
- align-items: center;
19
- justify-content: center;
20
- flex-grow: 1;
21
- background: none;
22
- color: var(--pos-normal-text-color);
23
- outline: none;
24
- border: none;
25
- overflow: hidden;
26
- text-overflow: ellipsis;
27
- white-space: nowrap;
28
- &:focus {
29
- text-decoration: underline;
30
- }
31
- :first-child {
16
+ button {
17
+ cursor: pointer;
18
+ font-size: var(--scale-1);
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
32
22
  flex-grow: 1;
23
+ background: none;
24
+ color: var(--pos-normal-text-color);
25
+ outline: none;
26
+ border: none;
27
+ overflow: hidden;
28
+ text-overflow: ellipsis;
29
+ white-space: nowrap;
30
+ &:focus {
31
+ text-decoration: underline;
32
+ }
33
+ :first-child {
34
+ flex-grow: 1;
35
+ }
36
+ svg {
37
+ width: var(--size-6);
38
+ color: var(--pos-subtle-text-color);
39
+ }
33
40
  }
34
- svg {
35
- width: var(--size-6);
36
- color: var(--pos-subtle-text-color);
41
+ pos-share {
42
+ height: 80%;
43
+ &:hover {
44
+ &::part(button) {
45
+ color: var(--pos-primary-color);
46
+ background-color: var(--pos-border-color);
47
+ border-radius: var(--radius-full);
48
+ }
49
+ }
50
+ &::part(button) {
51
+ font-size: var(--size-4);
52
+ background: none;
53
+ outline: none;
54
+ border: none;
55
+ color: var(--pos-subtle-text-color);
56
+ }
37
57
  }
38
58
  }
@@ -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: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && h("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), h("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, h("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon())));
14
+ return (h("section", { key: '5f49aa9dad9d07550ee8ffbee90036cbc1efda55', class: "current" }, this.current && this.searchIndexReady && h("pos-make-findable", { key: '85974a4772aaf8cad3a11cdcd49e6df10141bfe3', uri: this.current.uri }), h("button", { key: '40660a3455b0f3392c68d7aea0075b102a1762a2', "aria-label": ariaLabel, onClick: () => this.onClick() }, h("div", { key: '9ab8922175d701f714f72aefb95745cf5ae4bb95' }, this.current ? this.current.label() : 'Search or enter URI'), this.icon()), this.current && h("pos-share", { key: '3b80c1987f9f5138b11b8a106171fc73a236f426', uri: this.current.uri })));
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" })));
@@ -40,7 +40,8 @@ export class PosNavigationBar {
40
40
  "Thing": {
41
41
  "location": "import",
42
42
  "path": "@pod-os/core",
43
- "id": "../core/types/index.d.ts::Thing"
43
+ "id": "../core/types/index.d.ts::Thing",
44
+ "referenceLocation": "Thing"
44
45
  }
45
46
  }
46
47
  },
@@ -14,7 +14,7 @@ export class PosNewThingForm {
14
14
  subscribePodOs(this);
15
15
  }
16
16
  render() {
17
- return (h("form", { key: 'a362c5b749dd744123973987ff8b0291485b465e', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h("label", { key: '45c78b0b48955cc157d04f547285b4ae4c19c38f', htmlFor: "type" }, "Type"), h("pos-select-term", { key: 'e3c3ab9abdbbb585916d95ba1aa14a066dbc5bd0', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h("label", { key: 'c696f8ed862d40d3c366ef0ede5e88e574928db3', htmlFor: "name" }, "Name"), h("input", { key: '89e6289e24ca9d3969da97c7aeb22224db1c376c', 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: 'b9520afef34177c6f14ab0798c045536d5661a2a', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
17
+ return (h("form", { key: '64781cfb0e570d2368325d674c6637c581bb87c2', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h("label", { key: '409e04f147430042eb334024fc7061574ab543cf', htmlFor: "type" }, "Type"), h("pos-select-term", { key: '8d5d580ee1f1e2e2c60cac0cc06798e94a0d28c3', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h("label", { key: 'a45199618751e24b7d4a1bc13ad85c599cc93d1c', htmlFor: "name" }, "Name"), h("input", { key: 'bee3be7a680abbffc08caa5c549b68b1e653872d', 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: 'e8fab4d442188f7f2f325ff7bde3dce6d3f772f6', id: "create", type: "submit", value: "Create", disabled: !this.canSubmit })));
18
18
  }
19
19
  handleChange(event) {
20
20
  this.name = event.target.value;
@@ -38,7 +38,7 @@ export class PosRouter {
38
38
  this.routeChanged.emit(this.uri);
39
39
  }
40
40
  render() {
41
- return h("slot", { key: '8b09de3dbbd253665cd541b9f264b0dcdc774354' });
41
+ return h("slot", { key: '2775fc2835158ccd8d540e4f27edfd497eafe7a9' });
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: '2e995b15a3b76a13cd7e11d09670121a6191b5ce' }, h("input", { key: 'ad79f1b410312790d4f5cd1f398b2eec3c04aad7', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h("datalist", { key: 'e3cc9ce85b75033bac29a32ca8e55c57535a9659', part: "terms", id: "terms" }, this.terms.map(term => (h("option", { value: term.uri }, term.shorthand))))));
22
+ return (h(Host, { key: 'a4050d72acd62d907f0fd4c3b90c54194700871c' }, h("input", { key: '99b35c4a14a2623599ba237bb4af0b79c0761196', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h("datalist", { key: 'd64ad5ea83200014c6de5cd4720f29922494982c', 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,3 @@
1
+ export function openNewTab(url) {
2
+ window.open(url.toString(), '_blank');
3
+ }
@@ -0,0 +1,36 @@
1
+ :host {
2
+ display: flex;
3
+ aspect-ratio: 1/1;
4
+ height: var(--size-8);
5
+ align-items: center;
6
+ justify-content: center;
7
+ }
8
+
9
+ sl-dropdown {
10
+ height: 100%;
11
+ width: 100%;
12
+ display: flex;
13
+ align-items: center;
14
+ justify-content: center;
15
+ &::part(trigger) {
16
+ height: 100%;
17
+ width: 100%;
18
+ }
19
+ button {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ height: 100%;
24
+ width: 100%;
25
+ cursor: pointer;
26
+ padding: 0;
27
+ margin: 0;
28
+ }
29
+ }
30
+
31
+ sl-menu-item[disabled] {
32
+ &::part(base) {
33
+ cursor: default;
34
+ opacity: 1;
35
+ }
36
+ }
@@ -0,0 +1,111 @@
1
+ import { h } from "@stencil/core";
2
+ import "@shoelace-style/shoelace/dist/components/icon/icon.js";
3
+ import "@shoelace-style/shoelace/dist/components/menu/menu.js";
4
+ import "@shoelace-style/shoelace/dist/components/dropdown/dropdown.js";
5
+ import "@shoelace-style/shoelace/dist/components/menu-item/menu-item.js";
6
+ import "@shoelace-style/shoelace/dist/components/divider/divider.js";
7
+ import { usePodOS } from "../events/usePodOS";
8
+ import { openNewTab } from "./openNewTab";
9
+ /**
10
+ * Allows sharing a resource with other apps, people, etc.
11
+ */
12
+ export class PosShare {
13
+ constructor() {
14
+ this.apps = [];
15
+ }
16
+ async resourceLoaded(e) {
17
+ if (e.detail === this.uri) {
18
+ await this.updateApps();
19
+ }
20
+ }
21
+ async componentWillLoad() {
22
+ this.os = await usePodOS(this.el);
23
+ await this.updateApps();
24
+ }
25
+ async updateApps() {
26
+ const thing = this.os.store.get(this.uri);
27
+ this.apps = this.os.proposeAppsFor(thing);
28
+ }
29
+ onSelect(e) {
30
+ const { value } = e.detail.item;
31
+ if (value === 'copy-uri') {
32
+ navigator.clipboard.writeText(this.uri);
33
+ }
34
+ else {
35
+ openNewTab(value.urlTemplate.expand({ uri: this.uri }));
36
+ }
37
+ }
38
+ render() {
39
+ return (h("sl-dropdown", { key: '67ce5a1f7e5630ff40a6e79eaa9ab7f32b5f1a00' }, h("button", { key: '6c946718e7af9f0ef212c3853641f06a24d79474', slot: "trigger", "aria-label": "Share", part: "button" }, h("sl-icon", { key: 'effc4e9bdf4236451636f1b4622605c87746d414', name: "share" })), h("sl-menu", { key: '2f1c8e707e71a699803c2897fda8f1e79ccd5267' }, h("sl-menu-item", { key: '5a59cffe8351c23389620b38b60f8ccd24dce351', value: "copy-uri" }, h("sl-icon", { key: 'ab9b9d7f8a2a91e0a4f5ac657b9ff390418948cc', slot: "prefix", name: "copy" }), "Copy URI"), this.apps.length > 0 && h(OpenWithApps, { key: '718fbda37b7171df356afe02e6d6f7f1e8e8cd26', apps: this.apps }))));
40
+ }
41
+ static get is() { return "pos-share"; }
42
+ static get encapsulation() { return "shadow"; }
43
+ static get originalStyleUrls() {
44
+ return {
45
+ "$": ["pos-share.css"]
46
+ };
47
+ }
48
+ static get styleUrls() {
49
+ return {
50
+ "$": ["pos-share.css"]
51
+ };
52
+ }
53
+ static get properties() {
54
+ return {
55
+ "uri": {
56
+ "type": "string",
57
+ "mutable": false,
58
+ "complexType": {
59
+ "original": "string",
60
+ "resolved": "string",
61
+ "references": {}
62
+ },
63
+ "required": true,
64
+ "optional": false,
65
+ "docs": {
66
+ "tags": [],
67
+ "text": "URI of the resource to share."
68
+ },
69
+ "getter": false,
70
+ "setter": false,
71
+ "reflect": false,
72
+ "attribute": "uri"
73
+ }
74
+ };
75
+ }
76
+ static get states() {
77
+ return {
78
+ "apps": {},
79
+ "os": {}
80
+ };
81
+ }
82
+ static get elementRef() { return "el"; }
83
+ static get watchers() {
84
+ return [{
85
+ "propName": "uri",
86
+ "methodName": "updateApps"
87
+ }];
88
+ }
89
+ static get listeners() {
90
+ return [{
91
+ "name": "pod-os:resource-loaded",
92
+ "method": "resourceLoaded",
93
+ "target": "document",
94
+ "capture": false,
95
+ "passive": false
96
+ }, {
97
+ "name": "sl-select",
98
+ "method": "onSelect",
99
+ "target": undefined,
100
+ "capture": false,
101
+ "passive": false
102
+ }];
103
+ }
104
+ }
105
+ function OpenWithApps({ apps }) {
106
+ return [
107
+ h("sl-divider", null),
108
+ h("sl-menu-item", { disabled: true }, "Open with..."),
109
+ apps.map(it => h("sl-menu-item", { value: it }, it.name)),
110
+ ];
111
+ }
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Defines a template to use if the specified condition is met - to be used with [pos-switch](https://pod-os.org/reference/elements/components/pos-switch/).
3
+ * See [storybook](https://pod-os.github.io/PodOS/storybook/?path=/story/basics--pos-switch) for an example.
4
+ */
5
+ export class PosCase {
6
+ constructor() {
7
+ this.error = null;
8
+ }
9
+ componentWillLoad() {
10
+ const templateElement = this.host.querySelector('template');
11
+ if (templateElement == null) {
12
+ this.error = 'No template element found';
13
+ }
14
+ }
15
+ render() {
16
+ if (this.error)
17
+ return this.error;
18
+ return null;
19
+ }
20
+ static get is() { return "pos-case"; }
21
+ static get properties() {
22
+ return {
23
+ "ifTypeof": {
24
+ "type": "string",
25
+ "mutable": false,
26
+ "complexType": {
27
+ "original": "string",
28
+ "resolved": "string",
29
+ "references": {}
30
+ },
31
+ "required": false,
32
+ "optional": true,
33
+ "docs": {
34
+ "tags": [],
35
+ "text": "Test if the resource is of the specified type"
36
+ },
37
+ "getter": false,
38
+ "setter": false,
39
+ "reflect": false,
40
+ "attribute": "if-typeof"
41
+ },
42
+ "not": {
43
+ "type": "boolean",
44
+ "mutable": false,
45
+ "complexType": {
46
+ "original": "boolean",
47
+ "resolved": "boolean",
48
+ "references": {}
49
+ },
50
+ "required": false,
51
+ "optional": true,
52
+ "docs": {
53
+ "tags": [],
54
+ "text": "Negates the result of the test"
55
+ },
56
+ "getter": false,
57
+ "setter": false,
58
+ "reflect": false,
59
+ "attribute": "not"
60
+ },
61
+ "else": {
62
+ "type": "boolean",
63
+ "mutable": false,
64
+ "complexType": {
65
+ "original": "boolean",
66
+ "resolved": "boolean",
67
+ "references": {}
68
+ },
69
+ "required": false,
70
+ "optional": true,
71
+ "docs": {
72
+ "tags": [],
73
+ "text": "The test only evaluates to true if tests for preceding cases have failed"
74
+ },
75
+ "getter": false,
76
+ "setter": false,
77
+ "reflect": false,
78
+ "attribute": "else"
79
+ }
80
+ };
81
+ }
82
+ static get states() {
83
+ return {
84
+ "error": {}
85
+ };
86
+ }
87
+ static get elementRef() { return "host"; }
88
+ }