@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.
Files changed (164) hide show
  1. package/.pi/skills/bpmn-package-explorer/SKILL.md +120 -0
  2. package/.pi/skills/bpmn-package-explorer/assets/LICENSE.bpmn-io.txt +23 -0
  3. package/.pi/skills/bpmn-package-explorer/assets/VENDORED.md +90 -0
  4. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn-codes.css +108 -0
  5. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn-embedded.css +166 -0
  6. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/css/bpmn.css +164 -0
  7. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.eot +0 -0
  8. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.svg +224 -0
  9. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.ttf +0 -0
  10. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.woff +0 -0
  11. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-font/font/bpmn.woff2 +0 -0
  12. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn-navigated-viewer.production.min.js +22 -0
  13. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/bpmn.css +145 -0
  14. package/.pi/skills/bpmn-package-explorer/assets/bpmn-js/diagram-js.css +1249 -0
  15. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/diagram-js.css +1133 -0
  16. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn-codes.css +41 -0
  17. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn-embedded.css +98 -0
  18. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/css/dmn.css +97 -0
  19. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.eot +0 -0
  20. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.svg +90 -0
  21. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.ttf +0 -0
  22. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.woff +0 -0
  23. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-font/font/dmn.woff2 +0 -0
  24. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-decision-table.css +580 -0
  25. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-drd.css +108 -0
  26. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-literal-expression.css +165 -0
  27. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-js-shared.css +221 -0
  28. package/.pi/skills/bpmn-package-explorer/assets/dmn-js/dmn-viewer.production.min.js +16 -0
  29. package/.pi/skills/bpmn-package-explorer/assets/lib/bpmn-pipeline.mjs +6981 -0
  30. package/.pi/skills/bpmn-package-explorer/assets/lib/yaml.mjs +7372 -0
  31. package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g1-identical-bounds.bpmn +17 -0
  32. package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g2-zero-size.bpmn +17 -0
  33. package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g3-child-outside.bpmn +16 -0
  34. package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g4-negative-coord.bpmn +17 -0
  35. package/.pi/skills/bpmn-package-explorer/fixtures/geometry/g5-overlap.bpmn +17 -0
  36. package/.pi/skills/bpmn-package-explorer/fixtures/measured/1-linear.bpmn +12 -0
  37. package/.pi/skills/bpmn-package-explorer/fixtures/measured/2-gateway.bpmn +19 -0
  38. package/.pi/skills/bpmn-package-explorer/fixtures/measured/3-boundary.bpmn +13 -0
  39. package/.pi/skills/bpmn-package-explorer/fixtures/measured/4-subprocess.bpmn +17 -0
  40. package/.pi/skills/bpmn-package-explorer/fixtures/measured/5-pools.bpmn +21 -0
  41. package/.pi/skills/bpmn-package-explorer/fixtures/measured/6-lanes-only.bpmn +16 -0
  42. package/.pi/skills/bpmn-package-explorer/fixtures/measured/7-loop.bpmn +13 -0
  43. package/.pi/skills/bpmn-package-explorer/fixtures/measured/8-long-chain.bpmn +32 -0
  44. package/.pi/skills/bpmn-package-explorer/fixtures/nesting/expanded-subprocess-ok.bpmn +25 -0
  45. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/call-activity.bpmn +10 -0
  46. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/intermediate-catch.bpmn +10 -0
  47. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/intermediate-throw.bpmn +10 -0
  48. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/manual-task.bpmn +10 -0
  49. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/multi-boundary.bpmn +16 -0
  50. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/parallel-gateway.bpmn +10 -0
  51. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/receive-task.bpmn +10 -0
  52. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/rule-task.bpmn +10 -0
  53. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/script-task.bpmn +10 -0
  54. package/.pi/skills/bpmn-package-explorer/fixtures/provisional/send-task.bpmn +10 -0
  55. package/.pi/skills/bpmn-package-explorer/references/authoring-envelope.md +52 -0
  56. package/.pi/skills/bpmn-package-explorer/references/identifiers.md +102 -0
  57. package/.pi/skills/bpmn-package-explorer/references/layout-envelope.md +105 -0
  58. package/.pi/skills/bpmn-package-explorer/references/licensing.md +48 -0
  59. package/.pi/skills/bpmn-package-explorer/references/package-manifest.md +104 -0
  60. package/.pi/skills/bpmn-package-explorer/scripts/build-fixtures.mjs +299 -0
  61. package/.pi/skills/bpmn-package-explorer/scripts/demo.mjs +128 -0
  62. package/.pi/skills/bpmn-package-explorer/scripts/diagnostics.mjs +37 -0
  63. package/.pi/skills/bpmn-package-explorer/scripts/envelope.mjs +160 -0
  64. package/.pi/skills/bpmn-package-explorer/scripts/fixtures.mjs +140 -0
  65. package/.pi/skills/bpmn-package-explorer/scripts/generate-cli.mjs +31 -0
  66. package/.pi/skills/bpmn-package-explorer/scripts/generate.mjs +103 -0
  67. package/.pi/skills/bpmn-package-explorer/scripts/guard.mjs +335 -0
  68. package/.pi/skills/bpmn-package-explorer/scripts/harness.mjs +12 -0
  69. package/.pi/skills/bpmn-package-explorer/scripts/identifiers.mjs +117 -0
  70. package/.pi/skills/bpmn-package-explorer/scripts/ingest.mjs +95 -0
  71. package/.pi/skills/bpmn-package-explorer/scripts/manifest.mjs +374 -0
  72. package/.pi/skills/bpmn-package-explorer/scripts/pipeline.mjs +49 -0
  73. package/.pi/skills/bpmn-package-explorer/scripts/render.mjs +130 -0
  74. package/.pi/skills/bpmn-package-explorer/scripts/runguard.mjs +38 -0
  75. package/.pi/skills/bpmn-package-explorer/scripts/selftest-e2e.mjs +87 -0
  76. package/.pi/skills/bpmn-package-explorer/scripts/selftest-guard.mjs +99 -0
  77. package/.pi/skills/bpmn-package-explorer/scripts/selftest-manifest.mjs +170 -0
  78. package/.pi/skills/bpmn-package-explorer/scripts/selftest-more.mjs +87 -0
  79. package/.pi/skills/bpmn-package-explorer/scripts/selftest-workflow.mjs +73 -0
  80. package/.pi/skills/bpmn-package-explorer/scripts/selftest.mjs +57 -0
  81. package/.pi/skills/bpmn-package-explorer/scripts/vendor.mjs +141 -0
  82. package/.pi/skills/bpmn-package-explorer/scripts/view-cli.mjs +19 -0
  83. package/.pi/skills/bpmn-package-explorer/templates/shell.html +141 -0
  84. package/.pi/skills/bpmn-package-explorer/templates/viewer.js +301 -0
  85. package/.pi/skills/canvas-webapp/SKILL.md +104 -0
  86. package/.pi/skills/openforms-mui/SKILL.md +187 -0
  87. package/.pi/skills/openforms-mui/references/a11y.md +68 -0
  88. package/.pi/skills/openforms-mui/references/field-widget-map.md +64 -0
  89. package/.pi/skills/openforms-mui/references/hu-locale.md +45 -0
  90. package/.pi/skills/openforms-mui/references/logic.md +94 -0
  91. package/.pi/skills/openforms-mui/references/schema.md +94 -0
  92. package/.pi/skills/openforms-mui/references/theme-bridge.md +65 -0
  93. package/.pi/skills/openforms-mui/tools/canvas-serve.mjs +51 -0
  94. package/.pi/skills/openforms-mui/tools/demo-schema.json +80 -0
  95. package/.pi/skills/openforms-mui/tools/mockups/tokens.css +27 -0
  96. package/.pi/skills/openforms-mui/tools/mockups/ui-contract.tokens.json +16 -0
  97. package/.pi/skills/openforms-mui/tools/package-lock.json +5919 -0
  98. package/.pi/skills/openforms-mui/tools/package.json +61 -0
  99. package/.pi/skills/openforms-mui/tools/preview/RenderPanel.tsx +105 -0
  100. package/.pi/skills/openforms-mui/tools/preview/canvas-app.tsx +66 -0
  101. package/.pi/skills/openforms-mui/tools/preview/canvas-index.html +16 -0
  102. package/.pi/skills/openforms-mui/tools/preview/cli.ts +99 -0
  103. package/.pi/skills/openforms-mui/tools/preview/index.html +17 -0
  104. package/.pi/skills/openforms-mui/tools/preview/main.tsx +228 -0
  105. package/.pi/skills/openforms-mui/tools/preview/vite-plugin.ts +41 -0
  106. package/.pi/skills/openforms-mui/tools/scripts/assert-peer-deps.mjs +39 -0
  107. package/.pi/skills/openforms-mui/tools/src/OpenFormsMui.tsx +391 -0
  108. package/.pi/skills/openforms-mui/tools/src/css.d.ts +2 -0
  109. package/.pi/skills/openforms-mui/tools/src/fields/ErrorSummary.tsx +72 -0
  110. package/.pi/skills/openforms-mui/tools/src/fields/FieldRenderer.tsx +328 -0
  111. package/.pi/skills/openforms-mui/tools/src/fields/FieldShell.tsx +50 -0
  112. package/.pi/skills/openforms-mui/tools/src/fields/FileField.tsx +91 -0
  113. package/.pi/skills/openforms-mui/tools/src/fields/MatrixField.tsx +146 -0
  114. package/.pi/skills/openforms-mui/tools/src/fields/RepeaterField.tsx +82 -0
  115. package/.pi/skills/openforms-mui/tools/src/fields/SignatureCanvas.tsx +121 -0
  116. package/.pi/skills/openforms-mui/tools/src/fields/context.tsx +34 -0
  117. package/.pi/skills/openforms-mui/tools/src/fields/index.ts +7 -0
  118. package/.pi/skills/openforms-mui/tools/src/fields/label.ts +42 -0
  119. package/.pi/skills/openforms-mui/tools/src/fonts.ts +8 -0
  120. package/.pi/skills/openforms-mui/tools/src/i18n/dictionary.ts +58 -0
  121. package/.pi/skills/openforms-mui/tools/src/i18n/hu.ts +56 -0
  122. package/.pi/skills/openforms-mui/tools/src/i18n/index.ts +43 -0
  123. package/.pi/skills/openforms-mui/tools/src/index.ts +27 -0
  124. package/.pi/skills/openforms-mui/tools/src/logic/cnf.ts +206 -0
  125. package/.pi/skills/openforms-mui/tools/src/logic/formula.ts +285 -0
  126. package/.pi/skills/openforms-mui/tools/src/logic/index.ts +4 -0
  127. package/.pi/skills/openforms-mui/tools/src/logic/operators.ts +43 -0
  128. package/.pi/skills/openforms-mui/tools/src/logic/state.ts +183 -0
  129. package/.pi/skills/openforms-mui/tools/src/payload.ts +83 -0
  130. package/.pi/skills/openforms-mui/tools/src/provenance.ts +21 -0
  131. package/.pi/skills/openforms-mui/tools/src/schema/diagnose.ts +256 -0
  132. package/.pi/skills/openforms-mui/tools/src/schema/index.ts +4 -0
  133. package/.pi/skills/openforms-mui/tools/src/schema/normalize.ts +163 -0
  134. package/.pi/skills/openforms-mui/tools/src/schema/types.ts +299 -0
  135. package/.pi/skills/openforms-mui/tools/src/schema/walk.ts +68 -0
  136. package/.pi/skills/openforms-mui/tools/src/theme/from-tokens.ts +102 -0
  137. package/.pi/skills/openforms-mui/tools/src/theme/index.ts +1 -0
  138. package/.pi/skills/openforms-mui/tools/src/validation/constrain.ts +83 -0
  139. package/.pi/skills/openforms-mui/tools/src/validation/diagnostics.ts +62 -0
  140. package/.pi/skills/openforms-mui/tools/src/validation/empty.ts +53 -0
  141. package/.pi/skills/openforms-mui/tools/src/validation/index.ts +5 -0
  142. package/.pi/skills/openforms-mui/tools/src/validation/resolver.ts +14 -0
  143. package/.pi/skills/openforms-mui/tools/src/validation/zod-from-schema.ts +169 -0
  144. package/.pi/skills/openforms-mui/tools/tests/a11y.test.tsx +82 -0
  145. package/.pi/skills/openforms-mui/tools/tests/cli.test.ts +74 -0
  146. package/.pi/skills/openforms-mui/tools/tests/component.test.tsx +295 -0
  147. package/.pi/skills/openforms-mui/tools/tests/diagnose.test.ts +163 -0
  148. package/.pi/skills/openforms-mui/tools/tests/fixtures/all-field-types.json +45 -0
  149. package/.pi/skills/openforms-mui/tools/tests/logic.test.ts +175 -0
  150. package/.pi/skills/openforms-mui/tools/tests/normalize.test.ts +105 -0
  151. package/.pi/skills/openforms-mui/tools/tests/reference-semantics.test.ts +131 -0
  152. package/.pi/skills/openforms-mui/tools/tests/responsive.test.tsx +158 -0
  153. package/.pi/skills/openforms-mui/tools/tests/setup.ts +16 -0
  154. package/.pi/skills/openforms-mui/tools/tests/singleton.test.tsx +31 -0
  155. package/.pi/skills/openforms-mui/tools/tests/theme.test.ts +65 -0
  156. package/.pi/skills/openforms-mui/tools/tests/toolchain.test.ts +33 -0
  157. package/.pi/skills/openforms-mui/tools/tests/validation.test.ts +222 -0
  158. package/.pi/skills/openforms-mui/tools/tsconfig.json +21 -0
  159. package/.pi/skills/openforms-mui/tools/vite.canvas.config.ts +21 -0
  160. package/.pi/skills/openforms-mui/tools/vitest.config.ts +17 -0
  161. package/NOTICE +46 -0
  162. package/README.md +62 -0
  163. package/package.json +46 -0
  164. package/scripts/ensure-openforms-deps.mjs +38 -0
