Skip to content

Commit aecd3a0

Browse files
authored
Merge pull request #41 from objectstack-ai/copilot/update-draggable-controls
2 parents 87d5848 + 4fd9482 commit aecd3a0

15 files changed

Lines changed: 1831 additions & 76 deletions

File tree

packages/components/src/renderers/layout/card.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ ComponentRegistry.register('card',
3434
title: 'Card Title',
3535
description: 'Card description goes here',
3636
className: 'w-full'
37+
},
38+
isContainer: true,
39+
resizable: true,
40+
resizeConstraints: {
41+
width: true,
42+
height: true,
43+
minWidth: 200,
44+
minHeight: 100
3745
}
3846
}
3947
);

packages/components/src/renderers/layout/container.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ ComponentRegistry.register('container',
8181
children: [
8282
{ type: 'text', content: 'Container content goes here' }
8383
]
84+
},
85+
isContainer: true,
86+
resizable: true,
87+
resizeConstraints: {
88+
width: true,
89+
height: true,
90+
minWidth: 200,
91+
minHeight: 100
8492
}
8593
}
8694
);

packages/components/src/renderers/layout/grid.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ ComponentRegistry.register('grid',
8686
{ type: 'card', title: 'Card 3', description: 'Third card' },
8787
{ type: 'card', title: 'Card 4', description: 'Fourth card' }
8888
]
89+
},
90+
isContainer: true,
91+
resizable: true,
92+
resizeConstraints: {
93+
width: true,
94+
height: true,
95+
minWidth: 200,
96+
minHeight: 100
8997
}
9098
}
9199
);

packages/core/src/registry/Registry.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ export type ComponentMeta = {
2222
defaultProps?: Record<string, any>; // Default props when dropped
2323
defaultChildren?: SchemaNode[]; // Default children when dropped
2424
examples?: Record<string, any>; // Example configurations
25+
isContainer?: boolean; // Whether the component can have children
26+
resizable?: boolean; // Whether the component can be resized in the designer
27+
resizeConstraints?: {
28+
width?: boolean;
29+
height?: boolean;
30+
minWidth?: number;
31+
maxWidth?: number;
32+
minHeight?: number;
33+
maxHeight?: number;
34+
};
2535
};
2636

2737
export type ComponentConfig<T = any> = ComponentMeta & {

0 commit comments

Comments
 (0)