Skip to content

Implement visual designer for Object UI schemas#1

Merged
huangyiirene merged 10 commits intomainfrom
copilot/add-designer-feature
Jan 13, 2026
Merged

Implement visual designer for Object UI schemas#1
huangyiirene merged 10 commits intomainfrom
copilot/add-designer-feature

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 13, 2026

Adds @object-ui/designer package - a visual editor for creating and modifying Object UI schemas through a GUI.

Components

  • DesignerContext: State management for schema, selection, and CRUD operations
  • Canvas: Live preview with click-to-select and visual highlighting
  • ComponentPalette: Categorized browser for 50+ components (Form, Layout, Overlay, etc.)
  • PropertyPanel: Dynamic forms generated from component metadata with type-specific inputs
  • Toolbar: JSON import/export with modal editor
  • Designer: Main component integrating three-column layout

Usage

import { Designer } from '@object-ui/designer';

function App() {
  const [schema, setSchema] = useState({ type: 'div', body: [] });
  return <Designer initialSchema={schema} onSchemaChange={setSchema} />;
}

Implementation Details

  • Real-time preview updates on property changes
  • Automatic ID generation for all nodes
  • Recursive tree operations for nested schemas
  • Support for both single-node and array body types
  • Click-to-add workflow (drag-and-drop deferred)

Documentation

  • English README with API reference
  • Chinese implementation guide
  • Visual layout documentation
  • Working demo application

Node operations handle schema mutation immutably. Selection state syncs across all panels via Context. Component metadata drives property form generation dynamically.

Original prompt

帮我开发设计器


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits January 13, 2026 11:31
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
Copilot AI changed the title [WIP] Add designer feature to application Implement visual designer for Object UI schemas Jan 13, 2026
Copilot AI requested a review from huangyiirene January 13, 2026 11:38
@huangyiirene huangyiirene requested review from Copilot and removed request for huangyiirene January 13, 2026 11:58
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive visual designer package for creating and modifying Object UI schemas through a graphical interface. The designer provides real-time preview, component palette, property editing, and JSON import/export capabilities.

Changes:

  • Added @object-ui/designer package with 6 core React components
  • Implemented context-based state management for schema operations
  • Created demo application with Vite + React 19
  • Added comprehensive documentation (English README, Chinese implementation guide, visual guide)

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/designer/tsconfig.json Configured TypeScript with ES2020 target, module paths, and build settings
packages/designer/src/index.ts Main entry point exporting Designer components, context, hooks, and types
packages/designer/src/context/DesignerContext.tsx State management context with schema CRUD operations and helper functions
packages/designer/src/components/Toolbar.tsx Top toolbar with JSON import/export and modal editor
packages/designer/src/components/PropertyPanel.tsx Dynamic property editor with type-specific inputs
packages/designer/src/components/Designer.tsx Main component integrating three-column layout
packages/designer/src/components/ComponentPalette.tsx Categorized component browser with click-to-add functionality
packages/designer/src/components/Canvas.tsx Live preview canvas with selection and hover highlighting
packages/designer/package.json Package configuration with dependencies and scripts
packages/designer/VISUAL_GUIDE.md Visual documentation of interface layout and features
packages/designer/README.md Comprehensive usage guide with API reference
packages/designer/IMPLEMENTATION.zh-CN.md Chinese implementation guide
examples/designer-demo/* Complete demo application setup
DESIGNER_SUMMARY.md Bilingual implementation summary
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

},
"include": ["src"]
"include": ["src"],
"exclude": ["node_modules", "dist", "../renderer", "../ui"]
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exclude pattern '../renderer' and '../ui' use relative paths that may not work as intended from the tsconfig location. Consider using absolute patterns or verifying these paths exclude the intended directories.

Suggested change
"exclude": ["node_modules", "dist", "../renderer", "../ui"]
"exclude": ["node_modules", "dist"]

Copilot uses AI. Check for mistakes.

// Helper function to ensure all nodes have unique IDs
const ensureNodeIds = (node: SchemaNode, idPrefix = ''): SchemaNode => {
const nodeId = node.id || `${idPrefix}${node.type}-${Math.random().toString(36).substr(2, 9)}`;
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Math.random() for ID generation can result in collisions. Consider using a more robust ID generation method like crypto.randomUUID() or a library like uuid for guaranteed uniqueness.

Copilot uses AI. Check for mistakes.

const handleCopyJson = () => {
navigator.clipboard.writeText(JSON.stringify(schema, null, 2));
alert('Schema copied to clipboard!');
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using alert() is not user-friendly and blocks the UI. Consider using a toast notification or non-blocking feedback mechanism instead.

Copilot uses AI. Check for mistakes.
};

const handleDelete = () => {
if (confirm('Are you sure you want to delete this component?')) {
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using confirm() is not consistent with modern UI patterns. Consider using a custom dialog component or alert-dialog from @object-ui/ui for better user experience.

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +8
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
"../../packages/ui/src/**/*.{js,ts,jsx,tsx}",
"../../packages/renderer/src/**/*.{js,ts,jsx,tsx}",
"../../packages/designer/src/**/*.{js,ts,jsx,tsx}",
],
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'content' field is for Tailwind CSS configuration, not PostCSS. This configuration should be in tailwind.config.js. PostCSS config should only contain plugins like 'tailwindcss' and 'autoprefixer'.

