@unofficialbox/box-open-elements 0.24.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.
Files changed (40) hide show
  1. package/README.md +13 -13
  2. package/dist/components/actions/button.d.ts +1 -0
  3. package/dist/components/actions/button.js +13 -0
  4. package/dist/components/forms/checkbox.d.ts +1 -0
  5. package/dist/components/forms/checkbox.js +2 -0
  6. package/dist/components/forms/code-editor.d.ts +28 -3
  7. package/dist/components/forms/code-editor.js +71 -6
  8. package/dist/components/forms/combobox.js +7 -8
  9. package/dist/components/forms/number-input.d.ts +1 -0
  10. package/dist/components/forms/number-input.js +4 -1
  11. package/dist/components/forms/select.d.ts +1 -0
  12. package/dist/components/forms/select.js +3 -1
  13. package/dist/components/forms/text-area.js +5 -7
  14. package/dist/components/forms/text-field.d.ts +1 -0
  15. package/dist/components/forms/text-field.js +2 -0
  16. package/dist/components/navigation/accordion.d.ts +7 -0
  17. package/dist/components/navigation/accordion.js +31 -8
  18. package/dist/components/output/code-block.js +3 -1
  19. package/dist/components/overlays/drawer.js +2 -2
  20. package/dist/foundations/geometry/tokens.d.ts +2 -2
  21. package/dist/foundations/geometry/tokens.js +3 -3
  22. package/dist/foundations/icons/box-iconography.generated.d.ts +472 -1
  23. package/dist/foundations/icons/box-iconography.generated.js +473 -2
  24. package/dist/patterns/flow-builder/flow-builder.d.ts +5 -1
  25. package/dist/patterns/flow-builder/flow-builder.js +18 -7
  26. package/dist/patterns/flow-builder/primitives.d.ts +1 -0
  27. package/dist/patterns/flow-builder/primitives.js +11 -4
  28. package/dist/patterns/process-modeler/bridge.d.ts +10 -0
  29. package/dist/patterns/process-modeler/bridge.js +173 -0
  30. package/dist/patterns/process-modeler/design.d.ts +2 -0
  31. package/dist/patterns/process-modeler/design.js +288 -0
  32. package/dist/patterns/process-modeler/geometry.d.ts +20 -0
  33. package/dist/patterns/process-modeler/geometry.js +330 -0
  34. package/dist/patterns/process-modeler/index.d.ts +2 -0
  35. package/dist/patterns/process-modeler/index.js +2 -0
  36. package/dist/patterns/process-modeler/model.d.ts +106 -1
  37. package/dist/patterns/process-modeler/model.js +2 -2
  38. package/dist/patterns/process-modeler/process-modeler.d.ts +115 -3
  39. package/dist/patterns/process-modeler/process-modeler.js +1864 -128
  40. package/package.json +4 -3
@@ -1,2 +1,4 @@
1
1
  export * from "./model.js";
2
+ export * from "./geometry.js";
3
+ export * from "./bridge.js";
2
4
  export * from "./process-modeler.js";
@@ -1,2 +1,4 @@
1
1
  export * from "./model.js";
2
+ export * from "./geometry.js";
3
+ export * from "./bridge.js";
2
4
  export * from "./process-modeler.js";
@@ -5,9 +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;
13
+ /** Host identity at this path, used to reject stale saved positions. */
14
+ fingerprint?: string;
9
15
  /** A frame draws behind its children and connects as one box. */
10
16
  frame?: boolean;
17
+ /** Show the loop mark in a repeating frame without inferring host semantics from its kind name. */
18
+ loopMark?: boolean;
11
19
  parentId?: string;
12
20
  }
