@cratis/components 1.0.4 → 1.1.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.
- package/dist/cjs/CommandDialog/CommandDialog.js +2 -2
- package/dist/cjs/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/cjs/Common/Tooltip.css +10 -0
- package/dist/cjs/Common/Tooltip.js +17 -0
- package/dist/cjs/Common/Tooltip.js.map +1 -0
- package/dist/cjs/Common/index.js +2 -0
- package/dist/cjs/Common/index.js.map +1 -1
- package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js +3 -16
- package/dist/cjs/ObjectContentEditor/ObjectContentEditor.js.map +1 -1
- package/dist/cjs/ObjectContentEditor/objectHelpers.js +19 -0
- package/dist/cjs/ObjectContentEditor/objectHelpers.js.map +1 -0
- package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js +2 -10
- package/dist/cjs/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -1
- package/dist/cjs/ObjectNavigationalBar/breadcrumbHelpers.js +15 -0
- package/dist/cjs/ObjectNavigationalBar/breadcrumbHelpers.js.map +1 -0
- package/dist/cjs/SchemaEditor/SchemaEditor.js +4 -35
- package/dist/cjs/SchemaEditor/SchemaEditor.js.map +1 -1
- package/dist/cjs/SchemaEditor/schemaHelpers.js +33 -0
- package/dist/cjs/SchemaEditor/schemaHelpers.js.map +1 -0
- package/dist/cjs/TimeMachine/Properties.js +2 -7
- package/dist/cjs/TimeMachine/Properties.js.map +1 -1
- package/dist/cjs/TimeMachine/propertiesHelpers.js +11 -0
- package/dist/cjs/TimeMachine/propertiesHelpers.js.map +1 -0
- package/dist/cjs/Toolbar/Toolbar.css +131 -0
- package/dist/cjs/Toolbar/Toolbar.js +9 -0
- package/dist/cjs/Toolbar/Toolbar.js.map +1 -0
- package/dist/cjs/Toolbar/ToolbarButton.js +12 -0
- package/dist/cjs/Toolbar/ToolbarButton.js.map +1 -0
- package/dist/cjs/Toolbar/ToolbarContext.js +6 -0
- package/dist/cjs/Toolbar/ToolbarContext.js.map +1 -0
- package/dist/cjs/Toolbar/ToolbarFanOutItem.js +33 -0
- package/dist/cjs/Toolbar/ToolbarFanOutItem.js.map +1 -0
- package/dist/cjs/Toolbar/ToolbarSection.js +32 -0
- package/dist/cjs/Toolbar/ToolbarSection.js.map +1 -0
- package/dist/cjs/Toolbar/index.js +16 -0
- package/dist/cjs/Toolbar/index.js.map +1 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.d.ts.map +1 -1
- package/dist/esm/CommandDialog/CommandDialog.js +2 -2
- package/dist/esm/CommandDialog/CommandDialog.js.map +1 -1
- package/dist/esm/Common/Tooltip.css +10 -0
- package/dist/esm/Common/Tooltip.d.ts +10 -0
- package/dist/esm/Common/Tooltip.d.ts.map +1 -0
- package/dist/esm/Common/Tooltip.js +15 -0
- package/dist/esm/Common/Tooltip.js.map +1 -0
- package/dist/esm/Common/index.d.ts +1 -0
- package/dist/esm/Common/index.d.ts.map +1 -1
- package/dist/esm/Common/index.js +1 -0
- package/dist/esm/Common/index.js.map +1 -1
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.d.ts.map +1 -1
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.js +1 -14
- package/dist/esm/ObjectContentEditor/ObjectContentEditor.js.map +1 -1
- package/dist/esm/ObjectContentEditor/objectHelpers.d.ts +3 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.d.ts.map +1 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.js +17 -0
- package/dist/esm/ObjectContentEditor/objectHelpers.js.map +1 -0
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.d.ts.map +1 -1
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js +2 -10
- package/dist/esm/ObjectNavigationalBar/ObjectNavigationalBar.js.map +1 -1
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.d.ts +5 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.d.ts.map +1 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.js +13 -0
- package/dist/esm/ObjectNavigationalBar/breadcrumbHelpers.js.map +1 -0
- package/dist/esm/SchemaEditor/SchemaEditor.d.ts.map +1 -1
- package/dist/esm/SchemaEditor/SchemaEditor.js +2 -33
- package/dist/esm/SchemaEditor/SchemaEditor.js.map +1 -1
- package/dist/esm/SchemaEditor/schemaHelpers.d.ts +4 -0
- package/dist/esm/SchemaEditor/schemaHelpers.d.ts.map +1 -0
- package/dist/esm/SchemaEditor/schemaHelpers.js +30 -0
- package/dist/esm/SchemaEditor/schemaHelpers.js.map +1 -0
- package/dist/esm/TimeMachine/Properties.d.ts.map +1 -1
- package/dist/esm/TimeMachine/Properties.js +1 -6
- package/dist/esm/TimeMachine/Properties.js.map +1 -1
- package/dist/esm/TimeMachine/propertiesHelpers.d.ts +2 -0
- package/dist/esm/TimeMachine/propertiesHelpers.d.ts.map +1 -0
- package/dist/esm/TimeMachine/propertiesHelpers.js +9 -0
- package/dist/esm/TimeMachine/propertiesHelpers.js.map +1 -0
- package/dist/esm/Toolbar/Toolbar.css +131 -0
- package/dist/esm/Toolbar/Toolbar.d.ts +8 -0
- package/dist/esm/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/esm/Toolbar/Toolbar.js +7 -0
- package/dist/esm/Toolbar/Toolbar.js.map +1 -0
- package/dist/esm/Toolbar/Toolbar.stories.d.ts +11 -0
- package/dist/esm/Toolbar/Toolbar.stories.d.ts.map +1 -0
- package/dist/esm/Toolbar/Toolbar.stories.js +53 -0
- package/dist/esm/Toolbar/Toolbar.stories.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarButton.d.ts +10 -0
- package/dist/esm/Toolbar/ToolbarButton.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarButton.js +10 -0
- package/dist/esm/Toolbar/ToolbarButton.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarContext.d.ts +7 -0
- package/dist/esm/Toolbar/ToolbarContext.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarContext.js +4 -0
- package/dist/esm/Toolbar/ToolbarContext.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarFanOutItem.d.ts +11 -0
- package/dist/esm/Toolbar/ToolbarFanOutItem.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarFanOutItem.js +31 -0
- package/dist/esm/Toolbar/ToolbarFanOutItem.js.map +1 -0
- package/dist/esm/Toolbar/ToolbarSection.d.ts +8 -0
- package/dist/esm/Toolbar/ToolbarSection.d.ts.map +1 -0
- package/dist/esm/Toolbar/ToolbarSection.js +30 -0
- package/dist/esm/Toolbar/ToolbarSection.js.map +1 -0
- package/dist/esm/Toolbar/index.d.ts +11 -0
- package/dist/esm/Toolbar/index.d.ts.map +1 -0
- package/dist/esm/Toolbar/index.js +6 -0
- package/dist/esm/Toolbar/index.js.map +1 -0
- package/dist/esm/given.d.ts +5 -0
- package/dist/esm/given.d.ts.map +1 -0
- package/dist/esm/given.js +7 -0
- package/dist/esm/given.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from 'primereact/button';\nimport { DataTable } from 'primereact/datatable';\nimport { Column } from 'primereact/column';\nimport { Menubar } from 'primereact/menubar';\nimport { Tooltip } from 'primereact/tooltip';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport { JsonSchema, JsonSchemaProperty, NavigationItem } from '../types/JsonSchema';\nimport { TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport css from './SchemaEditor.module.css';\nimport { MenuItem } from 'primereact/menuitem';\n\nexport interface SchemaEditorProps {\n schema: JsonSchema;\n eventTypeName?: string;\n canEdit?: boolean;\n canNotEditReason?: string;\n onChange?: (schema: JsonSchema) => void;\n onSave?: () => void;\n onCancel?: () => void;\n editMode?: boolean;\n saveDisabled?: boolean;\n cancelDisabled?: boolean;\n typeFormats?: TypeFormat[];\n}\n\nexport const SchemaEditor = ({ \n schema, \n eventTypeName = '', \n canEdit = true, \n canNotEditReason, \n onChange, \n onSave, \n onCancel, \n editMode, \n saveDisabled = false, \n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS\n}: SchemaEditorProps) => {\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(schema);\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(schema);\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validatePropertyName = useCallback((name: string, propertyId: string, allProperties: JsonSchemaProperty[]): string | undefined => {\n if (!name || name.trim() === '') {\n return 'Property name cannot be empty';\n }\n\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n if (!validIdentifierPattern.test(name)) {\n return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';\n }\n\n const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);\n if (duplicates.length > 0) {\n return 'Property name must be unique';\n }\n\n return undefined;\n }, []);\n\n const validateAllProperties = useCallback((properties: JsonSchemaProperty[]) => {\n const errors: Record<string, string> = {};\n\n properties.forEach(prop => {\n if (!prop.name) return;\n const error = validatePropertyName(prop.name, prop.id!, properties);\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n }, [validatePropertyName]);\n\n useEffect(() => {\n setCurrentSchema(schema);\n setInitialSchema(JSON.parse(JSON.stringify(schema)));\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n required: (currentSchema.required as string[] | undefined)?.includes(name) || false\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps);\n }\n };\n\n const updateSchemaAtPath = useCallback((path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = JSON.parse(JSON.stringify(currentSchema));\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated);\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment];\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n targetSchema.properties[lastSegment] = updater(targetSchema.properties[lastSegment] || {});\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema);\n }, [currentSchema, onChange]);\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const removeProperty = useCallback((propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateProperty = useCallback((oldName: string, field: keyof JsonSchemaProperty, value: unknown, additionalUpdates?: Partial<JsonSchemaProperty>) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n if (field === 'name') {\n if (value !== oldName && !newProps[value as string]) {\n newProps[value as string] = prop;\n delete newProps[oldName];\n }\n } else if (field === 'type') {\n prop.type = value as string;\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n } else {\n delete prop.items;\n delete prop.properties;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateArrayItemType = useCallback((propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const navigateToProperty = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n }, [currentPath]);\n\n const navigateToArrayItems = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n }, [currentPath]);\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n }, [currentPath, eventTypeName]);\n\n const handleSave = useCallback(() => {\n onSave?.();\n setIsEditMode(false);\n }, [onSave]);\n\n const handleCancel = useCallback(() => {\n setCurrentSchema(JSON.parse(JSON.stringify(initialSchema)));\n onChange?.(JSON.parse(JSON.stringify(initialSchema)));\n setIsEditMode(false);\n onCancel?.();\n }, [initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n setInitialSchema(JSON.parse(JSON.stringify(currentSchema)));\n setIsEditMode(true);\n }, [currentSchema]);\n\n const getBreadcrumbItems = () => {\n const items: NavigationItem[] = [{ name: eventTypeName, path: [] }];\n\n for (let i = 0; i < currentPath.length; i++) {\n const segment = currentPath[i];\n if (segment === '$items') {\n items.push({\n name: '[items]',\n path: currentPath.slice(0, i + 1)\n });\n } else {\n items.push({\n name: segment,\n path: currentPath.slice(0, i + 1)\n });\n }\n }\n\n return items;\n };\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors = Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo(() => [\n ...(!isEditMode ? [{\n label: 'Edit',\n icon: <faIcons.FaPencil className='mr-2' />,\n command: canEdit ? handleEdit : undefined,\n className: !canEdit ? 'edit-disabled-with-reason' : undefined,\n template: !canEdit && canNotEditReason ? (item: MenuItem) => (\n <div\n className=\"p-menuitem-link p-disabled\"\n data-pr-tooltip={canNotEditReason}\n data-pr-position=\"bottom\"\n style={{ cursor: 'not-allowed', opacity: 0.6 }}\n >\n {item.icon}\n <span className=\"p-menuitem-text\">{item.label}</span>\n </div>\n ) : undefined\n }] : []),\n ...(isEditMode ? [\n ...(!saveDisabled ? [{\n label: 'Save',\n icon: <faIcons.FaCheck className='mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors\n }] : []),\n ...(!cancelDisabled ? [{\n label: 'Cancel',\n icon: <faIcons.FaXmark className='mr-2' />,\n command: handleCancel\n }] : []),\n {\n label: 'Add Property',\n icon: <faIcons.FaPlus className='mr-2' />,\n command: addProperty\n }\n ] : [])\n ], [isEditMode, handleSave, handleCancel, handleEdit, addProperty, canEdit, canNotEditReason, hasValidationErrors, saveDisabled, cancelDisabled]);\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n\n return (\n <div className=\"schema-editor\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <div className=\"px-4 py-4\">\n <Tooltip target=\"[data-pr-tooltip]\" />\n <div className=\"schema-editor-menubar\">\n <Menubar aria-label=\"Actions\" model={menuItems} />\n </div>\n </div>\n\n <div className=\"px-4 py-2 border-bottom-1 surface-border\">\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Button\n icon={<faIcons.FaArrowLeft />}\n className=\"p-button-text p-button-sm\"\n onClick={navigateBack}\n disabled={isAtRoot}\n tooltip=\"Navigate back\"\n tooltipOptions={{ position: 'top' }}\n />\n <div style={{ fontSize: '0.9rem', color: 'var(--text-color-secondary)', cursor: 'pointer' }}>\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className=\"mx-2\">></span>}\n <span\n onClick={() => navigateToBreadcrumb(index)}\n style={{ cursor: 'pointer', textDecoration: index < breadcrumbItems.length - 1 ? 'underline' : 'none' }}\n >\n {item.name}\n </span>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div style={{ fontSize: '0.875rem', color: 'var(--text-color-secondary)', marginTop: '0.5rem', marginLeft: '2.5rem', fontStyle: 'italic', display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <Tooltip key={`nav-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-navigation-tooltip\" mouseTrack mouseTrackTop={15} />\n <Tooltip key={`desc-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-description-tooltip\" />\n <DataTable\n key={`${isEditMode}-${currentPath.join('/')}`}\n value={properties}\n dataKey=\"id\"\n emptyMessage=\"No properties defined\"\n rowClassName={(rowData: JsonSchemaProperty) => {\n if (!isEditMode && (rowData.type === 'object' || (rowData.type === 'array' && rowData.items?.type === 'object'))) {\n return css.navigableRow;\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data as JsonSchemaProperty;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (rowData.type === 'array' && rowData.items?.type === 'object') {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n tbody: { style: { borderTop: '1px solid var(--surface-border)' } }\n }}\n >\n <Column\n field=\"name\"\n header=\"Property\"\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n />\n )}\n style={{ width: '30%' }}\n />\n <Column\n header=\"Type\"\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTable>\n </div>\n </div>\n );\n};\n"],"names":["DEFAULT_TYPE_FORMATS","useState","useEffect","useCallback","useMemo","_jsx","faIcons","_jsxs","Tooltip","Menubar","Button","DataTable","Column","NameCell","TypeCell"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,IAAI,EACd,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,KAAK,EACtB,WAAW,GAAGA,+BAAoB,EAClB,KAAI;IACpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGC,cAAQ,CAAW,EAAE,CAAC;IAC5D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAuB,EAAE,CAAC;IACtE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAa,MAAM,CAAC;AACtE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,QAAQ,IAAI,KAAK,CA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G,CAAC,CAAA,CAAE,CAwDrC,CAAA,EAAA,CACV,CAAA,EAAA,CACJ;AAEd;;;;"}
|
|
1
|
+
{"version":3,"file":"SchemaEditor.js","sources":["../../../SchemaEditor/SchemaEditor.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useState, useEffect, useMemo, useCallback } from 'react';\nimport { Button } from 'primereact/button';\nimport { DataTable } from 'primereact/datatable';\nimport { Column } from 'primereact/column';\nimport { Menubar } from 'primereact/menubar';\nimport { Tooltip } from 'primereact/tooltip';\nimport * as faIcons from 'react-icons/fa6';\nimport { NameCell } from './NameCell';\nimport { TypeCell } from './TypeCell';\nimport { JsonSchema, JsonSchemaProperty } from '../types/JsonSchema';\nimport { TypeFormat, DEFAULT_TYPE_FORMATS } from '../types/TypeFormat';\nimport { validatePropertyName, buildBreadcrumbItems } from './schemaHelpers';\nimport css from './SchemaEditor.module.css';\nimport { MenuItem } from 'primereact/menuitem';\n\nexport interface SchemaEditorProps {\n schema: JsonSchema;\n eventTypeName?: string;\n canEdit?: boolean;\n canNotEditReason?: string;\n onChange?: (schema: JsonSchema) => void;\n onSave?: () => void;\n onCancel?: () => void;\n editMode?: boolean;\n saveDisabled?: boolean;\n cancelDisabled?: boolean;\n typeFormats?: TypeFormat[];\n}\n\nexport const SchemaEditor = ({ \n schema, \n eventTypeName = '', \n canEdit = true, \n canNotEditReason, \n onChange, \n onSave, \n onCancel, \n editMode, \n saveDisabled = false, \n cancelDisabled = false,\n typeFormats = DEFAULT_TYPE_FORMATS\n}: SchemaEditorProps) => {\n const [currentPath, setCurrentPath] = useState<string[]>([]);\n const [properties, setProperties] = useState<JsonSchemaProperty[]>([]);\n const [currentSchema, setCurrentSchema] = useState<JsonSchema>(schema);\n const [isEditMode, setIsEditMode] = useState(editMode ?? false);\n const [initialSchema, setInitialSchema] = useState<JsonSchema>(schema);\n const [validationErrors, setValidationErrors] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (!isEditMode) {\n setCurrentPath([]);\n }\n }, [isEditMode]);\n\n const validateAllProperties = useCallback((properties: JsonSchemaProperty[]) => {\n const errors: Record<string, string> = {};\n\n properties.forEach(prop => {\n if (!prop.name) return;\n const error = validatePropertyName(prop.name, prop.id!, properties);\n if (error) {\n errors[prop.id!] = error;\n }\n });\n\n setValidationErrors(errors);\n return Object.keys(errors).length === 0;\n }, [validatePropertyName]);\n\n useEffect(() => {\n setCurrentSchema(schema);\n setInitialSchema(JSON.parse(JSON.stringify(schema)));\n }, [schema]);\n\n useEffect(() => {\n loadPropertiesForCurrentPath();\n }, [currentPath, currentSchema, isEditMode]);\n\n const loadPropertiesForCurrentPath = () => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return;\n }\n }\n\n const schemaProps: JsonSchemaProperty[] = [];\n if (targetSchema.properties) {\n let idCounter = 0;\n for (const [name, property] of Object.entries(targetSchema.properties)) {\n schemaProps.push({\n id: `prop-${currentPath.join('-')}-${idCounter++}`,\n name,\n type: property.type || 'string',\n format: property.format,\n description: property.description,\n items: property.items,\n properties: property.properties,\n required: (currentSchema.required as string[] | undefined)?.includes(name) || false\n });\n }\n }\n\n setProperties(schemaProps);\n if (isEditMode) {\n validateAllProperties(schemaProps);\n }\n };\n\n const updateSchemaAtPath = useCallback((path: string[], updater: (schema: JsonSchema) => JsonSchema) => {\n const newSchema = JSON.parse(JSON.stringify(currentSchema));\n\n if (path.length === 0) {\n const updated = updater(newSchema);\n setCurrentSchema(updated);\n onChange?.(updated);\n return;\n }\n\n let targetSchema = newSchema;\n for (let i = 0; i < path.length - 1; i++) {\n const segment = path[i];\n if (targetSchema.type === 'array' && segment === '$items') {\n if (!targetSchema.items) {\n targetSchema.items = { type: 'object', properties: {} };\n }\n targetSchema = targetSchema.items;\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment];\n }\n }\n\n const lastSegment = path[path.length - 1];\n if (targetSchema.type === 'array' && lastSegment === '$items') {\n targetSchema.items = updater(targetSchema.items || {});\n } else {\n if (!targetSchema.properties) {\n targetSchema.properties = {};\n }\n targetSchema.properties[lastSegment] = updater(targetSchema.properties[lastSegment] || {});\n }\n\n setCurrentSchema(newSchema);\n onChange?.(newSchema);\n }, [currentSchema, onChange]);\n\n const addProperty = useCallback(() => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n let newName = 'newProperty';\n let counter = 1;\n while (newProps[newName]) {\n newName = `newProperty${counter++}`;\n }\n newProps[newName] = { type: 'string' };\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const removeProperty = useCallback((propertyName: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n delete newProps[propertyName];\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateProperty = useCallback((oldName: string, field: keyof JsonSchemaProperty, value: unknown, additionalUpdates?: Partial<JsonSchemaProperty>) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[oldName] || {}) };\n\n if (field === 'name') {\n if (value !== oldName && !newProps[value as string]) {\n newProps[value as string] = prop;\n delete newProps[oldName];\n }\n } else if (field === 'type') {\n prop.type = value as string;\n if (value === 'array') {\n prop.items = { type: 'string' };\n delete prop.format;\n } else if (value === 'object') {\n prop.properties = {};\n delete prop.format;\n delete prop.items;\n } else {\n delete prop.items;\n delete prop.properties;\n }\n\n if (additionalUpdates) {\n if ('format' in additionalUpdates) {\n if (additionalUpdates.format) {\n prop.format = additionalUpdates.format as string;\n } else {\n delete prop.format;\n }\n }\n }\n\n newProps[oldName] = prop;\n } else if (field === 'format') {\n if (value && value !== 'none') {\n prop.format = value as string;\n } else {\n delete prop.format;\n }\n newProps[oldName] = prop;\n }\n\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const updateArrayItemType = useCallback((propertyName: string, itemType: string) => {\n updateSchemaAtPath(currentPath, (schema) => {\n const newProps = { ...(schema.properties || {}) };\n const prop = { ...(newProps[propertyName] || {}) };\n\n if (itemType === 'object') {\n prop.items = { type: 'object', properties: {} };\n } else if (itemType === 'array') {\n prop.items = { type: 'array', items: { type: 'string' } };\n } else {\n prop.items = { type: itemType };\n }\n\n newProps[propertyName] = prop;\n return { ...schema, properties: newProps };\n });\n }, [currentPath, updateSchemaAtPath]);\n\n const navigateToProperty = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName]);\n }, [currentPath]);\n\n const navigateToArrayItems = useCallback((propertyName: string) => {\n setCurrentPath([...currentPath, propertyName, '$items']);\n }, [currentPath]);\n\n const navigateBack = useCallback(() => {\n if (currentPath.length > 0) {\n setCurrentPath(currentPath.slice(0, -1));\n }\n }, [currentPath]);\n\n const navigateToBreadcrumb = useCallback((index: number) => {\n const items = getBreadcrumbItems();\n setCurrentPath(items[index].path);\n }, [currentPath, eventTypeName]);\n\n const handleSave = useCallback(() => {\n onSave?.();\n setIsEditMode(false);\n }, [onSave]);\n\n const handleCancel = useCallback(() => {\n setCurrentSchema(JSON.parse(JSON.stringify(initialSchema)));\n onChange?.(JSON.parse(JSON.stringify(initialSchema)));\n setIsEditMode(false);\n onCancel?.();\n }, [initialSchema, onChange, onCancel]);\n\n const handleEdit = useCallback(() => {\n setInitialSchema(JSON.parse(JSON.stringify(currentSchema)));\n setIsEditMode(true);\n }, [currentSchema]);\n\n const getBreadcrumbItems = () => buildBreadcrumbItems(eventTypeName, currentPath);\n\n const getCurrentDescription = useCallback(() => {\n let targetSchema: JsonSchema | JsonSchemaProperty = currentSchema;\n\n for (const segment of currentPath) {\n if (targetSchema.type === 'array' && segment === '$items') {\n targetSchema = targetSchema.items || {};\n } else if (targetSchema.properties && targetSchema.properties[segment]) {\n targetSchema = targetSchema.properties[segment] as JsonSchema | JsonSchemaProperty;\n } else {\n return undefined;\n }\n }\n\n return targetSchema.description;\n }, [currentSchema, currentPath]);\n\n const hasValidationErrors = Object.keys(validationErrors).length > 0;\n\n const menuItems = useMemo(() => [\n ...(!isEditMode ? [{\n label: 'Edit',\n icon: <faIcons.FaPencil className='mr-2' />,\n command: canEdit ? handleEdit : undefined,\n className: !canEdit ? 'edit-disabled-with-reason' : undefined,\n template: !canEdit && canNotEditReason ? (item: MenuItem) => (\n <div\n className=\"p-menuitem-link p-disabled\"\n data-pr-tooltip={canNotEditReason}\n data-pr-position=\"bottom\"\n style={{ cursor: 'not-allowed', opacity: 0.6 }}\n >\n {item.icon}\n <span className=\"p-menuitem-text\">{item.label}</span>\n </div>\n ) : undefined\n }] : []),\n ...(isEditMode ? [\n ...(!saveDisabled ? [{\n label: 'Save',\n icon: <faIcons.FaCheck className='mr-2' />,\n command: hasValidationErrors ? undefined : handleSave,\n disabled: hasValidationErrors\n }] : []),\n ...(!cancelDisabled ? [{\n label: 'Cancel',\n icon: <faIcons.FaXmark className='mr-2' />,\n command: handleCancel\n }] : []),\n {\n label: 'Add Property',\n icon: <faIcons.FaPlus className='mr-2' />,\n command: addProperty\n }\n ] : [])\n ], [isEditMode, handleSave, handleCancel, handleEdit, addProperty, canEdit, canNotEditReason, hasValidationErrors, saveDisabled, cancelDisabled]);\n\n const breadcrumbItems = getBreadcrumbItems();\n const isAtRoot = currentPath.length === 0;\n const currentDescription = getCurrentDescription();\n\n return (\n <div className=\"schema-editor\" style={{ display: 'flex', flexDirection: 'column', height: '100%' }}>\n <div className=\"px-4 py-4\">\n <Tooltip target=\"[data-pr-tooltip]\" />\n <div className=\"schema-editor-menubar\">\n <Menubar aria-label=\"Actions\" model={menuItems} />\n </div>\n </div>\n\n <div className=\"px-4 py-2 border-bottom-1 surface-border\">\n <div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <Button\n icon={<faIcons.FaArrowLeft />}\n className=\"p-button-text p-button-sm\"\n onClick={navigateBack}\n disabled={isAtRoot}\n tooltip=\"Navigate back\"\n tooltipOptions={{ position: 'top' }}\n />\n <div style={{ fontSize: '0.9rem', color: 'var(--text-color-secondary)', cursor: 'pointer' }}>\n {breadcrumbItems.map((item, index) => (\n <span key={index}>\n {index > 0 && <span className=\"mx-2\">></span>}\n <span\n onClick={() => navigateToBreadcrumb(index)}\n style={{ cursor: 'pointer', textDecoration: index < breadcrumbItems.length - 1 ? 'underline' : 'none' }}\n >\n {item.name}\n </span>\n </span>\n ))}\n </div>\n </div>\n {currentDescription && (\n <div style={{ fontSize: '0.875rem', color: 'var(--text-color-secondary)', marginTop: '0.5rem', marginLeft: '2.5rem', fontStyle: 'italic', display: 'flex', alignItems: 'center', gap: '0.5rem' }}>\n <faIcons.FaCircleInfo />\n <span>{currentDescription}</span>\n </div>\n )}\n </div>\n\n <div style={{ flex: 1, overflow: 'auto', padding: '1rem' }}>\n <Tooltip key={`nav-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-navigation-tooltip\" mouseTrack mouseTrackTop={15} />\n <Tooltip key={`desc-${eventTypeName}-${currentPath.join('/')}`} target=\".schema-description-tooltip\" />\n <DataTable\n key={`${isEditMode}-${currentPath.join('/')}`}\n value={properties}\n dataKey=\"id\"\n emptyMessage=\"No properties defined\"\n rowClassName={(rowData: JsonSchemaProperty) => {\n if (!isEditMode && (rowData.type === 'object' || (rowData.type === 'array' && rowData.items?.type === 'object'))) {\n return css.navigableRow;\n }\n return '';\n }}\n onRowClick={(e) => {\n if (!isEditMode) {\n const rowData = e.data as JsonSchemaProperty;\n if (rowData.name) {\n if (rowData.type === 'object') {\n navigateToProperty(rowData.name);\n } else if (rowData.type === 'array' && rowData.items?.type === 'object') {\n navigateToArrayItems(rowData.name);\n }\n }\n }\n }}\n pt={{\n root: { style: { border: 'none' } },\n tbody: { style: { borderTop: '1px solid var(--surface-border)' } }\n }}\n >\n <Column\n field=\"name\"\n header=\"Property\"\n body={(rowData: JsonSchemaProperty) => (\n <NameCell\n rowData={rowData}\n isEditMode={isEditMode}\n onUpdate={updateProperty}\n validationError={validationErrors[rowData.id!]}\n />\n )}\n style={{ width: '30%' }}\n />\n <Column\n header=\"Type\"\n body={(rowData: JsonSchemaProperty) => (\n <TypeCell\n rowData={rowData}\n isEditMode={isEditMode}\n typeFormats={typeFormats}\n onUpdateProperty={updateProperty}\n onUpdateArrayItemType={updateArrayItemType}\n onNavigateToProperty={navigateToProperty}\n onNavigateToArrayItems={navigateToArrayItems}\n onRemoveProperty={removeProperty}\n />\n )}\n style={{ width: '70%' }}\n />\n </DataTable>\n </div>\n </div>\n );\n};\n"],"names":["DEFAULT_TYPE_FORMATS","useState","useEffect","useCallback","validatePropertyName","buildBreadcrumbItems","useMemo","_jsx","faIcons","_jsxs","Tooltip","Menubar","Button","DataTable","Column","NameCell","TypeCell"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,YAAY,GAAG,CAAC,EACzB,MAAM,EACN,aAAa,GAAG,EAAE,EAClB,OAAO,GAAG,IAAI,EACd,gBAAgB,EAChB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,KAAK,EACtB,WAAW,GAAGA,+BAAoB,EAClB,KAAI;IACpB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAGC,cAAQ,CAAW,EAAE,CAAC;IAC5D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAuB,EAAE,CAAC;IACtE,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAa,MAAM,CAAC;AACtE,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,QAAQ,IAAI,KAAK,CAAC;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GAAG,CAAC,CAAA,CAAE,CAwDrC,CAAA,EAAA,CACV,CAAA,EAAA,CACJ;AAEd;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function validatePropertyName(name, propertyId, allProperties) {
|
|
4
|
+
if (!name || name.trim() === '') {
|
|
5
|
+
return 'Property name cannot be empty';
|
|
6
|
+
}
|
|
7
|
+
const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
8
|
+
if (!validIdentifierPattern.test(name)) {
|
|
9
|
+
return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';
|
|
10
|
+
}
|
|
11
|
+
const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);
|
|
12
|
+
if (duplicates.length > 0) {
|
|
13
|
+
return 'Property name must be unique';
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
function buildBreadcrumbItems(eventTypeName, currentPath) {
|
|
18
|
+
const items = [{ name: eventTypeName, path: [] }];
|
|
19
|
+
for (let i = 0; i < currentPath.length; i++) {
|
|
20
|
+
const segment = currentPath[i];
|
|
21
|
+
if (segment === '$items') {
|
|
22
|
+
items.push({ name: '[items]', path: currentPath.slice(0, i + 1) });
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
items.push({ name: segment, path: currentPath.slice(0, i + 1) });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return items;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
exports.buildBreadcrumbItems = buildBreadcrumbItems;
|
|
32
|
+
exports.validatePropertyName = validatePropertyName;
|
|
33
|
+
//# sourceMappingURL=schemaHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaHelpers.js","sources":["../../../SchemaEditor/schemaHelpers.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 { JsonSchemaProperty, NavigationItem } from '../types/JsonSchema';\n\n/**\n * Validates a property name, returning an error string or undefined if valid.\n */\nexport function validatePropertyName(name: string, propertyId: string, allProperties: JsonSchemaProperty[]): string | undefined {\n if (!name || name.trim() === '') {\n return 'Property name cannot be empty';\n }\n\n const validIdentifierPattern = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\n if (!validIdentifierPattern.test(name)) {\n return 'Property name must start with a letter or underscore and contain only letters, numbers, and underscores';\n }\n\n const duplicates = allProperties.filter(p => p.name === name && p.id !== propertyId);\n if (duplicates.length > 0) {\n return 'Property name must be unique';\n }\n\n return undefined;\n}\n\n/**\n * Builds the list of breadcrumb navigation items from a path, using the event type name as the root.\n */\nexport function buildBreadcrumbItems(eventTypeName: string, currentPath: string[]): NavigationItem[] {\n const items: NavigationItem[] = [{ name: eventTypeName, path: [] }];\n\n for (let i = 0; i < currentPath.length; i++) {\n const segment = currentPath[i];\n if (segment === '$items') {\n items.push({ name: '[items]', path: currentPath.slice(0, i + 1) });\n } else {\n items.push({ name: segment, path: currentPath.slice(0, i + 1) });\n }\n }\n\n return items;\n}\n"],"names":[],"mappings":";;SAQgB,oBAAoB,CAAC,IAAY,EAAE,UAAkB,EAAE,aAAmC,EAAA;IACtG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;AAC7B,QAAA,OAAO,+BAA+B;IAC1C;IAEA,MAAM,sBAAsB,GAAG,0BAA0B;IACzD,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;AACpC,QAAA,OAAO,yGAAyG;IACpH;IAEA,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,CAAC,EAAE,KAAK,UAAU,CAAC;AACpF,IAAA,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACvB,QAAA,OAAO,8BAA8B;IACzC;AAEA,IAAA,OAAO,SAAS;AACpB;AAKM,SAAU,oBAAoB,CAAC,aAAqB,EAAE,WAAqB,EAAA;AAC7E,IAAA,MAAM,KAAK,GAAqB,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;AAEnE,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;AACzC,QAAA,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC;AAC9B,QAAA,IAAI,OAAO,KAAK,QAAQ,EAAE;YACtB,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACtE;aAAO;YACH,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QACpE;IACJ;AAEA,IAAA,OAAO,KAAK;AAChB;;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var propertiesHelpers = require('./propertiesHelpers.js');
|
|
4
5
|
|
|
5
6
|
const Properties = ({ data, className, align = 'left' }) => {
|
|
6
7
|
const tableStyle = {
|
|
@@ -45,13 +46,7 @@ const Properties = ({ data, className, align = 'left' }) => {
|
|
|
45
46
|
}
|
|
46
47
|
return jsxRuntime.jsx("span", { children: String(value) });
|
|
47
48
|
};
|
|
48
|
-
|
|
49
|
-
return key
|
|
50
|
-
.replace(/([A-Z])/g, ' $1')
|
|
51
|
-
.replace(/^./, str => str.toUpperCase())
|
|
52
|
-
.trim();
|
|
53
|
-
};
|
|
54
|
-
return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx("table", { style: tableStyle, children: jsxRuntime.jsx("tbody", { children: data && Object.entries(data).map(([key, value], index) => (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsx("td", { style: labelStyle, children: formatPropertyName(key) }), jsxRuntime.jsx("td", { style: valueStyle, children: renderValue(value) })] }, `${key}-${index}`))) }) }) }));
|
|
49
|
+
return (jsxRuntime.jsx("div", { className: className, children: jsxRuntime.jsx("table", { style: tableStyle, children: jsxRuntime.jsx("tbody", { children: data && Object.entries(data).map(([key, value], index) => (jsxRuntime.jsxs("tr", { style: rowStyle, children: [jsxRuntime.jsx("td", { style: labelStyle, children: propertiesHelpers.formatPropertyName(key) }), jsxRuntime.jsx("td", { style: valueStyle, children: renderValue(value) })] }, `${key}-${index}`))) }) }) }));
|
|
55
50
|
};
|
|
56
51
|
|
|
57
52
|
exports.Properties = Properties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Properties.js","sources":["../../../TimeMachine/Properties.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 React from 'react';\n\ninterface PropertiesProps {\n data: Record<string, unknown>;\n /** CSS class name for the container */\n className?: string;\n /** Text alignment for the table */\n align?: 'left' | 'right';\n}\n\nexport const Properties: React.FC<PropertiesProps> = ({ data, className, align = 'left' }) => {\n const tableStyle: React.CSSProperties = {\n width: '100%',\n borderCollapse: 'collapse',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"SF Mono\", monospace',\n fontSize: '13px',\n };\n\n const rowStyle: React.CSSProperties = {\n borderBottom: '1px solid rgba(255,255,255,0.1)',\n };\n\n const labelStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: 'rgba(255,255,255,0.6)',\n textAlign: align,\n fontWeight: 500,\n width: '40%',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: align,\n };\n\n const renderValue = (value: unknown): React.ReactNode => {\n if (value === null || value === undefined) {\n return <span style={{ color: 'rgba(255,255,255,0.4)' }}>null</span>;\n }\n\n if (typeof value === 'boolean') {\n return <span style={{ color: value ? '#4ade80' : '#f87171' }}>{value.toString()}</span>;\n }\n\n if (typeof value === 'number') {\n return <span style={{ color: '#fbbf24' }}>{value}</span>;\n }\n\n if (value instanceof Date) {\n return <span style={{ color: '#60a5fa' }}>{value.toLocaleString()}</span>;\n }\n\n if (Array.isArray(value)) {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n Array[{value.length}]\n </span>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n {'{'}...{'}'}\n </span>\n );\n }\n\n return <span>{String(value)}</span>;\n };\n\n
|
|
1
|
+
{"version":3,"file":"Properties.js","sources":["../../../TimeMachine/Properties.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 React from 'react';\nimport { formatPropertyName } from './propertiesHelpers';\n\ninterface PropertiesProps {\n data: Record<string, unknown>;\n /** CSS class name for the container */\n className?: string;\n /** Text alignment for the table */\n align?: 'left' | 'right';\n}\n\nexport const Properties: React.FC<PropertiesProps> = ({ data, className, align = 'left' }) => {\n const tableStyle: React.CSSProperties = {\n width: '100%',\n borderCollapse: 'collapse',\n fontFamily: '-apple-system, BlinkMacSystemFont, \"SF Mono\", monospace',\n fontSize: '13px',\n };\n\n const rowStyle: React.CSSProperties = {\n borderBottom: '1px solid rgba(255,255,255,0.1)',\n };\n\n const labelStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: 'rgba(255,255,255,0.6)',\n textAlign: align,\n fontWeight: 500,\n width: '40%',\n };\n\n const valueStyle: React.CSSProperties = {\n padding: '8px 12px',\n color: '#fff',\n textAlign: align,\n };\n\n const renderValue = (value: unknown): React.ReactNode => {\n if (value === null || value === undefined) {\n return <span style={{ color: 'rgba(255,255,255,0.4)' }}>null</span>;\n }\n\n if (typeof value === 'boolean') {\n return <span style={{ color: value ? '#4ade80' : '#f87171' }}>{value.toString()}</span>;\n }\n\n if (typeof value === 'number') {\n return <span style={{ color: '#fbbf24' }}>{value}</span>;\n }\n\n if (value instanceof Date) {\n return <span style={{ color: '#60a5fa' }}>{value.toLocaleString()}</span>;\n }\n\n if (Array.isArray(value)) {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n Array[{value.length}]\n </span>\n );\n }\n\n if (typeof value === 'object') {\n return (\n <span style={{ color: 'rgba(255,255,255,0.7)' }}>\n {'{'}...{'}'}\n </span>\n );\n }\n\n return <span>{String(value)}</span>;\n };\n\n return (\n <div className={className}>\n <table style={tableStyle}>\n <tbody>\n {data && Object.entries(data).map(([key, value], index) => (\n <tr key={`${key}-${index}`} style={rowStyle}>\n <td style={labelStyle}>{formatPropertyName(key)}</td>\n <td style={valueStyle}>{renderValue(value)}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n};\n"],"names":["_jsx","_jsxs","formatPropertyName"],"mappings":";;;;;AAcO,MAAM,UAAU,GAA8B,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,EAAE,KAAI;AACzF,IAAA,MAAM,UAAU,GAAwB;AACpC,QAAA,KAAK,EAAE,MAAM;AACb,QAAA,cAAc,EAAE,UAAU;AAC1B,QAAA,UAAU,EAAE,yDAAyD;AACrE,QAAA,QAAQ,EAAE,MAAM;KACnB;AAED,IAAA,MAAM,QAAQ,GAAwB;AAClC,QAAA,YAAY,EAAE,iCAAiC;KAClD;AAED,IAAA,MAAM,UAAU,GAAwB;AACpC,QAAA,OAAO,EAAE,UAAU;AACnB,QAAA,KAAK,EAAE,uBAAuB;AAC9B,QAAA,SAAS,EAAE,KAAK;AAChB,QAAA,UAAU,EAAE,GAAG;AACf,QAAA,KAAK,EAAE,KAAK;KACf;AAED,IAAA,MAAM,UAAU,GAAwB;AACpC,QAAA,OAAO,EAAE,UA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AAK,EAAE,uBAAuB,EAAE,aAC1C,GAAG,EAAA,KAAA,EAAK,GAAG,CAAA,EAAA,CACT;QAEf;AAEA,QAAA,OAAOD,mCAAO,MAAM,CAAC,KAAK,CAAC,GAAQ;AACvC,IAAA,CAAC;AAED,IAAA,QACIA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,SAAS,EAAA,QAAA,EACrBA,cAAA,CAAA,OAAA,EAAA,EAAO,KAAK,EAAE,UAAU,EAAA,QAAA,EACpBA,cAAA,CAAA,OAAA,EAAA,EAAA,QAAA,EACK,IAAI,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,MAClDC,eAAA,CAAA,IAAA,EAAA,EAA4B,KAAK,EAAE,QAAQ,EAAA,QAAA,EAAA,CACvCD,cAAA,CAAA,IAAA,EAAA,EAAI,KAAK,EAAE,UAAU,EAAA,QAAA,EAAGE,oCAAkB,CAAC,GAAG,CAAC,EAAA,CAAM,EACrDF,cAAA,CAAA,IAAA,EAAA,EAAI,KAAK,EAAE,UAAU,EAAA,QAAA,EAAG,WAAW,CAAC,KAAK,CAAC,EAAA,CAAM,CAAA,EAAA,EAF3C,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,CAGrB,CACR,CAAC,EAAA,CACE,EAAA,CACJ,EAAA,CACN;AAEd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propertiesHelpers.js","sources":["../../../TimeMachine/propertiesHelpers.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\n/**\n * Converts a camelCase property key to a human-readable Title Case label with spaces.\n */\nexport function formatPropertyName(key: string): string {\n return key\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, str => str.toUpperCase())\n .trim();\n}\n"],"names":[],"mappings":";;AAMM,SAAU,kBAAkB,CAAC,GAAW,EAAA;AAC1C,IAAA,OAAO;AACF,SAAA,OAAO,CAAC,UAAU,EAAE,KAAK;SACzB,OAAO,CAAC,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE;AACtC,SAAA,IAAI,EAAE;AACf;;;;"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/* Copyright (c) Cratis. All rights reserved. */
|
|
2
|
+
/* Licensed under the MIT license. See LICENSE file in the project root for full license information. */
|
|
3
|
+
|
|
4
|
+
/* ── Toolbar container ───────────────────────────────────────────────────── */
|
|
5
|
+
.toolbar {
|
|
6
|
+
background: var(--surface-card);
|
|
7
|
+
border: 1px solid var(--surface-border);
|
|
8
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/* ── Toolbar button ──────────────────────────────────────────────────────── */
|
|
12
|
+
.toolbar-button {
|
|
13
|
+
color: var(--text-color-secondary);
|
|
14
|
+
background: transparent;
|
|
15
|
+
border: none;
|
|
16
|
+
transition: background 0.15s, color 0.15s;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.toolbar-button:hover {
|
|
20
|
+
background: var(--surface-100);
|
|
21
|
+
color: var(--text-color);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.toolbar-button--active {
|
|
25
|
+
background: var(--primary-color);
|
|
26
|
+
color: var(--primary-color-text);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.toolbar-button--active:hover {
|
|
30
|
+
background: var(--primary-color);
|
|
31
|
+
color: var(--primary-color-text);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ── Toolbar project name label ──────────────────────────────────────────── */
|
|
35
|
+
.toolbar-project-name {
|
|
36
|
+
padding: 0 8px;
|
|
37
|
+
font-size: 0.875rem;
|
|
38
|
+
font-weight: 500;
|
|
39
|
+
color: var(--text-color);
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── Toolbar section (context switching) ────────────────────────────────── */
|
|
44
|
+
|
|
45
|
+
/*
|
|
46
|
+
* The section is a fixed-size container that transitions smoothly between
|
|
47
|
+
* the dimensions required by each context.
|
|
48
|
+
* overflow is intentionally left as visible so that absolutely-positioned
|
|
49
|
+
* children (e.g. fan-out panels) can extend beyond the section's bounds.
|
|
50
|
+
* Inactive contexts are hidden via opacity/pointer-events, not overflow clipping.
|
|
51
|
+
*/
|
|
52
|
+
.toolbar-section {
|
|
53
|
+
position: relative;
|
|
54
|
+
transition:
|
|
55
|
+
width 0.35s cubic-bezier(0.4, 0, 0.2, 1),
|
|
56
|
+
height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/*
|
|
60
|
+
* Every context is absolutely stacked at the top-left of the section.
|
|
61
|
+
* Only the active one is visible; the others fade out and lose pointer events.
|
|
62
|
+
*/
|
|
63
|
+
.toolbar-context {
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 0;
|
|
66
|
+
left: 0;
|
|
67
|
+
transition: opacity 0.2s ease;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.toolbar-context--active {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
pointer-events: auto;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.toolbar-context--inactive {
|
|
76
|
+
opacity: 0;
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* ── Toolbar fan-out item ────────────────────────────────────────────────── */
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
* The wrapper provides the positioning context for the absolutely-placed panel.
|
|
84
|
+
*/
|
|
85
|
+
.toolbar-fanout-item {
|
|
86
|
+
position: relative;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* The fan-out panel is a floating pill that mirrors the Toolbar container style.
|
|
91
|
+
* When collapsed, it's hidden. When expanded, it appears elevated at the same
|
|
92
|
+
* position as the trigger button, with the trigger button as the first item.
|
|
93
|
+
* Vertically centered with where the collapsed button would be.
|
|
94
|
+
*/
|
|
95
|
+
.toolbar-fanout-panel {
|
|
96
|
+
position: absolute;
|
|
97
|
+
top: 50%;
|
|
98
|
+
left: calc(-0.5rem - 1px);
|
|
99
|
+
transform: translateY(-50%);
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
align-items: center;
|
|
103
|
+
gap: 0.25rem;
|
|
104
|
+
padding: 0.5rem;
|
|
105
|
+
background: var(--surface-card);
|
|
106
|
+
border: 1px solid var(--surface-border);
|
|
107
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
|
108
|
+
border-radius: 1rem;
|
|
109
|
+
white-space: nowrap;
|
|
110
|
+
z-index: 10;
|
|
111
|
+
pointer-events: none;
|
|
112
|
+
opacity: 0;
|
|
113
|
+
clip-path: inset(0 100% 0 0 round 1rem);
|
|
114
|
+
transition:
|
|
115
|
+
clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1),
|
|
116
|
+
opacity 0.2s ease;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Panel fans out to the left — reveal animates right → left */
|
|
120
|
+
.toolbar-fanout-panel--left {
|
|
121
|
+
left: auto;
|
|
122
|
+
right: calc(-0.5rem - 1px);
|
|
123
|
+
clip-path: inset(0 0 0 100% round 1rem);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Expanded state — fully visible, pointer events restored */
|
|
127
|
+
.toolbar-fanout-panel--visible {
|
|
128
|
+
clip-path: inset(0 0 0 0 round 1rem);
|
|
129
|
+
opacity: 1;
|
|
130
|
+
pointer-events: auto;
|
|
131
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
require('./Toolbar.css');
|
|
5
|
+
|
|
6
|
+
const Toolbar = ({ children, orientation = 'vertical' }) => (jsxRuntime.jsx("div", { className: `toolbar inline-flex ${orientation === 'horizontal' ? 'flex-row' : 'flex-col'} items-center gap-1 p-2 rounded-2xl`, children: children }));
|
|
7
|
+
|
|
8
|
+
exports.Toolbar = Toolbar;
|
|
9
|
+
//# sourceMappingURL=Toolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toolbar.js","sources":["../../../Toolbar/Toolbar.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 { ReactNode } from 'react';\nimport './Toolbar.css';\n\n/** Props for the {@link Toolbar} component. */\nexport interface ToolbarProps {\n /** The {@link ToolbarButton} elements to render inside this toolbar group. */\n children: ReactNode;\n /** Layout direction of the toolbar (default: 'vertical'). */\n orientation?: 'vertical' | 'horizontal';\n}\n\n/**\n * A toolbar container that groups icon buttons with a rounded border,\n * mimicking the style of tools panels found in canvas-based applications.\n * Supports both vertical (default) and horizontal orientations.\n */\nexport const Toolbar = ({ children, orientation = 'vertical' }: ToolbarProps) => (\n <div\n className={`toolbar inline-flex ${\n orientation === 'horizontal' ? 'flex-row' : 'flex-col'\n } items-center gap-1 p-2 rounded-2xl`}\n >\n {children}\n </div>\n);\n"],"names":["_jsx"],"mappings":";;;;;AAmBO,MAAM,OAAO,GAAG,CAAC,EAAE,QAAQ,EAAE,WAAW,GAAG,UAAU,EAAgB,MACxEA,cAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAE,CAAA,oBAAA,EACP,WAAW,KAAK,YAAY,GAAG,UAAU,GAAG,UAChD,CAAA,mCAAA,CAAqC,EAAA,QAAA,EAEpC,QAAQ,EAAA,CACP;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var Tooltip = require('../Common/Tooltip.js');
|
|
5
|
+
|
|
6
|
+
const ToolbarButton = ({ icon, tooltip, active = false, onClick, tooltipPosition = 'right' }) => {
|
|
7
|
+
const activeClass = active ? 'toolbar-button--active' : '';
|
|
8
|
+
return (jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, position: tooltipPosition, children: jsxRuntime.jsx("button", { type: 'button', "aria-label": tooltip, onClick: onClick, className: `toolbar-button w-10 h-10 flex items-center justify-center rounded-lg cursor-pointer ${activeClass}`, children: jsxRuntime.jsx("i", { className: `${icon} text-lg` }) }) }));
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.ToolbarButton = ToolbarButton;
|
|
12
|
+
//# sourceMappingURL=ToolbarButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarButton.js","sources":["../../../Toolbar/ToolbarButton.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 { Tooltip } from '../Common/Tooltip';\nimport type { TooltipPosition } from '../Common/Tooltip';\n\n/** Props for the {@link ToolbarButton} component. */\nexport interface ToolbarButtonProps {\n /** The PrimeIcons CSS class to use as the icon (e.g. 'pi pi-home'). */\n icon: string;\n\n /** Tooltip text shown when the user hovers over the button. */\n tooltip: string;\n\n /** Whether the button is currently in the active/selected state. */\n active?: boolean;\n\n /** Callback invoked when the button is clicked. */\n onClick?: () => void;\n\n /** Position of the tooltip relative to the button (default: 'right'). */\n tooltipPosition?: TooltipPosition;\n}\n\n/**\n * An icon button with a tooltip, intended to be placed inside a {@link Toolbar}.\n * Uses the shared {@link Tooltip} component for consistent hover labels.\n */\nexport const ToolbarButton = ({ icon, tooltip, active = false, onClick, tooltipPosition = 'right' }: ToolbarButtonProps) => {\n const activeClass = active ? 'toolbar-button--active' : '';\n\n return (\n <Tooltip content={tooltip} position={tooltipPosition}>\n <button\n type='button'\n aria-label={tooltip}\n onClick={onClick}\n className={`toolbar-button w-10 h-10 flex items-center justify-center rounded-lg cursor-pointer ${activeClass}`}\n >\n <i className={`${icon} text-lg`} />\n </button>\n </Tooltip>\n );\n};\n"],"names":["_jsx","Tooltip"],"mappings":";;;;;MA4Ba,aAAa,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,EAAsB,KAAI;IACvH,MAAM,WAAW,GAAG,MAAM,GAAG,wBAAwB,GAAG,EAAE;AAE1D,IAAA,QACIA,cAAA,CAACC,eAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAA,QAAA,EAChDD,cAAA,CAAA,QAAA,EAAA,EACI,IAAI,EAAC,QAAQ,gBACD,OAAO,EACnB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,CAAA,oFAAA,EAAuF,WAAW,EAAE,EAAA,QAAA,EAE/GA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,GAAG,IAAI,CAAA,QAAA,CAAU,GAAI,EAAA,CAC9B,EAAA,CACH;AAElB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarContext.js","sources":["../../../Toolbar/ToolbarContext.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 type { FC, ReactNode } from 'react';\n\n/** Props for the {@link ToolbarContext} component. */\nexport interface ToolbarContextProps {\n /** Unique name identifying this context within a {@link ToolbarSection}. */\n name: string;\n /** The toolbar items to render when this context is active. */\n children: ReactNode;\n}\n\n/**\n * Defines a named context (a set of toolbar items) within a {@link ToolbarSection}.\n * The section renders only the active context at a time and animates between them.\n *\n * This is a data-only component; its rendering is fully managed by {@link ToolbarSection}.\n */\nexport const ToolbarContext: FC<ToolbarContextProps> = () => null;\n"],"names":[],"mappings":";;MAmBa,cAAc,GAA4B,MAAM;;;;"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var Tooltip = require('../Common/Tooltip.js');
|
|
6
|
+
|
|
7
|
+
const ToolbarFanOutItem = ({ icon, tooltip, tooltipPosition = 'right', fanOutDirection = 'right', children, }) => {
|
|
8
|
+
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
9
|
+
const containerRef = React.useRef(null);
|
|
10
|
+
const handleToggle = () => {
|
|
11
|
+
setIsExpanded(!isExpanded);
|
|
12
|
+
};
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (!isExpanded)
|
|
15
|
+
return;
|
|
16
|
+
const handleClickOutside = (event) => {
|
|
17
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
18
|
+
setIsExpanded(false);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
22
|
+
return () => {
|
|
23
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
24
|
+
};
|
|
25
|
+
}, [isExpanded]);
|
|
26
|
+
const activeClass = isExpanded ? 'toolbar-button--active' : '';
|
|
27
|
+
const panelVisibleClass = isExpanded ? 'toolbar-fanout-panel--visible' : '';
|
|
28
|
+
const directionClass = `toolbar-fanout-panel--${fanOutDirection}`;
|
|
29
|
+
return (jsxRuntime.jsxs("div", { className: 'toolbar-fanout-item', ref: containerRef, children: [jsxRuntime.jsx(Tooltip.Tooltip, { content: tooltip, position: tooltipPosition, children: jsxRuntime.jsx("button", { type: 'button', "aria-label": tooltip, "aria-expanded": isExpanded, onClick: handleToggle, className: `toolbar-button w-10 h-10 flex items-center justify-center rounded-lg cursor-pointer ${activeClass}`, children: jsxRuntime.jsx("i", { className: `${icon} text-lg` }) }) }), jsxRuntime.jsx("div", { className: `toolbar-fanout-panel ${directionClass} ${panelVisibleClass}`, children: children })] }));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
exports.ToolbarFanOutItem = ToolbarFanOutItem;
|
|
33
|
+
//# sourceMappingURL=ToolbarFanOutItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarFanOutItem.js","sources":["../../../Toolbar/ToolbarFanOutItem.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 { ReactNode, useEffect, useRef, useState } from 'react';\nimport { Tooltip } from '../Common/Tooltip';\nimport type { TooltipPosition } from '../Common/Tooltip';\n\n/** Props for the {@link ToolbarFanOutItem} component. */\nexport interface ToolbarFanOutItemProps {\n /** The PrimeIcons CSS class to use as the trigger icon (e.g. 'pi pi-home'). */\n icon: string;\n\n /** Tooltip text shown when hovering over the trigger button. */\n tooltip: string;\n\n /** Position of the tooltip relative to the trigger button (default: 'right'). */\n tooltipPosition?: TooltipPosition;\n\n /** Direction the panel fans out from the trigger button (default: 'right'). */\n fanOutDirection?: 'right' | 'left';\n\n /** The toolbar items to render inside the fan-out panel. */\n children: ReactNode;\n}\n\n/**\n * A toolbar button that fans out a horizontal panel of sub-tool buttons when clicked.\n *\n * Place this inside a vertical {@link Toolbar}. When the button is clicked, a pill-shaped\n * panel slides out to the side (right by default) containing the provided children.\n * The panel animates in/out using a clip-path reveal transition.\n *\n * - Clicking the button again closes the panel\n * - Clicking anywhere outside the panel also closes it\n */\nexport const ToolbarFanOutItem = ({\n icon,\n tooltip,\n tooltipPosition = 'right',\n fanOutDirection = 'right',\n children,\n}: ToolbarFanOutItemProps) => {\n const [isExpanded, setIsExpanded] = useState(false);\n const containerRef = useRef<HTMLDivElement>(null);\n\n const handleToggle = () => {\n setIsExpanded(!isExpanded);\n };\n\n // Close the fan-out when clicking outside\n useEffect(() => {\n if (!isExpanded) return;\n\n const handleClickOutside = (event: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(event.target as Node)) {\n setIsExpanded(false);\n }\n };\n\n document.addEventListener('mousedown', handleClickOutside);\n return () => {\n document.removeEventListener('mousedown', handleClickOutside);\n };\n }, [isExpanded]);\n\n const activeClass = isExpanded ? 'toolbar-button--active' : '';\n const panelVisibleClass = isExpanded ? 'toolbar-fanout-panel--visible' : '';\n const directionClass = `toolbar-fanout-panel--${fanOutDirection}`;\n\n return (\n <div className='toolbar-fanout-item' ref={containerRef}>\n <Tooltip content={tooltip} position={tooltipPosition}>\n <button\n type='button'\n aria-label={tooltip}\n aria-expanded={isExpanded}\n onClick={handleToggle}\n className={`toolbar-button w-10 h-10 flex items-center justify-center rounded-lg cursor-pointer ${activeClass}`}\n >\n <i className={`${icon} text-lg`} />\n </button>\n </Tooltip>\n <div className={`toolbar-fanout-panel ${directionClass} ${panelVisibleClass}`}>\n {children}\n </div>\n </div>\n );\n};\n"],"names":["useState","useRef","useEffect","_jsxs","_jsx","Tooltip"],"mappings":";;;;;;MAmCa,iBAAiB,GAAG,CAAC,EAC9B,IAAI,EACJ,OAAO,EACP,eAAe,GAAG,OAAO,EACzB,eAAe,GAAG,OAAO,EACzB,QAAQ,GACa,KAAI;IACzB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;AACnD,IAAA,MAAM,YAAY,GAAGC,YAAM,CAAiB,IAAI,CAAC;IAEjD,MAAM,YAAY,GAAG,MAAK;AACtB,QAAA,aAAa,CAAC,CAAC,UAAU,CAAC;AAC9B,IAAA,CAAC;IAGDC,eAAS,CAAC,MAAK;AACX,QAAA,IAAI,CAAC,UAAU;YAAE;AAEjB,QAAA,MAAM,kBAAkB,GAAG,CAAC,KAAiB,KAAI;AAC7C,YAAA,IAAI,YAAY,CAAC,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC9E,aAAa,CAAC,KAAK,CAAC;YACxB;AACJ,QAAA,CAAC;AAED,QAAA,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC;AAC1D,QAAA,OAAO,MAAK;AACR,YAAA,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC;AACjE,QAAA,CAAC;AACL,IAAA,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;IAEhB,MAAM,WAAW,GAAG,UAAU,GAAG,wBAAwB,GAAG,EAAE;IAC9D,MAAM,iBAAiB,GAAG,UAAU,GAAG,+BAA+B,GAAG,EAAE;AAC3E,IAAA,MAAM,cAAc,GAAG,CAAA,sBAAA,EAAyB,eAAe,EAAE;AAEjE,IAAA,QACIC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,qBAAqB,EAAC,GAAG,EAAE,YAAY,EAAA,QAAA,EAAA,CAClDC,cAAA,CAACC,eAAO,EAAA,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAA,QAAA,EAChDD,cAAA,CAAA,QAAA,EAAA,EACI,IAAI,EAAC,QAAQ,EAAA,YAAA,EACD,OAAO,EAAA,eAAA,EACJ,UAAU,EACzB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,CAAA,oFAAA,EAAuF,WAAW,CAAA,CAAE,EAAA,QAAA,EAE/GA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,CAAA,EAAG,IAAI,UAAU,EAAA,CAAI,EAAA,CAC9B,EAAA,CACH,EACVA,cAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,CAAA,qBAAA,EAAwB,cAAc,CAAA,CAAA,EAAI,iBAAiB,CAAA,CAAE,EAAA,QAAA,EACxE,QAAQ,EAAA,CACP,CAAA,EAAA,CACJ;AAEd;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
const ToolbarSection = ({ activeContext, children, orientation = 'vertical' }) => {
|
|
7
|
+
const contextRefs = React.useRef({});
|
|
8
|
+
const [size, setSize] = React.useState(null);
|
|
9
|
+
const contexts = React.Children.toArray(children).filter((child) => React.isValidElement(child) && typeof child.props.name === 'string');
|
|
10
|
+
const effectiveContext = activeContext ?? contexts[0]?.props?.name ?? '';
|
|
11
|
+
const flexClass = orientation === 'horizontal' ? 'flex-row' : 'flex-col';
|
|
12
|
+
const measureAndSetSize = React.useCallback((contextName) => {
|
|
13
|
+
const ref = contextRefs.current[contextName];
|
|
14
|
+
if (ref) {
|
|
15
|
+
setSize({ width: ref.offsetWidth, height: ref.offsetHeight });
|
|
16
|
+
}
|
|
17
|
+
}, []);
|
|
18
|
+
React.useLayoutEffect(() => {
|
|
19
|
+
measureAndSetSize(effectiveContext);
|
|
20
|
+
}, []);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
measureAndSetSize(effectiveContext);
|
|
23
|
+
}, [effectiveContext, measureAndSetSize]);
|
|
24
|
+
return (jsxRuntime.jsx("div", { className: 'toolbar-section', style: size ? { width: size.width, height: size.height } : undefined, children: contexts.map((child) => {
|
|
25
|
+
const { name, children: contextChildren } = child.props;
|
|
26
|
+
const isActive = name === effectiveContext;
|
|
27
|
+
return (jsxRuntime.jsx("div", { ref: (element) => { contextRefs.current[name] = element; }, className: `toolbar-context inline-flex ${flexClass} items-center gap-1 ${isActive ? 'toolbar-context--active' : 'toolbar-context--inactive'}`, children: contextChildren }, name));
|
|
28
|
+
}) }));
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.ToolbarSection = ToolbarSection;
|
|
32
|
+
//# sourceMappingURL=ToolbarSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolbarSection.js","sources":["../../../Toolbar/ToolbarSection.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 { Children, ReactElement, ReactNode, isValidElement, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport type { ToolbarContextProps } from './ToolbarContext';\n\n/** Props for the {@link ToolbarSection} component. */\nexport interface ToolbarSectionProps {\n /**\n * The name of the currently active context.\n * Change this to trigger the fade-out / morph / fade-in animation.\n * Defaults to the first context if not specified.\n */\n activeContext?: string;\n\n /** {@link ToolbarContext} elements that define each context's toolbar items. */\n children: ReactNode;\n\n /** Layout direction matching the parent {@link Toolbar} (default: 'vertical'). */\n orientation?: 'vertical' | 'horizontal';\n}\n\n/**\n * A section within a {@link Toolbar} that supports multiple named contexts.\n *\n * When {@link activeContext} changes:\n * - The current items fade out.\n * - The section smoothly morphs to the dimensions required by the new context.\n * - The new items fade in.\n *\n * Contexts are defined by placing {@link ToolbarContext} children inside this section.\n * Switching contexts only affects this section; other sections are unaffected.\n */\nexport const ToolbarSection = ({ activeContext, children, orientation = 'vertical' }: ToolbarSectionProps) => {\n const contextRefs = useRef<Record<string, HTMLDivElement | null>>({});\n const [size, setSize] = useState<{ width: number; height: number } | null>(null);\n\n const contexts = Children.toArray(children).filter(\n (child): child is ReactElement<ToolbarContextProps> =>\n isValidElement(child) && typeof (child.props as ToolbarContextProps).name === 'string'\n );\n\n // Default to the first context if activeContext is not provided\n const effectiveContext = activeContext ?? (contexts[0]?.props as ToolbarContextProps)?.name ?? '';\n\n const flexClass = orientation === 'horizontal' ? 'flex-row' : 'flex-col';\n\n /** Measure the given context's natural dimensions and update the section size. */\n const measureAndSetSize = useCallback((contextName: string) => {\n const ref = contextRefs.current[contextName];\n if (ref) {\n setSize({ width: ref.offsetWidth, height: ref.offsetHeight });\n }\n }, []);\n\n // Set the initial size synchronously before the first browser paint so there is no layout flash.\n // Empty dependency array is intentional: ongoing context changes are handled by the useEffect below.\n useLayoutEffect(() => {\n measureAndSetSize(effectiveContext);\n }, []); // run only on mount\n\n // After a context switch, let the browser paint the opacity transition first,\n // then update the explicit size so the CSS width/height transition kicks in.\n useEffect(() => {\n measureAndSetSize(effectiveContext);\n }, [effectiveContext, measureAndSetSize]);\n\n return (\n <div\n className='toolbar-section'\n style={size ? { width: size.width, height: size.height } : undefined}\n >\n {contexts.map((child) => {\n const { name, children: contextChildren } = child.props as ToolbarContextProps;\n const isActive = name === effectiveContext;\n\n return (\n <div\n key={name}\n ref={(element) => { contextRefs.current[name] = element; }}\n className={`toolbar-context inline-flex ${flexClass} items-center gap-1 ${\n isActive ? 'toolbar-context--active' : 'toolbar-context--inactive'\n }`}\n >\n {contextChildren}\n </div>\n );\n })}\n </div>\n );\n};\n"],"names":["useRef","useState","Children","isValidElement","useCallback","useLayoutEffect","useEffect","_jsx"],"mappings":";;;;;AAkCO,MAAM,cAAc,GAAG,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,GAAG,UAAU,EAAuB,KAAI;AACzG,IAAA,MAAM,WAAW,GAAGA,YAAM,CAAwC,EAAE,CAAC;IACrE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAGC,cAAQ,CAA2C,IAAI,CAAC;AAEhF,IAAA,MAAM,QAAQ,GAAGC,cAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAC9C,CAAC,KAAK,KACFC,oBAAc,CAAC,KAAK,CAAC,IAAI,OAAQ,KAAK,CAAC,KAA6B,CAAC,IAAI,KAAK,QAAQ,CAC7F;AAGD,IAAA,MAAM,gBAAgB,GAAG,aAAa,IAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,KAA6B,EAAE,IAAI,IAAI,EAAE;AAEjG,IAAA,MAAM,SAAS,GAAG,WAAW,KAAK,YAAY,GAAG,UAAU,GAAG,UAAU;AAGxE,IAAA,MAAM,iBAAiB,GAAGC,iBAAW,CAAC,CAAC,WAAmB,KAAI;QAC1D,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC;QAC5C,IAAI,GAAG,EAAE;AACL,YAAA,OAAO,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,YAAY,EAAE,CAAC;QACjE;IACJ,CAAC,EAAE,EAAE,CAAC;IAINC,qBAAe,CAAC,MAAK;QACjB,iBAAiB,CAAC,gBAAgB,CAAC;IACvC,CAAC,EAAE,EAAE,CAAC;IAINC,eAAS,CAAC,MAAK;QACX,iBAAiB,CAAC,gBAAgB,CAAC;AACvC,IAAA,CAAC,EAAE,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;AAEzC,IAAA,QACIC,cAAA,CAAA,KAAA,EAAA,EACI,SAAS,EAAC,iBAAiB,EAC3B,KAAK,EAAE,IAAI,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAA,QAAA,EAEnE,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;YACpB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,KAA4B;AAC9E,YAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,gBAAgB;AAE1C,YAAA,QACIA,cAAA,CAAA,KAAA,EAAA,EAEI,GAAG,EAAE,CAAC,OAAO,KAAI,EAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAC1D,SAAS,EAAE,+BAA+B,SAAS,CAAA,oBAAA,EAC/C,QAAQ,GAAG,yBAAyB,GAAG,2BAC3C,EAAE,EAAA,QAAA,EAED,eAAe,IANX,IAAI,CAOP;QAEd,CAAC,CAAC,EAAA,CACA;AAEd;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Toolbar = require('./Toolbar.js');
|
|
4
|
+
var ToolbarButton = require('./ToolbarButton.js');
|
|
5
|
+
var ToolbarContext = require('./ToolbarContext.js');
|
|
6
|
+
var ToolbarSection = require('./ToolbarSection.js');
|
|
7
|
+
var ToolbarFanOutItem = require('./ToolbarFanOutItem.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.Toolbar = Toolbar.Toolbar;
|
|
12
|
+
exports.ToolbarButton = ToolbarButton.ToolbarButton;
|
|
13
|
+
exports.ToolbarContext = ToolbarContext.ToolbarContext;
|
|
14
|
+
exports.ToolbarSection = ToolbarSection.ToolbarSection;
|
|
15
|
+
exports.ToolbarFanOutItem = ToolbarFanOutItem.ToolbarFanOutItem;
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -12,6 +12,7 @@ var index$8 = require('./ObjectNavigationalBar/index.js');
|
|
|
12
12
|
var index$9 = require('./PivotViewer/index.js');
|
|
13
13
|
var index$a = require('./SchemaEditor/index.js');
|
|
14
14
|
var index$b = require('./TimeMachine/index.js');
|
|
15
|
+
var index$c = require('./Toolbar/index.js');
|
|
15
16
|
|
|
16
17
|
|
|
17
18
|
|
|
@@ -27,4 +28,5 @@ exports.ObjectNavigationalBar = index$8;
|
|
|
27
28
|
exports.PivotViewer = index$9;
|
|
28
29
|
exports.SchemaEditor = index$a;
|
|
29
30
|
exports.TimeMachine = index$b;
|
|
31
|
+
exports.Toolbar = index$c;
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|