@celldl/editor 0.20260212.0 → 0.20260217.1

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 (87) hide show
  1. package/README.md +13 -0
  2. package/dist/CellDLEditor-VG5HM79L.js +13851 -0
  3. package/dist/CellDLEditor-VG5HM79L.js.map +1 -0
  4. package/dist/CellDLEditor.css +1 -1
  5. package/dist/CellDLEditor.es.js +6 -5
  6. package/dist/app/src/App.vue.d.ts +2 -0
  7. package/dist/app/src/common/common.d.ts +8 -0
  8. package/dist/app/src/common/constants.d.ts +5 -0
  9. package/dist/app/src/common/electron.d.ts +5 -0
  10. package/dist/app/src/common/electronApi.d.ts +8 -0
  11. package/dist/app/src/common/settings.d.ts +18 -0
  12. package/dist/app/src/common/version.d.ts +7 -0
  13. package/dist/app/src/common/vueCommon.d.ts +9 -0
  14. package/dist/app/src/main.d.ts +1 -0
  15. package/dist/{vendor-DFPLRrnP.js → index-DdfNP2Wo.js} +41637 -47600
  16. package/dist/index-DdfNP2Wo.js.map +1 -0
  17. package/dist/index.d.ts +54 -16
  18. package/dist/{index-DtCZg5ZV.js → oxigraph-Dx4bu2IN.js} +221 -843
  19. package/dist/oxigraph-Dx4bu2IN.js.map +1 -0
  20. package/dist/package.json.d.ts +106 -0
  21. package/dist/src/CellDL/SVGElements/boundedelement.d.ts +21 -0
  22. package/dist/src/CellDL/SVGElements/index.d.ts +66 -0
  23. package/dist/src/CellDL/SVGElements/linearpath.d.ts +11 -0
  24. package/dist/src/CellDL/SVGElements/pathelement.d.ts +53 -0
  25. package/dist/src/CellDL/SVGElements/rectilinearpath.d.ts +50 -0
  26. package/dist/src/CellDL/SVGElements/svgconnection.d.ts +22 -0
  27. package/dist/src/CellDL/celldlObjects/index.d.ts +151 -0
  28. package/dist/src/CellDL/components/index.d.ts +39 -0
  29. package/dist/src/CellDL/components/properties.d.ts +61 -0
  30. package/dist/src/CellDL/connections/index.d.ts +35 -0
  31. package/dist/src/CellDL/connections/pathmaker.d.ts +38 -0
  32. package/dist/src/CellDL/diagram/index.d.ts +45 -0
  33. package/dist/src/CellDL/editor/alerts.d.ts +27 -0
  34. package/dist/src/CellDL/editor/editguides.d.ts +31 -0
  35. package/dist/src/CellDL/editor/editorframe.d.ts +13 -0
  36. package/dist/src/CellDL/editor/index.d.ts +40 -0
  37. package/dist/src/CellDL/editor/panzoom.d.ts +30 -0
  38. package/dist/src/CellDL/editor/selectionbox.d.ts +17 -0
  39. package/dist/src/CellDL/editor/undoredo.d.ts +46 -0
  40. package/dist/src/CellDL/geometry/controls.d.ts +53 -0
  41. package/dist/src/CellDL/geometry/index.d.ts +92 -0
  42. package/dist/src/CellDL/geometry/intersections.d.ts +6 -0
  43. package/dist/src/CellDL/geometry/pathutils.d.ts +12 -0
  44. package/dist/src/CellDL/geometry/spatialindex.d.ts +22 -0
  45. package/dist/src/CellDL/geometry/transforms.d.ts +21 -0
  46. package/dist/src/CellDL/geometry/units.d.ts +23 -0
  47. package/dist/src/CellDL/utils.d.ts +6 -0
  48. package/dist/src/assets/oxigraph/web.d.ts +279 -0
  49. package/dist/src/common/EditorTypes.d.ts +39 -0
  50. package/dist/src/common/common.d.ts +7 -0
  51. package/dist/src/common/constants.d.ts +5 -0
  52. package/dist/src/common/points.d.ts +57 -0
  53. package/dist/src/common/styling.d.ts +36 -0
  54. package/dist/src/common/svgUtils.d.ts +48 -0
  55. package/dist/src/common/themeCssVariables.d.ts +9 -0
  56. package/dist/src/common/types.d.ts +23 -0
  57. package/dist/src/common/vueCommon.d.ts +9 -0
  58. package/dist/src/components/CellDLEditor.vue.d.ts +19 -0
  59. package/dist/src/components/WrappedEditor.vue.d.ts +19 -0
  60. package/dist/src/components/panels/FillStyle.vue.d.ts +20 -0
  61. package/dist/src/components/panels/PathStyle.vue.d.ts +20 -0
  62. package/dist/src/components/panels/PropertiesPanel.vue.d.ts +21 -0
  63. package/dist/src/components/popovers/ComponentPopover.vue.d.ts +19 -0
  64. package/dist/src/components/popovers/ConnectionStylePopover.vue.d.ts +19 -0
  65. package/dist/src/components/toolbar/EditorToolbar.vue.d.ts +23 -0
  66. package/dist/src/components/toolbar/ToolButton.vue.d.ts +26 -0
  67. package/dist/src/components/toolbar/ToolPanel.vue.d.ts +2 -0
  68. package/dist/src/components/toolbar/ToolPopover.vue.d.ts +3 -0
  69. package/dist/src/components/widgets/InputWidget.vue.d.ts +34 -0
  70. package/dist/src/libopencor/locUIJsonApi.d.ts +54 -0
  71. package/dist/src/mathjax/index.d.ts +2 -0
  72. package/dist/src/metadata/index.d.ts +50 -0
  73. package/dist/src/metadata/namespaces.d.ts +46 -0
  74. package/dist/src/metadata/oxigraphStore.d.ts +61 -0
  75. package/dist/src/metadata/oximock.d.ts +36 -0
  76. package/dist/src/metadata/store.d.ts +23 -0
  77. package/dist/src/plugins/bondgraph/definitions.d.ts +6 -0
  78. package/dist/src/plugins/bondgraph/index.d.ts +40 -0
  79. package/dist/src/plugins/bondgraph/utils.d.ts +27 -0
  80. package/dist/src/plugins/index.d.ts +75 -0
  81. package/dist/vite.config.d.ts +3 -0
  82. package/dist/vite.lib.config.d.ts +3 -0
  83. package/package.json +4 -3
  84. package/dist/CellDLEditor-CRG_Fjg2.js +0 -7262
  85. package/dist/CellDLEditor-CRG_Fjg2.js.map +0 -1
  86. package/dist/index-DtCZg5ZV.js.map +0 -1
  87. package/dist/vendor-DFPLRrnP.js.map +0 -1
@@ -0,0 +1,39 @@
1
+ import { CellDLObject } from '../celldlObjects/index';
2
+ import { MetadataPropertiesMap } from '../../metadata/index';
3
+ import { PointLike } from '../../common/points';
4
+ import { Constructor, StringProperties } from '../../common/types';
5
+ export interface ObjectTemplate {
6
+ CellDLClass: Constructor<CellDLObject>;
7
+ description?: string;
8
+ image?: string;
9
+ metadataProperties: MetadataPropertiesMap;
10
+ name?: string;
11
+ }
12
+ export interface LibraryComponentTemplate {
13
+ id: string;
14
+ name: string;
15
+ image: string;
16
+ selected?: boolean;
17
+ }
18
+ export interface ComponentLibrary {
19
+ id: string;
20
+ name: string;
21
+ templates: LibraryComponentTemplate[];
22
+ }
23
+ export interface ElementTypeName {
24
+ type: string;
25
+ name: string;
26
+ }
27
+ export interface NamedProperty {
28
+ name: string;
29
+ property: string;
30
+ }
31
+ export interface TemplateProperties {
32
+ nodeSettings?: StringProperties;
33
+ }
34
+ export type TemplateEventDetails = {
35
+ id: string;
36
+ centre: PointLike;
37
+ offset: PointLike;
38
+ };
39
+ export declare function getTemplateEventDetails(id: string, target: HTMLImageElement, event: DragEvent | MouseEvent | null): TemplateEventDetails;
@@ -0,0 +1,61 @@
1
+ import { CellDLObject } from '../celldlObjects/index';
2
+ import { IPathStyle } from '../../common/svgUtils';
3
+ import { RdfStore } from '../../metadata/index';
4
+ /******************************************************************************
5
+
6
+ CellDL Editor
7
+
8
+ Copyright (c) 2022 - 2025 David Brooks
9
+
10
+ Licensed under the Apache License, Version 2.0 (the "License");
11
+ you may not use this file except in compliance with the License.
12
+ You may obtain a copy of the License at
13
+
14
+ http://www.apache.org/licenses/LICENSE-2.0
15
+
16
+ Unless required by applicable law or agreed to in writing, software
17
+ distributed under the License is distributed on an "AS IS" BASIS,
18
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
+ See the License for the specific language governing permissions and
20
+ limitations under the License.
21
+
22
+ ******************************************************************************/
23
+ import type * as locApi from '@renderer/libopencor/locUIJsonApi';
24
+ export type ItemDetails = locApi.IUiJsonInput & {
25
+ itemId: string;
26
+ property: string;
27
+ value?: string | number;
28
+ units?: string;
29
+ optional?: boolean;
30
+ numeric?: boolean;
31
+ };
32
+ export type StyleObject = {
33
+ fillColours?: string[];
34
+ pathStyle?: IPathStyle;
35
+ };
36
+ export interface PropertyGroup {
37
+ groupId: string;
38
+ items: ItemDetails[];
39
+ styling?: StyleObject;
40
+ title: string;
41
+ }
42
+ export type StylingGroup = PropertyGroup & {
43
+ styling: StyleObject;
44
+ };
45
+ export interface ValueChange {
46
+ oldValue: string;
47
+ newValue: string;
48
+ }
49
+ export declare const METADATA_GROUP_ID = "cd-metadata";
50
+ export declare const STYLING_GROUP_ID = "object-styling";
51
+ export declare const STYLING_GROUP: PropertyGroup;
52
+ export declare function getItemProperty(celldlObject: CellDLObject, itemTemplate: ItemDetails, rdfStore: RdfStore): ItemDetails | undefined;
53
+ export declare function updateItemProperty(property: string, value: ValueChange, celldlObject: CellDLObject, rdfStore: RdfStore): void;
54
+ export declare class ObjectPropertiesPanel {
55
+ #private;
56
+ constructor();
57
+ clearObjectProperties(): void;
58
+ setObjectProperties(celldlObject: CellDLObject | null, rdfStore: RdfStore): void;
59
+ updateObjectProperties(celldlObject: CellDLObject | null, itemId: string, value: ValueChange, rdfStore: RdfStore): Promise<void>;
60
+ updateObjectStyling(celldlObject: CellDLObject | null, objectType: string, styling: StyleObject): Promise<void>;
61
+ }
@@ -0,0 +1,35 @@
1
+ /******************************************************************************
2
+
3
+ CellDL Editor
4
+
5
+ Copyright (c) 2022 - 2025 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+ export declare enum ConnectionStyle {
21
+ Linear = "linear",
22
+ Rectilinear = "rectilinear"
23
+ }
24
+ export interface ConnectionStyleDefinition {
25
+ id: ConnectionStyle;
26
+ icon: string;
27
+ name: string;
28
+ }
29
+ export declare const DEFAULT_CONNECTION_STYLE_DEFINITION: {
30
+ id: ConnectionStyle;
31
+ name: string;
32
+ icon: string;
33
+ };
34
+ export declare const DEFAULT_CONNECTION_STYLE: ConnectionStyle;
35
+ export declare const CONNECTION_STYLE_DEFINITIONS: ConnectionStyleDefinition[];
@@ -0,0 +1,38 @@
1
+ import { PointLike } from '../../common/points';
2
+ import { CellDLConnectedObject, CellDLObject } from '../celldlObjects/index';
3
+ import { CellDLDiagram } from '../diagram/index';
4
+ import { EditorFrame } from '../editor/editorframe';
5
+ import { CellDLSVGElement } from '../SVGElements/index';
6
+ export declare class PathNode {
7
+ readonly object: CellDLConnectedObject;
8
+ constructor(object: CellDLConnectedObject);
9
+ get celldlSvgElement(): CellDLSVGElement | undefined;
10
+ get id(): string;
11
+ get uri(): import('../../metadata/index').NamedNode;
12
+ canConnect(_node: PathNode): boolean;
13
+ }
14
+ /**
15
+ * A ``PathMaker`` is used to create a ``celldl:Connection``.
16
+ *
17
+ * A connection begins with a start object; has a geometric shape, specified by an
18
+ * SVG path; possibly passes through intermediate objects (conduits); and finishes
19
+ * with an end object.
20
+ *
21
+ * An object may have constraints to determine whether and how it can be connected
22
+ * to a path.
23
+ */
24
+ export declare class PathMaker {
25
+ #private;
26
+ constructor(editorFrame: EditorFrame, startNode: PathNode, style?: string);
27
+ get currentSvgPath(): SVGPathElement | null;
28
+ get empty(): boolean;
29
+ static validStartObject(celldlObject: CellDLObject): PathNode | null;
30
+ static startPartialPath(point: PointLike, celldlDiagram: CellDLDiagram): PathNode;
31
+ close(): void;
32
+ validPathNode(celldlObject: CellDLObject): PathNode | null;
33
+ addIntermediate(node: PathNode, shiftKey?: boolean): void;
34
+ addPoint(point: PointLike, shiftKey?: boolean): void;
35
+ drawTo(point: PointLike, shiftKey?: boolean): void;
36
+ finishPath(endNode: PathNode, celldlDiagram: CellDLDiagram, shiftKey?: boolean): void;
37
+ finishPartialPath(celldlDiagram: CellDLDiagram, shiftKey?: boolean): void;
38
+ }
@@ -0,0 +1,45 @@
1
+ import { PointLike } from '../../common/points';
2
+ import { StringProperties } from '../../common/types';
3
+ import { NamedNode, MetadataPropertyValue } from '../../metadata/index';
4
+ import { Bounds } from '../geometry/index';
5
+ import { ContainedObject } from '../geometry/spatialindex';
6
+ import { CellDLConnectedObject, CellDLConnection, CellDLCompartment, CellDLInterface, CellDLObject, CellDLUnconnectedPort } from '../celldlObjects/index.ts';
7
+ import { CellDLEditor } from '../editor/index';
8
+ import { EditorUndoAction } from '../editor/undoredo';
9
+ import { ObjectTemplate } from '../components/index';
10
+ import * as $rdf from '@renderer/metadata/index';
11
+ export declare const CELLDL_VERSION = "1.0";
12
+ export declare class CellDLDiagram {
13
+ #private;
14
+ constructor(filePath: string, celldlData: string, celldlEditor: CellDLEditor, importSvg?: boolean);
15
+ finishSetup(): void;
16
+ edit(): Promise<void>;
17
+ get editorFrame(): import('../editor/editorframe').EditorFrame | null;
18
+ get metadata(): StringProperties;
19
+ set metadata(data: StringProperties);
20
+ get rdfStore(): $rdf.RdfStore;
21
+ get svgDiagram(): SVGSVGElement;
22
+ get uri(): string;
23
+ domToSvgCoords(domCoords: PointLike): DOMPoint;
24
+ svgToDomCoords(svgCoords: PointLike): DOMPoint;
25
+ makeUri(id: string): NamedNode;
26
+ removeKnowledge(subject: NamedNode, predicates: NamedNode[]): void;
27
+ objectById(id: string): CellDLObject | null;
28
+ export(format: string): {
29
+ error: string;
30
+ };
31
+ serialise(): Promise<string>;
32
+ addEditorElement(element: SVGElement, prepend?: boolean): void;
33
+ associatedObjects(object: CellDLObject): CellDLObject[];
34
+ addConnectedObject(svgElement: SVGGraphicsElement, template: ObjectTemplate): CellDLConnectedObject | null;
35
+ addNewConnection(svgElement: SVGGraphicsElement, template: ObjectTemplate): CellDLConnection;
36
+ createCompartment(bounds: Bounds, objects: CellDLObject[]): CellDLCompartment;
37
+ createInterfacePort(point: PointLike): CellDLInterface;
38
+ createUnconnectedPort(point: PointLike): CellDLUnconnectedPort;
39
+ getConnector(connectorNode: MetadataPropertyValue | null): CellDLConnectedObject | null;
40
+ objectsContainedIn(compartment: Bounds): ContainedObject[];
41
+ objectMoved(celldlObject: CellDLObject): void;
42
+ deleteInsertedObject(undoAction: EditorUndoAction): void;
43
+ insertDeletedObject(undoAction: EditorUndoAction): void;
44
+ removeObject(celldlObject: CellDLObject): void;
45
+ }
@@ -0,0 +1,27 @@
1
+ /******************************************************************************
2
+
3
+ CellDL Editor
4
+
5
+ Copyright (c) 2022 - 2025 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+ export declare namespace alert {
21
+ function clear(): void;
22
+ function error(msg: string): void;
23
+ function info(msg: string): void;
24
+ function tooltip(msg: string): void;
25
+ function warn(msg: string): void;
26
+ function elementError(msg: string, svgElement?: SVGGraphicsElement): void;
27
+ }
@@ -0,0 +1,31 @@
1
+ import { ViewState } from '../../common/EditorTypes';
2
+ import { Point, PointLike } from '../../common/points';
3
+ import { CellDLDiagram } from '../diagram/index';
4
+ import { CellDLMoveableObject } from '../celldlObjects/index';
5
+ import { Extent } from '../geometry/index';
6
+ export declare const EDITOR_GRID_CLASS = "alignment-grid";
7
+ export declare const GRID_SNAP_RESOLUTION = 0.5;
8
+ export declare const GRID_SPACING = 10;
9
+ export type GridAlignOptions = {
10
+ fullSnap?: boolean;
11
+ noAlign?: boolean;
12
+ noAlignX?: boolean;
13
+ noAlignY?: boolean;
14
+ resolution?: number;
15
+ snapGrid?: boolean;
16
+ };
17
+ export declare const DEFAULT_VIEW_STATE: ViewState;
18
+ declare class EditGuides {
19
+ #private;
20
+ private constructor();
21
+ static get instance(): EditGuides;
22
+ gridAlign(point: PointLike, options?: GridAlignOptions): Point;
23
+ addGuide(component: CellDLMoveableObject): void;
24
+ matchGuide(component: CellDLMoveableObject): Array<number | null>;
25
+ newDiagram(celldlDiagram: CellDLDiagram, showGrid: boolean): void;
26
+ setState(state: ViewState): void;
27
+ viewboxUpdated(viewbox: Extent): void;
28
+ removeGuide(component: CellDLMoveableObject): void;
29
+ }
30
+ export declare const editGuides: EditGuides;
31
+ export {};
@@ -0,0 +1,13 @@
1
+ import { PointLike } from '../../common/points';
2
+ import { ObjectTemplate } from '../components/index';
3
+ export declare const EDITOR_FRAME_ID = "celldl-editor-selection-frame";
4
+ export declare class EditorFrame {
5
+ #private;
6
+ constructor(svgDiagram: SVGSVGElement);
7
+ get svgGroup(): SVGGElement;
8
+ addElementAsString(element: string): SVGGraphicsElement | null;
9
+ addSvgElement(template: ObjectTemplate, topLeft: PointLike): SVGGElement;
10
+ clear(): void;
11
+ contains(feature: SVGGraphicsElement): boolean;
12
+ removeElement(element: SVGGraphicsElement | null): void;
13
+ }
@@ -0,0 +1,40 @@
1
+ import { CellDLDiagram } from '../diagram/index';
2
+ import { EditorFrame } from './editorframe';
3
+ export declare enum EDITOR_TOOL_IDS {
4
+ SelectTool = "select-tool",
5
+ DrawConnectionTool = "draw-connection-tool",
6
+ AddComponentTool = "add-component-tool"
7
+ }
8
+ export declare const DEFAULT_EDITOR_TOOL_ID = EDITOR_TOOL_IDS.SelectTool;
9
+ export declare enum PANEL_IDS {
10
+ PropertyPanel = "property-panel"
11
+ }
12
+ export declare enum CONTEXT_MENU {
13
+ DELETE = "menu-delete",
14
+ EDIT_GROUP = "menu-edit-group",
15
+ INFO = "menu-info",
16
+ GROUP_OBJECTS = "menu-group",
17
+ UNGROUP_OBJECTS = "menu-ungroup"
18
+ }
19
+ export declare function notifyChanges(): void;
20
+ export declare function getElementId(element: SVGGraphicsElement): string;
21
+ export declare class CellDLEditor {
22
+ #private;
23
+ static instance: CellDLEditor | null;
24
+ constructor();
25
+ mount(svgContainer: HTMLElement): void;
26
+ get celldlDiagram(): CellDLDiagram | null;
27
+ get dirty(): boolean;
28
+ get editorFrame(): EditorFrame | null;
29
+ get status(): string;
30
+ set status(text: string);
31
+ get windowSize(): [number, number];
32
+ setDirty(): void;
33
+ markClean(): void;
34
+ editDiagram(celldlDiagram: CellDLDiagram): Promise<void>;
35
+ closeDiagram(): void;
36
+ resetObjectStates(): void;
37
+ enableContextMenuItem(_itemId: string, _enable?: boolean): void;
38
+ showMessage(msg: string, style?: string): void;
39
+ showTooltip(msg: string, style?: string): void;
40
+ }
@@ -0,0 +1,30 @@
1
+ /******************************************************************************
2
+
3
+ CellDL Editor
4
+
5
+ Copyright (c) 2022 - 2025 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+ export default class PanZoom {
21
+ #private;
22
+ constructor(container: HTMLElement);
23
+ get panning(): boolean;
24
+ get scale(): number;
25
+ enable(svgDiagram: SVGSVGElement): void;
26
+ disable(): void;
27
+ pointerDown(event: PointerEvent): void;
28
+ pointerMove(event: PointerEvent): boolean;
29
+ pointerUp(_event: PointerEvent): void;
30
+ }
@@ -0,0 +1,17 @@
1
+ import { CellDLObject } from '../celldlObjects';
2
+ import { Bounds } from '../geometry';
3
+ import { CellDLEditor } from '.';
4
+ export declare class SelectionBox {
5
+ #private;
6
+ constructor(editor: CellDLEditor, startPoint: DOMPoint);
7
+ get bounds(): Bounds;
8
+ get count(): number;
9
+ get selectedObjects(): CellDLObject[];
10
+ pointInside(point: DOMPoint): boolean;
11
+ makeCompartment(): void;
12
+ pointerEvent(event: any, point: DOMPoint): boolean;
13
+ close(): void;
14
+ clearControlHandles(): void;
15
+ drawControlHandles(): void;
16
+ updateSelectedObjects(): void;
17
+ }
@@ -0,0 +1,46 @@
1
+ import { CellDLDiagram } from '../diagram/index';
2
+ import { CellDLObject } from '../celldlObjects/index';
3
+ import { Point, PointLike } from '../../common/points';
4
+ import { Statement } from '../../metadata/index';
5
+ declare enum Action {
6
+ DELETE = 1,
7
+ INSERT = 2,
8
+ MOVE = 3
9
+ }
10
+ declare enum MovePosition {
11
+ LAST = 1,
12
+ CURRENT = 2
13
+ }
14
+ export type UndoMovePosition = [number, Point | null] | null;
15
+ declare class ObjectDetails {
16
+ #private;
17
+ constructor(object: CellDLObject);
18
+ get object(): CellDLObject;
19
+ insertSvg(svgDiagram: SVGSVGElement): void;
20
+ }
21
+ export declare class EditorUndoAction {
22
+ #private;
23
+ readonly action: Action;
24
+ readonly position: Point | null;
25
+ constructor(action: Action, position?: Point | null);
26
+ get knowledge(): Statement[];
27
+ get objectDetails(): ObjectDetails[];
28
+ addKnowledge(statements: Statement[]): void;
29
+ addObjectDetails(object: CellDLObject): void;
30
+ moveDetails(position: MovePosition): UndoMovePosition;
31
+ startMove(controlIndex: number, position: PointLike): void;
32
+ endMove(controlIndex: number, position: PointLike): void;
33
+ }
34
+ declare class UndoRedo {
35
+ #private;
36
+ private constructor();
37
+ static get instance(): UndoRedo;
38
+ clean(): void;
39
+ redo(diagram: CellDLDiagram): void;
40
+ undo(diagram: CellDLDiagram): void;
41
+ undoDeleteAction(): EditorUndoAction;
42
+ undoInsertAction(): EditorUndoAction;
43
+ undoMoveAction(): EditorUndoAction;
44
+ }
45
+ export declare const undoRedo: UndoRedo;
46
+ export {};
@@ -0,0 +1,53 @@
1
+ import { CellDLConnection, CellDLObject } from '../celldlObjects/index';
2
+ import { EditorFrame } from '../editor/editorframe';
3
+ import { Point, PointLike } from '../../common/points';
4
+ import { StringProperties } from '../../common/types';
5
+ import { FixedValue, RestrictedPoint, RestrictedValue } from './index.ts';
6
+ export declare class ControlPoint extends RestrictedPoint {
7
+ #private;
8
+ constructor(xValue: RestrictedValue, yValue: RestrictedValue, celldlObject?: CellDLObject | null);
9
+ get celldlObject(): CellDLObject | null;
10
+ get fixed(): boolean;
11
+ get isConduit(): boolean;
12
+ static fromPoint(point: PointLike): ControlPoint;
13
+ static fromValue(x: number, y: number): ControlPoint;
14
+ colinear(p1: ControlPoint, p2: ControlPoint): boolean;
15
+ copy(): ControlPoint;
16
+ createSvgElement(editorFrame: EditorFrame, style?: string, connection?: CellDLConnection | null): SVGGraphicsElement;
17
+ removeSvgElement(): void;
18
+ reassignPosition(position: PointLike): void;
19
+ redraw(): boolean;
20
+ toString(): string;
21
+ }
22
+ export declare class FixedControlPoint extends ControlPoint {
23
+ readonly celldlObject: CellDLObject | null;
24
+ constructor(xValue: FixedValue, yValue: FixedValue, celldlObject?: CellDLObject | null);
25
+ copy(): FixedControlPoint;
26
+ toString(): string;
27
+ }
28
+ export declare class ControlRect {
29
+ #private;
30
+ constructor(corner_0: RestrictedPoint, corner_1: RestrictedPoint, centroidOffset?: Point | null);
31
+ set gridAligned(align: boolean);
32
+ get centroid(): RestrictedPoint;
33
+ get dirty(): boolean;
34
+ get fixed(): boolean;
35
+ get svgElement(): SVGRectElement | null;
36
+ get topLeftPoint(): Point;
37
+ clean(): void;
38
+ copy(): ControlRect;
39
+ setCornerPositions(corner_0: RestrictedPoint, corner_1: RestrictedPoint): void;
40
+ setCentroidOffset(centroidOffset: Point): void;
41
+ startMove(point: PointLike): void;
42
+ move(point: PointLike): void;
43
+ /**
44
+ * Reposition the rectangle.
45
+ *
46
+ * @param centroid - The new position of the rectangle's centroid.
47
+ */
48
+ reposition(centroid: PointLike): void;
49
+ svg(attributes?: StringProperties): string;
50
+ }
51
+ export declare class FixedControlRect extends ControlRect {
52
+ constructor(bounds: [number, number, number, number]);
53
+ }
@@ -0,0 +1,92 @@
1
+ import { GridAlignOptions } from '../editor/editguides';
2
+ import { Transform } from './transforms';
3
+ import { Point, PointLike } from '../../common/points';
4
+ export type PointMoveOptions = GridAlignOptions & {
5
+ noOffset?: boolean;
6
+ };
7
+ /**
8
+ * [left, top, width, height]
9
+ */
10
+ export type Extent = [number, number, number, number];
11
+ export declare class Bounds {
12
+ #private;
13
+ constructor(left: number, top: number, right: number, bottom: number);
14
+ get left(): number;
15
+ get right(): number;
16
+ get top(): number;
17
+ get bottom(): number;
18
+ static fromPoints(pt0: PointLike, pt1: PointLike): Bounds;
19
+ static fromSvg(svgElement: SVGGraphicsElement, globalTransform?: Transform | null): Bounds;
20
+ get height(): number;
21
+ get topLeft(): Point;
22
+ get width(): number;
23
+ asArray(): [number, number, number, number];
24
+ asPoints(): [Point, Point];
25
+ equal(bounds: Bounds, epsilon?: number): boolean;
26
+ expand(margin: number): Bounds;
27
+ inContainer(container: Bounds): boolean;
28
+ }
29
+ interface NumericRange {
30
+ minimum: number;
31
+ maximum: number;
32
+ }
33
+ export declare class RestrictedValue implements NumericRange {
34
+ #private;
35
+ readonly id: string;
36
+ constructor(value?: number, rangeStart?: number | RestrictedValue, rangeEnd?: number | RestrictedValue);
37
+ clean(): void;
38
+ get dirty(): boolean;
39
+ get fixed(): boolean;
40
+ get minimum(): number;
41
+ get maximum(): number;
42
+ get value(): number;
43
+ set value(value: number);
44
+ copy(): RestrictedValue;
45
+ adjustValue(delta: number): void;
46
+ narrowRange(minimum: number | RestrictedValue, maximum: number | RestrictedValue): void;
47
+ reassignMaximum(maximum: number | RestrictedValue): void;
48
+ reassignMinimum(minimum: number | RestrictedValue): void;
49
+ reassignValue(value: number): void;
50
+ toString(): string;
51
+ }
52
+ export declare class FixedValue extends RestrictedValue {
53
+ constructor(value: number);
54
+ get fixed(): boolean;
55
+ copy(): FixedValue;
56
+ narrowRange(_minimum: number, _maximum: number): void;
57
+ reassignValue(value: number): void;
58
+ }
59
+ export declare class ComputedValue extends RestrictedValue {
60
+ #private;
61
+ constructor(value: () => number, minimum?: number | RestrictedValue, maximum?: number | RestrictedValue);
62
+ get dirty(): boolean;
63
+ get value(): number;
64
+ set value(_: number);
65
+ }
66
+ export declare class RestrictedPoint {
67
+ #private;
68
+ constructor(xValue: RestrictedValue, yValue: RestrictedValue);
69
+ static fromPoint(point: PointLike): RestrictedPoint;
70
+ get dirty(): boolean;
71
+ get fixed(): boolean;
72
+ get point(): Point;
73
+ set point(point: PointLike);
74
+ get x(): number;
75
+ get y(): number;
76
+ get xValue(): RestrictedValue;
77
+ set xValue(value: RestrictedValue);
78
+ get yValue(): RestrictedValue;
79
+ set yValue(value: RestrictedValue);
80
+ clean(): void;
81
+ adjustValue(delta: PointLike): void;
82
+ copy(): RestrictedPoint;
83
+ move(point: PointLike, options?: PointMoveOptions): void;
84
+ offsetPoint(point: PointLike): Point;
85
+ reassignValue(point: PointLike): void;
86
+ startMove(point: PointLike): void;
87
+ toString(): string;
88
+ }
89
+ export declare class FixedPoint extends RestrictedPoint {
90
+ constructor(xValue: FixedValue, yValue: FixedValue);
91
+ }
92
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Point2D } from 'svg-intersections';
2
+ export declare class ShapeIntersections {
3
+ #private;
4
+ constructor(element: Element);
5
+ intersections(element: Element): Point2D[];
6
+ }
@@ -0,0 +1,12 @@
1
+ import { NormalArray } from 'svg-path-commander';
2
+ import { PointLike } from '../../common/points';
3
+ export type FoundPoint = {
4
+ point: PointLike;
5
+ offset: number | null;
6
+ segment: number | null;
7
+ };
8
+ export declare class PointFinder {
9
+ #private;
10
+ constructor(pathArray: NormalArray);
11
+ findPoint(point: PointLike): FoundPoint;
12
+ }
@@ -0,0 +1,22 @@
1
+ import { CellDLObject } from '../celldlObjects/index';
2
+ import { Bounds } from './index';
3
+ export type ContainedObject = {
4
+ object: CellDLObject;
5
+ exact: boolean;
6
+ };
7
+ export declare class CellDLSpatialIndex {
8
+ #private;
9
+ add(celldlObject: CellDLObject): void;
10
+ remove(celldlObject: CellDLObject): void;
11
+ update(celldlObject: CellDLObject): void;
12
+ objectsContainedIn(bounds: Bounds): ContainedObject[];
13
+ }
14
+ export type SpatialSearchResult = {
15
+ object: CellDLObject;
16
+ bounds: Bounds;
17
+ };
18
+ export declare class SpatialObjectIndex {
19
+ #private;
20
+ constructor(celldlObjects: CellDLObject[]);
21
+ search(bounds: Bounds): SpatialSearchResult[];
22
+ }
@@ -0,0 +1,21 @@
1
+ import { Matrix } from 'transformation-matrix';
2
+ import { Point, PointLike } from '../../common/points';
3
+ export declare class NormalTransform {
4
+ #private;
5
+ constructor(p0: PointLike, p1: PointLike);
6
+ normalise(point: PointLike): Point;
7
+ invert(point: PointLike): Point;
8
+ }
9
+ export declare class Transform {
10
+ #private;
11
+ constructor(matrix: Matrix);
12
+ static fromString(matrix: string): Transform;
13
+ static Identity(): Transform;
14
+ get isIdentity(): boolean;
15
+ inverse(): Transform;
16
+ leftMultiply(transform: Transform): Transform;
17
+ toString(): string;
18
+ transformPoint(point: PointLike): Point;
19
+ transformPoints(points: PointLike[]): Point[];
20
+ static Translate(tx: number, ty: number): Transform;
21
+ }
@@ -0,0 +1,23 @@
1
+ /******************************************************************************
2
+
3
+ CellDL Editor
4
+
5
+ Copyright (c) 2022 - 2025 David Brooks
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ ******************************************************************************/
20
+ export declare const EM_SIZE = 16;
21
+ export declare const EX_SIZE: number;
22
+ export declare function lengthToPixels(length: string | number | null): number | null;
23
+ export declare function pixelsToLength(pixels: string | number, units: string): string | null;