13
21
  export interface ProcessLine {
@@ -15,18 +23,105 @@ export interface ProcessLine {
15
23
  from: string;
16
24
  to: string;
17
25
  label?: string;
26
+ weight?: number;
27
+ fromSide?: ProcessSide;
28
+ toSide?: ProcessSide;
18
29
  dashed?: boolean;
19
30
  points?: {
20
31
  x: number;
21
32
  y: number;
22
33
  }[];
34
+ /** Optional last-run traffic share, between 0 and 1. */
35
+ share?: number;
36
+ }
37
+ export type ProcessSide = "north" | "east" | "south" | "west";
38
+ export interface ProcessConnection {
39
+ name: string;
40
+ kind: string;
41
+ id?: string;
42
+ signIn?: string;
43
+ }
44
+ export interface ProcessVariable {
45
+ name: string;
46
+ value?: unknown;
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;
75
+ }
76
+ export interface ProcessPositionSnapshot {
77
+ path?: NodePath;
78
+ fingerprint?: string;
79
+ id: string;
80
+ position: BoxPosition;
81
+ }
82
+ export interface ProcessLoadOptions {
83
+ /** Keys are JSON.stringify(path); snapshots are also accepted. Fingerprints must match. */
84
+ positions?: Readonly<Record<string, {
85
+ fingerprint?: string;
86
+ position: BoxPosition;
87
+ }>> | readonly ProcessPositionSnapshot[];
88
+ version?: string | number;
89
+ selectedPath?: NodePath | null;
23
90
  }
24
91
  export interface ProcessProjection<N = unknown> {
25
92
  boxes: readonly ProcessBox<N>[];
26
93
  lines: readonly ProcessLine[];
27
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
+ }
28
115
  export interface ProcessModel<D = unknown, N = unknown> {
29
116
  project(document: D): ProcessProjection<N>;
117
+ /** Optional host arrangement, used by Tidy up and for missing positions. */
118
+ arrange?(projection: ProcessProjection<N>): ProcessLayout;
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
+ */
124
+ validate?(document: D, projection: ProcessProjection<N>): readonly ProcessCheck[];
30
125
  }
31
126
  export interface BoxPosition {
32
127
  x: number;
@@ -45,6 +140,7 @@ export interface ProcessLayout {
45
140
  sections?: {
46
141
  id: string;
47
142
  title: string;
143
+ description?: string;
48
144
  x: number;
49
145
  y: number;
50
146
  width: number;
@@ -61,17 +157,26 @@ export interface ProcessCheck {
61
157
  path?: NodePath;
62
158
  }
63
159
  export interface ProcessEdit {
64
- type: "add" | "delete" | "connect" | "disconnect" | "insert";
160
+ type: "add" | "delete" | "duplicate" | "connect" | "disconnect" | "reattach" | "insert" | "reparent";
65
161
  boxId?: string;
162
+ sourceId?: string;
66
163
  from?: string;
67
164
  to?: string;
68
165
  lineId?: string;
69
166
  kind?: FlowKind;
70
167
  position?: BoxPosition;
168
+ parentId?: string;
169
+ fromSide?: ProcessSide;
170
+ toSide?: ProcessSide;
171
+ /** Optional branch presentation requested by a directional add. */
172
+ routeLabel?: string;
173
+ dashed?: boolean;
71
174
  }
72
175
  export interface ReversibleProcessEdit {
73
176
  undo(): void;
74
177
  redo(): void;
178
+ /** The already-applied edit's layout, recorded atomically with the document. */
179
+ layout?: ProcessLayout;
75
180
  }
76
181
  /** Host applies the edit, then calls accept with its inverse and replay. */
77
182
  export interface ProcessEditRequest extends ProcessEdit {
@@ -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 : 220, ...children.map((child) => child.width + 40)),
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
- : 96,
41
+ : box.shape === "gateway" || box.shape === "event" ? 56 : 64,
42
42
  };
43
43
  sizes.set(box.id, size);
44
44
  return size;
@@ -1,5 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
- import type { FlowKind, NodePath } from "../flow-builder/model.js";
2
+ import type { NodePath } from "../flow-builder/model.js";
3
+ import type { ProcessConnection, ProcessVariable, ProcessLoadOptions, ProcessKind, ProcessLastRun, ProcessOutlineItem, ProcessField } from "./model.js";
3
4
  import { ProcessHistory, type ProcessBox, type ProcessCheck, type ProcessEdit, type ProcessLayout, type ProcessModel, type ProcessProjection } from "./model.js";
4
5
  /** Projects host documents without owning workflow schemas or persistence. */
5
6
  export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends BaseElement {
@@ -10,19 +11,101 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
10
11
  private projection;
11
12
  private layoutValue;
12
13
  private catalogValue;
14
+ private detailValue;
15
+ private lastRunValue?;
16
+ private showLastRunValue;
13
17
  private selectedId;
18
+ private selectedLineId;
14
19
  private connecting;
15
20
  private checks;
16
21
  private renderer?;
17
22
  private cleanupInspector?;
18
23
  private inspected?;
19
24
  private inspectedId?;
25
+ private inspectedControls;
20
26
  private historyValue;
21
27
  private viewport;
22
28
  private pointers;
23
29
  private drag?;
24
30
  private pinchDistance;
25
31
  private gestureZoom;
32
+ private insertion?;
33
+ private selectedIds;
34
+ private clipboardIds;
35
+ private selectionToolbarKey;
36
+ private sectionSequence;
37
+ private versionValue;
38
+ private lastProjection;
39
+ private lastReadableProjection;
40
+ private readableValue;
41
+ private lastDocument?;
42
+ private connectionsValue;
43
+ private variablesValue;
44
+ private outlineValue;
45
+ private fieldsValue;
46
+ private processTitleValue;
47
+ private processSummaryValue;
48
+ private activePane;
49
+ private portDrag?;
50
+ private endDrag?;
51
+ private pendingReattach?;
52
+ private marquee?;
53
+ private segmentDrag?;
54
+ private frameResize?;
55
+ private spacePressed;
56
+ private dropLine?;
57
+ private paletteDragKind;
58
+ private narrowValue;
59
+ private suppressClick;
60
+ private resizeObserver?;
61
+ private routedLines;
62
+ private computedChecks;
63
+ get selectedBoxes(): readonly ProcessBox<N>[];
64
+ get selectedLine(): import("./model.js").ProcessLine | null;
65
+ get selectedPath(): NodePath | null;
66
+ set selectedPath(path: NodePath | null);
67
+ get connections(): readonly ProcessConnection[];
68
+ set connections(value: readonly ProcessConnection[]);
69
+ get variables(): readonly ProcessVariable[];
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;
89
+ get version(): string | number;
90
+ get narrow(): boolean;
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
+ }>;
99
+ load(document: D, options?: ProcessLoadOptions): void;
100
+ selectMany(ids: readonly string[]): void;
101
+ get headingLevel(): number;
102
+ set headingLevel(value: number);
103
+ get disableConnections(): boolean;
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);
108
+ private arrangedLayout;
26
109
  get document(): D | undefined;
27
110
  get history(): ProcessHistory;
28
111
  set history(value: ProcessHistory);
@@ -31,8 +114,14 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
31
114
  set model(value: ProcessModel<D, N>);
32
115
  get layout(): ProcessLayout;
33
116
  set layout(value: ProcessLayout);
34
- get catalog(): readonly FlowKind[];
35
- set catalog(value: readonly FlowKind[]);
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);
36
125
  get locked(): boolean;
37
126
  set locked(value: boolean);
38
127
  get snapToGrid(): boolean;
@@ -41,8 +130,10 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
41
130
  get renderInspector(): ((node: N, container: HTMLElement) => void | (() => void)) | undefined;
42
131
  set renderInspector(value: ((node: N, container: HTMLElement) => void | (() => void)) | undefined);
43
132
  disconnectedCallback(): void;
133
+ connectedCallback(): void;
44
134
  refresh(): void;
45
135
  select(id: string | null): void;
136
+ selectLine(id: string | null): void;
46
137
  setValidation(checks: readonly ProcessCheck[]): void;
47
138
  setValidationAtPath(message: string, path: NodePath): void;
48
139
  requestEdit(edit: ProcessEdit): void;
@@ -50,6 +141,7 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
50
141
  redo(): void;
51
142
  private commitLayout;
52
143
  move(id: string, x: number, y: number): void;
144
+ private emitPositions;
53
145
  private translatedLayout;
54
146
  tidy(): void;
55
147
  resize(id: string, width: number, height: number): void;
@@ -57,26 +149,46 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
57
149
  x: number;
58
150
  y: number;
59
151
  }[]): void;
