Skip to content

Commit aacddde

Browse files
authored
Update CONTRIBUTING.md (#9151)
Adding diagrams and file structure
1 parent d8df7b4 commit aacddde

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

source/nodejs/adaptivecards-designer/CONTRIBUTING.md

+111
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,114 @@ Many of the controls utilized in the designer come from the `adaptivecards-contr
9494
- [Add a new property to the element properties pane](https://github.com/microsoft/AdaptiveCards/pull/8271)
9595
- [Update adaptivecards-controls](https://github.com/microsoft/AdaptiveCards/pull/7937)
9696
- [Update designer peer ordering logic](https://github.com/microsoft/AdaptiveCards/pull/7514)
97+
98+
## Architecture
99+
100+
### High-level CardDesigner class interaction
101+
```mermaid
102+
flowchart TD
103+
CardDesigner[class CardDesigner] --> ToolBar[class ToolBar]
104+
CardDesigner --> SidePanel[class SidePanel]
105+
CardDesigner --> HostContainer[class HostContainer]
106+
CardDesigner --> Surface[class CardDesignerSurface]
107+
CardDesigner --> SampleCatalogue[class SampleCatalogue]
108+
CardDesigner --> OpenSample[class OpenSampleDialog]
109+
CardDesigner --> HelpDialog[class HelpDialog]
110+
```
111+
112+
### High-level SidePanel class interaction
113+
Note: The Toolbox control can contain any HTML content
114+
```mermaid
115+
flowchart TD
116+
SidePanel --> Toolbox[class Toolbox]
117+
SidePanel --> ToolboxInfo[class ToolboxInfo]
118+
ToolboxInfo --> Splitter[class Splitter]
119+
120+
Toolbox --> Monaco[Monaco editor]
121+
Toolbox --> Treeview[class TreeView]
122+
Toolbox --> AdaptiveCard[Rendered AdaptiveCard]
123+
Toolbox --> ElementPaletteItem[class ElementPaletteItem]
124+
125+
ElementPaletteItem --> BasePalette[class BasePaletteItem]
126+
BasePalette --> DraggableElement[class DraggableElement]
127+
128+
```
129+
130+
### High-level Toolbar class interaction
131+
```mermaid
132+
flowchart TD
133+
Toolbar --> ToolbarButton[class ToolbarButton]
134+
Toolbar --> ToolbarChoicePicker[class ToolbarChoicePicker]
135+
ToolbarButton -- extends --> ToolbarElement[class ToolbarElement]
136+
ToolbarChoicePicker -- extends --> ToolbarElement
137+
138+
Treeview --> DataTreeItem[class DataTreeItem]
139+
Treeview --> BaseTreeItem[class BaseTreeItem]
140+
141+
HostContainer -- parent class to --> MultiTheme[MultiThemeHostContainer]
142+
HostContainer -- parent class to --> SingleTheme[SingleThemeHostContainer]
143+
144+
MultiTheme --> CustomHost[Specific hosts, e.g. Outlook]
145+
SingleTheme --> CustomHost
146+
147+
```
148+
149+
### High-level CardDesignerSurface class interaction
150+
```mermaid
151+
flowchart TD
152+
Surface --> ElementRegistry[class CardElementPeerRegistry]
153+
Surface --> ActionRegistry[class ActionPeerRegistry]
154+
Surface --> DesignContext[class DesignContext]
155+
Surface --> DesignedCard[Designed AdaptiveCard]
156+
Surface --> DesignerPeer[class DesignerPeer]
157+
Surface --> DragHandle[class DragHandle]
158+
159+
ElementRegistry -- extends --> DesignerRegistry[class DesignerPeerRegistry]
160+
ActionRegistry -- extends --> DesignerRegistry
161+
DesignerRegistry -- creates --> DesignerPeer
162+
```
163+
164+
### High-level DesingerPeer class interaction
165+
```mermaid
166+
flowchart TD
167+
DesignerPeer --> PropertyEditor[class <type>PropertyEditor]
168+
DesignerPeer --> DesginerPeerTreeItem[class DesignerPeerTreeItem]
169+
DesignerPeer -- creates --> PropertySheet[class PropertySheet]
170+
171+
PropertyEditor -- extends --> PropertySheetEntry[class PropertySheetEntry]
172+
```
173+
174+
## Repo structure
175+
176+
Designer specific code is within `source/nodejs/adaptivecards-designer/src` folder. Here's the breakdown of relevant contents:
177+
```yaml
178+
├── assets # images used within the package
179+
├── containers
180+
│   ├── ** # Each supported container will have their own directory. Each includes their container implementation and css
181+
│   ├── host-container.ts # Base host container implementation
182+
│   ├── multi-theme-host-container.ts # Implementation for host containers that support multiple themes
183+
│   └── single-theme-host-container.ts # Implementation for host containers with one theme
184+
├── hostConfigs
185+
│   └── Host Configs for the containers are pulled from ~/samples/HostConfig. This directory should not be modified
186+
├── adaptive-card-schema.ts # Copy of the adaptive card schema
187+
├── adaptivecards-designer.css # Styling for the designer
188+
├── adaptivecards-designer.ts # Exports our default containers and device emulations
189+
├── base-tree-item.ts # Base class for building all tree views
190+
├── card-designer-surface.ts # Responsible for the rendering of the currently designed card and moving the designer peers across the surface
191+
├── card-desginer.ts # Main entry point for the designer. Handles the state of all components
192+
├── data-tree-item.ts # Utilized to build data tree views when users are selecting new data for templated properties
193+
├── data.ts # Helpers for templating data handling
194+
├── designer-peer-treeitem.ts # Utilized to build the tree view in the card structure pane
195+
├── designer-peers.ts # Implementation of designer peers and their property sheets
196+
├── draggable-element.ts # Implementation for elements that can be dragged on the designer surface (DesignerPeer extends this class)
197+
├── *-dialog.ts # Various popup dialogs utilized in the designer
198+
├── peer-command.ts # Supports actions on designer peers (e.g. "Add a column")
199+
├── shared.ts # GlobalSettings that can enable/disable features
200+
├── side-panel.ts # Utilized to dock content to side of the designer. Typically contains toolboxes/splitter
201+
├── splitter.ts # Support multiple toolboxes within one side panel
202+
├── string.ts
203+
├── tool-box.ts # Standard way to host docked content. Content can be any HTML
204+
├── tool-palette.ts # Contains palette item classes used to create the card elements toolbox
205+
├── toolbar.ts # Implementation for the toolbar and its elements
206+
└── tree-view.ts # Base class. Utilized to build the card structure
207+
```

0 commit comments

Comments
 (0)