@unofficialbox/box-open-elements 0.24.0 → 0.25.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 (36) 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.js +1 -1
  27. package/dist/patterns/process-modeler/bridge.d.ts +10 -0
  28. package/dist/patterns/process-modeler/bridge.js +173 -0
  29. package/dist/patterns/process-modeler/geometry.d.ts +18 -0
  30. package/dist/patterns/process-modeler/geometry.js +307 -0
  31. package/dist/patterns/process-modeler/index.d.ts +2 -0
  32. package/dist/patterns/process-modeler/index.js +2 -0
  33. package/dist/patterns/process-modeler/model.d.ts +41 -1
  34. package/dist/patterns/process-modeler/process-modeler.d.ts +48 -0
  35. package/dist/patterns/process-modeler/process-modeler.js +709 -63
  36. package/package.json +4 -3
@@ -6,6 +6,8 @@ export interface ProcessBox<N = unknown> {
6
6
  title: string;
7
7
  description?: string;
8
8
  path?: NodePath;
9
+ /** Host identity at this path, used to reject stale saved positions. */
10
+ fingerprint?: string;
9
11
  /** A frame draws behind its children and connects as one box. */
10
12
  frame?: boolean;
11
13
  parentId?: string;
@@ -15,18 +17,51 @@ export interface ProcessLine {
15
17
  from: string;
16
18
  to: string;
17
19
  label?: string;
20
+ weight?: number;
21
+ fromSide?: ProcessSide;
22
+ toSide?: ProcessSide;
18
23
  dashed?: boolean;
19
24
  points?: {
20
25
  x: number;
21
26
  y: number;
22
27
  }[];
23
28
  }
29
+ export type ProcessSide = "north" | "east" | "south" | "west";
30
+ export interface ProcessConnection {
31
+ name: string;
32
+ kind: string;
33
+ id?: string;
34
+ }
35
+ export interface ProcessVariable {
36
+ name: string;
37
+ value?: unknown;
38
+ description?: string;
39
+ }
40
+ export interface ProcessPositionSnapshot {
41
+ path?: NodePath;
42
+ fingerprint?: string;
43
+ id: string;
44
+ position: BoxPosition;
45
+ }
46
+ export interface ProcessLoadOptions {
47
+ /** Keys are JSON.stringify(path); snapshots are also accepted. Fingerprints must match. */
48
+ positions?: Readonly<Record<string, {
49
+ fingerprint?: string;
50
+ position: BoxPosition;
51
+ }>> | readonly ProcessPositionSnapshot[];
52
+ version?: string | number;
53
+ selectedPath?: NodePath | null;
54
+ }
24
55
  export interface ProcessProjection<N = unknown> {
25
56
  boxes: readonly ProcessBox<N>[];
26
57
  lines: readonly ProcessLine[];
27
58
  }
28
59
  export interface ProcessModel<D = unknown, N = unknown> {
29
60
  project(document: D): ProcessProjection<N>;
61
+ /** Optional host arrangement, used by Tidy up and for missing positions. */
62
+ arrange?(projection: ProcessProjection<N>): ProcessLayout;
63
+ /** Host-specific semantics supplement the generic free-graph checks. */
64
+ validate?(document: D, projection: ProcessProjection<N>): readonly ProcessCheck[];
30
65
  }
31
66
  export interface BoxPosition {
32
67
  x: number;
@@ -61,17 +96,22 @@ export interface ProcessCheck {
61
96
  path?: NodePath;
62
97
  }
63
98
  export interface ProcessEdit {
64
- type: "add" | "delete" | "connect" | "disconnect" | "insert";
99
+ type: "add" | "delete" | "connect" | "disconnect" | "insert" | "reparent";
65
100
  boxId?: string;
66
101
  from?: string;
67
102
  to?: string;
68
103
  lineId?: string;
69
104
  kind?: FlowKind;
70
105
  position?: BoxPosition;
106
+ parentId?: string;
107
+ fromSide?: ProcessSide;
108
+ toSide?: ProcessSide;
71
109
  }
72
110
  export interface ReversibleProcessEdit {
73
111
  undo(): void;
74
112
  redo(): void;
113
+ /** The already-applied edit's layout, recorded atomically with the document. */
114
+ layout?: ProcessLayout;
75
115
  }
76
116
  /** Host applies the edit, then calls accept with its inverse and replay. */
77
117
  export interface ProcessEditRequest extends ProcessEdit {
@@ -1,5 +1,6 @@
1
1
  import { BaseElement } from "../../core/index.js";
2
2
  import type { FlowKind, NodePath } from "../flow-builder/model.js";
3
+ import type { ProcessConnection, ProcessVariable, ProcessLoadOptions } 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 {
@@ -23,6 +24,40 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
23
24
  private drag?;
24
25
  private pinchDistance;
25
26
  private gestureZoom;
27
+ private insertion?;
28
+ private selectedIds;
29
+ private versionValue;
30
+ private lastProjection;
31
+ private lastDocument?;
32
+ private connectionsValue;
33
+ private variablesValue;
34
+ private activePane;
35
+ private portDrag?;
36
+ private marquee?;
37
+ private segmentDrag?;
38
+ private dropLine?;
39
+ private narrowValue;
40
+ private suppressClick;
41
+ private resizeObserver?;
42
+ private routedLines;
43
+ private computedChecks;
44
+ get selectedBoxes(): readonly ProcessBox<N>[];
45
+ get selectedPath(): NodePath | null;
46
+ set selectedPath(path: NodePath | null);
47
+ get connections(): readonly ProcessConnection[];
48
+ set connections(value: readonly ProcessConnection[]);
49
+ get variables(): readonly ProcessVariable[];
50
+ set variables(value: readonly ProcessVariable[]);
51
+ get version(): string | number;
52
+ get narrow(): boolean;
53
+ get positions(): readonly import("./model.js").ProcessPositionSnapshot[];
54
+ load(document: D, options?: ProcessLoadOptions): void;
55
+ selectMany(ids: readonly string[]): void;
56
+ get headingLevel(): number;
57
+ set headingLevel(value: number);
58
+ get disableConnections(): boolean;
59
+ set disableConnections(value: boolean);
60
+ private arrangedLayout;
26
61
  get document(): D | undefined;
27
62
  get history(): ProcessHistory;
28
63
  set history(value: ProcessHistory);
@@ -41,6 +76,7 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
41
76
  get renderInspector(): ((node: N, container: HTMLElement) => void | (() => void)) | undefined;
42
77
  set renderInspector(value: ((node: N, container: HTMLElement) => void | (() => void)) | undefined);
43
78
  disconnectedCallback(): void;
79
+ connectedCallback(): void;
44
80
  refresh(): void;
45
81
  select(id: string | null): void;
46
82
  setValidation(checks: readonly ProcessCheck[]): void;
@@ -50,6 +86,7 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
50
86
  redo(): void;
51
87
  private commitLayout;
52
88
  move(id: string, x: number, y: number): void;
89
+ private emitPositions;
53
90
  private translatedLayout;
54
91
  tidy(): void;
55
92
  resize(id: string, width: number, height: number): void;
@@ -63,13 +100,24 @@ export declare class ProcessModeler<D = ProcessProjection, N = unknown> extends
63
100
  fit(): void;
64
101
  private bounds;
65
102
  protected renderTemplate(): void;
103
+ private setupPanes;
104
+ private renderPane;
105
+ private selectionCommand;
66
106
  protected setupListeners(): void;
67
107
  private onKey;
68
108
  private pointerDown;
69
109
  private distance;
70
110
  private pointerMove;
71
111
  private pointerEnd;
112
+ private canvasPoint;
113
+ private boxAt;
114
+ private lineAt;
115
+ private markDropLine;
116
+ private alignedPoint;
117
+ private openChooser;
72
118
  protected update(): void;
119
+ private get allChecks();
120
+ private collectChecks;
73
121
  private renderWorld;
74
122
  private place;
75
123
  private renderPalette;