@pod-os/elements 0.37.0 → 0.38.0-rc.4b2b787.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/{index-OR1wNkjG.js → index-CmQJab4P.js} +70 -19
- package/dist/cjs/{jsonld-V2RB47OZ-B82QNsYZ.js → jsonld-V2RB47OZ-BpANcb5R.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/pos-add-literal-value_3.cjs.entry.js +1 -1
- package/dist/cjs/pos-add-new-thing_32.cjs.entry.js +2 -2
- package/dist/cjs/pos-container-contents.cjs.entry.js +3 -3
- package/dist/cjs/pos-list.cjs.entry.js +1 -1
- package/dist/cjs/pos-markdown-document.cjs.entry.js +2 -2
- package/dist/cjs/pos-subjects.cjs.entry.js +1 -1
- package/dist/cjs/pos-switch.cjs.entry.js +41 -7
- package/dist/collection/components/pos-app/pos-app.js +1 -1
- package/dist/collection/components/pos-container-contents/pos-container-contents.js +2 -2
- package/dist/collection/components/pos-list/pos-list.js +1 -1
- package/dist/collection/components/pos-markdown-document/pos-markdown-document.js +2 -2
- package/dist/collection/components/pos-switch/pos-case/pos-case.js +38 -0
- package/dist/collection/components/pos-switch/pos-switch.js +44 -8
- package/dist/components/index2.js +2 -2
- package/dist/components/pos-app2.js +1 -1
- package/dist/components/pos-case.js +1 -1
- package/dist/components/pos-container-contents2.js +1 -1
- package/dist/components/pos-list.js +1 -1
- package/dist/components/pos-markdown-document2.js +1 -1
- package/dist/components/pos-switch.js +1 -1
- package/dist/elements/elements.esm.js +1 -1
- package/dist/elements/p-07f69d8c.entry.js +1 -0
- package/dist/elements/{p-dc4c38c8.entry.js → p-59e18120.entry.js} +1 -1
- package/dist/elements/{p-c7032012.entry.js → p-935e8df7.entry.js} +1 -1
- package/dist/elements/{p-ab4eba43.entry.js → p-9899cefb.entry.js} +2 -2
- package/dist/elements/{p-8e76e9dc.entry.js → p-9ac2654c.entry.js} +1 -1
- package/dist/elements/{p-a1dd6b42.entry.js → p-9dbe8f72.entry.js} +1 -1
- package/dist/elements/{p-BLUiM5OK.js → p-DUt7ij35.js} +1 -1
- package/dist/elements/p-Dzr3lPEW.js +67 -0
- package/dist/elements/p-cfa86eeb.entry.js +1 -0
- package/dist/esm/elements.js +1 -1
- package/dist/esm/{index-CXK32bJz.js → index-DymdXook.js} +70 -19
- package/dist/esm/{jsonld-V2RB47OZ-BbN7F0s8.js → jsonld-V2RB47OZ-CtbtC7fM.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/pos-add-literal-value_3.entry.js +1 -1
- package/dist/esm/pos-add-new-thing_32.entry.js +2 -2
- package/dist/esm/pos-container-contents.entry.js +3 -3
- package/dist/esm/pos-list.entry.js +1 -1
- package/dist/esm/pos-markdown-document.entry.js +2 -2
- package/dist/esm/pos-subjects.entry.js +1 -1
- package/dist/esm/pos-switch.entry.js +41 -7
- package/dist/types/components/pos-switch/pos-case/pos-case.d.ts +8 -0
- package/dist/types/components/pos-switch/pos-switch.d.ts +7 -3
- package/dist/types/components.d.ts +18 -0
- package/package.json +2 -2
- package/dist/elements/p-3a890f5f.entry.js +0 -1
- package/dist/elements/p-53610ccd.entry.js +0 -1
- package/dist/elements/p-DHl0QGLf.js +0 -67
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as i,H as e,a as o}from"./p-DzbCx-pP.js";import{s as r}from"./p-BW_CkW1K.js";import{c as h}from"./p-vFMstSdt.js";const n=class{constructor(i){t(this,i),this.subscribeResource=s(this,"pod-os:resource",7),this.error=null,this.disconnected$=new h.Subject,this.receiveResource=t=>{this.disconnected$.next(),this.resource=void 0;let s=[];if(this.caseElements.some((t=>t.hasAttribute("if-typeof")))){const i=t.observeTypes().pipe(h.takeUntil(this.disconnected$));i.subscribe((t=>{this.types=t})),s.push(i)}if(this.caseElements.some((t=>t.hasAttribute("if-property")))){const i=t.observeRelations().pipe(h.takeUntil(this.disconnected$));i.subscribe((t=>{this.relations=t})),s.push(i)}if(this.caseElements.some((t=>t.hasAttribute("if-rev")))){const i=t.observeReverseRelations().pipe(h.takeUntil(this.disconnected$));i.subscribe((t=>{this.reverseRelations=t})),s.push(i)}h.firstValueFrom(h.combineLatest(s)).then((()=>this.resource=t))}}componentWillLoad(){const t=this.host.querySelectorAll("pos-case");0==t.length?this.error="No pos-case elements found":(this.caseElements=Array.from(t),r(this))}test(t){let s=null;return null!==t.getAttribute("if-typeof")&&(s=this.types.map((t=>t.uri)).includes(t.getAttribute("if-typeof"))),null!==t.getAttribute("if-property")&&(s=this.relations.map((t=>t.predicate)).includes(t.getAttribute("if-property"))),null!==t.getAttribute("if-rev")&&(s=this.reverseRelations.map((t=>t.predicate)).includes(t.getAttribute("if-rev"))),null!=t.getAttribute("not")&&(s=!s),s}render(){if(this.error)return this.error;if(!this.resource)return null;let t=null,s=[];this.caseElements.forEach((i=>{const e=this.test(i),o=!0!==t||null===i.getAttribute("else");e&&o&&(t=e,s.push(i)),null===e&&o&&s.push(i)}));const o=s.map((t=>t.querySelector("template").innerHTML)).join("\n");return i(e,{innerHTML:o})}disconnectedCallback(){this.disconnected$.next(),this.disconnected$.complete()}get host(){return o(this)}};export{n as pos_switch}
|
package/dist/esm/elements.js
CHANGED
|
@@ -43,5 +43,5 @@ var patchCloneNodeFix = (HTMLElementPrototype) => {
|
|
|
43
43
|
|
|
44
44
|
patchBrowser().then(async (options) => {
|
|
45
45
|
await globalScripts();
|
|
46
|
-
return bootstrapLazy([["pos-app-generic",[[1,"pos-app-generic"]]],["pos-app-ldp-container",[[1,"pos-app-ldp-container"]]],["pos-app-rdf-document",[[1,"pos-app-rdf-document"]]],["pos-app-image-viewer",[[1,"pos-app-image-viewer",{"resource":[32]}]]],["pos-tool-attachments",[[1,"pos-tool-attachments",{"os":[32],"resource":[32]}]]],["pos-app-document-viewer",[[1,"pos-app-document-viewer",{"resource":[32]}]]],["pos-list",[[0,"pos-list",{"rel":[1],"ifTypeof":[1,"if-typeof"],"fetch":[4],"error":[32],"os":[32],"resource":[32],"items":[32],"templateString":[32]}]]],["pos-case",[[0,"pos-case",{"ifTypeof":[1,"if-typeof"],"not":[4],"else":[4],"error":[32]}]]],["pos-switch",[[0,"pos-switch",{"error":[32],"resource":[32],"caseElements":[32],"
|
|
46
|
+
return bootstrapLazy([["pos-app-generic",[[1,"pos-app-generic"]]],["pos-app-ldp-container",[[1,"pos-app-ldp-container"]]],["pos-app-rdf-document",[[1,"pos-app-rdf-document"]]],["pos-app-image-viewer",[[1,"pos-app-image-viewer",{"resource":[32]}]]],["pos-tool-attachments",[[1,"pos-tool-attachments",{"os":[32],"resource":[32]}]]],["pos-app-document-viewer",[[1,"pos-app-document-viewer",{"resource":[32]}]]],["pos-list",[[0,"pos-list",{"rel":[1],"ifTypeof":[1,"if-typeof"],"fetch":[4],"error":[32],"os":[32],"resource":[32],"items":[32],"templateString":[32]}]]],["pos-case",[[0,"pos-case",{"ifTypeof":[1,"if-typeof"],"ifProperty":[1,"if-property"],"ifRev":[1,"if-rev"],"not":[4],"else":[4],"error":[32]}]]],["pos-switch",[[0,"pos-switch",{"error":[32],"resource":[32],"caseElements":[32],"types":[32],"relations":[32],"reverseRelations":[32]}]]],["pos-value",[[1,"pos-value",{"predicate":[1],"resource":[32]}]]],["pos-attachments",[[1,"pos-attachments",{"resource":[32],"attachments":[32],"addToList":[64]}]]],["pos-container-contents",[[1,"pos-container-contents",{"container":[32],"contents":[32],"loading":[32],"createNewItem":[32]},[[0,"keydown","handleKeyDown"]]]]],["pos-document",[[1,"pos-document",{"src":[1],"alt":[1],"os":[32],"file":[32],"brokenFile":[32],"error":[32],"saveStatus":[32],"loading":[32],"isEditable":[32]},[[0,"pod-os:document-modified","handleDocumentModified"]],{"os":[{"fetchBlob":0}],"src":[{"fetchBlob":0}]}]]],["pos-add-new-thing_32",[[0,"pos-app-browser",{"restorePreviousSession":[4,"restore-previous-session"],"mode":[1],"uri":[32]}],[0,"pos-internal-router",{"uri":[1]}],[257,"pos-login",{"os":[32],"customLoggedInComponent":[32]},[[4,"pod-os:logout","logout"],[4,"pod-os:login","onLogin"]]],[1,"pos-navigation",{"uri":[1],"os":[32],"inputValue":[32],"searchIndex":[32],"suggestions":[32],"selectedIndex":[32],"resource":[32]},[[0,"pod-os:search:index-created","buildSearchIndex"],[0,"pod-os:search:index-updated","rebuildSearchIndex"],[0,"pod-os:navigate","openNavigationDialog"],[4,"click","closeDialog"],[0,"pod-os:link","clearSuggestions"],[0,"click","onClickSelf"],[0,"keydown","handleKeyDown"]],{"uri":[{"updateResource":0}],"os":[{"updateResource":0}]}],[1,"pos-user-menu",{"webId":[1,"web-id"]},[[0,"sl-select","onSelect"]]],[1,"pos-add-new-thing",{"referenceUri":[1,"reference-uri"]}],[1,"pos-type-router",{"initialTool":[32],"availableTools":[32],"oldTool":[32],"currentTool":[32],"transitioning":[32]},[[0,"pod-os:tool-selected","handleToolSelected"]]],[257,"pos-app",{"restorePreviousSession":[4,"restore-previous-session"],"os":[32],"unsubscribeSettings":[32],"loading":[32]},[[0,"pod-os:init","initializeOs"],[0,"pod-os:module","loadModule"]]],[257,"pos-error-toast",{"title":[32],"message":[32]},[[8,"unhandledrejection","unhandledRejection"],[0,"pod-os:error","catchError"]]],[260,"pos-router",{"mode":[1],"uri":[32]},[[0,"pod-os:link","linkClicked"],[8,"pod-os:session-restored","sessionRestored"]]],[1,"pos-app-dashboard"],[1,"pos-navigation-bar",{"current":[16],"searchIndexReady":[4,"search-index-ready"]},[[4,"keydown","activate"]]],[1,"pos-app-settings"],[17,"pos-new-thing-form",{"referenceUri":[1,"reference-uri"],"os":[32],"newUri":[32],"name":[32],"selectedTypeUri":[32],"canSubmit":[32]},null,{"name":[{"validate":0}],"selectedTypeUri":[{"validate":0}]}],[17,"pos-login-form",{"idpUrl":[32],"canSubmit":[32]},null,{"idpUrl":[{"validate":0}]}],[1,"pos-tool-select",{"selected":[16],"tools":[16]}],[1,"pos-type-index-entries",{"uri":[1],"entries":[32]}],[1,"pos-example-resources"],[1,"pos-make-findable",{"uri":[1],"os":[32],"thing":[32],"indexes":[32],"unsubscribeSessionChange":[32],"showOptions":[32],"isIndexed":[32]},[[0,"sl-select","onSelect"]],{"uri":[{"updateUri":0}]}],[260,"pos-dialog",{"showModal":[64],"close":[64]}],[1,"pos-getting-started"],[1,"pos-setting-offline-cache"],[1,"pos-share",{"uri":[1],"apps":[32],"os":[32]},[[4,"pod-os:resource-loaded","resourceLoaded"],[0,"sl-select","onSelect"]],{"uri":[{"updateApps":0}]}],[257,"pos-picture",{"blurredBackground":[4,"blurred-background"],"noUpload":[4,"no-upload"],"resource":[32],"os":[32],"isUploading":[32]}],[1,"pos-image",{"src":[1],"alt":[1],"blurredBackground":[4,"blurred-background"],"os":[32],"dataUri":[32],"brokenFile":[32],"networkError":[32],"imageError":[32],"loading":[32]},null,{"os":[{"fetchBlob":0}],"src":[{"fetchBlob":0}]}],[1,"pos-upload",{"accept":[16],"uploader":[16]}],[17,"pos-select-term",{"placeholder":[1],"value":[1],"os":[32],"terms":[32]},null,{"os":[{"setTerms":0}]}],[1,"pos-predicate",{"uri":[1],"label":[1],"expanded":[32]}],[257,"pos-rich-link",{"uri":[1],"rel":[1],"rev":[1],"link":[32],"followPredicate":[32],"error":[32],"showCustomContent":[32]}],[1,"pos-description",{"resource":[32]}],[1,"pos-label",{"resource":[32]}],[257,"pos-resource",{"uri":[1],"lazy":[4],"os":[32],"resource":[32],"consumers":[32],"error":[32],"loading":[32],"fetch":[64]},[[0,"pod-os:resource","provideResource"]],{"os":[{"loadResource":0}],"uri":[{"loadResource":0}]}]]],["pos-relations_2",[[1,"pos-relations",{"data":[32]}],[1,"pos-reverse-relations",{"data":[32]}]]],["pos-subjects",[[1,"pos-subjects",{"data":[32]}]]],["pos-markdown-document",[[1,"pos-markdown-document",{"file":[16],"saveStatus":[1,"save-status"],"editable":[4],"markdown":[32],"isModified":[32],"isEditing":[32],"startEditing":[64],"stopEditing":[64]}]]],["pos-container-item_3",[[257,"pos-container-item",{"resource":[32]}],[1,"pos-container-toolbar"],[1,"pos-create-new-container-item",{"type":[1],"container":[16],"os":[32],"name":[32]}]]],["pos-add-literal-value_3",[[1,"pos-literals",{"data":[32]}],[1,"pos-type-badges",{"data":[32],"typeLabels":[32],"isExpanded":[32]}],[1,"pos-add-literal-value",{"os":[32],"resource":[32],"currentValue":[32],"selectedTermUri":[32]},null,{"os":[{"setName":0}]}]]]], options);
|
|
47
47
|
});
|
|
@@ -14297,18 +14297,18 @@ function pipeFromArray(fns) {
|
|
|
14297
14297
|
|
|
14298
14298
|
// ../node_modules/rxjs/dist/esm5/internal/Observable.js
|
|
14299
14299
|
var Observable = (function() {
|
|
14300
|
-
function
|
|
14300
|
+
function Observable5(subscribe) {
|
|
14301
14301
|
if (subscribe) {
|
|
14302
14302
|
this._subscribe = subscribe;
|
|
14303
14303
|
}
|
|
14304
14304
|
}
|
|
14305
|
-
|
|
14306
|
-
var observable2 = new
|
|
14305
|
+
Observable5.prototype.lift = function(operator2) {
|
|
14306
|
+
var observable2 = new Observable5();
|
|
14307
14307
|
observable2.source = this;
|
|
14308
14308
|
observable2.operator = operator2;
|
|
14309
14309
|
return observable2;
|
|
14310
14310
|
};
|
|
14311
|
-
|
|
14311
|
+
Observable5.prototype.subscribe = function(observerOrNext, error4, complete2) {
|
|
14312
14312
|
var _this = this;
|
|
14313
14313
|
var subscriber3 = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error4, complete2);
|
|
14314
14314
|
errorContext(function() {
|
|
@@ -14317,14 +14317,14 @@ var Observable = (function() {
|
|
|
14317
14317
|
});
|
|
14318
14318
|
return subscriber3;
|
|
14319
14319
|
};
|
|
14320
|
-
|
|
14320
|
+
Observable5.prototype._trySubscribe = function(sink) {
|
|
14321
14321
|
try {
|
|
14322
14322
|
return this._subscribe(sink);
|
|
14323
14323
|
} catch (err2) {
|
|
14324
14324
|
sink.error(err2);
|
|
14325
14325
|
}
|
|
14326
14326
|
};
|
|
14327
|
-
|
|
14327
|
+
Observable5.prototype.forEach = function(next4, promiseCtor) {
|
|
14328
14328
|
var _this = this;
|
|
14329
14329
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
14330
14330
|
return new promiseCtor(function(resolve, reject) {
|
|
@@ -14343,21 +14343,21 @@ var Observable = (function() {
|
|
|
14343
14343
|
_this.subscribe(subscriber3);
|
|
14344
14344
|
});
|
|
14345
14345
|
};
|
|
14346
|
-
|
|
14346
|
+
Observable5.prototype._subscribe = function(subscriber3) {
|
|
14347
14347
|
var _a;
|
|
14348
14348
|
return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber3);
|
|
14349
14349
|
};
|
|
14350
|
-
|
|
14350
|
+
Observable5.prototype[observable] = function() {
|
|
14351
14351
|
return this;
|
|
14352
14352
|
};
|
|
14353
|
-
|
|
14353
|
+
Observable5.prototype.pipe = function() {
|
|
14354
14354
|
var operations = [];
|
|
14355
14355
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14356
14356
|
operations[_i] = arguments[_i];
|
|
14357
14357
|
}
|
|
14358
14358
|
return pipeFromArray(operations)(this);
|
|
14359
14359
|
};
|
|
14360
|
-
|
|
14360
|
+
Observable5.prototype.toPromise = function(promiseCtor) {
|
|
14361
14361
|
var _this = this;
|
|
14362
14362
|
promiseCtor = getPromiseCtor(promiseCtor);
|
|
14363
14363
|
return new promiseCtor(function(resolve, reject) {
|
|
@@ -14371,10 +14371,10 @@ var Observable = (function() {
|
|
|
14371
14371
|
});
|
|
14372
14372
|
});
|
|
14373
14373
|
};
|
|
14374
|
-
|
|
14375
|
-
return new
|
|
14374
|
+
Observable5.create = function(subscribe) {
|
|
14375
|
+
return new Observable5(subscribe);
|
|
14376
14376
|
};
|
|
14377
|
-
return
|
|
14377
|
+
return Observable5;
|
|
14378
14378
|
})();
|
|
14379
14379
|
function getPromiseCtor(promiseCtor) {
|
|
14380
14380
|
var _a;
|
|
@@ -22138,7 +22138,7 @@ function listToCollection(kb, obj) {
|
|
|
22138
22138
|
}
|
|
22139
22139
|
async function jsonldParser(str, kb, base2) {
|
|
22140
22140
|
const baseString = base2 && Object.prototype.hasOwnProperty.call(base2, "termType") ? base2.value : base2;
|
|
22141
|
-
const jsonld = await import('./jsonld-V2RB47OZ-
|
|
22141
|
+
const jsonld = await import('./jsonld-V2RB47OZ-CtbtC7fM.js');
|
|
22142
22142
|
const flattened = await jsonld.default.flatten(JSON.parse(str), null, {
|
|
22143
22143
|
base: baseString
|
|
22144
22144
|
});
|
|
@@ -27632,6 +27632,7 @@ var flow = Namespace("http://www.w3.org/2005/01/wf/flow#");
|
|
|
27632
27632
|
// src/thing/accumulateSubjects.ts
|
|
27633
27633
|
var accumulateSubjects = (accumulator, current3) => {
|
|
27634
27634
|
const existing = accumulator[current3.predicate.uri];
|
|
27635
|
+
if (existing && existing.includes(current3.subject.value)) return accumulator;
|
|
27635
27636
|
return {
|
|
27636
27637
|
...accumulator,
|
|
27637
27638
|
[current3.predicate.uri]: existing ? [...existing, current3.subject.value] : [current3.subject.value]
|
|
@@ -27641,6 +27642,7 @@ var accumulateSubjects = (accumulator, current3) => {
|
|
|
27641
27642
|
// src/thing/accumulateValues.ts
|
|
27642
27643
|
var accumulateValues = (accumulator, current3) => {
|
|
27643
27644
|
const existing = accumulator[current3.predicate.uri];
|
|
27645
|
+
if (existing && existing.includes(current3.object.value)) return accumulator;
|
|
27644
27646
|
return {
|
|
27645
27647
|
...accumulator,
|
|
27646
27648
|
[current3.predicate.uri]: existing ? [...existing, current3.object.value] : [current3.object.value]
|
|
@@ -27734,7 +27736,7 @@ var Thing = class {
|
|
|
27734
27736
|
}));
|
|
27735
27737
|
}
|
|
27736
27738
|
/**
|
|
27737
|
-
* Returns all the links from this thing to other resources
|
|
27739
|
+
* Returns all the unique links from this thing to other resources. This only includes named nodes and excludes rdf:type relations.
|
|
27738
27740
|
*/
|
|
27739
27741
|
relations(predicate4) {
|
|
27740
27742
|
const statements = this.store.statementsMatching(
|
|
@@ -27749,7 +27751,25 @@ var Thing = class {
|
|
|
27749
27751
|
}));
|
|
27750
27752
|
}
|
|
27751
27753
|
/**
|
|
27752
|
-
*
|
|
27754
|
+
* Observe changes in links from this thing to other resources
|
|
27755
|
+
*/
|
|
27756
|
+
observeRelations(predicate4) {
|
|
27757
|
+
return merge(this.store.additions$, this.store.removals$).pipe(
|
|
27758
|
+
// Note: we assume that cost of filtering by the optional predicate is not worthwhile
|
|
27759
|
+
filter((quad3) => quad3.subject.value === this.uri),
|
|
27760
|
+
debounceTime(250),
|
|
27761
|
+
map(() => this.relations(predicate4)),
|
|
27762
|
+
startWith(this.relations(predicate4)),
|
|
27763
|
+
// Note: label is constructed from predicate and is therefore irrelevant to the comparison
|
|
27764
|
+
distinctUntilChanged(
|
|
27765
|
+
(prev2, curr) => prev2.length === curr.length && prev2.every(
|
|
27766
|
+
(rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
|
|
27767
|
+
)
|
|
27768
|
+
)
|
|
27769
|
+
);
|
|
27770
|
+
}
|
|
27771
|
+
/**
|
|
27772
|
+
* Returns all the unique links from other resources to this thing
|
|
27753
27773
|
*/
|
|
27754
27774
|
reverseRelations(predicate4) {
|
|
27755
27775
|
const statements = this.store.statementsMatching(
|
|
@@ -27764,6 +27784,24 @@ var Thing = class {
|
|
|
27764
27784
|
uris: values2[predicate5]
|
|
27765
27785
|
}));
|
|
27766
27786
|
}
|
|
27787
|
+
/**
|
|
27788
|
+
* Observe changes in links from other resources to this thing
|
|
27789
|
+
*/
|
|
27790
|
+
observeReverseRelations(predicate4) {
|
|
27791
|
+
return merge(this.store.additions$, this.store.removals$).pipe(
|
|
27792
|
+
// Note: we assume that cost of filtering by the optional predicate is not worthwhile
|
|
27793
|
+
filter((quad3) => quad3.object.value === this.uri),
|
|
27794
|
+
debounceTime(250),
|
|
27795
|
+
map(() => this.reverseRelations(predicate4)),
|
|
27796
|
+
startWith(this.reverseRelations(predicate4)),
|
|
27797
|
+
// Note: label is constructed from predicate and is therefore irrelevant to the comparison
|
|
27798
|
+
distinctUntilChanged(
|
|
27799
|
+
(prev2, curr) => prev2.length === curr.length && prev2.every(
|
|
27800
|
+
(rel2, i) => rel2.predicate === curr[i].predicate && rel2.uris.length === curr[i].uris.length
|
|
27801
|
+
)
|
|
27802
|
+
)
|
|
27803
|
+
);
|
|
27804
|
+
}
|
|
27767
27805
|
/**
|
|
27768
27806
|
* Returns any value linked from this thing via one of the given predicates
|
|
27769
27807
|
* @param predicateUris
|
|
@@ -27851,6 +27889,19 @@ var Thing = class {
|
|
|
27851
27889
|
label: labelForType(uri6)
|
|
27852
27890
|
}));
|
|
27853
27891
|
}
|
|
27892
|
+
/**
|
|
27893
|
+
* Observe changes to the list of RDF types for this thing
|
|
27894
|
+
*/
|
|
27895
|
+
observeTypes() {
|
|
27896
|
+
return merge(this.store.additions$, this.store.removals$).pipe(
|
|
27897
|
+
filter(
|
|
27898
|
+
(quad3) => quad3.subject.value === this.uri && quad3.predicate.value === "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" || quad3.predicate.value === "http://www.w3.org/2000/01/rdf-schema#subClassOf"
|
|
27899
|
+
),
|
|
27900
|
+
map(() => this.types()),
|
|
27901
|
+
startWith(this.types()),
|
|
27902
|
+
distinctUntilChanged((prev2, curr) => prev2.length === curr.length)
|
|
27903
|
+
);
|
|
27904
|
+
}
|
|
27854
27905
|
/**
|
|
27855
27906
|
* Returns all attachments linked to this thing
|
|
27856
27907
|
*/
|
|
@@ -27917,7 +27968,7 @@ var LdpContainer = class extends Thing {
|
|
|
27917
27968
|
observeContains() {
|
|
27918
27969
|
return merge(this.store.additions$, this.store.removals$).pipe(
|
|
27919
27970
|
filter(
|
|
27920
|
-
(quad3) => quad3.graph.value
|
|
27971
|
+
(quad3) => quad3.graph.value === this.uri && quad3.predicate.value === "http://www.w3.org/ns/ldp#contains"
|
|
27921
27972
|
),
|
|
27922
27973
|
debounceTime(250),
|
|
27923
27974
|
map(() => this.contains()),
|
|
@@ -28567,7 +28618,7 @@ var Store = class {
|
|
|
28567
28618
|
),
|
|
28568
28619
|
map(() => this.findMembers(classUri)),
|
|
28569
28620
|
startWith(this.findMembers(classUri)),
|
|
28570
|
-
distinctUntilChanged((prev2, curr) => prev2.length
|
|
28621
|
+
distinctUntilChanged((prev2, curr) => prev2.length === curr.length)
|
|
28571
28622
|
);
|
|
28572
28623
|
}
|
|
28573
28624
|
/**
|
|
@@ -28654,7 +28705,7 @@ var Store = class {
|
|
|
28654
28705
|
graph3,
|
|
28655
28706
|
justOne
|
|
28656
28707
|
);
|
|
28657
|
-
if (statements.length
|
|
28708
|
+
if (statements.length === 0) return null;
|
|
28658
28709
|
if (!subject8) {
|
|
28659
28710
|
return statements[0].subject;
|
|
28660
28711
|
} else if (!predicate4) {
|
package/dist/esm/loader.js
CHANGED
|
@@ -4,7 +4,7 @@ export { s as setNonce } from './index-DzbCx-pP.js';
|
|
|
4
4
|
const defineCustomElements = async (win, options) => {
|
|
5
5
|
if (typeof window === 'undefined') return undefined;
|
|
6
6
|
await globalScripts();
|
|
7
|
-
return bootstrapLazy([["pos-app-generic",[[1,"pos-app-generic"]]],["pos-app-ldp-container",[[1,"pos-app-ldp-container"]]],["pos-app-rdf-document",[[1,"pos-app-rdf-document"]]],["pos-app-image-viewer",[[1,"pos-app-image-viewer",{"resource":[32]}]]],["pos-tool-attachments",[[1,"pos-tool-attachments",{"os":[32],"resource":[32]}]]],["pos-app-document-viewer",[[1,"pos-app-document-viewer",{"resource":[32]}]]],["pos-list",[[0,"pos-list",{"rel":[1],"ifTypeof":[1,"if-typeof"],"fetch":[4],"error":[32],"os":[32],"resource":[32],"items":[32],"templateString":[32]}]]],["pos-case",[[0,"pos-case",{"ifTypeof":[1,"if-typeof"],"not":[4],"else":[4],"error":[32]}]]],["pos-switch",[[0,"pos-switch",{"error":[32],"resource":[32],"caseElements":[32],"
|
|
7
|
+
return bootstrapLazy([["pos-app-generic",[[1,"pos-app-generic"]]],["pos-app-ldp-container",[[1,"pos-app-ldp-container"]]],["pos-app-rdf-document",[[1,"pos-app-rdf-document"]]],["pos-app-image-viewer",[[1,"pos-app-image-viewer",{"resource":[32]}]]],["pos-tool-attachments",[[1,"pos-tool-attachments",{"os":[32],"resource":[32]}]]],["pos-app-document-viewer",[[1,"pos-app-document-viewer",{"resource":[32]}]]],["pos-list",[[0,"pos-list",{"rel":[1],"ifTypeof":[1,"if-typeof"],"fetch":[4],"error":[32],"os":[32],"resource":[32],"items":[32],"templateString":[32]}]]],["pos-case",[[0,"pos-case",{"ifTypeof":[1,"if-typeof"],"ifProperty":[1,"if-property"],"ifRev":[1,"if-rev"],"not":[4],"else":[4],"error":[32]}]]],["pos-switch",[[0,"pos-switch",{"error":[32],"resource":[32],"caseElements":[32],"types":[32],"relations":[32],"reverseRelations":[32]}]]],["pos-value",[[1,"pos-value",{"predicate":[1],"resource":[32]}]]],["pos-attachments",[[1,"pos-attachments",{"resource":[32],"attachments":[32],"addToList":[64]}]]],["pos-container-contents",[[1,"pos-container-contents",{"container":[32],"contents":[32],"loading":[32],"createNewItem":[32]},[[0,"keydown","handleKeyDown"]]]]],["pos-document",[[1,"pos-document",{"src":[1],"alt":[1],"os":[32],"file":[32],"brokenFile":[32],"error":[32],"saveStatus":[32],"loading":[32],"isEditable":[32]},[[0,"pod-os:document-modified","handleDocumentModified"]],{"os":[{"fetchBlob":0}],"src":[{"fetchBlob":0}]}]]],["pos-add-new-thing_32",[[0,"pos-app-browser",{"restorePreviousSession":[4,"restore-previous-session"],"mode":[1],"uri":[32]}],[0,"pos-internal-router",{"uri":[1]}],[257,"pos-login",{"os":[32],"customLoggedInComponent":[32]},[[4,"pod-os:logout","logout"],[4,"pod-os:login","onLogin"]]],[1,"pos-navigation",{"uri":[1],"os":[32],"inputValue":[32],"searchIndex":[32],"suggestions":[32],"selectedIndex":[32],"resource":[32]},[[0,"pod-os:search:index-created","buildSearchIndex"],[0,"pod-os:search:index-updated","rebuildSearchIndex"],[0,"pod-os:navigate","openNavigationDialog"],[4,"click","closeDialog"],[0,"pod-os:link","clearSuggestions"],[0,"click","onClickSelf"],[0,"keydown","handleKeyDown"]],{"uri":[{"updateResource":0}],"os":[{"updateResource":0}]}],[1,"pos-user-menu",{"webId":[1,"web-id"]},[[0,"sl-select","onSelect"]]],[1,"pos-add-new-thing",{"referenceUri":[1,"reference-uri"]}],[1,"pos-type-router",{"initialTool":[32],"availableTools":[32],"oldTool":[32],"currentTool":[32],"transitioning":[32]},[[0,"pod-os:tool-selected","handleToolSelected"]]],[257,"pos-app",{"restorePreviousSession":[4,"restore-previous-session"],"os":[32],"unsubscribeSettings":[32],"loading":[32]},[[0,"pod-os:init","initializeOs"],[0,"pod-os:module","loadModule"]]],[257,"pos-error-toast",{"title":[32],"message":[32]},[[8,"unhandledrejection","unhandledRejection"],[0,"pod-os:error","catchError"]]],[260,"pos-router",{"mode":[1],"uri":[32]},[[0,"pod-os:link","linkClicked"],[8,"pod-os:session-restored","sessionRestored"]]],[1,"pos-app-dashboard"],[1,"pos-navigation-bar",{"current":[16],"searchIndexReady":[4,"search-index-ready"]},[[4,"keydown","activate"]]],[1,"pos-app-settings"],[17,"pos-new-thing-form",{"referenceUri":[1,"reference-uri"],"os":[32],"newUri":[32],"name":[32],"selectedTypeUri":[32],"canSubmit":[32]},null,{"name":[{"validate":0}],"selectedTypeUri":[{"validate":0}]}],[17,"pos-login-form",{"idpUrl":[32],"canSubmit":[32]},null,{"idpUrl":[{"validate":0}]}],[1,"pos-tool-select",{"selected":[16],"tools":[16]}],[1,"pos-type-index-entries",{"uri":[1],"entries":[32]}],[1,"pos-example-resources"],[1,"pos-make-findable",{"uri":[1],"os":[32],"thing":[32],"indexes":[32],"unsubscribeSessionChange":[32],"showOptions":[32],"isIndexed":[32]},[[0,"sl-select","onSelect"]],{"uri":[{"updateUri":0}]}],[260,"pos-dialog",{"showModal":[64],"close":[64]}],[1,"pos-getting-started"],[1,"pos-setting-offline-cache"],[1,"pos-share",{"uri":[1],"apps":[32],"os":[32]},[[4,"pod-os:resource-loaded","resourceLoaded"],[0,"sl-select","onSelect"]],{"uri":[{"updateApps":0}]}],[257,"pos-picture",{"blurredBackground":[4,"blurred-background"],"noUpload":[4,"no-upload"],"resource":[32],"os":[32],"isUploading":[32]}],[1,"pos-image",{"src":[1],"alt":[1],"blurredBackground":[4,"blurred-background"],"os":[32],"dataUri":[32],"brokenFile":[32],"networkError":[32],"imageError":[32],"loading":[32]},null,{"os":[{"fetchBlob":0}],"src":[{"fetchBlob":0}]}],[1,"pos-upload",{"accept":[16],"uploader":[16]}],[17,"pos-select-term",{"placeholder":[1],"value":[1],"os":[32],"terms":[32]},null,{"os":[{"setTerms":0}]}],[1,"pos-predicate",{"uri":[1],"label":[1],"expanded":[32]}],[257,"pos-rich-link",{"uri":[1],"rel":[1],"rev":[1],"link":[32],"followPredicate":[32],"error":[32],"showCustomContent":[32]}],[1,"pos-description",{"resource":[32]}],[1,"pos-label",{"resource":[32]}],[257,"pos-resource",{"uri":[1],"lazy":[4],"os":[32],"resource":[32],"consumers":[32],"error":[32],"loading":[32],"fetch":[64]},[[0,"pod-os:resource","provideResource"]],{"os":[{"loadResource":0}],"uri":[{"loadResource":0}]}]]],["pos-relations_2",[[1,"pos-relations",{"data":[32]}],[1,"pos-reverse-relations",{"data":[32]}]]],["pos-subjects",[[1,"pos-subjects",{"data":[32]}]]],["pos-markdown-document",[[1,"pos-markdown-document",{"file":[16],"saveStatus":[1,"save-status"],"editable":[4],"markdown":[32],"isModified":[32],"isEditing":[32],"startEditing":[64],"stopEditing":[64]}]]],["pos-container-item_3",[[257,"pos-container-item",{"resource":[32]}],[1,"pos-container-toolbar"],[1,"pos-create-new-container-item",{"type":[1],"container":[16],"os":[32],"name":[32]}]]],["pos-add-literal-value_3",[[1,"pos-literals",{"data":[32]}],[1,"pos-type-badges",{"data":[32],"typeLabels":[32],"isExpanded":[32]}],[1,"pos-add-literal-value",{"os":[32],"resource":[32],"currentValue":[32],"selectedTermUri":[32]},null,{"os":[{"setName":0}]}]]]], options);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
export { defineCustomElements };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-DzbCx-pP.js';
|
|
2
|
-
import { l as labelFromUri } from './index-
|
|
2
|
+
import { l as labelFromUri } from './index-DymdXook.js';
|
|
3
3
|
import { s as subscribePodOs } from './PodOsAware-jlzl8vRd.js';
|
|
4
4
|
import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
|
|
5
5
|
import './chunk.ZGGPD2XJ-SJISSXOc.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h as h$4, H as Host, c as createEvent, a as getElement, i as getRenderingRef, j as forceUpdate } from './index-DzbCx-pP.js';
|
|
2
2
|
import { i as i$5, E as E$2, T as T$3, c as component_styles_default, _ as __decorateClass, n as n$6, S as ShoelaceElement, x as x$1, d as SlIcon, r as r$4, w as watch, e as __yieldStar, f as f$5 } from './chunk.ZGGPD2XJ-SJISSXOc.js';
|
|
3
3
|
import { c as createStore$1, s as store, B as BrokenFile } from './chunk.XQ2OKYYA-Cr3bMzqn.js';
|
|
4
|
-
import { P as PodOS, N as NoOfflineCache, a as LabelIndex, T as TypeIndex2 } from './index-
|
|
4
|
+
import { P as PodOS, N as NoOfflineCache, a as LabelIndex, T as TypeIndex2 } from './index-DymdXook.js';
|
|
5
5
|
import { c as cjsExports } from './index-vFMstSdt.js';
|
|
6
6
|
import { L as LocalizeController, e as e$6, s as setDefaultAnimation, a as stopAnimations, g as getAnimation, b as animateTo, w as waitForEvent, S as SlPopup } from './chunk.URTPIBTY-yxgfEQ1K.js';
|
|
7
7
|
import { a as e$4, i as i$6, t as t$2, e as e$5 } from './class-map-DEweE_Cr.js';
|
|
@@ -3076,7 +3076,7 @@ const PosApp = class {
|
|
|
3076
3076
|
disconnectedCallback() {
|
|
3077
3077
|
this.unsubscribeSettings();
|
|
3078
3078
|
this.disconnected$.next();
|
|
3079
|
-
this.disconnected$.
|
|
3079
|
+
this.disconnected$.complete();
|
|
3080
3080
|
}
|
|
3081
3081
|
async initializeOs(event) {
|
|
3082
3082
|
event.stopPropagation();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host } from './index-DzbCx-pP.js';
|
|
2
|
-
import { L as LdpContainer } from './index-
|
|
2
|
+
import { L as LdpContainer } from './index-DymdXook.js';
|
|
3
3
|
import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
|
|
4
4
|
import { c as cjsExports } from './index-vFMstSdt.js';
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ const PosContainerContents = class {
|
|
|
19
19
|
this.container
|
|
20
20
|
.observeContains()
|
|
21
21
|
.pipe(cjsExports.takeUntil(this.disconnected$))
|
|
22
|
-
.subscribe(contains => (this.contents = contains.
|
|
22
|
+
.subscribe(contains => (this.contents = contains.toSorted((a, b) => a.name.localeCompare(b.name))));
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
onCreateNewFile() {
|
|
@@ -47,7 +47,7 @@ const PosContainerContents = class {
|
|
|
47
47
|
}
|
|
48
48
|
disconnectedCallback() {
|
|
49
49
|
this.disconnected$.next();
|
|
50
|
-
this.disconnected$.
|
|
50
|
+
this.disconnected$.complete();
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
PosContainerContents.style = posContainerContentsCss();
|
|
@@ -26936,7 +26936,7 @@ const PosMarkdownDocument = class {
|
|
|
26936
26936
|
}
|
|
26937
26937
|
disconnectedCallback() {
|
|
26938
26938
|
this.disconnected$.next();
|
|
26939
|
-
this.disconnected$.
|
|
26939
|
+
this.disconnected$.complete();
|
|
26940
26940
|
}
|
|
26941
26941
|
/**
|
|
26942
26942
|
* Switch to editing mode
|
|
@@ -26953,7 +26953,7 @@ const PosMarkdownDocument = class {
|
|
|
26953
26953
|
this.isEditing = false;
|
|
26954
26954
|
}
|
|
26955
26955
|
render() {
|
|
26956
|
-
return (h$1("article", { key: '
|
|
26956
|
+
return (h$1("article", { key: '5ea4a46927219fe07df4cb79d9a43bc8fae9d1cd' }, this.editable ? (h$1("header", null, this.isEditing ? this.getStatus() : null, this.isEditing ? (h$1("button", { onClick: () => this.stopEditing() }, h$1("sl-icon", { name: "eye" }), "View")) : (h$1("button", { onClick: () => this.startEditing() }, h$1("sl-icon", { name: "pencil-square" }), "Edit")))) : null, h$1("div", { key: 'fb013b33f02fd5c756238fe9ce8a9799111e02b7', class: "content", ref: el => (this.editorEl = el) })));
|
|
26957
26957
|
}
|
|
26958
26958
|
getStatus() {
|
|
26959
26959
|
if (this.isModified) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-DzbCx-pP.js';
|
|
2
|
-
import { R as RdfDocument } from './index-
|
|
2
|
+
import { R as RdfDocument } from './index-DymdXook.js';
|
|
3
3
|
import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
|
|
4
4
|
|
|
5
5
|
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)}}}`;
|
|
@@ -1,32 +1,62 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, a as getElement } from './index-DzbCx-pP.js';
|
|
2
2
|
import { s as subscribeResource } from './ResourceAware-BW_CkW1K.js';
|
|
3
|
+
import { c as cjsExports } from './index-vFMstSdt.js';
|
|
3
4
|
|
|
4
5
|
const PosSwitch = class {
|
|
5
6
|
constructor(hostRef) {
|
|
6
7
|
registerInstance(this, hostRef);
|
|
7
8
|
this.subscribeResource = createEvent(this, "pod-os:resource", 7);
|
|
8
9
|
this.error = null;
|
|
10
|
+
this.disconnected$ = new cjsExports.Subject();
|
|
9
11
|
this.receiveResource = (resource) => {
|
|
10
|
-
|
|
12
|
+
// reset any existing resource
|
|
13
|
+
this.disconnected$.next();
|
|
14
|
+
this.resource = undefined;
|
|
15
|
+
let observables = [];
|
|
16
|
+
if (this.caseElements.some(caseElement => caseElement.hasAttribute('if-typeof'))) {
|
|
17
|
+
const observeTypes = resource.observeTypes().pipe(cjsExports.takeUntil(this.disconnected$));
|
|
18
|
+
observeTypes.subscribe(types => {
|
|
19
|
+
this.types = types;
|
|
20
|
+
});
|
|
21
|
+
observables.push(observeTypes);
|
|
22
|
+
}
|
|
23
|
+
if (this.caseElements.some(caseElement => caseElement.hasAttribute('if-property'))) {
|
|
24
|
+
const observeRelations = resource.observeRelations().pipe(cjsExports.takeUntil(this.disconnected$));
|
|
25
|
+
observeRelations.subscribe(relations => {
|
|
26
|
+
this.relations = relations;
|
|
27
|
+
});
|
|
28
|
+
observables.push(observeRelations);
|
|
29
|
+
}
|
|
30
|
+
if (this.caseElements.some(caseElement => caseElement.hasAttribute('if-rev'))) {
|
|
31
|
+
const observeReverseRelations = resource.observeReverseRelations().pipe(cjsExports.takeUntil(this.disconnected$));
|
|
32
|
+
observeReverseRelations.subscribe(reverseRelations => {
|
|
33
|
+
this.reverseRelations = reverseRelations;
|
|
34
|
+
});
|
|
35
|
+
observables.push(observeReverseRelations);
|
|
36
|
+
}
|
|
37
|
+
cjsExports.firstValueFrom(cjsExports.combineLatest(observables)).then(() => (this.resource = resource));
|
|
11
38
|
};
|
|
12
39
|
}
|
|
13
40
|
componentWillLoad() {
|
|
14
|
-
subscribeResource(this);
|
|
15
41
|
const caseElements = this.host.querySelectorAll('pos-case');
|
|
16
42
|
if (caseElements.length == 0) {
|
|
17
43
|
this.error = 'No pos-case elements found';
|
|
18
44
|
}
|
|
19
45
|
else {
|
|
20
|
-
this.caseElements = caseElements;
|
|
46
|
+
this.caseElements = Array.from(caseElements);
|
|
47
|
+
subscribeResource(this);
|
|
21
48
|
}
|
|
22
49
|
}
|
|
23
50
|
test(caseElement) {
|
|
24
51
|
let state = null;
|
|
25
52
|
if (caseElement.getAttribute('if-typeof') !== null) {
|
|
26
|
-
state = this.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
53
|
+
state = this.types.map(x => x.uri).includes(caseElement.getAttribute('if-typeof'));
|
|
54
|
+
}
|
|
55
|
+
if (caseElement.getAttribute('if-property') !== null) {
|
|
56
|
+
state = this.relations.map(x => x.predicate).includes(caseElement.getAttribute('if-property'));
|
|
57
|
+
}
|
|
58
|
+
if (caseElement.getAttribute('if-rev') !== null) {
|
|
59
|
+
state = this.reverseRelations.map(x => x.predicate).includes(caseElement.getAttribute('if-rev'));
|
|
30
60
|
}
|
|
31
61
|
if (caseElement.getAttribute('not') != null) {
|
|
32
62
|
state = !state;
|
|
@@ -56,6 +86,10 @@ const PosSwitch = class {
|
|
|
56
86
|
const activeElementsContent = activeElements.map(el => el.querySelector('template').innerHTML).join('\n');
|
|
57
87
|
return h(Host, { innerHTML: activeElementsContent });
|
|
58
88
|
}
|
|
89
|
+
disconnectedCallback() {
|
|
90
|
+
this.disconnected$.next();
|
|
91
|
+
this.disconnected$.complete();
|
|
92
|
+
}
|
|
59
93
|
get host() { return getElement(this); }
|
|
60
94
|
};
|
|
61
95
|
|
|
@@ -9,6 +9,14 @@ export declare class PosCase {
|
|
|
9
9
|
* Test if the resource is of the specified type
|
|
10
10
|
*/
|
|
11
11
|
ifTypeof?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Test if the resource has the specified property (forward link)
|
|
14
|
+
*/
|
|
15
|
+
ifProperty?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Test if the resource is the subject of the specified property (backward link)
|
|
18
|
+
*/
|
|
19
|
+
ifRev?: string;
|
|
12
20
|
/**
|
|
13
21
|
* Negates the result of the test
|
|
14
22
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Thing } from '@pod-os/core';
|
|
1
|
+
import { RdfType, Relation, Thing } from '@pod-os/core';
|
|
2
2
|
import { ResourceAware, ResourceEventEmitter } from '../events/ResourceAware';
|
|
3
3
|
/**
|
|
4
4
|
* Selects a child template to render based on properties of the subject resource, usually defined by an ancestor `pos-resource` element.
|
|
@@ -9,11 +9,15 @@ export declare class PosSwitch implements ResourceAware {
|
|
|
9
9
|
host: HTMLElement;
|
|
10
10
|
error: string;
|
|
11
11
|
resource: Thing;
|
|
12
|
-
caseElements:
|
|
13
|
-
|
|
12
|
+
caseElements: HTMLPosCaseElement[];
|
|
13
|
+
types: RdfType[];
|
|
14
|
+
relations: Relation[];
|
|
15
|
+
reverseRelations: Relation[];
|
|
16
|
+
private readonly disconnected$;
|
|
14
17
|
subscribeResource: ResourceEventEmitter;
|
|
15
18
|
componentWillLoad(): void;
|
|
16
19
|
test(caseElement: any): boolean;
|
|
17
20
|
receiveResource: (resource: Thing) => void;
|
|
18
21
|
render(): any;
|
|
22
|
+
disconnectedCallback(): void;
|
|
19
23
|
}
|
|
@@ -67,6 +67,14 @@ export namespace Components {
|
|
|
67
67
|
* The test only evaluates to true if tests for preceding cases have failed
|
|
68
68
|
*/
|
|
69
69
|
"else"?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Test if the resource has the specified property (forward link)
|
|
72
|
+
*/
|
|
73
|
+
"ifProperty"?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Test if the resource is the subject of the specified property (backward link)
|
|
76
|
+
*/
|
|
77
|
+
"ifRev"?: string;
|
|
70
78
|
/**
|
|
71
79
|
* Test if the resource is of the specified type
|
|
72
80
|
*/
|
|
@@ -1417,6 +1425,14 @@ declare namespace LocalJSX {
|
|
|
1417
1425
|
* The test only evaluates to true if tests for preceding cases have failed
|
|
1418
1426
|
*/
|
|
1419
1427
|
"else"?: boolean;
|
|
1428
|
+
/**
|
|
1429
|
+
* Test if the resource has the specified property (forward link)
|
|
1430
|
+
*/
|
|
1431
|
+
"ifProperty"?: string;
|
|
1432
|
+
/**
|
|
1433
|
+
* Test if the resource is the subject of the specified property (backward link)
|
|
1434
|
+
*/
|
|
1435
|
+
"ifRev"?: string;
|
|
1420
1436
|
/**
|
|
1421
1437
|
* Test if the resource is of the specified type
|
|
1422
1438
|
*/
|
|
@@ -1763,6 +1779,8 @@ declare namespace LocalJSX {
|
|
|
1763
1779
|
}
|
|
1764
1780
|
interface PosCaseAttributes {
|
|
1765
1781
|
"ifTypeof": string;
|
|
1782
|
+
"ifProperty": string;
|
|
1783
|
+
"ifRev": string;
|
|
1766
1784
|
"not": boolean;
|
|
1767
1785
|
"else": boolean;
|
|
1768
1786
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pod-os/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0-rc.4b2b787.0",
|
|
4
4
|
"description": "Custom elements for usage with Solid Pods",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"generate": "stencil generate"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@pod-os/core": "
|
|
24
|
+
"@pod-os/core": "v0.27.0-rc.4b2b787.0",
|
|
25
25
|
"@shoelace-style/shoelace": "^2.20.1",
|
|
26
26
|
"@stencil/core": "^4.43.2",
|
|
27
27
|
"@stencil/store": "^2.2.2",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as e,H as i}from"./p-DzbCx-pP.js";import{L as n}from"./p-DHl0QGLf.js";import{s as o}from"./p-BW_CkW1K.js";import{c as r}from"./p-vFMstSdt.js";const l=class{constructor(e){t(this,e),this.subscribeResource=s(this,"pod-os:resource",7),this.contents=[],this.loading=!0,this.createNewItem=null,this.disconnected$=new r.Subject,this.receiveResource=t=>{this.container=t.assume(n),this.loading=!1,this.container.observeContains().pipe(r.takeUntil(this.disconnected$)).subscribe((t=>this.contents=t.sort(((t,s)=>t.name.localeCompare(s.name)))))}}onCreateNewFile(){this.createNewItem="file"}onCreateNewFolder(){this.createNewItem="folder"}componentWillLoad(){o(this)}handleKeyDown(t){"Escape"===t.key&&(this.createNewItem=null)}render(){if(this.loading)return null;const t=this.contents.map((t=>e("li",{key:t.uri},e("pos-resource",{lazy:!0,uri:t.uri},e("pos-container-item",null,t.name)))));return null!==this.createNewItem&&t.unshift(e("li",{key:"new-item"},e("pos-create-new-container-item",{type:this.createNewItem,container:this.container}))),e(i,null,e("pos-container-toolbar",{"onPod-os:create-new-file":()=>this.onCreateNewFile(),"onPod-os:create-new-folder":()=>this.onCreateNewFolder()}),t.length>0?e("ul",{"aria-label":"Container contents"},t):e("p",null,"The container is empty"))}disconnectedCallback(){this.disconnected$.next(),this.disconnected$.unsubscribe()}};l.style="ul{list-style:none;padding:0;margin:0}li{padding:0;margin:0}";export{l as pos_container_contents}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,c as t,h as e,H as n,a as i}from"./p-DzbCx-pP.js";import{s as o}from"./p-BW_CkW1K.js";const l=class{constructor(e){s(this,e),this.subscribeResource=t(this,"pod-os:resource",7),this.error=null,this.receiveResource=s=>{this.resource=s}}componentWillLoad(){o(this);const s=this.host.querySelectorAll("pos-case");0==s.length?this.error="No pos-case elements found":this.caseElements=s}test(s){let t=null;return null!==s.getAttribute("if-typeof")&&(t=this.resource.types().map((s=>s.uri)).includes(s.getAttribute("if-typeof"))),null!=s.getAttribute("not")&&(t=!t),t}render(){if(this.error)return this.error;if(!this.resource)return null;let s=null,t=[];this.caseElements.forEach((e=>{const n=this.test(e),i=!0!==s||null===e.getAttribute("else");n&&i&&(s=n,t.push(e)),null===n&&i&&t.push(e)}));const i=t.map((s=>s.querySelector("template").innerHTML)).join("\n");return e(n,{innerHTML:i})}get host(){return i(this)}};export{l as pos_switch}
|