@pod-os/elements 0.30.2-rc.0b72955.0 → 0.30.2-rc.1b2b855.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/elements.cjs.js +1 -1
- package/dist/cjs/{ion-badge_5.cjs.entry.js → ion-badge_4.cjs.entry.js} +1 -21
- package/dist/cjs/ion-badge_4.cjs.entry.js.map +1 -0
- package/dist/cjs/ion-icon_33.cjs.entry.js +6 -5
- package/dist/cjs/ion-icon_33.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pos-app-document-viewer.cjs.entry.js +1 -1
- package/dist/cjs/pos-app-document-viewer.cjs.entry.js.map +1 -1
- package/dist/cjs/pos-document.cjs.entry.js +7 -2
- package/dist/cjs/pos-document.cjs.entry.js.map +1 -1
- package/dist/cjs/pos-markdown-document.cjs.entry.js +1500 -0
- package/dist/cjs/pos-markdown-document.cjs.entry.js.map +1 -0
- package/dist/cjs/pos-predicate.cjs.entry.js +28 -0
- package/dist/cjs/pos-predicate.cjs.entry.js.map +1 -0
- package/dist/collection/apps/pos-app-document-viewer/pos-app-document-viewer.js +1 -1
- package/dist/collection/apps/pos-app-document-viewer/pos-app-document-viewer.js.map +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/pos-document/pos-document.js +8 -3
- package/dist/collection/components/pos-document/pos-document.js.map +1 -1
- package/dist/collection/components/pos-markdown-document/pos-markdown-document.css +3 -0
- package/dist/collection/components/pos-markdown-document/pos-markdown-document.js +69 -0
- package/dist/collection/components/pos-markdown-document/pos-markdown-document.js.map +1 -0
- package/dist/collection/components/pos-markdown-document/sanitize.js +10 -0
- package/dist/collection/components/pos-markdown-document/sanitize.js.map +1 -0
- package/dist/collection/components/pos-navigation/bar/pos-navigation-bar.js +1 -1
- package/dist/collection/components/pos-navigation/pos-navigation.js +1 -1
- package/dist/collection/components/pos-new-thing-form/pos-new-thing-form.js +1 -1
- package/dist/collection/components/pos-router/pos-router.js +1 -1
- package/dist/collection/components/pos-select-term/pos-select-term.js +1 -1
- package/dist/collection/components/pos-type-router/availableTools.js +55 -0
- package/dist/collection/components/pos-type-router/availableTools.js.map +1 -0
- package/dist/collection/components/pos-type-router/selectToolsForTypes.js +1 -54
- package/dist/collection/components/pos-type-router/selectToolsForTypes.js.map +1 -1
- package/dist/components/pos-app-document-viewer.js +9 -45
- package/dist/components/pos-app-document-viewer.js.map +1 -1
- package/dist/components/pos-document2.js +18 -7
- package/dist/components/pos-document2.js.map +1 -1
- package/dist/components/pos-markdown-document.d.ts +11 -0
- package/dist/components/pos-markdown-document.js +8 -0
- package/dist/components/pos-markdown-document.js.map +1 -0
- package/dist/components/pos-markdown-document2.js +1514 -0
- package/dist/components/pos-markdown-document2.js.map +1 -0
- package/dist/components/pos-navigation-bar2.js +1 -1
- package/dist/components/pos-navigation2.js +1 -1
- package/dist/components/pos-new-thing-form2.js +1 -1
- package/dist/components/pos-router2.js +1 -1
- package/dist/components/pos-select-term2.js +1 -1
- package/dist/components/pos-type-router2.js +1 -0
- package/dist/components/pos-type-router2.js.map +1 -1
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/elements.esm.js.map +1 -1
- package/dist/elements/p-262e321b.entry.js +2 -0
- package/dist/elements/p-262e321b.entry.js.map +1 -0
- package/dist/elements/p-51f0a869.entry.js +3 -0
- package/dist/elements/p-51f0a869.entry.js.map +1 -0
- package/dist/elements/p-b98f91f4.entry.js +2 -0
- package/dist/elements/p-b98f91f4.entry.js.map +1 -0
- package/dist/elements/{p-fe3c0e1b.entry.js → p-c267a78a.entry.js} +2 -2
- package/dist/elements/p-c267a78a.entry.js.map +1 -0
- package/dist/elements/{p-f2e65e83.entry.js → p-c43ec7b2.entry.js} +2 -2
- package/dist/elements/p-c43ec7b2.entry.js.map +1 -0
- package/dist/elements/{p-a7c9aa13.entry.js → p-c5efde87.entry.js} +2 -2
- package/dist/elements/{p-a7c9aa13.entry.js.map → p-c5efde87.entry.js.map} +1 -1
- package/dist/esm/elements.js +1 -1
- package/dist/esm/{ion-badge_5.entry.js → ion-badge_4.entry.js} +2 -21
- package/dist/esm/ion-badge_4.entry.js.map +1 -0
- package/dist/esm/ion-icon_33.entry.js +6 -5
- package/dist/esm/ion-icon_33.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pos-app-document-viewer.entry.js +1 -1
- package/dist/esm/pos-app-document-viewer.entry.js.map +1 -1
- package/dist/esm/pos-document.entry.js +7 -2
- package/dist/esm/pos-document.entry.js.map +1 -1
- package/dist/esm/pos-markdown-document.entry.js +1496 -0
- package/dist/esm/pos-markdown-document.entry.js.map +1 -0
- package/dist/esm/pos-predicate.entry.js +24 -0
- package/dist/esm/pos-predicate.entry.js.map +1 -0
- package/dist/types/components/pos-document/pos-document.d.ts +1 -1
- package/dist/types/components/pos-markdown-document/pos-markdown-document.d.ts +7 -0
- package/dist/types/components/pos-markdown-document/sanitize.d.ts +4 -0
- package/dist/types/components/pos-type-router/availableTools.d.ts +4 -0
- package/dist/types/components/pos-type-router/selectToolsForTypes.d.ts +0 -3
- package/dist/types/components.d.ts +17 -2
- package/package.json +3 -1
- package/dist/cjs/ion-badge_5.cjs.entry.js.map +0 -1
- package/dist/elements/p-26c54a6f.entry.js +0 -2
- package/dist/elements/p-26c54a6f.entry.js.map +0 -1
- package/dist/elements/p-f2e65e83.entry.js.map +0 -1
- package/dist/elements/p-fe3c0e1b.entry.js.map +0 -1
- package/dist/esm/ion-badge_5.entry.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-45dd971c.js');
|
|
6
|
+
|
|
7
|
+
const posPredicateCss = ":host{--text-color:var(--pos-primary-color);font-family:var(--font-sans)}button{line-height:var(--scale-0);font-family:inherit;margin:0;padding:0;display:flex;background:none;border:none;cursor:pointer}button,a{color:var(--text-color);font-weight:var(--weight-light);line-height:var(--scale-0);font-size:var(--scale-0);font-family:inherit}.container{display:flex;gap:var(--size-1);flex-direction:row;align-items:center;line-height:var(--scale-0)}";
|
|
8
|
+
const PosPredicateStyle0 = posPredicateCss;
|
|
9
|
+
|
|
10
|
+
const PosPredicate = class {
|
|
11
|
+
constructor(hostRef) {
|
|
12
|
+
index.registerInstance(this, hostRef);
|
|
13
|
+
this.expanded = false;
|
|
14
|
+
}
|
|
15
|
+
render() {
|
|
16
|
+
if (this.expanded) {
|
|
17
|
+
return (index.h("div", { class: "container" }, index.h("a", { href: this.uri }, this.uri), index.h("button", { "aria-label": `collapse URI to ${this.label}`, onClick: () => (this.expanded = false) }, index.h("ion-icon", { name: "chevron-back-circle-outline" }))));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return (index.h("button", { onClick: () => (this.expanded = true), title: this.uri }, this.label));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
PosPredicate.style = PosPredicateStyle0;
|
|
25
|
+
|
|
26
|
+
exports.pos_predicate = PosPredicate;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=pos-predicate.cjs.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"pos-predicate.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,eAAe,GAAG,gcAAgc,CAAC;AACzd,2BAAe,eAAe;;MCYjB,YAAY;IALzB;;QAmBE,aAAQ,GAAY,KAAK,CAAC;KAoB3B;IAlBC,MAAM;QACJ,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,QACEA,iBAAK,KAAK,EAAC,WAAW,IACpBA,eAAG,IAAI,EAAE,IAAI,CAAC,GAAG,IAAG,IAAI,CAAC,GAAG,CAAK,EACjCA,kCAAoB,mBAAmB,IAAI,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,IACzFA,sBAAU,IAAI,EAAC,6BAA6B,GAAY,CACjD,CACL,EACN;SACH;aAAM;YACL,QACEA,oBAAQ,OAAO,EAAE,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,IAC3D,IAAI,CAAC,KAAK,CACJ,EACT;SACH;KACF;;;;;;","names":["h"],"sources":["src/components/pos-predicate/pos-predicate.css?tag=pos-predicate&encapsulation=shadow","src/components/pos-predicate/pos-predicate.tsx"],"sourcesContent":[":host {\n --text-color: var(--pos-primary-color);\n font-family: var(--font-sans);\n}\n\nbutton {\n line-height: var(--scale-0);\n font-family: inherit;\n margin: 0;\n padding: 0;\n display: flex;\n background: none;\n border: none;\n cursor: pointer;\n}\n\nbutton,\na {\n color: var(--text-color);\n font-weight: var(--weight-light);\n line-height: var(--scale-0);\n font-size: var(--scale-0);\n font-family: inherit;\n}\n\n.container {\n display: flex;\n gap: var(--size-1);\n flex-direction: row;\n align-items: center;\n line-height: var(--scale-0);\n}\n","import { Component, h, Prop, State } from '@stencil/core';\n\n/**\n * Displays an RDF term (predicate) in a human-friendly way, using a provided label. The user can still expand the label\n * to the full URI to see the actual predicate.\n *\n * This will only show the predicate itself, not any value. If you want to display a value, use [pos-value](../pos-value) instead.\n */\n@Component({\n tag: 'pos-predicate',\n shadow: true,\n styleUrl: './pos-predicate.css',\n})\nexport class PosPredicate {\n /**\n * The full URI of the predicate\n */\n @Prop()\n uri: string;\n\n /**\n * The human-readable label to show for this predicate\n */\n @Prop()\n label: string;\n\n @State()\n expanded: boolean = false;\n\n render() {\n if (this.expanded) {\n return (\n <div class=\"container\">\n <a href={this.uri}>{this.uri}</a>\n <button aria-label={`collapse URI to ${this.label}`} onClick={() => (this.expanded = false)}>\n <ion-icon name=\"chevron-back-circle-outline\"></ion-icon>\n </button>\n </div>\n );\n } else {\n return (\n <button onClick={() => (this.expanded = true)} title={this.uri}>\n {this.label}\n </button>\n );\n }\n }\n}\n"],"version":3}
|
|
@@ -13,7 +13,7 @@ export class PosAppDocumentViewer {
|
|
|
13
13
|
if (!this.resource) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
return (h(Host, null, h("section", null, h("pos-document", { src: this.resource.uri }))
|
|
16
|
+
return (h(Host, null, h("section", null, h("pos-document", { src: this.resource.uri }))));
|
|
17
17
|
}
|
|
18
18
|
static get is() { return "pos-app-document-viewer"; }
|
|
19
19
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pos-app-document-viewer.js","sourceRoot":"","sources":["../../../../src/apps/pos-app-document-viewer/pos-app-document-viewer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAiB,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAOzF,MAAM,OAAO,oBAAoB;IALjC;QAcE,oBAAe,GAAG,CAAC,QAAe,EAAE,EAAE;YACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pos-app-document-viewer.js","sourceRoot":"","sources":["../../../../src/apps/pos-app-document-viewer/pos-app-document-viewer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAiB,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAOzF,MAAM,OAAO,oBAAoB;IALjC;QAcE,oBAAe,GAAG,CAAC,QAAe,EAAE,EAAE;YACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,CAAC,CAAC;KAeH;IArBC,iBAAiB;QACf,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IAMD,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,CACL,EAAC,IAAI;YACH;gBACE,oBAAc,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAI,CAChC,CACL,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Thing } from '@pod-os/core';\nimport { Component, Event, EventEmitter, h, Host, State } from '@stencil/core';\nimport { ResourceAware, subscribeResource } from '../../components/events/ResourceAware';\n\n@Component({\n tag: 'pos-app-document-viewer',\n shadow: true,\n styleUrls: ['../styles/default-app-layout.css', '../styles/article-card.css'],\n})\nexport class PosAppDocumentViewer implements ResourceAware {\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 if (!this.resource) {\n return null;\n }\n\n return (\n <Host>\n <section>\n <pos-document src={this.resource.uri} />\n </section>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"components/pos-login/pos-login.js",
|
|
29
29
|
"components/pos-login-form/pos-login-form.js",
|
|
30
30
|
"components/pos-make-findable/pos-make-findable.js",
|
|
31
|
+
"components/pos-markdown-document/pos-markdown-document.js",
|
|
31
32
|
"components/pos-navigation/pos-navigation.js",
|
|
32
33
|
"components/pos-navigation/bar/pos-navigation-bar.js",
|
|
33
34
|
"components/pos-new-thing-form/pos-new-thing-form.js",
|
|
@@ -18,7 +18,7 @@ export class PosDocument {
|
|
|
18
18
|
const file = await this.os.fetchFile(this.src);
|
|
19
19
|
this.resourceLoadedEmitter.emit(this.src);
|
|
20
20
|
if (file.blob()) {
|
|
21
|
-
this.
|
|
21
|
+
this.file = file;
|
|
22
22
|
this.error = null;
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -42,7 +42,12 @@ export class PosDocument {
|
|
|
42
42
|
if (this.brokenFile) {
|
|
43
43
|
return h(BrokenFile, { file: this.brokenFile });
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
if (this.file.blob().type === 'text/markdown') {
|
|
46
|
+
return h("pos-markdown-document", { file: this.file });
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return h("iframe", { src: URL.createObjectURL(this.file.blob()) });
|
|
50
|
+
}
|
|
46
51
|
}
|
|
47
52
|
static get is() { return "pos-document"; }
|
|
48
53
|
static get encapsulation() { return "shadow"; }
|
|
@@ -101,7 +106,7 @@ export class PosDocument {
|
|
|
101
106
|
static get states() {
|
|
102
107
|
return {
|
|
103
108
|
"os": {},
|
|
104
|
-
"
|
|
109
|
+
"file": {},
|
|
105
110
|
"brokenFile": {},
|
|
106
111
|
"error": {},
|
|
107
112
|
"loading": {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pos-document.js","sourceRoot":"","sources":["../../../../src/components/pos-document/pos-document.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAOvD,MAAM,OAAO,WAAW;IALxB;QAsBU,YAAO,GAAY,IAAI,CAAC;QAchC,UAAK,GAAG,KAAK,EAAE,EAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"pos-document.js","sourceRoot":"","sources":["../../../../src/components/pos-document/pos-document.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,OAAO,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAOvD,MAAM,OAAO,WAAW;IALxB;QAsBU,YAAO,GAAY,IAAI,CAAC;QAchC,UAAK,GAAG,KAAK,EAAE,EAAS,EAAE,EAAE;YAC1B,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACf,CAAC,CAAC;KAsCH;IA7CC,iBAAiB;QACf,OAAO,CAAC,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,CAAC;IAQD,KAAK,CAAC,SAAS;QACb,IAAI,CAAC;YACH,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC/C,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1C,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;gBAChB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;gBACjB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YACpB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,UAAU,GAAG,IAAsB,CAAC;YAC3C,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACnB,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO,yBAAmB,QAAQ,EAAE,IAAI,GAAsB,CAAC;QACjE,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,WAAK,KAAK,EAAC,OAAO,IAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAO,CAAC;QACvD,CAAC;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,OAAO,EAAC,UAAU,IAAC,IAAI,EAAE,IAAI,CAAC,UAAU,GAAI,CAAC;QAC/C,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,KAAK,eAAe,EAAE,CAAC;YAC9C,OAAO,6BAAuB,IAAI,EAAE,IAAI,CAAC,IAAI,GAA0B,CAAC;QAC1E,CAAC;aAAM,CAAC;YACN,OAAO,cAAQ,GAAG,EAAE,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,GAAW,CAAC;QACvE,CAAC;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { PodOS, BrokenFile as BrokenFileData, SolidFile } from '@pod-os/core';\nimport { Component, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\nimport session from '../../store/session';\nimport { BrokenFile } from '../broken-file/BrokenFile';\n\n@Component({\n tag: 'pos-document',\n styleUrl: 'pos-document.css',\n shadow: true,\n})\nexport class PosDocument {\n @Prop() src: string;\n\n @Prop() alt: string;\n\n @State() os: PodOS;\n\n @State()\n private file: SolidFile;\n\n @State()\n private brokenFile: BrokenFileData;\n\n @State()\n private error: Error;\n\n @State()\n private loading: boolean = true;\n\n @Event({ eventName: 'pod-os:init' }) initializeOsEmitter: EventEmitter;\n\n /**\n * Indicates that the resource given in `src` property has been loaded.\n */\n @Event({ eventName: 'pod-os:resource-loaded' }) resourceLoadedEmitter: EventEmitter<string>;\n\n componentWillLoad() {\n session.onChange('isLoggedIn', () => this.fetchBlob());\n this.initializeOsEmitter.emit(this.setOs);\n }\n\n setOs = async (os: PodOS) => {\n this.os = os;\n };\n\n @Watch('os')\n @Watch('src')\n async fetchBlob() {\n try {\n this.loading = true;\n const file = await this.os.fetchFile(this.src);\n this.resourceLoadedEmitter.emit(this.src);\n if (file.blob()) {\n this.file = file;\n this.error = null;\n } else {\n this.brokenFile = file as BrokenFileData;\n }\n } catch (err) {\n this.error = err;\n } finally {\n this.loading = false;\n }\n }\n\n render() {\n if (this.loading) {\n return <ion-skeleton-text animated={true}></ion-skeleton-text>;\n }\n if (this.error) {\n return <div class=\"error\">{this.error.message}</div>;\n }\n if (this.brokenFile) {\n return <BrokenFile file={this.brokenFile} />;\n }\n if (this.file.blob().type === 'text/markdown') {\n return <pos-markdown-document file={this.file}></pos-markdown-document>;\n } else {\n return <iframe src={URL.createObjectURL(this.file.blob())}></iframe>;\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { marked, Renderer } from "marked";
|
|
3
|
+
import { sanitize } from "./sanitize";
|
|
4
|
+
export class PosMarkdownDocument {
|
|
5
|
+
async componentWillLoad() {
|
|
6
|
+
const markdown = await this.file.blob().text();
|
|
7
|
+
const renderer = new Renderer();
|
|
8
|
+
renderer.link = ({ href, text }) => {
|
|
9
|
+
const url = new URL(href, this.file.url);
|
|
10
|
+
return `<pos-rich-link uri="${url}">${text}</pos-rich-link>`;
|
|
11
|
+
};
|
|
12
|
+
renderer.image = ({ href, title, text }) => {
|
|
13
|
+
const titleAttr = title ? ` title="${title}"` : '';
|
|
14
|
+
const url = new URL(href, this.file.url);
|
|
15
|
+
return `<pos-image src="${url}" alt="${text}" ${titleAttr}>`;
|
|
16
|
+
};
|
|
17
|
+
marked.setOptions({ renderer });
|
|
18
|
+
const parsed = await marked(markdown);
|
|
19
|
+
this.sanitizedHtml = sanitize(parsed);
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
return h("article", { key: 'c02b19957db7f953916103f8a92a1c7c82f28014', innerHTML: this.sanitizedHtml.value });
|
|
23
|
+
}
|
|
24
|
+
static get is() { return "pos-markdown-document"; }
|
|
25
|
+
static get encapsulation() { return "shadow"; }
|
|
26
|
+
static get originalStyleUrls() {
|
|
27
|
+
return {
|
|
28
|
+
"$": ["pos-markdown-document.css", "../../apps/styles/article-card.css"]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static get styleUrls() {
|
|
32
|
+
return {
|
|
33
|
+
"$": ["pos-markdown-document.css", "../../apps/styles/article-card.css"]
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
static get properties() {
|
|
37
|
+
return {
|
|
38
|
+
"file": {
|
|
39
|
+
"type": "unknown",
|
|
40
|
+
"mutable": false,
|
|
41
|
+
"complexType": {
|
|
42
|
+
"original": "SolidFile",
|
|
43
|
+
"resolved": "SolidFile",
|
|
44
|
+
"references": {
|
|
45
|
+
"SolidFile": {
|
|
46
|
+
"location": "import",
|
|
47
|
+
"path": "@pod-os/core",
|
|
48
|
+
"id": "../core/types/index.d.ts::SolidFile"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"required": false,
|
|
53
|
+
"optional": false,
|
|
54
|
+
"docs": {
|
|
55
|
+
"tags": [],
|
|
56
|
+
"text": ""
|
|
57
|
+
},
|
|
58
|
+
"getter": false,
|
|
59
|
+
"setter": false
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
static get states() {
|
|
64
|
+
return {
|
|
65
|
+
"sanitizedHtml": {}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=pos-markdown-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pos-markdown-document.js","sourceRoot":"","sources":["../../../../src/components/pos-markdown-document/pos-markdown-document.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAC;AAOrD,MAAM,OAAO,mBAAmB;IAO9B,KAAK,CAAC,iBAAiB;QACrB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC;QAE/C,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QAEhC,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;YACjC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,uBAAuB,GAAG,KAAK,IAAI,kBAAkB,CAAC;QAC/D,CAAC,CAAC;QAEF,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;YACzC,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACzC,OAAO,mBAAmB,GAAG,UAAU,IAAI,KAAK,SAAS,GAAG,CAAC;QAC/D,CAAC,CAAC;QAEF,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACtC,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,gEAAS,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK,GAAY,CAAC;IAClE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { SolidFile } from '@pod-os/core';\nimport { Component, h, Prop, State } from '@stencil/core';\n\nimport { marked, Renderer } from 'marked';\nimport { sanitize, SanitizedHtml } from './sanitize';\n\n@Component({\n tag: 'pos-markdown-document',\n styleUrls: ['pos-markdown-document.css', '../../apps/styles/article-card.css'],\n shadow: true,\n})\nexport class PosMarkdownDocument {\n @Prop()\n file: SolidFile;\n\n @State()\n private sanitizedHtml: SanitizedHtml;\n\n async componentWillLoad() {\n const markdown = await this.file.blob().text();\n\n const renderer = new Renderer();\n\n renderer.link = ({ href, text }) => {\n const url = new URL(href, this.file.url);\n return `<pos-rich-link uri=\"${url}\">${text}</pos-rich-link>`;\n };\n\n renderer.image = ({ href, title, text }) => {\n const titleAttr = title ? ` title=\"${title}\"` : '';\n const url = new URL(href, this.file.url);\n return `<pos-image src=\"${url}\" alt=\"${text}\" ${titleAttr}>`;\n };\n\n marked.setOptions({ renderer });\n const parsed = await marked(markdown);\n this.sanitizedHtml = sanitize(parsed);\n }\n\n render() {\n return <article innerHTML={this.sanitizedHtml.value}></article>;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../../../../src/components/pos-markdown-document/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAMlC,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO;QACL,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE;YAC9B,QAAQ,EAAE,CAAC,eAAe,EAAE,WAAW,CAAC;YACxC,QAAQ,EAAE,CAAC,KAAK,CAAC;SAClB,CAAC;KACH,CAAC;AACJ,CAAC","sourcesContent":["import DomPurify from 'dompurify';\n\nexport interface SanitizedHtml {\n value: string;\n}\n\nexport function sanitize(html: string): SanitizedHtml {\n return {\n value: DomPurify.sanitize(html, {\n ADD_TAGS: ['pos-rich-link', 'pos-image'],\n ADD_ATTR: ['uri'],\n }),\n };\n}\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: '
|
|
14
|
+
return (h("section", { key: '9f6287fbf17dcfb8afce157379e798b67ac23e10', class: "current" }, this.current && this.searchIndexReady && h("pos-make-findable", { key: '08a1e2bb449513ed6565437b701d6f63fe0ef923', uri: this.current.uri }), h("button", { key: 'd4f55f3ad06100545279da8336f78099dcb9bedc', "aria-label": ariaLabel, onClick: () => this.onClick() }, h("div", { key: 'bdc0906378e431e6ef0fde16da45e190f5511d14' }, 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: '
|
|
116
|
+
return (h("nav", { key: 'cf1cd48ea2bf1658531ca2f5823f4324566cb310' }, h("search", { key: 'dccc4d03cb8cd754980b98a926bea8e86b269818' }, h("pos-navigation-bar", { key: '64e26ace1b35beb51be4c4ef5c09621a7975ef6f', searchIndexReady: this.searchIndex !== undefined, current: this.resource }), h("dialog", { key: '56a68557d4d208f32ae04b0f8bee7c8409c4ac40', ref: el => (this.dialogRef = el) }, h("form", { key: '6eea4d79afd30134cba1a4710cd751f10c1ca753', method: "dialog", onSubmit: () => this.onSubmit() }, h("input", { key: '292139ce8abcc567e1c467bc938c5f25aab894a0', 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: '
|
|
17
|
+
return (h("form", { key: 'd231729bb8d01ffa9e1f88d9488fa92041f33460', method: "dialog", onSubmit: e => this.handleSubmit(e) }, h("label", { key: '739f893b508ffe8baa0b575594af48f6f690425c', htmlFor: "type" }, "Type"), h("pos-select-term", { key: '9973af04355cf8dec838a4217f711e4c8669dab4', id: "type", placeholder: "", value: this.selectedTypeUri, "onPod-os:term-selected": e => this.onTermSelected(e) }), h("label", { key: '4fac8ecca95c2e16c98c35ae92ea9b7f6bd6a94a', htmlFor: "name" }, "Name"), h("input", { key: 'c922c03e656d194c3235fb374ef90fce205f7ee7', 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: 'fb39eb6c09e67315326f13e184aab93a4ed786c6', 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: '
|
|
41
|
+
return h("slot", { key: '21f84b363ae9820f290475d61af8e32b76aeedfb' });
|
|
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: '
|
|
22
|
+
return (h(Host, { key: 'b8d13c8bbbce1b43aa979d1554300ee07691ce7c' }, h("input", { key: '48ce96862c6f5ae744874681f5c8e3966cf7747a', part: "input", list: "terms", placeholder: this.placeholder, value: this.value, onChange: ev => this.handleChange(ev) }), h("datalist", { key: '2e717df5aa51a375b8cf23b97084f4788877960f', 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,55 @@
|
|
|
1
|
+
export const AvailableTools = {
|
|
2
|
+
Generic: {
|
|
3
|
+
element: 'pos-app-generic',
|
|
4
|
+
label: 'Data',
|
|
5
|
+
icon: 'list-ul',
|
|
6
|
+
types: [], // since this is included everywhere, it does not need to specify types
|
|
7
|
+
},
|
|
8
|
+
RdfDocument: {
|
|
9
|
+
element: 'pos-app-rdf-document',
|
|
10
|
+
label: 'Things',
|
|
11
|
+
icon: 'diagram-2',
|
|
12
|
+
types: [
|
|
13
|
+
{
|
|
14
|
+
uri: 'http://www.w3.org/2007/ont/link#RDFDocument',
|
|
15
|
+
priority: 20,
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
DocumentViewer: {
|
|
20
|
+
element: 'pos-app-document-viewer',
|
|
21
|
+
label: 'Doc',
|
|
22
|
+
icon: 'file-text',
|
|
23
|
+
types: [
|
|
24
|
+
{
|
|
25
|
+
uri: mimeType('application/pdf'),
|
|
26
|
+
priority: 30,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
uri: 'http://www.w3.org/2007/ont/link#Document',
|
|
30
|
+
priority: 10,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
ImageViewer: {
|
|
35
|
+
element: 'pos-app-image-viewer',
|
|
36
|
+
label: 'Pic',
|
|
37
|
+
icon: 'file-image',
|
|
38
|
+
types: [
|
|
39
|
+
{
|
|
40
|
+
uri: 'http://purl.org/dc/terms/Image',
|
|
41
|
+
priority: 20,
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
LdpContainer: {
|
|
46
|
+
element: 'pos-app-ldp-container',
|
|
47
|
+
label: 'Content',
|
|
48
|
+
icon: 'folder',
|
|
49
|
+
types: [{ uri: 'http://www.w3.org/ns/ldp#Container', priority: 30 }],
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
function mimeType(mimeType) {
|
|
53
|
+
return 'http://www.w3.org/ns/iana/media-types/' + mimeType + '#Resource';
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=availableTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"availableTools.js","sourceRoot":"","sources":["../../../../src/components/pos-type-router/availableTools.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAkC;IAC3D,OAAO,EAAE;QACP,OAAO,EAAE,iBAAiB;QAC1B,KAAK,EAAE,MAAM;QACb,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,EAAE,EAAE,uEAAuE;KACnF;IACD,WAAW,EAAE;QACX,OAAO,EAAE,sBAAsB;QAC/B,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE;YACL;gBACE,GAAG,EAAE,6CAA6C;gBAClD,QAAQ,EAAE,EAAE;aACb;SACF;KACF;IACD,cAAc,EAAE;QACd,OAAO,EAAE,yBAAyB;QAClC,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE;YACL;gBACE,GAAG,EAAE,QAAQ,CAAC,iBAAiB,CAAC;gBAChC,QAAQ,EAAE,EAAE;aACb;YACD;gBACE,GAAG,EAAE,0CAA0C;gBAC/C,QAAQ,EAAE,EAAE;aACb;SACF;KACF;IACD,WAAW,EAAE;QACX,OAAO,EAAE,sBAAsB;QAC/B,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,YAAY;QAClB,KAAK,EAAE;YACL;gBACE,GAAG,EAAE,gCAAgC;gBACrC,QAAQ,EAAE,EAAE;aACb;SACF;KACF;IACD,YAAY,EAAE;QACZ,OAAO,EAAE,uBAAuB;QAChC,KAAK,EAAE,SAAS;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,oCAAoC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;KACrE;CACF,CAAC;AAEF,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,wCAAwC,GAAG,QAAQ,GAAG,WAAW,CAAC;AAC3E,CAAC","sourcesContent":["import { ToolConfig } from './selectToolsForTypes';\n\nexport const AvailableTools: { [key: string]: ToolConfig } = {\n Generic: {\n element: 'pos-app-generic',\n label: 'Data',\n icon: 'list-ul',\n types: [], // since this is included everywhere, it does not need to specify types\n },\n RdfDocument: {\n element: 'pos-app-rdf-document',\n label: 'Things',\n icon: 'diagram-2',\n types: [\n {\n uri: 'http://www.w3.org/2007/ont/link#RDFDocument',\n priority: 20,\n },\n ],\n },\n DocumentViewer: {\n element: 'pos-app-document-viewer',\n label: 'Doc',\n icon: 'file-text',\n types: [\n {\n uri: mimeType('application/pdf'),\n priority: 30,\n },\n {\n uri: 'http://www.w3.org/2007/ont/link#Document',\n priority: 10,\n },\n ],\n },\n ImageViewer: {\n element: 'pos-app-image-viewer',\n label: 'Pic',\n icon: 'file-image',\n types: [\n {\n uri: 'http://purl.org/dc/terms/Image',\n priority: 20,\n },\n ],\n },\n LdpContainer: {\n element: 'pos-app-ldp-container',\n label: 'Content',\n icon: 'folder',\n types: [{ uri: 'http://www.w3.org/ns/ldp#Container', priority: 30 }],\n },\n};\n\nfunction mimeType(mimeType: string) {\n return 'http://www.w3.org/ns/iana/media-types/' + mimeType + '#Resource';\n}\n"]}
|
|
@@ -1,57 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Generic: {
|
|
3
|
-
element: 'pos-app-generic',
|
|
4
|
-
label: 'Data',
|
|
5
|
-
icon: 'list-ul',
|
|
6
|
-
types: [], // since this is included everywhere, it does not need to specify types
|
|
7
|
-
},
|
|
8
|
-
RdfDocument: {
|
|
9
|
-
element: 'pos-app-rdf-document',
|
|
10
|
-
label: 'Things',
|
|
11
|
-
icon: 'diagram-2',
|
|
12
|
-
types: [
|
|
13
|
-
{
|
|
14
|
-
uri: 'http://www.w3.org/2007/ont/link#RDFDocument',
|
|
15
|
-
priority: 20,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
},
|
|
19
|
-
DocumentViewer: {
|
|
20
|
-
element: 'pos-app-document-viewer',
|
|
21
|
-
label: 'Doc',
|
|
22
|
-
icon: 'file-text',
|
|
23
|
-
types: [
|
|
24
|
-
{
|
|
25
|
-
uri: mimeType('application/pdf'),
|
|
26
|
-
priority: 30,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
uri: 'http://www.w3.org/2007/ont/link#Document',
|
|
30
|
-
priority: 10,
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
ImageViewer: {
|
|
35
|
-
element: 'pos-app-image-viewer',
|
|
36
|
-
label: 'Pic',
|
|
37
|
-
icon: 'file-image',
|
|
38
|
-
types: [
|
|
39
|
-
{
|
|
40
|
-
uri: 'http://purl.org/dc/terms/Image',
|
|
41
|
-
priority: 20,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
LdpContainer: {
|
|
46
|
-
element: 'pos-app-ldp-container',
|
|
47
|
-
label: 'Content',
|
|
48
|
-
icon: 'folder',
|
|
49
|
-
types: [{ uri: 'http://www.w3.org/ns/ldp#Container', priority: 30 }],
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
function mimeType(mimeType) {
|
|
53
|
-
return 'http://www.w3.org/ns/iana/media-types/' + mimeType + '#Resource';
|
|
54
|
-
}
|
|
1
|
+
import { AvailableTools } from "./availableTools";
|
|
55
2
|
export function selectToolsForTypes(types) {
|
|
56
3
|
const typeUris = new Set(types.map(type => type.uri));
|
|
57
4
|
return Object.values(AvailableTools)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectToolsForTypes.js","sourceRoot":"","sources":["../../../../src/components/pos-type-router/selectToolsForTypes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectToolsForTypes.js","sourceRoot":"","sources":["../../../../src/components/pos-type-router/selectToolsForTypes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAqDlD,MAAM,UAAU,mBAAmB,CAAC,KAAgB;IAClD,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAEtD,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;SACjC,GAAG,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;SAC7B,MAAM,CAAC,YAAY,CAAC;SACpB,QAAQ,CAAC,UAAU,CAAC;SACpB,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;SAClB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,cAAc,GAAG,CAAC,QAAqB,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CACvD,CAAC;IACC,IAAI;IACJ,QAAQ,EAAE,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;CAC5C,CAAiB,CAAC;AAErB,SAAS,WAAW,CAAC,KAAqB,EAAE,QAAqB;IAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7G,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,EAAgB,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC;AAE3D,MAAM,UAAU,GAAG,CAAC,CAAe,EAAE,CAAe,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC","sourcesContent":["import { RdfType } from '@pod-os/core';\nimport { AvailableTools } from './availableTools';\n\n/**\n * Describes a tool that can be used\n */\nexport interface ToolConfig {\n /**\n * The HTML custom element that renders the tool\n */\n element: string;\n /**\n * A human-readable short label to identify the tool\n */\n label: string;\n /**\n * An icon to identify the tool\n * Available values see https://shoelace.style/components/icon/#default-icons\n */\n icon: string;\n /**\n * The types that can be handled by that tool\n */\n types: TypePriority[];\n}\n\n/**\n * Describes how well a given RDF type can be handled\n */\ninterface TypePriority {\n /**\n * URI identifying the RDF type\n */\n uri: string;\n /**\n * how well that type can be handled (higher values === better fit)\n */\n priority: number;\n}\n\n/**\n * Describes the priority (order) that applies to a tool\n */\ninterface ToolPriority {\n /**\n * The tool in question\n */\n tool: ToolConfig;\n /**\n * The priority given to the tool (higher values === better fit)\n */\n priority: number;\n}\n\nexport function selectToolsForTypes(types: RdfType[]) {\n const typeUris = new Set(types.map(type => type.uri));\n\n return Object.values(AvailableTools)\n .map(maxPriorityFor(typeUris))\n .filter(onlyRelevant)\n .toSorted(byPriority)\n .map(it => it.tool)\n .concat(AvailableTools.Generic);\n}\n\nconst maxPriorityFor = (typeUris: Set<string>) => tool =>\n ({\n tool,\n priority: maxPriority(tool.types, typeUris),\n }) as ToolPriority;\n\nfunction maxPriority(types: TypePriority[], typeUris: Set<string>): number {\n return types.filter(type => typeUris.has(type.uri)).reduce((max, type) => Math.max(max, type.priority), 0);\n}\n\nconst onlyRelevant = (it: ToolPriority) => it.priority > 0;\n\nconst byPriority = (a: ToolPriority, b: ToolPriority) => b.priority - a.priority;\n"]}
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { s as subscribeResource } from './ResourceAware.js';
|
|
3
|
-
import { d as defineCustomElement$
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
6
|
-
import { d as defineCustomElement$
|
|
7
|
-
import { d as defineCustomElement$7 } from './pos-document2.js';
|
|
8
|
-
import { d as defineCustomElement$6 } from './pos-label2.js';
|
|
9
|
-
import { d as defineCustomElement$5 } from './pos-literals2.js';
|
|
10
|
-
import { d as defineCustomElement$4 } from './pos-predicate2.js';
|
|
11
|
-
import { d as defineCustomElement$3 } from './pos-select-term2.js';
|
|
12
|
-
import { d as defineCustomElement$2 } from './pos-type-badges2.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './icon.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './skeleton-text.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './pos-document2.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './pos-markdown-document2.js';
|
|
13
7
|
|
|
14
8
|
const defaultAppLayoutCss = ":host{--gap-size:var(--size-4);display:flex;flex-direction:column;gap:var(--gap-size);margin:var(--gap-size)}section{display:flex;flex-direction:column;gap:var(--gap-size)}@media (min-width: 640px){:host{flex-direction:row;flex-wrap:wrap;section:first-of-type {\n flex: 1}section:not(:first-of-type){flex:0 0 30%}}";
|
|
15
9
|
const PosAppDocumentViewerStyle0 = defaultAppLayoutCss;
|
|
@@ -34,7 +28,7 @@ const PosAppDocumentViewer$1 = /*@__PURE__*/ proxyCustomElement(class PosAppDocu
|
|
|
34
28
|
if (!this.resource) {
|
|
35
29
|
return null;
|
|
36
30
|
}
|
|
37
|
-
return (h(Host, null, h("section", null, h("pos-document", { src: this.resource.uri }))
|
|
31
|
+
return (h(Host, null, h("section", null, h("pos-document", { src: this.resource.uri }))));
|
|
38
32
|
}
|
|
39
33
|
static get style() { return PosAppDocumentViewerStyle0 + PosAppDocumentViewerStyle1; }
|
|
40
34
|
}, [1, "pos-app-document-viewer", {
|
|
@@ -44,59 +38,29 @@ function defineCustomElement$1() {
|
|
|
44
38
|
if (typeof customElements === "undefined") {
|
|
45
39
|
return;
|
|
46
40
|
}
|
|
47
|
-
const components = ["pos-app-document-viewer", "ion-
|
|
41
|
+
const components = ["pos-app-document-viewer", "ion-icon", "ion-skeleton-text", "pos-document", "pos-markdown-document"];
|
|
48
42
|
components.forEach(tagName => { switch (tagName) {
|
|
49
43
|
case "pos-app-document-viewer":
|
|
50
44
|
if (!customElements.get(tagName)) {
|
|
51
45
|
customElements.define(tagName, PosAppDocumentViewer$1);
|
|
52
46
|
}
|
|
53
47
|
break;
|
|
54
|
-
case "ion-badge":
|
|
55
|
-
if (!customElements.get(tagName)) {
|
|
56
|
-
defineCustomElement$b();
|
|
57
|
-
}
|
|
58
|
-
break;
|
|
59
48
|
case "ion-icon":
|
|
60
|
-
if (!customElements.get(tagName)) {
|
|
61
|
-
defineCustomElement$a();
|
|
62
|
-
}
|
|
63
|
-
break;
|
|
64
|
-
case "ion-skeleton-text":
|
|
65
|
-
if (!customElements.get(tagName)) {
|
|
66
|
-
defineCustomElement$9();
|
|
67
|
-
}
|
|
68
|
-
break;
|
|
69
|
-
case "pos-add-literal-value":
|
|
70
|
-
if (!customElements.get(tagName)) {
|
|
71
|
-
defineCustomElement$8();
|
|
72
|
-
}
|
|
73
|
-
break;
|
|
74
|
-
case "pos-document":
|
|
75
|
-
if (!customElements.get(tagName)) {
|
|
76
|
-
defineCustomElement$7();
|
|
77
|
-
}
|
|
78
|
-
break;
|
|
79
|
-
case "pos-label":
|
|
80
|
-
if (!customElements.get(tagName)) {
|
|
81
|
-
defineCustomElement$6();
|
|
82
|
-
}
|
|
83
|
-
break;
|
|
84
|
-
case "pos-literals":
|
|
85
49
|
if (!customElements.get(tagName)) {
|
|
86
50
|
defineCustomElement$5();
|
|
87
51
|
}
|
|
88
52
|
break;
|
|
89
|
-
case "
|
|
53
|
+
case "ion-skeleton-text":
|
|
90
54
|
if (!customElements.get(tagName)) {
|
|
91
55
|
defineCustomElement$4();
|
|
92
56
|
}
|
|
93
57
|
break;
|
|
94
|
-
case "pos-
|
|
58
|
+
case "pos-document":
|
|
95
59
|
if (!customElements.get(tagName)) {
|
|
96
60
|
defineCustomElement$3();
|
|
97
61
|
}
|
|
98
62
|
break;
|
|
99
|
-
case "pos-
|
|
63
|
+
case "pos-markdown-document":
|
|
100
64
|
if (!customElements.get(tagName)) {
|
|
101
65
|
defineCustomElement$2();
|
|
102
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"pos-app-document-viewer.js","mappings":"
|
|
1
|
+
{"file":"pos-app-document-viewer.js","mappings":";;;;;;;AAAA,MAAM,mBAAmB,GAAG,iUAAiU,CAAC;AAC9V,mCAAe,mBAAmB;;ACDlC,MAAM,cAAc,GAAG,0YAA0Y,CAAC;AACla,mCAAe,cAAc;;MCQhBA,sBAAoB;IALjC;;;;;QAcE,oBAAe,GAAG,CAAC,QAAe;YAChC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B,CAAC;KAeH;IArBC,iBAAiB;QACf,iBAAiB,CAAC,IAAI,CAAC,CAAC;KACzB;IAMD,MAAM;QACJ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QAED,QACE,EAAC,IAAI,QACH,mBACE,oBAAc,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,GAAI,CAChC,CACL,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["PosAppDocumentViewer"],"sources":["src/apps/styles/default-app-layout.css?tag=pos-app-document-viewer&encapsulation=shadow","src/apps/styles/article-card.css?tag=pos-app-document-viewer&encapsulation=shadow","src/apps/pos-app-document-viewer/pos-app-document-viewer.tsx"],"sourcesContent":[":host {\n --gap-size: var(--size-4);\n display: flex;\n flex-direction: column;\n gap: var(--gap-size);\n margin: var(--gap-size);\n}\n\nsection {\n display: flex;\n flex-direction: column;\n gap: var(--gap-size);\n}\n\n@media (min-width: 640px) {\n :host {\n flex-direction: row;\n flex-wrap: wrap;\n\n section:first-of-type {\n flex: 1;\n }\n\n section:not(:first-of-type) {\n flex: 0 0 30%;\n }\n }\n}\n","article {\n padding: var(--size-2);\n display: flex;\n flex-direction: column;\n gap: var(--size-2);\n outline: var(--pos-border-solid);\n border-radius: var(--radius-sm);\n box-shadow: var(--shadow-md);\n background-color: var(--pos-card-background);\n\n header {\n display: flex;\n flex-direction: column;\n gap: var(--size-2);\n h1 {\n margin: 0;\n }\n }\n}\n","import { Thing } from '@pod-os/core';\nimport { Component, Event, EventEmitter, h, Host, State } from '@stencil/core';\nimport { ResourceAware, subscribeResource } from '../../components/events/ResourceAware';\n\n@Component({\n tag: 'pos-app-document-viewer',\n shadow: true,\n styleUrls: ['../styles/default-app-layout.css', '../styles/article-card.css'],\n})\nexport class PosAppDocumentViewer implements ResourceAware {\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 if (!this.resource) {\n return null;\n }\n\n return (\n <Host>\n <section>\n <pos-document src={this.resource.uri} />\n </section>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { s as store } from './session.js';
|
|
3
3
|
import { B as BrokenFile } from './BrokenFile.js';
|
|
4
|
-
import { d as defineCustomElement$
|
|
5
|
-
import { d as defineCustomElement$
|
|
4
|
+
import { d as defineCustomElement$3 } from './icon.js';
|
|
5
|
+
import { d as defineCustomElement$2 } from './skeleton-text.js';
|
|
6
|
+
import { d as defineCustomElement$1 } from './pos-markdown-document2.js';
|
|
6
7
|
|
|
7
8
|
const posDocumentCss = "iframe{background-color:var(--pos-background-color);width:100%;height:100vh}.error{display:flex;opacity:0.8;background:repeating-linear-gradient(-45deg, rgba(150, 0, 0, 0.1), rgba(150, 0, 0, 0.1) 10px, #fff 5px, #fff 25px);flex-direction:column;border:1px solid red;color:black;align-items:center;justify-content:center;word-break:break-all;padding:1rem;box-sizing:border-box}.error ion-icon{color:#282828;--ionicon-stroke-width:calc(var(--width) / 5);font-size:calc(var(--width) / 2)}a{text-decoration:none;width:var(--width);height:var(--height)}.code{font-weight:bold;font-size:calc(var(--width) / 8)}.text{font-size:calc(var(--width) / 20)}";
|
|
8
9
|
const PosDocumentStyle0 = posDocumentCss;
|
|
@@ -29,7 +30,7 @@ const PosDocument = /*@__PURE__*/ proxyCustomElement(class PosDocument extends H
|
|
|
29
30
|
const file = await this.os.fetchFile(this.src);
|
|
30
31
|
this.resourceLoadedEmitter.emit(this.src);
|
|
31
32
|
if (file.blob()) {
|
|
32
|
-
this.
|
|
33
|
+
this.file = file;
|
|
33
34
|
this.error = null;
|
|
34
35
|
}
|
|
35
36
|
else {
|
|
@@ -53,7 +54,12 @@ const PosDocument = /*@__PURE__*/ proxyCustomElement(class PosDocument extends H
|
|
|
53
54
|
if (this.brokenFile) {
|
|
54
55
|
return h(BrokenFile, { file: this.brokenFile });
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
if (this.file.blob().type === 'text/markdown') {
|
|
58
|
+
return h("pos-markdown-document", { file: this.file });
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return h("iframe", { src: URL.createObjectURL(this.file.blob()) });
|
|
62
|
+
}
|
|
57
63
|
}
|
|
58
64
|
static get watchers() { return {
|
|
59
65
|
"os": ["fetchBlob"],
|
|
@@ -64,7 +70,7 @@ const PosDocument = /*@__PURE__*/ proxyCustomElement(class PosDocument extends H
|
|
|
64
70
|
"src": [1],
|
|
65
71
|
"alt": [1],
|
|
66
72
|
"os": [32],
|
|
67
|
-
"
|
|
73
|
+
"file": [32],
|
|
68
74
|
"brokenFile": [32],
|
|
69
75
|
"error": [32],
|
|
70
76
|
"loading": [32]
|
|
@@ -76,7 +82,7 @@ function defineCustomElement() {
|
|
|
76
82
|
if (typeof customElements === "undefined") {
|
|
77
83
|
return;
|
|
78
84
|
}
|
|
79
|
-
const components = ["pos-document", "ion-icon", "ion-skeleton-text"];
|
|
85
|
+
const components = ["pos-document", "ion-icon", "ion-skeleton-text", "pos-markdown-document"];
|
|
80
86
|
components.forEach(tagName => { switch (tagName) {
|
|
81
87
|
case "pos-document":
|
|
82
88
|
if (!customElements.get(tagName)) {
|
|
@@ -85,10 +91,15 @@ function defineCustomElement() {
|
|
|
85
91
|
break;
|
|
86
92
|
case "ion-icon":
|
|
87
93
|
if (!customElements.get(tagName)) {
|
|
88
|
-
defineCustomElement$
|
|
94
|
+
defineCustomElement$3();
|
|
89
95
|
}
|
|
90
96
|
break;
|
|
91
97
|
case "ion-skeleton-text":
|
|
98
|
+
if (!customElements.get(tagName)) {
|
|
99
|
+
defineCustomElement$2();
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case "pos-markdown-document":
|
|
92
103
|
if (!customElements.get(tagName)) {
|
|
93
104
|
defineCustomElement$1();
|
|
94
105
|
}
|