@dr2rai/raid-canvas 0.1.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.
@@ -0,0 +1,162 @@
1
+ /**
2
+ * @file types.ts
3
+ * @description Core ontological types, metamodel contracts, and SVG attributes
4
+ * for the RaidCanvas AOAIM visual modeler.
5
+ *
6
+ * Honors Alan Kay's vision of living, reactive object systems and Rainer Burkhardt's
7
+ * C++ GrafObj graphical object hierarchies.
8
+ */
9
+ /**
10
+ * Canonical AOAIM (Activity-Object-AI Model) entity archetypes.
11
+ *
12
+ * - 'uc' : UseCase (elliptical boundary, Cascais Net Gold accent)
13
+ * - 'act' : Activity (rounded rectangle process step, Heraldic Green accent)
14
+ * - 'cls' : Class (compartmentalized class specification card)
15
+ * - 'obj' : Object / Instance (runtime instance card with underlined title)
16
+ * - 'per' : Person / Actor (Initiating or Defined role stick-figure/card)
17
+ */
18
+ export type AimOntologyKind = 'uc' | 'act' | 'cls' | 'obj' | 'per';
19
+ /**
20
+ * Ontological relationship classifications in AOAIM.
21
+ */
22
+ export type AimEdgeKind = 'association' | 'dependency' | 'generalization' | 'realization' | 'aggregation' | 'composition';
23
+ /**
24
+ * 2D Cartesian coordinate pair for geometry and Manhattan orthogonal routing.
25
+ */
26
+ export interface Point {
27
+ readonly x: number;
28
+ readonly y: number;
29
+ }
30
+ /**
31
+ * Single bend point (vertex) along an orthogonal Manhattan edge path.
32
+ */
33
+ export interface SvgBendPoint {
34
+ readonly x: number;
35
+ readonly y: number;
36
+ }
37
+ /**
38
+ * 2D Bounding box for nodes and frames.
39
+ */
40
+ export interface Bounds {
41
+ readonly x: number;
42
+ readonly y: number;
43
+ readonly width: number;
44
+ readonly height: number;
45
+ }
46
+ /**
47
+ * Canonical port identifiers for 4-way orthogonal docking.
48
+ */
49
+ export type OrthogonalPortId = 'port-top' | 'port-right' | 'port-bottom' | 'port-left';
50
+ /**
51
+ * Metadata carried by an ontological node inside AntV X6.
52
+ */
53
+ export interface RaidNodeData {
54
+ /** Unique entity identifier in the metamodel (e.g., 'SignContract_UC'). */
55
+ readonly id: string;
56
+ /** Ontological kind of the node. */
57
+ readonly kind: AimOntologyKind;
58
+ /** Display label presented on the canvas. */
59
+ readonly displayName: string;
60
+ /** Optional ontological stereotype (e.g., '«initiates»', '«executes»'). */
61
+ readonly stereotype?: string;
62
+ /** Subtitle, frame, or namespace tag. */
63
+ readonly namespace?: string;
64
+ /** For 'cls' / 'obj': list of attribute or field declarations. */
65
+ readonly attributes?: readonly string[];
66
+ /** For 'cls': list of method or operation declarations. */
67
+ readonly methods?: readonly string[];
68
+ /** Spatial bounds of the node. */
69
+ readonly bounds: Bounds;
70
+ /** Custom extension properties passed from or serialized to .raid manifests. */
71
+ readonly properties?: Readonly<Record<string, unknown>>;
72
+ }
73
+ /**
74
+ * Metadata carried by an ontological edge inside AntV X6.
75
+ */
76
+ export interface RaidEdgeData {
77
+ /** Unique edge identifier. */
78
+ readonly id: string;
79
+ /** Ontological relationship type. */
80
+ readonly kind: AimEdgeKind;
81
+ /** Identifier of the source node. */
82
+ readonly sourceId: string;
83
+ /** Identifier of the target node. */
84
+ readonly targetId: string;
85
+ /** Optional docking port on source node. */
86
+ readonly sourcePort?: OrthogonalPortId | string;
87
+ /** Optional docking port on target node. */
88
+ readonly targetPort?: OrthogonalPortId | string;
89
+ /** Optional edge label text. */
90
+ readonly label?: string;
91
+ /** Optional edge stereotype annotation (e.g., '«DependsOn»'). */
92
+ readonly stereotype?: string;
93
+ /** Multiplicity / Cardinality at the source end (e.g., '1', '0..*'). */
94
+ readonly sourceCardinality?: string;
95
+ /** Multiplicity / Cardinality at the target end (e.g., '0..1', '*'). */
96
+ readonly targetCardinality?: string;
97
+ /** User-editable or router-computed Manhattan bend points. */
98
+ readonly bendPoints: readonly SvgBendPoint[];
99
+ }
100
+ /**
101
+ * Full in-memory metamodel representation corresponding to a `.raid` manifest.
102
+ */
103
+ export interface RaidMetamodel {
104
+ /** Diagram identifier (e.g., 'SignContract_UCD'). */
105
+ readonly diagramId: string;
106
+ /** Optional human-readable title. */
107
+ readonly title?: string;
108
+ /** Archetype classification (e.g., 'OneUseCaseDiagram', 'ClassDiagram', 'ActivityDiagram'). */
109
+ readonly archetype: string;
110
+ /** Entity nodes projected in the diagram. */
111
+ readonly nodes: readonly RaidNodeData[];
112
+ /** Relationships connecting projected nodes. */
113
+ readonly edges: readonly RaidEdgeData[];
114
+ /** Additional diagram-level metadata. */
115
+ readonly metadata?: Readonly<Record<string, unknown>>;
116
+ }
117
+ /**
118
+ * Contractual SVG attribute names adhering to the 'aim-*' standard.
119
+ */
120
+ export declare const AimSvgContract: {
121
+ readonly ATTR_NODE: 'aim-node';
122
+ readonly ATTR_ID: 'aim-id';
123
+ readonly ATTR_KIND: 'aim-kind';
124
+ readonly ATTR_DISPLAY_NAME: 'aim-display-name';
125
+ readonly ATTR_STEREOTYPE: 'aim-stereotype';
126
+ readonly ATTR_NAMESPACE: 'aim-namespace';
127
+ readonly ATTR_EDGE: 'aim-edge';
128
+ readonly ATTR_EDGE_KIND: 'aim-edge-kind';
129
+ readonly ATTR_SOURCE: 'aim-source';
130
+ readonly ATTR_TARGET: 'aim-target';
131
+ readonly ATTR_SOURCE_PORT: 'aim-source-port';
132
+ readonly ATTR_TARGET_PORT: 'aim-target-port';
133
+ readonly ATTR_BENDS: 'aim-bends';
134
+ readonly SELECTOR_NODE: '[aim-node], [data-node], g[aim-kind]';
135
+ readonly SELECTOR_EDGE: '[aim-edge], path[aim-edge-kind]';
136
+ };
137
+ /**
138
+ * Options for hydrating an AntV X6 graph from an SVG document.
139
+ */
140
+ export interface HydrationOptions {
141
+ /** If true, clears any existing graph elements before populating. Default: true. */
142
+ readonly clearGraph?: boolean;
143
+ /** If true, automatically executes Manhattan routing if bend points are missing. Default: true. */
144
+ readonly autoRouteEdges?: boolean;
145
+ /** Default fallback dimensions when width/height are unspecified in SVG. */
146
+ readonly defaultNodeSize?: {
147
+ readonly width: number;
148
+ readonly height: number;
149
+ };
150
+ }
151
+ /**
152
+ * Options for serializing an AntV X6 graph to an SVG document.
153
+ */
154
+ export interface SerializationOptions {
155
+ /** Base SVG template to inject updated coordinates and bend points into. */
156
+ readonly baseSvg?: string;
157
+ /** Pretty-print XML output with indentation. Default: true. */
158
+ readonly format?: boolean;
159
+ /** Inject Cascais design token CSS variables into `<defs><style>`. Default: true. */
160
+ readonly embedStyles?: boolean;
161
+ }
162
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,aAAa,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,aAAa,GAAG,WAAW,CAAC;AAEvF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B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AC,cAAc,CAAC,EAAE,OAAO,CAAC;IAElC,4EAA4E;IAC5E,QAAQ,CAAC,eAAe,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CAChF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAE1B,qFAAqF;IACrF,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC"}
package/dist/types.js ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file types.ts
3
+ * @description Core ontological types, metamodel contracts, and SVG attributes
4
+ * for the RaidCanvas AOAIM visual modeler.
5
+ *
6
+ * Honors Alan Kay's vision of living, reactive object systems and Rainer Burkhardt's
7
+ * C++ GrafObj graphical object hierarchies.
8
+ */
9
+ /**
10
+ * Contractual SVG attribute names adhering to the 'aim-*' standard.
11
+ */
12
+ export const AimSvgContract = {
13
+ // Node marking & attributes
14
+ ATTR_NODE: 'aim-node',
15
+ ATTR_ID: 'aim-id',
16
+ ATTR_KIND: 'aim-kind',
17
+ ATTR_DISPLAY_NAME: 'aim-display-name',
18
+ ATTR_STEREOTYPE: 'aim-stereotype',
19
+ ATTR_NAMESPACE: 'aim-namespace',
20
+ // Edge marking & attributes
21
+ ATTR_EDGE: 'aim-edge',
22
+ ATTR_EDGE_KIND: 'aim-edge-kind',
23
+ ATTR_SOURCE: 'aim-source',
24
+ ATTR_TARGET: 'aim-target',
25
+ ATTR_SOURCE_PORT: 'aim-source-port',
26
+ ATTR_TARGET_PORT: 'aim-target-port',
27
+ ATTR_BENDS: 'aim-bends',
28
+ // Selectors for DOM queries
29
+ SELECTOR_NODE: '[aim-node], [data-node], g[aim-kind]',
30
+ SELECTOR_EDGE: '[aim-edge], path[aim-edge-kind]',
31
+ };
32
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoJH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,4BAA4B;IAC5B,SAAS,EAAE,UAAU;IACrB,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,UAAU;IACrB,iBAAiB,EAAE,kBAAkB;IACrC,eAAe,EAAE,gBAAgB;IACjC,cAAc,EAAE,eAAe;IAE/B,4BAA4B;IAC5B,SAAS,EAAE,UAAU;IACrB,cAAc,EAAE,eAAe;IAC/B,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,YAAY;IACzB,gBAAgB,EAAE,iBAAiB;IACnC,gBAAgB,EAAE,iBAAiB;IACnC,UAAU,EAAE,WAAW;IAEvB,4BAA4B;IAC5B,aAAa,EAAE,sCAAsC;IACrD,aAAa,EAAE,iCAAiC;CACxC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@dr2rai/raid-canvas",
3
+ "version": "0.1.0",
4
+ "description": "Interactive AntV X6 diagram canvas for AOAIM (.raid) models and ontological SVG contracts",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./styles": "./src/styles/aoaim-theme.css",
16
+ "./styles/*": "./src/styles/*"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "src",
21
+ "README.md",
22
+ "LICENSE",
23
+ "NOTICE"
24
+ ],
25
+ "dependencies": {
26
+ "@antv/x6": "^2.18.1"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "^22.5.5",
30
+ "typescript": "^7.0.2"
31
+ },
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "license": "Apache-2.0",
36
+ "copyright": "© Rainer Burkhardt. All rights reserved.",
37
+ "scripts": {
38
+ "build": "tsc -b --force",
39
+ "typecheck": "tsc --noEmit",
40
+ "test": "node --test test/canvas.test.mjs"
41
+ }
42
+ }