@cratis/components 4.25.2 → 4.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/compat-manifest.json +11 -11
  2. package/dist/esm/SchemaEditor/NameCell.d.ts +5 -1
  3. package/dist/esm/SchemaEditor/NameCell.d.ts.map +1 -1
  4. package/dist/esm/SchemaEditor/NameCell.js +2 -2
  5. package/dist/esm/SchemaEditor/NameCell.js.map +1 -1
  6. package/dist/esm/SchemaEditor/SchemaEditor.d.ts +63 -48
  7. package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -1
  8. package/dist/esm/SchemaEditor/SchemaEditor.js +83 -25
  9. package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -1
  10. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts +98 -0
  11. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts.map +1 -0
  12. package/dist/esm/SchemaEditor/SchemaEditorLabels.js +4 -0
  13. package/dist/esm/SchemaEditor/SchemaEditorLabels.js.map +1 -0
  14. package/dist/esm/SchemaEditor/SchemaEditorLayout.d.ts +6 -0
  15. package/dist/esm/SchemaEditor/SchemaEditorLayout.d.ts.map +1 -0
  16. package/dist/esm/SchemaEditor/SchemaEditorLayout.js +4 -0
  17. package/dist/esm/SchemaEditor/SchemaEditorLayout.js.map +1 -0
  18. package/dist/esm/SchemaEditor/Tree/Property.d.ts +30 -0
  19. package/dist/esm/SchemaEditor/Tree/Property.d.ts.map +1 -0
  20. package/dist/esm/SchemaEditor/Tree/Property.js +4 -0
  21. package/dist/esm/SchemaEditor/Tree/Property.js.map +1 -0
  22. package/dist/esm/SchemaEditor/Tree/PropertyConcept.d.ts +15 -0
  23. package/dist/esm/SchemaEditor/Tree/PropertyConcept.d.ts.map +1 -0
  24. package/dist/esm/SchemaEditor/Tree/PropertyConcept.js +4 -0
  25. package/dist/esm/SchemaEditor/Tree/PropertyConcept.js.map +1 -0
  26. package/dist/esm/SchemaEditor/Tree/PropertyConceptsContext.d.ts +22 -0
  27. package/dist/esm/SchemaEditor/Tree/PropertyConceptsContext.d.ts.map +1 -0
  28. package/dist/esm/SchemaEditor/Tree/PropertyConceptsContext.js +10 -0
  29. package/dist/esm/SchemaEditor/Tree/PropertyConceptsContext.js.map +1 -0
  30. package/dist/esm/SchemaEditor/Tree/PropertyType.d.ts +22 -0
  31. package/dist/esm/SchemaEditor/Tree/PropertyType.d.ts.map +1 -0
  32. package/dist/esm/SchemaEditor/Tree/PropertyType.js +15 -0
  33. package/dist/esm/SchemaEditor/Tree/PropertyType.js.map +1 -0
  34. package/dist/esm/SchemaEditor/Tree/PropertyTypeBadge.d.ts +20 -0
  35. package/dist/esm/SchemaEditor/Tree/PropertyTypeBadge.d.ts.map +1 -0
  36. package/dist/esm/SchemaEditor/Tree/PropertyTypeBadge.js +12 -0
  37. package/dist/esm/SchemaEditor/Tree/PropertyTypeBadge.js.map +1 -0
  38. package/dist/esm/SchemaEditor/Tree/PropertyTypeGlyph.d.ts +12 -0
  39. package/dist/esm/SchemaEditor/Tree/PropertyTypeGlyph.d.ts.map +1 -0
  40. package/dist/esm/SchemaEditor/Tree/PropertyTypeGlyph.js +29 -0
  41. package/dist/esm/SchemaEditor/Tree/PropertyTypeGlyph.js.map +1 -0
  42. package/dist/esm/SchemaEditor/Tree/PropertyTypeMenu.d.ts +28 -0
  43. package/dist/esm/SchemaEditor/Tree/PropertyTypeMenu.d.ts.map +1 -0
  44. package/dist/esm/SchemaEditor/Tree/PropertyTypeMenu.js +38 -0
  45. package/dist/esm/SchemaEditor/Tree/PropertyTypeMenu.js.map +1 -0
  46. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts +42 -0
  47. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts.map +1 -0
  48. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.js +12 -0
  49. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.js.map +1 -0
  50. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts +60 -0
  51. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts.map +1 -0
  52. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.js +4 -0
  53. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.js.map +1 -0
  54. package/dist/esm/SchemaEditor/Tree/SchemaPropertyContext.d.ts +13 -0
  55. package/dist/esm/SchemaEditor/Tree/SchemaPropertyContext.d.ts.map +1 -0
  56. package/dist/esm/SchemaEditor/Tree/SchemaPropertyContext.js +4 -0
  57. package/dist/esm/SchemaEditor/Tree/SchemaPropertyContext.js.map +1 -0
  58. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.d.ts +13 -0
  59. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.d.ts.map +1 -0
  60. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js +107 -0
  61. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js.map +1 -0
  62. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRowState.d.ts +16 -0
  63. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRowState.d.ts.map +1 -0
  64. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRowState.js +4 -0
  65. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRowState.js.map +1 -0
  66. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts +116 -0
  67. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts.map +1 -0
  68. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js +96 -0
  69. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js.map +1 -0
  70. package/dist/esm/SchemaEditor/Tree/propertyNaming.d.ts +35 -0
  71. package/dist/esm/SchemaEditor/Tree/propertyNaming.d.ts.map +1 -0
  72. package/dist/esm/SchemaEditor/Tree/propertyNaming.js +34 -0
  73. package/dist/esm/SchemaEditor/Tree/propertyNaming.js.map +1 -0
  74. package/dist/esm/SchemaEditor/Tree/propertyTree.d.ts +30 -0
  75. package/dist/esm/SchemaEditor/Tree/propertyTree.d.ts.map +1 -0
  76. package/dist/esm/SchemaEditor/Tree/propertyTree.js +36 -0
  77. package/dist/esm/SchemaEditor/Tree/propertyTree.js.map +1 -0
  78. package/dist/esm/SchemaEditor/Tree/propertyTypeDisplay.d.ts +20 -0
  79. package/dist/esm/SchemaEditor/Tree/propertyTypeDisplay.d.ts.map +1 -0
  80. package/dist/esm/SchemaEditor/Tree/propertyTypeDisplay.js +34 -0
  81. package/dist/esm/SchemaEditor/Tree/propertyTypeDisplay.js.map +1 -0
  82. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts +95 -0
  83. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts.map +1 -0
  84. package/dist/esm/SchemaEditor/Tree/schemaConversion.js +171 -0
  85. package/dist/esm/SchemaEditor/Tree/schemaConversion.js.map +1 -0
  86. package/dist/esm/SchemaEditor/TypeCell.d.ts +3 -1
  87. package/dist/esm/SchemaEditor/TypeCell.d.ts.map +1 -1
  88. package/dist/esm/SchemaEditor/TypeCell.js +2 -2
  89. package/dist/esm/SchemaEditor/TypeCell.js.map +1 -1
  90. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.d.ts +9 -0
  91. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.d.ts.map +1 -0
  92. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js +51 -0
  93. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js.map +1 -0
  94. package/dist/esm/SchemaEditor/index.d.ts +12 -0
  95. package/dist/esm/SchemaEditor/index.d.ts.map +1 -1
  96. package/dist/esm/SchemaEditor/index.js +7 -1
  97. package/dist/esm/SchemaEditor/index.js.map +1 -1
  98. package/dist/esm/SchemaEditor/resolveSchemaEditorLabels.d.ts +4 -0
  99. package/dist/esm/SchemaEditor/resolveSchemaEditorLabels.d.ts.map +1 -0
  100. package/dist/esm/SchemaEditor/resolveSchemaEditorLabels.js +13 -0
  101. package/dist/esm/SchemaEditor/resolveSchemaEditorLabels.js.map +1 -0
  102. package/dist/esm/styles.SchemaEditor.css +391 -0
  103. package/dist/esm/styles.css +391 -0
  104. package/dist/esm/types/parts.d.ts +25 -0
  105. package/dist/esm/types/parts.d.ts.map +1 -1
  106. package/dist/esm/types/parts.js +25 -0
  107. package/dist/esm/types/parts.js.map +1 -1
  108. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from '../Common/Button';\nimport { DataTableCore } from '../DataTables/DataTableCore';\nimport { Column } from '../DataTables/Column';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport { Tooltip } from '../Common/Tooltip';\nimport { Message } from '../Display/Message';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport type { JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { type TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport { validatePropertyName, buildBreadcrumbItems } from './schemaHelpers';\n\n/**\n * User-facing strings for {@link SchemaEditor}. Every field is optional; pass a\n * partial `labels` to override any of them (for localization). Omitted fields\n * fall back to {@link defaultSchemaEditorLabels} (English).\n */\nexport interface SchemaEditorLabels {\n /** Menu action that enters edit mode. */\n edit: string;\n /** Menu action that saves changes. */\n save: string;\n /** Menu action that cancels editing. */\n cancel: string;\n /** Menu action that adds a property. */\n addProperty: string;\n /** Accessible name for the action menubar. */\n actions: string;\n /** Accessible name and tooltip for the back button. */\n navigateBack: string;\n /** Shown when the schema has no properties. */\n emptyMessage: string;\n /** Accessible name for the \"drill into array item definition\" button. */\n navigateToItemDefinition: string;\n /** Accessible name for the \"drill into object properties\" button. */\n navigateToProperties: string;\n /** Accessible name for a property-name input. */\n propertyName: string;\n /** Accessible name for a property-type selector. */\n propertyType: string;\n /** Accessible name for an array item-type selector. */\n arrayItemType: string;\n /** Accessible name for the \"remove property\" button. */\n deleteProperty: string;\n /** Validation message shown when the schema cannot be represented as valid JSON. */\n invalidJson: string;\n}\n\n/** English defaults for {@link SchemaEditorLabels}. */\nexport const defaultSchemaEditorLabels: SchemaEditorLabels = {\n edit: 'Edit',\n save: 'Save',\n cancel: 'Cancel',\n addProperty: 'Add Property',\n actions: 'Actions',\n navigateBack: 'Navigate back',\n emptyMessage: 'No properties defined',\n navigateToItemDefinition: 'Navigate to item definition',\n navigateToProperties: 'Navigate to object properties',\n propertyName: 'Property name',\n propertyType: 'Property type',\n arrayItemType: 'Array item type',\n deleteProperty: 'Delete property',\n invalidJson: 'The schema must contain valid JSON before it can be edited.',\n};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/**\n * Recursively validates that a parsed schema node, its required names, and every nested\n * `properties`, `definitions`, and `items` schema match the supported object shape. A JSON-valid\n * document can still contain malformed nested values (for example `properties.foo: null`,\n * `required: {}`, or `items: \"string\"`) that later code dereferences as schema data; those are\n * rejected here rather than crashing downstream.\n */\nconst isValidSchemaNode = (node: unknown): node is JsonSchema => {\n if (!isPlainObject(node)) {\n return false;\n }\n\n if (\n node.required !== undefined &&\n (!Array.isArray(node.required) ||\n !node.required.every((propertyName) => typeof propertyName === 'string'))\n ) {\n return false;\n }\n\n for (const nestedSchemas of [node.properties, node.definitions]) {\n if (nestedSchemas === undefined) continue;\n if (!isPlainObject(nestedSchemas)) return false;\n for (const nestedSchema of Object.values(nestedSchemas)) {\n if (!isValidSchemaNode(nestedSchema)) return false;\n }\n }\n\n if (node.items !== undefined && !isValidSchemaNode(node.items)) {\n return false;\n }\n\n return true;\n};\n\nconst cloneSchema = (schema: JsonSchema): JsonSchema | undefined => {\n try {\n const serializedSchema = JSON.stringify(schema);\n if (serializedSchema === undefined) return undefined;\n\n const parsedSchema: unknown = JSON.parse(serializedSchema);\n if (!isValidSchemaNode(parsedSchema)) {\n return undefined;\n }\n\n return parsedSchema;\n } catch {\n return undefined;\n }\n};\n\nconst asJsonSchema = (property: JsonSchemaProperty): JsonSchema => {\n // SAFETY: A nested \"object\" property has the same editable shape as a schema —\n // `properties`, `items`, and `required` all mean the same thing on both types.\n return property as unknown as JsonSchema;\n};\n\nconst asJsonSchemaProperty = (schema: JsonSchema): JsonSchemaProperty => {\n // SAFETY: The inverse of asJsonSchema; the shapes are structurally interchangeable.\n return schema as unknown as JsonSchemaProperty;\n};\n\n/**\n * Props for {@link SchemaEditor}.\n */\nexport interface SchemaEditorProps {\n /** The JSON Schema being viewed or edited. */\n schema: JsonSchema;\n\n /** Optional event-type label displayed in the editor header. */\n eventTypeName?: string;\n\n /** When false, the Edit action remains visible but cannot enter edit mode; defaults to `true`. */\n canEdit?: boolean;\n\n /**\n * When {@link canEdit} is false, this string is shown as a tooltip on an\n * inert Edit action to explain why editing is unavailable.\n */\n canNotEditReason?: string;\n\n /** Invoked with the updated schema and optional metadata after any structural change. */\n onChange?: ChangeHandler<JsonSchema>;\n\n /** Invoked when the user activates the Save action. */\n onSave?: () => void;\n\n /** Invoked when the user activates the Cancel action. */\n onCancel?: () => void;\n\n /** Initial edit-mode state; defaults to `false` (read-only). */\n editMode?: boolean;\n\n /** When true, hides the Save menu item even while in edit mode. */\n saveDisabled?: boolean;\n\n /** When true, hides the Cancel menu item even while in edit mode. */\n cancelDisabled?: boolean;\n\n /**\n * Override the list of selectable type formats per JSON Schema type. Each\n * entry contributes options to the type-format dropdown shown in edit\n * mode. Defaults to {@link DEFAULT_TYPE_FORMATS}.\n */\n typeFormats?: TypeFormat[];\n\n /**\n * Extra CSS class names appended to the editor root. Combined with the\n * default `schema-editor` class. For fine-grained styling of internal\n * Components controls, use product tokens and stable Cratis parts.\n */\n className?: string;\n\n /** Override any user-facing string (for localization). See {@link SchemaEditorLabels}. */\n labels?: Partial<SchemaEditorLabels>;\n}\n\n/**\n * A breadcrumb-navigated editor for JSON Schemas. Lets users browse nested\n * `object` and `array` property definitions, add or remove properties, change\n * types and formats, and validate naming rules in place. Designed to drive\n * UIs around event payload schemas and similar structural documents.\n *\n * The editor composes a Cratis data table, action toolbar, and form widgets\n * internally. Restyle it through semantic tokens, the editor root `className`,\n * and documented `data-cratis-part` values rather than a provider preset.\n *\n * @param props - {@link SchemaEditorProps}.\n */\nexport const SchemaEditor = ({\n schema,\n eventTypeName = '',\n canEdit = true,\n canNotEditReason,\n onChange,\n onSave,\n onCancel,\n editMode,\n saveDisabled = false,\n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS,\n className,\n labels,\n}: SchemaEditorProps) => {\n const l = useMemo(() => ({ ...defaultSchemaEditorLabels, ...labels }), [labels]);\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [initialParsedSchema] = useState<JsonSchema | undefined>(() =>\n cloneSchema(schema),\n );\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(\n initialParsedSchema ?? {},\n );\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(\n initialParsedSchema ?? {},\n );\n const [schemaJsonIsInvalid, setSchemaJsonIsInvalid] = useState(\n initialParsedSchema === undefined,\n );\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validateAllProperties = useCallback(\n (properties: JsonSchemaProperty[]) => {\n const errors: Record<string, string> = {};\n\n properties.forEach((prop) => {\n const error = validatePropertyName(prop.name ?? '', prop.id!, properties);\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n },\n [validatePropertyName],\n );\n\n useEffect(() => {\n const parsedSchema = cloneSchema(schema);\n if (!parsedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n setSchemaJsonIsInvalid(false);\n setCurrentSchema(parsedSchema);\n setInitialSchema(parsedSchema);\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as\n JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n // A property's own `required` array (populated when its `type`\n // is \"object\") lists which of *its* properties are required.\n // It is scoped to this property alone — never to the parent\n // schema's `required` array — and is carried through verbatim\n // so navigating into it (see asJsonSchema) sees it intact.\n required: property.required,\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps);\n }\n };\n\n const updateSchemaAtPath = useCallback(\n (path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = cloneSchema(currentSchema);\n if (!newSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated, { source: 'user' });\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = asJsonSchema(targetSchema.properties[segment]);\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n const propertySchema = targetSchema.properties[lastSegment];\n targetSchema.properties[lastSegment] = asJsonSchemaProperty(\n updater(propertySchema ? asJsonSchema(propertySchema) : {}),\n );\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema, { source: 'user' });\n },\n [currentSchema, onChange],\n );\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const removeProperty = useCallback(\n (propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n\n // Deleting a property must also drop it from this schema's own\n // `required` array, or the array keeps naming a property that no\n // longer exists in `properties`.\n const updated: JsonSchema = { ...schema, properties: newProps };\n if (schema.required?.includes(propertyName)) {\n updated.required = schema.required.filter(\n (name) => name !== propertyName,\n );\n }\n\n return updated;\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const updateProperty = useCallback(\n (\n oldName: string,\n field: keyof JsonSchemaProperty,\n value: unknown,\n additionalUpdates?: Partial<JsonSchemaProperty>,\n ) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n let newRequired = schema.required;\n\n if (field === 'name') {\n const newName = value as string;\n if (newName !== oldName && !newProps[newName]) {\n newProps[newName] = prop;\n delete newProps[oldName];\n\n // Renaming a required property must keep the `required`\n // array pointing at the new name, or it goes stale and\n // silently references a property that no longer exists.\n if (schema.required?.includes(oldName)) {\n newRequired = schema.required.map((name) =>\n name === oldName ? newName : name,\n );\n }\n }\n } else if (field === 'type') {\n prop.type = value as string;\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n // Only an \"object\" property has a meaningful `required`\n // array of its own; any prior one is now stale.\n delete prop.required;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n // Starting fresh with empty `properties`, so any prior\n // `required` array (naming properties that no longer\n // exist here) would be stale.\n delete prop.required;\n } else {\n delete prop.items;\n delete prop.properties;\n delete prop.required;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps, required: newRequired };\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const updateArrayItemType = useCallback(\n (propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const navigateToProperty = useCallback(\n (propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n },\n [currentPath],\n );\n\n const navigateToArrayItems = useCallback(\n (propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n },\n [currentPath],\n );\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback(\n (index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n },\n [currentPath, eventTypeName],\n );\n\n const handleSave = useCallback(() => {\n if (schemaJsonIsInvalid) return;\n\n onSave?.();\n setIsEditMode(false);\n }, [onSave, schemaJsonIsInvalid]);\n\n const handleCancel = useCallback(() => {\n const restoredSchema = cloneSchema(initialSchema);\n const changedSchema = cloneSchema(initialSchema);\n if (!restoredSchema || !changedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n const hasChanges = JSON.stringify(currentSchema) !== JSON.stringify(initialSchema);\n setCurrentSchema(restoredSchema);\n if (hasChanges) {\n onChange?.(changedSchema, { source: 'reset' });\n }\n setIsEditMode(false);\n onCancel?.();\n }, [currentSchema, initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n if (schemaJsonIsInvalid) return;\n\n const parsedSchema = cloneSchema(currentSchema);\n if (!parsedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n setInitialSchema(parsedSchema);\n setIsEditMode(true);\n }, [currentSchema, schemaJsonIsInvalid]);\n\n const getBreadcrumbItems = () => buildBreadcrumbItems(eventTypeName, currentPath);\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as\n JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors =\n schemaJsonIsInvalid || Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo<ActionMenuItem[]>(\n () => [\n ...(isEditMode\n ? []\n : [\n {\n label: l.edit,\n icon: <faIcons.FaPencil className='cratis:mr-2' />,\n command:\n canEdit && !schemaJsonIsInvalid ? handleEdit : undefined,\n disabled: schemaJsonIsInvalid,\n className: canEdit ? undefined : 'edit-disabled-with-reason',\n template:\n !canEdit && canNotEditReason\n ? (item: ActionMenuItem) => (\n <Tooltip\n content={canNotEditReason}\n position='bottom'\n >\n <button\n type='button'\n aria-disabled='true'\n style={{\n border: 0,\n background: 'transparent',\n color: 'inherit',\n cursor: 'not-allowed',\n opacity: 0.6,\n display: 'inline-flex',\n alignItems: 'center',\n padding: '0.5rem 0.75rem',\n }}\n >\n {item.icon}\n <span>{item.label}</span>\n </button>\n </Tooltip>\n )\n : undefined,\n },\n ]),\n ...(isEditMode\n ? [\n ...(saveDisabled\n ? []\n : [\n {\n label: l.save,\n icon: <faIcons.FaCheck className='cratis:mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors,\n },\n ]),\n ...(cancelDisabled\n ? []\n : [\n {\n label: l.cancel,\n icon: <faIcons.FaXmark className='cratis:mr-2' />,\n command: handleCancel,\n },\n ]),\n {\n label: l.addProperty,\n icon: <faIcons.FaPlus className='cratis:mr-2' />,\n command: schemaJsonIsInvalid ? undefined : addProperty,\n disabled: schemaJsonIsInvalid,\n },\n ]\n : []),\n ],\n [\n isEditMode,\n handleSave,\n handleCancel,\n handleEdit,\n addProperty,\n canEdit,\n canNotEditReason,\n hasValidationErrors,\n schemaJsonIsInvalid,\n saveDisabled,\n cancelDisabled,\n l,\n ],\n );\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n\n return (\n <div\n className={className ? `schema-editor ${className}` : 'schema-editor'}\n style={{ display: 'flex', flexDirection: 'column', height: '100%' }}\n >\n <div className='cratis:px-4 cratis:py-4'>\n <div className='schema-editor-menubar'>\n <ActionMenubar aria-label={l.actions} model={menuItems} />\n </div>\n {schemaJsonIsInvalid && (\n <Message\n severity='error'\n text={l.invalidJson}\n className='cratis:mt-3'\n />\n )}\n </div>\n\n <div className='cratis:px-4 cratis:py-2 cratis-schema-editor-bottom-border'>\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Tooltip content={l.navigateBack} position='top'>\n <Button\n variant='ghost'\n size='small'\n icon={<faIcons.FaArrowLeft />}\n onClick={navigateBack}\n disabled={isAtRoot}\n aria-label={l.navigateBack}\n />\n </Tooltip>\n <div\n style={{\n fontSize: '0.9rem',\n color: 'var(--cratis-text-color-secondary)',\n cursor: 'pointer',\n }}\n >\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className='cratis:mx-2'>&gt;</span>}\n <button\n type='button'\n onClick={() => navigateToBreadcrumb(index)}\n aria-current={\n index === breadcrumbItems.length - 1\n ? 'location'\n : undefined\n }\n style={{\n padding: 0,\n border: 0,\n background: 'transparent',\n color: 'inherit',\n font: 'inherit',\n cursor: 'pointer',\n textDecoration:\n index < breadcrumbItems.length - 1\n ? 'underline'\n : 'none',\n }}\n >\n {item.name}\n </button>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div\n style={{\n fontSize: '0.875rem',\n color: 'var(--cratis-text-color-secondary)',\n marginTop: '0.5rem',\n marginLeft: '2.5rem',\n fontStyle: 'italic',\n display: 'flex',\n alignItems: 'center',\n gap: '0.5rem',\n }}\n >\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <DataTableCore<JsonSchemaProperty>\n key={`${isEditMode}-${currentPath.join('/')}`}\n data={properties}\n dataKey='id'\n emptyMessage={l.emptyMessage}\n rowClassName={(rowData) => {\n if (\n !isEditMode &&\n (rowData.type === 'object' ||\n (rowData.type === 'array' &&\n rowData.items?.type === 'object'))\n ) {\n return 'cratis-schema-editor-navigable-row';\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (\n rowData.type === 'array' &&\n rowData.items?.type === 'object'\n ) {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n body: {\n style: {\n borderTop: '1px solid var(--cratis-surface-border)',\n },\n },\n }}\n >\n <Column\n field='name'\n header='Property'\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n propertyNameLabel={l.propertyName}\n />\n )}\n style={{ width: '30%' }}\n />\n <Column\n header='Type'\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n labels={l}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTableCore>\n </div>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;AAuDO,MAAM,yBAAyB,GAAuB;AACzD,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,MAAM,EAAE,QAAQ;AAChB,IAAA,WAAW,EAAE,cAAc;AAC3B,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,uBAAuB;AACrC,IAAA,wBAAwB,EAAE,6BAA6B;AACvD,IAAA,oBAAoB,EAAE,+BAA+B;AACrD,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,YAAY,EAAE,eAAe;AAC7B,IAAA,aAAa,EAAE,iBAAiB;AAChC,IAAA,cAAc,EAAE,iBAAiB;AACjC,IAAA,WAAW,EAAE,6DAA6D;;AAG9E,MAAM,aAAa,GAAG,CAAC,KAAc,KACjC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK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wBAAA,IAAI,EAAE;AACF,4BAAA,KAAK,EAAE;AACH,gCAAA,SAAS,EAAE,wCAAwC;AACtD,6BAAA;AACJ,yBAAA;AACJ,qBAAA,EAAA,QAAA,EAAA,CAEDD,GAAA,CAAC,MAAM,EAAA,EACH,KAAK,EAAC,MAAM,EACZ,MAAM,EAAC,UAAU,EACjB,IAAI,EAAE,CAAC,OAA2B,MAC9BA,GAAA,CAAC,QAAQ,IACL,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,cAAc,EACxB,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAAC,EAAG,CAAC,EAC9C,iBAAiB,EAAE,CAAC,CAAC,YAAY,GACnC,CACL,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAA,CACzB,EACFA,GAAA,CAAC,MAAM,EAAA,EACH,MAAM,EAAC,MAAM,EACb,IAAI,EAAE,CAAC,OAA2B,MAC9BA,IAAC,QAAQ,EAAA,EACL,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,cAAc,EAChC,qBAAqB,EAAE,mBAAmB,EAC1C,oBAAoB,EAAE,kBAAkB,EACxC,sBAAsB,EAAE,oBAAoB,EAC5C,gBAAgB,EAAE,cAAc,EAChC,MAAM,EAAE,CAAC,EAAA,CACX,CACL,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAA,CACzB,CAAA,EAAA,EArEG,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAE,CAsEjC,EAAA,CACd,CAAA,EAAA,CACJ;AAEd;;"}
1
+ {"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from '../Common/Button';\nimport { Checkbox } from '../Common/Checkbox';\nimport { DataTableCore } from '../DataTables/DataTableCore';\nimport { Column } from '../DataTables/Column';\nimport { ActionMenubar, type ActionMenuItem } from '../Common/ActionMenubar';\nimport { Tooltip } from '../Common/Tooltip';\nimport { Message } from '../Display/Message';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport type { ReactNode } from 'react';\nimport type { ChangeHandler } from '../types/ChangeHandler';\nimport type { JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { type TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport { validatePropertyName, buildBreadcrumbItems } from './schemaHelpers';\nimport { defaultSchemaEditorLabels } from './defaultSchemaEditorLabels';\nimport type { SchemaEditorLabels } from './SchemaEditorLabels';\n\nimport type { SchemaEditorLayout } from './SchemaEditorLayout';\nimport type { Property } from './Tree/Property';\nimport { jsonSchemaToProperties, KEY_KEYWORD } from './Tree/schemaConversion';\nimport { TreeSchemaEditor, type TreeSchemaEditorProps } from './Tree/TreeSchemaEditor';\n\nexport { defaultSchemaEditorLabels };\nexport type { SchemaEditorLabels };\n\n/** Properties of the tree layout the table layout has no counterpart for. They are ignored when `layout` is `'table'`. */\ntype TreeOnlyProps = Omit<\n TreeSchemaEditorProps,\n | 'schema'\n | 'onChange'\n | 'labels'\n | 'className'\n | 'allowKeyProperty'\n | 'allowRequired'\n | 'readOnly'\n | 'isPropertyProtected'\n | 'validatePropertyName'\n | 'onPropertyRemoved'\n | 'onPropertyRenamed'\n | 'header'\n | 'footer'\n>;\n\nconst emptySchema: JsonSchema = {};\n\nconst isPlainObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/**\n * Recursively validates that a parsed schema node, its required names, and every nested\n * `properties`, `definitions`, and `items` schema match the supported object shape. A JSON-valid\n * document can still contain malformed nested values (for example `properties.foo: null`,\n * `required: {}`, or `items: \"string\"`) that later code dereferences as schema data; those are\n * rejected here rather than crashing downstream.\n */\nconst isValidSchemaNode = (node: unknown): node is JsonSchema => {\n if (!isPlainObject(node)) {\n return false;\n }\n\n if (\n node.required !== undefined &&\n (!Array.isArray(node.required) ||\n !node.required.every((propertyName) => typeof propertyName === 'string'))\n ) {\n return false;\n }\n\n for (const nestedSchemas of [node.properties, node.definitions]) {\n if (nestedSchemas === undefined) continue;\n if (!isPlainObject(nestedSchemas)) return false;\n for (const nestedSchema of Object.values(nestedSchemas)) {\n if (!isValidSchemaNode(nestedSchema)) return false;\n }\n }\n\n if (node.items !== undefined && !isValidSchemaNode(node.items)) {\n return false;\n }\n\n return true;\n};\n\nconst cloneSchema = (schema: JsonSchema): JsonSchema | undefined => {\n try {\n const serializedSchema = JSON.stringify(schema);\n if (serializedSchema === undefined) return undefined;\n\n const parsedSchema: unknown = JSON.parse(serializedSchema);\n if (!isValidSchemaNode(parsedSchema)) {\n return undefined;\n }\n\n return parsedSchema;\n } catch {\n return undefined;\n }\n};\n\n/** Follows a drill-down path (property names and `$items`) to the schema it points at. */\nconst findSchemaAtPath = (root: JsonSchema, path: string[]): JsonSchema | undefined => {\n let target: JsonSchema | JsonSchemaProperty = root;\n for (const segment of path) {\n if (target.type === 'array' && segment === '$items') {\n target = target.items || {};\n } else if (target.properties && target.properties[segment]) {\n target = target.properties[segment];\n } else {\n return undefined;\n }\n }\n return target as unknown as JsonSchema;\n};\n\nconst asJsonSchema = (property: JsonSchemaProperty): JsonSchema => {\n // SAFETY: A nested \"object\" property has the same editable shape as a schema —\n // `properties`, `items`, and `required` all mean the same thing on both types.\n return property as unknown as JsonSchema;\n};\n\nconst asJsonSchemaProperty = (schema: JsonSchema): JsonSchemaProperty => {\n // SAFETY: The inverse of asJsonSchema; the shapes are structurally interchangeable.\n return schema as unknown as JsonSchemaProperty;\n};\n\n/**\n * Props for {@link SchemaEditor}.\n */\nexport interface SchemaEditorProps extends TreeOnlyProps {\n /**\n * Which editor to render. `'table'` (the default) is the breadcrumb-navigated table with an Edit, Save and\n * Cancel workflow; `'tree'` is the inline tree editor that applies every edit live. See the layout notes in\n * the documentation for the props each layout honors.\n */\n layout?: SchemaEditorLayout;\n\n /**\n * The JSON Schema being viewed or edited. Required unless the tree layout is controlled through\n * `properties`.\n */\n schema?: JsonSchema;\n\n /** Optional event-type label displayed in the editor header. */\n eventTypeName?: string;\n\n /** When false, the Edit action remains visible but cannot enter edit mode; defaults to `true`. */\n canEdit?: boolean;\n\n /**\n * When {@link canEdit} is false, this string is shown as a tooltip on an\n * inert Edit action to explain why editing is unavailable.\n */\n canNotEditReason?: string;\n\n /** Invoked with the updated schema and optional metadata after any structural change. */\n onChange?: ChangeHandler<JsonSchema>;\n\n /** Invoked when the user activates the Save action. */\n onSave?: () => void;\n\n /** Invoked when the user activates the Cancel action. */\n onCancel?: () => void;\n\n /** Initial edit-mode state; defaults to `false` (read-only). */\n editMode?: boolean;\n\n /** When true, hides the Save menu item even while in edit mode. */\n saveDisabled?: boolean;\n\n /** When true, hides the Cancel menu item even while in edit mode. */\n cancelDisabled?: boolean;\n\n /**\n * Override the list of selectable type formats per JSON Schema type. Each\n * entry contributes options to the type-format dropdown shown in edit\n * mode. Defaults to {@link DEFAULT_TYPE_FORMATS}.\n */\n typeFormats?: TypeFormat[];\n\n /**\n * Extra CSS class names appended to the editor root. Combined with the\n * default `schema-editor` class. For fine-grained styling of internal\n * Components controls, use product tokens and stable Cratis parts.\n */\n className?: string;\n\n /** Override any user-facing string (for localization). See {@link SchemaEditorLabels}. */\n labels?: Partial<SchemaEditorLabels>;\n\n /**\n * Offers the key toggle (`x-key`, at most one property per object). In the table layout this adds a Key\n * column, editable in edit mode; a function enables the column for every row. In the tree layout it is\n * offered on every property, or per property when a function is given.\n */\n allowKeyProperty?: TreeSchemaEditorProps['allowKeyProperty'];\n\n /**\n * Offers the toggle for whether a property must be present (the `required` list). In the table layout this\n * adds a Required column, editable in edit mode.\n */\n allowRequired?: boolean;\n\n /** Offers no edits at all. Tree layout only: the table layout is read-only until Edit is chosen, controlled by `canEdit`. */\n readOnly?: boolean;\n\n /** Decides which properties can be neither renamed nor removed. By default none. Both layouts. */\n isPropertyProtected?: (property: Property) => boolean;\n\n /**\n * Extra check of a new name, after the editor has rejected blank, reserved and duplicate names. Return the\n * message to show, or `undefined` to accept the name. Both layouts.\n */\n validatePropertyName?: (name: string, property: Property, siblings: Property[]) => string | undefined;\n\n /** Called after a property was removed, with the property and everything nested under it. Both layouts. */\n onPropertyRemoved?: (property: Property) => void;\n\n /** Called after a property was renamed, with the renamed property and the name it had. Both layouts. */\n onPropertyRenamed?: (property: Property, previousName: string) => void;\n\n /** Content above the editor, for example the title of the schema. Both layouts. */\n header?: ReactNode;\n\n /** Content below the properties, for example further actions. Both layouts. */\n footer?: ReactNode;\n}\n\n/**\n * A breadcrumb-navigated editor for JSON Schemas. Lets users browse nested\n * `object` and `array` property definitions, add or remove properties, change\n * types and formats, and validate naming rules in place. Designed to drive\n * UIs around event payload schemas and similar structural documents.\n *\n * The editor composes a Cratis data table, action toolbar, and form widgets\n * internally. Restyle it through semantic tokens, the editor root `className`,\n * and documented `data-cratis-part` values rather than a provider preset.\n *\n * @param props - {@link SchemaEditorProps}.\n */\nconst TableSchemaEditor = ({\n schema: suppliedSchema,\n eventTypeName = '',\n canEdit = true,\n canNotEditReason,\n onChange,\n onSave,\n onCancel,\n editMode,\n saveDisabled = false,\n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS,\n className,\n labels,\n allowKeyProperty,\n allowRequired,\n isPropertyProtected,\n validatePropertyName: validateCustomPropertyName,\n onPropertyRemoved,\n onPropertyRenamed,\n header,\n footer,\n}: SchemaEditorProps) => {\n const schema = suppliedSchema ?? emptySchema;\n const l = useMemo(() => ({ ...defaultSchemaEditorLabels, ...labels }) as Required<SchemaEditorLabels>, [labels]);\n const showKey = allowKeyProperty !== undefined && allowKeyProperty !== false;\n const showRequired = allowRequired === true;\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [initialParsedSchema] = useState<JsonSchema | undefined>(() =>\n cloneSchema(schema),\n );\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(\n initialParsedSchema ?? {},\n );\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(\n initialParsedSchema ?? {},\n );\n const [schemaJsonIsInvalid, setSchemaJsonIsInvalid] = useState(\n initialParsedSchema === undefined,\n );\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validateAllProperties = useCallback(\n (properties: JsonSchemaProperty[], level: Property[] = []) => {\n const errors: Record<string, string> = {};\n\n properties.forEach((prop) => {\n let error = validatePropertyName(prop.name ?? '', prop.id!, properties);\n if (!error && validateCustomPropertyName) {\n const property = level.find((candidate) => candidate.name === prop.name);\n if (property) {\n error = validateCustomPropertyName(property.name, property, level);\n }\n }\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n },\n [validatePropertyName, validateCustomPropertyName],\n );\n\n useEffect(() => {\n const parsedSchema = cloneSchema(schema);\n if (!parsedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n setSchemaJsonIsInvalid(false);\n setCurrentSchema(parsedSchema);\n setInitialSchema(parsedSchema);\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as\n JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n // A property's own `required` array (populated when its `type`\n // is \"object\") lists which of *its* properties are required.\n // It is scoped to this property alone — never to the parent\n // schema's `required` array — and is carried through verbatim\n // so navigating into it (see asJsonSchema) sees it intact.\n required: property.required,\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps, jsonSchemaToProperties(targetSchema as unknown as JsonSchema));\n }\n };\n\n const updateSchemaAtPath = useCallback(\n (path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = cloneSchema(currentSchema);\n if (!newSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated, { source: 'user' });\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = asJsonSchema(targetSchema.properties[segment]);\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n const propertySchema = targetSchema.properties[lastSegment];\n targetSchema.properties[lastSegment] = asJsonSchemaProperty(\n updater(propertySchema ? asJsonSchema(propertySchema) : {}),\n );\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema, { source: 'user' });\n },\n [currentSchema, onChange],\n );\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n /** The editable view of the properties at the current path, for the host callbacks. */\n const getLevelProperties = useCallback(\n () => jsonSchemaToProperties(findSchemaAtPath(currentSchema, currentPath)),\n [currentSchema, currentPath],\n );\n\n const isProtected = useCallback(\n (propertyName: string) => {\n if (!isPropertyProtected) return false;\n const property = getLevelProperties().find((candidate) => candidate.name === propertyName);\n return property !== undefined && isPropertyProtected(property);\n },\n [isPropertyProtected, getLevelProperties],\n );\n\n const removeProperty = useCallback(\n (propertyName: string) => {\n const removed = getLevelProperties().find((candidate) => candidate.name === propertyName);\n if (removed && isPropertyProtected?.(removed)) return;\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n\n // Deleting a property must also drop it from this schema's own\n // `required` array, or the array keeps naming a property that no\n // longer exists in `properties`.\n const updated: JsonSchema = { ...schema, properties: newProps };\n if (schema.required?.includes(propertyName)) {\n updated.required = schema.required.filter(\n (name) => name !== propertyName,\n );\n }\n\n return updated;\n });\n if (removed) onPropertyRemoved?.(removed);\n },\n [currentPath, updateSchemaAtPath, getLevelProperties, isPropertyProtected, onPropertyRemoved],\n );\n\n const setRequired = useCallback(\n (propertyName: string, isRequired: boolean) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const others = (schema.required ?? []).filter((name) => name !== propertyName);\n const required = isRequired ? [...others, propertyName] : others;\n const updated: JsonSchema = { ...schema };\n if (required.length > 0) {\n updated.required = required;\n } else {\n delete updated.required;\n }\n return updated;\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const setKey = useCallback(\n (propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps: Record<string, JsonSchemaProperty> = {};\n for (const [name, property] of Object.entries(schema.properties || {})) {\n const { [KEY_KEYWORD]: previousKey, ...rest } = property as JsonSchemaProperty & Record<string, unknown>;\n const makeKey = name === propertyName && previousKey !== true;\n newProps[name] = (makeKey ? { ...rest, [KEY_KEYWORD]: true } : rest) as JsonSchemaProperty;\n }\n return { ...schema, properties: newProps };\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const updateProperty = useCallback(\n (\n oldName: string,\n field: keyof JsonSchemaProperty,\n value: unknown,\n additionalUpdates?: Partial<JsonSchemaProperty>,\n ) => {\n let renamed: Property | undefined;\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n let newRequired = schema.required;\n\n if (field === 'name') {\n const newName = value as string;\n if (newName !== oldName && !newProps[newName] && !isProtected(oldName)) {\n renamed = jsonSchemaToProperties({ properties: { [newName]: prop } })[0];\n newProps[newName] = prop;\n delete newProps[oldName];\n\n // Renaming a required property must keep the `required`\n // array pointing at the new name, or it goes stale and\n // silently references a property that no longer exists.\n if (schema.required?.includes(oldName)) {\n newRequired = schema.required.map((name) =>\n name === oldName ? newName : name,\n );\n }\n }\n } else if (field === 'type') {\n prop.type = value as string;\n // A concept belongs to the type it was chosen for; the table offers no concepts.\n delete (prop as Record<string, unknown>)['x-concept'];\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n // Only an \"object\" property has a meaningful `required`\n // array of its own; any prior one is now stale.\n delete prop.required;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n // Starting fresh with empty `properties`, so any prior\n // `required` array (naming properties that no longer\n // exist here) would be stale.\n delete prop.required;\n } else {\n delete prop.items;\n delete prop.properties;\n delete prop.required;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps, required: newRequired };\n });\n if (renamed) onPropertyRenamed?.(renamed, oldName);\n },\n [currentPath, updateSchemaAtPath, isProtected, onPropertyRenamed],\n );\n\n const updateArrayItemType = useCallback(\n (propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n },\n [currentPath, updateSchemaAtPath],\n );\n\n const navigateToProperty = useCallback(\n (propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n },\n [currentPath],\n );\n\n const navigateToArrayItems = useCallback(\n (propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n },\n [currentPath],\n );\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback(\n (index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n },\n [currentPath, eventTypeName],\n );\n\n const handleSave = useCallback(() => {\n if (schemaJsonIsInvalid) return;\n\n onSave?.();\n setIsEditMode(false);\n }, [onSave, schemaJsonIsInvalid]);\n\n const handleCancel = useCallback(() => {\n const restoredSchema = cloneSchema(initialSchema);\n const changedSchema = cloneSchema(initialSchema);\n if (!restoredSchema || !changedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n const hasChanges = JSON.stringify(currentSchema) !== JSON.stringify(initialSchema);\n setCurrentSchema(restoredSchema);\n if (hasChanges) {\n onChange?.(changedSchema, { source: 'reset' });\n }\n setIsEditMode(false);\n onCancel?.();\n }, [currentSchema, initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n if (schemaJsonIsInvalid) return;\n\n const parsedSchema = cloneSchema(currentSchema);\n if (!parsedSchema) {\n setSchemaJsonIsInvalid(true);\n return;\n }\n\n setInitialSchema(parsedSchema);\n setIsEditMode(true);\n }, [currentSchema, schemaJsonIsInvalid]);\n\n const getBreadcrumbItems = () => buildBreadcrumbItems(eventTypeName, currentPath);\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as\n JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors =\n schemaJsonIsInvalid || Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo<ActionMenuItem[]>(\n () => [\n ...(isEditMode\n ? []\n : [\n {\n label: l.edit,\n icon: <faIcons.FaPencil className='cratis:mr-2' />,\n command:\n canEdit && !schemaJsonIsInvalid ? handleEdit : undefined,\n disabled: schemaJsonIsInvalid,\n className: canEdit ? undefined : 'edit-disabled-with-reason',\n template:\n !canEdit && canNotEditReason\n ? (item: ActionMenuItem) => (\n <Tooltip\n content={canNotEditReason}\n position='bottom'\n >\n <button\n type='button'\n aria-disabled='true'\n style={{\n border: 0,\n background: 'transparent',\n color: 'inherit',\n cursor: 'not-allowed',\n opacity: 0.6,\n display: 'inline-flex',\n alignItems: 'center',\n padding: '0.5rem 0.75rem',\n }}\n >\n {item.icon}\n <span>{item.label}</span>\n </button>\n </Tooltip>\n )\n : undefined,\n },\n ]),\n ...(isEditMode\n ? [\n ...(saveDisabled\n ? []\n : [\n {\n label: l.save,\n icon: <faIcons.FaCheck className='cratis:mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors,\n },\n ]),\n ...(cancelDisabled\n ? []\n : [\n {\n label: l.cancel,\n icon: <faIcons.FaXmark className='cratis:mr-2' />,\n command: handleCancel,\n },\n ]),\n {\n label: l.addProperty,\n icon: <faIcons.FaPlus className='cratis:mr-2' />,\n command: schemaJsonIsInvalid ? undefined : addProperty,\n disabled: schemaJsonIsInvalid,\n },\n ]\n : []),\n ],\n [\n isEditMode,\n handleSave,\n handleCancel,\n handleEdit,\n addProperty,\n canEdit,\n canNotEditReason,\n hasValidationErrors,\n schemaJsonIsInvalid,\n saveDisabled,\n cancelDisabled,\n l,\n ],\n );\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n const currentLevel = findSchemaAtPath(currentSchema, currentPath);\n\n return (\n <div\n className={className ? `schema-editor ${className}` : 'schema-editor'}\n style={{ display: 'flex', flexDirection: 'column', height: '100%' }}\n >\n {header}\n <div className='cratis:px-4 cratis:py-4'>\n <div className='schema-editor-menubar'>\n <ActionMenubar aria-label={l.actions} model={menuItems} />\n </div>\n {schemaJsonIsInvalid && (\n <Message\n severity='error'\n text={l.invalidJson}\n className='cratis:mt-3'\n />\n )}\n </div>\n\n <div className='cratis:px-4 cratis:py-2 cratis-schema-editor-bottom-border'>\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Tooltip content={l.navigateBack} position='top'>\n <Button\n variant='ghost'\n size='small'\n icon={<faIcons.FaArrowLeft />}\n onClick={navigateBack}\n disabled={isAtRoot}\n aria-label={l.navigateBack}\n />\n </Tooltip>\n <div\n style={{\n fontSize: '0.9rem',\n color: 'var(--cratis-text-color-secondary)',\n cursor: 'pointer',\n }}\n >\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className='cratis:mx-2'>&gt;</span>}\n <button\n type='button'\n onClick={() => navigateToBreadcrumb(index)}\n aria-current={\n index === breadcrumbItems.length - 1\n ? 'location'\n : undefined\n }\n style={{\n padding: 0,\n border: 0,\n background: 'transparent',\n color: 'inherit',\n font: 'inherit',\n cursor: 'pointer',\n textDecoration:\n index < breadcrumbItems.length - 1\n ? 'underline'\n : 'none',\n }}\n >\n {item.name}\n </button>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div\n style={{\n fontSize: '0.875rem',\n color: 'var(--cratis-text-color-secondary)',\n marginTop: '0.5rem',\n marginLeft: '2.5rem',\n fontStyle: 'italic',\n display: 'flex',\n alignItems: 'center',\n gap: '0.5rem',\n }}\n >\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <DataTableCore<JsonSchemaProperty>\n key={`${isEditMode}-${currentPath.join('/')}`}\n data={properties}\n dataKey='id'\n emptyMessage={l.emptyMessage}\n rowClassName={(rowData) => {\n if (\n !isEditMode &&\n (rowData.type === 'object' ||\n (rowData.type === 'array' &&\n rowData.items?.type === 'object'))\n ) {\n return 'cratis-schema-editor-navigable-row';\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (\n rowData.type === 'array' &&\n rowData.items?.type === 'object'\n ) {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n body: {\n style: {\n borderTop: '1px solid var(--cratis-surface-border)',\n },\n },\n }}\n >\n <Column\n field='name'\n header='Property'\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n propertyNameLabel={l.propertyName}\n isLocked={isProtected(rowData.name ?? '')}\n lockedReason={l.protectedProperty}\n />\n )}\n style={{ width: '30%' }}\n />\n {showRequired && (\n <Column\n header={l.requiredColumn}\n body={(rowData: JsonSchemaProperty) => (\n <Checkbox\n aria-label={l.requiredProperty(rowData.name ?? '')}\n checked={Boolean(currentLevel?.required?.includes(rowData.name ?? ''))}\n readOnly={!isEditMode}\n onChange={(checked) => setRequired(rowData.name ?? '', checked)}\n />\n )}\n style={{ width: '6rem' }}\n />\n )}\n {showKey && (\n <Column\n header={l.keyColumn}\n body={(rowData: JsonSchemaProperty) => (\n <Checkbox\n aria-label={l.keyProperty(rowData.name ?? '')}\n checked={isKeyProperty(currentLevel, rowData.name ?? '')}\n readOnly={!isEditMode}\n onChange={() => setKey(rowData.name ?? '')}\n />\n )}\n style={{ width: '6rem' }}\n />\n )}\n <Column\n header='Type'\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n canRemove={!isProtected(rowData.name ?? '')}\n labels={l}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTableCore>\n </div>\n {footer}\n </div>\n );\n};\n\nconst isKeyProperty = (level: JsonSchema | undefined, propertyName: string): boolean =>\n (level?.properties?.[propertyName] as Record<string, unknown> | undefined)?.[KEY_KEYWORD] === true;\n\n/**\n * Edits the properties of a JSON Schema. By default (`layout='table'`) it is a breadcrumb-navigated table: it\n * lets users browse nested `object` and `array` property definitions, add or remove properties, change types and\n * formats, and validate naming rules in place, behind an Edit, Save and Cancel workflow. With `layout='tree'` it\n * is an inline tree that shows nested properties in place and applies every edit live. Designed to drive UIs\n * around event payload schemas and similar structural documents.\n *\n * Both layouts accept `allowRequired`, `allowKeyProperty`, `isPropertyProtected`, `validatePropertyName`,\n * `onPropertyRenamed`, `onPropertyRemoved`, `header` and `footer`. The tree layout also takes concepts, controlled\n * mode, per-row slots and selection; see the documentation for the exact split.\n *\n * The table layout composes a Cratis data table, action toolbar, and form widgets internally. Restyle it through\n * semantic tokens, the editor root `className`, and documented `data-cratis-part` values rather than a provider\n * preset.\n *\n * @param props - {@link SchemaEditorProps}.\n */\nexport const SchemaEditor = (props: SchemaEditorProps) =>\n props.layout === 'tree' ? <TreeSchemaEditor {...props} /> : <TableSchemaEditor {...props} />;\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;AAgDA,MAAM,WAAW,GAAe,EAAE;AAElC,MAAM,aAAa,GAAG,CAAC,KAAc,KACjC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;AASxE,MAAM,iBAAiB,GAAG,CAAC,IAAa,KAAwB;AAC5D,IAAA,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE;AACtB,QAAA,OAAO,KAAK;IAChB;AAEA,IAAA,IACI,IAAI,CAAC,QAAQ,KAAK,SAAS;SAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;AAC1B,YAAA,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,YAAY,KAAK,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,EAC/E;AACE,QAAA,OAAO,KAAK;IAChB;AAEA,IAAA,KAAK,MAAM,aAAa,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE;QAC7D,IAAI,aAAa,KAAK,SAAS;YAAE;AACjC,QAAA,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;AAAE,YAAA,OAAO,KAAK;QAC/C,KAAK,MAAM,YAAY,IAAI,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;AACrD,YAAA,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC;AAAE,gBAAA,OAAO,KAAK;QACtD;IACJ;AAEA,IAAA,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAA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EAAE,KAAK,EAAE,KAAK,EAAE,GACzB,CAAA,EAAA,EApGG,CAAA,EAAG,UAAU,CAAA,CAAA,EAAI,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAqGjC,EAAA,CACd,EACL,MAAM,CAAA,EAAA,CACL;AAEd,CAAC;AAED,MAAM,aAAa,GAAG,CAAC,KAA6B,EAAE,YAAoB,KACrE,KAAK,EAAE,UAAU,GAAG,YAAY,CAAyC,GAAG,WAAW,CAAC,KAAK,IAAI;AAmB/F,MAAM,YAAY,GAAG,CAAC,KAAwB,KACjD,KAAK,CAAC,MAAM,KAAK,MAAM,GAAGA,GAAA,CAAC,gBAAgB,EAAA,EAAA,GAAK,KAAK,EAAA,CAAI,GAAGA,GAAA,CAAC,iBAAiB,EAAA,EAAA,GAAK,KAAK;;"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * User-facing strings for {@link SchemaEditor}. Every field is optional; pass a
3
+ * partial `labels` to override any of them (for localization). Omitted fields
4
+ * fall back to {@link defaultSchemaEditorLabels} (English).
5
+ */
6
+ export interface SchemaEditorLabels {
7
+ /** Menu action that enters edit mode. */
8
+ edit: string;
9
+ /** Menu action that saves changes. */
10
+ save: string;
11
+ /** Menu action that cancels editing. */
12
+ cancel: string;
13
+ /** Menu action that adds a property. */
14
+ addProperty: string;
15
+ /** Accessible name for the action menubar. */
16
+ actions: string;
17
+ /** Accessible name and tooltip for the back button. */
18
+ navigateBack: string;
19
+ /** Shown when the schema has no properties. */
20
+ emptyMessage: string;
21
+ /** Accessible name for the "drill into array item definition" button. */
22
+ navigateToItemDefinition: string;
23
+ /** Accessible name for the "drill into object properties" button. */
24
+ navigateToProperties: string;
25
+ /** Accessible name for a property-name input. */
26
+ propertyName: string;
27
+ /** Accessible name for a property-type selector. */
28
+ propertyType: string;
29
+ /** Accessible name for an array item-type selector. */
30
+ arrayItemType: string;
31
+ /** Accessible name for the "remove property" button. */
32
+ deleteProperty: string;
33
+ /** Validation message shown when the schema cannot be represented as valid JSON. */
34
+ invalidJson: string;
35
+ /** Tree layout and capabilities: accessible name of the editor when the host supplies none. Default `Schema properties`. */
36
+ schema?: string;
37
+ /** Tree layout: accessible name of the button that adds a property to a nested object. */
38
+ addPropertyTo?: (propertyName: string) => string;
39
+ /** Tree layout: accessible name of the list of properties nested under a property. */
40
+ nestedProperties?: (propertyName: string) => string;
41
+ /** Tree layout: accessible name of the input used to rename a property. Receives the property's current name. */
42
+ propertyNameFor?: (propertyName: string) => string;
43
+ /** Tree layout: tooltip of the control that starts renaming a property. */
44
+ renameHint?: string;
45
+ /** Tree layout: accessible name of the button that removes a property. */
46
+ deletePropertyFor?: (propertyName: string) => string;
47
+ /** Tree layout: accessible name of the button that opens the menu of types; receives the current type's name. */
48
+ changeType?: (propertyName: string, typeName: string) => string;
49
+ /** Tree layout: accessible name of the menu of types. */
50
+ propertyTypes?: string;
51
+ /** Heading of the concepts in the menu of types. */
52
+ concepts?: string;
53
+ /** Disabled hint in the menu of types when concepts are enabled but none are defined. */
54
+ noConcepts?: string;
55
+ /** Visible text of the toggle for whether a property must be present (`allowRequired`). */
56
+ required?: string;
57
+ /** Accessible name of the toggle for whether a property must be present. */
58
+ requiredProperty?: (propertyName: string) => string;
59
+ /** Explains what the required toggle means. */
60
+ requiredHelp?: string;
61
+ /** Accessible name of the toggle that makes a property the key of its object (`allowKeyProperty`). */
62
+ keyProperty?: (propertyName: string) => string;
63
+ /** Tooltip of the key toggle while the property is not the key. */
64
+ setAsKey?: string;
65
+ /** Tooltip of the key toggle while the property is the key. */
66
+ isKey?: string;
67
+ /** Column header of the key column in the table layout. */
68
+ keyColumn?: string;
69
+ /** Column header of the required column in the table layout. */
70
+ requiredColumn?: string;
71
+ /** Why a property cannot be renamed or removed (`isPropertyProtected`). */
72
+ protectedProperty?: string;
73
+ /** Tree layout: validation message for a blank name. */
74
+ nameRequired?: string;
75
+ /** Tree layout: validation message for a name that would shadow a member every object inherits. */
76
+ nameReserved?: (name: string) => string;
77
+ /** Tree layout: validation message for a name a sibling already uses. */
78
+ nameDuplicate?: (name: string) => string;
79
+ /** Tree layout: name of the `string` type. */
80
+ typeString?: string;
81
+ /** Tree layout: name of the `number` type. */
82
+ typeNumber?: string;
83
+ /** Tree layout: name of the `boolean` type. */
84
+ typeBoolean?: string;
85
+ /** Tree layout: name of the `date` type. */
86
+ typeDate?: string;
87
+ /** Tree layout: name of the `time` type. */
88
+ typeTime?: string;
89
+ /** Tree layout: name of the list-of-text type. */
90
+ typeStringArray?: string;
91
+ /** Tree layout: name of the list-of-numbers type. */
92
+ typeNumberArray?: string;
93
+ /** Tree layout: name of the nested object type. */
94
+ typeObject?: string;
95
+ /** Tree layout: name of the list-of-objects type. */
96
+ typeObjectArray?: string;
97
+ }
98
+ //# sourceMappingURL=SchemaEditorLabels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaEditorLabels.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/SchemaEditorLabels.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,yEAAyE;IACzE,wBAAwB,EAAE,MAAM,CAAC;IACjC,qEAAqE;IACrE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,YAAY,EAAE,MAAM,CAAC;IACrB,oDAAoD;IACpD,YAAY,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,wDAAwD;IACxD,cAAc,EAAE,MA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A2E;IAC3E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mGAAmG;IACnG,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,yEAAyE;IACzE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACzC,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=SchemaEditorLabels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaEditorLabels.js","sourceRoot":"","sources":["../../../SchemaEditor/SchemaEditorLabels.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * User-facing strings for {@link SchemaEditor}. Every field is optional; pass a\n * partial `labels` to override any of them (for localization). Omitted fields\n * fall back to {@link defaultSchemaEditorLabels} (English).\n */\nexport interface SchemaEditorLabels {\n /** Menu action that enters edit mode. */\n edit: string;\n /** Menu action that saves changes. */\n save: string;\n /** Menu action that cancels editing. */\n cancel: string;\n /** Menu action that adds a property. */\n addProperty: string;\n /** Accessible name for the action menubar. */\n actions: string;\n /** Accessible name and tooltip for the back button. */\n navigateBack: string;\n /** Shown when the schema has no properties. */\n emptyMessage: string;\n /** Accessible name for the \"drill into array item definition\" button. */\n navigateToItemDefinition: string;\n /** Accessible name for the \"drill into object properties\" button. */\n navigateToProperties: string;\n /** Accessible name for a property-name input. */\n propertyName: string;\n /** Accessible name for a property-type selector. */\n propertyType: string;\n /** Accessible name for an array item-type selector. */\n arrayItemType: string;\n /** Accessible name for the \"remove property\" button. */\n deleteProperty: string;\n /** Validation message shown when the schema cannot be represented as valid JSON. */\n invalidJson: string;\n\n /** Tree layout and capabilities: accessible name of the editor when the host supplies none. Default `Schema properties`. */\n schema?: string;\n /** Tree layout: accessible name of the button that adds a property to a nested object. */\n addPropertyTo?: (propertyName: string) => string;\n /** Tree layout: accessible name of the list of properties nested under a property. */\n nestedProperties?: (propertyName: string) => string;\n /** Tree layout: accessible name of the input used to rename a property. Receives the property's current name. */\n propertyNameFor?: (propertyName: string) => string;\n /** Tree layout: tooltip of the control that starts renaming a property. */\n renameHint?: string;\n /** Tree layout: accessible name of the button that removes a property. */\n deletePropertyFor?: (propertyName: string) => string;\n /** Tree layout: accessible name of the button that opens the menu of types; receives the current type's name. */\n changeType?: (propertyName: string, typeName: string) => string;\n /** Tree layout: accessible name of the menu of types. */\n propertyTypes?: string;\n /** Heading of the concepts in the menu of types. */\n concepts?: string;\n /** Disabled hint in the menu of types when concepts are enabled but none are defined. */\n noConcepts?: string;\n /** Visible text of the toggle for whether a property must be present (`allowRequired`). */\n required?: string;\n /** Accessible name of the toggle for whether a property must be present. */\n requiredProperty?: (propertyName: string) => string;\n /** Explains what the required toggle means. */\n requiredHelp?: string;\n /** Accessible name of the toggle that makes a property the key of its object (`allowKeyProperty`). */\n keyProperty?: (propertyName: string) => string;\n /** Tooltip of the key toggle while the property is not the key. */\n setAsKey?: string;\n /** Tooltip of the key toggle while the property is the key. */\n isKey?: string;\n /** Column header of the key column in the table layout. */\n keyColumn?: string;\n /** Column header of the required column in the table layout. */\n requiredColumn?: string;\n /** Why a property cannot be renamed or removed (`isPropertyProtected`). */\n protectedProperty?: string;\n /** Tree layout: validation message for a blank name. */\n nameRequired?: string;\n /** Tree layout: validation message for a name that would shadow a member every object inherits. */\n nameReserved?: (name: string) => string;\n /** Tree layout: validation message for a name a sibling already uses. */\n nameDuplicate?: (name: string) => string;\n /** Tree layout: name of the `string` type. */\n typeString?: string;\n /** Tree layout: name of the `number` type. */\n typeNumber?: string;\n /** Tree layout: name of the `boolean` type. */\n typeBoolean?: string;\n /** Tree layout: name of the `date` type. */\n typeDate?: string;\n /** Tree layout: name of the `time` type. */\n typeTime?: string;\n /** Tree layout: name of the list-of-text type. */\n typeStringArray?: string;\n /** Tree layout: name of the list-of-numbers type. */\n typeNumberArray?: string;\n /** Tree layout: name of the nested object type. */\n typeObject?: string;\n /** Tree layout: name of the list-of-objects type. */\n typeObjectArray?: string;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Which editor a {@link SchemaEditor} renders. `'table'` is the breadcrumb-navigated table with an Edit, Save and
3
+ * Cancel workflow and the default; `'tree'` is the inline tree that applies every edit live.
4
+ */
5
+ export type SchemaEditorLayout = 'table' | 'tree';
6
+ //# sourceMappingURL=SchemaEditorLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaEditorLayout.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/SchemaEditorLayout.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,MAAM,CAAC"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=SchemaEditorLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaEditorLayout.js","sourceRoot":"","sources":["../../../SchemaEditor/SchemaEditorLayout.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * Which editor a {@link SchemaEditor} renders. `'table'` is the breadcrumb-navigated table with an Edit, Save and\n * Cancel workflow and the default; `'tree'` is the inline tree that applies every edit live.\n */\nexport type SchemaEditorLayout = 'table' | 'tree';\n"]}
@@ -0,0 +1,30 @@
1
+ import type { PropertyType } from './PropertyType.js';
2
+ /**
3
+ * One editable property of a schema. The editor works on a tree of these and converts to and from
4
+ * JSON Schema at its boundary.
5
+ */
6
+ export interface Property {
7
+ /**
8
+ * Identifies the property for the lifetime of an editor session. Ids are generated when a schema is
9
+ * converted into a tree, so they are not stable across sessions: persist the {@link Property.name},
10
+ * not the id.
11
+ */
12
+ id: string;
13
+ /** The name of the property; the key of the property in the JSON Schema object. */
14
+ name: string;
15
+ /** The kind of value the property holds. */
16
+ type: PropertyType;
17
+ /**
18
+ * The name of the concept this property is typed as, when it is typed as one rather than as a bare
19
+ * primitive. The concept wraps the primitive in {@link Property.type}, so everything that reasons about
20
+ * the type keeps working; the name is carried alongside because that is what the domain calls the value.
21
+ */
22
+ concept?: string;
23
+ /** The properties of a nested object, or of each item of an object list. */
24
+ children?: Property[];
25
+ /** Whether the property identifies its parent object. At most one property of an object is the key. */
26
+ isKey?: boolean;
27
+ /** Whether the property must be present in its parent object (membership in the JSON Schema `required` list). */
28
+ isRequired?: boolean;
29
+ }
30
+ //# sourceMappingURL=Property.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Property.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/Property.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACrB;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IAEb,4CAA4C;IAC5C,IAAI,EAAE,YAAY,CAAC;IAEnB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;IAEtB,uGAAuG;IACvG,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iHAAiH;IACjH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=Property.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Property.js","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/Property.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { PropertyType } from './PropertyType';\n\n/**\n * One editable property of a schema. The editor works on a tree of these and converts to and from\n * JSON Schema at its boundary.\n */\nexport interface Property {\n /**\n * Identifies the property for the lifetime of an editor session. Ids are generated when a schema is\n * converted into a tree, so they are not stable across sessions: persist the {@link Property.name},\n * not the id.\n */\n id: string;\n\n /** The name of the property; the key of the property in the JSON Schema object. */\n name: string;\n\n /** The kind of value the property holds. */\n type: PropertyType;\n\n /**\n * The name of the concept this property is typed as, when it is typed as one rather than as a bare\n * primitive. The concept wraps the primitive in {@link Property.type}, so everything that reasons about\n * the type keeps working; the name is carried alongside because that is what the domain calls the value.\n */\n concept?: string;\n\n /** The properties of a nested object, or of each item of an object list. */\n children?: Property[];\n\n /** Whether the property identifies its parent object. At most one property of an object is the key. */\n isKey?: boolean;\n\n /** Whether the property must be present in its parent object (membership in the JSON Schema `required` list). */\n isRequired?: boolean;\n}\n"]}
@@ -0,0 +1,15 @@
1
+ import type { PropertyType } from './PropertyType.js';
2
+ /**
3
+ * A concept the editor offers as the type of a property.
4
+ *
5
+ * A concept wraps exactly one primitive, so a property typed as a concept still behaves as that primitive
6
+ * everywhere — in the stored JSON Schema and in anything that reasons about the type. The concept is what
7
+ * the value is called in the domain, and that name is what travels with the property.
8
+ */
9
+ export interface PropertyConcept {
10
+ /** The name of the concept, as it is known in the domain. */
11
+ name: string;
12
+ /** The property type the concept's underlying primitive behaves as. */
13
+ type: PropertyType;
14
+ }
15
+ //# sourceMappingURL=PropertyConcept.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyConcept.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/PropertyConcept.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAEnD;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC5B,6DAA6D;IAC7D,IAAI,EAAE,MAAM,CAAC;IAEb,uEAAuE;IACvE,IAAI,EAAE,YAAY,CAAC;CACtB"}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Cratis. All rights reserved.
2
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
+ export {};
4
+ //# sourceMappingURL=PropertyConcept.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyConcept.js","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/PropertyConcept.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,qGAAqG","sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { PropertyType } from './PropertyType';\n\n/**\n * A concept the editor offers as the type of a property.\n *\n * A concept wraps exactly one primitive, so a property typed as a concept still behaves as that primitive\n * everywhere — in the stored JSON Schema and in anything that reasons about the type. The concept is what\n * the value is called in the domain, and that name is what travels with the property.\n */\nexport interface PropertyConcept {\n /** The name of the concept, as it is known in the domain. */\n name: string;\n\n /** The property type the concept's underlying primitive behaves as. */\n type: PropertyType;\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { PropertyConcept } from './PropertyConcept.js';
3
+ /** Props for the {@link PropertyConceptsProvider} component. */
4
+ export interface PropertyConceptsProviderProps {
5
+ /** The concepts the schema editors within this scope can type a property as. */
6
+ concepts: PropertyConcept[];
7
+ /** The scope the concepts are available in. */
8
+ children?: ReactNode;
9
+ }
10
+ /**
11
+ * Makes the concepts of the surrounding scope available to every {@link SchemaEditor} rendered inside it.
12
+ *
13
+ * The same set of concepts usually applies to every schema in an application, and the editors sit several
14
+ * components below whoever knows which concepts exist — so provide them once for the scope instead of
15
+ * threading a `concepts` prop through each editor. An editor's own `concepts` prop takes precedence.
16
+ */
17
+ export declare const PropertyConceptsProvider: ({ concepts, children }: PropertyConceptsProviderProps) => import("react").JSX.Element;
18
+ /** The concepts available as property types in the current scope. Empty when nothing provides them. */
19
+ export declare const usePropertyConcepts: () => PropertyConcept[];
20
+ /** The concepts of the current scope, or `undefined` when no provider is above — the host has not opted into concepts. */
21
+ export declare const useOptionalPropertyConcepts: () => PropertyConcept[] | undefined;
22
+ //# sourceMappingURL=PropertyConceptsContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyConceptsContext.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/PropertyConceptsContext.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAIzD,gEAAgE;AAChE,MAAM,WAAW,6BAA6B;IAC1C,gFAAgF;IAChF,QAAQ,EAAE,eAAe,EAAE,CAAC;IAE5B,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,CAAC;CACxB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,2BAA4B,6BAA6B,gCAE7F,CAAC;AAEF,uGAAuG;AACvG,eAAO,MAAM,mBAAmB,QAAO,eAAe,EAA+C,CAAC;AAEtG,0HAA0H;AAC1H,eAAO,MAAM,2BAA2B,QAAO,eAAe,EAAE,GAAG,SAAgD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext } from 'react';
3
+
4
+ const PropertyConceptsContext = createContext(undefined);
5
+ const PropertyConceptsProvider = ({ concepts, children }) => (jsx(PropertyConceptsContext.Provider, { value: concepts, children: children }));
6
+ const usePropertyConcepts = () => useContext(PropertyConceptsContext) ?? [];
7
+ const useOptionalPropertyConcepts = () => useContext(PropertyConceptsContext);
8
+
9
+ export { PropertyConceptsProvider, useOptionalPropertyConcepts, usePropertyConcepts };
10
+ //# sourceMappingURL=PropertyConceptsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyConceptsContext.js","sources":["../../../../SchemaEditor/Tree/PropertyConceptsContext.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { createContext, useContext, type ReactNode } from 'react';\nimport type { PropertyConcept } from './PropertyConcept';\n\nconst PropertyConceptsContext = createContext<PropertyConcept[] | undefined>(undefined);\n\n/** Props for the {@link PropertyConceptsProvider} component. */\nexport interface PropertyConceptsProviderProps {\n /** The concepts the schema editors within this scope can type a property as. */\n concepts: PropertyConcept[];\n\n /** The scope the concepts are available in. */\n children?: ReactNode;\n}\n\n/**\n * Makes the concepts of the surrounding scope available to every {@link SchemaEditor} rendered inside it.\n *\n * The same set of concepts usually applies to every schema in an application, and the editors sit several\n * components below whoever knows which concepts exist — so provide them once for the scope instead of\n * threading a `concepts` prop through each editor. An editor's own `concepts` prop takes precedence.\n */\nexport const PropertyConceptsProvider = ({ concepts, children }: PropertyConceptsProviderProps) => (\n <PropertyConceptsContext.Provider value={concepts}>{children}</PropertyConceptsContext.Provider>\n);\n\n/** The concepts available as property types in the current scope. Empty when nothing provides them. */\nexport const usePropertyConcepts = (): PropertyConcept[] => useContext(PropertyConceptsContext) ?? [];\n\n/** The concepts of the current scope, or `undefined` when no provider is above — the host has not opted into concepts. */\nexport const useOptionalPropertyConcepts = (): PropertyConcept[] | undefined => useContext(PropertyConceptsContext);\n"],"names":["_jsx"],"mappings":";;;AAMA,MAAM,uBAAuB,GAAG,aAAa,CAAgC,SAAS,CAAC;AAkBhF,MAAM,wBAAwB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAiC,MAC1FA,GAAA,CAAC,uBAAuB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,QAAQ,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAoC;AAI7F,MAAM,mBAAmB,GAAG,MAAyB,UAAU,CAAC,uBAAuB,CAAC,IAAI;AAG5F,MAAM,2BAA2B,GAAG,MAAqC,UAAU,CAAC,uBAAuB;;"}
@@ -0,0 +1,22 @@
1
+ /** The kinds of value a {@link Property} can hold. */
2
+ export declare enum PropertyType {
3
+ /** Text. */
4
+ String = "string",
5
+ /** A number, integer or fractional. */
6
+ Number = "number",
7
+ /** A true or false value. */
8
+ Boolean = "boolean",
9
+ /** A calendar date. */
10
+ Date = "date",
11
+ /** A time of day. */
12
+ Time = "time",
13
+ /** A nested object with its own properties. */
14
+ Object = "object",
15
+ /** A list of text values. */
16
+ StringArray = "stringArray",
17
+ /** A list of numbers. */
18
+ NumberArray = "numberArray",
19
+ /** A list of nested objects, each with the same properties. */
20
+ ObjectArray = "objectArray"
21
+ }
22
+ //# sourceMappingURL=PropertyType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PropertyType.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/PropertyType.ts"],"names":[],"mappings":"AAGA,sDAAsD;AACtD,oBAAY,YAAY;IACpB,YAAY;IACZ,MAAM,WAAW;IACjB,uCAAuC;IACvC,MAAM,WAAW;IACjB,6BAA6B;IAC7B,OAAO,YAAY;IACnB,uBAAuB;IACvB,IAAI,SAAS;IACb,qBAAqB;IACrB,IAAI,SAAS;IACb,+CAA+C;IAC/C,MAAM,WAAW;IACjB,6BAA6B;IAC7B,WAAW,gBAAgB;IAC3B,yBAAyB;IACzB,WAAW,gBAAgB;IAC3B,+DAA+D;IAC/D,WAAW,gBAAgB;CAC9B"}