@blackbelt-technology/pi-dashboard-forms-bpmn 0.7.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 +120 -0
- package/.pi/skills/bpmn-package-explorer/assets/LICENSE.bpmn-io.txt +23 -0
- package/.pi/skills/bpmn-package-explorer/assets/VENDORED.md +90 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn-codes.css +108 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn-embedded.css +166 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn.css +164 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.eot +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.svg +224 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.ttf +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.woff +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.woff2 +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-navigated-viewer.production.min.js +22 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn.css +145 -0
- package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/diagram-js.css +1249 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/diagram-js.css +1133 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn-codes.css +41 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn-embedded.css +98 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn.css +97 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.eot +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.svg +90 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.ttf +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.woff +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.woff2 +0 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-decision-table.css +580 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-drd.css +108 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-literal-expression.css +165 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-shared.css +221 -0
- package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-viewer.production.min.js +16 -0
- package/.pi/skills/bpmn-package-explorer/assets/lib/bpmn-pipeline.mjs +6981 -0
- package/.pi/skills/bpmn-package-explorer/assets/lib/yaml.mjs +7372 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g1-identical-bounds.bpmn +17 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g2-zero-size.bpmn +17 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g3-child-outside.bpmn +16 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g4-negative-coord.bpmn +17 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g5-overlap.bpmn +17 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/1-linear.bpmn +12 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/2-gateway.bpmn +19 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/3-boundary.bpmn +13 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/4-subprocess.bpmn +17 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/5-pools.bpmn +21 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/6-lanes-only.bpmn +16 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/7-loop.bpmn +13 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/measured/8-long-chain.bpmn +32 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/nesting/expanded-subprocess-ok.bpmn +25 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/call-activity.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/intermediate-catch.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/intermediate-throw.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/manual-task.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/multi-boundary.bpmn +16 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/parallel-gateway.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/receive-task.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/rule-task.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/script-task.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/fixtures/provisional/send-task.bpmn +10 -0
- package/.pi/skills/bpmn-package-explorer/references/authoring-envelope.md +52 -0
- package/.pi/skills/bpmn-package-explorer/references/identifiers.md +102 -0
- package/.pi/skills/bpmn-package-explorer/references/layout-envelope.md +105 -0
- package/.pi/skills/bpmn-package-explorer/references/licensing.md +48 -0
- package/.pi/skills/bpmn-package-explorer/references/package-manifest.md +104 -0
- package/.pi/skills/bpmn-package-explorer/scripts/build-fixtures.mjs +299 -0
- package/.pi/skills/bpmn-package-explorer/scripts/demo.mjs +128 -0
- package/.pi/skills/bpmn-package-explorer/scripts/diagnostics.mjs +37 -0
- package/.pi/skills/bpmn-package-explorer/scripts/envelope.mjs +160 -0
- package/.pi/skills/bpmn-package-explorer/scripts/fixtures.mjs +140 -0
- package/.pi/skills/bpmn-package-explorer/scripts/generate-cli.mjs +31 -0
- package/.pi/skills/bpmn-package-explorer/scripts/generate.mjs +103 -0
- package/.pi/skills/bpmn-package-explorer/scripts/guard.mjs +335 -0
- package/.pi/skills/bpmn-package-explorer/scripts/harness.mjs +12 -0
- package/.pi/skills/bpmn-package-explorer/scripts/identifiers.mjs +117 -0
- package/.pi/skills/bpmn-package-explorer/scripts/ingest.mjs +95 -0
- package/.pi/skills/bpmn-package-explorer/scripts/manifest.mjs +374 -0
- package/.pi/skills/bpmn-package-explorer/scripts/pipeline.mjs +49 -0
- package/.pi/skills/bpmn-package-explorer/scripts/render.mjs +130 -0
- package/.pi/skills/bpmn-package-explorer/scripts/runguard.mjs +38 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest-e2e.mjs +87 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest-guard.mjs +99 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest-manifest.mjs +170 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest-more.mjs +87 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest-workflow.mjs +73 -0
- package/.pi/skills/bpmn-package-explorer/scripts/selftest.mjs +57 -0
- package/.pi/skills/bpmn-package-explorer/scripts/vendor.mjs +141 -0
- package/.pi/skills/bpmn-package-explorer/scripts/view-cli.mjs +19 -0
- package/.pi/skills/bpmn-package-explorer/templates/shell.html +141 -0
- package/.pi/skills/bpmn-package-explorer/templates/viewer.js +301 -0
- package/.pi/skills/canvas-webapp/SKILL.md +104 -0
- package/.pi/skills/openforms-mui/SKILL.md +187 -0
- package/.pi/skills/openforms-mui/references/a11y.md +68 -0
- package/.pi/skills/openforms-mui/references/field-widget-map.md +64 -0
- package/.pi/skills/openforms-mui/references/hu-locale.md +45 -0
- package/.pi/skills/openforms-mui/references/logic.md +94 -0
- package/.pi/skills/openforms-mui/references/schema.md +94 -0
- package/.pi/skills/openforms-mui/references/theme-bridge.md +65 -0
- package/.pi/skills/openforms-mui/tools/canvas-serve.mjs +51 -0
- package/.pi/skills/openforms-mui/tools/demo-schema.json +80 -0
- package/.pi/skills/openforms-mui/tools/mockups/tokens.css +27 -0
- package/.pi/skills/openforms-mui/tools/mockups/ui-contract.tokens.json +16 -0
- package/.pi/skills/openforms-mui/tools/package-lock.json +5919 -0
- package/.pi/skills/openforms-mui/tools/package.json +61 -0
- package/.pi/skills/openforms-mui/tools/preview/RenderPanel.tsx +105 -0
- package/.pi/skills/openforms-mui/tools/preview/canvas-app.tsx +66 -0
- package/.pi/skills/openforms-mui/tools/preview/canvas-index.html +16 -0
- package/.pi/skills/openforms-mui/tools/preview/cli.ts +99 -0
- package/.pi/skills/openforms-mui/tools/preview/index.html +17 -0
- package/.pi/skills/openforms-mui/tools/preview/main.tsx +228 -0
- package/.pi/skills/openforms-mui/tools/preview/vite-plugin.ts +41 -0
- package/.pi/skills/openforms-mui/tools/scripts/assert-peer-deps.mjs +39 -0
- package/.pi/skills/openforms-mui/tools/src/OpenFormsMui.tsx +391 -0
- package/.pi/skills/openforms-mui/tools/src/css.d.ts +2 -0
- package/.pi/skills/openforms-mui/tools/src/fields/ErrorSummary.tsx +72 -0
- package/.pi/skills/openforms-mui/tools/src/fields/FieldRenderer.tsx +328 -0
- package/.pi/skills/openforms-mui/tools/src/fields/FieldShell.tsx +50 -0
- package/.pi/skills/openforms-mui/tools/src/fields/FileField.tsx +91 -0
- package/.pi/skills/openforms-mui/tools/src/fields/MatrixField.tsx +146 -0
- package/.pi/skills/openforms-mui/tools/src/fields/RepeaterField.tsx +82 -0
- package/.pi/skills/openforms-mui/tools/src/fields/SignatureCanvas.tsx +121 -0
- package/.pi/skills/openforms-mui/tools/src/fields/context.tsx +34 -0
- package/.pi/skills/openforms-mui/tools/src/fields/index.ts +7 -0
- package/.pi/skills/openforms-mui/tools/src/fields/label.ts +42 -0
- package/.pi/skills/openforms-mui/tools/src/fonts.ts +8 -0
- package/.pi/skills/openforms-mui/tools/src/i18n/dictionary.ts +58 -0
- package/.pi/skills/openforms-mui/tools/src/i18n/hu.ts +56 -0
- package/.pi/skills/openforms-mui/tools/src/i18n/index.ts +43 -0
- package/.pi/skills/openforms-mui/tools/src/index.ts +27 -0
- package/.pi/skills/openforms-mui/tools/src/logic/cnf.ts +206 -0
- package/.pi/skills/openforms-mui/tools/src/logic/formula.ts +285 -0
- package/.pi/skills/openforms-mui/tools/src/logic/index.ts +4 -0
- package/.pi/skills/openforms-mui/tools/src/logic/operators.ts +43 -0
- package/.pi/skills/openforms-mui/tools/src/logic/state.ts +183 -0
- package/.pi/skills/openforms-mui/tools/src/payload.ts +83 -0
- package/.pi/skills/openforms-mui/tools/src/provenance.ts +21 -0
- package/.pi/skills/openforms-mui/tools/src/schema/diagnose.ts +256 -0
- package/.pi/skills/openforms-mui/tools/src/schema/index.ts +4 -0
- package/.pi/skills/openforms-mui/tools/src/schema/normalize.ts +163 -0
- package/.pi/skills/openforms-mui/tools/src/schema/types.ts +299 -0
- package/.pi/skills/openforms-mui/tools/src/schema/walk.ts +68 -0
- package/.pi/skills/openforms-mui/tools/src/theme/from-tokens.ts +102 -0
- package/.pi/skills/openforms-mui/tools/src/theme/index.ts +1 -0
- package/.pi/skills/openforms-mui/tools/src/validation/constrain.ts +83 -0
- package/.pi/skills/openforms-mui/tools/src/validation/diagnostics.ts +62 -0
- package/.pi/skills/openforms-mui/tools/src/validation/empty.ts +53 -0
- package/.pi/skills/openforms-mui/tools/src/validation/index.ts +5 -0
- package/.pi/skills/openforms-mui/tools/src/validation/resolver.ts +14 -0
- package/.pi/skills/openforms-mui/tools/src/validation/zod-from-schema.ts +169 -0
- package/.pi/skills/openforms-mui/tools/tests/a11y.test.tsx +82 -0
- package/.pi/skills/openforms-mui/tools/tests/cli.test.ts +74 -0
- package/.pi/skills/openforms-mui/tools/tests/component.test.tsx +295 -0
- package/.pi/skills/openforms-mui/tools/tests/diagnose.test.ts +163 -0
- package/.pi/skills/openforms-mui/tools/tests/fixtures/all-field-types.json +45 -0
- package/.pi/skills/openforms-mui/tools/tests/logic.test.ts +175 -0
- package/.pi/skills/openforms-mui/tools/tests/normalize.test.ts +105 -0
- package/.pi/skills/openforms-mui/tools/tests/reference-semantics.test.ts +131 -0
- package/.pi/skills/openforms-mui/tools/tests/responsive.test.tsx +158 -0
- package/.pi/skills/openforms-mui/tools/tests/setup.ts +16 -0
- package/.pi/skills/openforms-mui/tools/tests/singleton.test.tsx +31 -0
- package/.pi/skills/openforms-mui/tools/tests/theme.test.ts +65 -0
- package/.pi/skills/openforms-mui/tools/tests/toolchain.test.ts +33 -0
- package/.pi/skills/openforms-mui/tools/tests/validation.test.ts +222 -0
- package/.pi/skills/openforms-mui/tools/tsconfig.json +21 -0
- package/.pi/skills/openforms-mui/tools/vite.canvas.config.ts +21 -0
- package/.pi/skills/openforms-mui/tools/vitest.config.ts +17 -0
- package/NOTICE +46 -0
- package/README.md +62 -0
- package/package.json +46 -0
- package/scripts/ensure-openforms-deps.mjs +38 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Maintenance / re-vendoring workflow for bpmn-package-explorer.
|
|
3
|
+
//
|
|
4
|
+
// Reproduces every vendored asset from PINNED inputs. It is NOT run at use
|
|
5
|
+
// time; it is run by a maintainer upgrading a bundle. The buildless contract
|
|
6
|
+
// governs *use* time (generate + render need no install, no bundler, no
|
|
7
|
+
// network); this script is the vendoring-time build that produces the
|
|
8
|
+
// self-contained Node module.
|
|
9
|
+
//
|
|
10
|
+
// Contract:
|
|
11
|
+
// * Browser bundles (bpmn-js, dmn-js) are copied verbatim and hash-compared
|
|
12
|
+
// against the published artifact (whole-file identity).
|
|
13
|
+
// * The Node closure is bundled into ONE self-contained ESM module with
|
|
14
|
+
// esbuild. That output is a BUILD ARTIFACT, so its INPUTS are hash-recorded
|
|
15
|
+
// (see PINS below and assets/VENDORED.md) rather than the output being
|
|
16
|
+
// compared to a published file.
|
|
17
|
+
// * After re-vendoring, scripts/fixtures.mjs MUST be run and its result
|
|
18
|
+
// recorded before the change is accepted (upstream drift detector).
|
|
19
|
+
//
|
|
20
|
+
// Usage: node scripts/vendor.mjs # verify current vendored hashes
|
|
21
|
+
// node scripts/vendor.mjs --rebuild # re-install pinned inputs + rebuild
|
|
22
|
+
//
|
|
23
|
+
// A --rebuild needs npm + network + esbuild; plain verify is offline.
|
|
24
|
+
|
|
25
|
+
import { createHash } from 'node:crypto';
|
|
26
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
27
|
+
import { fileURLToPath } from 'node:url';
|
|
28
|
+
import { dirname, join } from 'node:path';
|
|
29
|
+
import { execSync } from 'node:child_process';
|
|
30
|
+
|
|
31
|
+
const SKILL = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
32
|
+
const ASSETS = join(SKILL, 'assets');
|
|
33
|
+
|
|
34
|
+
// ─── PINS ─── exact versions, never a range. Mirrors assets/VENDORED.md.
|
|
35
|
+
export const PINS = {
|
|
36
|
+
browser: {
|
|
37
|
+
'bpmn-js': '18.24.0',
|
|
38
|
+
'dmn-js': '17.10.1',
|
|
39
|
+
},
|
|
40
|
+
node: {
|
|
41
|
+
'bpmn-auto-layout': '1.3.0',
|
|
42
|
+
'bpmn-moddle': '10.1.0',
|
|
43
|
+
moddle: '8.2.1',
|
|
44
|
+
'moddle-xml': '12.1.0',
|
|
45
|
+
'min-dash': '5.1.0',
|
|
46
|
+
saxen: '11.1.1',
|
|
47
|
+
yaml: '2.9.0',
|
|
48
|
+
},
|
|
49
|
+
esbuild: '0.24.0',
|
|
50
|
+
nodeFloor: '20.12', // strictest engines.node in the closure (bpmn-moddle, saxen)
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// Whole-file hashes recorded at vendoring time.
|
|
54
|
+
// browser: hash of the copied published bundle (identity check).
|
|
55
|
+
// nodeInputs: hash of each package's published dist/index.js — the ESBUILD
|
|
56
|
+
// INPUTS, recorded because the bundle is a build output.
|
|
57
|
+
export const HASHES = {
|
|
58
|
+
browser: {
|
|
59
|
+
'assets/bpmn-js/bpmn-navigated-viewer.production.min.js':
|
|
60
|
+
'e815dba42e3864eafc1621fab15e9c22e8ebcd07cf1e89650a9ca4ad2fe45f49',
|
|
61
|
+
'assets/dmn-js/dmn-viewer.production.min.js':
|
|
62
|
+
'0e3e4504b17bad6b570b93441807d4b322a1e10b33452b80497177499a8d72b9',
|
|
63
|
+
},
|
|
64
|
+
nodeInputs: {
|
|
65
|
+
'bpmn-auto-layout/dist/index.js':
|
|
66
|
+
'1443e3f710c45db7bf4cdcfcb960fe48a5e0cae8214a1451deca5784424e211e',
|
|
67
|
+
'bpmn-moddle/dist/index.js':
|
|
68
|
+
'ece57e2fae965e1372cfb21b983fba06818c318ad0d35b6b8b8b6da2e27a0c9b',
|
|
69
|
+
'moddle/dist/index.js':
|
|
70
|
+
'fc20cb48373cf2a6e09143492626dbc77efb8d8e3660a9e132b5bc9dcb7a558c',
|
|
71
|
+
'moddle-xml/dist/index.js':
|
|
72
|
+
'35480f3eb2f0baf57d1f07e812ae47b65df68217e273b427ed07f2d442e7da14',
|
|
73
|
+
'min-dash/dist/index.js':
|
|
74
|
+
'0eacee75abc8df5349304a6c1a7377f3d36142cb182cbb95c2227ca8a3349a7c',
|
|
75
|
+
'saxen/dist/index.js':
|
|
76
|
+
'6303cae8a9787409db5671c958897ec8e5a3bf9e26f4b490c760b4d6d4257279',
|
|
77
|
+
'yaml/dist/index.js':
|
|
78
|
+
'2d58984e0ae80de4acbd8f009fab332f5ce77d9e1a5f138a3058a0ada6567fb9',
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export function sha256(path) {
|
|
83
|
+
return createHash('sha256').update(readFileSync(path)).digest('hex');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function verify() {
|
|
87
|
+
let failed = 0;
|
|
88
|
+
for (const [rel, expected] of Object.entries(HASHES.browser)) {
|
|
89
|
+
const p = join(SKILL, rel);
|
|
90
|
+
if (!existsSync(p)) { console.error(`MISSING ${rel}`); failed++; continue; }
|
|
91
|
+
const got = sha256(p);
|
|
92
|
+
const ok = got === expected;
|
|
93
|
+
console.log(`${ok ? 'OK ' : 'FAIL'} ${rel}`);
|
|
94
|
+
if (!ok) { console.error(` expected ${expected}\n got ${got}`); failed++; }
|
|
95
|
+
}
|
|
96
|
+
const pipeline = join(ASSETS, 'lib', 'bpmn-pipeline.mjs');
|
|
97
|
+
console.log(existsSync(pipeline) ? `OK assets/lib/bpmn-pipeline.mjs present` : 'FAIL bundle missing');
|
|
98
|
+
if (!existsSync(pipeline)) failed++;
|
|
99
|
+
if (failed) { console.error(`\n${failed} vendored asset(s) failed verification`); process.exit(1); }
|
|
100
|
+
console.log('\nAll vendored browser bundles match their recorded hashes.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function rebuild() {
|
|
104
|
+
const tmp = execSync('mktemp -d /tmp/bpmn-vendor.XXXXXX').toString().trim();
|
|
105
|
+
console.log(`vendor workspace: ${tmp}`);
|
|
106
|
+
const spec = [
|
|
107
|
+
...Object.entries(PINS.browser),
|
|
108
|
+
...Object.entries(PINS.node),
|
|
109
|
+
].map(([n, v]) => `${n}@${v}`).join(' ');
|
|
110
|
+
execSync(`cd ${tmp} && npm init -y >/dev/null && npm install --no-audit --no-fund ${spec}`, { stdio: 'inherit' });
|
|
111
|
+
const nm = join(tmp, 'node_modules');
|
|
112
|
+
|
|
113
|
+
// Browser copies
|
|
114
|
+
const cp = (from, to) => execSync(`cp -R ${join(nm, from)} ${join(SKILL, to)}`);
|
|
115
|
+
cp('bpmn-js/dist/bpmn-navigated-viewer.production.min.js', 'assets/bpmn-js/');
|
|
116
|
+
cp('bpmn-js/dist/assets/diagram-js.css', 'assets/bpmn-js/');
|
|
117
|
+
execSync(`cp ${join(nm, 'bpmn-js/dist/assets/bpmn-js.css')} ${join(SKILL, 'assets/bpmn-js/bpmn.css')}`);
|
|
118
|
+
cp('bpmn-js/dist/assets/bpmn-font', 'assets/bpmn-js/');
|
|
119
|
+
cp('dmn-js/dist/dmn-viewer.production.min.js', 'assets/dmn-js/');
|
|
120
|
+
for (const css of ['diagram-js.css', 'dmn-js-shared.css', 'dmn-js-drd.css',
|
|
121
|
+
'dmn-js-decision-table.css', 'dmn-js-literal-expression.css']) {
|
|
122
|
+
cp(`dmn-js/dist/assets/${css}`, 'assets/dmn-js/');
|
|
123
|
+
}
|
|
124
|
+
cp('dmn-js/dist/assets/dmn-font', 'assets/dmn-js/');
|
|
125
|
+
|
|
126
|
+
// Node closure bundle (build output)
|
|
127
|
+
const entry = join(tmp, 'entry.mjs');
|
|
128
|
+
execSync(`printf '%s\\n' "export { layoutProcess } from 'bpmn-auto-layout';" "export { BpmnModdle } from 'bpmn-moddle';" > ${entry}`);
|
|
129
|
+
execSync(`cd ${tmp} && npx --yes esbuild@${PINS.esbuild} entry.mjs --bundle --format=esm --platform=node --target=node${PINS.nodeFloor} --legal-comments=none --outfile=${join(ASSETS, 'lib', 'bpmn-pipeline.mjs')}`, { stdio: 'inherit' });
|
|
130
|
+
|
|
131
|
+
// YAML parser bundle (createRequire banner so CJS require('process') resolves)
|
|
132
|
+
const yentry = join(tmp, 'yaml-entry.mjs');
|
|
133
|
+
execSync(`printf "export { parse, parseDocument, Document } from 'yaml';\\n" > ${yentry}`);
|
|
134
|
+
execSync(`cd ${tmp} && npx --yes esbuild@${PINS.esbuild} yaml-entry.mjs --bundle --format=esm --platform=node --target=node${PINS.nodeFloor} --legal-comments=none --banner:js='import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);' --outfile=${join(ASSETS, 'lib', 'yaml.mjs')}`, { stdio: 'inherit' });
|
|
135
|
+
|
|
136
|
+
console.log('\nRebuild complete. Now run: node scripts/fixtures.mjs (record the outcome before accepting).');
|
|
137
|
+
verify();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (process.argv.includes('--rebuild')) rebuild();
|
|
141
|
+
else verify();
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Standalone view of a single .bpmn/.dmn WITHOUT a manifest (§8.4). A DI-less
|
|
3
|
+
// .bpmn is laid out into a separate render artifact; the source is never touched.
|
|
4
|
+
//
|
|
5
|
+
// node scripts/view-cli.mjs <file.bpmn|file.dmn> [renderOutDir]
|
|
6
|
+
// → prints the render-root path (serve it with serve_mockup) or the refusal
|
|
7
|
+
|
|
8
|
+
import { assembleStandalone } from './render.mjs';
|
|
9
|
+
|
|
10
|
+
const [src, outDir] = process.argv.slice(2);
|
|
11
|
+
if (!src) { console.error('usage: node scripts/view-cli.mjs <file.bpmn|file.dmn> [renderOutDir]'); process.exit(1); }
|
|
12
|
+
|
|
13
|
+
const r = await assembleStandalone(src, outDir);
|
|
14
|
+
if (r.refused) {
|
|
15
|
+
console.error('REFUSED — this file contains a construct the envelope rejects and has no DI:');
|
|
16
|
+
for (const d of r.diagnostics) console.error(` [${d.code}] ${d.message}`);
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
console.log(r.renderRoot);
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>BPMN Package Explorer</title>
|
|
7
|
+
|
|
8
|
+
<!-- Vendored bundles, loaded by relative URL from the render root (single
|
|
9
|
+
origin, port-agnostic). No bundler, no install, no network. -->
|
|
10
|
+
<link rel="stylesheet" href="assets/bpmn-js/diagram-js.css" />
|
|
11
|
+
<link rel="stylesheet" href="assets/bpmn-js/bpmn.css" />
|
|
12
|
+
<link rel="stylesheet" href="assets/bpmn-js/bpmn-font/css/bpmn.css" />
|
|
13
|
+
<link rel="stylesheet" href="assets/dmn-js/diagram-js.css" />
|
|
14
|
+
<link rel="stylesheet" href="assets/dmn-js/dmn-js-shared.css" />
|
|
15
|
+
<link rel="stylesheet" href="assets/dmn-js/dmn-js-drd.css" />
|
|
16
|
+
<link rel="stylesheet" href="assets/dmn-js/dmn-js-decision-table.css" />
|
|
17
|
+
<link rel="stylesheet" href="assets/dmn-js/dmn-js-literal-expression.css" />
|
|
18
|
+
|
|
19
|
+
<style>
|
|
20
|
+
:root { --panel-w: 400px; --wm-reserve: 190px; }
|
|
21
|
+
* { box-sizing: border-box; }
|
|
22
|
+
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1a2b3c; }
|
|
23
|
+
#app { display: flex; height: 100vh; width: 100vw; overflow: hidden; }
|
|
24
|
+
|
|
25
|
+
/* Main canvas mount. bpmn.io watermark renders at bottom:15px;right:15px
|
|
26
|
+
INSIDE this element, so we never place chrome over its lower-right. */
|
|
27
|
+
#canvas { position: relative; flex: 1 1 auto; min-width: 0; background: #fbfcfe; }
|
|
28
|
+
#canvas .djs-container { height: 100%; }
|
|
29
|
+
|
|
30
|
+
/* Side panel sits BESIDE the canvas (never overlays it). Its own dmn-js
|
|
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;
|
|
33
|
+
background: #fff; display: none; flex-direction: column; position: relative; }
|
|
34
|
+
#panel.open { display: flex; }
|
|
35
|
+
#panel header { display: flex; align-items: center; gap: 8px; padding: 10px 12px;
|
|
36
|
+
border-bottom: 1px solid #eef2f6; font-size: 14px; }
|
|
37
|
+
#panel header .title { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
38
|
+
#panel .artifact-path { font-size: 12px; color: #6b7c8f; padding: 4px 12px; }
|
|
39
|
+
#panel-body { flex: 1; overflow: auto; position: relative;
|
|
40
|
+
/* reserve lower-right for the dmn-js / mount watermark */
|
|
41
|
+
padding-bottom: var(--wm-reserve); }
|
|
42
|
+
#panel .close { cursor: pointer; border: 1px solid #cdd7e1; background: #fff; border-radius: 6px; padding: 2px 8px; }
|
|
43
|
+
|
|
44
|
+
/* Overlays do not intercept diagram clicks: the CONTAINER is click-through and
|
|
45
|
+
only the interactive chrome (buttons, select, links) captures pointer events.
|
|
46
|
+
Without this, an overlay sitting over a flow node would swallow its click. */
|
|
47
|
+
.controls, #switcher, #legend, .attribution, #diagnostics { pointer-events: none; }
|
|
48
|
+
.controls button, #switcher select, #legend a, .attribution a,
|
|
49
|
+
#diagnostics .dismiss, #diagnostics a { pointer-events: auto; }
|
|
50
|
+
|
|
51
|
+
/* Controls — top-left, clear of the lower-right watermark. */
|
|
52
|
+
.controls { position: absolute; top: 12px; left: 12px; z-index: 40; display: flex; gap: 6px; }
|
|
53
|
+
.controls button { cursor: pointer; border: 1px solid #cdd7e1; background: #fff; border-radius: 6px; padding: 4px 10px; font-size: 13px; }
|
|
54
|
+
|
|
55
|
+
/* Return control (drill-down) — its own row below the toolbar, so it never
|
|
56
|
+
sits under the participant switcher. */
|
|
57
|
+
#return-zone { position: absolute; top: 48px; left: 12px; z-index: 41; }
|
|
58
|
+
#return-zone button { cursor: pointer; border: 1px solid #cdd7e1; background: #fff; border-radius: 6px; padding: 4px 10px; font-size: 13px; }
|
|
59
|
+
|
|
60
|
+
/* Participant switcher — top-center-left. */
|
|
61
|
+
#switcher { position: absolute; top: 12px; left: 140px; z-index: 40; }
|
|
62
|
+
#switcher select { padding: 4px 8px; border: 1px solid #cdd7e1; border-radius: 6px; background: #fff; font-size: 13px; }
|
|
63
|
+
|
|
64
|
+
/* Legend — TOP-right, explicitly clear of the lower-right watermark. */
|
|
65
|
+
#legend { position: absolute; top: 12px; right: 12px; z-index: 40; background: rgba(255,255,255,.94);
|
|
66
|
+
border: 1px solid #dfe6ee; border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: 220px; }
|
|
67
|
+
#legend h4 { margin: 0 0 6px; font-size: 12px; }
|
|
68
|
+
#legend .row { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
|
|
69
|
+
#legend .swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
|
|
70
|
+
|
|
71
|
+
/* Diagnostics — TOP band, dismissible, clear of every watermark region. */
|
|
72
|
+
#diagnostics { position: absolute; top: 56px; left: 12px; right: 240px; z-index: 45;
|
|
73
|
+
background: #fff8e1; border: 1px solid #f2d675; border-radius: 8px; padding: 8px 12px; font-size: 13px; }
|
|
74
|
+
#diagnostics.hidden { display: none; }
|
|
75
|
+
#diagnostics ul { margin: 6px 0 0; padding-left: 18px; }
|
|
76
|
+
#diagnostics .dismiss { float: right; cursor: pointer; border: none; background: transparent; font-size: 16px; }
|
|
77
|
+
|
|
78
|
+
/* Attribution footer — bottom-LEFT, never the watermark's lower-right. */
|
|
79
|
+
.attribution { position: absolute; bottom: 6px; left: 10px; z-index: 30; font-size: 11px; color: #8595a6; }
|
|
80
|
+
.attribution a { color: #5b6b7d; }
|
|
81
|
+
|
|
82
|
+
/* Role markers — distinguishable WITHOUT colour alone (pattern + border). */
|
|
83
|
+
.role-marker .djs-visual > :nth-child(1) { stroke-width: 3px !important; }
|
|
84
|
+
.role-0 .djs-visual > :nth-child(1) { stroke: #1f77b4 !important; stroke-dasharray: 0 !important; }
|
|
85
|
+
.role-1 .djs-visual > :nth-child(1) { stroke: #d62728 !important; stroke-dasharray: 6 3 !important; }
|
|
86
|
+
.role-2 .djs-visual > :nth-child(1) { stroke: #2ca02c !important; stroke-dasharray: 2 3 !important; }
|
|
87
|
+
.role-3 .djs-visual > :nth-child(1) { stroke: #9467bd !important; stroke-dasharray: 10 4 2 4 !important; }
|
|
88
|
+
|
|
89
|
+
/* Form mount styling is SCOPED to the panel, so MUI-style resets cannot
|
|
90
|
+
reach diagram-js canvas rendering. */
|
|
91
|
+
#panel-body .form-mount { padding: 12px; }
|
|
92
|
+
#panel-body .placeholder { margin: 16px; padding: 16px; border: 1px dashed #b9c6d4; border-radius: 8px; color: #55697c; }
|
|
93
|
+
|
|
94
|
+
/* Narrow viewport: the panel REPLACES the canvas rather than overlaying it,
|
|
95
|
+
so exactly one watermark-bearing mount is shown at a time (structural
|
|
96
|
+
compliance, not "leave a strip uncovered"). */
|
|
97
|
+
@media (max-width: 767px) {
|
|
98
|
+
#panel { flex-basis: 100%; }
|
|
99
|
+
body.panel-open #canvas { display: none; }
|
|
100
|
+
#diagnostics { right: 12px; }
|
|
101
|
+
}
|
|
102
|
+
</style>
|
|
103
|
+
</head>
|
|
104
|
+
<body>
|
|
105
|
+
<div id="app">
|
|
106
|
+
<div id="canvas">
|
|
107
|
+
<div class="controls">
|
|
108
|
+
<button id="zoom-in" title="Zoom in">+</button>
|
|
109
|
+
<button id="zoom-out" title="Zoom out">−</button>
|
|
110
|
+
<button id="zoom-reset" title="Fit to viewport">Fit</button>
|
|
111
|
+
</div>
|
|
112
|
+
<div id="switcher" hidden><select id="switcher-select" aria-label="Participant"></select></div>
|
|
113
|
+
<div id="return-zone"></div>
|
|
114
|
+
<div id="legend" hidden></div>
|
|
115
|
+
<div id="diagnostics" class="hidden">
|
|
116
|
+
<button class="dismiss" title="Dismiss">×</button>
|
|
117
|
+
<strong>Diagnostics</strong>
|
|
118
|
+
<ul id="diag-list"></ul>
|
|
119
|
+
</div>
|
|
120
|
+
<div class="attribution">
|
|
121
|
+
Diagrams by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>
|
|
122
|
+
<span id="of-attribution" hidden> · Forms: OpenForms (Apache 2.0)</span>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
<aside id="panel" aria-label="Artifact panel">
|
|
126
|
+
<header>
|
|
127
|
+
<span class="title" id="panel-title"></span>
|
|
128
|
+
<button class="close" id="panel-close">Close</button>
|
|
129
|
+
</header>
|
|
130
|
+
<div class="artifact-path" id="panel-path"></div>
|
|
131
|
+
<div id="panel-body"></div>
|
|
132
|
+
</aside>
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
<script src="assets/bpmn-js/bpmn-navigated-viewer.production.min.js"></script>
|
|
136
|
+
<script src="assets/dmn-js/dmn-viewer.production.min.js"></script>
|
|
137
|
+
<!-- The OpenForms renderer is loaded dynamically by viewer.js ONLY when the
|
|
138
|
+
package-data flag says it is vendored, so an absent renderer never 404s. -->
|
|
139
|
+
<script src="viewer.js"></script>
|
|
140
|
+
</body>
|
|
141
|
+
</html>
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/* BPMN Package Explorer — buildless viewer shell logic.
|
|
2
|
+
* Loads package-data.json, mounts bpmn-js / dmn-js / the form adapter, and
|
|
3
|
+
* wires the side panel, drill-down, participant switcher, roles and diagnostics.
|
|
4
|
+
* No bundler, no install, no network. */
|
|
5
|
+
(function () {
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
var ROLE_CLASSES = ['role-0', 'role-1', 'role-2', 'role-3'];
|
|
9
|
+
var DEPTH_LIMIT = 20;
|
|
10
|
+
|
|
11
|
+
var els = {
|
|
12
|
+
canvas: document.getElementById('canvas'),
|
|
13
|
+
panel: document.getElementById('panel'),
|
|
14
|
+
panelTitle: document.getElementById('panel-title'),
|
|
15
|
+
panelPath: document.getElementById('panel-path'),
|
|
16
|
+
panelBody: document.getElementById('panel-body'),
|
|
17
|
+
panelClose: document.getElementById('panel-close'),
|
|
18
|
+
zoomIn: document.getElementById('zoom-in'),
|
|
19
|
+
zoomOut: document.getElementById('zoom-out'),
|
|
20
|
+
zoomReset: document.getElementById('zoom-reset'),
|
|
21
|
+
switcher: document.getElementById('switcher'),
|
|
22
|
+
switcherSelect: document.getElementById('switcher-select'),
|
|
23
|
+
legend: document.getElementById('legend'),
|
|
24
|
+
diagnostics: document.getElementById('diagnostics'),
|
|
25
|
+
diagList: document.getElementById('diag-list'),
|
|
26
|
+
ofAttribution: document.getElementById('of-attribution'),
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var state = { data: null, viewer: null, dmn: null, navStack: [], currentFile: null };
|
|
30
|
+
|
|
31
|
+
function diag(msgs) {
|
|
32
|
+
if (!msgs || !msgs.length) return;
|
|
33
|
+
for (var i = 0; i < msgs.length; i++) {
|
|
34
|
+
var li = document.createElement('li');
|
|
35
|
+
li.textContent = msgs[i];
|
|
36
|
+
els.diagList.appendChild(li);
|
|
37
|
+
}
|
|
38
|
+
els.diagnostics.classList.remove('hidden');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function assetLoadFailed() {
|
|
42
|
+
// 7.3b — if a bundle did not load, the package was likely served outside the
|
|
43
|
+
// render root (asset root not on this origin). Diagnose instead of showing a
|
|
44
|
+
// diagram with missing icons.
|
|
45
|
+
if (typeof window.BpmnJS === 'undefined') {
|
|
46
|
+
document.body.innerHTML =
|
|
47
|
+
'<div style="padding:24px;font-family:system-ui">' +
|
|
48
|
+
'<h3>Viewer assets failed to load</h3>' +
|
|
49
|
+
'<p>The vendored bpmn-js bundle was not served under this origin. ' +
|
|
50
|
+
'Serve the assembled <em>render root</em> (which symlinks the shared asset root) ' +
|
|
51
|
+
'rather than the package directory directly.</p></div>';
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function bindingsFor(file) {
|
|
58
|
+
return (state.data.bindings || []).filter(function (b) {
|
|
59
|
+
if (b.kind === 'participant') return false;
|
|
60
|
+
return (b.in || state.data.entry) === file;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
function rolesFor(file) {
|
|
64
|
+
return (state.data.roles || []).filter(function (r) {
|
|
65
|
+
return (r.in || state.data.entry) === file;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function fetchText(path) {
|
|
70
|
+
return fetch(path).then(function (r) {
|
|
71
|
+
if (!r.ok) throw new Error('HTTP ' + r.status + ' for ' + path);
|
|
72
|
+
return r.text();
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function xmlHasDI(xml) { return /<(\w+:)?BPMNDiagram[\s>]/.test(xml) || /<bpmndi:/.test(xml); }
|
|
76
|
+
|
|
77
|
+
// ── main bpmn mount ─────────────────────────────────────────────────────
|
|
78
|
+
function mountProcess(file, push) {
|
|
79
|
+
return fetchText(file).then(function (xml) {
|
|
80
|
+
if (!xmlHasDI(xml)) {
|
|
81
|
+
// 7.14 — a navigated-to file with no DI is a diagnostic, not a blank canvas.
|
|
82
|
+
diag(['Called process "' + file + '" carries no layout (DI) and cannot be rendered here; generate it through the pipeline first.']);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (state.viewer) state.viewer.destroy();
|
|
86
|
+
state.viewer = new window.BpmnJS({ container: els.canvas });
|
|
87
|
+
state.currentFile = file;
|
|
88
|
+
return state.viewer.importXML(xml).then(function () {
|
|
89
|
+
var canvas = state.viewer.get('canvas');
|
|
90
|
+
canvas.zoom('fit-viewport'); // 7.21 fit on load
|
|
91
|
+
// Leave headroom for the top-left toolbar / switcher overlay so the
|
|
92
|
+
// diagram's top row is never hidden beneath (and clickable) them.
|
|
93
|
+
canvas.scroll({ dx: 0, dy: 72 });
|
|
94
|
+
applyRoles(file);
|
|
95
|
+
wireClicks(file);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function wireClicks(file) {
|
|
101
|
+
var binds = bindingsFor(file);
|
|
102
|
+
var byElement = {};
|
|
103
|
+
binds.forEach(function (b) { byElement[b.element] = b; });
|
|
104
|
+
state.viewer.on('element.click', function (e) {
|
|
105
|
+
var id = e.element.id;
|
|
106
|
+
var b = byElement[id];
|
|
107
|
+
if (!b) return; // 7.11 unbound element is inert
|
|
108
|
+
if (b.kind === 'process') return drillDown(b, e.element.name || id);
|
|
109
|
+
openPanel(b, e.element.name || id);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ── side panel (decision / form) ────────────────────────────────────────
|
|
114
|
+
function openPanel(binding, elementName) {
|
|
115
|
+
els.panelTitle.textContent = elementName;
|
|
116
|
+
els.panelPath.textContent = binding.ref;
|
|
117
|
+
els.panelBody.innerHTML = '';
|
|
118
|
+
els.panel.classList.add('open');
|
|
119
|
+
document.body.classList.add('panel-open');
|
|
120
|
+
if (binding.kind === 'decision') return mountDecision(binding.ref);
|
|
121
|
+
if (binding.kind === 'form') return mountForm(binding.ref);
|
|
122
|
+
}
|
|
123
|
+
function closePanel() {
|
|
124
|
+
els.panel.classList.remove('open');
|
|
125
|
+
document.body.classList.remove('panel-open');
|
|
126
|
+
if (state.dmn) { state.dmn.destroy(); state.dmn = null; }
|
|
127
|
+
els.panelBody.innerHTML = '';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function mountDecision(ref) {
|
|
131
|
+
return fetchText(ref).then(function (xml) {
|
|
132
|
+
if (state.dmn) state.dmn.destroy();
|
|
133
|
+
state.dmn = new window.DmnJS({ container: els.panelBody });
|
|
134
|
+
return state.dmn.importXML(xml).then(function (res) {
|
|
135
|
+
// 7.7 — a multi-decision DRD without DI is refused at manifest validation,
|
|
136
|
+
// so anything reaching here is renderable; surface any dmn-js warnings.
|
|
137
|
+
if (res && res.warnings && res.warnings.length) {
|
|
138
|
+
diag(res.warnings.map(function (w) { return 'DMN: ' + (w.message || w); }));
|
|
139
|
+
}
|
|
140
|
+
}).catch(function (err) {
|
|
141
|
+
els.panelBody.innerHTML = '<div class="placeholder">Could not render decision: ' + err.message + '</div>';
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ── form mount behind a SINGLE adapter (7.18) ───────────────────────────
|
|
147
|
+
function mountForm(ref) {
|
|
148
|
+
return fetchText(ref).then(function (text) {
|
|
149
|
+
var schema; try { schema = JSON.parse(text); } catch (e) { schema = null; }
|
|
150
|
+
var mount = document.createElement('div');
|
|
151
|
+
mount.className = 'form-mount';
|
|
152
|
+
els.panelBody.appendChild(mount);
|
|
153
|
+
// The one and only call site for the form renderer. Renegotiating the
|
|
154
|
+
// entry point touches only this block.
|
|
155
|
+
if (window.OpenFormsMui && typeof window.OpenFormsMui.render === 'function' && schema) {
|
|
156
|
+
try {
|
|
157
|
+
window.OpenFormsMui.render(mount, schema, { readOnly: true, locale: 'hu' });
|
|
158
|
+
els.ofAttribution.hidden = false; // 7.22 OpenForms attribution when a form renders
|
|
159
|
+
return;
|
|
160
|
+
} catch (e) { /* fall through to placeholder */ }
|
|
161
|
+
}
|
|
162
|
+
// 7.19 — absent renderer: a legible placeholder, no console error, no break.
|
|
163
|
+
var ph = document.createElement('div');
|
|
164
|
+
ph.className = 'placeholder';
|
|
165
|
+
ph.innerHTML = '<strong>Form: ' + ref + '</strong><br/>The binding is valid. ' +
|
|
166
|
+
'The OpenForms form renderer is not installed, so the form is not displayed.';
|
|
167
|
+
mount.appendChild(ph);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// ── drill-down (kind: process) ──────────────────────────────────────────
|
|
172
|
+
function drillDown(binding, callerName) {
|
|
173
|
+
if (state.navStack.length >= DEPTH_LIMIT) {
|
|
174
|
+
diag(['Navigation depth limit reached (' + DEPTH_LIMIT + '); stopping drill-down.']);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
var visited = state.navStack.map(function (s) { return s.file; }).concat(state.currentFile);
|
|
178
|
+
if (visited.indexOf(binding.ref) !== -1) {
|
|
179
|
+
// 7.13 — recursion notice instead of an unbounded stack.
|
|
180
|
+
diag(['Recursion: "' + binding.ref + '" is already open in this navigation path. Not re-entering.']);
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
state.navStack.push({ file: state.currentFile, callerName: state.currentFile });
|
|
184
|
+
addReturnControl(callerName);
|
|
185
|
+
mountProcess(binding.ref, true);
|
|
186
|
+
}
|
|
187
|
+
function addReturnControl(callerName) {
|
|
188
|
+
var existing = document.getElementById('return-control');
|
|
189
|
+
if (existing) existing.remove();
|
|
190
|
+
var btn = document.createElement('button');
|
|
191
|
+
btn.id = 'return-control';
|
|
192
|
+
btn.textContent = '← Back to ' + callerName;
|
|
193
|
+
btn.onclick = function () {
|
|
194
|
+
var prev = state.navStack.pop();
|
|
195
|
+
if (!prev) return;
|
|
196
|
+
if (!state.navStack.length) btn.remove();
|
|
197
|
+
mountProcess(prev.file, false);
|
|
198
|
+
};
|
|
199
|
+
document.getElementById('return-zone').appendChild(btn);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// ── participant switcher (7.15) ─────────────────────────────────────────
|
|
203
|
+
function buildSwitcher() {
|
|
204
|
+
var participants = (state.data.bindings || []).filter(function (b) { return b.kind === 'participant'; });
|
|
205
|
+
if (!participants.length) return;
|
|
206
|
+
els.switcher.hidden = false;
|
|
207
|
+
var opt = document.createElement('option');
|
|
208
|
+
opt.value = state.data.entry; opt.textContent = state.data.name || state.data.entry;
|
|
209
|
+
els.switcherSelect.appendChild(opt);
|
|
210
|
+
participants.forEach(function (p) {
|
|
211
|
+
var o = document.createElement('option');
|
|
212
|
+
o.value = p.ref; o.textContent = p.name || p.ref;
|
|
213
|
+
els.switcherSelect.appendChild(o);
|
|
214
|
+
});
|
|
215
|
+
els.switcherSelect.onchange = function () {
|
|
216
|
+
state.navStack = [];
|
|
217
|
+
var rc = document.getElementById('return-control'); if (rc) rc.remove();
|
|
218
|
+
mountProcess(els.switcherSelect.value, false);
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// ── roles (7.17) ────────────────────────────────────────────────────────
|
|
223
|
+
var roleIndex = {};
|
|
224
|
+
function applyRoles(file) {
|
|
225
|
+
var roles = rolesFor(file);
|
|
226
|
+
if (!roles.length) { els.legend.hidden = true; return; }
|
|
227
|
+
var canvas = state.viewer.get('canvas');
|
|
228
|
+
var reg = state.viewer.get('elementRegistry');
|
|
229
|
+
var names = [];
|
|
230
|
+
roles.forEach(function (r) {
|
|
231
|
+
if (!(r.role in roleIndex)) { roleIndex[r.role] = Object.keys(roleIndex).length % ROLE_CLASSES.length; names.push(r.role); }
|
|
232
|
+
if (reg.get(r.element)) {
|
|
233
|
+
canvas.addMarker(r.element, 'role-marker');
|
|
234
|
+
canvas.addMarker(r.element, ROLE_CLASSES[roleIndex[r.role]]);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
renderLegend();
|
|
238
|
+
}
|
|
239
|
+
function renderLegend() {
|
|
240
|
+
var keys = Object.keys(roleIndex);
|
|
241
|
+
if (!keys.length) return;
|
|
242
|
+
els.legend.hidden = false;
|
|
243
|
+
els.legend.innerHTML = '<h4>Roles</h4>';
|
|
244
|
+
keys.forEach(function (role) {
|
|
245
|
+
var row = document.createElement('div'); row.className = 'row';
|
|
246
|
+
var sw = document.createElement('span'); sw.className = 'swatch';
|
|
247
|
+
var cls = ROLE_CLASSES[roleIndex[role]];
|
|
248
|
+
var color = { 'role-0': '#1f77b4', 'role-1': '#d62728', 'role-2': '#2ca02c', 'role-3': '#9467bd' }[cls];
|
|
249
|
+
var dash = { 'role-0': 'solid', 'role-1': 'dashed', 'role-2': 'dotted', 'role-3': 'dash-dot' }[cls];
|
|
250
|
+
sw.style.border = '3px ' + (dash === 'solid' ? 'solid' : dash === 'dotted' ? 'dotted' : 'dashed') + ' ' + color;
|
|
251
|
+
row.appendChild(sw);
|
|
252
|
+
row.appendChild(document.createTextNode(role + ' (' + dash + ')'));
|
|
253
|
+
els.legend.appendChild(row);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// ── controls ────────────────────────────────────────────────────────────
|
|
258
|
+
function zoom(delta) { if (!state.viewer) return; var c = state.viewer.get('canvas'); c.zoom(c.zoom() + delta); }
|
|
259
|
+
els.zoomIn.onclick = function () { zoom(0.2); };
|
|
260
|
+
els.zoomOut.onclick = function () { zoom(-0.2); };
|
|
261
|
+
els.zoomReset.onclick = function () { if (state.viewer) state.viewer.get('canvas').zoom('fit-viewport'); };
|
|
262
|
+
els.panelClose.onclick = closePanel;
|
|
263
|
+
els.diagnostics.querySelector('.dismiss').onclick = function () { els.diagnostics.classList.add('hidden'); };
|
|
264
|
+
|
|
265
|
+
// Load the OpenForms renderer only when vendored (avoids a 404 / console error).
|
|
266
|
+
function loadFormRenderer(data) {
|
|
267
|
+
return new Promise(function (resolve) {
|
|
268
|
+
if (!data.formsRenderer) { window.__ofMissing = true; return resolve(); }
|
|
269
|
+
var s = document.createElement('script');
|
|
270
|
+
s.src = 'assets/openforms/openforms-mui.iife.js';
|
|
271
|
+
s.onload = function () { resolve(); };
|
|
272
|
+
s.onerror = function () { window.__ofMissing = true; resolve(); };
|
|
273
|
+
document.head.appendChild(s);
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// ── boot ─────────────────────────────────────────────────────────────────
|
|
278
|
+
if (assetLoadFailed()) return;
|
|
279
|
+
fetchText('package-data.json').then(function (t) {
|
|
280
|
+
state.data = JSON.parse(t);
|
|
281
|
+
return loadFormRenderer(state.data);
|
|
282
|
+
}).then(function () {
|
|
283
|
+
// surface generation/validation diagnostics
|
|
284
|
+
var d = state.data.diagnostics;
|
|
285
|
+
if (d) {
|
|
286
|
+
var msgs = [];
|
|
287
|
+
(d.errors || []).forEach(function (e) { msgs.push('ERROR [' + e.code + '] ' + e.message); });
|
|
288
|
+
(d.warnings || []).forEach(function (w) { msgs.push('[' + w.code + '] ' + w.message); });
|
|
289
|
+
diag(msgs);
|
|
290
|
+
}
|
|
291
|
+
buildSwitcher();
|
|
292
|
+
// 8.4 standalone .dmn: mount the decision viewer on the main canvas.
|
|
293
|
+
if (state.data.entryKind === 'dmn') {
|
|
294
|
+
state.dmn = new window.DmnJS({ container: els.canvas });
|
|
295
|
+
return fetchText(state.data.entry).then(function (xml) { return state.dmn.importXML(xml); });
|
|
296
|
+
}
|
|
297
|
+
return mountProcess(state.data.entry, false);
|
|
298
|
+
}).catch(function (err) {
|
|
299
|
+
diag(['Failed to load package: ' + err.message]);
|
|
300
|
+
});
|
|
301
|
+
})();
|