# xaboy/form-create-designer architecture

> Architecture diagram of the GitHub repository xaboy/form-create-designer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xaboy/form-create-designer
- Repository: https://github.com/xaboy/form-create-designer

## Overview

##### Project Type and Purpose
- This is a monorepo (managed by Lerna + pnpm) containing three parallel Vue component libraries:
- @form-create/element-ui‑designer (Element Plus)
- @form-create/antd-designer (Ant Design Vue)
- @form-create/vant‑designer (Vant)
- Each package wraps FormCreate core + UI framework to provide a low‑code form designer component.
- It hosts source components, configuration/rules, utilities, examples, and build scripts.

##### File Structure & Readme
- Top level:
- Monorepo controls: lerna.json, pnpm-workspace.yaml, package.json
- CI and quality: .github/, .eslintrc.js, tsconfig.json
- packages/ant‑design‑vue, element‑ui, vant:
- src/components: the designer UI pieces (drag, editors, preview, table, style, language, etc.)
- src/config: base configs + rule definitions for each UI component
- src/utils: shared helpers (form, locale, template, highlight, message)
- examples/: demo sandbox (Vue App.vue, main.js, index.html)
- build scripts: gulpfile.js, vite.config.*.js, babel.config.js, vue.config.js
- types/: TypeScript declarations
- README clarifies the purpose: a low‑code form design component that plugs into Vue apps via CDN or NPM.

##### Main Components
A. Monorepo Orchestration Layer
- Lerna + pnpm
- Root scripts: lint, test, build, release
B. Package Modules (for each of the three frameworks)
- Designer Wrapper Component (entry point: index.js)
- FormCreate Core Plugin (form-create library)
- UI Framework Adapter (Element Plus / Ant Design Vue / Vant)
- Components Layer (DragBox, Table, FnEditor, etc.)
- Configuration Layer (base, menu, rule definitions)
- Utilities Layer (form utils, locale, template engine, code highlight)
- Examples App (Vue CLI or Vite powered demo)
- Build & Packaging (Gulp, Vite, Babel, Rollup under the hood)
C. External Dependencies
- Vue (v2/v3 as applicable)
- UI frameworks (Element Plus, Ant Design Vue, Vant)
- NPM registry (publish/consume)
- CDN (for UMD builds)

##### Relationships & Data Flows
- Developer → Clone Monorepo → Run pnpm install (Lerna bootstraps packages)
- Developer → Code changes in packages/* → Local build (Gulp/Vite) → Examples app hot‑reload
- CI pipeline → Runs lint, tests (if any), builds all packages → Publishes to NPM registry
- Consumer App → Installs @form-create/designer + UI framework → Vue.use(FcDesigner) → `<fc-designer/>` renders

##### Architectural Patterns & Design Principles
- Monorepo with modular packages for reuse & version consistency
- Plugin architecture: each designer “plugin” wraps core + UI framework
- Layered structure inside each package:
1. Adapter Layer (Wrappers + plugin registration)
2. UI Components Layer (visual building blocks)
3. Config/Rules Layer (declarative definitions)
4. Utilities Layer (shared helpers)
5. Examples/Docs Layer
- Build abstraction: Gulp for legacy, Vite for modern ES modules, Babel for transpilation

##### Final Advice
- Be as granular as possible: separate Layers → Modules → Files if needed
- Monorepo Management (e.g., blue)
- Package internals (e.g., green)
- External dependencies (e.g., gray)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors
    DEV["Developer"]:::actor
    CI["CI Pipeline"]:::actor
    CON["Consumer App"]:::actor

    %% Monorepo Layer
    subgraph "Monorepo Orchestration Layer"
        LR["Lerna (lerna.json)"]:::monorepo
        PN["pnpm-workspace.yaml"]:::monorepo
        PK["package.json"]:::monorepo
        GH[".github/"]:::monorepo
        ESL[".eslintrc.js"]:::monorepo
        TS["tsconfig.json"]:::monorepo
    end

    %% Packages
    subgraph "@form-create/ant-design-vue Designer"
        AEP["Entry Point\nsrc/index.js"]:::package
        ACO["Components\nsrc/components/"]:::package
        ACF["Config\nsrc/config/"]:::package
        AUT["Utils\nsrc/utils/"]:::package
        AEX["Examples\nexamples/"]:::package
        subgraph "Build & Packaging"
            AGP["gulpfile.js"]:::package
            ABB["babel.config.js"]:::package
            AVC["vue.config.js"]:::package
            AVB["vite.config.build.js"]:::package
            AVL["vite.config.locale.js"]:::package
            AVP["vite.config.preview.js"]:::package
        end
        ATY["Types\ntypes/index.d.ts"]:::package
    end

    subgraph "@form-create/element-ui-designer"
        EEP["Entry Point\nsrc/index.js"]:::package
        ECO["Components\nsrc/components/"]:::package
        ECF["Config\nsrc/config/"]:::package
        EUT["Utils\nsrc/utils/"]:::package
        EEX["Examples\nexamples/"]:::package
        subgraph "Build & Packaging"
            EGP["gulpfile.js"]:::package
            EBB["babel.config.js"]:::package
            EVC["vue.config.js"]:::package
            EVB["vite.config.build.js"]:::package
            EVL["vite.config.locale.js"]:::package
            EVP["vite.config.preview.js"]:::package
        end
        ETY["Types\ntypes/index.d.ts"]:::package
    end

    subgraph "@form-create/vant-designer"
        VEP["Entry Point\nsrc/index.js"]:::package
        VCO["Components\nsrc/components/"]:::package
        VCF["Config\nsrc/config/"]:::package
        VUT["Utils\nsrc/utils/"]:::package
        VEX["Examples\nexamples/"]:::package
        subgraph "Build & Packaging"
            VGP["gulpfile.js"]:::package
            VBB["babel.config.js"]:::package
            VVC["vue.config.js"]:::package
            VVB["vite.config.build.js"]:::package
            VVL["vite.config.locale.js"]:::package
            VVP["vite.config.preview.js"]:::package
        end
        VTY["Types\ntypes/index.d.ts"]:::package
    end

    %% External Dependencies
    subgraph "External Dependencies"
        FC["FormCreate Core"]:::external
        VUE["Vue"]:::external
        UI1["Element Plus"]:::external
        UI2["Ant Design Vue"]:::external
        UI3["Vant"]:::external
        NPM["NPM Registry"]:::external
        CDN["CDN (UMD)"]:::external
    end

    %% Flows
    DEV -->|clones & bootstraps| LR
    LR -->|install| AEP
    LR --> AEP
    LR --> EEP
    LR --> VEP

    CI -->|runs lint/test/build| PK
    PK -->|publishes| NPM

    CON -->|installs| NPM
    CON -->|CDN| CDN

    AEP -->|uses| FC
    AEP -->|depends| VUE
    AEP -->|UI adapter| UI2

    EEP -->|uses| FC
    EEP -->|depends| VUE
    EEP -->|UI adapter| UI1

    VEP -->|uses| FC
    VEP -->|depends| VUE
    VEP -->|UI adapter| UI3

    %% Click Events
    click LR "https://github.com/xaboy/form-create-designer/blob/next/lerna.json"
    click PN "https://github.com/xaboy/form-create-designer/blob/next/pnpm-workspace.yaml"
    click PK "https://github.com/xaboy/form-create-designer/blob/next/package.json"
    click GH "https://github.com/xaboy/form-create-designer/tree/next/.github/"
    click ESL "https://github.com/xaboy/form-create-designer/blob/next/.eslintrc.js"
    click TS "https://github.com/xaboy/form-create-designer/blob/next/tsconfig.json"

    click AEP "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/src/index.js"
    click ACO "https://github.com/xaboy/form-create-designer/tree/next/packages/ant-design-vue/src/components/"
    click ACF "https://github.com/xaboy/form-create-designer/tree/next/packages/ant-design-vue/src/config/"
    click AUT "https://github.com/xaboy/form-create-designer/tree/next/packages/ant-design-vue/src/utils/"
    click AEX "https://github.com/xaboy/form-create-designer/tree/next/packages/ant-design-vue/examples/"
    click AGP "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/gulpfile.js"
    click ABB "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/babel.config.js"
    click AVC "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/vue.config.js"
    click AVB "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/vite.config.build.js"
    click AVL "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/vite.config.locale.js"
    click AVP "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/vite.config.preview.js"
    click ATY "https://github.com/xaboy/form-create-designer/blob/next/packages/ant-design-vue/types/index.d.ts"

    click EEP "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/src/index.js"
    click ECO "https://github.com/xaboy/form-create-designer/tree/next/packages/element-ui/src/components/"
    click ECF "https://github.com/xaboy/form-create-designer/tree/next/packages/element-ui/src/config/"
    click EUT "https://github.com/xaboy/form-create-designer/tree/next/packages/element-ui/src/utils/"
    click EEX "https://github.com/xaboy/form-create-designer/tree/next/packages/element-ui/examples/"
    click EGP "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/gulpfile.js"
    click EBB "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/babel.config.js"
    click EVC "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/vue.config.js"
    click EVB "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/vite.config.build.js"
    click EVL "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/vite.config.locale.js"
    click EVP "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/vite.config.preview.js"
    click ETY "https://github.com/xaboy/form-create-designer/blob/next/packages/element-ui/types/index.d.ts"

    click VEP "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/src/index.js"
    click VCO "https://github.com/xaboy/form-create-designer/tree/next/packages/vant/src/components/"
    click VCF "https://github.com/xaboy/form-create-designer/tree/next/packages/vant/src/config/"
    click VUT "https://github.com/xaboy/form-create-designer/tree/next/packages/vant/src/utils/"
    click VEX "https://github.com/xaboy/form-create-designer/tree/next/packages/vant/examples/"
    click VGP "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/gulpfile.js"
    click VBB "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/babel.config.js"
    click VVC "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/vue.config.js"
    click VVB "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/vite.config.build.js"
    click VVL "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/vite.config.locale.js"
    click VVP "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/vite.config.preview.js"
    click VTY "https://github.com/xaboy/form-create-designer/blob/next/packages/vant/types/index.d.ts"

    %% Styles
    classDef monorepo fill:#D0EBFF,stroke:#1C7ED6
    classDef package fill:#E6FFFA,stroke:#2F855A
    classDef external fill:#EDF2F7,stroke:#4A5568
    classDef actor fill:#FFF5F5,stroke:#C53030,stroke-width:2px
```
