Socket
Socket
Sign inDemoInstall

@json-layout/vocabulary

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@json-layout/vocabulary - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

src/components/compile-types.js

10

package.json
{
"name": "@json-layout/vocabulary",
"version": "0.14.0",
"version": "0.15.0",
"description": "Main JSON Layout vocabulary as JSON schemas and Typescript types. Also contains some small utility functions to validate and normalize annotations.",

@@ -20,7 +20,7 @@ "type": "module",

"scripts": {
"test:single": "node --test --test-only test/*.spec.js",
"test:only": "node --test --test-only test/*.spec.js",
"test": "node --test test/*.spec.js",
"build": "run-s clean build:schemas build:tsc",
"build": "run-s clean build:types build:tsc",
"clean": "rm -rf ./types && rm -f src/*/types.ts && rm -f src/*/validate.js",
"build:schemas": "node scripts/compile-schemas.js",
"build:types": "node scripts/compile-types.js",
"build:tsc": "tsc -p tsconfig.build.json",

@@ -55,4 +55,4 @@ "lint": "eslint . --fix",

"ajv": "^8.12.0",
"json-schema-to-typescript": "^13.1.1"
"json-schema-to-typescript": "^14.0.0"
}
}
/** @typedef {import("./types.js").SchemaFragment} SchemaFragment */
/** @typedef {import("./types.js").ComponentInfo} ComponentInfo */
export * from './layout-keyword/index.js'
export * from './normalized-layout/index.js'
export * from './components/index.js'
export { normalizeLayoutFragment, getSchemaFragmentType } from './normalize.js'

@@ -1,3 +0,3 @@

import validate from './validate.js'
import schema from './schema.js'
import {ajv} from '../validate.js'

@@ -8,2 +8,4 @@ /**

* @typedef {import('./types.js').PartialChildren} PartialChildren
* @typedef {import('./types.js').PartialChild} PartialChild
* @typedef {import('./types.js').PartialChildComposite} PartialChildComposite
* @typedef {import('./types.js').PartialSwitch} PartialSwitch

@@ -21,3 +23,3 @@ * @typedef {import('./types.js').PartialCompObject} PartialCompObject

export const /** @type {ValidateLayoutKeyword} */ validateLayoutKeyword = /** @type {any} */ (validate)
export const /** @type {ValidateLayoutKeyword} */ validateLayoutKeyword = /** @type {any} */ (ajv.getSchema(schema.$id))

@@ -41,2 +43,7 @@ export const layoutKeywordSchema = /** @type {any} */ (schema)

/** @type {(partialChild: PartialChild) => partialChild is PartialChildComposite} */
export function isPartialChildComposite (partialChild) {
return typeof partialChild !== 'string' && "children" in partialChild
}
/** @type {(layoutKeyword: LayoutKeyword) => layoutKeyword is PartialCompObject} */

