n8n-nodes-ui-render 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +206 -0
- package/dist/assets/banner.png +0 -0
- package/dist/icons/demo-header.png +0 -0
- package/dist/icons/demo-webhook.png +0 -0
- package/dist/icons/demo.png +0 -0
- package/dist/nodes/UiRenderer/UiRenderer.node.d.ts +5 -0
- package/dist/nodes/UiRenderer/UiRenderer.node.js +2837 -0
- package/dist/nodes/UiRenderer/UiRenderer.node.js.map +1 -0
- package/dist/nodes/UiRenderer/UiRenderer.node.json +13 -0
- package/dist/nodes/UiRenderer/ui-renderer.dark.svg +8 -0
- package/dist/nodes/UiRenderer/ui-renderer.svg +8 -0
- package/dist/package.json +62 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Benjamin Prouff
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
+
so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# n8n-nodes-ui-render
|
|
4
|
+
|
|
5
|
+
Turn your n8n data into clean, good-looking **HTML** reports (tables, charts, timelines, and a **chat-style** transcript UI).
|
|
6
|
+
Use it between your data nodes and **Respond to Webhook** to return a full HTML page in one step.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### Community Nodes (recommended)
|
|
11
|
+
|
|
12
|
+
1. In n8n: **Settings → Community Nodes**.
|
|
13
|
+
2. **Install**: enter the package name `n8n-nodes-ui-render` and install.
|
|
14
|
+
3. Reload n8n if prompted.
|
|
15
|
+
|
|
16
|
+
### Manual install (self-hosted)
|
|
17
|
+
|
|
18
|
+
From the same directory as your n8n installation (or your custom nodes setup):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install n8n-nodes-ui-render
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Restart n8n after installation.
|
|
25
|
+
|
|
26
|
+
> **npm / GitHub releases**
|
|
27
|
+
> Until a version is published to npm, **Community Nodes** may not resolve the package. Maintainers: configure Trusted Publishing (or `NPM_TOKEN`) as described in [`.github/workflows/publish.yml`](.github/workflows/publish.yml), then run **`npm run release`** locally to bump, tag, and trigger the npm publish workflow.
|
|
28
|
+
|
|
29
|
+
## What it renders
|
|
30
|
+
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
Depending on **Template Type**:
|
|
34
|
+
|
|
35
|
+
- `table` — responsive HTML table
|
|
36
|
+
- `list` — card list (timeline layout under **Activity Feed** preset)
|
|
37
|
+
- `chart` — `bar`, `line`, `pie`, `donut`, `polar` (Chart.js)
|
|
38
|
+
- `sectionText` — title + paragraph (supports placeholders)
|
|
39
|
+
- `chat` — chat UI from a **messages** array on your item
|
|
40
|
+
- `LLM Chat Widget (webhook)` — embed / widget-oriented template (see node options)
|
|
41
|
+
|
|
42
|
+
## Input data: one item = one row (important)
|
|
43
|
+
|
|
44
|
+
For **table**, **list**, and **chart** (field mode), the node uses **each input item’s `json`** as one data row (or one chart point).
|
|
45
|
+
If you have a single item like `{ "rows": [ ... ] }`, add a **Code** node to output one item per row (snippet in [examples/README.md](examples/README.md)).
|
|
46
|
+
|
|
47
|
+
Ready-to-copy samples live under **[examples/](examples/)** (table, chart, list, section text, chat).
|
|
48
|
+
|
|
49
|
+
### Table — one row (one item)
|
|
50
|
+
|
|
51
|
+
[`examples/payload-table-row.json`](examples/payload-table-row.json)
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"deal": "Acme Corp",
|
|
56
|
+
"owner": "Alex",
|
|
57
|
+
"stage": "Negotiation",
|
|
58
|
+
"amount": 12000
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Chart — field mode, multiple points = multiple items
|
|
63
|
+
|
|
64
|
+
Use one item per point, or expand from [`examples/payload-chart-rows-bulk.json`](examples/payload-chart-rows-bulk.json). Single point example: [`examples/payload-chart-row.json`](examples/payload-chart-row.json).
|
|
65
|
+
|
|
66
|
+
### Chart — array mode (labels/values in the node)
|
|
67
|
+
|
|
68
|
+
When **Labels mode** / **Values mode** are set to **array**, paste JSON **strings** into the node fields (see [`examples/payload-chart-donut-array.json`](examples/payload-chart-donut-array.json)).
|
|
69
|
+
|
|
70
|
+
### List — one row (one item)
|
|
71
|
+
|
|
72
|
+
[`examples/payload-list-row.json`](examples/payload-list-row.json)
|
|
73
|
+
|
|
74
|
+
### Chat template
|
|
75
|
+
|
|
76
|
+
[`examples/payload-chat.json`](examples/payload-chat.json)
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"messages": [
|
|
81
|
+
{ "role": "user", "content": "Hello!", "timestamp": "2026-03-20 08:33" },
|
|
82
|
+
{
|
|
83
|
+
"role": "assistant",
|
|
84
|
+
"content": "Hi! Here is the ops dashboard.",
|
|
85
|
+
"timestamp": "2026-03-20 08:34"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Field renames: **Chat — Messages / Role / Content / Timestamp** in the node.
|
|
92
|
+
|
|
93
|
+
### Importable workflow
|
|
94
|
+
|
|
95
|
+
GitHub Markdown cannot add a real “Copy to clipboard” button. To try quickly:
|
|
96
|
+
|
|
97
|
+
1. **Manual Trigger** → **Set** (paste JSON from `examples/`) → **UI Render** → **Respond to Webhook**.
|
|
98
|
+
2. Or use a **Code** node with the expand snippet from [examples/README.md](examples/README.md).
|
|
99
|
+
|
|
100
|
+
You can also **duplicate** an existing workflow and replace the body of **Set** with the sample files above.
|
|
101
|
+
|
|
102
|
+
## Quick setup: Webhook → UI Render → Respond to Webhook
|
|
103
|
+
|
|
104
|
+
1. Build your data, then **UI Render**.
|
|
105
|
+
2. In **Respond to Webhook**:
|
|
106
|
+
- **Body**: `{{$json.html}}`
|
|
107
|
+
- **Header**: `Content-Type: text/html; charset=utf-8`
|
|
108
|
+
|
|
109
|
+
## Placeholders (`{{ … }}`) — not Handlebars, not n8n expressions *inside* the template
|
|
110
|
+
|
|
111
|
+
Inside **UI Render** text fields (title, subtitle, section text, etc.), the node runs a **small built-in resolver**:
|
|
112
|
+
|
|
113
|
+
- **`{{item.some.path}}`** — value from the **first** input item (dot path).
|
|
114
|
+
- **`{{meta.generatedAt}}`** — render metadata (see below).
|
|
115
|
+
- **`{{stats.count}}`** — number of input items used for this render.
|
|
116
|
+
|
|
117
|
+
This is **not** Handlebars and **does not** evaluate arbitrary n8n expressions like `{{ $json.x }}` *inside* those strings.
|
|
118
|
+
If you need n8n expressions, use them **in the parameter itself** in the n8n UI (n8n evaluates the parameter **before** the node runs); the UI Render placeholders are only for the `item` / `meta` / `stats` prefixes above.
|
|
119
|
+
|
|
120
|
+
### Available `meta` and `stats`
|
|
121
|
+
|
|
122
|
+
| Object | Keys | Description |
|
|
123
|
+
|--------|------|-------------|
|
|
124
|
+
| `meta` | `generatedAt` | ISO timestamp when the HTML was generated. |
|
|
125
|
+
| `stats` | `count` | Count of input items in the current render context. |
|
|
126
|
+
|
|
127
|
+
## Presets (global look & layout)
|
|
128
|
+
|
|
129
|
+
- **ExecutiveDashboard** — neutral business report.
|
|
130
|
+
- **SalesReport** — centered header, formal tone.
|
|
131
|
+
- **OpsTable** — consecutive **chart** blocks can form a **responsive grid**.
|
|
132
|
+
- **ActivityFeed** — **list** blocks use a **timeline** layout.
|
|
133
|
+
|
|
134
|
+
### Tips for a neutral layout
|
|
135
|
+
|
|
136
|
+
- Prefer **Theme = light** unless you’ve tuned custom colors.
|
|
137
|
+
- **Layout density = comfortable** avoids cramped cards.
|
|
138
|
+
- Leave accent / background / text color empty to rely on the preset.
|
|
139
|
+
|
|
140
|
+
## Charts (donut / polar included)
|
|
141
|
+
|
|
142
|
+
- **Labels**: mode `field` or `array`
|
|
143
|
+
- **Values**: mode `field` or `array`
|
|
144
|
+
- Map **field** names or paste **array** JSON strings in the node fields.
|
|
145
|
+
|
|
146
|
+
## Multi-block mode
|
|
147
|
+
|
|
148
|
+
With **Page composition = Multi blocks**, stack **table / list / chart / text** blocks in order (block type **Text** maps to section-style content). **OpsTable** groups consecutive charts in a grid.
|
|
149
|
+
|
|
150
|
+
## Floating chat widget (direct webhook)
|
|
151
|
+
|
|
152
|
+
Enable **Chat Widget (direct webhook)** in the node. The page **POST**s JSON to your public webhook: `sessionId`, `message`, `chatInput`.
|
|
153
|
+
|
|
154
|
+
## Local development
|
|
155
|
+
|
|
156
|
+
Clone the repo, then:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm install
|
|
160
|
+
npm run build
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Link into your n8n environment (from this package directory):
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
npm link
|
|
167
|
+
# in the n8n installation directory (or as per n8n docs for custom nodes):
|
|
168
|
+
npm link n8n-nodes-ui-render
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Restart n8n after each **build** so it picks up `dist/`.
|
|
172
|
+
Optional: `npm run dev` / `n8n-node dev` if you use the n8n node CLI in watch mode.
|
|
173
|
+
|
|
174
|
+
**Lockfile:** Commit `package-lock.json` with your changes. GitHub Actions uses `npm install` (not `npm ci`) so small lockfile differences across npm versions are less likely to break CI.
|
|
175
|
+
|
|
176
|
+
## Publishing to npm (maintainers)
|
|
177
|
+
|
|
178
|
+
This package lists **`"files": ["dist"]`** so only the built node is published — not `node_modules`, sources, or your machine config.
|
|
179
|
+
|
|
180
|
+
**Important:** `dist/` is in `.gitignore`, so npm would normally skip it when packing. The repo includes a **`.npmignore`** so packaging uses that list instead of `.gitignore`, and **`dist/` is included** in the tarball. Do not delete `.npmignore` unless you know what you’re doing.
|
|
181
|
+
|
|
182
|
+
1. One-time: **`npm login`** (npmjs.com account; 2FA may ask for an OTP on publish).
|
|
183
|
+
2. **`npm run build`** — must succeed so `dist/` contains `UiRenderer.node.js`, icons, etc.
|
|
184
|
+
3. **Sanity check:** `npm pack --dry-run` — you should see `dist/nodes/UiRenderer/...` in the file list (not only `package.json` / README).
|
|
185
|
+
4. **Publish (scoped packages are private by default; this name is public):**
|
|
186
|
+
**`npm publish --access public`**
|
|
187
|
+
|
|
188
|
+
`prepublishOnly` runs **`npm run lint` then `npm run build`** before publish. (The CLI’s `n8n-node prerelease` only exists to steer you toward `npm run release` and blocks a plain `npm publish`.)
|
|
189
|
+
|
|
190
|
+
For **npm provenance** (required for n8n community nodes on the public registry), prefer the GitHub workflow in [`.github/workflows/publish.yml`](.github/workflows/publish.yml) (`npm run release` + tag) instead of only publishing from your laptop.
|
|
191
|
+
|
|
192
|
+
## Roadmap (ideas)
|
|
193
|
+
|
|
194
|
+
- **Dark mode polish** — first-class theme QA (today: light is the safest default).
|
|
195
|
+
- **Export PDF** — optional pipeline (e.g. headless Chromium) from the generated HTML.
|
|
196
|
+
- **More chart types** — area, mixed axes, radar, etc.
|
|
197
|
+
- **More preset screenshots** — gallery in the README.
|
|
198
|
+
|
|
199
|
+
## Safety
|
|
200
|
+
|
|
201
|
+
- Values are **HTML-escaped** by default.
|
|
202
|
+
- **Advanced — Allow unsafe HTML** allows raw HTML; use only with trusted content.
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
MIT — [LICENSE.md](LICENSE.md)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class UiRenderer implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|