@@ -0,0 +1,65 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { readdirSync, readFileSync, existsSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+ import { themeFromTokens, defaultTheme } from "../src/theme/from-tokens";
6
+
7
+ const here = dirname(fileURLToPath(import.meta.url));
8
+ const srcDir = join(here, "..", "src");
9
+
10
+ describe("theme bridge (tasks 5.1, 5.2)", () => {
11
+ it("produces a MUI theme from DTCG tokens", () => {
12
+ const theme = themeFromTokens({
13
+ color: {
14
+ primary: { $value: "#0a7d33" },
15
+ secondary: { $value: "#333333" },
16
+ },
17
+ radius: { base: { $value: 12 } },
18
+ });
19
+ expect(theme.palette.primary.main).toBe("#0a7d33");
20
+ expect(theme.shape.borderRadius).toBe(12);
21
+ });
22
+
23
+ it("falls back to a documented default when no tokens are present", () => {
24
+ const theme = themeFromTokens(null);
25
+ expect(theme.palette.primary.main).toBe(defaultTheme().palette.primary.main);
26
+ });
27
+ });
28
+
29
+ describe("token-lint: no literal colour in component sources (task 5.3)", () => {
30
+ // Colour literals belong only in the token/theme layer. Component widgets must
31
+ // read from the theme. Scan field components + the root component.
32
+ const COMPONENT_DIRS = [join(srcDir, "fields")];
33
+ const COMPONENT_FILES = [join(srcDir, "OpenFormsMui.tsx")];
34
+
35
+ function collectSources(): string[] {
36
+ const files: string[] = [];
37
+ for (const dir of COMPONENT_DIRS) {
38
+ if (!existsSync(dir)) continue;
39
+ for (const f of readdirSync(dir)) {
40
+ if (f.endsWith(".tsx") || f.endsWith(".ts")) files.push(join(dir, f));
41
+ }
42
+ }
43
+ for (const f of COMPONENT_FILES) if (existsSync(f)) files.push(f);
44
+ return files;
45
+ }
46
+
47
+ const HEX = /#[0-9a-fA-F]{3,8}\b/;
48
+ const RGB = /\brgba?\(/;
49
+ const HSL = /\bhsla?\(/;
50
+
51
+ it("contains no hex / rgb / hsl colour literals", () => {
52
+ const offenders: string[] = [];
53
+ for (const file of collectSources()) {
54
+ const code = readFileSync(file, "utf8")
55
+ .replace(/\/\*[\s\S]*?\*\//g, "")
56
+ .replace(/\/\/.*$/gm, "");
57
+ code.split("\n").forEach((line, i) => {
58
+ if (HEX.test(line) || RGB.test(line) || HSL.test(line)) {
59
+ offenders.push(`${file}:${i + 1}: ${line.trim()}`);
60
+ }
61
+ });
62
+ }
63
+ expect(offenders, offenders.join("\n")).toEqual([]);
64
+ });
65
+ });
@@ -0,0 +1,33 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { readFileSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+ import { UPSTREAM_PROVENANCE } from "../src/provenance";
6
+
7
+ const here = dirname(fileURLToPath(import.meta.url));
8
+ const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8"));
9
+
10
+ const SINGLETONS = [
11
+ "react",
12
+ "react-dom",
13
+ "@mui/material",
14
+ "@mui/x-date-pickers",
15
+ "@emotion/react",
16
+ "@emotion/styled",
17
+ ];
18
+
19
+ describe("toolchain (task 1.3, 1.7, 1.8)", () => {
20
+ it("declares each singleton as peer + dev and never as a plain dependency", () => {
21
+ for (const name of SINGLETONS) {
22
+ expect(pkg.peerDependencies?.[name], `${name} peer`).toBeTruthy();
23
+ expect(pkg.devDependencies?.[name], `${name} dev`).toBeTruthy();
24
+ expect(pkg.dependencies?.[name], `${name} must not be a plain dependency`).toBeUndefined();
25
+ }
26
+ });
27
+
28
+ it("pins the upstream provenance in a single constant", () => {
29
+ expect(UPSTREAM_PROVENANCE.repository).toBe("henriquefps/open-forms");
30
+ expect(UPSTREAM_PROVENANCE.version).toBe("1.0.7");
31
+ expect(UPSTREAM_PROVENANCE.license).toBe("Apache-2.0");
32
+ });
33
+ });
@@ -0,0 +1,222 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import type { Field, FormSchemaJSON } from "../src/schema/types";
3
+ import { normalizeSchema } from "../src/schema/normalize";
4
+ import { resolveFormState } from "../src/logic/state";
5
+ import {
6
+ deriveZodSchema,
7
+ createMemoizedDeriver,
8
+ FORM_LEVEL_PATH,
9
+ } from "../src/validation/zod-from-schema";
10
+ import { collectFieldDiagnostics } from "../src/validation/diagnostics";
11
+
12
+ function form(fields: Field[], extra?: Partial<FormSchemaJSON>): FormSchemaJSON {
13
+ return normalizeSchema({
14
+ pages: [{ sections: [{ rows: [{ columns: [{ fields }] }] }] }],
15
+ ...extra,
16
+ }).schema;
17
+ }
18
+
19
+ describe("Zod derivation (tasks 4.0, 4.1)", () => {
20
+ it("maps field types to validators and accepts declared empty values", () => {
21
+ const s = form([
22
+ { type: "text", key: "t" },
23
+ { type: "number", key: "n" },
24
+ { type: "date", key: "d" },
25
+ { type: "boolean", key: "b" },
26
+ { type: "checkbox", key: "c", options: [] },
27
+ ]);
28
+ const zod = deriveZodSchema(s, resolveFormState(s, {}));
29
+ const ok = zod.safeParse({ t: "", n: null, d: "", b: false, c: [] });
30
+ expect(ok.success).toBe(true);
31
+ // number rejects a wrong shape
32
+ const bad = zod.safeParse({ t: "", n: "notnum", d: "", b: false, c: [] });
33
+ expect(bad.success).toBe(false);
34
+ });
35
+
36
+ it("excludes header and paragraph fields", () => {
37
+ const s = form([{ type: "header", key: "h" }, { type: "paragraph", key: "p" }, { type: "text", key: "t" }]);
38
+ const zod = deriveZodSchema(s, resolveFormState(s, {}));
39
+ // Parsing an object without h/p keys succeeds (no required key for them).
40
+ expect(zod.safeParse({ t: "" }).success).toBe(true);
41
+ });
42
+ });
43
+
44
+ describe("visibility-aware validation (tasks 4.2, 4.8)", () => {
45
+ const schema = form([
46
+ { type: "text", key: "toggle" },
47
+ {
48
+ type: "text",
49
+ key: "secret",
50
+ required: true,
51
+ validationRegex: "^[0-9]+$",
52
+ errorMessage: "digits only",
53
+ conditionalRules: [
54
+ { targetProperty: "visibility", andGroups: [{ conditions: [{ dependentFieldKey: "toggle", operator: "equals", equalsValue: "show" }] }] },
55
+ ],
56
+ },
57
+ ]);
58
+
59
+ it("a hidden field holding an invalid value does not block submission", () => {
60
+ const state = resolveFormState(schema, { toggle: "hide", secret: "not-digits" });
61
+ const zod = deriveZodSchema(schema, state);
62
+ expect(zod.safeParse({ toggle: "hide", secret: "not-digits" }).success).toBe(true);
63
+ });
64
+
65
+ it("the field becomes required and constrained when revealed", () => {
66
+ const state = resolveFormState(schema, { toggle: "show", secret: "" });
67
+ const zod = deriveZodSchema(schema, state);
68
+ expect(zod.safeParse({ toggle: "show", secret: "" }).success).toBe(false);
69
+ expect(zod.safeParse({ toggle: "show", secret: "abc" }).success).toBe(false);
70
+ expect(zod.safeParse({ toggle: "show", secret: "123" }).success).toBe(true);
71
+ });
72
+ });
73
+
74
+ describe("memoization on derived state (tasks 4.5, 4.7)", () => {
75
+ const schema = form([
76
+ { type: "text", key: "toggle" },
77
+ {
78
+ type: "text",
79
+ key: "dep",
80
+ conditionalRules: [
81
+ { targetProperty: "visibility", andGroups: [{ conditions: [{ dependentFieldKey: "toggle", operator: "equals", equalsValue: "x" }] }] },
82
+ ],
83
+ },
84
+ ]);
85
+
86
+ it("typing into a visible field does not rebuild the schema", () => {
87
+ const deriver = createMemoizedDeriver(schema);
88
+ const rebuildCount = () => (deriver as unknown as { rebuildCount(): number }).rebuildCount();
89
+ deriver(resolveFormState(schema, { toggle: "a" }));
90
+ expect(rebuildCount()).toBe(1);
91
+ deriver(resolveFormState(schema, { toggle: "ab" })); // still hidden, same state
92
+ expect(rebuildCount()).toBe(1);
93
+ });
94
+
95
+ it("a visibility transition rebuilds the schema", () => {
96
+ const deriver = createMemoizedDeriver(schema);
97
+ const rebuildCount = () => (deriver as unknown as { rebuildCount(): number }).rebuildCount();
98
+ deriver(resolveFormState(schema, { toggle: "a" }));
99
+ deriver(resolveFormState(schema, { toggle: "x" })); // dep now visible
100
+ expect(rebuildCount()).toBe(2);
101
+ });
102
+ });
103
+
104
+ describe("cross-field rules (task 4.4)", () => {
105
+ const schema = form(
106
+ [
107
+ { type: "date", key: "startDate" },
108
+ { type: "date", key: "endDate" },
109
+ ],
110
+ {
111
+ crossFieldRules: [
112
+ {
113
+ andGroups: [{ conditions: [{ dependentFieldKey: "startDate", operator: "greaterThan", compareMode: "field", compareToFieldKey: "endDate" }] }],
114
+ targetFields: ["startDate", "endDate"],
115
+ errorMessage: "Start must not be after end.",
116
+ },
117
+ ],
118
+ },
119
+ );
120
+
121
+ it("a violated rule blocks and marks every visible target", () => {
122
+ const state = resolveFormState(schema, { startDate: "2026-07-02", endDate: "2026-07-01" });
123
+ const zod = deriveZodSchema(schema, state);
124
+ const res = zod.safeParse({ startDate: "2026-07-02", endDate: "2026-07-01" });
125
+ expect(res.success).toBe(false);
126
+ if (!res.success) {
127
+ const paths = res.error.issues.map((i) => i.path.join("."));
128
+ expect(paths).toContain("startDate");
129
+ expect(paths).toContain("endDate");
130
+ }
131
+ });
132
+
133
+ it("an unviolated rule permits submission", () => {
134
+ const state = resolveFormState(schema, { startDate: "2026-07-01", endDate: "2026-07-02" });
135
+ const zod = deriveZodSchema(schema, state);
136
+ expect(zod.safeParse({ startDate: "2026-07-01", endDate: "2026-07-02" }).success).toBe(true);
137
+ });
138
+
139
+ it("a rule with all-hidden targets still blocks via the form-level path", () => {
140
+ const hiddenSchema = form(
141
+ [
142
+ { type: "text", key: "toggle" },
143
+ {
144
+ type: "date",
145
+ key: "startDate",
146
+ conditionalRules: [{ targetProperty: "visibility", andGroups: [{ conditions: [{ dependentFieldKey: "toggle", operator: "equals", equalsValue: "show" }] }] }],
147
+ },
148
+ {
149
+ type: "date",
150
+ key: "endDate",
151
+ conditionalRules: [{ targetProperty: "visibility", andGroups: [{ conditions: [{ dependentFieldKey: "toggle", operator: "equals", equalsValue: "show" }] }] }],
152
+ },
153
+ ],
154
+ {
155
+ crossFieldRules: [
156
+ {
157
+ andGroups: [{ conditions: [{ dependentFieldKey: "startDate", operator: "greaterThan", compareMode: "field", compareToFieldKey: "endDate" }] }],
158
+ targetFields: ["startDate", "endDate"],
159
+ errorMessage: "Start must not be after end.",
160
+ },
161
+ ],
162
+ },
163
+ );
164
+ const answers = { toggle: "hide", startDate: "2026-07-02", endDate: "2026-07-01" };
165
+ const state = resolveFormState(hiddenSchema, answers);
166
+ const zod = deriveZodSchema(hiddenSchema, state);
167
+ const res = zod.safeParse(answers);
168
+ expect(res.success).toBe(false);
169
+ if (!res.success) {
170
+ expect(res.error.issues.some((i) => i.path[0] === FORM_LEVEL_PATH)).toBe(true);
171
+ }
172
+ });
173
+ });
174
+
175
+ describe("disabled/calculated diagnostics reach the host (validation spec)", () => {
176
+ it("a disabled field with a violating value is reported, not blocked", () => {
177
+ const schema = form([
178
+ { type: "text", key: "code", disabled: true, validationRegex: "^[0-9]+$", errorMessage: "digits" },
179
+ ]);
180
+ const answers = { code: "abc" };
181
+ const state = resolveFormState(schema, answers);
182
+ // Not blocked:
183
+ expect(deriveZodSchema(schema, state).safeParse(answers).success).toBe(true);
184
+ // But reported:
185
+ const diags = collectFieldDiagnostics(schema, state, answers);
186
+ expect(diags.some((d) => d.code === "disabled-constraint-violation")).toBe(true);
187
+ });
188
+
189
+ it("a non-rendered calculated value out of range is reported, not blocked", () => {
190
+ const schema = form([
191
+ { type: "number", key: "a" },
192
+ { type: "number", key: "big", isCalculated: true, isVisibleOnForm: false, formulaExpression: "{a} * 1000", max: 10 },
193
+ ]);
194
+ const answers = { a: 5 };
195
+ const state = resolveFormState(schema, answers);
196
+ const diags = collectFieldDiagnostics(schema, state, state.effectiveAnswers);
197
+ expect(diags.some((d) => d.code === "calculated-constraint-violation")).toBe(true);
198
+ });
199
+ });
200
+
201
+ describe("repeater bounds (task 4.3)", () => {
202
+ const schema = form([
203
+ {
204
+ type: "repeater",
205
+ key: "people",
206
+ minItems: 1,
207
+ rows: [{ columns: [{ fields: [{ type: "text", key: "name", required: true }] }] }],
208
+ },
209
+ ]);
210
+ it("fails when below minItems", () => {
211
+ const state = resolveFormState(schema, { people: [] });
212
+ expect(deriveZodSchema(schema, state).safeParse({ people: [] }).success).toBe(false);
213
+ });
214
+ it("addresses a nested child error at its array path", () => {
215
+ const state = resolveFormState(schema, { people: [{ name: "" }] });
216
+ const res = deriveZodSchema(schema, state).safeParse({ people: [{ name: "" }] });
217
+ expect(res.success).toBe(false);
218
+ if (!res.success) {
219
+ expect(res.error.issues.some((i) => i.path.join(".") === "people.0.name")).toBe(true);
220
+ }
221
+ });
222
+ });
@@ -0,0 +1,21 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "lib": ["ES2022", "DOM", "DOM.Iterable"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "jsx": "react-jsx",
8
+ "strict": true,
9
+ "noUnusedLocals": true,
10
+ "noUnusedParameters": true,
11
+ "noFallthroughCasesInSwitch": true,
12
+ "exactOptionalPropertyTypes": false,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "esModuleInterop": true,
15
+ "skipLibCheck": true,
16
+ "resolveJsonModule": true,
17
+ "isolatedModules": true,
18
+ "types": ["node", "vitest/globals", "@testing-library/jest-dom"]
19
+ },
20
+ "include": ["src", "preview", "tests", "scripts"]
21
+ }
@@ -0,0 +1,21 @@
1
+ import { defineConfig } from "vite";
2
+ import react from "@vitejs/plugin-react";
3
+ import { resolve } from "node:path";
4
+
5
+ // Static build with RELATIVE base so the bundle works under the dashboard
6
+ // live-server proxy subpath (/live/<id>/) inside a sandboxed iframe.
7
+ export default defineConfig({
8
+ base: "./",
9
+ root: resolve(import.meta.dirname, "preview"),
10
+ plugins: [react()],
11
+ resolve: {
12
+ dedupe: ["react", "react-dom", "@mui/material", "@emotion/react", "@emotion/styled"],
13
+ },
14
+ build: {
15
+ outDir: resolve(import.meta.dirname, "canvas-dist"),
16
+ emptyOutDir: true,
17
+ rollupOptions: {
18
+ input: resolve(import.meta.dirname, "preview/canvas-index.html"),
19
+ },
20
+ },
21
+ });
@@ -0,0 +1,17 @@
1
+ import { defineConfig } from "vitest/config";
2
+ import react from "@vitejs/plugin-react";
3
+
4
+ export default defineConfig({
5
+ plugins: [react()],
6
+ test: {
7
+ globals: true,
8
+ environment: "jsdom",
9
+ setupFiles: ["./tests/setup.ts"],
10
+ include: ["tests/**/*.test.{ts,tsx}"],
11
+ // Deduplicate React so component tests never load two instances (mirrors D14).
12
+ server: { deps: { inline: [/@mui/, /@emotion/] } },
13
+ },
14
+ resolve: {
15
+ dedupe: ["react", "react-dom", "@mui/material", "@emotion/react", "@emotion/styled"],
16
+ },
17
+ });
package/NOTICE ADDED
@@ -0,0 +1,46 @@
1
+ @blackbelt-technology/pi-dashboard-forms-bpmn
2
+ Copyright (c) BlackBelt Technology
3
+
4
+ This package bundles three pi skills. Third-party attributions follow.
5
+
6
+ ================================================================================
7
+ openforms-mui
8
+ ================================================================================
9
+ A clean-room re-implementation of the OpenForms FormSchemaJSON contract as an
10
+ MUI runtime. NO upstream renderer or builder source is vendored — the TypeScript
11
+ types and diagnostics were derived from the published schema reference and
12
+ observed semantics.
13
+
14
+ Upstream schema contract: OpenForms (github.com/henriquefps/open-forms)
15
+ Upstream license: Apache License 2.0
16
+ Pinned reference version: 1.0.7
17
+
18
+ Runtime dependencies (installed on demand under
19
+ .pi/skills/openforms-mui/tools/node_modules) carry their own licenses:
20
+ React, @mui/material, @mui/x-date-pickers, @emotion/*, react-hook-form, zod,
21
+ dayjs, @fontsource/roboto. See each package for terms.
22
+
23
+ ================================================================================
24
+ bpmn-package-explorer
25
+ ================================================================================
26
+ Vendors the pre-built bpmn.io viewers and a Node layout bundle for buildless,
27
+ offline operation.
28
+
29
+ bpmn-js, dmn-js — bpmn.io License (MIT + watermark obligation)
30
+ Full text: .pi/skills/bpmn-package-explorer/assets/LICENSE.bpmn-io.txt
31
+ bpmn-auto-layout — see vendored bundle provenance in
32
+ .pi/skills/bpmn-package-explorer/assets/VENDORED.md
33
+
34
+ WATERMARK OBLIGATION (bpmn.io License): the source displaying the bpmn.io
35
+ watermark linking to https://bpmn.io MUST NOT be removed, changed, or visually
36
+ overlapped. The vendored viewers keep it fully visible in every rendered
37
+ diagram. Do not disable it.
38
+
39
+ Optional OpenForms form rendering inside a BPMN user task follows the OpenForms
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 ADDED
@@ -0,0 +1,62 @@
1
+ # @blackbelt-technology/pi-dashboard-forms-bpmn
2
+
3
+ Two complementary **pi skills** for turning structured definitions into
4
+ interactive, canvas-viewable UI — bundled for distribution cohesion, kept as
5
+ **separate, single-responsibility skills** (not merged).
6
+
7
+ | Skill | What it does |
8
+ |-------|--------------|
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
+ | **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
+
13
+ ## Why bundled, not merged
14
+
15
+ The two capabilities live in different domains (forms vs. process models) and
16
+ have **opposite build philosophies** — openforms needs a bundler + React/MUI;
17
+ bpmn deliberately avoids all installs to stay offline. Merging would force the
18
+ buildless skill to pull React/MUI and lose its offline guarantee. The **package**
19
+ is the unit of cohesion; the skills stay focused. Their only real overlap —
20
+ rendering on the dashboard canvas — is factored into `canvas-webapp`.
21
+
22
+ ## Install
23
+
24
+ ```bash
25
+ # from the monorepo checkout (global, available in every pi session):
26
+ pi install /Users/<you>/…/pi-agent-dashboard/packages/pi-forms-bpmn
27
+ # or project-scoped:
28
+ pi install -l ./packages/pi-forms-bpmn
29
+ # try ephemerally, no persistence:
30
+ pi -e ./packages/pi-forms-bpmn
31
+
32
+ pi config # enable/disable individual skills
33
+ ```
34
+
35
+ On install a **guarded postinstall** (`scripts/ensure-openforms-deps.mjs`)
36
+ installs the openforms `tools/` dependencies **only if missing** — a cheap no-op
37
+ otherwise. The bpmn skill needs nothing installed.
38
+
39
+ > **Note — `canvas-webapp` name overlap.** The dashboard's own `extension`
40
+ > package also bundles a `canvas-webapp` skill. If both packages are enabled on
41
+ > one machine you get two same-named skills (identical content; one shadows the
42
+ > other). Disable one via `pi config` if desired.
43
+
44
+ ## Requirements
45
+
46
+ - Node **≥ 20.12** (bpmn layout bundle floor).
47
+ - A browser for the canvas viewers.
48
+
49
+ ## Rendering on the pi-dashboard canvas
50
+
51
+ Both skills serve web content the dashboard shows in a `sandbox="allow-scripts"`
52
+ (opaque-origin, no `allow-same-origin`) iframe proxied under `/live/<id>/`. See
53
+ `canvas-webapp` for the full recipe: static build with `base:'./'` + a static
54
+ server that sets `Access-Control-Allow-Origin: *` (module fetch in an
55
+ opaque-origin iframe is CORS with `Origin: null`).
56
+
57
+ ## Attribution
58
+
59
+ See `NOTICE`. openforms-mui is a clean-room re-implementation from the OpenForms
60
+ schema reference (Apache 2.0); bpmn-package-explorer vendors bpmn.io viewers
61
+ under the **bpmn.io License** (MIT + a watermark obligation that is retained —
62
+ the bpmn.io watermark must stay visible in every rendered diagram).
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@blackbelt-technology/pi-dashboard-forms-bpmn",
3
+ "version": "0.7.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). Ships canvas-webapp for rendering either on the pi-dashboard canvas (sandboxed opaque-origin iframe + CORS static-serve recipe).",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/BlackBeltTechnology/pi-agent-dashboard",
9
+ "directory": "packages/pi-forms-bpmn"
10
+ },
11
+ "license": "MIT",
12
+ "engines": {
13
+ "node": ">=20.12"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "keywords": [
19
+ "pi-package",
20
+ "pi-skill",
21
+ "pi-dashboard",
22
+ "openforms",
23
+ "form-builder",
24
+ "mui",
25
+ "bpmn",
26
+ "dmn",
27
+ "process-modeling",
28
+ "canvas"
29
+ ],
30
+ "pi": {
31
+ "skills": [
32
+ ".pi/skills/openforms-mui",
33
+ ".pi/skills/bpmn-package-explorer",
34
+ ".pi/skills/canvas-webapp"
35
+ ]
36
+ },
37
+ "scripts": {
38
+ "postinstall": "node scripts/ensure-openforms-deps.mjs"
39
+ },
40
+ "files": [
41
+ ".pi/skills/",
42
+ "scripts/",
43
+ "README.md",
44
+ "NOTICE"
45
+ ]
46
+ }
@@ -0,0 +1,38 @@
1
+ // Guarded postinstall: the openforms-mui skill ships a self-contained Vite
2
+ // library under .pi/skills/openforms-mui/tools with its OWN package.json. That
3
+ // nested dir is NOT an npm-workspace member, so a monorepo-root `npm install`
4
+ // never installs its deps. Install them here — but ONLY when missing, so this
5
+ // is a cheap no-op on every subsequent install (no churn in the dashboard
6
+ // monorepo dev loop). The bpmn skill is buildless/offline and needs nothing.
7
+ import { existsSync } from "node:fs";
8
+ import { execFileSync } from "node:child_process";
9
+ import { dirname, join } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ const here = dirname(fileURLToPath(import.meta.url));
13
+ const toolsDir = join(here, "..", ".pi", "skills", "openforms-mui", "tools");
14
+ const marker = join(toolsDir, "node_modules", ".package-lock.json");
15
+
16
+ if (!existsSync(join(toolsDir, "package.json"))) {
17
+ console.log("[pi-forms-bpmn] openforms tools/ not found — skipping.");
18
+ process.exit(0);
19
+ }
20
+ if (existsSync(marker)) {
21
+ // Already installed — nothing to do.
22
+ process.exit(0);
23
+ }
24
+
25
+ console.log("[pi-forms-bpmn] installing openforms-mui/tools dependencies (one-time)…");
26
+ try {
27
+ execFileSync("npm", ["install", "--no-audit", "--no-fund", "--prefix", toolsDir], {
28
+ stdio: "inherit",
29
+ });
30
+ } catch (e) {
31
+ console.warn(
32
+ "[pi-forms-bpmn] openforms tools install failed; run it manually with:\n" +
33
+ ` npm --prefix "${toolsDir}" install\n` +
34
+ String(e?.message ?? e),
35
+ );
36
+ // Do not fail the whole install — the bpmn skill still works offline.
37
+ process.exit(0);
38
+ }