lit-rdf 0.1.0 → 0.2.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/CHANGELOG.md +14 -0
- package/package.json +8 -2
- package/src/components/data-graph.d.ts +2 -1
- package/src/components/data-graph.js +7 -3
- package/src/components/rdf-environment.d.ts +1 -0
- package/src/components/rdf-environment.js +6 -1
- package/src/components/resource-label.d.ts +4 -4
- package/src/components/resource-label.js +8 -7
- package/src/components/resource-link.d.ts +3 -3
- package/src/components/resource-link.js +9 -5
- package/src/components/target-node.d.ts +1 -1
- package/src/constructor.d.ts +1 -1
- package/src/controllers/Environment.d.ts +7 -0
- package/src/controllers/Environment.js +17 -0
- package/src/controllers/FocusNode.js +6 -0
- package/src/controllers/Graph.d.ts +7 -0
- package/src/controllers/Graph.js +14 -0
- package/src/controllers.d.ts +2 -0
- package/src/controllers.js +2 -0
- package/src/mixins/environment.d.ts +0 -1
- package/src/mixins/environment.js +1 -12
- package/src/mixins/graph.d.ts +0 -1
- package/src/mixins/graph.js +1 -13
- package/src/mixins/targetNode.d.ts +8 -1
- package/src/mixins/targetNode.js +13 -14
- package/src/mixins/traverseGraph.js +5 -4
- package/src/mixins.d.ts +1 -2
- package/src/mixins.js +1 -2
- package/src/mixins/focusNode.d.ts +0 -2
- package/src/mixins/focusNode.js +0 -20
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# lit-rdf
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- db31aa2: Removed `provideFocusNode`, `provideGraph` and `provideEnvironment` mixins. Instead, the respecitve controllers must be used
|
|
8
|
+
- db31aa2: Change the `resource-label` `property` property to `predicate`.
|
|
9
|
+
|
|
10
|
+
## 0.1.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- First release
|
package/package.json
CHANGED
|
@@ -1,20 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-rdf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prepare": "husky",
|
|
7
|
-
"lint": "eslint . --quiet --ignore-path .gitignore",
|
|
7
|
+
"lint": "eslint . --quiet --ignore-path .gitignore --ignore-path .eslintignore",
|
|
8
8
|
"storybook": "storybook dev -p 6006",
|
|
9
9
|
"build-storybook": "storybook build",
|
|
10
|
+
"test": "vitest --project=storybook",
|
|
10
11
|
"build": "tsc",
|
|
11
12
|
"prepack": "npm run build",
|
|
12
13
|
"release": "changeset publish"
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
|
16
|
+
"CHANGELOG.md",
|
|
15
17
|
"src/**/*.js",
|
|
16
18
|
"src/**/*.d.ts"
|
|
17
19
|
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/hypermedia-app/lit-rdf"
|
|
23
|
+
},
|
|
18
24
|
"exports": {
|
|
19
25
|
".": "./src/index.js",
|
|
20
26
|
"./components/*.js": "./src/components/*.js",
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { AnyPointer } from 'clownface';
|
|
3
|
-
declare const default_base: typeof LitElement & import("../constructor.js").LitElementConstructor<import("../constructor.js").
|
|
3
|
+
declare const default_base: typeof LitElement & import("../constructor.js").LitElementConstructor<import("../constructor.js").WithGraph>;
|
|
4
4
|
export default class extends default_base {
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
5
6
|
parent: AnyPointer | undefined;
|
|
6
7
|
render(): unknown;
|
|
7
8
|
}
|
|
@@ -4,13 +4,17 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement } from 'lit';
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import { consume } from '@lit/context';
|
|
9
9
|
import { customElement, state } from 'lit/decorators.js';
|
|
10
10
|
import { dataset } from '../context.js';
|
|
11
|
-
import { consumeEnvironment } from '../mixins/environment.js';
|
|
12
11
|
import { provideGraph } from '../mixins/graph.js';
|
|
13
|
-
let default_1 = class extends provideGraph(
|
|
12
|
+
let default_1 = class extends provideGraph(LitElement) {
|
|
13
|
+
static { this.styles = css `
|
|
14
|
+
:host {
|
|
15
|
+
display: contents;
|
|
16
|
+
}
|
|
17
|
+
`; }
|
|
14
18
|
render() {
|
|
15
19
|
return html `
|
|
16
20
|
<slot></slot>`;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
declare const default_base: typeof LitElement & import("../constructor.js").LitElementConstructor<import("../constructor.js").WithEnvironment>;
|
|
3
3
|
export default class extends default_base {
|
|
4
|
+
static styles: import("lit").CSSResult;
|
|
4
5
|
constructor();
|
|
5
6
|
render(): import("lit-html").TemplateResult<1>;
|
|
6
7
|
}
|
|
@@ -4,11 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { html, LitElement } from 'lit';
|
|
7
|
+
import { css, html, LitElement } from 'lit';
|
|
8
8
|
import env from '@zazuko/env/web.js';
|
|
9
9
|
import { customElement } from 'lit/decorators.js';
|
|
10
10
|
import { provideEnvironment } from '../mixins.js';
|
|
11
11
|
let default_1 = class extends provideEnvironment(LitElement) {
|
|
12
|
+
static { this.styles = css `
|
|
13
|
+
:host {
|
|
14
|
+
display: contents;
|
|
15
|
+
}
|
|
16
|
+
`; }
|
|
12
17
|
constructor() {
|
|
13
18
|
super();
|
|
14
19
|
this.rdf = env;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { NamedNode } from '@rdfjs/types';
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export declare class ResourceLabel extends LitElement {
|
|
4
|
+
predicate: NamedNode;
|
|
5
|
+
private readonly focusNode;
|
|
6
|
+
constructor();
|
|
6
7
|
render(): import("lit-html").TemplateResult<1>;
|
|
7
8
|
}
|
|
8
|
-
export {};
|
|
@@ -8,23 +8,24 @@ import { html, LitElement } from 'lit';
|
|
|
8
8
|
import { customElement, property } from 'lit/decorators.js';
|
|
9
9
|
import { localizedLabel } from '@rdfjs-elements/lit-helpers/localizedLabel.js';
|
|
10
10
|
import rdf from '@rdfjs/data-model';
|
|
11
|
-
import { consumeFocusNode } from '../mixins/focusNode.js';
|
|
12
11
|
import { toNamedNode } from '../converter.js';
|
|
13
|
-
|
|
12
|
+
import { FocusNode } from '../controllers/FocusNode.js';
|
|
13
|
+
let ResourceLabel = class ResourceLabel extends LitElement {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(
|
|
16
|
-
this.
|
|
15
|
+
super();
|
|
16
|
+
this.predicate = rdf.namedNode('http://www.w3.org/2000/01/rdf-schema#label');
|
|
17
|
+
this.focusNode = new FocusNode(this);
|
|
17
18
|
}
|
|
18
19
|
render() {
|
|
19
|
-
if (!this.focusNode) {
|
|
20
|
+
if (!this.focusNode.pointer) {
|
|
20
21
|
return html ``;
|
|
21
22
|
}
|
|
22
|
-
return html `${localizedLabel(this.focusNode, { property: this.
|
|
23
|
+
return html `${localizedLabel(this.focusNode.pointer, { property: this.predicate })}`;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
__decorate([
|
|
26
27
|
property({ type: Object, converter: toNamedNode })
|
|
27
|
-
], ResourceLabel.prototype, "
|
|
28
|
+
], ResourceLabel.prototype, "predicate", void 0);
|
|
28
29
|
ResourceLabel = __decorate([
|
|
29
30
|
customElement('resource-label')
|
|
30
31
|
], ResourceLabel);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { NamedNode } from '@rdfjs/types';
|
|
3
|
-
declare
|
|
4
|
-
export declare class ResourceLink extends ResourceLink_base {
|
|
3
|
+
export declare class ResourceLink extends LitElement {
|
|
5
4
|
property?: NamedNode;
|
|
5
|
+
private readonly focusNode;
|
|
6
|
+
constructor();
|
|
6
7
|
render(): import("lit-html").TemplateResult<1>;
|
|
7
8
|
}
|
|
8
|
-
export {};
|
|
@@ -7,20 +7,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html, LitElement } from 'lit';
|
|
8
8
|
import { customElement, property } from 'lit/decorators.js';
|
|
9
9
|
import { findNodes } from 'clownface-shacl-path';
|
|
10
|
-
import { consumeFocusNode } from '../mixins/focusNode.js';
|
|
11
10
|
import { toPropertyPath } from '../converter.js';
|
|
12
|
-
|
|
11
|
+
import { FocusNode } from '../controllers/FocusNode.js';
|
|
12
|
+
let ResourceLink = class ResourceLink extends LitElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.focusNode = new FocusNode(this);
|
|
16
|
+
}
|
|
13
17
|
render() {
|
|
14
|
-
if (!this.focusNode) {
|
|
18
|
+
if (!this.focusNode.pointer) {
|
|
15
19
|
return html `
|
|
16
20
|
<slot></slot>`;
|
|
17
21
|
}
|
|
18
22
|
let href;
|
|
19
23
|
if (this.property) {
|
|
20
|
-
href = findNodes(this.focusNode, this.property).value;
|
|
24
|
+
href = findNodes(this.focusNode.pointer, this.property).value;
|
|
21
25
|
}
|
|
22
26
|
if (!href) {
|
|
23
|
-
href = this.focusNode.value;
|
|
27
|
+
href = this.focusNode.pointer.value;
|
|
24
28
|
}
|
|
25
29
|
return html `<a href="${href}">
|
|
26
30
|
<slot></slot>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
2
|
import type { NamedNode } from '@rdfjs/types';
|
|
3
|
-
declare const default_base: typeof LitElement & import("../constructor.js").LitElementConstructor<import("../constructor.js").WithFocusNode>;
|
|
3
|
+
declare const default_base: typeof LitElement & import("../constructor.js").LitElementConstructor<import("../constructor.js").WithFocusNode & import("../mixins/targetNode.js").WithTargets>;
|
|
4
4
|
export default class extends default_base {
|
|
5
5
|
static styles: import("lit").CSSResult;
|
|
6
6
|
orderBy: NamedNode | undefined;
|
package/src/constructor.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { LitElement } from 'lit';
|
|
2
2
|
import type { AnyPointer, MultiPointer } from 'clownface';
|
|
3
3
|
import type { Environment } from './context.js';
|
|
4
|
-
export type LitElementConstructor<T =
|
|
4
|
+
export type LitElementConstructor<T = unknown> = new (...args: any[]) => T & LitElement;
|
|
5
5
|
export type WithGraph = {
|
|
6
6
|
graph: AnyPointer | undefined;
|
|
7
7
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import * as context from '../context.js';
|
|
3
|
+
export declare class Environment<E extends context.Environment = context.Environment> {
|
|
4
|
+
private consumer;
|
|
5
|
+
constructor(host: ReactiveControllerHost & HTMLElement);
|
|
6
|
+
get value(): E;
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ContextConsumer } from '@lit/context';
|
|
2
|
+
import * as context from '../context.js';
|
|
3
|
+
export class Environment {
|
|
4
|
+
constructor(host) {
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
this.consumer = new ContextConsumer(host, {
|
|
8
|
+
context: context.environment,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
get value() {
|
|
12
|
+
if (!this.consumer.value) {
|
|
13
|
+
throw new Error('Environment not available. Make sure that a parent element is providing the environment.');
|
|
14
|
+
}
|
|
15
|
+
return this.consumer.value;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -5,10 +5,16 @@ export class FocusNode {
|
|
|
5
5
|
this.focusNodeConsumer = new ContextConsumer(host, {
|
|
6
6
|
context: focusNode,
|
|
7
7
|
subscribe: true,
|
|
8
|
+
callback() {
|
|
9
|
+
host.requestUpdate();
|
|
10
|
+
},
|
|
8
11
|
});
|
|
9
12
|
this.sortCriteriaConsumer = new ContextConsumer(host, {
|
|
10
13
|
context: sortCriteria,
|
|
11
14
|
subscribe: true,
|
|
15
|
+
callback() {
|
|
16
|
+
host.requestUpdate();
|
|
17
|
+
},
|
|
12
18
|
});
|
|
13
19
|
}
|
|
14
20
|
get pointer() {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactiveControllerHost } from 'lit';
|
|
2
|
+
import type { AnyPointer } from 'clownface';
|
|
3
|
+
export declare class Graph {
|
|
4
|
+
private consumer;
|
|
5
|
+
constructor(host: ReactiveControllerHost & HTMLElement, callback?: (value: AnyPointer | undefined) => void);
|
|
6
|
+
get value(): AnyPointer<import("clownface").AnyContext, import("@rdfjs/types").DatasetCore<import("@rdfjs/types").Quad, import("@rdfjs/types").Quad>> | undefined;
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ContextConsumer } from '@lit/context';
|
|
2
|
+
import { dataset } from '../context.js';
|
|
3
|
+
export class Graph {
|
|
4
|
+
constructor(host, callback) {
|
|
5
|
+
this.consumer = new ContextConsumer(host, {
|
|
6
|
+
context: dataset,
|
|
7
|
+
subscribe: true,
|
|
8
|
+
callback,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
get value() {
|
|
12
|
+
return this.consumer.value;
|
|
13
|
+
}
|
|
14
|
+
}
|
package/src/controllers.d.ts
CHANGED
package/src/controllers.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { LitElementConstructor, WithEnvironment } from '../constructor.js';
|
|
2
|
-
export declare function consumeEnvironment<T extends LitElementConstructor>(base: T): T & LitElementConstructor<WithEnvironment>;
|
|
3
2
|
export declare function provideEnvironment<T extends LitElementConstructor>(base: T): T & LitElementConstructor<WithEnvironment>;
|
|
@@ -4,20 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { provide } from '@lit/context';
|
|
8
8
|
import { state } from 'lit/decorators.js';
|
|
9
9
|
import { environment as context } from '../context.js';
|
|
10
|
-
export function consumeEnvironment(base) {
|
|
11
|
-
class Impl extends base {
|
|
12
|
-
constructor(...args) {
|
|
13
|
-
super(...args);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
__decorate([
|
|
17
|
-
consume({ context })
|
|
18
|
-
], Impl.prototype, "rdf", void 0);
|
|
19
|
-
return Impl;
|
|
20
|
-
}
|
|
21
10
|
export function provideEnvironment(base) {
|
|
22
11
|
class Impl extends base {
|
|
23
12
|
constructor(...args) {
|
package/src/mixins/graph.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { LitElementConstructor, WithGraph } from '../constructor.js';
|
|
2
2
|
export declare function provideGraph<T extends LitElementConstructor>(base: T): T & LitElementConstructor<WithGraph>;
|
|
3
|
-
export declare function consumeGraph<T extends LitElementConstructor>(base: T): T & LitElementConstructor<WithGraph>;
|
package/src/mixins/graph.js
CHANGED
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
7
|
+
import { provide } from '@lit/context';
|
|
8
8
|
import { state } from 'lit/decorators.js';
|
|
9
9
|
import { dataset } from '../context.js';
|
|
10
10
|
export function provideGraph(base) {
|
|
@@ -19,15 +19,3 @@ export function provideGraph(base) {
|
|
|
19
19
|
], WithGraphProvider.prototype, "graph", void 0);
|
|
20
20
|
return WithGraphProvider;
|
|
21
21
|
}
|
|
22
|
-
export function consumeGraph(base) {
|
|
23
|
-
class WithGraphConsumer extends base {
|
|
24
|
-
constructor(...args) {
|
|
25
|
-
super(...args);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
__decorate([
|
|
29
|
-
consume({ context: dataset, subscribe: true }),
|
|
30
|
-
state()
|
|
31
|
-
], WithGraphConsumer.prototype, "graph", void 0);
|
|
32
|
-
return WithGraphConsumer;
|
|
33
|
-
}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import type { NamedNode } from '@rdfjs/types';
|
|
1
2
|
import type { LitElementConstructor, WithFocusNode } from '../constructor.js';
|
|
2
|
-
export
|
|
3
|
+
export interface WithTargets {
|
|
4
|
+
targetObjectsOf: NamedNode | undefined;
|
|
5
|
+
targetSubjectsOf: NamedNode | undefined;
|
|
6
|
+
targetClass: NamedNode | undefined;
|
|
7
|
+
targetNode: NamedNode | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function provideTargetNode<T extends LitElementConstructor>(base: T): T & LitElementConstructor<WithFocusNode & WithTargets>;
|
package/src/mixins/targetNode.js
CHANGED
|
@@ -8,25 +8,24 @@ import { property, state } from 'lit/decorators.js';
|
|
|
8
8
|
import { provide } from '@lit/context';
|
|
9
9
|
import { focusNode } from '../context.js';
|
|
10
10
|
import { toNamedNode } from '../converter.js';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { Environment } from '../controllers/Environment.js';
|
|
12
|
+
import { Graph } from '../controllers/Graph.js';
|
|
13
13
|
export function provideTargetNode(base) {
|
|
14
|
-
class DataBound extends
|
|
14
|
+
class DataBound extends base {
|
|
15
15
|
constructor(...args) {
|
|
16
16
|
super(...args);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (_changedProperties.has('graph')) {
|
|
17
|
+
this.rdf = new Environment(this);
|
|
18
|
+
this.graph = new Graph(this, () => {
|
|
20
19
|
this.setFocusNode();
|
|
21
|
-
}
|
|
20
|
+
});
|
|
22
21
|
}
|
|
23
|
-
updated(
|
|
24
|
-
if (
|
|
22
|
+
updated(changedProperties) {
|
|
23
|
+
if (changedProperties.has('targetNode') || changedProperties.has('targetClass') || changedProperties.has('targetSubjectsOf') || changedProperties.has('targetObjectsOf')) {
|
|
25
24
|
this.setFocusNode();
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
27
|
setFocusNode() {
|
|
29
|
-
if (this.graph) {
|
|
28
|
+
if (this.graph.value) {
|
|
30
29
|
const found = this.findFocusNode();
|
|
31
30
|
if (found?.terms.length) {
|
|
32
31
|
this.focusNode = found;
|
|
@@ -35,16 +34,16 @@ export function provideTargetNode(base) {
|
|
|
35
34
|
}
|
|
36
35
|
findFocusNode() {
|
|
37
36
|
if (this.targetNode) {
|
|
38
|
-
return this.graph?.node(this.targetNode);
|
|
37
|
+
return this.graph.value?.node(this.targetNode);
|
|
39
38
|
}
|
|
40
39
|
if (this.targetClass) {
|
|
41
|
-
return this.graph?.has(this.rdf.ns.rdf.type, this.targetClass);
|
|
40
|
+
return this.graph.value?.has(this.rdf.value.ns.rdf.type, this.targetClass);
|
|
42
41
|
}
|
|
43
42
|
if (this.targetSubjectsOf) {
|
|
44
|
-
return this.graph?.in(this.targetSubjectsOf);
|
|
43
|
+
return this.graph.value?.in(this.targetSubjectsOf);
|
|
45
44
|
}
|
|
46
45
|
if (this.targetObjectsOf) {
|
|
47
|
-
return this.graph?.out(this.targetObjectsOf);
|
|
46
|
+
return this.graph.value?.out(this.targetObjectsOf);
|
|
48
47
|
}
|
|
49
48
|
return undefined;
|
|
50
49
|
}
|
|
@@ -9,11 +9,12 @@ import { findNodes } from 'clownface-shacl-path';
|
|
|
9
9
|
import { provide } from '@lit/context';
|
|
10
10
|
import { focusNode as context } from '../context.js';
|
|
11
11
|
import { toPropertyPath } from '../converter.js';
|
|
12
|
-
import {
|
|
12
|
+
import { FocusNode } from '../controllers/FocusNode.js';
|
|
13
13
|
export function traverseGraph(Base) {
|
|
14
|
-
class TraverseGraph extends
|
|
14
|
+
class TraverseGraph extends Base {
|
|
15
15
|
constructor(...args) {
|
|
16
16
|
super(...args);
|
|
17
|
+
this.focusNode = new FocusNode(this);
|
|
17
18
|
}
|
|
18
19
|
willUpdate(_changedProperties) {
|
|
19
20
|
if (_changedProperties.has('focusNode') || _changedProperties.has('propertyPath')) {
|
|
@@ -21,8 +22,8 @@ export function traverseGraph(Base) {
|
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
setObjectNode() {
|
|
24
|
-
if (this.propertyPath && this.focusNode) {
|
|
25
|
-
this.objectNode = findNodes(this.focusNode, this.propertyPath);
|
|
25
|
+
if (this.propertyPath && this.focusNode.pointer) {
|
|
26
|
+
this.objectNode = findNodes(this.focusNode.pointer, this.propertyPath);
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
}
|
package/src/mixins.d.ts
CHANGED
package/src/mixins.js
CHANGED
package/src/mixins/focusNode.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
import { consume } from '@lit/context';
|
|
8
|
-
import { focusNode as context } from '../context.js';
|
|
9
|
-
import { consumeEnvironment } from './environment.js';
|
|
10
|
-
export function consumeFocusNode(base) {
|
|
11
|
-
class Impl extends consumeEnvironment(base) {
|
|
12
|
-
constructor(...args) {
|
|
13
|
-
super(...args);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
__decorate([
|
|
17
|
-
consume({ context, subscribe: true })
|
|
18
|
-
], Impl.prototype, "focusNode", void 0);
|
|
19
|
-
return Impl;
|
|
20
|
-
}
|