@cratis/components 4.26.4 → 4.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/compat-manifest.json +11 -11
  2. package/dist/esm/Common/CratisComponentsProvider.d.ts +4 -0
  3. package/dist/esm/Common/CratisComponentsProvider.d.ts.map +1 -1
  4. package/dist/esm/Common/CratisComponentsProvider.js +1 -0
  5. package/dist/esm/Common/CratisComponentsProvider.js.map +1 -1
  6. package/dist/esm/DataPage/DataPage.d.ts +2 -0
  7. package/dist/esm/DataPage/DataPage.d.ts.map +1 -1
  8. package/dist/esm/DataPage/DataPage.js.map +1 -1
  9. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts +2 -0
  10. package/dist/esm/DataTables/DataTableForObservableQuery.d.ts.map +1 -1
  11. package/dist/esm/DataTables/DataTableForObservableQuery.js +1 -1
  12. package/dist/esm/DataTables/DataTableForObservableQuery.js.map +1 -1
  13. package/dist/esm/DataTables/DataTableForQuery.d.ts +2 -0
  14. package/dist/esm/DataTables/DataTableForQuery.d.ts.map +1 -1
  15. package/dist/esm/DataTables/DataTableForQuery.js +1 -1
  16. package/dist/esm/DataTables/DataTableForQuery.js.map +1 -1
  17. package/dist/esm/DataTables/PaginatorPageItem.d.ts +13 -0
  18. package/dist/esm/DataTables/PaginatorPageItem.d.ts.map +1 -0
  19. package/dist/esm/DataTables/PaginatorPageItem.js +4 -0
  20. package/dist/esm/DataTables/PaginatorPageItem.js.map +1 -0
  21. package/dist/esm/DataTables/TablePaginator.d.ts +22 -2
  22. package/dist/esm/DataTables/TablePaginator.d.ts.map +1 -1
  23. package/dist/esm/DataTables/TablePaginator.js.map +1 -1
  24. package/dist/esm/DataTables/TablePaginatorImplementation.d.ts +1 -1
  25. package/dist/esm/DataTables/TablePaginatorImplementation.d.ts.map +1 -1
  26. package/dist/esm/DataTables/TablePaginatorImplementation.js +8 -3
  27. package/dist/esm/DataTables/TablePaginatorImplementation.js.map +1 -1
  28. package/dist/esm/DataTables/TablePaginatorPages.d.ts +9 -0
  29. package/dist/esm/DataTables/TablePaginatorPages.d.ts.map +1 -0
  30. package/dist/esm/DataTables/TablePaginatorPages.js +20 -0
  31. package/dist/esm/DataTables/TablePaginatorPages.js.map +1 -0
  32. package/dist/esm/DataTables/index.d.ts +2 -0
  33. package/dist/esm/DataTables/index.d.ts.map +1 -1
  34. package/dist/esm/DataTables/index.js +1 -0
  35. package/dist/esm/DataTables/index.js.map +1 -1
  36. package/dist/esm/DataTables/paginatorPages.d.ts +15 -0
  37. package/dist/esm/DataTables/paginatorPages.d.ts.map +1 -0
  38. package/dist/esm/DataTables/paginatorPages.js +40 -0
  39. package/dist/esm/DataTables/paginatorPages.js.map +1 -0
  40. package/dist/esm/Filter/FilterGroup.d.ts +23 -0
  41. package/dist/esm/Filter/FilterGroup.d.ts.map +1 -0
  42. package/dist/esm/Filter/FilterGroup.js +51 -0
  43. package/dist/esm/Filter/FilterGroup.js.map +1 -0
  44. package/dist/esm/Filter/FilterPanel.d.ts.map +1 -1
  45. package/dist/esm/Filter/FilterPanel.js +24 -257
  46. package/dist/esm/Filter/FilterPanel.js.map +1 -1
  47. package/dist/esm/Filter/FilterSearchBox.d.ts +10 -0
  48. package/dist/esm/Filter/FilterSearchBox.d.ts.map +1 -0
  49. package/dist/esm/Filter/FilterSearchBox.js +10 -0
  50. package/dist/esm/Filter/FilterSearchBox.js.map +1 -0
  51. package/dist/esm/Filter/measurePanelPlacement.d.ts +31 -0
  52. package/dist/esm/Filter/measurePanelPlacement.d.ts.map +1 -0
  53. package/dist/esm/Filter/measurePanelPlacement.js +132 -0
  54. package/dist/esm/Filter/measurePanelPlacement.js.map +1 -0
  55. package/dist/esm/Filter/usePanelDismissal.d.ts +32 -0
  56. package/dist/esm/Filter/usePanelDismissal.d.ts.map +1 -0
  57. package/dist/esm/Filter/usePanelDismissal.js +63 -0
  58. package/dist/esm/Filter/usePanelDismissal.js.map +1 -0
  59. package/dist/esm/Filter/usePanelPosition.d.ts +24 -0
  60. package/dist/esm/Filter/usePanelPosition.d.ts.map +1 -0
  61. package/dist/esm/Filter/usePanelPosition.js +85 -0
  62. package/dist/esm/Filter/usePanelPosition.js.map +1 -0
  63. package/dist/esm/Filter/useResolvedAnchor.d.ts +17 -0
  64. package/dist/esm/Filter/useResolvedAnchor.d.ts.map +1 -0
  65. package/dist/esm/Filter/useResolvedAnchor.js +16 -0
  66. package/dist/esm/Filter/useResolvedAnchor.js.map +1 -0
  67. package/dist/esm/PivotViewer/PivotViewer.d.ts.map +1 -1
  68. package/dist/esm/PivotViewer/PivotViewer.js +47 -207
  69. package/dist/esm/PivotViewer/PivotViewer.js.map +1 -1
  70. package/dist/esm/PivotViewer/components/pivot/visibility.d.ts +1 -1
  71. package/dist/esm/PivotViewer/components/pivot/visibility.d.ts.map +1 -1
  72. package/dist/esm/PivotViewer/components/pivot/visibility.js +24 -222
  73. package/dist/esm/PivotViewer/components/pivot/visibility.js.map +1 -1
  74. package/dist/esm/PivotViewer/components/pivot/visibilityHelpers.d.ts +114 -0
  75. package/dist/esm/PivotViewer/components/pivot/visibilityHelpers.d.ts.map +1 -0
  76. package/dist/esm/PivotViewer/components/pivot/visibilityHelpers.js +306 -0
  77. package/dist/esm/PivotViewer/components/pivot/visibilityHelpers.js.map +1 -0
  78. package/dist/esm/PivotViewer/hooks/useColorCssVariables.d.ts +9 -0
  79. package/dist/esm/PivotViewer/hooks/useColorCssVariables.d.ts.map +1 -0
  80. package/dist/esm/PivotViewer/hooks/useColorCssVariables.js +32 -0
  81. package/dist/esm/PivotViewer/hooks/useColorCssVariables.js.map +1 -0
  82. package/dist/esm/PivotViewer/hooks/usePivotViewerGrouping.d.ts +27 -0
  83. package/dist/esm/PivotViewer/hooks/usePivotViewerGrouping.d.ts.map +1 -0
  84. package/dist/esm/PivotViewer/hooks/usePivotViewerGrouping.js +40 -0
  85. package/dist/esm/PivotViewer/hooks/usePivotViewerGrouping.js.map +1 -0
  86. package/dist/esm/PivotViewer/hooks/usePivotViewerInteractions.d.ts +27 -0
  87. package/dist/esm/PivotViewer/hooks/usePivotViewerInteractions.d.ts.map +1 -0
  88. package/dist/esm/PivotViewer/hooks/usePivotViewerInteractions.js +46 -0
  89. package/dist/esm/PivotViewer/hooks/usePivotViewerInteractions.js.map +1 -0
  90. package/dist/esm/PivotViewer/hooks/useRawGrouping.d.ts +22 -0
  91. package/dist/esm/PivotViewer/hooks/useRawGrouping.d.ts.map +1 -0
  92. package/dist/esm/PivotViewer/hooks/useRawGrouping.js +56 -0
  93. package/dist/esm/PivotViewer/hooks/useRawGrouping.js.map +1 -0
  94. package/dist/esm/PivotViewer/hooks/useScrollPositionTracking.d.ts +12 -0
  95. package/dist/esm/PivotViewer/hooks/useScrollPositionTracking.d.ts.map +1 -0
  96. package/dist/esm/PivotViewer/hooks/useScrollPositionTracking.js +20 -0
  97. package/dist/esm/PivotViewer/hooks/useScrollPositionTracking.js.map +1 -0
  98. package/dist/esm/PivotViewer/hooks/useViewerLayout.d.ts +16 -0
  99. package/dist/esm/PivotViewer/hooks/useViewerLayout.d.ts.map +1 -0
  100. package/dist/esm/PivotViewer/hooks/useViewerLayout.js +29 -0
  101. package/dist/esm/PivotViewer/hooks/useViewerLayout.js.map +1 -0
  102. package/dist/esm/PivotViewer/hooks/useVisibleIds.d.ts +21 -0
  103. package/dist/esm/PivotViewer/hooks/useVisibleIds.d.ts.map +1 -0
  104. package/dist/esm/PivotViewer/hooks/useVisibleIds.js +34 -0
  105. package/dist/esm/PivotViewer/hooks/useVisibleIds.js.map +1 -0
  106. package/dist/esm/SchemaEditor/SchemaEditor.d.ts +4 -1
  107. package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -1
  108. package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -1
  109. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts +6 -0
  110. package/dist/esm/SchemaEditor/SchemaEditorLabels.d.ts.map +1 -1
  111. package/dist/esm/SchemaEditor/SchemaEditorLabels.js.map +1 -1
  112. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.d.ts +11 -0
  113. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.d.ts.map +1 -0
  114. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.js +24 -0
  115. package/dist/esm/SchemaEditor/Tree/GeneratedToggle.js.map +1 -0
  116. package/dist/esm/SchemaEditor/Tree/Property.d.ts +6 -0
  117. package/dist/esm/SchemaEditor/Tree/Property.d.ts.map +1 -1
  118. package/dist/esm/SchemaEditor/Tree/Property.js.map +1 -1
  119. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts +2 -0
  120. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.d.ts.map +1 -1
  121. package/dist/esm/SchemaEditor/Tree/SchemaEditorContext.js.map +1 -1
  122. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts +2 -0
  123. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.d.ts.map +1 -1
  124. package/dist/esm/SchemaEditor/Tree/SchemaEditorParts.js.map +1 -1
  125. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.d.ts +12 -0
  126. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.d.ts.map +1 -0
  127. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.js +13 -0
  128. package/dist/esm/SchemaEditor/Tree/SchemaOrderedProperty.js.map +1 -0
  129. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.d.ts.map +1 -1
  130. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js +2 -2
  131. package/dist/esm/SchemaEditor/Tree/SchemaPropertyRow.js.map +1 -1
  132. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts +8 -1
  133. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.d.ts.map +1 -1
  134. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js +15 -11
  135. package/dist/esm/SchemaEditor/Tree/TreeSchemaEditor.js.map +1 -1
  136. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts +15 -3
  137. package/dist/esm/SchemaEditor/Tree/schemaConversion.d.ts.map +1 -1
  138. package/dist/esm/SchemaEditor/Tree/schemaConversion.js +83 -27
  139. package/dist/esm/SchemaEditor/Tree/schemaConversion.js.map +1 -1
  140. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.d.ts +3 -0
  141. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.d.ts.map +1 -0
  142. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.js +7 -0
  143. package/dist/esm/SchemaEditor/Tree/schemaInOriginalOrder.js.map +1 -0
  144. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.d.ts.map +1 -1
  145. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js +3 -0
  146. package/dist/esm/SchemaEditor/defaultSchemaEditorLabels.js.map +1 -1
  147. package/dist/esm/SchemaEditor/index.d.ts +1 -1
  148. package/dist/esm/SchemaEditor/index.d.ts.map +1 -1
  149. package/dist/esm/SchemaEditor/index.js +1 -1
  150. package/dist/esm/configuration/CratisComponentsDefaults.d.ts.map +1 -1
  151. package/dist/esm/configuration/CratisComponentsDefaults.js +2 -0
  152. package/dist/esm/configuration/CratisComponentsDefaults.js.map +1 -1
  153. package/dist/esm/styles.DataPage.css +51 -6
  154. package/dist/esm/styles.DataTables.css +51 -6
  155. package/dist/esm/styles.SchemaEditor.css +58 -16
  156. package/dist/esm/styles.css +58 -16
  157. package/dist/esm/styles.renderer.builtin.css +51 -6
  158. package/dist/esm/types/parts.d.ts +6 -2
  159. package/dist/esm/types/parts.d.ts.map +1 -1
  160. package/dist/esm/types/parts.js +6 -2
  161. package/dist/esm/types/parts.js.map +1 -1
  162. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditorLabels.d.ts","sourceRoot":"","sources":["../../../SchemaEditor/SchemaEditorLabels.ts"],"names":[],"mappings":"AAGA;;;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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"}
