@tumaet/apollon 4.2.18 → 4.2.21

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.
@@ -1,6 +1,6 @@
1
1
  import { StoreApi, UseBoundStore } from 'zustand';
2
2
  import { Node, Edge, OnNodesChange, OnEdgesChange } from '@xyflow/react';
3
- import { Assessment } from '../typings';
3
+ import { Assessment, InteractiveElements } from '../typings';
4
4
  import * as Y from "yjs";
5
5
  export type DiagramStoreData = {
6
6
  nodes: Node[];
@@ -12,6 +12,8 @@ export type DiagramStore = {
12
12
  selectedElementIds: string[];
13
13
  diagramId: string;
14
14
  assessments: Record<string, Assessment>;
15
+ interactiveElements: Record<string, boolean>;
16
+ interactiveRelationships: Record<string, boolean>;
15
17
  canUndo: boolean;
16
18
  canRedo: boolean;
17
19
  undoManager: Y.UndoManager | null;
@@ -35,5 +37,9 @@ export type DiagramStore = {
35
37
  redo: () => void;
36
38
  initializeUndoManager: () => void;
37
39
  updateUndoRedoState: () => void;
40
+ toggleInteractiveElement: (elementId: string) => void;
41
+ getInteractiveForSerialization: () => InteractiveElements | undefined;
42
+ setInteractive: (interactive: InteractiveElements | undefined) => void;
43
+ isElementInteractive: (elementId: string) => boolean;
38
44
  };
39
45
  export declare const createDiagramStore: (ydoc: Y.Doc) => UseBoundStore<StoreApi<DiagramStore>>;
@@ -1,16 +1,20 @@
1
1
  import { StoreApi, UseBoundStore } from 'zustand';
2
2
  import { UMLDiagramType } from '../types';
3
- import { ApollonMode } from '../typings';
3
+ import { ApollonMode, ApollonView } from '../typings';
4
4
  import * as Y from "yjs";
5
5
  export type MetadataStore = {
6
6
  diagramTitle: string;
7
7
  diagramType: UMLDiagramType;
8
8
  mode: ApollonMode;
9
+ view: ApollonView;
10
+ availableViews: ApollonView[];
9
11
  readonly: boolean;
10
12
  debug: boolean;
11
13
  scrollLock: boolean;
12
14
  scrollEnabled: boolean;
13
15
  setMode: (mode: ApollonMode) => void;
16
+ setView: (view: ApollonView) => void;
17
+ setAvailableViews: (availableViews: ApollonView[]) => void;
14
18
  setReadonly: (readonly: boolean) => void;
15
19
  setScrollLock: (scrollLock: boolean) => void;
16
20
  setScrollEnabled: (scrollEnabled: boolean) => void;
package/dist/typings.d.ts CHANGED
@@ -49,6 +49,10 @@ export type ApollonEdge = {
49
49
  points: IPoint[];
50
50
  };
51
51
  };
52
+ export type InteractiveElements = {
53
+ elements: Record<string, boolean>;
54
+ relationships: Record<string, boolean>;
55
+ };
52
56
  export type UMLModel = {
53
57
  version: `4.${number}.${number}`;
54
58
  id: string;
@@ -59,6 +63,7 @@ export type UMLModel = {
59
63
  assessments: {
60
64
  [id: string]: Assessment;
61
65
  };
66
+ interactive?: InteractiveElements;
62
67
  };
63
68
  export declare enum ApollonView {
64
69
  Modelling = "Modelling",
@@ -69,6 +74,8 @@ export type SvgExportMode = "web" | "compat";
69
74
  export type ApollonOptions = {
70
75
  type?: UMLDiagramType;
71
76
  mode?: ApollonMode;
77
+ view?: ApollonView;
78
+ availableViews?: ApollonView[];
72
79
  readonly?: boolean;
73
80
  enablePopups?: boolean;
74
81
  model?: UMLModel;
@@ -1,9 +1,13 @@
1
1
  import { ReactFlowInstance, Node, Edge, Rect } from '@xyflow/react';
2
2
  import { Point } from './pathParsing';
3
3
  type SvgExportMode = "web" | "compat";
4
- export declare const getSVG: (container: HTMLElement, clip: Rect, options?: {
4
+ type ExportFilterOptions = {
5
+ include?: string[];
6
+ exclude?: string[];
5
7
  svgMode?: SvgExportMode;
6
- }) => string;
8
+ };
9
+ export declare function filterRenderedElements(container: HTMLElement, options?: ExportFilterOptions): void;
10
+ export declare const getSVG: (container: HTMLElement, clip: Rect, options?: ExportFilterOptions) => string;
7
11
  /**
8
12
  * Extract all coordinate points from an SVG path string.
9
13
  * This includes endpoints AND control points for bezier curves,
@@ -14,6 +18,7 @@ export declare const getSVG: (container: HTMLElement, clip: Rect, options?: {
14
18
  * include the reflected control point which may extend the bounds.
15
19
  */
16
20
  declare function extractPathPoints(pathD: string): Point[];
21
+ declare function getNodeBoundsFromDOM(container: HTMLElement, reactFlow?: ReactFlowInstance<Node, Edge>): Rect | undefined;
17
22
  /**
18
23
  * Calculate bounds for node SVG overflow content.
19
24
  *
@@ -30,6 +35,7 @@ declare function extractPathPoints(pathD: string): Point[];
30
35
  declare function getNodeOverflowBoundsFromDOM(container: HTMLElement): Rect | undefined;
31
36
  declare function mergeBounds(a: Rect, b: Rect): Rect;
32
37
  export declare function getDiagramBounds(reactFlow: ReactFlowInstance<Node, Edge>, container?: HTMLElement | null): Rect;
38
+ export declare function getRenderedDiagramBounds(reactFlow: ReactFlowInstance<Node, Edge>, container: HTMLElement): Rect;
33
39
  declare function extractStyles(styleString: string): {
34
40
  transform: {
35
41
  x: number;
@@ -89,6 +95,8 @@ declare function removeMarkerElements(svg: Element): void;
89
95
  * @internal — Exported for unit testing only. Not part of the public API.
90
96
  */
91
97
  export declare const __testing: {
98
+ readonly filterRenderedElements: typeof filterRenderedElements;
99
+ readonly getRenderedDiagramBounds: typeof getRenderedDiagramBounds;
92
100
  readonly extractPathPoints: typeof extractPathPoints;
93
101
  readonly extractStyles: typeof extractStyles;
94
102
  readonly resolveCSSVariable: typeof resolveCSSVariable;
@@ -98,6 +106,7 @@ export declare const __testing: {
98
106
  readonly removeMarkerElements: typeof removeMarkerElements;
99
107
  readonly replaceTextDecorationWithManualUnderline: typeof replaceTextDecorationWithManualUnderline;
100
108
  readonly mergeBounds: typeof mergeBounds;
109
+ readonly getNodeBoundsFromDOM: typeof getNodeBoundsFromDOM;
101
110
  readonly getNodeOverflowBoundsFromDOM: typeof getNodeOverflowBoundsFromDOM;
102
111
  };
103
112
  export {};
@@ -0,0 +1,4 @@
1
+ import { ApollonEdge, ApollonNode, InteractiveElements } from '../typings';
2
+ export declare function pruneInteractiveElements(interactive: InteractiveElements | undefined, nodes: Array<Pick<ApollonNode, "id">>, edges: Array<Pick<ApollonEdge, "id">>): InteractiveElements | undefined;
3
+ export declare function toggleInteractiveRecord(record: Record<string, boolean>, id: string): Record<string, boolean>;
4
+ export declare function hasInteractiveSelections(interactive: InteractiveElements | undefined): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tumaet/apollon",
3
- "version": "4.2.18",
3
+ "version": "4.2.21",
4
4
  "description": "An embeddable UML modeling editor for React. 13 diagram types, SVG/PNG/PDF/JSON export, optional real-time collaboration via Yjs.",
5
5
  "keywords": [
6
6
  "apollon",