Suggested change
content: [
"./index.html",
"./src/**/*.{js,ts,jsx,tsx}",
"../../packages/ui/src/**/*.{js,ts,jsx,tsx}",
"../../packages/renderer/src/**/*.{js,ts,jsx,tsx}",
"../../packages/designer/src/**/*.{js,ts,jsx,tsx}",
],
plugins: {
tailwindcss: {},
autoprefixer: {},
},

Copilot uses AI. Check for mistakes.
@huangyiirene huangyiirene marked this pull request as ready for review January 13, 2026 12:53
@huangyiirene huangyiirene merged commit 9c5497b into main Jan 13, 2026
2 of 5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

✅ All checks passed!

  • ✅ Type check passed
  • ✅ Tests passed
  • ✅ Lint check completed

Copilot AI added a commit that referenced this pull request Jan 24, 2026
- Fix handleExportCSV to guard on gridRef.current?.api (issue #1)
- Add dedicated onContextMenuAction callback instead of overloading onCellClicked (issue #2)
- Remove icon property from customItems to prevent HTML injection (issue #3)
- Remove validation claim from README - only basic AG Grid editing (issue #4)
- Add test assertions for all new inputs (editable, exportConfig, etc.) (issue #5)
- Fix onExport type to only support 'csv' format (issue #6)
- Remove unused ColumnConfig properties (autoSize, groupable) (issue #9)
- Type schema props with proper interfaces instead of 'any' (issue #10)
- Update export description to only mention CSV (issue #11)
- Add AG Grid Community vs Enterprise section to docs (issue #8)
- Update README and docs with new callback and clarifications

All tests pass (8/8), lint clean (0 errors)

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Feb 20, 2026
…warning, i18n fallback

- Issue #1: Normalize `in`/`not in` operators to backend-compatible `or`/`and` of `=`/`!=`
- Issue #2: Filter merging now validates and filters empty conditions
- Issue #3: CSV export safely serializes arrays (semicolon-separated) and objects (JSON)
- Issue #5: Request counter prevents stale data from overwriting latest results
- Issue #6: PullToRefresh resets pull distance immediately to prevent UI lock
- Issue #7: $top configurable via schema.pagination, data limit warning shown
- Issue #8: Extended i18n fallback translations for all ListView labels
- Issue #9: Defensive null checks in effectiveFields for mismatched objectDef
- Issue #10: Added FilterNormalization, Export, and DataFetch test suites

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants