Skip to content

Commit 7f1373e

Browse files
authored
Updating documentation for designer and website (#9115)
* [Not ready for review] Update README.md Updating readme docs * Update auth instructions * Update README.md * Create CONTRIBUTING.md * Update CONTRIBUTING.md * Update README.md - website
1 parent 98ec709 commit 7f1373e

File tree

4 files changed

+116
-5
lines changed

4 files changed

+116
-5
lines changed

source/nodejs/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,17 @@ Removed JS packages:
1515

1616
## Prerequisites
1717

18-
- Node 20+
18+
- Install Node 20+
1919

2020
## Authenticate with npm registry
2121

22-
1. `vsts-npm-auth -config .npmrc` in `source/nodejs`
22+
1. `cd source/nodejs`
23+
2. `npm install -g vsts-npm-auth`
24+
3. `vsts-npm-auth -config .npmrc`
2325

2426
## Bootstrap the repo
2527

26-
We use lerna to manage package linking and building.
28+
We use [lerna](https://lerna.js.org/) to manage package linking and building.
2729

2830
1. `cd source/nodejs`
2931
2. `npm install`
@@ -38,13 +40,20 @@ We use lerna to manage package linking and building.
3840
2. `npm start`
3941
3. OR to test preview features: `npm run start:preview`
4042

43+
Note: The documentation side can also be used to validate designer changes.
44+
4145
## Start the documentation site (http://adaptivecards.io)
4246

4347
1. `cd adaptivecards-site`
4448
2. `npx lerna run release`
4549
3. `npm start`
4650
4. Open up the browser to point to: `localhost:[portnumber]` printed after the command above returns under "Hexo is running at".
4751

52+
If you do not see your changes, you are likely pulling from the cache. Please try:
53+
1. `npx lerna run clean`
54+
2. `npx lerna run release --skip-nx-cache`
55+
3. `npm start`
56+
4857
## Adding a new package
4958

5059
1. `npx lerna add <new-package> --scope=<install-target>`
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Contributing to the Designer
2+
This document covers information to help those wanting to contribute to the Adaptive Cards Designer.
3+
4+
## How to use the designer
5+
The designer can be used in a few different ways.
6+
1. Hosted on adaptivecards.io
7+
2. Shipped as a standalone package. This allows developers to use the designer within their own sites and customize it.
8+
3. Standalone app
9+
10+
## Renderer
11+
Its important to note that the designer utilizes the javascript renderer **only**. The version that the designer uses can be configured by the container and by the user.
12+
13+
## Styling
14+
Default styling for the designer is found at `src/adaptivecards-designer.css`. Note that containers also have styling for the rendered cards.
15+
16+
## `card-designer.ts`
17+
The bulk of the designer is found within `src/card-designer.ts`. Most handling for the following features is included here:
18+
1. Toolbar functionality
19+
5. Card elements pane
20+
6. Card surface
21+
7. Card payload editor
22+
8. Sample data editor
23+
9. Card structure pane
24+
10. Element properties pane
25+
11. Error pane
26+
27+
Since the designer is meant to be extensible to external developers and resilient to new feautres, most of these features are implemented with shared classes. Notably:
28+
- `Toolbar`
29+
- `ToolbarButton`
30+
- `ToolbarChoicePicker`
31+
- `BasePaletteItem`
32+
- `ElementPaletteItem`
33+
- `DataPaletteItem`
34+
- `SidePanel`
35+
- `DataTreeItem`
36+
- `TreeView`
37+
38+
The idea here is that you can simply create a new `ToolbarButton` when you want to add a new button to the main toolbar.
39+
40+
## Card Designer Surface
41+
The area of the designer that displays the card is called the `CardDesignerSurface` (See `src/card-designer-surface.ts`).
42+
It is easiest to think about the surface in two modes.
43+
44+
### Preview mode
45+
When the designer is in preview mode, we will display the card as it is rendered. That is, you cannot modify the card without editing the JSON manually. This version is the most straighforward as there are no features beyond the renderer.
46+
47+
### Design mode
48+
In design mode, the card designer surface is more complicated, because all card elements have an paired element called a `DesignerPeer` (See `src/designer-peers.ts`). That is, when we render the card in design mode, there will be a DesignerPeer overlaid on top of each element.
49+
![image](https://github.com/user-attachments/assets/f9ecf217-6fe7-4ac5-a1a6-18429b2b1250)
50+
51+
The peers allow us to enable a drag and drop interface for the designer. For some element peers, we also have additional buttons attached that add functionality (Example: `ColumnSetPeer` include an "Add a column" button). Note that new peers need to be registered within `CardElementPeerRegistry` (See `card-designer-surface.ts`).
52+
53+
The goal of design mode is to allow developers to design the card **without** manually modifyin the JSON editor. When an element has been moved, deleted, or modified from the card surface, the JSON editor will reflect the changes.
54+
55+
## Containers
56+
The designer has a concept of a "container" that allows us to mock a specific host app. The default containers can be found within `adaptivecards-designer/src/containers`. Containers can specify their own styling and custom rendering. When a designer container is initialized, we will render the container and attach it to the designer host (See `src/card-designer.ts`).
57+
58+
For instance, we have a container for the Widgets Board which allows for different themes and container sizes.
59+
<img width="695" alt="image" src="https://github.com/user-attachments/assets/bf323569-3c0e-4778-9742-c4536ed008eb" />
60+
61+
Containers can also specify their own Host Config, and these are stored at `samples/HostConfig/`.
62+
63+
## Templating
64+
Users are able to provide templating data via the Sample Data Editor.
65+
![image](https://github.com/user-attachments/assets/072ecf88-3aa1-471e-b2e6-b0369e768e04)
66+
67+
When the card is rendered from the card designer surface, the template payload from the editor will be provided to the renderer.
68+
69+
Template data can also be utilized from the Element Properties pane:
70+
![image](https://github.com/user-attachments/assets/2d35b9f4-002e-46a8-94b5-974ef36160e4)
71+
72+
More information on the element properties pane is below, but the specifics for the Data Binding button can be found in the `StringPropertyEditor` class.
73+
74+
## Card elements pane
75+
The card elements pane showcases all available elements, and it is only displays elements available for that specific version.
76+
![image](https://github.com/user-attachments/assets/5a0b259f-e66f-40de-bacc-c2eb2359ef08)
77+
78+
Each element can be dragged to the designer surface or double clicked to add it to the current card. Most of the implemenentation is handled within `card-designer.ts`. See `_draggedPaletteItem` and `_toolPaletteToolbox`.
79+
80+
## Element properties pane
81+
The element properties pane allows users to modify the various element properties without updating the JSON directly.
82+
83+
Populating this pane is handled by DesignerPeers. Each peer adds their properties to a `propertySheet` where the values are a `PropertyEditor` type. For instance, the Carousel has an additional property of type `BooleanPropertyEditor` that corresponds to the `loop` property.
84+
85+
<img width="411" alt="image" src="https://github.com/user-attachments/assets/b5b4f033-f96c-4dc0-b644-cefa1bd90a24" />
86+
87+
## `adaptivecards-controls` usage
88+
Many of the controls utilized in the designer come from the `adaptivecards-controls` library. Occasionally, a fix for the designer will require you to modify that package.
89+
90+
## Reference Pull Requests
91+
- [Add new element to the designer](https://github.com/microsoft/AdaptiveCards/pull/7654)
92+
- [Add controls to the toolbar](https://github.com/microsoft/AdaptiveCards/pull/7741)
93+
- [Add a new container](https://github.com/microsoft/AdaptiveCards/pull/6612)
94+
- [Add a new property to the element properties pane](https://github.com/microsoft/AdaptiveCards/pull/8271)
95+
- [Update adaptivecards-controls](https://github.com/microsoft/AdaptiveCards/pull/7937)
96+
- [Update designer peer ordering logic](https://github.com/microsoft/AdaptiveCards/pull/7514)

source/nodejs/adaptivecards-designer/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ The Adaptive Card Designer provides a rich, interactive design-time experience f
44

55
Try it out at [https://adaptivecards.io/designer](https://adaptivecards.io/designer)
66

7-
![Designer Screenshot](https://adaptivecards.io/images/designer.png)
8-
97
## What is this package?
108

119
This package allows you to easily integrate the adaptive cards designer into your own experiences.

source/nodejs/adaptivecards-site/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ Microsoft properties have a standard header/footer that is provided by the UHF A
3737
* `header.ejs` has a manual copy-paste of the HTML
3838
* `footer.ejs` non-essential JS includes that can be placed at the bottom of the page to decrease page load times.
3939

40+
**Update as of October 2022**
41+
* We updated our UHF usage to pull directly from their API for the cssIncludes, javascriptIncludes, and footer whenever the site is generated. [Reference Pull Request](https://github.com/microsoft/AdaptiveCards/pull/7941)
42+
43+
For UFH purposes, take note of the following properties:
44+
* partnerId: "MSDocsAdaptivecards"
45+
* headerId: "MSDocsAdaptivecardsHeader"
46+
* footerId: "MSDocsAdaptivecardsFooter"
47+
4048
## Install and Build
4149

4250
### Prerequisites

0 commit comments

Comments
 (0)