152
+ resetLine(id: string): void;
60
153
  setNote(note: NonNullable<ProcessLayout["notes"]>[number] | null, id?: string | undefined): void;
61
154
  setSection(section: NonNullable<ProcessLayout["sections"]>[number] | null, id?: string | undefined): void;
62
155
  zoomBy(factor: number): void;
63
156
  fit(): void;
64
157
  private bounds;
65
158
  protected renderTemplate(): void;
159
+ private setupPanes;
160
+ private renderPane;
161
+ private selectionCommand;
162
+ arrangeSelection(action: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom' | 'distribute-horizontal' | 'distribute-vertical'): void;
163
+ makeSection(title?: string): void;
66
164
  protected setupListeners(): void;
67
165
  private onKey;
68
166
  private pointerDown;
69
167
  private distance;
70
168
  private pointerMove;
71
169
  private pointerEnd;
170
+ private canvasPoint;
171
+ private boxAt;
172
+ private sideAt;
173
+ private lineAt;
174
+ private markDropLine;
175
+ private alignedPoint;
176
+ private openChooser;
177
+ private addLayoutKind;
178
+ private showConnectTooltip;
72
179
  protected update(): void;
180
+ private get allChecks();
181
+ private collectChecks;
73
182
  private renderWorld;
74
183
  private place;
75
184
  private renderPalette;
76
185
  private renderChecks;
186
+ private renderField;
77
187
  private renderSelection;
188
+ private renderSelectionToolbar;
78
189
  private updateToolbar;
79
190
  private paintViewport;
191
+ private positionSelectionToolbar;
80
192
  private focusBox;
81
193
  private setStatus;
82
194
  }