@bpmn-io/form-js-editor 1.20.0 → 1.21.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.
@@ -173,6 +173,7 @@ export class FormEditor {
173
173
  } | {
174
174
  __init__: string[];
175
175
  renderInjector: (string | typeof import("./features/render-injection/RenderInjector").RenderInjector)[];
176
+ slotFillManager: (string | typeof import("./features/render-injection/SlotFillManager").SlotFillManager)[];
176
177
  } | {
177
178
  __init__: string[];
178
179
  repeatRenderManager: (string | typeof import("./features/repeat-render").EditorRepeatRenderManager)[];
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Framework-agnostic service for managing slot fills.
3
+ *
4
+ * Fills are registered as render callbacks: `(container: HTMLElement) => (() => void) | void`.
5
+ * The optional return value is a cleanup function called when the fill is removed or the slot unmounts.
6
+ *
7
+ * @example
8
+ *
9
+ * // Via config (simplest):
10
+ * new FormEditor({
11
+ * slots: {
12
+ * 'editor-empty-state__footer': (container) => {
13
+ * container.textContent = 'Hello from vanilla JS';
14
+ * }
15
+ * }
16
+ * });
17
+ *
18
+ * // Via config (multiple fills per slot):
19
+ * new FormEditor({
20
+ * slots: {
21
+ * 'editor-empty-state__footer': [
22
+ * (container) => { container.textContent = 'First'; },
23
+ * { render: (container) => { container.textContent = 'Second'; }, priority: 10 }
24
+ * ]
25
+ * }
26
+ * });
27
+ *
28
+ * // Via service (runtime):
29
+ * const slotFillManager = editor.get('slotFillManager');
30
+ * slotFillManager.addFill('editor-empty-state__footer', 'my-fill', {
31
+ * render: (container) => { ... },
32
+ * priority: 10,
33
+ * group: 'custom'
34
+ * });
35
+ */
36
+ export class SlotFillManager {
37
+ /**
38
+ * @param {Object} slotsConfig
39
+ * @param {import('../../core/EventBus').EventBus} eventBus
40
+ */
41
+ constructor(slotsConfig: any, eventBus: import("../../core/EventBus").EventBus);
42
+ _eventBus: import("diagram-js/lib/core/EventBus").default<null>;
43
+ /** @type {Array<{ slotName: string, fillId: string, render: Function, priority: number, group: string }>} */
44
+ _fills: Array<{
45
+ slotName: string;
46
+ fillId: string;
47
+ render: Function;
48
+ priority: number;
49
+ group: string;
50
+ }>;
51
+ /**
52
+ * Register a fill for a named slot.
53
+ *
54
+ * @param {string} slotName - The slot to fill.
55
+ * @param {string} fillId - Unique identifier for this fill.
56
+ * @param {Function|Object} options - A render callback `(container) => cleanup`, or `{ render, priority?, group? }`.
57
+ */
58
+ addFill(slotName: string, fillId: string, options: Function | any): void;
59
+ /**
60
+ * Remove a fill by its ID.
61
+ *
62
+ * @param {string} fillId
63
+ */
64
+ removeFill(fillId: string): void;
65
+ /**
66
+ * Get fills for a given slot, sorted by group (alphabetical) then priority (descending).
67
+ *
68
+ * @param {string} slotName
69
+ * @returns {Array<{ slotName: string, fillId: string, render: Function, priority: number, group: string }>}
70
+ */
71
+ getFills(slotName: string): Array<{
72
+ slotName: string;
73
+ fillId: string;
74
+ render: Function;
75
+ priority: number;
76
+ group: string;
77
+ }>;
78
+ /**
79
+ * @private
80
+ */
81
+ private _populateFromConfig;
82
+ }
83
+ export namespace SlotFillManager {
84
+ let $inject: string[];
85
+ }
@@ -1,5 +1,7 @@
1
1
  export namespace RenderInjectionModule {
2
2
  let __init__: string[];
3
3
  let renderInjector: (string | typeof RenderInjector)[];
4
+ let slotFillManager: (string | typeof SlotFillManager)[];
4
5
  }
5
6
  import { RenderInjector } from './RenderInjector';
7
+ import { SlotFillManager } from './SlotFillManager';
@@ -1,7 +1,7 @@
1
1
  export function Slot(props: {
2
2
  name: string;
3
- fillRoot: Function;
4
- groupFn: Function;
5
- separatorFn: Function;
6
- limit: number;
7
- }): any[];
3
+ fillRoot?: Function;
4
+ groupFn?: Function;
5
+ separatorFn?: Function;
6
+ limit?: number;
7
+ }): import("preact").VNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmn-io/form-js-editor",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "Edit forms - powered by bpmn.io",
5
5
  "exports": {
6
6
  ".": {
@@ -23,10 +23,10 @@
23
23
  "scripts": {
24
24
  "all": "run-s lint test build",
25
25
  "build": "run-p bundle bundle:scss generate-types",
26
- "bundle": "rollup -c --failAfterWarnings --bundleConfigAsCjs",
26
+ "bundle": "rollup -c --failAfterWarnings",
27
27
  "bundle:scss": "sass --no-source-map --load-path=\"../../node_modules\" assets/index.scss dist/assets/form-js-editor.css",
28
28
  "bundle:watch": "run-p bundle:watch-js bundle:watch-scss",
29
- "bundle:watch-js": "rollup -c -w --bundleConfigAsCjs",
29
+ "bundle:watch-js": "rollup -c -w",
30
30
  "bundle:watch-scss": "npm run bundle:scss -- --watch",
31
31
  "dev": "npm test -- --auto-watch --no-single-run",
32
32
  "example:dev": "cd example && npm start",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@bpmn-io/draggle": "^4.1.2",
51
- "@bpmn-io/form-js-viewer": "^1.20.0",
51
+ "@bpmn-io/form-js-viewer": "1.21.0",
52
52
  "@bpmn-io/properties-panel": "^3.40.3",
53
53
  "array-move": "^4.0.0",
54
54
  "big.js": "^7.0.1",
55
55
  "ids": "^3.0.1",
56
56
  "min-dash": "^5.0.0",
57
57
  "min-dom": "^5.2.0",
58
- "preact": "^10.5.14"
58
+ "preact": ">=10.5.14 <=10.15.1"
59
59
  },
60
60
  "sideEffects": [
61
61
  "*.css"
@@ -63,5 +63,5 @@
63
63
  "files": [
64
64
  "dist"
65
65
  ],
66
- "gitHead": "99083c967e6c5fcd8ad15a96558296eae4e02b69"
66
+ "gitHead": "19daa3fe06157ae0ae52ae27345fc9dc236b61ca"
67
67
  }