@blackbelt-technology/pi-dashboard-forms-bpmn 0.7.0 → 0.8.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/.pi/skills/bpmn-package-explorer/SKILL.md +15 -9
- package/.pi/skills/bpmn-package-explorer/scripts/fixtures.mjs +6 -1
- package/.pi/skills/bpmn-package-explorer/scripts/generate-cli.mjs +1 -1
- package/.pi/skills/bpmn-package-explorer/scripts/render.mjs +3 -2
- package/.pi/skills/bpmn-package-explorer/scripts/serve.mjs +91 -0
- package/.pi/skills/bpmn-package-explorer/scripts/view-cli.mjs +1 -1
- package/.pi/skills/bpmn-package-explorer/templates/shell.html +12 -1
- package/.pi/skills/bpmn-package-explorer/templates/viewer.js +52 -5
- package/.pi/skills/openforms-mui/tools/package-lock.json +0 -42
- package/.pi/skills/openforms-mui/tools/src/fields/FieldRenderer.tsx +5 -0
- package/.pi/skills/openforms-mui/tools/src/fields/RepeaterField.tsx +4 -2
- package/.pi/skills/openforms-mui/tools/src/fields/renderer-registry.ts +43 -0
- package/NOTICE +0 -6
- package/README.md +12 -9
- package/package.json +8 -6
- package/.pi/skills/canvas-webapp/SKILL.md +0 -104
- package/.pi/skills/openforms-mui/tools/tests/a11y.test.tsx +0 -82
- package/.pi/skills/openforms-mui/tools/tests/cli.test.ts +0 -74
- package/.pi/skills/openforms-mui/tools/tests/component.test.tsx +0 -295
- package/.pi/skills/openforms-mui/tools/tests/diagnose.test.ts +0 -163
- package/.pi/skills/openforms-mui/tools/tests/fixtures/all-field-types.json +0 -45
- package/.pi/skills/openforms-mui/tools/tests/logic.test.ts +0 -175
- package/.pi/skills/openforms-mui/tools/tests/normalize.test.ts +0 -105
- package/.pi/skills/openforms-mui/tools/tests/reference-semantics.test.ts +0 -131
- package/.pi/skills/openforms-mui/tools/tests/responsive.test.tsx +0 -158
- package/.pi/skills/openforms-mui/tools/tests/setup.ts +0 -16
- package/.pi/skills/openforms-mui/tools/tests/singleton.test.tsx +0 -31
- package/.pi/skills/openforms-mui/tools/tests/theme.test.ts +0 -65
- package/.pi/skills/openforms-mui/tools/tests/toolchain.test.ts +0 -33
- package/.pi/skills/openforms-mui/tools/tests/validation.test.ts +0 -222
|
@@ -55,13 +55,17 @@ mechanical steps, each failing loudly:
|
|
|
55
55
|
4. **Validate the manifest** — `node scripts/generate-cli.mjs <packageDir>`
|
|
56
56
|
runs the envelope check, manifest validation, layout + guard, and assembles a
|
|
57
57
|
render root; it **stops before serving** on any error.
|
|
58
|
-
5. **Serve + canvas** — serve the printed render-root path with
|
|
59
|
-
|
|
58
|
+
5. **Serve + canvas** — serve the printed render-root path with
|
|
59
|
+
`node scripts/serve.mjs <renderRoot> [port]` (CORS-enabled) and open the
|
|
60
|
+
printed URL on the canvas (never `file://`). Do **not** use `serve_mockup`
|
|
61
|
+
for canvas display: it omits `Access-Control-Allow-Origin`, so the viewer's
|
|
62
|
+
`fetch('package-data.json')` fails in the opaque-origin sandbox (“Failed to
|
|
63
|
+
fetch” → blank diagram).
|
|
60
64
|
|
|
61
65
|
## Display / view workflow
|
|
62
66
|
|
|
63
|
-
- Package: `node scripts/generate-cli.mjs <packageDir>` → `
|
|
64
|
-
`canvas`.
|
|
67
|
+
- Package: `node scripts/generate-cli.mjs <packageDir>` → `node scripts/serve.mjs
|
|
68
|
+
<renderRoot>` → `canvas`.
|
|
65
69
|
- Standalone file (no manifest): `node scripts/view-cli.mjs <file.bpmn|.dmn>`.
|
|
66
70
|
A file with DI renders as authored; a semantics-only `.bpmn` is laid out into a
|
|
67
71
|
**separate** render artifact (the source is never overwritten). A DI-less file
|
|
@@ -80,11 +84,13 @@ or **404s**, it is almost always one of these, not a viewer bug:
|
|
|
80
84
|
under the `/live/<id>/` prefix → 404. Keep every path in the render root
|
|
81
85
|
**relative** (`./vendor/...`). Serve the render root with `serve_mockup` (never
|
|
82
86
|
`file://`) and open the returned URL on the canvas.
|
|
83
|
-
- **
|
|
84
|
-
|
|
85
|
-
`
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
- **Missing CORS on the static server → “Failed to load package: Failed to
|
|
88
|
+
fetch”.** In the opaque-origin iframe every runtime request carries
|
|
89
|
+
`Origin: null`: the viewer's `fetch('package-data.json')` (and any
|
|
90
|
+
`<script type="module">`) is rejected unless the server answers with
|
|
91
|
+
`Access-Control-Allow-Origin: *`. `serve_mockup` does NOT set it, so serve
|
|
92
|
+
canvas render roots with `node scripts/serve.mjs <renderRoot>` (this skill's
|
|
93
|
+
CORS server) rather than `serve_mockup`.
|
|
88
94
|
- **Self-verify** by iframing your served render root with
|
|
89
95
|
`sandbox="allow-scripts"` and screenshotting before trusting the canvas — that
|
|
90
96
|
reproduces the exact dashboard sandbox.
|
|
@@ -137,4 +137,9 @@ async function main() {
|
|
|
137
137
|
console.log(`\nAll ${files.length} fixtures match their recorded outcomes.`);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
main()
|
|
140
|
+
// Owned rejection: this is the script's entry point, so a rejected `main()` must
|
|
141
|
+
// exit non-zero with a message rather than float as an unhandled rejection.
|
|
142
|
+
main().catch((err) => {
|
|
143
|
+
console.error(err);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// a render root ready to serve. Fails loudly; stops before serving on any error.
|
|
4
4
|
//
|
|
5
5
|
// node scripts/generate-cli.mjs <packageDir> [renderOutDir]
|
|
6
|
-
// → prints the render-root path on success (serve it with
|
|
6
|
+
// → prints the render-root path on success (serve it with scripts/serve.mjs — CORS)
|
|
7
7
|
|
|
8
8
|
import { buildPackage, WorkflowError } from './generate.mjs';
|
|
9
9
|
import { assembleRenderRoot } from './render.mjs';
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Builds a directory that presents the shell, the package artifacts and the
|
|
4
4
|
// single shared asset root under ONE origin — the asset root as a SYMLINK, so
|
|
5
|
-
// the multi-megabyte payload is never duplicated per package (
|
|
5
|
+
// the multi-megabyte payload is never duplicated per package (the CORS server
|
|
6
6
|
// follows symlinks). Asset URLs in the shell are RELATIVE, so they survive an
|
|
7
7
|
// ephemeral port not known at generation time.
|
|
8
8
|
//
|
|
9
9
|
// node scripts/render.mjs <packageDir> [outDir]
|
|
10
|
-
// → assembles a render root and prints its path (serve it with
|
|
10
|
+
// → assembles a render root and prints its path (serve it with
|
|
11
|
+
// scripts/serve.mjs — CORS-enabled, required for the opaque-origin canvas)
|
|
11
12
|
|
|
12
13
|
import { mkdtempSync, mkdirSync, readdirSync, copyFileSync, writeFileSync, readFileSync, existsSync, symlinkSync, statSync, rmSync } from 'node:fs';
|
|
13
14
|
import { tmpdir } from 'node:os';
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// CORS-enabled static server for a render root (§8.3 canvas display).
|
|
3
|
+
//
|
|
4
|
+
// The dashboard opens the canvas in a `sandbox="allow-scripts"` iframe with NO
|
|
5
|
+
// `allow-same-origin` (opaque origin), proxied under `/live/<id>/`. In that
|
|
6
|
+
// sandbox the viewer's runtime `fetch('package-data.json')` (and any module
|
|
7
|
+
// script) goes out with `Origin: null`, so the static server MUST answer with
|
|
8
|
+
// `Access-Control-Allow-Origin: *` or the browser rejects it as "Failed to
|
|
9
|
+
// fetch" and the canvas shows a blank diagram. `serve_mockup` does NOT set that
|
|
10
|
+
// header, so serve canvas render roots with THIS instead.
|
|
11
|
+
//
|
|
12
|
+
// node scripts/serve.mjs <renderRoot> [port]
|
|
13
|
+
// → binds 127.0.0.1:<port> (ephemeral if omitted) and prints the URL
|
|
14
|
+
//
|
|
15
|
+
// Symlinks are followed (the asset root + source artifacts are symlinked into
|
|
16
|
+
// the render root, mirroring serve_mockup); URL paths are lexically confined so
|
|
17
|
+
// a `../` in the request cannot escape the render root.
|
|
18
|
+
|
|
19
|
+
import http from 'node:http';
|
|
20
|
+
import { createReadStream, statSync } from 'node:fs';
|
|
21
|
+
import { join, normalize, extname, resolve } from 'node:path';
|
|
22
|
+
|
|
23
|
+
const [rootArg, portArg] = process.argv.slice(2);
|
|
24
|
+
if (!rootArg) {
|
|
25
|
+
console.error('usage: node scripts/serve.mjs <renderRoot> [port]');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
const ROOT = resolve(rootArg);
|
|
29
|
+
const PORT = portArg ? Number(portArg) : 0;
|
|
30
|
+
|
|
31
|
+
const TYPES = {
|
|
32
|
+
'.html': 'text/html; charset=utf-8',
|
|
33
|
+
'.js': 'text/javascript; charset=utf-8',
|
|
34
|
+
'.mjs': 'text/javascript; charset=utf-8',
|
|
35
|
+
'.json': 'application/json; charset=utf-8',
|
|
36
|
+
'.css': 'text/css; charset=utf-8',
|
|
37
|
+
'.svg': 'image/svg+xml',
|
|
38
|
+
'.bpmn': 'application/xml; charset=utf-8',
|
|
39
|
+
'.dmn': 'application/xml; charset=utf-8',
|
|
40
|
+
'.form': 'application/json; charset=utf-8',
|
|
41
|
+
'.png': 'image/png',
|
|
42
|
+
'.woff': 'font/woff',
|
|
43
|
+
'.woff2': 'font/woff2',
|
|
44
|
+
'.ttf': 'font/ttf',
|
|
45
|
+
'.eot': 'application/vnd.ms-fontobject',
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const server = http.createServer((req, res) => {
|
|
49
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
50
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, HEAD, OPTIONS');
|
|
51
|
+
if (req.method === 'OPTIONS') {
|
|
52
|
+
res.writeHead(204);
|
|
53
|
+
return res.end();
|
|
54
|
+
}
|
|
55
|
+
// Lexically confine the request path: strip the query, decode, normalize, and
|
|
56
|
+
// drop any leading `../` so traversal above the render root is impossible.
|
|
57
|
+
let rel = decodeURIComponent((req.url || '/').split('?')[0]);
|
|
58
|
+
if (rel === '/' || rel === '') rel = '/index.html';
|
|
59
|
+
rel = normalize(rel).replace(/^(\.\.[/\\])+/, '').replace(/^[/\\]+/, '');
|
|
60
|
+
const full = join(ROOT, rel);
|
|
61
|
+
if (full !== ROOT && !full.startsWith(ROOT + '/')) {
|
|
62
|
+
res.writeHead(403);
|
|
63
|
+
return res.end('forbidden');
|
|
64
|
+
}
|
|
65
|
+
let st;
|
|
66
|
+
try {
|
|
67
|
+
st = statSync(full); // follows symlinks (asset root + artifacts are links)
|
|
68
|
+
} catch {
|
|
69
|
+
res.writeHead(404);
|
|
70
|
+
return res.end('not found');
|
|
71
|
+
}
|
|
72
|
+
if (!st.isFile()) {
|
|
73
|
+
res.writeHead(404);
|
|
74
|
+
return res.end('not found');
|
|
75
|
+
}
|
|
76
|
+
res.setHeader('Content-Type', TYPES[extname(full).toLowerCase()] || 'application/octet-stream');
|
|
77
|
+
if (req.method === 'HEAD') {
|
|
78
|
+
res.writeHead(200);
|
|
79
|
+
return res.end();
|
|
80
|
+
}
|
|
81
|
+
createReadStream(full).on('error', () => {
|
|
82
|
+
res.writeHead(500);
|
|
83
|
+
res.end('read error');
|
|
84
|
+
}).pipe(res);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
server.listen(PORT, '127.0.0.1', () => {
|
|
88
|
+
const port = server.address().port;
|
|
89
|
+
console.log(`http://127.0.0.1:${port}/`);
|
|
90
|
+
console.error(`[serve] CORS static server for ${ROOT} on 127.0.0.1:${port}`);
|
|
91
|
+
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// .bpmn is laid out into a separate render artifact; the source is never touched.
|
|
4
4
|
//
|
|
5
5
|
// node scripts/view-cli.mjs <file.bpmn|file.dmn> [renderOutDir]
|
|
6
|
-
// → prints the render-root path (serve it with
|
|
6
|
+
// → prints the render-root path (serve it with scripts/serve.mjs — CORS) or the refusal
|
|
7
7
|
|
|
8
8
|
import { assembleStandalone } from './render.mjs';
|
|
9
9
|
|
|
@@ -29,9 +29,18 @@
|
|
|
29
29
|
|
|
30
30
|
/* Side panel sits BESIDE the canvas (never overlays it). Its own dmn-js
|
|
31
31
|
watermark renders at its lower-right, so panel chrome keeps clear of it. */
|
|
32
|
-
#panel { flex: 0 0 var(--panel-w); max-width: 100%; border-left: 1px solid #dfe6ee;
|
|
32
|
+
#panel { flex: 0 0 var(--panel-w); max-width: 100%; min-width: 240px; border-left: 1px solid #dfe6ee;
|
|
33
33
|
background: #fff; display: none; flex-direction: column; position: relative; }
|
|
34
34
|
#panel.open { display: flex; }
|
|
35
|
+
|
|
36
|
+
/* Drag handle straddling the panel's left seam — resizes the canvas/panel
|
|
37
|
+
split by adjusting --panel-w. Sits above panel chrome but below overlays. */
|
|
38
|
+
#panel-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px;
|
|
39
|
+
cursor: col-resize; z-index: 50; touch-action: none; }
|
|
40
|
+
#panel-resize::before { content: ''; position: absolute; left: 3px; top: 0; bottom: 0;
|
|
41
|
+
width: 3px; background: transparent; transition: background .12s; }
|
|
42
|
+
#panel-resize:hover::before, #panel-resize.dragging::before { background: rgba(31,119,180,.35); }
|
|
43
|
+
body.panel-resizing { cursor: col-resize; user-select: none; }
|
|
35
44
|
#panel header { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
|
|
36
45
|
border-bottom: 1px solid #eef2f6; font-size: 14px; }
|
|
37
46
|
#panel header .title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
@@ -97,6 +106,7 @@
|
|
|
97
106
|
@media (max-width: 767px) {
|
|
98
107
|
#panel { flex-basis: 100%; }
|
|
99
108
|
body.panel-open #canvas { display: none; }
|
|
109
|
+
#panel-resize { display: none; }
|
|
100
110
|
#diagnostics { right: 12px; }
|
|
101
111
|
}
|
|
102
112
|
</style>
|
|
@@ -123,6 +133,7 @@
|
|
|
123
133
|
</div>
|
|
124
134
|
</div>
|
|
125
135
|
<aside id="panel" aria-label="Artifact panel">
|
|
136
|
+
<div id="panel-resize" role="separator" aria-orientation="vertical" aria-label="Resize panel" tabindex="0"></div>
|
|
126
137
|
<header>
|
|
127
138
|
<span class="title" id="panel-title"></span>
|
|
128
139
|
<button class="close" id="panel-close">Close</button>
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
panelPath: document.getElementById('panel-path'),
|
|
16
16
|
panelBody: document.getElementById('panel-body'),
|
|
17
17
|
panelClose: document.getElementById('panel-close'),
|
|
18
|
+
panelResize: document.getElementById('panel-resize'),
|
|
18
19
|
zoomIn: document.getElementById('zoom-in'),
|
|
19
20
|
zoomOut: document.getElementById('zoom-out'),
|
|
20
21
|
zoomReset: document.getElementById('zoom-reset'),
|
|
@@ -74,6 +75,13 @@
|
|
|
74
75
|
}
|
|
75
76
|
function xmlHasDI(xml) { return /<(\w+:)?BPMNDiagram[\s>]/.test(xml) || /<bpmndi:/.test(xml); }
|
|
76
77
|
|
|
78
|
+
// A navigation promise fired from a DOM handler has no caller to await it, so
|
|
79
|
+
// own its rejection here: surface through the existing diagnostic channel
|
|
80
|
+
// rather than leaving an unhandled rejection in the page.
|
|
81
|
+
function failSoft(p) {
|
|
82
|
+
if (p && typeof p.catch === 'function') p.catch(function (err) { diag([String(err)]); });
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
// ── main bpmn mount ─────────────────────────────────────────────────────
|
|
78
86
|
function mountProcess(file, push) {
|
|
79
87
|
return fetchText(file).then(function (xml) {
|
|
@@ -105,8 +113,8 @@
|
|
|
105
113
|
var id = e.element.id;
|
|
106
114
|
var b = byElement[id];
|
|
107
115
|
if (!b) return; // 7.11 unbound element is inert
|
|
108
|
-
if (b.kind === 'process')
|
|
109
|
-
openPanel(b, e.element.name || id);
|
|
116
|
+
if (b.kind === 'process') { failSoft(drillDown(b, e.element.name || id)); return; }
|
|
117
|
+
failSoft(openPanel(b, e.element.name || id));
|
|
110
118
|
});
|
|
111
119
|
}
|
|
112
120
|
|
|
@@ -182,7 +190,7 @@
|
|
|
182
190
|
}
|
|
183
191
|
state.navStack.push({ file: state.currentFile, callerName: state.currentFile });
|
|
184
192
|
addReturnControl(callerName);
|
|
185
|
-
mountProcess(binding.ref, true);
|
|
193
|
+
failSoft(mountProcess(binding.ref, true));
|
|
186
194
|
}
|
|
187
195
|
function addReturnControl(callerName) {
|
|
188
196
|
var existing = document.getElementById('return-control');
|
|
@@ -194,7 +202,7 @@
|
|
|
194
202
|
var prev = state.navStack.pop();
|
|
195
203
|
if (!prev) return;
|
|
196
204
|
if (!state.navStack.length) btn.remove();
|
|
197
|
-
mountProcess(prev.file, false);
|
|
205
|
+
failSoft(mountProcess(prev.file, false));
|
|
198
206
|
};
|
|
199
207
|
document.getElementById('return-zone').appendChild(btn);
|
|
200
208
|
}
|
|
@@ -215,7 +223,7 @@
|
|
|
215
223
|
els.switcherSelect.onchange = function () {
|
|
216
224
|
state.navStack = [];
|
|
217
225
|
var rc = document.getElementById('return-control'); if (rc) rc.remove();
|
|
218
|
-
mountProcess(els.switcherSelect.value, false);
|
|
226
|
+
failSoft(mountProcess(els.switcherSelect.value, false));
|
|
219
227
|
};
|
|
220
228
|
}
|
|
221
229
|
|
|
@@ -262,6 +270,45 @@
|
|
|
262
270
|
els.panelClose.onclick = closePanel;
|
|
263
271
|
els.diagnostics.querySelector('.dismiss').onclick = function () { els.diagnostics.classList.add('hidden'); };
|
|
264
272
|
|
|
273
|
+
// ── panel resize (drag the seam to set --panel-w) ───────────────────────
|
|
274
|
+
(function wirePanelResize() {
|
|
275
|
+
var handle = els.panelResize;
|
|
276
|
+
if (!handle) return;
|
|
277
|
+
var MIN = 240; // keep in sync with #panel min-width
|
|
278
|
+
function clamp(px) { return Math.max(MIN, Math.min(px, window.innerWidth - 120)); }
|
|
279
|
+
function setWidth(px) {
|
|
280
|
+
document.documentElement.style.setProperty('--panel-w', clamp(px) + 'px');
|
|
281
|
+
if (state.viewer) { try { state.viewer.get('canvas').resized(); } catch (e) {} }
|
|
282
|
+
}
|
|
283
|
+
function onMove(clientX) { setWidth(window.innerWidth - clientX); }
|
|
284
|
+
function startDrag(getX) {
|
|
285
|
+
handle.classList.add('dragging');
|
|
286
|
+
document.body.classList.add('panel-resizing');
|
|
287
|
+
function move(ev) { onMove(getX(ev)); }
|
|
288
|
+
function up() {
|
|
289
|
+
handle.classList.remove('dragging');
|
|
290
|
+
document.body.classList.remove('panel-resizing');
|
|
291
|
+
window.removeEventListener('mousemove', move);
|
|
292
|
+
window.removeEventListener('mouseup', up);
|
|
293
|
+
window.removeEventListener('touchmove', tmove);
|
|
294
|
+
window.removeEventListener('touchend', up);
|
|
295
|
+
}
|
|
296
|
+
function tmove(ev) { if (ev.touches[0]) onMove(ev.touches[0].clientX); }
|
|
297
|
+
window.addEventListener('mousemove', move);
|
|
298
|
+
window.addEventListener('mouseup', up);
|
|
299
|
+
window.addEventListener('touchmove', tmove, { passive: true });
|
|
300
|
+
window.addEventListener('touchend', up);
|
|
301
|
+
}
|
|
302
|
+
handle.addEventListener('mousedown', function (e) { e.preventDefault(); startDrag(function (ev) { return ev.clientX; }); });
|
|
303
|
+
handle.addEventListener('touchstart', function (e) { if (e.touches[0]) startDrag(function () { return 0; }); }, { passive: true });
|
|
304
|
+
// keyboard: arrow keys nudge the split for accessibility.
|
|
305
|
+
handle.addEventListener('keydown', function (e) {
|
|
306
|
+
var cur = els.panel.getBoundingClientRect().width;
|
|
307
|
+
if (e.key === 'ArrowLeft') { setWidth(cur + 24); e.preventDefault(); }
|
|
308
|
+
else if (e.key === 'ArrowRight') { setWidth(cur - 24); e.preventDefault(); }
|
|
309
|
+
});
|
|
310
|
+
})();
|
|
311
|
+
|
|
265
312
|
// Load the OpenForms renderer only when vendored (avoids a 404 / console error).
|
|
266
313
|
function loadFormRenderer(data) {
|
|
267
314
|
return new Promise(function (resolve) {
|
|
@@ -1603,9 +1603,6 @@
|
|
|
1603
1603
|
"x64"
|
|
1604
1604
|
],
|
|
1605
1605
|
"dev": true,
|
|
1606
|
-
"libc": [
|
|
1607
|
-
"glibc"
|
|
1608
|
-
],
|
|
1609
1606
|
"license": "MIT",
|
|
1610
1607
|
"optional": true,
|
|
1611
1608
|
"os": [
|
|
@@ -1725,9 +1722,6 @@
|
|
|
1725
1722
|
"arm"
|
|
1726
1723
|
],
|
|
1727
1724
|
"dev": true,
|
|
1728
|
-
"libc": [
|
|
1729
|
-
"glibc"
|
|
1730
|
-
],
|
|
1731
1725
|
"license": "MIT",
|
|
1732
1726
|
"optional": true,
|
|
1733
1727
|
"os": [
|
|
@@ -1742,9 +1736,6 @@
|
|
|
1742
1736
|
"arm"
|
|
1743
1737
|
],
|
|
1744
1738
|
"dev": true,
|
|
1745
|
-
"libc": [
|
|
1746
|
-
"musl"
|
|
1747
|
-
],
|
|
1748
1739
|
"license": "MIT",
|
|
1749
1740
|
"optional": true,
|
|
1750
1741
|
"os": [
|
|
@@ -1759,9 +1750,6 @@
|
|
|
1759
1750
|
"arm64"
|
|
1760
1751
|
],
|
|
1761
1752
|
"dev": true,
|
|
1762
|
-
"libc": [
|
|
1763
|
-
"glibc"
|
|
1764
|
-
],
|
|
1765
1753
|
"license": "MIT",
|
|
1766
1754
|
"optional": true,
|
|
1767
1755
|
"os": [
|
|
@@ -1776,9 +1764,6 @@
|
|
|
1776
1764
|
"arm64"
|
|
1777
1765
|
],
|
|
1778
1766
|
"dev": true,
|
|
1779
|
-
"libc": [
|
|
1780
|
-
"musl"
|
|
1781
|
-
],
|
|
1782
1767
|
"license": "MIT",
|
|
1783
1768
|
"optional": true,
|
|
1784
1769
|
"os": [
|
|
@@ -1793,9 +1778,6 @@
|
|
|
1793
1778
|
"loong64"
|
|
1794
1779
|
],
|
|
1795
1780
|
"dev": true,
|
|
1796
|
-
"libc": [
|
|
1797
|
-
"glibc"
|
|
1798
|
-
],
|
|
1799
1781
|
"license": "MIT",
|
|
1800
1782
|
"optional": true,
|
|
1801
1783
|
"os": [
|
|
@@ -1810,9 +1792,6 @@
|
|
|
1810
1792
|
"loong64"
|
|
1811
1793
|
],
|
|
1812
1794
|
"dev": true,
|
|
1813
|
-
"libc": [
|
|
1814
|
-
"musl"
|
|
1815
|
-
],
|
|
1816
1795
|
"license": "MIT",
|
|
1817
1796
|
"optional": true,
|
|
1818
1797
|
"os": [
|
|
@@ -1827,9 +1806,6 @@
|
|
|
1827
1806
|
"ppc64"
|
|
1828
1807
|
],
|
|
1829
1808
|
"dev": true,
|
|
1830
|
-
"libc": [
|
|
1831
|
-
"glibc"
|
|
1832
|
-
],
|
|
1833
1809
|
"license": "MIT",
|
|
1834
1810
|
"optional": true,
|
|
1835
1811
|
"os": [
|
|
@@ -1844,9 +1820,6 @@
|
|
|
1844
1820
|
"ppc64"
|
|
1845
1821
|
],
|
|
1846
1822
|
"dev": true,
|
|
1847
|
-
"libc": [
|
|
1848
|
-
"musl"
|
|
1849
|
-
],
|
|
1850
1823
|
"license": "MIT",
|
|
1851
1824
|
"optional": true,
|
|
1852
1825
|
"os": [
|
|
@@ -1861,9 +1834,6 @@
|
|
|
1861
1834
|
"riscv64"
|
|
1862
1835
|
],
|
|
1863
1836
|
"dev": true,
|
|
1864
|
-
"libc": [
|
|
1865
|
-
"glibc"
|
|
1866
|
-
],
|
|
1867
1837
|
"license": "MIT",
|
|
1868
1838
|
"optional": true,
|
|
1869
1839
|
"os": [
|
|
@@ -1878,9 +1848,6 @@
|
|
|
1878
1848
|
"riscv64"
|
|
1879
1849
|
],
|
|
1880
1850
|
"dev": true,
|
|
1881
|
-
"libc": [
|
|
1882
|
-
"musl"
|
|
1883
|
-
],
|
|
1884
1851
|
"license": "MIT",
|
|
1885
1852
|
"optional": true,
|
|
1886
1853
|
"os": [
|
|
@@ -1895,9 +1862,6 @@
|
|
|
1895
1862
|
"s390x"
|
|
1896
1863
|
],
|
|
1897
1864
|
"dev": true,
|
|
1898
|
-
"libc": [
|
|
1899
|
-
"glibc"
|
|
1900
|
-
],
|
|
1901
1865
|
"license": "MIT",
|
|
1902
1866
|
"optional": true,
|
|
1903
1867
|
"os": [
|
|
@@ -1912,9 +1876,6 @@
|
|
|
1912
1876
|
"x64"
|
|
1913
1877
|
],
|
|
1914
1878
|
"dev": true,
|
|
1915
|
-
"libc": [
|
|
1916
|
-
"glibc"
|
|
1917
|
-
],
|
|
1918
1879
|
"license": "MIT",
|
|
1919
1880
|
"optional": true,
|
|
1920
1881
|
"os": [
|
|
@@ -1929,9 +1890,6 @@
|
|
|
1929
1890
|
"x64"
|
|
1930
1891
|
],
|
|
1931
1892
|
"dev": true,
|
|
1932
|
-
"libc": [
|
|
1933
|
-
"musl"
|
|
1934
|
-
],
|
|
1935
1893
|
"license": "MIT",
|
|
1936
1894
|
"optional": true,
|
|
1937
1895
|
"os": [
|
|
@@ -20,6 +20,7 @@ import { useOpenForms } from "./context.js";
|
|
|
20
20
|
import { FieldShell } from "./FieldShell.js";
|
|
21
21
|
import { labelWithMarker } from "./label.js";
|
|
22
22
|
import { MatrixFieldWidget } from "./MatrixField.js";
|
|
23
|
+
import { registerFieldRenderer } from "./renderer-registry.js";
|
|
23
24
|
import { RepeaterFieldWidget } from "./RepeaterField.js";
|
|
24
25
|
import { FileFieldWidget } from "./FileField.js";
|
|
25
26
|
import { SignatureCanvas } from "./SignatureCanvas.js";
|
|
@@ -326,3 +327,7 @@ export function FieldRenderer({ field, namePrefix = "", inRepeater, revealed }:
|
|
|
326
327
|
|
|
327
328
|
return null;
|
|
328
329
|
}
|
|
330
|
+
|
|
331
|
+
// Register at module load so container widgets (repeater, matrix) can resolve
|
|
332
|
+
// the renderer at RENDER time instead of importing it — see renderer-registry.
|
|
333
|
+
registerFieldRenderer(FieldRenderer);
|
|
@@ -10,7 +10,7 @@ import type { Field, RepeaterField as RepeaterFieldType } from "../schema/types.
|
|
|
10
10
|
import { emptyValueFor } from "../validation/empty.js";
|
|
11
11
|
import { useOpenForms } from "./context.js";
|
|
12
12
|
import { FieldShell } from "./FieldShell.js";
|
|
13
|
-
import {
|
|
13
|
+
import { getFieldRenderer } from "./renderer-registry.js";
|
|
14
14
|
|
|
15
15
|
/** Build one empty row object with every child key present (payload contract). */
|
|
16
16
|
export function emptyRepeaterRow(field: RepeaterFieldType): Record<string, unknown> {
|
|
@@ -41,6 +41,8 @@ export function RepeaterFieldWidget({ field, name }: { field: RepeaterFieldType;
|
|
|
41
41
|
const childFields: Field[] = (field.rows ?? []).flatMap((r) =>
|
|
42
42
|
r.columns.flatMap((c) => c.fields),
|
|
43
43
|
);
|
|
44
|
+
// Resolved at render time, not imported — breaks the renderer↔repeater cycle.
|
|
45
|
+
const FieldRendererImpl = getFieldRenderer();
|
|
44
46
|
|
|
45
47
|
return (
|
|
46
48
|
<FieldShell field={field}>
|
|
@@ -52,7 +54,7 @@ export function RepeaterFieldWidget({ field, name }: { field: RepeaterFieldType;
|
|
|
52
54
|
<Card key={item.id} variant="outlined">
|
|
53
55
|
<CardContent>
|
|
54
56
|
{childFields.map((child, ci) => (
|
|
55
|
-
<
|
|
57
|
+
<FieldRendererImpl key={`${child.key}-${ci}`} field={child} namePrefix={`${name}.${index}.`} inRepeater />
|
|
56
58
|
))}
|
|
57
59
|
{!readOnly && (
|
|
58
60
|
<Box sx={{ mt: 1 }}>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Breaks the FieldRenderer ↔ RepeaterField import cycle.
|
|
3
|
+
*
|
|
4
|
+
* A repeater renders arbitrary child fields, so it needs the renderer; the
|
|
5
|
+
* renderer dispatches repeaters, so it needs the repeater. That is genuine
|
|
6
|
+
* mutual recursion, not a layering mistake — but a static import cycle makes
|
|
7
|
+
* module-init order load-bearing (whichever side initializes first sees
|
|
8
|
+
* `undefined`), which is exactly what `noImportCycles` guards against.
|
|
9
|
+
*
|
|
10
|
+
* The renderer registers itself on module load; container widgets resolve it at
|
|
11
|
+
* RENDER time, by which point both modules are initialized. One direction of
|
|
12
|
+
* the edge becomes dynamic, so the cycle disappears without changing behaviour.
|
|
13
|
+
*/
|
|
14
|
+
import type { ComponentType } from "react";
|
|
15
|
+
import type { Field } from "../schema/types.js";
|
|
16
|
+
|
|
17
|
+
export interface FieldRendererProps {
|
|
18
|
+
field: Field;
|
|
19
|
+
namePrefix?: string;
|
|
20
|
+
inRepeater?: boolean;
|
|
21
|
+
revealed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let renderer: ComponentType<FieldRendererProps> | undefined;
|
|
25
|
+
|
|
26
|
+
/** Called once by `FieldRenderer.tsx` at module load. */
|
|
27
|
+
export function registerFieldRenderer(component: ComponentType<FieldRendererProps>): void {
|
|
28
|
+
renderer = component;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The registered renderer. Throws rather than rendering nothing: a missing
|
|
33
|
+
* registration is a build/import-order defect, and a silent empty repeater row
|
|
34
|
+
* would be far harder to trace than an explicit failure.
|
|
35
|
+
*/
|
|
36
|
+
export function getFieldRenderer(): ComponentType<FieldRendererProps> {
|
|
37
|
+
if (!renderer) {
|
|
38
|
+
throw new Error(
|
|
39
|
+
"FieldRenderer is not registered — import './FieldRenderer.js' before rendering a container field.",
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
return renderer;
|
|
43
|
+
}
|
package/NOTICE
CHANGED
|
@@ -38,9 +38,3 @@ offline operation.
|
|
|
38
38
|
|
|
39
39
|
Optional OpenForms form rendering inside a BPMN user task follows the OpenForms
|
|
40
40
|
Apache 2.0 attribution above.
|
|
41
|
-
|
|
42
|
-
================================================================================
|
|
43
|
-
canvas-webapp
|
|
44
|
-
================================================================================
|
|
45
|
-
Original documentation skill (MIT, this package). Describes rendering a web app
|
|
46
|
-
on the pi-dashboard canvas.
|
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@ interactive, canvas-viewable UI — bundled for distribution cohesion, kept as
|
|
|
8
8
|
|-------|--------------|
|
|
9
9
|
| **openforms-mui** | Runtime interpreter that renders/authors an OpenForms `FormSchemaJSON` as idiomatic, themed, accessible **MUI** (React). 14 field types, conditional logic, calculated fields, validation. Bundler-based (Vite) library under `.pi/skills/openforms-mui/tools`. |
|
|
10
10
|
| **bpmn-package-explorer** | Generate + view vendor-neutral **BPMN 2.0** process packages (plus DMN decisions and forms). **Buildless & offline**: vendored bpmn-js / dmn-js viewers, Node layout bundle, no `npm install`, no network. |
|
|
11
|
-
| **canvas-webapp** | Shared infra skill: how to render a web app on the **pi-dashboard canvas** (sandboxed opaque-origin iframe) — static build with relative `base` + a CORS static server. Referenced by both skills above. |
|
|
12
11
|
|
|
13
12
|
## Why bundled, not merged
|
|
14
13
|
|
|
@@ -17,7 +16,9 @@ have **opposite build philosophies** — openforms needs a bundler + React/MUI;
|
|
|
17
16
|
bpmn deliberately avoids all installs to stay offline. Merging would force the
|
|
18
17
|
buildless skill to pull React/MUI and lose its offline guarantee. The **package**
|
|
19
18
|
is the unit of cohesion; the skills stay focused. Their only real overlap —
|
|
20
|
-
rendering on the dashboard canvas — is
|
|
19
|
+
rendering on the dashboard canvas — is documented by the dashboard `extension`
|
|
20
|
+
package's own `canvas-webapp` skill (present in any pi-dashboard session); the
|
|
21
|
+
two skills cross-reference it by name.
|
|
21
22
|
|
|
22
23
|
## Install
|
|
23
24
|
|
|
@@ -36,10 +37,11 @@ On install a **guarded postinstall** (`scripts/ensure-openforms-deps.mjs`)
|
|
|
36
37
|
installs the openforms `tools/` dependencies **only if missing** — a cheap no-op
|
|
37
38
|
otherwise. The bpmn skill needs nothing installed.
|
|
38
39
|
|
|
39
|
-
> **Note — `canvas-webapp`
|
|
40
|
-
>
|
|
41
|
-
>
|
|
42
|
-
>
|
|
40
|
+
> **Note — `canvas-webapp` is not bundled here.** The canvas-render recipe
|
|
41
|
+
> ships with the dashboard's own `extension` package as the `canvas-webapp`
|
|
42
|
+
> skill, which is present in any pi-dashboard session (the only place the canvas
|
|
43
|
+
> exists). The two skills above cross-reference it by name — no copy is kept
|
|
44
|
+
> here, so there is no name-shadowing.
|
|
43
45
|
|
|
44
46
|
## Requirements
|
|
45
47
|
|
|
@@ -50,9 +52,10 @@ otherwise. The bpmn skill needs nothing installed.
|
|
|
50
52
|
|
|
51
53
|
Both skills serve web content the dashboard shows in a `sandbox="allow-scripts"`
|
|
52
54
|
(opaque-origin, no `allow-same-origin`) iframe proxied under `/live/<id>/`. See
|
|
53
|
-
`canvas-webapp` for the full recipe:
|
|
54
|
-
|
|
55
|
-
opaque-origin iframe is
|
|
55
|
+
the dashboard `extension` package's `canvas-webapp` skill for the full recipe:
|
|
56
|
+
static build with `base:'./'` + a static server that sets
|
|
57
|
+
`Access-Control-Allow-Origin: *` (module fetch in an opaque-origin iframe is
|
|
58
|
+
CORS with `Origin: null`).
|
|
56
59
|
|
|
57
60
|
## Attribution
|
|
58
61
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackbelt-technology/pi-dashboard-forms-bpmn",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Two pi skills bundled together: openforms-mui (render/author OpenForms FormSchemaJSON as themed, accessible MUI) and bpmn-package-explorer (generate/view vendor-neutral BPMN 2.0 + DMN process packages).
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Two pi skills bundled together: openforms-mui (render/author OpenForms FormSchemaJSON as themed, accessible MUI) and bpmn-package-explorer (generate/view vendor-neutral BPMN 2.0 + DMN process packages). Rendering either on the pi-dashboard canvas is documented by the dashboard extension's own canvas-webapp skill.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/BlackBeltTechnology/pi-agent-dashboard",
|
|
8
|
+
"url": "git+https://github.com/BlackBeltTechnology/pi-agent-dashboard.git",
|
|
9
9
|
"directory": "packages/pi-forms-bpmn"
|
|
10
10
|
},
|
|
11
11
|
"license": "MIT",
|
|
@@ -30,8 +30,7 @@
|
|
|
30
30
|
"pi": {
|
|
31
31
|
"skills": [
|
|
32
32
|
".pi/skills/openforms-mui",
|
|
33
|
-
".pi/skills/bpmn-package-explorer"
|
|
34
|
-
".pi/skills/canvas-webapp"
|
|
33
|
+
".pi/skills/bpmn-package-explorer"
|
|
35
34
|
]
|
|
36
35
|
},
|
|
37
36
|
"scripts": {
|
|
@@ -41,6 +40,9 @@
|
|
|
41
40
|
".pi/skills/",
|
|
42
41
|
"scripts/",
|
|
43
42
|
"README.md",
|
|
44
|
-
"NOTICE"
|
|
43
|
+
"NOTICE",
|
|
44
|
+
"!**/AGENTS.md",
|
|
45
|
+
"!**/*.AGENTS.md",
|
|
46
|
+
"!**/tools/tests"
|
|
45
47
|
]
|
|
46
48
|
}
|