@ulb-darmstadt/shacl-form 1.1.2 → 1.1.3

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/loader.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Store, Parser, NamedNode } from 'n3';
2
- import { ShaclForm } from './form';
2
+ import { Config } from './config';
3
3
  export declare class Loader {
4
4
  private abortController;
5
- private form;
6
- constructor(form: ShaclForm);
5
+ private config;
6
+ constructor(config: Config);
7
7
  loadGraphs(): Promise<void>;
8
8
  importRDF(input: string | Promise<string>, store: Store, graph?: NamedNode, parser?: Parser): Promise<void>;
9
9
  fetchRDF(url: string): Promise<string>;
package/dist/node.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import { BlankNode, NamedNode, Store } from 'n3';
2
- import { ShaclPropertyInstance } from './property';
3
2
  import { Config } from './config';
4
3
  export declare class ShaclNode extends HTMLElement {
5
4
  shaclSubject: NamedNode;
6
- exportValueSubject: NamedNode | BlankNode;
5
+ nodeId: NamedNode | BlankNode;
7
6
  targetClass: NamedNode | undefined;
8
- parent: ShaclNode | ShaclPropertyInstance | undefined;
9
7
  config: Config;
10
- constructor(shaclSubject: NamedNode, config: Config, parent: ShaclNode | ShaclPropertyInstance | undefined, valueSubject: NamedNode | BlankNode | undefined);
8
+ constructor(shaclSubject: NamedNode, config: Config, valueSubject: NamedNode | BlankNode | undefined, label?: string);
11
9
  toRDF(graph: Store, subject?: NamedNode | BlankNode): (NamedNode | BlankNode);
12
10
  }
package/dist/plugin.d.ts CHANGED
@@ -1,10 +1,21 @@
1
- import { ShaclPropertySpec } from './property-spec';
2
- import { InputBase } from './inputs';
1
+ import { ShaclPropertyTemplate } from './property-template';
2
+ import { InputListEntry } from './editors';
3
+ import { NamedNode } from 'n3';
4
+ import { Term } from '@rdfjs/types';
5
+ import { Config } from './config';
3
6
  export type Plugins = {
4
7
  [predicate: string]: Plugin;
5
8
  };
6
9
  export declare abstract class Plugin {
7
10
  predicate: string;
8
11
  constructor(predicate: string);
9
- abstract createInstance(property: ShaclPropertySpec, value?: string): InputBase;
12
+ abstract createInstance(template: ShaclPropertyTemplate, value?: Term): HTMLElement;
13
+ }
14
+ export type ClassInstanceProvider = (clazz: string) => Promise<string>;
15
+ export declare class ClassInstanceLoader {
16
+ private config;
17
+ private provider;
18
+ private loadedClasses;
19
+ constructor(config: Config, provider: ClassInstanceProvider);
20
+ loadClassInstances(clazz: NamedNode, config: Config): Promise<InputListEntry[]>;
10
21
  }
@@ -1,8 +1,9 @@
1
1
  import { Plugin } from '../plugin';
2
- import { ShaclPropertySpec } from '../property-spec';
3
- import { InputList, InputListEntry } from '../inputs';
2
+ import { Term } from '@rdfjs/types';
3
+ import { ShaclPropertyTemplate } from '../property-template';
4
+ import { InputListEntry } from '../editors';
4
5
  export declare class FixedListPlugin extends Plugin {
5
6
  entries: InputListEntry[] | Promise<InputListEntry[]>;
6
7
  constructor(predicate: string, entries: InputListEntry[] | Promise<InputListEntry[]>);
7
- createInstance(property: ShaclPropertySpec, value?: string): InputList;
8
+ createInstance(template: ShaclPropertyTemplate, value?: Term): HTMLElement;
8
9
  }
@@ -1,3 +1,3 @@
1
1
  export { FixedListPlugin } from './fixed-list';
2
2
  export { MapBoxPlugin } from './mapbox';
3
- export { InputListEntry } from '../inputs';
3
+ export { InputListEntry } from '../editors';
@@ -1,8 +1,8 @@
1
- import { InputText } from '../inputs';
1
+ import { Term } from '@rdfjs/types';
2
2
  import { Plugin } from '../plugin';
3
- import { ShaclPropertySpec } from '../property-spec';
3
+ import { ShaclPropertyTemplate } from '../property-template';
4
4
  export declare class MapBoxPlugin extends Plugin {
5
5
  apiKey: string;
6
6
  constructor(predicate: string, apiKey: string);
7
- createInstance(property: ShaclPropertySpec, value?: string): InputText;
7
+ createInstance(template: ShaclPropertyTemplate, value?: Term): HTMLElement;
8
8
  }
@@ -1,11 +1,11 @@
1
- import { Literal, NamedNode, Quad } from 'n3';
1
+ import { Literal, NamedNode, BlankNode, Quad } from 'n3';
2
2
  import { Term } from '@rdfjs/types';
3
3
  import { Config } from './config';
4
- export declare class ShaclPropertySpec {
4
+ export declare class ShaclPropertyTemplate {
5
5
  label: string;
6
+ nodeId: NamedNode | BlankNode;
6
7
  name: Literal | undefined;
7
8
  description: Literal | undefined;
8
- classInstances: Term[] | undefined;
9
9
  path: string | undefined;
10
10
  node: NamedNode | undefined;
11
11
  class: NamedNode | undefined;
@@ -28,7 +28,7 @@ export declare class ShaclPropertySpec {
28
28
  datatype: NamedNode | undefined;
29
29
  hasValue: Term | undefined;
30
30
  config: Config;
31
- constructor(quads: Quad[], config: Config);
32
- merge(quads: Quad[]): ShaclPropertySpec;
33
- clone(): ShaclPropertySpec;
31
+ constructor(quads: Quad[], nodeId: NamedNode | BlankNode, config: Config);
32
+ merge(quads: Quad[]): ShaclPropertyTemplate;
33
+ clone(): ShaclPropertyTemplate;
34
34
  }
@@ -1,16 +1,13 @@
1
1
  import { BlankNode, NamedNode, Store } from 'n3';
2
2
  import { Term } from '@rdfjs/types';
3
3
  import { Config } from './config';
4
- import { ShaclPropertySpec } from './property-spec';
4
+ import { ShaclPropertyTemplate } from './property-template';
5
5
  export declare class ShaclProperty extends HTMLElement {
6
- spec: ShaclPropertySpec;
6
+ template: ShaclPropertyTemplate;
7
7
  addButton: HTMLElement;
8
- constructor(shaclSubject: BlankNode | NamedNode, config: Config, valueSubject?: NamedNode | BlankNode);
9
- createPropertyInstance(value?: Term): HTMLElement;
8
+ constructor(shaclSubject: BlankNode | NamedNode, config: Config, nodeId: NamedNode | BlankNode, valueSubject?: NamedNode | BlankNode);
9
+ addPropertyInstance(value?: Term): HTMLElement;
10
10
  updateControls(): void;
11
11
  toRDF(graph: Store, subject: NamedNode | BlankNode): void;
12
12
  }
13
- export declare class ShaclPropertyInstance extends HTMLElement {
14
- spec: ShaclPropertySpec;
15
- constructor(spec: ShaclPropertySpec, value?: Term, forceRemovable?: boolean);
16
- }
13
+ export declare function createPropertyInstance(template: ShaclPropertyTemplate, value?: Term, forceRemovable?: boolean): HTMLElement;
package/dist/util.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { Prefixes, Quad, Store } from 'n3';
2
2
  import { Term } from '@rdfjs/types';
3
- import { InputListEntry } from './inputs';
3
+ import { InputListEntry } from './editors';
4
+ import { Config } from './config';
4
5
  export declare function findObjectValueByPredicate(quads: Quad[], predicate: string, prefix?: string, language?: string | null): string;
5
6
  export declare function findObjectByPredicate(quads: Quad[], predicate: string, prefix?: string, language?: string | null): Term | undefined;
6
7
  export declare function focusFirstInputElement(context: HTMLElement): void;
7
8
  export declare function findLabel(quads: Quad[], language?: string | null): string;
8
9
  export declare function createInputListEntries(subjects: Term[], shapesGraph: Store, language?: string | null): InputListEntry[];
9
10
  export declare function removePrefixes(id: string, prefixes: Prefixes): string;
11
+ export declare function findInstancesOf(clazz: Term, config: Config): InputListEntry[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ulb-darmstadt/shacl-form",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "SHACL form generator",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
package/dist/inputs.d.ts DELETED
@@ -1,56 +0,0 @@
1
- import { NamedNode, Literal } from 'n3';
2
- import { Term } from '@rdfjs/types';
3
- import { ShaclPropertySpec } from './property-spec';
4
- export type Editor = HTMLElement & {
5
- value: string;
6
- };
7
- export declare abstract class InputBase extends HTMLElement {
8
- static idCtr: number;
9
- property: ShaclPropertySpec;
10
- editor: Editor;
11
- required: boolean;
12
- constructor(property: ShaclPropertySpec);
13
- setValue(value: Term): void;
14
- abstract createEditor(): Editor;
15
- abstract toRDFObject(): Literal | NamedNode | undefined;
16
- }
17
- export declare class InputDate extends InputBase {
18
- createEditor(): Editor;
19
- setValue(value: Term): void;
20
- toRDFObject(): Literal | undefined;
21
- }
22
- export declare class InputText extends InputBase {
23
- constructor(property: ShaclPropertySpec);
24
- createEditor(): Editor;
25
- toRDFObject(): Literal | NamedNode | undefined;
26
- }
27
- export declare class InputLangString extends InputText {
28
- language: string | undefined;
29
- langChooser: HTMLInputElement | HTMLSelectElement;
30
- constructor(property: ShaclPropertySpec);
31
- setValue(value: Term): void;
32
- toRDFObject(): Literal | NamedNode | undefined;
33
- createLangChooser(): HTMLInputElement | HTMLSelectElement;
34
- }
35
- export declare class InputBoolean extends InputBase {
36
- constructor(property: ShaclPropertySpec);
37
- createEditor(): Editor;
38
- setValue(value: Term): void;
39
- toRDFObject(): Literal | undefined;
40
- }
41
- export declare class InputNumber extends InputBase {
42
- constructor(property: ShaclPropertySpec);
43
- createEditor(): Editor;
44
- toRDFObject(): Literal | undefined;
45
- }
46
- export type InputListEntry = {
47
- value: Term;
48
- label?: string;
49
- };
50
- export declare class InputList extends InputBase {
51
- constructor(property: ShaclPropertySpec, listEntries?: InputListEntry[]);
52
- setListEntries(list: InputListEntry[]): void;
53
- createEditor(): Editor;
54
- toRDFObject(): Literal | NamedNode | undefined;
55
- }
56
- export declare function inputFactory(property: ShaclPropertySpec): InputBase;
package/dist/theme.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export interface Theme {
2
- createTextInput(): HTMLElement;
3
- }
4
- export declare class DefaultTheme implements Theme {
5
- createTextInput(): HTMLElement;
6
- }
7
- export declare class BootstrapTheme implements Theme {
8
- createTextInput(): HTMLElement;
9
- }