@@ -1 +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"]}
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 /** Tree layout: accessible name of the Generated toggle. */\n generatedProperty?: (propertyName: string) => string;\n /** Tree layout: tooltip of the Generated toggle while the value is entered. */\n setAsGenerated?: string;\n /** Tree layout: tooltip of the Generated toggle while the value is generated. */\n isGenerated?: 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,11 @@
1
+ import type { Property } from './Property.js';
2
+ import type { SchemaPropertyContext } from './SchemaPropertyContext.js';
3
+ /** The property and its position in the tree. */
4
+ interface GeneratedToggleProps {
5
+ property: Property;
6
+ rowContext: SchemaPropertyContext;
7
+ }
8
+ /** Offers the Generated toggle, or shows a non-interactive marker for a generated value. */
9
+ export declare const GeneratedToggle: ({ property, rowContext }: GeneratedToggleProps) => import("react").JSX.Element | null;
10
+ export {};
11
+ //# sourceMappingURL=GeneratedToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneratedToggle.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/GeneratedToggle.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAAyB,CAAC;AAGrE,iDAAiD;AACjD,UAAU,oBAAoB;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,qBAAqB,CAAC;CACrC;AAMD,4FAA4F;AAC5F,eAAO,MAAM,eAAe,6BAA8B,oBAAoB,uCA+B7E,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { FaWandMagicSparkles } from 'react-icons/fa6';
3
+ import { useSchemaEditorContext } from './SchemaEditorContext.js';
4
+
5
+ function canToggleGenerated(context, property, rowContext) {
6
+ return !context.readOnly && context.operations.setGenerated !== undefined && context.isGeneratedAllowed(property, rowContext);
7
+ }
8
+ const GeneratedToggle = ({ property, rowContext }) => {
9
+ const context = useSchemaEditorContext();
10
+ const { labels, parts, operations } = context;
11
+ const { generated = {} } = parts ?? {};
12
+ const className = `cratis-schema-editor__toggle cratis-schema-editor__generated ${generated.className ?? ''}`;
13
+ const label = labels.generatedProperty(property.name);
14
+ const icon = jsx(FaWandMagicSparkles, { "aria-hidden": 'true' });
15
+ if (canToggleGenerated(context, property, rowContext)) {
16
+ return (jsx("button", { ...generated, type: 'button', "aria-pressed": property.isGenerated === true, "aria-label": label, title: property.isGenerated ? labels.isGenerated : labels.setAsGenerated, className: className, "data-cratis-part": 'generated', "data-pressed": property.isGenerated === true || undefined, onClick: () => operations.setGenerated?.(property.id, !property.isGenerated), children: icon }));
17
+ }
18
+ if (!property.isGenerated)
19
+ return null;
20
+ return (jsx("span", { className: className, style: { ...generated.style, cursor: 'default' }, role: 'img', "aria-label": label, title: label, "data-cratis-part": 'generated', "data-pressed": true, children: icon }));
21
+ };
22
+
23
+ export { GeneratedToggle };
24
+ //# sourceMappingURL=GeneratedToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GeneratedToggle.js","sources":["../../../../SchemaEditor/Tree/GeneratedToggle.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 { FaWandMagicSparkles } from 'react-icons/fa6';\nimport type { Property } from './Property';\nimport type { SchemaPropertyContext } from './SchemaPropertyContext';\nimport { useSchemaEditorContext, type SchemaEditorContextValue } from './SchemaEditorContext';\n\n/** The property and its position in the tree. */\ninterface GeneratedToggleProps {\n property: Property;\n rowContext: SchemaPropertyContext;\n}\n\nfunction canToggleGenerated(context: SchemaEditorContextValue, property: Property, rowContext: SchemaPropertyContext): boolean {\n return !context.readOnly && context.operations.setGenerated !== undefined && context.isGeneratedAllowed(property, rowContext);\n}\n\n/** Offers the Generated toggle, or shows a non-interactive marker for a generated value. */\nexport const GeneratedToggle = ({ property, rowContext }: GeneratedToggleProps) => {\n const context = useSchemaEditorContext();\n const { labels, parts, operations } = context;\n const { generated = {} } = parts ?? {};\n const className = `cratis-schema-editor__toggle cratis-schema-editor__generated ${generated.className ?? ''}`;\n const label = labels.generatedProperty(property.name);\n const icon = <FaWandMagicSparkles aria-hidden='true' />;\n\n if (canToggleGenerated(context, property, rowContext)) {\n return (\n <button\n {...generated}\n type='button'\n aria-pressed={property.isGenerated === true}\n aria-label={label}\n title={property.isGenerated ? labels.isGenerated : labels.setAsGenerated}\n className={className}\n data-cratis-part='generated'\n data-pressed={property.isGenerated === true || undefined}\n onClick={() => operations.setGenerated?.(property.id, !property.isGenerated)}\n >\n {icon}\n </button>\n );\n }\n if (!property.isGenerated) return null;\n return (\n <span className={className} style={{ ...generated.style, cursor: 'default' }} role='img' aria-label={label} title={label} data-cratis-part='generated' data-pressed>\n {icon}\n </span>\n );\n};\n"],"names":["_jsx"],"mappings":";;;;AAcA,SAAS,kBAAkB,CAAC,OAAiC,EAAE,QAAkB,EAAE,UAAiC,EAAA;IAChH,OAAO,CAAC,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,UAAU,CAAC,YAAY,KAAK,SAAS,IAAI,OAAO,CAAC,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC;AACjI;AAGO,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAwB,KAAI;AAC9E,IAAA,MAAM,OAAO,GAAG,sBAAsB,EAAE;IACxC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO;IAC7C,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,GAAG,KAAK,IAAI,EAAE;IACtC,MAAM,SAAS,GAAG,CAAA,6DAAA,EAAgE,SAAS,CAAC,SAAS,IAAI,EAAE,CAAA,CAAE;IAC7G,MAAM,KAAK,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,IAAI,CAAC;AACrD,IAAA,MAAM,IAAI,GAAGA,GAAA,CAAC,mBAAmB,EAAA,EAAA,aAAA,EAAa,MAAM,GAAG;IAEvD,IAAI,kBAAkB,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE;AACnD,QAAA,QACIA,GAAA,CAAA,QAAA,EAAA,EAAA,GACQ,SAAS,EACb,IAAI,EAAC,QAAQ,EAAA,cAAA,EACC,QAAQ,CAAC,WAAW,KAAK,IAAI,gBAC/B,KAAK,EACjB,KAAK,EAAE,QAAQ,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,cAAc,EACxE,SAAS,EAAE,SAAS,EAAA,kBAAA,EACH,WAAW,EAAA,cAAA,EACd,QAAQ,CAAC,WAAW,KAAK,IAAI,IAAI,SAAS,EACxD,OAAO,EAAE,MAAM,UAAU,CAAC,YAAY,GAAG,QAAQ,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAA,QAAA,EAE3E,IAAI,EAAA,CACA;IAEjB;IACA,IAAI,CAAC,QAAQ,CAAC,WAAW;AAAE,QAAA,OAAO,IAAI;AACtC,IAAA,QACIA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,IAAI,EAAC,KAAK,EAAA,YAAA,EAAa,KAAK,EAAE,KAAK,EAAE,KAAK,sBAAmB,WAAW,EAAA,cAAA,EAAA,IAAA,EAAA,QAAA,EACjJ,IAAI,EAAA,CACF;AAEf;;"}
@@ -24,6 +24,12 @@ export interface Property {
24
24
  children?: Property[];
25
25
  /** Whether the property identifies its parent object. At most one property of an object is the key. */
26
26
  isKey?: boolean;
27
+ /** Whether the value is generated when the command runs rather than entered. */
28
+ isGenerated?: boolean;
29
+ /** Other `x-` keywords on this property's schema node, preserved verbatim. */
30
+ vendorKeywords?: Readonly<Record<string, unknown>>;
31
+ /** `x-` keywords on an array's items node, preserved verbatim. */
32
+ itemVendorKeywords?: Readonly<Record<string, unknown>>;
27
33
  /** Whether the property must be present in its parent object (membership in the JSON Schema `required` list). */
28
34
  isRequired?: boolean;
29
35
  }