@@ -43,0 +50,0 @@ export function isPartialCompObject (layoutKeyword) {

@@ -5,21 +5,23 @@

"$id": "https://json-layout.github.io/layout-keyword",
"title": "layout keyword",
"errorMessage": {
"anyOf": "layout keyword must be a string with a valid component name, or a more complete object definition, or an array of children, or a switch structure"
},
"anyOf": [
{
"$ref": "#/$defs/comp-name"
"$defs": {
"layout-keyword": {
"title": "layout keyword",
"errorMessage": {
"anyOf": "layout keyword must be a string with a valid component name, or a more complete object definition, or an array of children, or a switch structure"
},
"anyOf": [
{
"$ref": "#/$defs/comp-name"
},
{
"$ref": "#/$defs/partial-children"
},
{
"$ref": "#/$defs/partial-comp-object"
},
{
"$ref": "#/$defs/partial-switch"
}
]
},
{
"$ref": "#/$defs/partial-children"
},
{
"$ref": "#/$defs/partial-comp-object"
},
{
"$ref": "#/$defs/partial-switch"
}
],
"$defs": {
"partial-switch": {

@@ -152,36 +154,10 @@ "type": "object",

"title": "component name",
"type": "string",
"errorMessage": {
"enum": "component name is unknown"
},
"enum": [
"none",
"text-field",
"number-field",
"textarea",
"markdown",
"checkbox",
"switch",
"slider",
"date-picker",
"date-time-picker",
"time-picker",
"color-picker",
"combobox",
"number-combobox",
"section",
"list",
"select",
"autocomplete",
"tabs",
"vertical-tabs",
"expansion-panels",
"stepper",
"one-of-select",
"file-input"
]
"type": "string"
},
"partial-child": {
"partial-child-ref": {
"type": "object",
"unevaluatedProperties": false,
"required": [
"key"
],
"additionalProperties": false,
"properties": {

@@ -197,8 +173,44 @@ "key": {

}
},
"allOf": [
}
},
"partial-child-composite": {
"type": "object",
"required": [
"children"
],
"properties": {
"comp": {
"type": "string"
},
"title": {
"type": [
"string",
"null"
]
},
"subtitle": {
"type": [
"string",
"null"
]
},
"children": {
"$ref": "#/$defs/partial-children"
},
"cols": {
"$ref": "#/$defs/partial-cols"
}
}
},
"partial-child": {
"anyOf": [
{
"$ref": "#/$defs/partial-comp-object"
"type": "string"
},
{}
{
"$ref": "#/$defs/partial-child-ref"
},
{
"$ref": "#/$defs/partial-child-composite"
}
]

@@ -209,10 +221,3 @@ },

"items": {
"oneOf": [
{
"type": "string"
},
{
"$ref": "#/$defs/partial-child"
}
]
"$ref": "#/$defs/partial-child"
}

@@ -219,0 +224,0 @@ },

{
"$id": "https://json-layout.github.io/layout-keyword",
"title": "layout keyword",
"errorMessage": {
"anyOf": "layout keyword must be a string with a valid component name, or a more complete object definition, or an array of children, or a switch structure"
},
"anyOf": [
{"$ref": "#/$defs/comp-name"},
{"$ref": "#/$defs/partial-children"},
{"$ref": "#/$defs/partial-comp-object"},
{"$ref": "#/$defs/partial-switch"}
],
"$defs": {
"layout-keyword": {
"title": "layout keyword",
"errorMessage": {
"anyOf": "layout keyword must be a string with a valid component name, or a more complete object definition, or an array of children, or a switch structure"
},
"anyOf": [
{"$ref": "#/$defs/comp-name"},
{"$ref": "#/$defs/partial-children"},
{"$ref": "#/$defs/partial-comp-object"},
{"$ref": "#/$defs/partial-switch"}
]
},
"partial-switch": {

@@ -64,43 +66,29 @@ "type": "object",

"title": "component name",
"type": "string",
"errorMessage": {
"enum": "component name is unknown"
},
"enum": [
"none",
"text-field",
"number-field",
"textarea",
"markdown",
"checkbox",
"switch",
"slider",
"date-picker",
"date-time-picker",
"time-picker",
"color-picker",
"combobox",
"number-combobox",
"section",
"list",
"select",
"autocomplete",
"tabs",
"vertical-tabs",
"expansion-panels",
"stepper",
"one-of-select",
"file-input"
]
"type": "string"
},
"partial-child": {
"partial-child-ref": {
"type": "object",
"unevaluatedProperties": false,
"required": ["key"],
"additionalProperties": false,
"properties": {
"key": {"type": ["string", "integer"]},
"cols": {"$ref": "#/$defs/partial-cols"}
},
"allOf": [
{"$ref": "#/$defs/partial-comp-object"},
{}
}
},
"partial-child-composite": {
"type": "object",
"required": ["children"],
"properties": {
"comp": {"type": "string"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/partial-children"},
"cols": {"$ref": "#/$defs/partial-cols"}
}
},
"partial-child": {
"anyOf": [
{"type": "string"},
{"$ref": "#/$defs/partial-child-ref"},
{"$ref": "#/$defs/partial-child-composite"}
]

@@ -111,6 +99,3 @@ },

"items": {
"oneOf": [
{"type": "string"},
{"$ref": "#/$defs/partial-child"}
]
"$ref": "#/$defs/partial-child"
}

@@ -117,0 +102,0 @@ },

@@ -0,34 +1,40 @@

/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "layout-keyword".
*/
export type LayoutKeyword = ComponentName | PartialChildren | PartialCompObject | PartialSwitch;
export type ComponentName =
| "none"
| "text-field"
| "number-field"
| "textarea"
| "markdown"
| "checkbox"
| "switch"
| "slider"
| "date-picker"
| "date-time-picker"
| "time-picker"
| "color-picker"
| "combobox"
| "number-combobox"
| "section"
| "list"
| "select"
| "autocomplete"
| "tabs"
| "vertical-tabs"
| "expansion-panels"
| "stepper"
| "one-of-select"
| "file-input";
export type PartialChild = PartialChild1 & {
key?: string | number;
cols?: PartialCols;
[k: string]: unknown;
};
export type PartialChild1 = PartialCompObject & unknown;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "comp-name".
*/
export type ComponentName = string;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child".
*/
export type PartialChild = string | PartialChildRef | PartialChildComposite;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols".
*/
export type PartialCols = PartialColsNumber | PartialColsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols-number".
*/
export type PartialColsNumber = number;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-children".
*/
export type PartialChildren = PartialChild[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-expression".
*/
export type PartialExpression = string | PartialExpressionObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-select-item".
*/
export type PartialSelectItem =

@@ -42,3 +48,11 @@ | string

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items".
*/
export type PartialGetItems = string | PartialGetItemsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items-obj".
*/
export type PartialGetItemsObj = {

@@ -58,11 +72,50 @@ itemTitle?: PartialExpression;

);
export type PartialCols = PartialColsNumber | PartialColsObj;
export type PartialColsNumber = number;
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot".
*/
export type PartialSlot = string | PartialSlotText | PartialSlotMarkdown | PartialSlotName;
export type PartialChildren = (string | PartialChild)[];
export interface HttpsJsonLayoutGithubIoLayoutKeyword {
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child-ref".
*/
export interface PartialChildRef {
key: string | number;
cols?: PartialCols;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols-obj".
*/
export interface PartialColsObj {
xs?: PartialColsNumber;
sm?: PartialColsNumber;
md?: PartialColsNumber;
lg?: PartialColsNumber;
xl?: PartialColsNumber;
xxl?: PartialColsNumber;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child-composite".
*/
export interface PartialChildComposite {
comp?: string;
title?: string | null;
subtitle?: string | null;
children: PartialChildren;
cols?: PartialCols;
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-comp-object".
*/
export interface PartialCompObject {

@@ -105,2 +158,6 @@ comp?: ComponentName;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-expression-obj".
*/
export interface PartialExpressionObj {

@@ -111,2 +168,6 @@ type?: "js-fn" | "js-eval" | "js-tpl";

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items-fetch".
*/
export interface PartialGetItemsFetch {

@@ -116,21 +177,29 @@ url: PartialExpression;

}
export interface PartialColsObj {
xs?: PartialColsNumber;
sm?: PartialColsNumber;
md?: PartialColsNumber;
lg?: PartialColsNumber;
xl?: PartialColsNumber;
xxl?: PartialColsNumber;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-text".
*/
export interface PartialSlotText {
text: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-markdown".
*/
export interface PartialSlotMarkdown {
markdown: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-name".
*/
export interface PartialSlotName {
name: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-switch".
*/
export interface PartialSwitch {
switch: PartialCompObject[];
}

@@ -1,3 +0,4 @@

import { validateLayoutKeyword, isComponentName, isPartialCompObject, isPartialChildren, isPartialSwitch, isPartialGetItemsExpr, isPartialGetItemsObj, isPartialSlotMarkdown, isPartialGetItemsFetch } from './layout-keyword/index.js'
import { validateNormalizedLayout, compositeCompNames } from './normalized-layout/index.js'
import { validateLayoutKeyword, isComponentName, isPartialCompObject, isPartialChildren, isPartialSwitch, isPartialGetItemsExpr, isPartialGetItemsObj, isPartialSlotMarkdown, isPartialGetItemsFetch, isPartialChildComposite } from './layout-keyword/index.js'
import { validateNormalizedLayout } from './normalized-layout/index.js'
import { getComponentValidate } from './validate.js'

@@ -7,3 +8,3 @@ /**

* @typedef {import('./index.js').Children} Children
* @typedef {import('./index.js').CompObject} CompObject
* @typedef {import('./index.js').BaseCompObject} BaseCompObject
* @typedef {import('./index.js').Expression} Expression

@@ -59,3 +60,3 @@ * @typedef {import('./index.js').NormalizedLayout} NormalizedLayout

const matchingDefaultChild = defaultChildren.find(c => c.key === partialChild)
if (!matchingDefaultChild) throw new Error(`child unknown ${partialChild}`)
if (!matchingDefaultChild) throw new Error(`unknown child "${partialChild}"`)
return matchingDefaultChild

@@ -67,9 +68,9 @@ } else {

const matchingDefaultChild = defaultChildren.find(c => c.key === partialChild.key)
if (!matchingDefaultChild) throw new Error(`child unknown ${partialChild.key}`)
if (!matchingDefaultChild) throw new Error(`unknown child "${partialChild.key}"`)
return /** @type {Child} */ (partialChild)
} else { // a composite component definition, not directly related to a known child
const child = partialChild
if (partialChild.children) {
if (!partialChild.comp) child.comp = 'section'
child.children = getChildren(defaultChildren, partialChild.children)
if (isPartialChildComposite(child)) {
if (!child.comp) child.comp = 'section'
child.children = getChildren(defaultChildren, child.children)
}

@@ -238,10 +239,9 @@ if (!('key' in partialChild)) {

* @param {string} schemaPath
* @param {Record<string, import('./types.js').ComponentInfo>} components
* @param {(text: string) => string} markdown
* @param {string[]} optionsKeys
* @param {'oneOf'} [arrayChild]
* @returns {{normalized: CompObject, errors: string[]}}
* @returns {BaseCompObject}
*/
function getCompObject (layoutKeyword, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild) {
/** @type {string[]} */
const errors = []
function getCompObject (layoutKeyword, schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild) {
const key = schemaPath.slice(schemaPath.lastIndexOf('/') + 1)

@@ -251,4 +251,4 @@

if ('const' in schemaFragment) return { normalized: { comp: 'none' }, errors }
if (!type) return { normalized: { comp: 'none' }, errors }
if ('const' in schemaFragment) return { comp: 'none' }
if (!type) return { comp: 'none' }

@@ -258,3 +258,3 @@ const partial = getPartialCompObject(layoutKeyword)

if (type === 'array' && !schemaFragment.items && partial.comp !== 'file-input') {
return { normalized: { comp: 'none' }, errors }
return { comp: 'none' }
}

@@ -264,15 +264,13 @@

if (!partial.comp) {
try {
partial.comp = getDefaultComp(partial, schemaFragment, arrayChild)
} catch (/** @type {any} */err) {
errors.push(err.message)
partial.comp = 'none'
}
partial.comp = getDefaultComp(partial, schemaFragment, arrayChild)
}
if (partial.comp === 'none') return { normalized: { comp: 'none' }, errors }
const component = components[partial.comp]
if (!component) {
throw new Error(`unknown component "${partial.comp}"`)
}
if (partial.comp === 'none') return { comp: 'none' }
if (nullable) partial.nullable = nullable
// @ts-ignore
if (compositeCompNames.includes(partial.comp)) {
if (component.composite) {
if (!('title' in partial)) partial.title = schemaFragment.title ?? null

@@ -288,3 +286,3 @@ partial.children = getChildren(getDefaultChildren(schemaFragment), partial.children)

if (['select', 'autocomplete', 'combobox'].includes(partial.comp) && !partial.items) {
if (component.itemsBased && !partial.items) {
let items

@@ -305,3 +303,3 @@ if (type === 'array') {

if (['select', 'autocomplete', 'combobox', 'number-combobox', 'file-input'].includes(partial.comp)) {
if (component.multipleCompat) {
if (type === 'array' || partial.separator) {

@@ -413,3 +411,10 @@ partial.multiple = true

return { normalized: /** @type {CompObject} */(partial), errors }
const validateComponent = getComponentValidate(component)
if (!validateComponent(partial)) {
const error = new Error(`component "${component.name}" validation errors`)
error.cause = lighterValidationErrors(validateComponent.errors)
throw error
}
return /** @type {BaseCompObject} */(partial)
}

@@ -421,12 +426,12 @@

* @param {string} schemaPath
* @param {Record<string, import('./types.js').ComponentInfo>} components
* @param {(text: string) => string} markdown
* @param {string[]} optionsKeys
* @param {'oneOf'} [arrayChild]
* @returns {{normalized: NormalizedLayout, errors: string[]}}
* @returns {NormalizedLayout}}
*/
function getNormalizedLayout (layoutKeyword, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild) {
function getNormalizedLayout (layoutKeyword, schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild) {
if (isPartialSwitch(layoutKeyword)) {
/** @type {CompObject[]} */
/** @type {BaseCompObject[]} */
const normalizedSwitchCases = []
const errors = []
const switchCases = [...layoutKeyword.switch]

@@ -438,9 +443,8 @@ if (!switchCases.find(s => !s.if)) {

const switchCase = switchCases[i]
const compObjectResult = getCompObject(switchCase, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild)
normalizedSwitchCases.push(compObjectResult.normalized)
for (const error of compObjectResult.errors) errors.push(`switch ${i} - ${error}`)
const compObjectResult = getCompObject(switchCase, schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild)
normalizedSwitchCases.push(compObjectResult)
}
return { normalized: { switch: normalizedSwitchCases }, errors: [] }
return { switch: normalizedSwitchCases }
} else {
return getCompObject(layoutKeyword, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild)
return getCompObject(layoutKeyword, schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild)
}

@@ -462,6 +466,7 @@ }

/**
* @param {import('ajv').ErrorObject[]} errors
* @param {import('ajv').ErrorObject[] | null | undefined} errors
* @returns {string[]}
*/
function lighterValidationErrors (errors) {
if (!errors) return []
const compositeErrors = errors.filter(e => matchValidationError(e, (e) => e.keyword === 'anyOf' || e.keyword === 'oneOf'))

@@ -475,3 +480,9 @@ // in case of a anyOf/oneOf error there are some subschemas errors that mostly prevent readability

}
return errors.map(e => e.message ?? e.keyword)
const messages = []
for (const error of errors) {
let message = error.message ?? error.keyword
if (error.params) message += ' ' + JSON.stringify(error.params)
messages.push(message)
}
return messages
}

@@ -484,8 +495,9 @@

* @param {string} schemaPath
* @param {Record<string, import('./types.js').ComponentInfo>} components
* @param {(text: string) => string} markdown
* @param {string[]} [optionsKeys]
* @param {'oneOf'} [arrayChild]
* @returns {{layout: NormalizedLayout, errors: string[]}}
* @returns {NormalizedLayout}
*/
export function normalizeLayoutFragment (schemaFragment, schemaPath, markdown = (src) => src, optionsKeys, arrayChild) {
function normalizeValidLayoutFragment (schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild) {
optionsKeys = optionsKeys ? optionsKeys.concat(defaultOptionsKeys) : defaultOptionsKeys

@@ -499,18 +511,45 @@ let layoutKeyword

if (!validateLayoutKeyword(layoutKeyword)) {
console.error(`layout keyword validation errors at path ${schemaPath}`, layoutKeyword, validateLayoutKeyword.errors)
return {
layout: getNormalizedLayout({}, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild).normalized,
errors: lighterValidationErrors(validateLayoutKeyword.errors)
}
const error = new Error('layout keyword validation errors at path')
error.cause = lighterValidationErrors(validateLayoutKeyword.errors)
throw error
}
const normalizedLayout = getNormalizedLayout(layoutKeyword, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild)
if (!validateNormalizedLayout(normalizedLayout.normalized)) {
console.error(`normalized layout validation errors at path ${schemaPath}`, normalizedLayout, validateNormalizedLayout.errors)
return {
layout: getNormalizedLayout({}, schemaFragment, schemaPath, markdown, optionsKeys, arrayChild).normalized,
errors: lighterValidationErrors(validateNormalizedLayout.errors)
const normalizedLayout = getNormalizedLayout(layoutKeyword, schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild)
if (!validateNormalizedLayout(normalizedLayout)) {
const error = new Error('normalized layout validation errors at path')
error.cause = lighterValidationErrors(validateNormalizedLayout.errors)
throw error
}
return normalizedLayout
}
/**
* @param {SchemaFragment} schemaFragment
* @param {string} schemaPath
* @param {Record<string, import('./types.js').ComponentInfo>} components
* @param {(text: string) => string} markdown
* @param {string[]} [optionsKeys]
* @param {'oneOf'} [arrayChild]
* @returns {{layout: NormalizedLayout, errors: string[]}}
*/
export function normalizeLayoutFragment (schemaFragment, schemaPath, components, markdown = (src) => src, optionsKeys, arrayChild) {
/** @type {string[]} */
const errors = []
try {
const layout = normalizeValidLayoutFragment(schemaFragment, schemaPath, components, markdown, optionsKeys, arrayChild)
return { layout, errors }
} catch (/** @type {any} */err) {
try {
errors.push(err.message)
if (err.cause && Array.isArray(err.cause)) errors.push(...err.cause)
errors.push('failed to normalize layout, use default component')
const layout = normalizeValidLayoutFragment({ ...schemaFragment, layout: {} }, schemaPath, components, markdown, optionsKeys, arrayChild)
return { layout, errors }
} catch (/** @type {any} */err) {
errors.push(err.message)
if (err.cause && Array.isArray(err.cause)) errors.push(...err.cause)
errors.push('failed to produce default layout, hide this fragment')
return { layout: { comp: 'none' }, errors }
}
// throw new Error(`invalid layout at path ${schemaPath}`, { cause: validateNormalizedLayout.errors })
}
return { layout: normalizedLayout.normalized, errors: [] }
}

@@ -1,3 +0,3 @@

import validate from './validate.js'
import schema from './schema.js'
import {ajv} from '../validate.js'

@@ -7,33 +7,13 @@ /**

* @typedef {import('./types.js').SwitchStruct} SwitchStruct
* @typedef {import('./types.js').CompObject} CompObject
* @typedef {import('./types.js').Section} Section
* @typedef {import('./types.js').GetItems} GetItems
* @typedef {import('./types.js').Expression} Expression
* @typedef {import('./types.js').Select} Select
* @typedef {import('./types.js').Autocomplete} Autocomplete
* @typedef {import('./types.js').BaseCompObject} BaseCompObject
* @typedef {import('./types.js').SelectItem} SelectItem
* @typedef {import('./types.js').SelectItems} SelectItems
* @typedef {import('./types.js').GetItemsFetch} GetItemsFetch
* @typedef {import('./types.js').TextField} TextField
* @typedef {import('./types.js').Textarea} Textarea
* @typedef {import('./types.js').NumberField} NumberField
* @typedef {import('./types.js').Slider} Slider
* @typedef {import('./types.js').Checkbox} Checkbox
* @typedef {import('./types.js').Switch} Switch
* @typedef {import('./types.js').DatePicker} DatePicker
* @typedef {import('./types.js').TimePicker} TimePicker
* @typedef {import('./types.js').DateTimePicker} DateTimePicker
* @typedef {import('./types.js').ColorPicker} ColorPicker
* @typedef {import('./types.js').OneOfSelect} OneOfSelect
* @typedef {import('./types.js').Child} Child
* @typedef {import('./types.js').Children} Children
* @typedef {import('./types.js').CompositeCompObject} CompositeCompObject
* @typedef {import('./types.js').Tabs} Tabs
* @typedef {import('./types.js').VerticalTabs} VerticalTabs
* @typedef {import('./types.js').ExpansionPanels} ExpansionPanels
* @typedef {import('./types.js').Stepper} Stepper
* @typedef {import('./types.js').List} List
* @typedef {import('./types.js').Combobox} Combobox
* @typedef {import('./types.js').Markdown} Markdown
* @typedef {import('./types.js').FileInput} FileInput
* @typedef {import('./types.js').ItemsBasedCompObject} ItemsBasedCompObject
* @typedef {import('./types.js').FocusableCompObject} FocusableCompObject
* @typedef {import('./types.js').GetItems} GetItems
* @typedef {import('./types.js').Expression} Expression
* @typedef {import('./types.js').Cols} Cols

@@ -47,3 +27,3 @@ * @typedef {import('./types.js').ColsObj} ColsObj

export const /** @type {ValidateNormalizedLayout} */ validateNormalizedLayout = /** @type {any} */ (validate)
export const /** @type {ValidateNormalizedLayout} */ validateNormalizedLayout = /** @type {any} */ (ajv.getSchema(schema.$id))

@@ -57,3 +37,3 @@ export const normalizedLayoutSchema = /** @type {any} */ (schema)

/** @type {(layout: NormalizedLayout) => layout is CompObject} */
/** @type {(layout: NormalizedLayout) => layout is BaseCompObject} */
export function isCompObject (layout) {

@@ -65,46 +45,20 @@ return !isSwitchStruct(layout)

export function childIsCompObject (child) {
return !!child.comp
return 'comp' in child
}
/** @type {(layout: CompObject) => layout is Section} */
export function isSectionLayout (layout) {
return layout.comp === 'section'
/** @type {(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>) => layout is CompositeCompObject} */
export function isCompositeLayout (layout, components) {
return !!components[layout.comp]?.composite
}
export const compositeCompNames = ['section', 'tabs', 'vertical-tabs', 'expansion-panels', 'stepper']
// these components can received keybord inputs and emit blur events
// they will be debounced when validateOn=blur is applicable and data binding will be updated on blur
export const editableCompNames = ['text-field', 'number-field', 'textarea', 'markdown']
/** @type {(layout: CompObject) => layout is CompositeCompObject} */
export function isCompositeLayout (layout) {
return compositeCompNames.includes(layout.comp)
/** @type {(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>) => layout is FocusableCompObject} */
export function isFocusableLayout (layout, components) {
return !!components[layout.comp]?.focusable
}
/** @type {(layout: CompObject) => layout is TextField} */
export function isTextFieldLayout (layout) {
return layout.comp === 'text-field'
/** @type {(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>) => layout is ItemsBasedCompObject} */
export function isItemsLayout (layout, components) {
return !!components[layout.comp]?.itemsBased
}
/** @type {(layout: CompObject) => layout is Select} */
export function isSelectLayout (layout) {
return layout.comp === 'select'
}
/** @type {(layout: CompObject) => layout is FileInput} */
export function isFileLayout (layout) {
return layout.comp === 'file-input'
}
/** @type {(layout: CompObject) => layout is CompObject & {autofocus: boolean}} */
export function isFocusableLayout (layout) {
return ['text-field', 'number-field', 'textarea', 'select', 'combobox', 'number-combobox', 'autocomplete', 'markdown'].includes(layout.comp)
}
/** @type {(layout: CompObject) => layout is Select | Combobox | Autocomplete} */
export function isItemsLayout (layout) {
return layout.comp === 'select' || layout.comp === 'combobox' || layout.comp === 'autocomplete'
}
/** @type {(getItems: GetItems) => getItems is Expression} */

@@ -111,0 +65,0 @@ export function isGetItemsExpression (getItems) {

@@ -5,12 +5,16 @@

"$id": "https://json-layout.github.io/normalized-layout-keyword",
"title": "normalized layout",
"oneOf": [
{
"$ref": "#/$defs/switch-struct"
"$defs": {
"normalized-layout": {
"title": "normalized layout",
"type": "object",
"unevaluatedProperties": false,
"oneOf": [
{
"$ref": "#/$defs/switch-struct"
},
{
"$ref": "#/$defs/base-comp-object"
}
]
},
{
"$ref": "#/$defs/comp-object"
}
],
"$defs": {
"switch-struct": {

@@ -26,3 +30,3 @@ "type": "object",

"items": {
"$ref": "#/$defs/comp-object"
"$ref": "#/$defs/base-comp-object"
}

@@ -32,3 +36,3 @@ }

},
"comp-object": {
"base-comp-object": {
"type": "object",

@@ -38,239 +42,230 @@ "required": [

],
"unevaluatedProperties": false,
"properties": {
"comp": {
"type": "string"
},
"if": {
"$ref": "#/$defs/expression"
},
"options": {
"$ref": "#/$defs/state-node-options-base"
},
"getOptions": {
"$ref": "#/$defs/expression"
},
"defaultData": {},
"getDefaultData": {
"$ref": "#/$defs/expression"
},
"constData": {},
"getConstData": {
"$ref": "#/$defs/expression"
},
"transformData": {
"$ref": "#/$defs/expression"
},
"nullable": {
"type": "boolean"
},
"help": {
"type": "string"
},
"cols": {
"$ref": "#/$defs/cols-obj"
},
"props": {
"$ref": "#/$defs/state-node-props-lib"
},
"getProps": {
"$ref": "#/$defs/expression"
},
"slots": {
"type": "object",
"allOf": [
{
"$ref": "#/$defs/state-node-slots-lib"
},
{
"properties": {
"before": {
"$ref": "#/$defs/slot"
},
"after": {
"$ref": "#/$defs/slot"
},
"component": {
"$ref": "#/$defs/slot"
}
}
}
]
}
}
},
"composite-comp-object": {
"allOf": [
{
"$ref": "#/$defs/base-comp-object"
},
{
"type": "object",
"required": [
"children",
"comp"
],
"properties": {
"if": {
"$ref": "#/$defs/expression"
"comp": {
"type": "string"
},
"options": {
"$ref": "#/$defs/state-node-options-base"
"title": {
"type": [
"string",
"null"
]
},
"getOptions": {
"$ref": "#/$defs/expression"
"subtitle": {
"type": [
"string",
"null"
]
},
"defaultData": {},
"getDefaultData": {
"$ref": "#/$defs/expression"
"children": {
"$ref": "#/$defs/children"
}
}
}
]
},
"simple-comp-object": {
"allOf": [
{
"$ref": "#/$defs/base-comp-object"
},
{
"type": "object",
"required": [
"comp"
],
"properties": {
"comp": {
"type": "string"
},
"constData": {},
"getConstData": {
"$ref": "#/$defs/expression"
"label": {
"type": "string"
}
}
}
]
},
"focusable-comp-object": {
"allOf": [
{
"$ref": "#/$defs/base-comp-object"
},
{
"type": "object",
"required": [
"comp"
],
"properties": {
"comp": {
"type": "string"
},
"transformData": {
"$ref": "#/$defs/expression"
"label": {
"type": "string"
},
"nullable": {
"autofocus": {
"type": "boolean"
},
"help": {
"type": "string"
},
"cols": {
"$ref": "#/$defs/cols-obj"
},
"props": {
"$ref": "#/$defs/state-node-props-lib"
},
"getProps": {
"$ref": "#/$defs/expression"
},
"slots": {
"type": "object",
"allOf": [
{
"$ref": "#/$defs/state-node-slots-lib"
},
{
"properties": {
"before": {
"$ref": "#/$defs/slot"
},
"after": {
"$ref": "#/$defs/slot"
},
"component": {
"$ref": "#/$defs/slot"
}
}
}
]
}
}
}
]
},
"items-based-comp-object": {
"allOf": [
{
"$ref": "#/$defs/base-comp-object"
},
{
"discriminator": {
"propertyName": "comp"
},
"oneOf": [
{
"$ref": "#/$defs/none"
"type": "object",
"required": [
"comp"
],
"properties": {
"comp": {
"type": "string"
},
{
"$ref": "#/$defs/list"
"items": {
"$ref": "#/$defs/select-items"
},
{
"$ref": "#/$defs/text-field"
"getItems": {
"$ref": "#/$defs/get-items"
},
{
"$ref": "#/$defs/number-field"
"multiple": {
"type": "boolean"
},
{
"$ref": "#/$defs/textarea"
},
{
"$ref": "#/$defs/markdown"
},
{
"$ref": "#/$defs/checkbox"
},
{
"$ref": "#/$defs/switch"
},
{
"$ref": "#/$defs/slider"
},
{
"$ref": "#/$defs/date-picker"
},
{
"$ref": "#/$defs/date-time-picker"
},
{
"$ref": "#/$defs/time-picker"
},
{
"$ref": "#/$defs/color-picker"
},
{
"$ref": "#/$defs/combobox"
},
{
"$ref": "#/$defs/number-combobox"
},
{
"$ref": "#/$defs/select"
},
{
"$ref": "#/$defs/autocomplete"
},
{
"$ref": "#/$defs/one-of-select"
},
{
"$ref": "#/$defs/section"
},
{
"$ref": "#/$defs/tabs"
},
{
"$ref": "#/$defs/vertical-tabs"
},
{
"$ref": "#/$defs/expansion-panels"
},
{
"$ref": "#/$defs/stepper"
},
{
"$ref": "#/$defs/file-input"
"separator": {
"type": "string"
}
]
}
}
]
},
"composite-comp-object": {
"type": "object",
"discriminator": {
"propertyName": "comp"
},
"oneOf": [
"multiple-compat-comp-object": {
"allOf": [
{
"$ref": "#/$defs/section"
"$ref": "#/$defs/base-comp-object"
},
{
"$ref": "#/$defs/tabs"
},
{
"$ref": "#/$defs/vertical-tabs"
},
{
"$ref": "#/$defs/expansion-panels"
"type": "object",
"required": [
"comp"
],
"properties": {
"comp": {
"type": "string"
},
"multiple": {
"type": "boolean"
}
}
}
]
},
"none": {
"child-ref": {
"type": "object",
"required": [
"comp"
"key"
],
"additionalProperties": false,
"properties": {
"comp": {
"const": "none"
}
}
},
"section": {
"type": "object",
"required": [
"comp",
"children"
],
"properties": {
"comp": {
"const": "section"
},
"title": {
"key": {
"type": [
"string",
"null"
"integer"
]
},
"subtitle": {
"type": [
"string",
"null"
]
},
"children": {
"$ref": "#/$defs/children"
"cols": {
"$ref": "#/$defs/cols-obj"
}
}
},
"tabs": {
"child-composite": {
"type": "object",
"required": [
"comp",
"key",
"children"
],
"properties": {
"comp": {
"const": "tabs"
},
"title": {
"key": {
"type": [
"string",
"null"
"integer"
]
},
"subtitle": {
"type": [
"string",
"null"
]
"cols": {
"$ref": "#/$defs/cols-obj"
},
"children": {
"$ref": "#/$defs/children"
}
}
},
"vertical-tabs": {
"type": "object",
"required": [
"comp",
"children"
],
"properties": {
"comp": {
"const": "vertical-tabs"
"type": "string"
},

@@ -294,77 +289,11 @@ "title": {

},
"expansion-panels": {
"type": "object",
"required": [
"comp",
"children"
],
"properties": {
"comp": {
"const": "expansion-panels"
},
"title": {
"type": [
"string",
"null"
]
},
"subtitle": {
"type": [
"string",
"null"
]
},
"children": {
"$ref": "#/$defs/children"
}
}
},
"stepper": {
"type": "object",
"required": [
"comp",
"children"
],
"properties": {
"comp": {
"const": "stepper"
},
"title": {
"type": [
"string",
"null"
]
},
"subtitle": {
"type": [
"string",
"null"
]
},
"children": {
"$ref": "#/$defs/children"
}
}
},
"child": {
"title": "Child",
"type": "object",
"unevaluatedProperties": false,
"required": [
"key"
],
"properties": {
"key": {
"type": [
"string",
"integer"
]
"oneOf": [
{
"$ref": "#/$defs/child-ref"
},
"cols": {
"$ref": "#/$defs/cols-obj"
}
},
"anyOf": [
{},
{
"$ref": "#/$defs/composite-comp-object"
"$ref": "#/$defs/child-composite"
}

@@ -379,443 +308,2 @@ ]

},
"list": {
"type": "object",
"required": [
"comp",
"listEditMode",
"listActions"
],
"properties": {
"comp": {
"const": "list"
},
"title": {
"type": "string"
},
"listEditMode": {
"type": "string",
"enum": [
"inline",
"inline-single",
"menu",
"dialog"
]
},
"listActions": {
"type": "array",
"items": {
"type": "string",
"enum": [
"add",
"edit",
"delete",
"sort",
"duplicate"
]
}
},
"itemTitle": {
"$ref": "#/$defs/expression"
},
"itemSubtitle": {
"$ref": "#/$defs/expression"
},
"messages": {
"type": "object",
"additionalProperties": false,
"properties": {
"addItem": {
"type": "string"
},
"delete": {
"type": "string"
},
"edit": {
"type": "string"
},
"duplicate": {
"type": "string"
},
"sort": {
"type": "string"
}
}
}
}
},
"text-field": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "text-field"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
}
}
},
"number-field": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "number-field"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
},
"step": {
"type": "number"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"textarea": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "textarea"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
}
}
},
"markdown": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "markdown"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
}
}
},
"checkbox": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "checkbox"
},
"label": {
"type": "string"
}
}
},
"switch": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "switch"
},
"label": {
"type": "string"
}
}
},
"slider": {
"type": "object",
"required": [
"comp",
"label",
"min",
"max"
],
"properties": {
"comp": {
"const": "slider"
},
"label": {
"type": "string"
},
"step": {
"type": "number"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"date-picker": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "date-picker"
},
"label": {
"type": "string"
},
"min": {
"type": "string",
"format": "date"
},
"max": {
"type": "string",
"format": "date"
},
"format": {
"type": "string",
"enum": [
"date",
"date-time"
],
"default": "date"
}
}
},
"date-time-picker": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "date-time-picker"
},
"label": {
"type": "string"
},
"min": {
"type": "string",
"format": "date-time"
},
"max": {
"type": "string",
"format": "date-time"
}
}
},
"time-picker": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "time-picker"
},
"label": {
"type": "string"
},
"min": {
"type": "string",
"format": "time"
},
"max": {
"type": "string",
"format": "time"
}
}
},
"color-picker": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "color-picker"
},
"label": {
"type": "string"
}
}
},
"combobox": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "combobox"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
},
"items": {
"$ref": "#/$defs/select-items"
},
"getItems": {
"$ref": "#/$defs/get-items"
},
"multiple": {
"type": "boolean"
},
"separator": {
"type": "string"
}
}
},
"number-combobox": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "number-combobox"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
},
"items": {
"$ref": "#/$defs/select-items"
},
"getItems": {
"$ref": "#/$defs/get-items"
},
"multiple": {
"type": "boolean"
},
"step": {
"type": "number"
},
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"select": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "select"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
},
"items": {
"$ref": "#/$defs/select-items"
},
"getItems": {
"$ref": "#/$defs/get-items"
},
"multiple": {
"type": "boolean"
},
"separator": {
"type": "string"
}
}
},
"autocomplete": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "autocomplete"
},
"label": {
"type": "string"
},
"autofocus": {
"type": "boolean"
},
"items": {
"$ref": "#/$defs/select-items"
},
"getItems": {
"$ref": "#/$defs/get-items"
},
"multiple": {
"type": "boolean"
},
"separator": {
"type": "string"
}
}
},
"file-input": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "file-input"
},
"label": {
"type": "string"
},
"accept": {
"type": "string"
},
"multiple": {
"type": "boolean"
}
}
},
"select-items": {

@@ -907,17 +395,2 @@ "type": "array",

},
"one-of-select": {
"type": "object",
"required": [
"comp",
"label"
],
"properties": {
"comp": {
"const": "one-of-select"
},
"label": {
"type": "string"
}
}
},
"expression": {

@@ -924,0 +397,0 @@ "type": "object",

{
"$id": "https://json-layout.github.io/normalized-layout-keyword",
"title": "normalized layout",
"oneOf": [
{"$ref": "#/$defs/switch-struct"},
{"$ref": "#/$defs/comp-object"}
],
"$defs": {
"normalized-layout": {
"title": "normalized layout",
"type": "object",
"unevaluatedProperties": false,
"oneOf": [
{"$ref": "#/$defs/switch-struct"},
{"$ref": "#/$defs/base-comp-object"}
]
},
"switch-struct": {

@@ -16,115 +20,126 @@ "type": "object",

"type": "array",
"items": {"$ref": "#/$defs/comp-object"}
"items": {"$ref": "#/$defs/base-comp-object"}
}
}
},
"comp-object": {
"base-comp-object": {
"type": "object",
"required": ["comp"],
"unevaluatedProperties": false,
"properties": {
"comp": {"type": "string"},
"if": {"$ref": "#/$defs/expression"},
"options": {"$ref": "#/$defs/state-node-options-base"},
"getOptions": {"$ref": "#/$defs/expression"},
"defaultData": {},
"getDefaultData": {"$ref": "#/$defs/expression"},
"constData": {},
"getConstData": {"$ref": "#/$defs/expression"},
"transformData": {"$ref": "#/$defs/expression"},
"nullable": {"type": "boolean"},
"help": {"type": "string"},
"cols": {"$ref": "#/$defs/cols-obj"},
"props": {"$ref": "#/$defs/state-node-props-lib"},
"getProps": {"$ref": "#/$defs/expression"},
"slots": {
"type": "object",
"allOf": [
{"$ref": "#/$defs/state-node-slots-lib"},
{
"properties": {
"before": {"$ref": "#/$defs/slot"},
"after": {"$ref": "#/$defs/slot"},
"component": {"$ref": "#/$defs/slot"}
}
}
]
}
}
},
"composite-comp-object": {
"allOf": [
{"$ref": "#/$defs/base-comp-object"},
{
"type": "object",
"required": ["children", "comp"],
"properties": {
"if": {"$ref": "#/$defs/expression"},
"options": {"$ref": "#/$defs/state-node-options-base"},
"getOptions": {"$ref": "#/$defs/expression"},
"defaultData": {},
"getDefaultData": {"$ref": "#/$defs/expression"},
"constData": {},
"getConstData": {"$ref": "#/$defs/expression"},
"transformData": {"$ref": "#/$defs/expression"},
"nullable": {"type": "boolean"},
"help": {"type": "string"},
"cols": {"$ref": "#/$defs/cols-obj"},
"props": {"$ref": "#/$defs/state-node-props-lib"},
"getProps": {"$ref": "#/$defs/expression"},
"slots": {
"type": "object",
"allOf": [
{"$ref": "#/$defs/state-node-slots-lib"},
{
"properties": {
"before": {"$ref": "#/$defs/slot"},
"after": {"$ref": "#/$defs/slot"},
"component": {"$ref": "#/$defs/slot"}
}
}
]
}
"comp": {"type": "string"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/children"}
}
},
}
]
},
"simple-comp-object": {
"allOf": [
{"$ref": "#/$defs/base-comp-object"},
{
"discriminator": {"propertyName": "comp"},
"oneOf": [
{"$ref": "#/$defs/none"},
{"$ref": "#/$defs/list"},
{"$ref": "#/$defs/text-field"},
{"$ref": "#/$defs/number-field"},
{"$ref": "#/$defs/textarea"},
{"$ref": "#/$defs/markdown"},
{"$ref": "#/$defs/checkbox"},
{"$ref": "#/$defs/switch"},
{"$ref": "#/$defs/slider"},
{"$ref": "#/$defs/date-picker"},
{"$ref": "#/$defs/date-time-picker"},
{"$ref": "#/$defs/time-picker"},
{"$ref": "#/$defs/color-picker"},
{"$ref": "#/$defs/combobox"},
{"$ref": "#/$defs/number-combobox"},
{"$ref": "#/$defs/select"},
{"$ref": "#/$defs/autocomplete"},
{"$ref": "#/$defs/one-of-select"},
{"$ref": "#/$defs/section"},
{"$ref": "#/$defs/tabs"},
{"$ref": "#/$defs/vertical-tabs"},
{"$ref": "#/$defs/expansion-panels"},
{"$ref": "#/$defs/stepper"},
{"$ref": "#/$defs/file-input"}
]
"type": "object",
"required": ["comp"],
"properties": {
"comp": {"type": "string"},
"label": {"type": "string"}
}
}
]
},
"composite-comp-object": {
"type": "object",
"discriminator": {"propertyName": "comp"},
"oneOf": [
{"$ref": "#/$defs/section"},
{"$ref": "#/$defs/tabs"},
{"$ref": "#/$defs/vertical-tabs"},
{"$ref": "#/$defs/expansion-panels"}
"focusable-comp-object": {
"allOf": [
{"$ref": "#/$defs/base-comp-object"},
{
"type": "object",
"required": ["comp"],
"properties": {
"comp": {"type": "string"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"}
}
}
]
},
"none": {
"type": "object",
"required": ["comp"],
"properties": {
"comp": {"const": "none"}
}
"items-based-comp-object": {
"allOf": [
{"$ref": "#/$defs/base-comp-object"},
{
"type": "object",
"required": ["comp"],
"properties": {
"comp": {"type": "string"},
"items": {"$ref": "#/$defs/select-items"},
"getItems": {"$ref": "#/$defs/get-items"},
"multiple": {"type": "boolean"},
"separator": {"type": "string"}
}
}
]
},
"section": {
"type": "object",
"required": ["comp", "children"],
"properties": {
"comp": {"const": "section"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/children"}
}
"multiple-compat-comp-object": {
"allOf": [
{"$ref": "#/$defs/base-comp-object"},
{
"type": "object",
"required": ["comp"],
"properties": {
"comp": {"type": "string"},
"multiple": {"type": "boolean"}
}
}
]
},
"tabs": {
"child-ref": {
"type": "object",
"required": ["comp", "children"],
"required": ["key"],
"additionalProperties": false,
"properties": {
"comp": {"const": "tabs"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/children"}
"key": {"type": ["string", "integer"]},
"cols": {"$ref": "#/$defs/cols-obj"}
}
},
"vertical-tabs": {
"child-composite": {
"type": "object",
"required": ["comp", "children"],
"required": ["key", "children"],
"properties": {
"comp": {"const": "vertical-tabs"},
"key": {"type": ["string", "integer"]},
"cols": {"$ref": "#/$defs/cols-obj"},
"comp": {"type": "string"},
"title": {"type": ["string", "null"]},

@@ -135,33 +150,12 @@ "subtitle": {"type": ["string", "null"]},

},
"expansion-panels": {
"type": "object",
"required": ["comp", "children"],
"properties": {
"comp": {"const": "expansion-panels"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/children"}
}
},
"stepper": {
"type": "object",
"required": ["comp", "children"],
"properties": {
"comp": {"const": "stepper"},
"title": {"type": ["string", "null"]},
"subtitle": {"type": ["string", "null"]},
"children": {"$ref": "#/$defs/children"}
}
},
"child": {
"title": "Child",
"type": "object",
"unevaluatedProperties": false,
"required": ["key"],
"properties": {
"key": {"type": ["string", "integer"]},
"cols": {"$ref": "#/$defs/cols-obj"}
},
"anyOf": [
{},
{"$ref": "#/$defs/composite-comp-object"}
"oneOf": [
{
"$ref": "#/$defs/child-ref"
},
{
"$ref": "#/$defs/child-composite"
}
]

@@ -173,194 +167,2 @@ },

},
"list": {
"type": "object",
"required": ["comp", "listEditMode", "listActions"],
"properties": {
"comp": {"const": "list"},
"title": {"type": "string"},
"listEditMode": {"type": "string", "enum": ["inline", "inline-single", "menu", "dialog"]},
"listActions": {"type": "array", "items": {"type": "string", "enum": ["add", "edit", "delete", "sort", "duplicate"]}},
"itemTitle": {"$ref": "#/$defs/expression"},
"itemSubtitle": {"$ref": "#/$defs/expression"},
"messages": {
"type": "object",
"additionalProperties": false,
"properties": {
"addItem": {"type": "string"},
"delete": {"type": "string"},
"edit": {"type": "string"},
"duplicate": {"type": "string"},
"sort": {"type": "string"}
}
}
}
},
"text-field": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "text-field"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"}
}
},
"number-field": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "number-field"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"},
"step": {"type": "number"},
"min": {"type": "number"},
"max": {"type": "number"}
}
},
"textarea": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "textarea"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"}
}
},
"markdown": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "markdown"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"}
}
},
"checkbox": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "checkbox"},
"label": {"type": "string"}
}
},
"switch": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "switch"},
"label": {"type": "string"}
}
},
"slider": {
"type": "object",
"required": ["comp", "label", "min", "max"],
"properties": {
"comp": {"const": "slider"},
"label": {"type": "string"},
"step": {"type": "number"},
"min": {"type": "number"},
"max": {"type": "number"}
}
},
"date-picker": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "date-picker"},
"label": {"type": "string"},
"min": {"type": "string", "format": "date"},
"max": {"type": "string", "format": "date"},
"format": {"type": "string", "enum": ["date", "date-time"], "default": "date"}
}
},
"date-time-picker": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "date-time-picker"},
"label": {"type": "string"},
"min": {"type": "string", "format": "date-time"},
"max": {"type": "string", "format": "date-time"}
}
},
"time-picker": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "time-picker"},
"label": {"type": "string"},
"min": {"type": "string", "format": "time"},
"max": {"type": "string", "format": "time"}
}
},
"color-picker": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "color-picker"},
"label": {"type": "string"}
}
},
"combobox": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "combobox"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"},
"items": {"$ref": "#/$defs/select-items"},
"getItems": {"$ref": "#/$defs/get-items"},
"multiple": {"type": "boolean"},
"separator": {"type": "string"}
}
},
"number-combobox": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "number-combobox"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"},
"items": {"$ref": "#/$defs/select-items"},
"getItems": {"$ref": "#/$defs/get-items"},
"multiple": {"type": "boolean"},
"step": {"type": "number"},
"min": {"type": "number"},
"max": {"type": "number"}
}
},
"select": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "select"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"},
"items": {"$ref": "#/$defs/select-items"},
"getItems": {"$ref": "#/$defs/get-items"},
"multiple": {"type": "boolean"},
"separator": {"type": "string"}
}
},
"autocomplete": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "autocomplete"},
"label": {"type": "string"},
"autofocus": {"type": "boolean"},
"items": {"$ref": "#/$defs/select-items"},
"getItems": {"$ref": "#/$defs/get-items"},
"multiple": {"type": "boolean"},
"separator": {"type": "string"}
}
},
"file-input": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "file-input"},
"label": {"type": "string"},
"accept": {"type": "string"},
"multiple": {"type": "boolean"}
}
},
"select-items": {

@@ -413,10 +215,2 @@ "type": "array",

},
"one-of-select": {
"type": "object",
"required": ["comp", "label"],
"properties": {
"comp": {"const": "one-of-select"},
"label": {"type": "string"}
}
},
"expression": {

@@ -423,0 +217,0 @@ "type": "object",

@@ -1,49 +0,10 @@

export type NormalizedLayout = SwitchStruct | CompObject;
export type CompObject = {
if?: Expression;
options?: StateNodeOptionsBase;
getOptions?: Expression;
defaultData?: unknown;
getDefaultData?: Expression;
constData?: unknown;
getConstData?: Expression;
transformData?: Expression;
nullable?: boolean;
help?: string;
cols?: ColsObj;
props?: StateNodePropsLib;
getProps?: Expression;
slots?: StateNodeSlotsLib & {
before?: Slot;
after?: Slot;
component?: Slot;
[k: string]: unknown;
};
[k: string]: unknown;
} & (
| None
| List
| TextField
| NumberField
| Textarea
| Markdown
| Checkbox
| Switch
| Slider
| DatePicker
| DateTimePicker
| TimePicker
| ColorPicker
| Combobox
| NumberCombobox
| Select
| Autocomplete
| OneOfSelect
| Section
| Tabs
| VerticalTabs
| ExpansionPanels
| Stepper
| FileInput
);
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "normalized-layout".
*/
export type NormalizedLayout = SwitchStruct | BaseCompObject;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-options-base".
*/
export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {

@@ -67,2 +28,6 @@ readOnly?: boolean;

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "cols".
*/
export type Cols = number;

@@ -72,2 +37,5 @@ /**

* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "slot".
*/

@@ -84,3 +52,63 @@ export type Slot =

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "composite-comp-object".
*/
export type CompositeCompObject = BaseCompObject & {
comp: string;
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child".
*/
export type Child = ChildRef | ChildComposite;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "children".
*/
export type Children = Child[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "simple-comp-object".
*/
export type SimpleCompObject = BaseCompObject & {
comp: string;
label?: string;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "focusable-comp-object".
*/
export type FocusableCompObject = BaseCompObject & {
comp: string;
label?: string;
autofocus?: boolean;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "items-based-comp-object".
*/
export type ItemsBasedCompObject = BaseCompObject & {
comp: string;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "select-items".
*/
export type SelectItems = SelectItem[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "get-items".
*/
export type GetItems = {

@@ -95,17 +123,55 @@ returnObjects?: boolean;

} & (Expression | GetItemsFetch);
export type Child = Child1 & {
key: string | number;
cols?: ColsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "multiple-compat-comp-object".
*/
export type MultipleCompatCompObject = BaseCompObject & {
comp: string;
multiple?: boolean;
[k: string]: unknown;
};
export type Child1 = unknown | CompositeCompObject;
export type CompositeCompObject = Section | Tabs | VerticalTabs | ExpansionPanels;
export type Children = Child[];
export interface HttpsJsonLayoutGithubIoNormalizedLayoutKeyword {
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "switch-struct".
*/
export interface SwitchStruct {
switch: CompObject[];
switch: BaseCompObject[];
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "base-comp-object".
*/
export interface BaseCompObject {
comp: string;
if?: Expression;
options?: StateNodeOptionsBase;
getOptions?: Expression;
defaultData?: unknown;
getDefaultData?: Expression;
constData?: unknown;
getConstData?: Expression;
transformData?: Expression;
nullable?: boolean;
help?: string;
cols?: ColsObj;
props?: StateNodePropsLib;
getProps?: Expression;
slots?: StateNodeSlotsLib & {
before?: Slot;
after?: Slot;
component?: Slot;
[k: string]: unknown;
};
[k: string]: unknown;
}
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "expression".
*/

@@ -119,2 +185,6 @@ export interface Expression {

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-options-base-lib".
*/
export interface StateNodeOptionsBaseLib {

@@ -127,2 +197,6 @@ /**

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "cols-obj".
*/
export interface ColsObj {

@@ -136,2 +210,6 @@ xs: number;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-props-lib".
*/
export interface StateNodePropsLib {

@@ -144,107 +222,34 @@ /**

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-slots-lib".
*/
export interface StateNodeSlotsLib {
[k: string]: Slot;
}
export interface None {
comp: "none";
[k: string]: unknown;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child-ref".
*/
export interface ChildRef {
key: string | number;
cols?: ColsObj;
}
export interface List {
comp: "list";
title?: string;
listEditMode: "inline" | "inline-single" | "menu" | "dialog";
listActions: ("add" | "edit" | "delete" | "sort" | "duplicate")[];
itemTitle?: Expression;
itemSubtitle?: Expression;
messages?: {
addItem?: string;
delete?: string;
edit?: string;
duplicate?: string;
sort?: string;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child-composite".
*/
export interface ChildComposite {
key: string | number;
cols?: ColsObj;
comp?: string;
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface TextField {
comp: "text-field";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface NumberField {
comp: "number-field";
label: string;
autofocus?: boolean;
step?: number;
min?: number;
max?: number;
[k: string]: unknown;
}
export interface Textarea {
comp: "textarea";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface Markdown {
comp: "markdown";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface Checkbox {
comp: "checkbox";
label: string;
[k: string]: unknown;
}
export interface Switch {
comp: "switch";
label: string;
[k: string]: unknown;
}
export interface Slider {
comp: "slider";
label: string;
step?: number;
min: number;
max: number;
[k: string]: unknown;
}
export interface DatePicker {
comp: "date-picker";
label: string;
min?: string;
max?: string;
format?: "date" | "date-time";
[k: string]: unknown;
}
export interface DateTimePicker {
comp: "date-time-picker";
label: string;
min?: string;
max?: string;
[k: string]: unknown;
}
export interface TimePicker {
comp: "time-picker";
label: string;
min?: string;
max?: string;
[k: string]: unknown;
}
export interface ColorPicker {
comp: "color-picker";
label: string;
[k: string]: unknown;
}
export interface Combobox {
comp: "combobox";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "select-item".
*/
export interface SelectItem {

@@ -257,2 +262,6 @@ title: string;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "get-items-fetch".
*/
export interface GetItemsFetch {

@@ -266,80 +275,1 @@ url: Expression;

}
export interface NumberCombobox {
comp: "number-combobox";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
step?: number;
min?: number;
max?: number;
[k: string]: unknown;
}
export interface Select {
comp: "select";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
export interface Autocomplete {
comp: "autocomplete";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
export interface OneOfSelect {
comp: "one-of-select";
label: string;
[k: string]: unknown;
}
export interface Section {
comp: "section";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface Tabs {
comp: "tabs";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface VerticalTabs {
comp: "vertical-tabs";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface ExpansionPanels {
comp: "expansion-panels";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface Stepper {
comp: "stepper";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface FileInput {
comp: "file-input";
label: string;
accept?: string;
multiple?: boolean;
[k: string]: unknown;
}

@@ -23,1 +23,12 @@ import { type LayoutKeyword } from './layout-keyword/types.js'

}
export interface ComponentInfo {
name: string
composite?: boolean
shouldDebounce?: boolean
emitsBlur?: boolean
focusable?: boolean
itemsBased?: boolean
multipleCompat?: boolean
schema?: any
}
export * from "./layout-keyword/index.js";
export * from "./normalized-layout/index.js";
export * from "./components/index.js";
export type SchemaFragment = import("./types.js").SchemaFragment;
export type ComponentInfo = import("./types.js").ComponentInfo;
export { normalizeLayoutFragment, getSchemaFragmentType } from "./normalize.js";
//# sourceMappingURL=index.d.ts.map

@@ -1,4 +0,5 @@

export function isComponentName(layoutKeyword: LayoutKeyword): layoutKeyword is import("./types.js").ComponentName;
export function isComponentName(layoutKeyword: LayoutKeyword): layoutKeyword is string;
export function isPartialSwitch(layoutKeyword: LayoutKeyword): layoutKeyword is import("./types.js").PartialSwitch;
export function isPartialChildren(layoutKeyword: LayoutKeyword): layoutKeyword is import("./types.js").PartialChildren;
export function isPartialChildComposite(partialChild: PartialChild): partialChild is import("./types.js").PartialChildComposite;
export function isPartialCompObject(layoutKeyword: LayoutKeyword): layoutKeyword is import("./types.js").PartialCompObject;

@@ -13,2 +14,4 @@ export function isPartialGetItemsExpr(getItems: PartialGetItems): getItems is import("./types.js").PartialExpression;

* @typedef {import('./types.js').PartialChildren} PartialChildren
* @typedef {import('./types.js').PartialChild} PartialChild
* @typedef {import('./types.js').PartialChildComposite} PartialChildComposite
* @typedef {import('./types.js').PartialSwitch} PartialSwitch

@@ -30,2 +33,4 @@ * @typedef {import('./types.js').PartialCompObject} PartialCompObject

export type PartialChildren = import('./types.js').PartialChildren;
export type PartialChild = import('./types.js').PartialChild;
export type PartialChildComposite = import('./types.js').PartialChildComposite;
export type PartialSwitch = import('./types.js').PartialSwitch;

@@ -32,0 +37,0 @@ export type PartialCompObject = import('./types.js').PartialCompObject;

declare namespace _default {
export let $id: string;
export let title: string;
export namespace errorMessage {
let anyOf: string;
}
let anyOf_1: {
$ref: string;
}[];
export { anyOf_1 as anyOf };
export let $defs: {
let $id: string;
let $defs: {
"layout-keyword": {
title: string;
errorMessage: {
anyOf: string;
};
anyOf: {
$ref: string;
}[];
};
"partial-switch": {

@@ -121,10 +122,7 @@ type: string;

type: string;
errorMessage: {
enum: string;
};
enum: string[];
};
"partial-child": {
"partial-child-ref": {
type: string;
unevaluatedProperties: boolean;
required: string[];
additionalProperties: boolean;
properties: {

@@ -138,6 +136,31 @@ key: {

};
allOf: ({
};
"partial-child-composite": {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
$ref: string;
};
cols: {
$ref: string;
};
};
};
"partial-child": {
anyOf: ({
type: string;
$ref?: undefined;
} | {
$ref: string;
} | {
$ref?: undefined;
type?: undefined;
})[];

@@ -148,9 +171,3 @@ };

items: {
oneOf: ({
type: string;
$ref?: undefined;
} | {
$ref: string;
type?: undefined;
})[];
$ref: string;
};

@@ -157,0 +174,0 @@ };

@@ -0,10 +1,40 @@

/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "layout-keyword".
*/
export type LayoutKeyword = ComponentName | PartialChildren | PartialCompObject | PartialSwitch;
export type ComponentName = "none" | "text-field" | "number-field" | "textarea" | "markdown" | "checkbox" | "switch" | "slider" | "date-picker" | "date-time-picker" | "time-picker" | "color-picker" | "combobox" | "number-combobox" | "section" | "list" | "select" | "autocomplete" | "tabs" | "vertical-tabs" | "expansion-panels" | "stepper" | "one-of-select" | "file-input";
export type PartialChild = PartialChild1 & {
key?: string | number;
cols?: PartialCols;
[k: string]: unknown;
};
export type PartialChild1 = PartialCompObject & unknown;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "comp-name".
*/
export type ComponentName = string;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child".
*/
export type PartialChild = string | PartialChildRef | PartialChildComposite;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols".
*/
export type PartialCols = PartialColsNumber | PartialColsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols-number".
*/
export type PartialColsNumber = number;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-children".
*/
export type PartialChildren = PartialChild[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-expression".
*/
export type PartialExpression = string | PartialExpressionObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-select-item".
*/
export type PartialSelectItem = string | {

@@ -16,3 +46,11 @@ key?: string;

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items".
*/
export type PartialGetItems = string | PartialGetItemsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items-obj".
*/
export type PartialGetItemsObj = {

@@ -28,10 +66,49 @@ itemTitle?: PartialExpression;

} | PartialExpressionObj | PartialGetItemsFetch);
export type PartialCols = PartialColsNumber | PartialColsObj;
export type PartialColsNumber = number;
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot".
*/
export type PartialSlot = string | PartialSlotText | PartialSlotMarkdown | PartialSlotName;
export type PartialChildren = (string | PartialChild)[];
export interface HttpsJsonLayoutGithubIoLayoutKeyword {
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child-ref".
*/
export interface PartialChildRef {
key: string | number;
cols?: PartialCols;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-cols-obj".
*/
export interface PartialColsObj {
xs?: PartialColsNumber;
sm?: PartialColsNumber;
md?: PartialColsNumber;
lg?: PartialColsNumber;
xl?: PartialColsNumber;
xxl?: PartialColsNumber;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-child-composite".
*/
export interface PartialChildComposite {
comp?: string;
title?: string | null;
subtitle?: string | null;
children: PartialChildren;
cols?: PartialCols;
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-comp-object".
*/
export interface PartialCompObject {

@@ -74,2 +151,6 @@ comp?: ComponentName;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-expression-obj".
*/
export interface PartialExpressionObj {

@@ -80,2 +161,6 @@ type?: "js-fn" | "js-eval" | "js-tpl";

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-get-items-fetch".
*/
export interface PartialGetItemsFetch {

@@ -85,19 +170,27 @@ url: PartialExpression;

}
export interface PartialColsObj {
xs?: PartialColsNumber;
sm?: PartialColsNumber;
md?: PartialColsNumber;
lg?: PartialColsNumber;
xl?: PartialColsNumber;
xxl?: PartialColsNumber;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-text".
*/
export interface PartialSlotText {
text: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-markdown".
*/
export interface PartialSlotMarkdown {
markdown: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-slot-name".
*/
export interface PartialSlotName {
name: string;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoLayoutKeyword`'s JSON-Schema
* via the `definition` "partial-switch".
*/
export interface PartialSwitch {

@@ -104,0 +197,0 @@ switch: PartialCompObject[];

/**
* @param {SchemaFragment} schemaFragment
* @param {string} schemaPath
* @param {Record<string, import('./types.js').ComponentInfo>} components
* @param {(text: string) => string} markdown

@@ -9,3 +10,3 @@ * @param {string[]} [optionsKeys]

*/
export function normalizeLayoutFragment(schemaFragment: SchemaFragment, schemaPath: string, markdown?: (text: string) => string, optionsKeys?: string[] | undefined, arrayChild?: "oneOf" | undefined): {
export function normalizeLayoutFragment(schemaFragment: SchemaFragment, schemaPath: string, components: Record<string, import('./types.js').ComponentInfo>, markdown?: (text: string) => string, optionsKeys?: string[] | undefined, arrayChild?: "oneOf" | undefined): {
layout: NormalizedLayout;

@@ -20,3 +21,3 @@ errors: string[];

export type Children = import('./index.js').Children;
export type CompObject = import('./index.js').CompObject;
export type BaseCompObject = import('./index.js').BaseCompObject;
export type Expression = import('./index.js').Expression;

@@ -23,0 +24,0 @@ export type NormalizedLayout = import('./index.js').NormalizedLayout;

export function isSwitchStruct(layout: NormalizedLayout): layout is import("./types.js").SwitchStruct;
export function isCompObject(layout: NormalizedLayout): layout is import("./types.js").CompObject;
export function childIsCompObject(child: Child): child is {
export function isCompObject(layout: NormalizedLayout): layout is import("./types.js").BaseCompObject;
export function childIsCompObject(child: Child): child is import("./types.js").Child & import("./types.js").BaseCompObject & {
[k: string]: unknown;
key: string | number;
cols?: import("./types.js").ColsObj | undefined;
} & import("./types.js").CompositeCompObject;
export function isSectionLayout(layout: CompObject): layout is import("./types.js").Section;
export function isCompositeLayout(layout: CompObject): layout is import("./types.js").CompositeCompObject;
export function isTextFieldLayout(layout: CompObject): layout is import("./types.js").TextField;
export function isSelectLayout(layout: CompObject): layout is import("./types.js").Select;
export function isFileLayout(layout: CompObject): layout is import("./types.js").FileInput;
export function isFocusableLayout(layout: CompObject): layout is import("./types.js").CompObject & {
autofocus: boolean;
comp: string;
title?: string | null | undefined;
subtitle?: string | null | undefined;
children: import("./types.js").Children;
};
export function isItemsLayout(layout: CompObject): layout is import("./types.js").Combobox | import("./types.js").Select | import("./types.js").Autocomplete;
export function isCompositeLayout(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>): layout is import("./types.js").CompositeCompObject;
export function isFocusableLayout(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>): layout is import("./types.js").FocusableCompObject;
export function isItemsLayout(layout: BaseCompObject, components: Record<string, import('../types.js').ComponentInfo>): layout is import("./types.js").ItemsBasedCompObject;
export function isGetItemsExpression(getItems: GetItems): getItems is import("./types.js").Expression;

@@ -31,33 +27,13 @@ export function isGetItemsFetch(getItems: GetItems): getItems is import("./types.js").GetItemsFetch;

* @typedef {import('./types.js').SwitchStruct} SwitchStruct
* @typedef {import('./types.js').CompObject} CompObject
* @typedef {import('./types.js').Section} Section
* @typedef {import('./types.js').GetItems} GetItems
* @typedef {import('./types.js').Expression} Expression
* @typedef {import('./types.js').Select} Select
* @typedef {import('./types.js').Autocomplete} Autocomplete
* @typedef {import('./types.js').BaseCompObject} BaseCompObject
* @typedef {import('./types.js').SelectItem} SelectItem
* @typedef {import('./types.js').SelectItems} SelectItems
* @typedef {import('./types.js').GetItemsFetch} GetItemsFetch
* @typedef {import('./types.js').TextField} TextField
* @typedef {import('./types.js').Textarea} Textarea
* @typedef {import('./types.js').NumberField} NumberField
* @typedef {import('./types.js').Slider} Slider
* @typedef {import('./types.js').Checkbox} Checkbox
* @typedef {import('./types.js').Switch} Switch
* @typedef {import('./types.js').DatePicker} DatePicker
* @typedef {import('./types.js').TimePicker} TimePicker
* @typedef {import('./types.js').DateTimePicker} DateTimePicker
* @typedef {import('./types.js').ColorPicker} ColorPicker
* @typedef {import('./types.js').OneOfSelect} OneOfSelect
* @typedef {import('./types.js').Child} Child
* @typedef {import('./types.js').Children} Children
* @typedef {import('./types.js').CompositeCompObject} CompositeCompObject
* @typedef {import('./types.js').Tabs} Tabs
* @typedef {import('./types.js').VerticalTabs} VerticalTabs
* @typedef {import('./types.js').ExpansionPanels} ExpansionPanels
* @typedef {import('./types.js').Stepper} Stepper
* @typedef {import('./types.js').List} List
* @typedef {import('./types.js').Combobox} Combobox
* @typedef {import('./types.js').Markdown} Markdown
* @typedef {import('./types.js').FileInput} FileInput
* @typedef {import('./types.js').ItemsBasedCompObject} ItemsBasedCompObject
* @typedef {import('./types.js').FocusableCompObject} FocusableCompObject
* @typedef {import('./types.js').GetItems} GetItems
* @typedef {import('./types.js').Expression} Expression
* @typedef {import('./types.js').Cols} Cols

@@ -72,37 +48,15 @@ * @typedef {import('./types.js').ColsObj} ColsObj

export const normalizedLayoutSchema: any;
export const compositeCompNames: string[];
export const editableCompNames: string[];
export type NormalizedLayout = import('./types.js').NormalizedLayout;
export type SwitchStruct = import('./types.js').SwitchStruct;
export type CompObject = import('./types.js').CompObject;
export type Section = import('./types.js').Section;
export type GetItems = import('./types.js').GetItems;
export type Expression = import('./types.js').Expression;
export type Select = import('./types.js').Select;
export type Autocomplete = import('./types.js').Autocomplete;
export type BaseCompObject = import('./types.js').BaseCompObject;
export type SelectItem = import('./types.js').SelectItem;
export type SelectItems = import('./types.js').SelectItems;
export type GetItemsFetch = import('./types.js').GetItemsFetch;
export type TextField = import('./types.js').TextField;
export type Textarea = import('./types.js').Textarea;
export type NumberField = import('./types.js').NumberField;
export type Slider = import('./types.js').Slider;
export type Checkbox = import('./types.js').Checkbox;
export type Switch = import('./types.js').Switch;
export type DatePicker = import('./types.js').DatePicker;
export type TimePicker = import('./types.js').TimePicker;
export type DateTimePicker = import('./types.js').DateTimePicker;
export type ColorPicker = import('./types.js').ColorPicker;
export type OneOfSelect = import('./types.js').OneOfSelect;
export type Child = import('./types.js').Child;
export type Children = import('./types.js').Children;
export type CompositeCompObject = import('./types.js').CompositeCompObject;
export type Tabs = import('./types.js').Tabs;
export type VerticalTabs = import('./types.js').VerticalTabs;
export type ExpansionPanels = import('./types.js').ExpansionPanels;
export type Stepper = import('./types.js').Stepper;
export type List = import('./types.js').List;
export type Combobox = import('./types.js').Combobox;
export type Markdown = import('./types.js').Markdown;
export type FileInput = import('./types.js').FileInput;
export type ItemsBasedCompObject = import('./types.js').ItemsBasedCompObject;
export type FocusableCompObject = import('./types.js').FocusableCompObject;
export type GetItems = import('./types.js').GetItems;
export type Expression = import('./types.js').Expression;
export type Cols = import('./types.js').Cols;

@@ -109,0 +63,0 @@ export type ColsObj = import('./types.js').ColsObj;

declare namespace _default {
let $id: string;
let title: string;
let oneOf: {
$ref: string;
}[];
let $defs: {
"normalized-layout": {
title: string;
type: string;
unevaluatedProperties: boolean;
oneOf: {
$ref: string;
}[];
};
"switch-struct": {

@@ -21,579 +25,232 @@ type: string;

};
"comp-object": {
"base-comp-object": {
type: string;
required: string[];
unevaluatedProperties: boolean;
allOf: ({
properties: {
if: {
$ref: string;
};
options: {
$ref: string;
};
getOptions: {
$ref: string;
};
defaultData: {};
getDefaultData: {
$ref: string;
};
constData: {};
getConstData: {
$ref: string;
};
transformData: {
$ref: string;
};
nullable: {
type: string;
};
help: {
type: string;
};
cols: {
$ref: string;
};
props: {
$ref: string;
};
getProps: {
$ref: string;
};
slots: {
type: string;
allOf: ({
$ref: string;
properties?: undefined;
} | {
properties: {
before: {
$ref: string;
};
after: {
$ref: string;
};
component: {
$ref: string;
};
};
$ref?: undefined;
})[];
};
};
discriminator?: undefined;
oneOf?: undefined;
} | {
discriminator: {
propertyName: string;
};
oneOf: {
$ref: string;
}[];
properties?: undefined;
})[];
};
"composite-comp-object": {
type: string;
discriminator: {
propertyName: string;
};
oneOf: {
$ref: string;
}[];
};
none: {
type: string;
required: string[];
properties: {
comp: {
const: string;
type: string;
};
};
};
section: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
if: {
$ref: string;
};
};
};
tabs: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
options: {
$ref: string;
};
};
};
"vertical-tabs": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
getOptions: {
$ref: string;
};
};
};
"expansion-panels": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
defaultData: {};
getDefaultData: {
$ref: string;
};
};
};
stepper: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
constData: {};
getConstData: {
$ref: string;
};
};
};
child: {
type: string;
unevaluatedProperties: boolean;
required: string[];
properties: {
key: {
type: string[];
};
cols: {
transformData: {
$ref: string;
};
};
anyOf: ({
$ref?: undefined;
} | {
$ref: string;
})[];
};
children: {
type: string;
items: {
$ref: string;
};
};
list: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
title: {
nullable: {
type: string;
};
listEditMode: {
help: {
type: string;
enum: string[];
};
listActions: {
type: string;
items: {
type: string;
enum: string[];
};
cols: {
$ref: string;
};
itemTitle: {
props: {
$ref: string;
};
itemSubtitle: {
getProps: {
$ref: string;
};
messages: {
slots: {
type: string;
additionalProperties: boolean;
properties: {
addItem: {
type: string;
allOf: ({
$ref: string;
properties?: undefined;
} | {
properties: {
before: {
$ref: string;
};
after: {
$ref: string;
};
component: {
$ref: string;
};
};
delete: {
type: string;
};
edit: {
type: string;
};
duplicate: {
type: string;
};
sort: {
type: string;
};
};
$ref?: undefined;
})[];
};
};
};
"text-field": {
type: string;
required: string[];
properties: {
comp: {
const: string;
"composite-comp-object": {
allOf: ({
$ref: string;
type?: undefined;
required?: undefined;
properties?: undefined;
} | {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
title: {
type: string[];
};
subtitle: {
type: string[];
};
children: {
$ref: string;
};
};
label: {
type: string;
};
autofocus: {
type: string;
};
};
$ref?: undefined;
})[];
};
"number-field": {
type: string;
required: string[];
properties: {
comp: {
const: string;
"simple-comp-object": {
allOf: ({
$ref: string;
type?: undefined;
required?: undefined;
properties?: undefined;
} | {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
label: {
type: string;
};
};
label: {
type: string;
};
autofocus: {
type: string;
};
step: {
type: string;
};
min: {
type: string;
};
max: {
type: string;
};
};
$ref?: undefined;
})[];
};
textarea: {
type: string;
required: string[];
properties: {
comp: {
const: string;
"focusable-comp-object": {
allOf: ({
$ref: string;
type?: undefined;
required?: undefined;
properties?: undefined;
} | {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
label: {
type: string;
};
autofocus: {
type: string;
};
};
label: {
type: string;
};
autofocus: {
type: string;
};
};
$ref?: undefined;
})[];
};
markdown: {
type: string;
required: string[];
properties: {
comp: {
const: string;
"items-based-comp-object": {
allOf: ({
$ref: string;
type?: undefined;
required?: undefined;
properties?: undefined;
} | {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
items: {
$ref: string;
};
getItems: {
$ref: string;
};
multiple: {
type: string;
};
separator: {
type: string;
};
};
label: {
type: string;
};
autofocus: {
type: string;
};
};
$ref?: undefined;
})[];
};
checkbox: {
type: string;
required: string[];
properties: {
comp: {
const: string;
"multiple-compat-comp-object": {
allOf: ({
$ref: string;
type?: undefined;
required?: undefined;
properties?: undefined;
} | {
type: string;
required: string[];
properties: {
comp: {
type: string;
};
multiple: {
type: string;
};
};
label: {
type: string;
};
};
$ref?: undefined;
})[];
};
switch: {
"child-ref": {
type: string;
required: string[];
additionalProperties: boolean;
properties: {
comp: {
const: string;
key: {
type: string[];
};
label: {
type: string;
};
};
};
slider: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
step: {
type: string;
};
min: {
type: string;
};
max: {
type: string;
};
};
};
"date-picker": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
min: {
type: string;
format: string;
};
max: {
type: string;
format: string;
};
format: {
type: string;
enum: string[];
default: string;
};
};
};
"date-time-picker": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
min: {
type: string;
format: string;
};
max: {
type: string;
format: string;
};
};
};
"time-picker": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
min: {
type: string;
format: string;
};
max: {
type: string;
format: string;
};
};
};
"color-picker": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
};
};
combobox: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
autofocus: {
type: string;
};
items: {
cols: {
$ref: string;
};
getItems: {
$ref: string;
};
multiple: {
type: string;
};
separator: {
type: string;
};
};
};
"number-combobox": {
"child-composite": {
type: string;
required: string[];
properties: {
comp: {
const: string;
key: {
type: string[];
};
label: {
type: string;
};
autofocus: {
type: string;
};
items: {
cols: {
$ref: string;
};
getItems: {
$ref: string;
};
multiple: {
type: string;
};
step: {
type: string;
};
min: {
type: string;
};
max: {
type: string;
};
};
};
select: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
autofocus: {
type: string;
title: {
type: string[];
};
items: {
$ref: string;
subtitle: {
type: string[];
};
getItems: {
children: {
$ref: string;
};
multiple: {
type: string;
};
separator: {
type: string;
};
};
};
autocomplete: {
child: {
title: string;
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
autofocus: {
type: string;
};
items: {
$ref: string;
};
getItems: {
$ref: string;
};
multiple: {
type: string;
};
separator: {
type: string;
};
};
oneOf: {
$ref: string;
}[];
};
"file-input": {
children: {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
accept: {
type: string;
};
multiple: {
type: string;
};
items: {
$ref: string;
};

@@ -675,14 +332,2 @@ };

};
"one-of-select": {
type: string;
required: string[];
properties: {
comp: {
const: string;
};
label: {
type: string;
};
};
};
expression: {

@@ -689,0 +334,0 @@ type: string;

@@ -1,24 +0,10 @@

export type NormalizedLayout = SwitchStruct | CompObject;
export type CompObject = {
if?: Expression;
options?: StateNodeOptionsBase;
getOptions?: Expression;
defaultData?: unknown;
getDefaultData?: Expression;
constData?: unknown;
getConstData?: Expression;
transformData?: Expression;
nullable?: boolean;
help?: string;
cols?: ColsObj;
props?: StateNodePropsLib;
getProps?: Expression;
slots?: StateNodeSlotsLib & {
before?: Slot;
after?: Slot;
component?: Slot;
[k: string]: unknown;
};
[k: string]: unknown;
} & (None | List | TextField | NumberField | Textarea | Markdown | Checkbox | Switch | Slider | DatePicker | DateTimePicker | TimePicker | ColorPicker | Combobox | NumberCombobox | Select | Autocomplete | OneOfSelect | Section | Tabs | VerticalTabs | ExpansionPanels | Stepper | FileInput);
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "normalized-layout".
*/
export type NormalizedLayout = SwitchStruct | BaseCompObject;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-options-base".
*/
export type StateNodeOptionsBase = StateNodeOptionsBaseLib & {

@@ -42,2 +28,6 @@ readOnly?: boolean;

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "cols".
*/
export type Cols = number;

@@ -47,2 +37,5 @@ /**

* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "slot".
*/

@@ -56,3 +49,63 @@ export type Slot = {

};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "composite-comp-object".
*/
export type CompositeCompObject = BaseCompObject & {
comp: string;
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child".
*/
export type Child = ChildRef | ChildComposite;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "children".
*/
export type Children = Child[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "simple-comp-object".
*/
export type SimpleCompObject = BaseCompObject & {
comp: string;
label?: string;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "focusable-comp-object".
*/
export type FocusableCompObject = BaseCompObject & {
comp: string;
label?: string;
autofocus?: boolean;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "items-based-comp-object".
*/
export type ItemsBasedCompObject = BaseCompObject & {
comp: string;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "select-items".
*/
export type SelectItems = SelectItem[];
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "get-items".
*/
export type GetItems = {

@@ -67,16 +120,54 @@ returnObjects?: boolean;

} & (Expression | GetItemsFetch);
export type Child = Child1 & {
key: string | number;
cols?: ColsObj;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "multiple-compat-comp-object".
*/
export type MultipleCompatCompObject = BaseCompObject & {
comp: string;
multiple?: boolean;
[k: string]: unknown;
};
export type Child1 = unknown | CompositeCompObject;
export type CompositeCompObject = Section | Tabs | VerticalTabs | ExpansionPanels;
export type Children = Child[];
export interface HttpsJsonLayoutGithubIoNormalizedLayoutKeyword {
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "switch-struct".
*/
export interface SwitchStruct {
switch: CompObject[];
switch: BaseCompObject[];
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "base-comp-object".
*/
export interface BaseCompObject {
comp: string;
if?: Expression;
options?: StateNodeOptionsBase;
getOptions?: Expression;
defaultData?: unknown;
getDefaultData?: Expression;
constData?: unknown;
getConstData?: Expression;
transformData?: Expression;
nullable?: boolean;
help?: string;
cols?: ColsObj;
props?: StateNodePropsLib;
getProps?: Expression;
slots?: StateNodeSlotsLib & {
before?: Slot;
after?: Slot;
component?: Slot;
[k: string]: unknown;
};
[k: string]: unknown;
}
/**
* This interface was referenced by `undefined`'s JSON-Schema definition
* via the `patternProperty` ".*".
*
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "expression".
*/

@@ -90,2 +181,6 @@ export interface Expression {

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-options-base-lib".
*/
export interface StateNodeOptionsBaseLib {

@@ -98,2 +193,6 @@ /**

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "cols-obj".
*/
export interface ColsObj {

@@ -107,2 +206,6 @@ xs: number;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-props-lib".
*/
export interface StateNodePropsLib {

@@ -115,107 +218,34 @@ /**

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "state-node-slots-lib".
*/
export interface StateNodeSlotsLib {
[k: string]: Slot;
}
export interface None {
comp: "none";
[k: string]: unknown;
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child-ref".
*/
export interface ChildRef {
key: string | number;
cols?: ColsObj;
}
export interface List {
comp: "list";
title?: string;
listEditMode: "inline" | "inline-single" | "menu" | "dialog";
listActions: ("add" | "edit" | "delete" | "sort" | "duplicate")[];
itemTitle?: Expression;
itemSubtitle?: Expression;
messages?: {
addItem?: string;
delete?: string;
edit?: string;
duplicate?: string;
sort?: string;
};
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "child-composite".
*/
export interface ChildComposite {
key: string | number;
cols?: ColsObj;
comp?: string;
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface TextField {
comp: "text-field";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface NumberField {
comp: "number-field";
label: string;
autofocus?: boolean;
step?: number;
min?: number;
max?: number;
[k: string]: unknown;
}
export interface Textarea {
comp: "textarea";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface Markdown {
comp: "markdown";
label: string;
autofocus?: boolean;
[k: string]: unknown;
}
export interface Checkbox {
comp: "checkbox";
label: string;
[k: string]: unknown;
}
export interface Switch {
comp: "switch";
label: string;
[k: string]: unknown;
}
export interface Slider {
comp: "slider";
label: string;
step?: number;
min: number;
max: number;
[k: string]: unknown;
}
export interface DatePicker {
comp: "date-picker";
label: string;
min?: string;
max?: string;
format?: "date" | "date-time";
[k: string]: unknown;
}
export interface DateTimePicker {
comp: "date-time-picker";
label: string;
min?: string;
max?: string;
[k: string]: unknown;
}
export interface TimePicker {
comp: "time-picker";
label: string;
min?: string;
max?: string;
[k: string]: unknown;
}
export interface ColorPicker {
comp: "color-picker";
label: string;
[k: string]: unknown;
}
export interface Combobox {
comp: "combobox";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "select-item".
*/
export interface SelectItem {

@@ -228,2 +258,6 @@ title: string;

}
/**
* This interface was referenced by `HttpsJsonLayoutGithubIoNormalizedLayoutKeyword`'s JSON-Schema
* via the `definition` "get-items-fetch".
*/
export interface GetItemsFetch {

@@ -237,81 +271,2 @@ url: Expression;

}
export interface NumberCombobox {
comp: "number-combobox";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
step?: number;
min?: number;
max?: number;
[k: string]: unknown;
}
export interface Select {
comp: "select";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
export interface Autocomplete {
comp: "autocomplete";
label: string;
autofocus?: boolean;
items?: SelectItems;
getItems?: GetItems;
multiple?: boolean;
separator?: string;
[k: string]: unknown;
}
export interface OneOfSelect {
comp: "one-of-select";
label: string;
[k: string]: unknown;
}
export interface Section {
comp: "section";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface Tabs {
comp: "tabs";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface VerticalTabs {
comp: "vertical-tabs";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface ExpansionPanels {
comp: "expansion-panels";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface Stepper {
comp: "stepper";
title?: string | null;
subtitle?: string | null;
children: Children;
[k: string]: unknown;
}
export interface FileInput {
comp: "file-input";
label: string;
accept?: string;
multiple?: boolean;
[k: string]: unknown;
}
//# sourceMappingURL=types.d.ts.map

@@ -22,2 +22,12 @@ import { type LayoutKeyword } from './layout-keyword/types.js';

}
export interface ComponentInfo {
name: string;
composite?: boolean;
shouldDebounce?: boolean;
emitsBlur?: boolean;
focusable?: boolean;
itemsBased?: boolean;
multipleCompat?: boolean;
schema?: any;
}
//# sourceMappingURL=types.d.ts.map

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc