@unofficialbox/box-open-elements 0.25.0 → 0.26.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/README.md +13 -13
- package/dist/patterns/flow-builder/primitives.d.ts +1 -0
- package/dist/patterns/flow-builder/primitives.js +10 -3
- package/dist/patterns/process-modeler/design.d.ts +2 -0
- package/dist/patterns/process-modeler/design.js +288 -0
- package/dist/patterns/process-modeler/geometry.d.ts +2 -0
- package/dist/patterns/process-modeler/geometry.js +30 -7
- package/dist/patterns/process-modeler/model.d.ts +67 -2
- package/dist/patterns/process-modeler/model.js +2 -2
- package/dist/patterns/process-modeler/process-modeler.d.ts +68 -4
- package/dist/patterns/process-modeler/process-modeler.js +1257 -167
- package/package.json +1 -1
|
@@ -5,11 +5,17 @@ export interface ProcessBox<N = unknown> {
|
|
|
5
5
|
kind: string;
|
|
6
6
|
title: string;
|
|
7
7
|
description?: string;
|
|
8
|
+
/** Description used in Technical view; absent values fall back to description. */
|
|
9
|
+
technicalDescription?: string;
|
|
10
|
+
/** Visual anatomy, independent of the host's kind identifier. */
|
|
11
|
+
shape?: "task" | "gateway" | "event" | "frame";
|
|
8
12
|
path?: NodePath;
|
|
9
13
|
/** Host identity at this path, used to reject stale saved positions. */
|
|
10
14
|
fingerprint?: string;
|
|
11
15
|
/** A frame draws behind its children and connects as one box. */
|
|
12
16
|
frame?: boolean;
|
|
17
|
+
/** Show the loop mark in a repeating frame without inferring host semantics from its kind name. */
|
|
18
|
+
loopMark?: boolean;
|
|
13
19
|
parentId?: string;
|
|
14
20
|
}
|
|
15
21
|
export interface ProcessLine {
|
|
@@ -25,17 +31,47 @@ export interface ProcessLine {
|
|
|
25
31
|
x: number;
|
|
26
32
|
y: number;
|
|
27
33
|
}[];
|
|
34
|
+
/** Optional last-run traffic share, between 0 and 1. */
|
|
35
|
+
share?: number;
|
|
28
36
|
}
|
|
29
37
|
export type ProcessSide = "north" | "east" | "south" | "west";
|
|
30
38
|
export interface ProcessConnection {
|
|
31
39
|
name: string;
|
|
32
40
|
kind: string;
|
|
33
41
|
id?: string;
|
|
42
|
+
signIn?: string;
|
|
34
43
|
}
|
|
35
44
|
export interface ProcessVariable {
|
|
36
45
|
name: string;
|
|
37
46
|
value?: unknown;
|
|
38
47
|
description?: string;
|
|
48
|
+
scope?: string;
|
|
49
|
+
startingValue?: string;
|
|
50
|
+
problem?: string;
|
|
51
|
+
}
|
|
52
|
+
/** Host-authored, readable outline; boxId links a row to a projected step. */
|
|
53
|
+
export interface ProcessOutlineItem {
|
|
54
|
+
title: string;
|
|
55
|
+
description?: string;
|
|
56
|
+
boxId?: string;
|
|
57
|
+
children?: readonly ProcessOutlineItem[];
|
|
58
|
+
}
|
|
59
|
+
/** Host-supplied field values; the modeler draws controls and requests edits. */
|
|
60
|
+
export interface ProcessField {
|
|
61
|
+
key: string;
|
|
62
|
+
label: string;
|
|
63
|
+
kind: "text" | "multiline" | "number" | "choice" | "boolean" | "expression" | "search" | "action";
|
|
64
|
+
value: string | number | boolean;
|
|
65
|
+
description?: string;
|
|
66
|
+
options?: readonly {
|
|
67
|
+
value: string;
|
|
68
|
+
label: string;
|
|
69
|
+
group?: string;
|
|
70
|
+
}[];
|
|
71
|
+
placeholder?: string;
|
|
72
|
+
required?: boolean;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
problem?: string;
|
|
39
75
|
}
|
|
40
76
|
export interface ProcessPositionSnapshot {
|
|
41
77
|
path?: NodePath;
|
|
@@ -56,11 +92,35 @@ export interface ProcessProjection<N = unknown> {
|
|
|
56
92
|
boxes: readonly ProcessBox<N>[];
|
|
57
93
|
lines: readonly ProcessLine[];
|
|
58
94
|
}
|
|
95
|
+
export interface ProcessKind extends FlowKind {
|
|
96
|
+
/** Alternative terms included in palette search. */
|
|
97
|
+
aliases?: readonly string[];
|
|
98
|
+
/** Host kind names never dictate the reusable visual anatomy. */
|
|
99
|
+
shape?: ProcessBox["shape"];
|
|
100
|
+
/** Notes and sections live in layout rather than the host workflow graph. */
|
|
101
|
+
placement?: "note" | "section";
|
|
102
|
+
}
|
|
103
|
+
export interface ProcessStepMetrics {
|
|
104
|
+
callsPerSecond?: number;
|
|
105
|
+
p95Ms?: number;
|
|
106
|
+
failedShare?: number;
|
|
107
|
+
/** True when the step was not measured in this run. */
|
|
108
|
+
notInRun?: boolean;
|
|
109
|
+
}
|
|
110
|
+
export interface ProcessLastRun {
|
|
111
|
+
label: string;
|
|
112
|
+
/** Keys are projected box IDs, supplied by the host. */
|
|
113
|
+
steps: Readonly<Record<string, ProcessStepMetrics>>;
|
|
114
|
+
}
|
|
59
115
|
export interface ProcessModel<D = unknown, N = unknown> {
|
|
60
116
|
project(document: D): ProcessProjection<N>;
|
|
61
117
|
/** Optional host arrangement, used by Tidy up and for missing positions. */
|
|
62
118
|
arrange?(projection: ProcessProjection<N>): ProcessLayout;
|
|
63
|
-
/**
|
|
119
|
+
/**
|
|
120
|
+
* The host's workflow read-back/validation. When supplied it is authoritative:
|
|
121
|
+
* generic vocabulary-based graph checks are not added on top. A host may call
|
|
122
|
+
* graphChecks itself with its own kind names if it wants those checks too.
|
|
123
|
+
*/
|
|
64
124
|
validate?(document: D, projection: ProcessProjection<N>): readonly ProcessCheck[];
|
|
65
125
|
}
|
|
66
126
|
export interface BoxPosition {
|
|
@@ -80,6 +140,7 @@ export interface ProcessLayout {
|
|
|
80
140
|
sections?: {
|
|
81
141
|
id: string;
|
|
82
142
|
title: string;
|
|
143
|
+
description?: string;
|
|
83
144
|
x: number;
|
|
84
145
|
y: number;
|
|
85
146
|
width: number;
|
|
@@ -96,8 +157,9 @@ export interface ProcessCheck {
|
|
|
96
157
|
path?: NodePath;
|
|
97
158
|
}
|
|
98
159
|
export interface ProcessEdit {
|
|
99
|
-
type: "add" | "delete" | "connect" | "disconnect" | "insert" | "reparent";
|
|
160
|
+
type: "add" | "delete" | "duplicate" | "connect" | "disconnect" | "reattach" | "insert" | "reparent";
|
|
100
161
|
boxId?: string;
|
|
162
|
+
sourceId?: string;
|
|
101
163
|
from?: string;
|
|
102
164
|
to?: string;
|
|
103
165
|
lineId?: string;
|
|
@@ -106,6 +168,9 @@ export interface ProcessEdit {
|
|
|
106
168
|
parentId?: string;
|
|
107
169
|
fromSide?: ProcessSide;
|
|
108
170
|
toSide?: ProcessSide;
|
|
171
|
+
/** Optional branch presentation requested by a directional add. */
|
|
172
|
+
routeLabel?: string;
|
|
173
|
+
dashed?: boolean;
|
|
109
174
|
}
|
|
110
175
|
export interface ReversibleProcessEdit {
|
|
111
176
|
undo(): void;
|
|
@@ -35,10 +35,10 @@ export function completeLayout(projection, layout) {
|
|
|
35
35
|
.filter((child) => child.parentId === box.id)
|
|
36
36
|
.map(measure);
|
|
37
37
|
const size = {
|
|
38
|
-
width: Math.max(box.frame ? 320 :
|
|
38
|
+
width: Math.max(box.frame || box.shape === "frame" ? 320 : box.shape === "gateway" || box.shape === "event" ? 56 : 224, ...children.map((child) => child.width + 40)),
|
|
39
39
|
height: box.frame
|
|
40
40
|
? Math.max(180, 64 + children.reduce((sum, child) => sum + child.height + 24, 0))
|
|
41
|
-
:
|
|
41
|
+
: box.shape === "gateway" || box.shape === "event" ? 56 : 64,
|
|
42
42
|
};
|
|
43
43
|
sizes.set(box.id, size);
|
|
44
44
|
return size;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseElement } from "../../core/index.js";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ProcessConnection, ProcessVariable, ProcessLoadOptions } from "./model.js";
|
|
2
|
+
import type { NodePath } from "../flow-builder/model.js";
|
|
3
|
+
import type { ProcessConnection, ProcessVariable, ProcessLoadOptions, ProcessKind, ProcessLastRun, ProcessOutlineItem, ProcessField } from "./model.js";
|
|
4
4
|
import { ProcessHistory, type ProcessBox, type ProcessCheck, type ProcessEdit, type ProcessLayout, type ProcessModel, type ProcessProjection } from "./model.js";
|
|
5
5
|
/** Projects host documents without owning workflow schemas or persistence. */
|
|
6
6
|
export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends BaseElement {
|
|
@@ -11,13 +11,18 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
11
11
|
private projection;
|
|
12
12
|
private layoutValue;
|
|
13
13
|
private catalogValue;
|
|
14
|
+
private detailValue;
|
|
15
|
+
private lastRunValue?;
|
|
16
|
+
private showLastRunValue;
|
|
14
17
|
private selectedId;
|
|
18
|
+
private selectedLineId;
|
|
15
19
|
private connecting;
|
|
16
20
|
private checks;
|
|
17
21
|
private renderer?;
|
|
18
22
|
private cleanupInspector?;
|
|
19
23
|
private inspected?;
|
|
20
24
|
private inspectedId?;
|
|
25
|
+
private inspectedControls;
|
|
21
26
|
private historyValue;
|
|
22
27
|
private viewport;
|
|
23
28
|
private pointers;
|
|
@@ -26,37 +31,80 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
26
31
|
private gestureZoom;
|
|
27
32
|
private insertion?;
|
|
28
33
|
private selectedIds;
|
|
34
|
+
private clipboardIds;
|
|
35
|
+
private selectionToolbarKey;
|
|
36
|
+
private sectionSequence;
|
|
29
37
|
private versionValue;
|
|
30
38
|
private lastProjection;
|
|
39
|
+
private lastReadableProjection;
|
|
40
|
+
private readableValue;
|
|
31
41
|
private lastDocument?;
|
|
32
42
|
private connectionsValue;
|
|
33
43
|
private variablesValue;
|
|
44
|
+
private outlineValue;
|
|
45
|
+
private fieldsValue;
|
|
46
|
+
private processTitleValue;
|
|
47
|
+
private processSummaryValue;
|
|
34
48
|
private activePane;
|
|
35
49
|
private portDrag?;
|
|
50
|
+
private endDrag?;
|
|
51
|
+
private pendingReattach?;
|
|
36
52
|
private marquee?;
|
|
37
53
|
private segmentDrag?;
|
|
54
|
+
private frameResize?;
|
|
55
|
+
private spacePressed;
|
|
38
56
|
private dropLine?;
|
|
57
|
+
private paletteDragKind;
|
|
39
58
|
private narrowValue;
|
|
40
59
|
private suppressClick;
|
|
41
60
|
private resizeObserver?;
|
|
42
61
|
private routedLines;
|
|
43
62
|
private computedChecks;
|
|
44
63
|
get selectedBoxes(): readonly ProcessBox<N>[];
|
|
64
|
+
get selectedLine(): import("./model.js").ProcessLine | null;
|
|
45
65
|
get selectedPath(): NodePath | null;
|
|
46
66
|
set selectedPath(path: NodePath | null);
|
|
47
67
|
get connections(): readonly ProcessConnection[];
|
|
48
68
|
set connections(value: readonly ProcessConnection[]);
|
|
49
69
|
get variables(): readonly ProcessVariable[];
|
|
50
70
|
set variables(value: readonly ProcessVariable[]);
|
|
71
|
+
get outline(): readonly ProcessOutlineItem[];
|
|
72
|
+
set outline(value: readonly ProcessOutlineItem[]);
|
|
73
|
+
get fields(): Readonly<Record<string, readonly ProcessField[]>>;
|
|
74
|
+
set fields(value: Readonly<Record<string, readonly ProcessField[]>>);
|
|
75
|
+
get processTitle(): string;
|
|
76
|
+
set processTitle(value: string);
|
|
77
|
+
get processSummary(): string;
|
|
78
|
+
set processSummary(value: string);
|
|
79
|
+
get view(): Readonly<{
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
zoom: number;
|
|
83
|
+
}>;
|
|
84
|
+
setView(view: {
|
|
85
|
+
x: number;
|
|
86
|
+
y: number;
|
|
87
|
+
zoom: number;
|
|
88
|
+
}): void;
|
|
51
89
|
get version(): string | number;
|
|
52
90
|
get narrow(): boolean;
|
|
53
91
|
get positions(): readonly import("./model.js").ProcessPositionSnapshot[];
|
|
92
|
+
/** Current drawing and last valid drawing; hosts own conversion and persistence. */
|
|
93
|
+
get readback(): Readonly<{
|
|
94
|
+
current: ProcessProjection<N> | null;
|
|
95
|
+
lastReadable: ProcessProjection<N> | null;
|
|
96
|
+
checks: readonly ProcessCheck[];
|
|
97
|
+
version: string | number;
|
|
98
|
+
}>;
|
|
54
99
|
load(document: D, options?: ProcessLoadOptions): void;
|
|
55
100
|
selectMany(ids: readonly string[]): void;
|
|
56
101
|
get headingLevel(): number;
|
|
57
102
|
set headingLevel(value: number);
|
|
58
103
|
get disableConnections(): boolean;
|
|
59
104
|
set disableConnections(value: boolean);
|
|
105
|
+
/** Hide duplicate process heading/view controls when the host supplies them. */
|
|
106
|
+
get embedMode(): boolean;
|
|
107
|
+
set embedMode(value: boolean);
|
|
60
108
|
private arrangedLayout;
|
|
61
109
|
get document(): D | undefined;
|
|
62
110
|
get history(): ProcessHistory;
|
|
@@ -66,8 +114,14 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
66
114
|
set model(value: ProcessModel<D, N>);
|
|
67
115
|
get layout(): ProcessLayout;
|
|
68
116
|
set layout(value: ProcessLayout);
|
|
69
|
-
get catalog(): readonly
|
|
70
|
-
set catalog(value: readonly
|
|
117
|
+
get catalog(): readonly ProcessKind[];
|
|
118
|
+
set catalog(value: readonly ProcessKind[]);
|
|
119
|
+
get detail(): "business" | "technical";
|
|
120
|
+
set detail(value: "business" | "technical");
|
|
121
|
+
get lastRun(): ProcessLastRun | undefined;
|
|
122
|
+
set lastRun(value: ProcessLastRun | undefined);
|
|
123
|
+
get showLastRun(): boolean;
|
|
124
|
+
set showLastRun(value: boolean);
|
|
71
125
|
get locked(): boolean;
|
|
72
126
|
set locked(value: boolean);
|
|
73
127
|
get snapToGrid(): boolean;
|
|
@@ -79,6 +133,7 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
79
133
|
connectedCallback(): void;
|
|
80
134
|
refresh(): void;
|
|
81
135
|
select(id: string | null): void;
|
|
136
|
+
selectLine(id: string | null): void;
|
|
82
137
|
setValidation(checks: readonly ProcessCheck[]): void;
|
|
83
138
|
setValidationAtPath(message: string, path: NodePath): void;
|
|
84
139
|
requestEdit(edit: ProcessEdit): void;
|
|
@@ -94,6 +149,7 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
94
149
|
x: number;
|
|
95
150
|
y: number;
|
|
96
151
|
}[]): void;
|
|
152
|
+
resetLine(id: string): void;
|
|
97
153
|
setNote(note: NonNullable<ProcessLayout["notes"]>[number] | null, id?: string | undefined): void;
|
|
98
154
|
setSection(section: NonNullable<ProcessLayout["sections"]>[number] | null, id?: string | undefined): void;
|
|
99
155
|
zoomBy(factor: number): void;
|
|
@@ -103,6 +159,8 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
103
159
|
private setupPanes;
|
|
104
160
|
private renderPane;
|
|
105
161
|
private selectionCommand;
|
|
162
|
+
arrangeSelection(action: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom' | 'distribute-horizontal' | 'distribute-vertical'): void;
|
|
163
|
+
makeSection(title?: string): void;
|
|
106
164
|
protected setupListeners(): void;
|
|
107
165
|
private onKey;
|
|
108
166
|
private pointerDown;
|
|
@@ -111,10 +169,13 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
111
169
|
private pointerEnd;
|
|
112
170
|
private canvasPoint;
|
|
113
171
|
private boxAt;
|
|
172
|
+
private sideAt;
|
|
114
173
|
private lineAt;
|
|
115
174
|
private markDropLine;
|
|
116
175
|
private alignedPoint;
|
|
117
176
|
private openChooser;
|
|
177
|
+
private addLayoutKind;
|
|
178
|
+
private showConnectTooltip;
|
|
118
179
|
protected update(): void;
|
|
119
180
|
private get allChecks();
|
|
120
181
|
private collectChecks;
|
|
@@ -122,9 +183,12 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
|
|
|
122
183
|
private place;
|
|
123
184
|
private renderPalette;
|
|
124
185
|
private renderChecks;
|
|
186
|
+
private renderField;
|
|
125
187
|
private renderSelection;
|
|
188
|
+
private renderSelectionToolbar;
|
|
126
189
|
private updateToolbar;
|
|
127
190
|
private paintViewport;
|
|
191
|
+
private positionSelectionToolbar;
|
|
128
192
|
private focusBox;
|
|
129
193
|
private setStatus;
|
|
130
194
|
}
|