@@ -1 +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"}
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,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnD,kEAAkE;IAClE,kBAAkB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvD,iHAAiH;IACjH,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB"}
@@ -1 +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"]}
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 value is generated when the command runs rather than entered. */\n isGenerated?: boolean;\n\n /** Other `x-` keywords on this property's schema node, preserved verbatim. */\n vendorKeywords?: Readonly<Record<string, unknown>>;\n\n /** `x-` keywords on an array's items node, preserved verbatim. */\n itemVendorKeywords?: Readonly<Record<string, unknown>>;\n\n /** Whether the property must be present in its parent object (membership in the JSON Schema `required` list). */\n isRequired?: boolean;\n}\n"]}
@@ -13,6 +13,7 @@ export interface SchemaEditorOperations {
13
13
  rename?: (propertyId: string, name: string) => void;
14
14
  changeType?: (propertyId: string, type: PropertyType, concept?: string) => void;
15
15
  setKey?: (propertyId: string) => void;
16
+ setGenerated?: (propertyId: string, isGenerated: boolean) => void;
16
17
  setRequired?: (propertyId: string, isRequired: boolean) => void;
17
18
  }
18
19
  /** Everything the rows of an editor share. Internal: hosts configure the editor through its props. */
@@ -26,6 +27,7 @@ export interface SchemaEditorContextValue {
26
27
  selectedPropertyId: string | null | undefined;
27
28
  onPropertyClick: ((propertyId: string) => void) | undefined;
28
29
  isKeyAllowed: (property: Property, context: SchemaPropertyContext) => boolean;
30
+ isGeneratedAllowed: (property: Property, context: SchemaPropertyContext) => boolean;
29
31
  isRequiredAllowed: boolean;
30
32
  isProtected: (property: Property) => boolean;
31
33
  validateName: ((name: string, property: Property, siblings: Property[]) => string | undefined) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditorContext.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaEditorContext.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA0B,CAAC;AAEvE,8FAA8F;AAC9F,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5E,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAChF,MAAM,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CACnE;AAED,sGAAs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KAAK,sBAAsB,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IACtH,aAAa,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;IAC/F,eAAe,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;IACjG,aAAa,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;IAC/F,eAAe,EAAE,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,KAAK,SAAS,CAAC,GAAG,SAAS,CAAC;CAC7H;AAED,6DAA6D;AAC7D,eAAO,MAAM,mBAAmB,+DAAiE,CAAC;AAElG,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,QAAO,wBAIzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditorContext.js","sources":["../../../../SchemaEditor/Tree/SchemaEditorContext.ts"],"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 { Property } from './Property';\nimport type { PropertyConcept } from './PropertyConcept';\nimport type { PropertyType } from './PropertyType';\nimport type { SchemaEditorLabels } from '../SchemaEditorLabels';\nimport type { SchemaEditorParts } from './SchemaEditorParts';\nimport type { SchemaPropertyContext } from './SchemaPropertyContext';\nimport type { SchemaPropertyRowState } from './SchemaPropertyRowState';\n\n/** The edits the editor can currently perform. An edit that is `undefined` is not offered. */\nexport interface SchemaEditorOperations {\n addChild?: (parentId: string, type: PropertyType, concept?: string) => void;\n remove?: (propertyId: string) => void;\n rename?: (propertyId: string, name: string) => void;\n changeType?: (propertyId: string, type: PropertyType, concept?: string) => void;\n setKey?: (propertyId: string) => void;\n setRequired?: (propertyId: string, isRequired: boolean) => void;\n}\n\n/** Everything the rows of an editor share. Internal: hosts configure the editor through its props. */\nexport interface SchemaEditorContextValue {\n labels: Required<SchemaEditorLabels>;\n parts: SchemaEditorParts | undefined;\n properties: Property[];\n concepts: PropertyConcept[] | undefined;\n readOnly: boolean;\n operations: SchemaEditorOperations;\n selectedPropertyId: string | null | undefined;\n onPropertyClick: ((propertyId: string) => void) | undefined;\n isKeyAllowed: (property: Property, context: SchemaPropertyContext) => boolean;\n isRequiredAllowed: boolean;\n isProtected: (property: Property) => boolean;\n validateName: ((name: string, property: Property, siblings: Property[]) => string | undefined) | undefined;\n getRowState: ((property: Property, context: SchemaPropertyContext) => SchemaPropertyRowState | undefined) | undefined;\n renderLeading: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderAccessory: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderDetails: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderTypeBadge: ((property: Property, context: SchemaPropertyContext, defaultBadge: ReactNode) => ReactNode) | undefined;\n}\n\n/** Carries the editor's shared configuration to its rows. */\nexport const SchemaEditorContext = createContext<SchemaEditorContextValue | undefined>(undefined);\n\n/** Reads the editor's shared configuration. Rows only render inside an editor. */\nexport const useSchemaEditorContext = (): SchemaEditorContextValue => {\n const value = useContext(SchemaEditorContext);\n if (!value) throw new Error('A schema property row must be rendered inside a SchemaEditor.');\n return value;\n};\n"],"names":[],"mappings":";;MA4Ca,mBAAmB,GAAG,aAAa,CAAuC,SAAS;AAGzF,MAAM,sBAAsB,GAAG,MAA+B;AACjE,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,mBAAmB,CAAC;AAC7C,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC;AAC5F,IAAA,OAAO,KAAK;AAChB;;"}
1
+ {"version":3,"file":"SchemaEditorContext.js","sources":["../../../../SchemaEditor/Tree/SchemaEditorContext.ts"],"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 { Property } from './Property';\nimport type { PropertyConcept } from './PropertyConcept';\nimport type { PropertyType } from './PropertyType';\nimport type { SchemaEditorLabels } from '../SchemaEditorLabels';\nimport type { SchemaEditorParts } from './SchemaEditorParts';\nimport type { SchemaPropertyContext } from './SchemaPropertyContext';\nimport type { SchemaPropertyRowState } from './SchemaPropertyRowState';\n\n/** The edits the editor can currently perform. An edit that is `undefined` is not offered. */\nexport interface SchemaEditorOperations {\n addChild?: (parentId: string, type: PropertyType, concept?: string) => void;\n remove?: (propertyId: string) => void;\n rename?: (propertyId: string, name: string) => void;\n changeType?: (propertyId: string, type: PropertyType, concept?: string) => void;\n setKey?: (propertyId: string) => void;\n setGenerated?: (propertyId: string, isGenerated: boolean) => void;\n setRequired?: (propertyId: string, isRequired: boolean) => void;\n}\n\n/** Everything the rows of an editor share. Internal: hosts configure the editor through its props. */\nexport interface SchemaEditorContextValue {\n labels: Required<SchemaEditorLabels>;\n parts: SchemaEditorParts | undefined;\n properties: Property[];\n concepts: PropertyConcept[] | undefined;\n readOnly: boolean;\n operations: SchemaEditorOperations;\n selectedPropertyId: string | null | undefined;\n onPropertyClick: ((propertyId: string) => void) | undefined;\n isKeyAllowed: (property: Property, context: SchemaPropertyContext) => boolean;\n isGeneratedAllowed: (property: Property, context: SchemaPropertyContext) => boolean;\n isRequiredAllowed: boolean;\n isProtected: (property: Property) => boolean;\n validateName: ((name: string, property: Property, siblings: Property[]) => string | undefined) | undefined;\n getRowState: ((property: Property, context: SchemaPropertyContext) => SchemaPropertyRowState | undefined) | undefined;\n renderLeading: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderAccessory: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderDetails: ((property: Property, context: SchemaPropertyContext) => ReactNode) | undefined;\n renderTypeBadge: ((property: Property, context: SchemaPropertyContext, defaultBadge: ReactNode) => ReactNode) | undefined;\n}\n\n/** Carries the editor's shared configuration to its rows. */\nexport const SchemaEditorContext = createContext<SchemaEditorContextValue | undefined>(undefined);\n\n/** Reads the editor's shared configuration. Rows only render inside an editor. */\nexport const useSchemaEditorContext = (): SchemaEditorContextValue => {\n const value = useContext(SchemaEditorContext);\n if (!value) throw new Error('A schema property row must be rendered inside a SchemaEditor.');\n return value;\n};\n"],"names":[],"mappings":";;MA8Ca,mBAAmB,GAAG,aAAa,CAAuC,SAAS;AAGzF,MAAM,sBAAsB,GAAG,MAA+B;AACjE,IAAA,MAAM,KAAK,GAAG,UAAU,CAAC,mBAAmB,CAAC;AAC7C,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC;AAC5F,IAAA,OAAO,KAAK;AAChB;;"}
@@ -40,6 +40,8 @@ export interface SchemaEditorParts {
40
40
  required?: SchemaEditorPartAttributes<HTMLLabelElement>;
41
41
  /** The key toggle. Carries `data-pressed` while the property is the key. */
42
42
  key?: ButtonHTMLAttributes<HTMLButtonElement>;
43
+ /** The Generated toggle, or non-interactive marker when editing is unavailable. Carries `data-pressed` while the value is generated. */
44
+ generated?: ButtonHTMLAttributes<HTMLButtonElement>;
43
45
  /** The wrapper of the host's accessory slot. */
44
46
  accessory?: SchemaEditorPartAttributes<HTMLSpanElement>;
45
47
  /** The button that removes a property. */
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditorParts.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaEditorParts.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAEvF,0FAA0F;AAC1F,MAAM,MAAM,0BAA0B,CAAC,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG;IAC1E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pD,gDAAgD;IAChD,SAAS,CAAC,EAAE,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAExD,0CAA0C;IAC1C,MAAM,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAEjD,8EAA8E;IAC9E,SAAS,CAAC,EAAE,0BAA0B,CAAC,eAAe,CAAC,CAAC;IAExD,mEAAmE;IACnE,OAAO,CAAC,EAAE,0BAA0B,CAAC,cAAc,CAAC,CAAC;IAErD,0EAA0E;IAC1E,GAAG,CAAC,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAE9C,mDAAmD;IACnD,KAAK,CAAC,EAAE,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IAEzD,4BAA4B;IAC5B,OAAO,CAAC,EAAE,0BAA0B,CAAC,oBAAoB,CAAC,CAAC;IAE3D,iEAAiE;IACjE,MAAM,CAAC,EAAE,0BAA0B,CAAC,cAAc,CAAC,CAAC;CACvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaEditorParts.js","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaEditorParts.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 { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes } from 'react';\n\n/** Attributes passed through to one part of the editor, including `data-*` attributes. */\nexport type SchemaEditorPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** Styling attributes passed to a part the editor renders through a popover menu. */\nexport type SchemaEditorMenuPartAttributes = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/**\n * Stable Cratis-owned parts for styling a {@link SchemaEditor}. Each is marked with a matching\n * `data-cratis-part` attribute and receives what is passed here; the editor's own wiring wins.\n */\nexport interface SchemaEditorParts {\n /** The editor root. Carries `data-readonly` while the editor is read-only. */\n root?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The wrapper of the host's `header`. */\n header?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** A list of properties: the root list, or the properties nested under a property. */\n list?: SchemaEditorPartAttributes<HTMLUListElement>;\n\n /** One property with everything nested under it. Carries `data-property-type`. */\n property?: SchemaEditorPartAttributes<HTMLLIElement>;\n\n /** The row of one property. Carries `data-selected` while the host marks it selected. */\n row?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The wrapper of the host's leading slot. */\n leading?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The control that shows the name and starts renaming. */\n name?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The input shown while renaming. Carries `data-invalid` for a name that cannot be used. */\n nameInput?: InputHTMLAttributes<HTMLInputElement>;\n\n /** The read-only badge of a property's type. Carries `data-property-type`, and `data-locked` while the type is locked. */\n badge?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The button that opens the menu of types. */\n typeButton?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The popover of the menu of types. */\n menu?: SchemaEditorMenuPartAttributes;\n\n /** One entry of the menu of types. */\n menuItem?: SchemaEditorMenuPartAttributes;\n\n /** The label of the required toggle. */\n required?: SchemaEditorPartAttributes<HTMLLabelElement>;\n\n /** The key toggle. Carries `data-pressed` while the property is the key. */\n key?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The wrapper of the host's accessory slot. */\n accessory?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The button that removes a property. */\n remove?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The marker shown instead of the remove button for a protected property. */\n protected?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The wrapper of the host's details slot, shown under the row. */\n details?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The button that adds a property, at the root or in a nested object. */\n add?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The text shown when there are no properties. */\n empty?: SchemaEditorPartAttributes<HTMLParagraphElement>;\n\n /** A validation message. */\n message?: SchemaEditorPartAttributes<HTMLParagraphElement>;\n\n /** The wrapper of the host's `footer`, beside the add button. */\n footer?: SchemaEditorPartAttributes<HTMLDivElement>;\n}\n"]}
1
+ {"version":3,"file":"SchemaEditorParts.js","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaEditorParts.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 { ButtonHTMLAttributes, HTMLAttributes, InputHTMLAttributes } from 'react';\n\n/** Attributes passed through to one part of the editor, including `data-*` attributes. */\nexport type SchemaEditorPartAttributes<TElement> = HTMLAttributes<TElement> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/** Styling attributes passed to a part the editor renders through a popover menu. */\nexport type SchemaEditorMenuPartAttributes = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {\n [attribute: `data-${string}`]: string | number | boolean | undefined;\n};\n\n/**\n * Stable Cratis-owned parts for styling a {@link SchemaEditor}. Each is marked with a matching\n * `data-cratis-part` attribute and receives what is passed here; the editor's own wiring wins.\n */\nexport interface SchemaEditorParts {\n /** The editor root. Carries `data-readonly` while the editor is read-only. */\n root?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The wrapper of the host's `header`. */\n header?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** A list of properties: the root list, or the properties nested under a property. */\n list?: SchemaEditorPartAttributes<HTMLUListElement>;\n\n /** One property with everything nested under it. Carries `data-property-type`. */\n property?: SchemaEditorPartAttributes<HTMLLIElement>;\n\n /** The row of one property. Carries `data-selected` while the host marks it selected. */\n row?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The wrapper of the host's leading slot. */\n leading?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The control that shows the name and starts renaming. */\n name?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The input shown while renaming. Carries `data-invalid` for a name that cannot be used. */\n nameInput?: InputHTMLAttributes<HTMLInputElement>;\n\n /** The read-only badge of a property's type. Carries `data-property-type`, and `data-locked` while the type is locked. */\n badge?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The button that opens the menu of types. */\n typeButton?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The popover of the menu of types. */\n menu?: SchemaEditorMenuPartAttributes;\n\n /** One entry of the menu of types. */\n menuItem?: SchemaEditorMenuPartAttributes;\n\n /** The label of the required toggle. */\n required?: SchemaEditorPartAttributes<HTMLLabelElement>;\n\n /** The key toggle. Carries `data-pressed` while the property is the key. */\n key?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The Generated toggle, or non-interactive marker when editing is unavailable. Carries `data-pressed` while the value is generated. */\n generated?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The wrapper of the host's accessory slot. */\n accessory?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The button that removes a property. */\n remove?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The marker shown instead of the remove button for a protected property. */\n protected?: SchemaEditorPartAttributes<HTMLSpanElement>;\n\n /** The wrapper of the host's details slot, shown under the row. */\n details?: SchemaEditorPartAttributes<HTMLDivElement>;\n\n /** The button that adds a property, at the root or in a nested object. */\n add?: ButtonHTMLAttributes<HTMLButtonElement>;\n\n /** The text shown when there are no properties. */\n empty?: SchemaEditorPartAttributes<HTMLParagraphElement>;\n\n /** A validation message. */\n message?: SchemaEditorPartAttributes<HTMLParagraphElement>;\n\n /** The wrapper of the host's `footer`, beside the add button. */\n footer?: SchemaEditorPartAttributes<HTMLDivElement>;\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import type { Property } from './Property.js';
2
+ /** Internal ordering metadata that remains invisible to enumeration and plain property comparisons. */
3
+ export declare const schemaKeywordOrder: unique symbol;
4
+ export declare const itemSchemaKeywordOrder: unique symbol;
5
+ /** A property read from a schema, with the original keyword positions. */
6
+ export interface SchemaOrderedProperty extends Property {
7
+ [schemaKeywordOrder]?: readonly string[];
8
+ [itemSchemaKeywordOrder]?: readonly string[];
9
+ }
10
+ /** Carries original keyword positions onto a property without exposing enumerable metadata. */
11
+ export declare function copySchemaKeywordOrder(source: Partial<SchemaOrderedProperty>, target: SchemaOrderedProperty): Property;
12
+ //# sourceMappingURL=SchemaOrderedProperty.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaOrderedProperty.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaOrderedProperty.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAE3C,uGAAuG;AACvG,eAAO,MAAM,kBAAkB,eAA+B,CAAC;AAC/D,eAAO,MAAM,sBAAsB,eAAmC,CAAC;AAEvE,0EAA0E;AAC1E,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IACnD,CAAC,kBAAkB,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,CAAC,sBAAsB,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAChD;AAED,+FAA+F;AAC/F,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,qBAAqB,GAAG,QAAQ,CAMtH"}
@@ -0,0 +1,13 @@
1
+ const schemaKeywordOrder = Symbol('schemaKeywordOrder');
2
+ const itemSchemaKeywordOrder = Symbol('itemSchemaKeywordOrder');
3
+ function copySchemaKeywordOrder(source, target) {
4
+ for (const keyword of [schemaKeywordOrder, itemSchemaKeywordOrder]) {
5
+ const order = source[keyword];
6
+ if (order)
7
+ Object.defineProperty(target, keyword, { value: order, enumerable: false, configurable: true });
8
+ }
9
+ return target;
10
+ }
11
+
12
+ export { copySchemaKeywordOrder, itemSchemaKeywordOrder, schemaKeywordOrder };
13
+ //# sourceMappingURL=SchemaOrderedProperty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaOrderedProperty.js","sources":["../../../../SchemaEditor/Tree/SchemaOrderedProperty.ts"],"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 { Property } from './Property';\n\n/** Internal ordering metadata that remains invisible to enumeration and plain property comparisons. */\nexport const schemaKeywordOrder = Symbol('schemaKeywordOrder');\nexport const itemSchemaKeywordOrder = Symbol('itemSchemaKeywordOrder');\n\n/** A property read from a schema, with the original keyword positions. */\nexport interface SchemaOrderedProperty extends Property {\n [schemaKeywordOrder]?: readonly string[];\n [itemSchemaKeywordOrder]?: readonly string[];\n}\n\n/** Carries original keyword positions onto a property without exposing enumerable metadata. */\nexport function copySchemaKeywordOrder(source: Partial<SchemaOrderedProperty>, target: SchemaOrderedProperty): Property {\n for (const keyword of [schemaKeywordOrder, itemSchemaKeywordOrder] as const) {\n const order = source[keyword];\n if (order) Object.defineProperty(target, keyword, { value: order, enumerable: false, configurable: true });\n }\n return target;\n}\n"],"names":[],"mappings":"MAMa,kBAAkB,GAAG,MAAM,CAAC,oBAAoB;MAChD,sBAAsB,GAAG,MAAM,CAAC,wBAAwB;AAS/D,SAAU,sBAAsB,CAAC,MAAsC,EAAE,MAA6B,EAAA;IACxG,KAAK,MAAM,OAAO,IAAI,CAAC,kBAAkB,EAAE,sBAAsB,CAAU,EAAE;AACzE,QAAA,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;AAC7B,QAAA,IAAI,KAAK;YAAE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IAC9G;AACA,IAAA,OAAO,MAAM;AACjB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPropertyRow.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaPropertyRow.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAQ3C,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACnC,0BAA0B;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IAEnB,8DAA8D;IAC9D,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAErB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACjB;AAID,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,kCAAmC,sBAAsB,gCAsRtF,CAAC"}
1
+ {"version":3,"file":"SchemaPropertyRow.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/SchemaPropertyRow.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAS3C,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACnC,0BAA0B;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IAEnB,8DAA8D;IAC9D,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAErB,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;CACjB;AAID,4GAA4G;AAC5G,eAAO,MAAM,iBAAiB,kCAAmC,sBAAsB,gCAuRtF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
2
  import { useId, useRef, useState, useEffect } from 'react';
3
3
  import { FaKey, FaLock, FaXmark, FaPlus } from 'react-icons/fa6';
4
+ import { GeneratedToggle } from './GeneratedToggle.js';
4
5
  import { findPropertyNameProblem, PropertyNameProblem } from './propertyNaming.js';
5
6
  import { PropertyTypeBadge } from './PropertyTypeBadge.js';
6
7
  import { PropertyTypeMenu } from './PropertyTypeMenu.js';
@@ -23,7 +24,6 @@ const SchemaPropertyRow = ({ property, siblings, depth }) => {
23
24
  const canRename = !readOnly && !isProtected && operations.rename !== undefined;
24
25
  const canRemove = !readOnly && !isProtected && operations.remove !== undefined;
25
26
  const canChangeType = !readOnly && operations.changeType !== undefined && rowState?.lockType !== true;
26
- const canSetRequired = context.isRequiredAllowed && operations.setRequired !== undefined;
27
27
  const canSetKey = !readOnly && operations.setKey !== undefined && context.isKeyAllowed(property, rowContext);
28
28
  const canAddChild = !readOnly && operations.addChild !== undefined && hasNestedProperties(property.type);
29
29
  const lockReason = rowState?.lockType === true ? rowState.lockTypeReason : undefined;
@@ -100,7 +100,7 @@ const SchemaPropertyRow = ({ property, siblings, depth }) => {
100
100
  stopEditing(); }, onKeyDown: handleEditKeyDown }), problem && (jsx("p", { ...parts?.message, id: messageId, role: 'alert', className: `cratis-schema-editor__message ${parts?.message?.className ?? ''}`, "data-cratis-part": 'message', children: problem }))] })) : canRename || isSelectable ? (jsx("button", { ...parts?.name, type: 'button', title: canRename ? labels.renameHint : undefined, "aria-keyshortcuts": canRename ? 'F2' : undefined, className: `cratis-schema-editor__name ${parts?.name?.className ?? ''}`, "data-cratis-part": 'name', onDoubleClick: startEditing, onKeyDown: event => { if (event.key === 'F2') {
101
101
  event.preventDefault();
102
102
  startEditing();
103
- } }, children: property.name })) : (jsx("span", { className: `cratis-schema-editor__name cratis-schema-editor__name--static ${parts?.name?.className ?? ''}`, "data-cratis-part": 'name', children: property.name })), canChangeType ? (jsx(PropertyTypeMenu, { labels: labels, concepts: context.concepts, triggerPart: 'typeButton', triggerLabel: labels.changeType(property.name, property.concept ?? typeName), parts: parts, onSelect: (type, concept) => operations.changeType?.(property.id, type, concept), children: typeBadge })) : typeBadge, canSetRequired && (jsxs("label", { ...parts?.required, title: labels.requiredHelp, className: `cratis-schema-editor__required ${parts?.required?.className ?? ''}`, "data-cratis-part": 'required', children: [jsx("input", { type: 'checkbox', checked: property.isRequired === true, disabled: readOnly, "aria-label": labels.requiredProperty(property.name), "aria-description": labels.requiredHelp, onChange: event => operations.setRequired?.(property.id, event.target.checked) }), labels.required] })), canSetKey && (jsx("button", { ...parts?.key, type: 'button', "aria-pressed": property.isKey === true, "aria-label": labels.keyProperty(property.name), title: property.isKey ? labels.isKey : labels.setAsKey, className: `cratis-schema-editor__key ${parts?.key?.className ?? ''}`, "data-cratis-part": 'key', "data-pressed": property.isKey === true || undefined, onClick: () => operations.setKey?.(property.id), children: jsx(FaKey, { "aria-hidden": 'true' }) })), context.renderAccessory && (jsx("span", { ...parts?.accessory, className: `cratis-schema-editor__accessory ${parts?.accessory?.className ?? ''}`, "data-cratis-part": 'accessory', children: context.renderAccessory(property, rowContext) })), isProtected ? (jsx("span", { ...parts?.protected, role: 'img', "aria-label": labels.protectedProperty, title: labels.protectedProperty, className: `cratis-schema-editor__protected ${parts?.protected?.className ?? ''}`, "data-cratis-part": 'protected', children: jsx(FaLock, { "aria-hidden": 'true' }) })) : canRemove && (jsx("button", { ...parts?.remove, type: 'button', "aria-label": labels.deletePropertyFor(property.name), title: labels.deletePropertyFor(property.name), className: `cratis-schema-editor__remove ${parts?.remove?.className ?? ''}`, "data-cratis-part": 'remove', onClick: () => operations.remove?.(property.id), children: jsx(FaXmark, { "aria-hidden": 'true' }) }))] }), details && (jsx("div", { ...parts?.details, className: `cratis-schema-editor__details ${parts?.details?.className ?? ''}`, "data-cratis-part": 'details', children: details })), hasNestedProperties(property.type) && (jsxs(Fragment, { children: [(property.children ?? []).length > 0 && (jsx("ul", { ...parts?.list, "aria-label": nestedLabel, className: `cratis-schema-editor__list cratis-schema-editor__list--nested ${parts?.list?.className ?? ''}`, "data-cratis-part": 'list', children: (property.children ?? []).map(child => (jsx(SchemaPropertyRow, { property: child, siblings: property.children ?? [], depth: depth + 1 }, child.id))) })), canAddChild && (jsxs(PropertyTypeMenu, { labels: labels, concepts: context.concepts, triggerPart: 'add', triggerLabel: labels.addPropertyTo(property.name), parts: parts, onSelect: (type, concept) => operations.addChild?.(property.id, type, concept), children: [jsx(FaPlus, { "aria-hidden": 'true' }), labels.addProperty] }))] }))] }));
103
+ } }, children: property.name })) : (jsx("span", { className: `cratis-schema-editor__name cratis-schema-editor__name--static ${parts?.name?.className ?? ''}`, "data-cratis-part": 'name', children: property.name })), canChangeType ? (jsx(PropertyTypeMenu, { labels: labels, concepts: context.concepts, triggerPart: 'typeButton', triggerLabel: labels.changeType(property.name, property.concept ?? typeName), parts: parts, onSelect: (type, concept) => operations.changeType?.(property.id, type, concept), children: typeBadge })) : typeBadge, context.isRequiredAllowed && operations.setRequired !== undefined && (jsxs("label", { ...parts?.required, title: labels.requiredHelp, className: `cratis-schema-editor__required ${parts?.required?.className ?? ''}`, "data-cratis-part": 'required', children: [jsx("input", { type: 'checkbox', checked: property.isRequired === true, disabled: readOnly, "aria-label": labels.requiredProperty(property.name), "aria-description": labels.requiredHelp, onChange: event => operations.setRequired?.(property.id, event.target.checked) }), labels.required] })), canSetKey && (jsx("button", { ...parts?.key, type: 'button', "aria-pressed": property.isKey === true, "aria-label": labels.keyProperty(property.name), title: property.isKey ? labels.isKey : labels.setAsKey, className: `cratis-schema-editor__toggle cratis-schema-editor__key ${parts?.key?.className ?? ''}`, "data-cratis-part": 'key', "data-pressed": property.isKey === true || undefined, onClick: () => operations.setKey?.(property.id), children: jsx(FaKey, { "aria-hidden": 'true' }) })), jsx(GeneratedToggle, { property: property, rowContext: rowContext }), context.renderAccessory && (jsx("span", { ...parts?.accessory, className: `cratis-schema-editor__accessory ${parts?.accessory?.className ?? ''}`, "data-cratis-part": 'accessory', children: context.renderAccessory(property, rowContext) })), isProtected ? (jsx("span", { ...parts?.protected, role: 'img', "aria-label": labels.protectedProperty, title: labels.protectedProperty, className: `cratis-schema-editor__protected ${parts?.protected?.className ?? ''}`, "data-cratis-part": 'protected', children: jsx(FaLock, { "aria-hidden": 'true' }) })) : canRemove && (jsx("button", { ...parts?.remove, type: 'button', "aria-label": labels.deletePropertyFor(property.name), title: labels.deletePropertyFor(property.name), className: `cratis-schema-editor__remove ${parts?.remove?.className ?? ''}`, "data-cratis-part": 'remove', onClick: () => operations.remove?.(property.id), children: jsx(FaXmark, { "aria-hidden": 'true' }) }))] }), details && (jsx("div", { ...parts?.details, className: `cratis-schema-editor__details ${parts?.details?.className ?? ''}`, "data-cratis-part": 'details', children: details })), hasNestedProperties(property.type) && (jsxs(Fragment, { children: [(property.children ?? []).length > 0 && (jsx("ul", { ...parts?.list, "aria-label": nestedLabel, className: `cratis-schema-editor__list cratis-schema-editor__list--nested ${parts?.list?.className ?? ''}`, "data-cratis-part": 'list', children: (property.children ?? []).map(child => (jsx(SchemaPropertyRow, { property: child, siblings: property.children ?? [], depth: depth + 1 }, child.id))) })), canAddChild && (jsxs(PropertyTypeMenu, { labels: labels, concepts: context.concepts, triggerPart: 'add', triggerLabel: labels.addPropertyTo(property.name), parts: parts, onSelect: (type, concept) => operations.addChild?.(property.id, type, concept), children: [jsx(FaPlus, { "aria-hidden": 'true' }), labels.addProperty] }))] }))] }));
104
104
  };
