import { LitElement, PropertyValues, TemplateResult } from 'lit'; import type { DatasetCore } from '@rdfjs/types'; import type { FormState, ValidationResultState } from '@hydrofoil/shaperone-core/models/forms'; import { FocusNode } from '@hydrofoil/shaperone-core'; import type { RdfResource } from '@tpluscode/rdfine'; import type { AnyPointer, GraphPointer } from 'clownface'; import { NodeShape } from '@rdfine/shacl'; import { Renderer } from '@hydrofoil/shaperone-core/renderer.js'; import { ShaperoneEnvironment } from '@hydrofoil/shaperone-core/env.js'; import { State } from './store.js'; declare const resourceSymbol: unique symbol; declare const shapesSymbol: unique symbol; declare const notify: unique symbol; declare const shapes: unique symbol; export declare const id: (form: any) => symbol; declare const ShaperoneForm_base: import("@captaincodeman/rdx").Constructor & typeof LitElement; /** * A custom element which renders a form element using graph description in [SHACL format](http://datashapes.org/forms.html). * The underlying value is a graph represented using the [RDF/JS data model specification](https://rdf.js.org/data-model-spec/) * * ## Usage * * This example shows the element used with the default lit renderer * * ```typescript * import '@hypermedia-app/shaperone-form/shaperone-form.js' * import Environment from '@zazuko/env/Environment.js' * import { configure } from '@hydrofoil/shaperone-wc/configure.js' * import { html } from '@hypermedia-app/shaperone-form' * import alcaeus from 'alcaeus/Factory.js' * import parent from '@zazuko/env/web.js' * * const env = new Environment([alcaeus()], { parent }) * configure(env) * * const shapes = await env.hydra.loadResource('http://example.com/api/shape') * const resource = rdf.clownface().blankNode() * * const formTemplate = html`` * ``` * * The above snippet assumes that shapes get loaded from a remote resource and the form value is initialized with a * blank node without any properties. * * Such setup will render a very basic and unstyled form using native browser input elements and no specific layout. * Check the main documentation page for instructions on customizing the form's rendering. */ export declare class ShaperoneForm extends ShaperoneForm_base { private [resourceSymbol]?; private [shapesSymbol]?; private [notify]; static get styles(): import("lit").CSSResult[]; /** * Gets or sets the renderer implementation */ renderer: Renderer; private [shapes]; /** * Gets the RDF/JS environment * * @readonly */ get env(): ShaperoneEnvironment; /** * Gets the state of the DASH editors model * * @readonly */ editors: State['editors']; /** * Gets the state of the editor components * * @readonly */ components: State['components']; /** * Gets the state of the renderer * * @readonly */ rendererOptions: State['renderer']; /** * Disables the ability to change object editors. Only the one with [highest score](http://datashapes.org/forms.html#score) will be rendered * * @attr no-editor-switches */ noEditorSwitches: boolean; constructor(); connectedCallback(): Promise; disconnectedCallback(): void; /** * Gets the internal state of the form element */ state: FormState; protected updated(_changedProperties: PropertyValues): void; /** * Gets or sets the resource graph as graph pointer */ get resource(): FocusNode | undefined; set resource(rootPointer: FocusNode | undefined); /** * Gets the resource as a [rdfine](https://npm.im/@tpluscode/rdfine) object */ get value(): RdfResource | null; /** * Gets a value indicating if there are any `sh:Violation` violation results */ get isValid(): boolean; /** * Get all validation results found in the {@see validationReport} graph */ get validationResults(): ValidationResultState[]; /** * Gets a graph pointer to the latest [SHACL Validation Report](https://www.w3.org/TR/shacl/#validation-report) */ get validationReport(): GraphPointer | undefined; /** * Gets or sets the shapes graph */ get shapes(): AnyPointer | DatasetCore | undefined; set shapes(shapesGraph: AnyPointer | DatasetCore | undefined); render(): TemplateResult; /** * Triggers validation of the current resource against the shapes graph */ validate(): void; /** * @private */ mapState(state: State): { state: FormState | undefined; [resourceSymbol]: FocusNode | undefined; [shapes]: NodeShape>[]; rendererOptions: import("./renderer/model.js").RendererState; editors: import("@hydrofoil/shaperone-core/models/editors/index.js").EditorsState; components: import("@hydrofoil/shaperone-core/models/components/index.js").ComponentsState; }; } export {}; //# sourceMappingURL=ShaperoneForm.d.ts.map