105
105
 
106
106
  export { SchemaPropertyRow };
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPropertyRow.js","sources":["../../../../SchemaEditor/Tree/SchemaPropertyRow.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 { useEffect, useId, useRef, useState, type KeyboardEvent, type MouseEvent } from 'react';\nimport { FaKey, FaLock, FaPlus, FaXmark } from 'react-icons/fa6';\nimport type { Property } from './Property';\nimport { PropertyNameProblem, findPropertyNameProblem } from './propertyNaming';\nimport { PropertyTypeBadge } from './PropertyTypeBadge';\nimport { PropertyTypeMenu } from './PropertyTypeMenu';\nimport { useSchemaEditorContext } from './SchemaEditorContext';\nimport type { SchemaPropertyContext } from './SchemaPropertyContext';\nimport { hasNestedProperties, propertyTypeName } from './propertyTypeDisplay';\n\n/** Props for one row of the editor, and everything nested under it. */\nexport interface SchemaPropertyRowProps {\n /** The property shown. */\n property: Property;\n\n /** The properties that share its parent, including itself. */\n siblings: Property[];\n\n /** How deeply the property is nested. */\n depth: number;\n}\n\nconst interactiveSelector = 'button, input, label, textarea, select, a, [role=\"menu\"]';\n\n/** One property: its row of controls, the host's details beneath it, and the properties nested under it. */\nexport const SchemaPropertyRow = ({ property, siblings, depth }: SchemaPropertyRowProps) => {\n const context = useSchemaEditorContext();\n const { labels, parts, operations, readOnly } = context;\n const messageId = useId();\n const nameInput = useRef<HTMLInputElement>(null);\n const [isEditing, setIsEditing] = useState(false);\n const [draftName, setDraftName] = useState(property.name);\n const [problem, setProblem] = useState<string | undefined>(undefined);\n\n const rowContext: SchemaPropertyContext = { depth, siblings, properties: context.properties, readOnly };\n const rowState = context.getRowState?.(property, rowContext);\n const details = context.renderDetails?.(property, rowContext);\n const isProtected = context.isProtected(property);\n const canRename = !readOnly && !isProtected && operations.rename !== undefined;\n const canRemove = !readOnly && !isProtected && operations.remove !== undefined;\n const canChangeType = !readOnly && operations.changeType !== undefined && rowState?.lockType !== true;\n const canSetRequired = context.isRequiredAllowed && operations.setRequired !== undefined;\n const canSetKey = !readOnly && operations.setKey !== undefined && context.isKeyAllowed(property, rowContext);\n const canAddChild = !readOnly && operations.addChild !== undefined && hasNestedProperties(property.type);\n const lockReason = rowState?.lockType === true ? rowState.lockTypeReason : undefined;\n const isSelected = context.selectedPropertyId === property.id;\n const typeName = propertyTypeName(property.type, labels);\n const nestedLabel = labels.nestedProperties(property.name);\n\n useEffect(() => {\n if (isEditing) nameInput.current?.select();\n }, [isEditing]);\n\n const startEditing = () => {\n if (!canRename) return;\n setDraftName(property.name);\n setProblem(undefined);\n setIsEditing(true);\n };\n\n const stopEditing = () => {\n setIsEditing(false);\n setProblem(undefined);\n };\n\n const describe = (name: string): string | undefined => {\n const found = findPropertyNameProblem(name, property.id, siblings);\n if (found === PropertyNameProblem.Empty) return labels.nameRequired;\n if (found === PropertyNameProblem.Reserved) return labels.nameReserved(name);\n if (found === PropertyNameProblem.Duplicate) return labels.nameDuplicate(name);\n return context.validateName?.(name, property, siblings);\n };\n\n const commit = (): boolean => {\n const name = draftName.trim();\n if (name === property.name) {\n stopEditing();\n return true;\n }\n const message = describe(name);\n if (message) {\n setProblem(message);\n return false;\n }\n stopEditing();\n operations.rename?.(property.id, name);\n return true;\n };\n\n const handleEditKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n commit();\n } else if (event.key === 'Escape') {\n event.stopPropagation();\n stopEditing();\n }\n };\n\n const handleRowClick = (event: MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n const optedIn = target.closest('[data-schema-row-select]');\n if (optedIn && event.currentTarget.contains(optedIn)) {\n context.onPropertyClick?.(property.id);\n return;\n }\n const interactive = target.closest(interactiveSelector);\n if (interactive && interactive.getAttribute('data-cratis-part') !== 'name') return;\n context.onPropertyClick?.(property.id);\n };\n\n const defaultBadge = <PropertyTypeBadge property={property} labels={labels} part={parts?.badge} lockReason={lockReason} />;\n const typeBadge = context.renderTypeBadge ? context.renderTypeBadge(property, rowContext, defaultBadge) : defaultBadge;\n const rowAttributes = rowState?.attributes ?? {};\n const isSelectable = context.onPropertyClick !== undefined;\n\n return (\n <li\n {...parts?.property}\n className={`cratis-schema-editor__property ${parts?.property?.className ?? ''}`}\n data-cratis-part='property'\n data-property-type={property.type}\n >\n <div\n {...parts?.row}\n {...rowAttributes}\n title={rowState?.title}\n className={`cratis-schema-editor__row ${rowState?.className ?? ''} ${parts?.row?.className ?? ''}`}\n data-cratis-part='row'\n data-selected={isSelected || undefined}\n onClick={handleRowClick}\n >\n {context.renderLeading && (\n <span {...parts?.leading} className={`cratis-schema-editor__leading ${parts?.leading?.className ?? ''}`} data-cratis-part='leading'>\n {context.renderLeading(property, rowContext)}\n </span>\n )}\n\n {isEditing ? (\n <span className='cratis-schema-editor__name-edit'>\n <input\n {...parts?.nameInput}\n ref={nameInput}\n type='text'\n value={draftName}\n aria-label={labels.propertyNameFor(property.name)}\n aria-invalid={problem !== undefined || undefined}\n aria-describedby={problem ? messageId : undefined}\n className={`cratis-schema-editor__name-input ${parts?.nameInput?.className ?? ''}`}\n data-cratis-part='nameInput'\n data-invalid={problem !== undefined || undefined}\n onChange={event => { setDraftName(event.target.value); setProblem(undefined); }}\n onBlur={() => { if (!commit()) stopEditing(); }}\n onKeyDown={handleEditKeyDown}\n />\n {problem && (\n <p\n {...parts?.message}\n id={messageId}\n role='alert'\n className={`cratis-schema-editor__message ${parts?.message?.className ?? ''}`}\n data-cratis-part='message'\n >\n {problem}\n </p>\n )}\n </span>\n ) : canRename || isSelectable ? (\n <button\n {...parts?.name}\n type='button'\n title={canRename ? labels.renameHint : undefined}\n aria-keyshortcuts={canRename ? 'F2' : undefined}\n className={`cratis-schema-editor__name ${parts?.name?.className ?? ''}`}\n data-cratis-part='name'\n onDoubleClick={startEditing}\n onKeyDown={event => { if (event.key === 'F2') { event.preventDefault(); startEditing(); } }}\n >\n {property.name}\n </button>\n ) : (\n <span className={`cratis-schema-editor__name cratis-schema-editor__name--static ${parts?.name?.className ?? ''}`} data-cratis-part='name'>\n {property.name}\n </span>\n )}\n\n {canChangeType ? (\n <PropertyTypeMenu\n labels={labels}\n concepts={context.concepts}\n triggerPart='typeButton'\n triggerLabel={labels.changeType(property.name, property.concept ?? typeName)}\n parts={parts}\n onSelect={(type, concept) => operations.changeType?.(property.id, type, concept)}\n >\n {typeBadge}\n </PropertyTypeMenu>\n ) : typeBadge}\n\n {canSetRequired && (\n <label\n {...parts?.required}\n title={labels.requiredHelp}\n className={`cratis-schema-editor__required ${parts?.required?.className ?? ''}`}\n data-cratis-part='required'\n >\n <input\n type='checkbox'\n checked={property.isRequired === true}\n disabled={readOnly}\n aria-label={labels.requiredProperty(property.name)}\n aria-description={labels.requiredHelp}\n onChange={event => operations.setRequired?.(property.id, event.target.checked)}\n />\n {labels.required}\n </label>\n )}\n\n {canSetKey && (\n <button\n {...parts?.key}\n type='button'\n aria-pressed={property.isKey === true}\n aria-label={labels.keyProperty(property.name)}\n title={property.isKey ? labels.isKey : labels.setAsKey}\n className={`cratis-schema-editor__key ${parts?.key?.className ?? ''}`}\n data-cratis-part='key'\n data-pressed={property.isKey === true || undefined}\n onClick={() => operations.setKey?.(property.id)}\n >\n <FaKey aria-hidden='true' />\n </button>\n )}\n\n {context.renderAccessory && (\n <span {...parts?.accessory} className={`cratis-schema-editor__accessory ${parts?.accessory?.className ?? ''}`} data-cratis-part='accessory'>\n {context.renderAccessory(property, rowContext)}\n </span>\n )}\n\n {isProtected ? (\n <span\n {...parts?.protected}\n role='img'\n aria-label={labels.protectedProperty}\n title={labels.protectedProperty}\n className={`cratis-schema-editor__protected ${parts?.protected?.className ?? ''}`}\n data-cratis-part='protected'\n >\n <FaLock aria-hidden='true' />\n </span>\n ) : canRemove && (\n <button\n {...parts?.remove}\n type='button'\n aria-label={labels.deletePropertyFor(property.name)}\n title={labels.deletePropertyFor(property.name)}\n className={`cratis-schema-editor__remove ${parts?.remove?.className ?? ''}`}\n data-cratis-part='remove'\n onClick={() => operations.remove?.(property.id)}\n >\n <FaXmark aria-hidden='true' />\n </button>\n )}\n </div>\n\n {details && (\n <div {...parts?.details} className={`cratis-schema-editor__details ${parts?.details?.className ?? ''}`} data-cratis-part='details'>\n {details}\n </div>\n )}\n\n {hasNestedProperties(property.type) && (\n <>\n {(property.children ?? []).length > 0 && (\n <ul\n {...parts?.list}\n aria-label={nestedLabel}\n className={`cratis-schema-editor__list cratis-schema-editor__list--nested ${parts?.list?.className ?? ''}`}\n data-cratis-part='list'\n >\n {(property.children ?? []).map(child => (\n <SchemaPropertyRow key={child.id} property={child} siblings={property.children ?? []} depth={depth + 1} />\n ))}\n </ul>\n )}\n {canAddChild && (\n <PropertyTypeMenu\n labels={labels}\n concepts={context.concepts}\n triggerPart='add'\n triggerLabel={labels.addPropertyTo(property.name)}\n parts={parts}\n onSelect={(type, concept) => operations.addChild?.(property.id, type, concept)}\n >\n <FaPlus aria-hidden='true' />\n {labels.addProperty}\n </PropertyTypeMenu>\n )}\n </>\n )}\n </li>\n );\n};\n"],"names":["_jsx","_jsxs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AAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,aAE9ED,GAAA,CAAC,MAAM,EAAA,EAAA,aAAA,EAAa,MAAM,GAAG,EAC5B,MAAM,CAAC,WAAW,IACJ,CACtB,CAAA,EAAA,CACF,CACN,CAAA,EAAA,CACA;AAEb;;"}
1
+ {"version":3,"file":"SchemaPropertyRow.js","sources":["../../../../SchemaEditor/Tree/SchemaPropertyRow.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 { useEffect, useId, useRef, useState, type KeyboardEvent, type MouseEvent } from 'react';\nimport { FaKey, FaLock, FaPlus, FaXmark } from 'react-icons/fa6';\nimport type { Property } from './Property';\nimport { GeneratedToggle } from './GeneratedToggle';\nimport { PropertyNameProblem, findPropertyNameProblem } from './propertyNaming';\nimport { PropertyTypeBadge } from './PropertyTypeBadge';\nimport { PropertyTypeMenu } from './PropertyTypeMenu';\nimport { useSchemaEditorContext } from './SchemaEditorContext';\nimport type { SchemaPropertyContext } from './SchemaPropertyContext';\nimport { hasNestedProperties, propertyTypeName } from './propertyTypeDisplay';\n\n/** Props for one row of the editor, and everything nested under it. */\nexport interface SchemaPropertyRowProps {\n /** The property shown. */\n property: Property;\n\n /** The properties that share its parent, including itself. */\n siblings: Property[];\n\n /** How deeply the property is nested. */\n depth: number;\n}\n\nconst interactiveSelector = 'button, input, label, textarea, select, a, [role=\"menu\"]';\n\n/** One property: its row of controls, the host's details beneath it, and the properties nested under it. */\nexport const SchemaPropertyRow = ({ property, siblings, depth }: SchemaPropertyRowProps) => {\n const context = useSchemaEditorContext();\n const { labels, parts, operations, readOnly } = context;\n const messageId = useId();\n const nameInput = useRef<HTMLInputElement>(null);\n const [isEditing, setIsEditing] = useState(false);\n const [draftName, setDraftName] = useState(property.name);\n const [problem, setProblem] = useState<string | undefined>(undefined);\n\n const rowContext: SchemaPropertyContext = { depth, siblings, properties: context.properties, readOnly };\n const rowState = context.getRowState?.(property, rowContext);\n const details = context.renderDetails?.(property, rowContext);\n const isProtected = context.isProtected(property);\n const canRename = !readOnly && !isProtected && operations.rename !== undefined;\n const canRemove = !readOnly && !isProtected && operations.remove !== undefined;\n const canChangeType = !readOnly && operations.changeType !== undefined && rowState?.lockType !== true;\n const canSetKey = !readOnly && operations.setKey !== undefined && context.isKeyAllowed(property, rowContext);\n const canAddChild = !readOnly && operations.addChild !== undefined && hasNestedProperties(property.type);\n const lockReason = rowState?.lockType === true ? rowState.lockTypeReason : undefined;\n const isSelected = context.selectedPropertyId === property.id;\n const typeName = propertyTypeName(property.type, labels);\n const nestedLabel = labels.nestedProperties(property.name);\n\n useEffect(() => {\n if (isEditing) nameInput.current?.select();\n }, [isEditing]);\n\n const startEditing = () => {\n if (!canRename) return;\n setDraftName(property.name);\n setProblem(undefined);\n setIsEditing(true);\n };\n\n const stopEditing = () => {\n setIsEditing(false);\n setProblem(undefined);\n };\n\n const describe = (name: string): string | undefined => {\n const found = findPropertyNameProblem(name, property.id, siblings);\n if (found === PropertyNameProblem.Empty) return labels.nameRequired;\n if (found === PropertyNameProblem.Reserved) return labels.nameReserved(name);\n if (found === PropertyNameProblem.Duplicate) return labels.nameDuplicate(name);\n return context.validateName?.(name, property, siblings);\n };\n\n const commit = (): boolean => {\n const name = draftName.trim();\n if (name === property.name) {\n stopEditing();\n return true;\n }\n const message = describe(name);\n if (message) {\n setProblem(message);\n return false;\n }\n stopEditing();\n operations.rename?.(property.id, name);\n return true;\n };\n\n const handleEditKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n commit();\n } else if (event.key === 'Escape') {\n event.stopPropagation();\n stopEditing();\n }\n };\n\n const handleRowClick = (event: MouseEvent<HTMLDivElement>) => {\n const target = event.target as HTMLElement;\n const optedIn = target.closest('[data-schema-row-select]');\n if (optedIn && event.currentTarget.contains(optedIn)) {\n context.onPropertyClick?.(property.id);\n return;\n }\n const interactive = target.closest(interactiveSelector);\n if (interactive && interactive.getAttribute('data-cratis-part') !== 'name') return;\n context.onPropertyClick?.(property.id);\n };\n\n const defaultBadge = <PropertyTypeBadge property={property} labels={labels} part={parts?.badge} lockReason={lockReason} />;\n const typeBadge = context.renderTypeBadge ? context.renderTypeBadge(property, rowContext, defaultBadge) : defaultBadge;\n const rowAttributes = rowState?.attributes ?? {};\n const isSelectable = context.onPropertyClick !== undefined;\n\n return (\n <li\n {...parts?.property}\n className={`cratis-schema-editor__property ${parts?.property?.className ?? ''}`}\n data-cratis-part='property'\n data-property-type={property.type}\n >\n <div\n {...parts?.row}\n {...rowAttributes}\n title={rowState?.title}\n className={`cratis-schema-editor__row ${rowState?.className ?? ''} ${parts?.row?.className ?? ''}`}\n data-cratis-part='row'\n data-selected={isSelected || undefined}\n onClick={handleRowClick}\n >\n {context.renderLeading && (\n <span {...parts?.leading} className={`cratis-schema-editor__leading ${parts?.leading?.className ?? ''}`} data-cratis-part='leading'>\n {context.renderLeading(property, rowContext)}\n </span>\n )}\n\n {isEditing ? (\n <span className='cratis-schema-editor__name-edit'>\n <input\n {...parts?.nameInput}\n ref={nameInput}\n type='text'\n value={draftName}\n aria-label={labels.propertyNameFor(property.name)}\n aria-invalid={problem !== undefined || undefined}\n aria-describedby={problem ? messageId : undefined}\n className={`cratis-schema-editor__name-input ${parts?.nameInput?.className ?? ''}`}\n data-cratis-part='nameInput'\n data-invalid={problem !== undefined || undefined}\n onChange={event => { setDraftName(event.target.value); setProblem(undefined); }}\n onBlur={() => { if (!commit()) stopEditing(); }}\n onKeyDown={handleEditKeyDown}\n />\n {problem && (\n <p\n {...parts?.message}\n id={messageId}\n role='alert'\n className={`cratis-schema-editor__message ${parts?.message?.className ?? ''}`}\n data-cratis-part='message'\n >\n {problem}\n </p>\n )}\n </span>\n ) : canRename || isSelectable ? (\n <button\n {...parts?.name}\n type='button'\n title={canRename ? labels.renameHint : undefined}\n aria-keyshortcuts={canRename ? 'F2' : undefined}\n className={`cratis-schema-editor__name ${parts?.name?.className ?? ''}`}\n data-cratis-part='name'\n onDoubleClick={startEditing}\n onKeyDown={event => { if (event.key === 'F2') { event.preventDefault(); startEditing(); } }}\n >\n {property.name}\n </button>\n ) : (\n <span className={`cratis-schema-editor__name cratis-schema-editor__name--static ${parts?.name?.className ?? ''}`} data-cratis-part='name'>\n {property.name}\n </span>\n )}\n\n {canChangeType ? (\n <PropertyTypeMenu\n labels={labels}\n concepts={context.concepts}\n triggerPart='typeButton'\n triggerLabel={labels.changeType(property.name, property.concept ?? typeName)}\n parts={parts}\n onSelect={(type, concept) => operations.changeType?.(property.id, type, concept)}\n >\n {typeBadge}\n </PropertyTypeMenu>\n ) : typeBadge}\n\n {context.isRequiredAllowed && operations.setRequired !== undefined && (\n <label\n {...parts?.required}\n title={labels.requiredHelp}\n className={`cratis-schema-editor__required ${parts?.required?.className ?? ''}`}\n data-cratis-part='required'\n >\n <input\n type='checkbox'\n checked={property.isRequired === true}\n disabled={readOnly}\n aria-label={labels.requiredProperty(property.name)}\n aria-description={labels.requiredHelp}\n onChange={event => operations.setRequired?.(property.id, event.target.checked)}\n />\n {labels.required}\n </label>\n )}\n\n {canSetKey && (\n <button\n {...parts?.key}\n type='button'\n aria-pressed={property.isKey === true}\n aria-label={labels.keyProperty(property.name)}\n title={property.isKey ? labels.isKey : labels.setAsKey}\n className={`cratis-schema-editor__toggle cratis-schema-editor__key ${parts?.key?.className ?? ''}`}\n data-cratis-part='key'\n data-pressed={property.isKey === true || undefined}\n onClick={() => operations.setKey?.(property.id)}\n >\n <FaKey aria-hidden='true' />\n </button>\n )}\n\n <GeneratedToggle property={property} rowContext={rowContext} />\n\n {context.renderAccessory && (\n <span {...parts?.accessory} className={`cratis-schema-editor__accessory ${parts?.accessory?.className ?? ''}`} data-cratis-part='accessory'>\n {context.renderAccessory(property, rowContext)}\n </span>\n )}\n\n {isProtected ? (\n <span\n {...parts?.protected}\n role='img'\n aria-label={labels.protectedProperty}\n title={labels.protectedProperty}\n className={`cratis-schema-editor__protected ${parts?.protected?.className ?? ''}`}\n data-cratis-part='protected'\n >\n <FaLock aria-hidden='true' />\n </span>\n ) : canRemove && (\n <button\n {...parts?.remove}\n type='button'\n aria-label={labels.deletePropertyFor(property.name)}\n title={labels.deletePropertyFor(property.name)}\n className={`cratis-schema-editor__remove ${parts?.remove?.className ?? ''}`}\n data-cratis-part='remove'\n onClick={() => operations.remove?.(property.id)}\n >\n <FaXmark aria-hidden='true' />\n </button>\n )}\n </div>\n\n {details && (\n <div {...parts?.details} className={`cratis-schema-editor__details ${parts?.details?.className ?? ''}`} data-cratis-part='details'>\n {details}\n </div>\n )}\n\n {hasNestedProperties(property.type) && (\n <>\n {(property.children ?? []).length > 0 && (\n <ul\n {...parts?.list}\n aria-label={nestedLabel}\n className={`cratis-schema-editor__list cratis-schema-editor__list--nested ${parts?.list?.className ?? ''}`}\n data-cratis-part='list'\n >\n {(property.children ?? []).map(child => (\n <SchemaPropertyRow key={child.id} property={child} siblings={property.children ?? []} depth={depth + 1} />\n ))}\n </ul>\n )}\n {canAddChild && (\n <PropertyTypeMenu\n labels={labels}\n concepts={context.concepts}\n triggerPart='add'\n triggerLabel={labels.addPropertyTo(property.name)}\n parts={parts}\n onSelect={(type, concept) => operations.addChild?.(property.id, type, concept)}\n >\n <FaPlus aria-hidden='true' />\n {labels.addProperty}\n </PropertyTypeMenu>\n )}\n </>\n )}\n </li>\n );\n};\n"],"names":["_jsx","_jsxs"],"mappings":";;;;;;;;;;AA0BA,MAAM,mBAAmB,GAAG,0DAA0D;AAG/E,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAA0B,KAAI;AACvF,IAAA,MAAM,OAAO,GAAG,sBAAsB,EAAE;IACxC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ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,EAAA,CACA;AAEb;;"}
@@ -43,6 +43,8 @@ export interface TreeSchemaEditorProps {
43
43
  onChangePropertyType?: (propertyId: string, type: PropertyType, concept?: string) => void;
44
44
  /** Controlled mode: make a property the key of its object, or clear it when it already is. */
45
45
  onSetKeyProperty?: (propertyId: string) => void;
46
+ /** Controlled mode: set whether a property's value is generated. Implies allowGeneratedProperty unless explicitly false. */
47
+ onSetGeneratedProperty?: (propertyId: string, isGenerated: boolean) => void;
46
48
  /** Controlled mode: set whether a property must be present. */
47
49
  onSetRequiredProperty?: (propertyId: string, isRequired: boolean) => void;
48
50
  /**
@@ -56,6 +58,11 @@ export interface TreeSchemaEditorProps {
56
58
  * controlled mode, where supplying `onSetKeyProperty` implies `true` unless this is explicitly `false`.
57
59
  */
58
60
  allowKeyProperty?: boolean | ((property: Property, context: SchemaPropertyContext) => boolean);
61
+ /**
62
+ * Offers the Generated toggle on every property, or on properties accepted by the predicate. Off by default;
63
+ * a controlled onSetGeneratedProperty callback implies true unless explicitly false. The table layout ignores it.
64
+ */
65
+ allowGeneratedProperty?: boolean | ((property: Property, context: SchemaPropertyContext) => boolean);
59
66
  /**
60
67
  * Offers the toggle for whether a property must be present (the `required` list). Off by default, except in
61
68
  * controlled mode, where supplying `onSetRequiredProperty` implies `true` unless this is explicitly `false`.
@@ -112,5 +119,5 @@ export interface TreeSchemaEditorProps {
112
119
  * attached through the slots (`header`, `footer`, `renderPropertyLeading`, `renderPropertyAccessory`,
113
120
  * `renderPropertyDetails`, `renderPropertyTypeBadge`) and `getPropertyRowState`.
114
121
  */
115
- export declare const TreeSchemaEditor: ({ schema, onChange, onPropertiesChange, onPropertyRemoved, onPropertyRenamed, properties: controlledProperties, onAddProperty, onAddChildProperty, onDeleteProperty, onRenameProperty, onChangePropertyType, onSetKeyProperty, onSetRequiredProperty, concepts: suppliedConcepts, allowKeyProperty, allowRequired, readOnly, isPropertyProtected, validatePropertyName, selectedPropertyId, onPropertyClick, header, footer, renderPropertyLeading, renderPropertyAccessory, renderPropertyDetails, getPropertyRowState, renderPropertyTypeBadge, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }: TreeSchemaEditorProps) => import("react").JSX.Element;
122
+ export declare const TreeSchemaEditor: ({ schema, onChange, onPropertiesChange, onPropertyRemoved, onPropertyRenamed, properties: controlledProperties, onAddProperty, onAddChildProperty, onDeleteProperty, onRenameProperty, onChangePropertyType, onSetKeyProperty, onSetGeneratedProperty, onSetRequiredProperty, concepts: suppliedConcepts, allowKeyProperty, allowGeneratedProperty, allowRequired, readOnly, isPropertyProtected, validatePropertyName, selectedPropertyId, onPropertyClick, header, footer, renderPropertyLeading, renderPropertyAccessory, renderPropertyDetails, getPropertyRowState, renderPropertyTypeBadge, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }: TreeSchemaEditorProps) => import("react").JSX.Element;
116
123
  //# sourceMappingURL=TreeSchemaEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TreeSchemaEditor.d.ts","sourceRoot":"","sources":["../../../../SchemaEditor/Tree/TreeSchemaEditor.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAmB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAgB,CAAC;AAe9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAAuB,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAqB,CAAC;AAE7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAAy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AqB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAE1F,wGAAwG;IACxG,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAE5F,4JAA4J;IAC5J,qBAAqB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC;IAE1F,iIAAiI;IACjI,mBAAmB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,sBAAsB,GAAG,SAAS,CAAC;IAEjH;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,KAAK,SAAS,CAAC;IAErH,qEAAqE;IACrE,MAAM,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAErC,qEAAqE;IACrE,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,+CAA+C;IAC/C,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,qDAAqD;IACrD,EAAE,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAUD;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,2qBAoC1B,qBAAqB,gCA6IvB,CAAC"}
@@ -4,13 +4,19 @@ import { FaPlus } from 'react-icons/fa6';
4
4
  import { useOptionalPropertyConcepts } from './PropertyConceptsContext.js';
5
5
  import { findPropertyById, totalPropertyCount } from './propertyTree.js';
6
6
  import { PropertyTypeMenu } from './PropertyTypeMenu.js';
7
- import { jsonSchemaToProperties, propertiesToJsonSchema, setRequiredProperty, setKeyProperty, changePropertyType, renameProperty, removeProperty, addChildProperty, addProperty } from './schemaConversion.js';
7
+ import { jsonSchemaToProperties, propertiesToJsonSchema, setRequiredProperty, setGeneratedProperty, setKeyProperty, changePropertyType, renameProperty, removeProperty, addChildProperty, addProperty } from './schemaConversion.js';
8
8
  import { SchemaEditorContext } from './SchemaEditorContext.js';
9
9
  import { resolveSchemaEditorLabels } from '../resolveSchemaEditorLabels.js';
10
10
  import { SchemaPropertyRow } from './SchemaPropertyRow.js';
11
11
 
12
12
  const never = () => false;
13
- const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemoved, onPropertyRenamed, properties: controlledProperties, onAddProperty, onAddChildProperty, onDeleteProperty, onRenameProperty, onChangePropertyType, onSetKeyProperty, onSetRequiredProperty, concepts: suppliedConcepts, allowKeyProperty, allowRequired, readOnly = false, isPropertyProtected, validatePropertyName, selectedPropertyId, onPropertyClick, header, footer, renderPropertyLeading, renderPropertyAccessory, renderPropertyDetails, getPropertyRowState, renderPropertyTypeBadge, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }) => {
13
+ function allowance(flag, callback, isControlled) {
14
+ const allowed = flag ?? (isControlled && callback !== undefined);
15
+ if (typeof allowed === 'function')
16
+ return allowed;
17
+ return allowed ? () => true : never;
18
+ }
19
+ const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemoved, onPropertyRenamed, properties: controlledProperties, onAddProperty, onAddChildProperty, onDeleteProperty, onRenameProperty, onChangePropertyType, onSetKeyProperty, onSetGeneratedProperty, onSetRequiredProperty, concepts: suppliedConcepts, allowKeyProperty, allowGeneratedProperty, allowRequired, readOnly = false, isPropertyProtected, validatePropertyName, selectedPropertyId, onPropertyClick, header, footer, renderPropertyLeading, renderPropertyAccessory, renderPropertyDetails, getPropertyRowState, renderPropertyTypeBadge, labels: suppliedLabels, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, className, pt, }) => {
14
20
  const labels = useMemo(() => resolveSchemaEditorLabels(suppliedLabels), [suppliedLabels]);
15
21
  const providedConcepts = useOptionalPropertyConcepts();
16
22
  const concepts = suppliedConcepts ?? providedConcepts;
@@ -23,14 +29,14 @@ const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemo
23
29
  const [seenSchema, setSeenSchema] = useState(incomingSchema);
24
30
  if (!isControlled && incomingSchema !== seenSchema) {
25
31
  setSeenSchema(incomingSchema);
26
- if (schema !== undefined && incomingSchema !== JSON.stringify(propertiesToJsonSchema(ownedProperties))) {
32
+ if (schema !== undefined && incomingSchema !== JSON.stringify(propertiesToJsonSchema(ownedProperties, schema))) {
27
33
  setOwnedProperties(jsonSchemaToProperties(schema));
28
34
  }
29
35
  }
30
36
  const apply = (next) => {
31
37
  latest.current = next;
32
38
  setOwnedProperties(next);
33
- onChange?.(propertiesToJsonSchema(next), { source: 'user' });
39
+ onChange?.(propertiesToJsonSchema(next, schema), { source: 'user' });
34
40
  onPropertiesChange?.(next);
35
41
  };
36
42
  const ownedOperations = {
@@ -51,6 +57,7 @@ const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemo
51
57
  },
52
58
  changeType: (propertyId, type, concept) => apply(changePropertyType(latest.current, propertyId, type, concept)),
53
59
  setKey: propertyId => apply(setKeyProperty(latest.current, propertyId)),
60
+ setGenerated: (propertyId, isGenerated) => apply(setGeneratedProperty(latest.current, propertyId, isGenerated)),
54
61
  setRequired: (propertyId, isRequired) => apply(setRequiredProperty(latest.current, propertyId, isRequired)),
55
62
  };
56
63
  const controlledOperations = {
@@ -59,17 +66,13 @@ const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemo
59
66
  rename: onRenameProperty,
60
67
  changeType: onChangePropertyType,
61
68
  setKey: onSetKeyProperty,
69
+ setGenerated: onSetGeneratedProperty,
62
70
  setRequired: onSetRequiredProperty,
63
71
  };
64
72
  const operations = isControlled ? controlledOperations : ownedOperations;
65
73
  const addRoot = isControlled
66
74
  ? onAddProperty
67
75
  : (type, concept) => apply(addProperty(latest.current, type, totalPropertyCount(latest.current), concept));
68
- const keyAllowance = allowKeyProperty ?? (isControlled && onSetKeyProperty !== undefined);
69
- const isKeyAllowed = typeof keyAllowance === 'function'
70
- ? keyAllowance
71
- : keyAllowance ? () => true : never;
72
- const isRequiredAllowed = allowRequired ?? (isControlled && onSetRequiredProperty !== undefined);
73
76
  const contextValue = {
74
77
  labels,
75
78
  parts: pt,
@@ -79,8 +82,9 @@ const TreeSchemaEditor = ({ schema, onChange, onPropertiesChange, onPropertyRemo
79
82
  operations,
80
83
  selectedPropertyId,
81
84
  onPropertyClick,
82
- isKeyAllowed,
83
- isRequiredAllowed,
85
+ isKeyAllowed: allowance(allowKeyProperty, onSetKeyProperty, isControlled),
86
+ isGeneratedAllowed: allowance(allowGeneratedProperty, onSetGeneratedProperty, isControlled),
87
+ isRequiredAllowed: allowRequired ?? (isControlled && onSetRequiredProperty !== undefined),
84
88
  isProtected: isPropertyProtected ?? never,
85
89
  validateName: validatePropertyName,
86
90
  getRowState: getPropertyRowState,