Skip to content

Commit 997224d

Browse files
committed
"@ocwg/node/rect" instead of rect-node
1 parent 6bfbb75 commit 997224d

File tree

3 files changed

+42
-36
lines changed

3 files changed

+42
-36
lines changed

apps/vps-web/public/test-grid.ocif.json

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"ocif": "https://canvasprotocol.org/ocif/0.2",
2+
"ocif": "https://canvasprotocol.org/ocif/0.3",
33
"nodes": [
44
{
55
"id": "n1",
@@ -8,9 +8,9 @@
88
"resource": "r1",
99
"data": [
1010
{
11-
"type": "rect-node",
11+
"type": "@ocwg/node/rect",
1212
"strokeColor": "#FF5733",
13-
"strokeWidth": "4px",
13+
"strokeWidth": 4,
1414
"fillColor": "#C13D26"
1515
}
1616
]
@@ -22,9 +22,9 @@
2222
"resource": "r2",
2323
"data": [
2424
{
25-
"type": "rect-node",
25+
"type": "@ocwg/node/rect",
2626
"strokeColor": "#33FF57",
27-
"strokeWidth": "4px",
27+
"strokeWidth": 4,
2828
"fillColor": "#269E3D"
2929
}
3030
]
@@ -36,9 +36,9 @@
3636
"resource": "r3",
3737
"data": [
3838
{
39-
"type": "rect-node",
39+
"type": "@ocwg/node/rect",
4040
"strokeColor": "#3357FF",
41-
"strokeWidth": "4px",
41+
"strokeWidth": 4,
4242
"fillColor": "#263DA6"
4343
}
4444
]
@@ -50,9 +50,9 @@
5050
"resource": "r4",
5151
"data": [
5252
{
53-
"type": "rect-node",
53+
"type": "@ocwg/node/rect",
5454
"strokeColor": "#FF33A1",
55-
"strokeWidth": "4px",
55+
"strokeWidth": 4,
5656
"fillColor": "#A1266E"
5757
}
5858
]
@@ -64,9 +64,9 @@
6464
"resource": "r5",
6565
"data": [
6666
{
67-
"type": "rect-node",
67+
"type": "@ocwg/node/rect",
6868
"strokeColor": "#FFC733",
69-
"strokeWidth": "4px",
69+
"strokeWidth": 4,
7070
"fillColor": "#C19B26"
7171
}
7272
]
@@ -78,9 +78,9 @@
7878
"resource": "r6",
7979
"data": [
8080
{
81-
"type": "rect-node",
81+
"type": "@ocwg/node/rect",
8282
"strokeColor": "#8D33FF",
83-
"strokeWidth": "4px",
83+
"strokeWidth": 4,
8484
"fillColor": "#6626A6"
8585
}
8686
]
@@ -92,9 +92,9 @@
9292
"resource": "r7",
9393
"data": [
9494
{
95-
"type": "rect-node",
95+
"type": "@ocwg/node/rect",
9696
"strokeColor": "#33FFF6",
97-
"strokeWidth": "4px",
97+
"strokeWidth": 4,
9898
"fillColor": "#269EB5"
9999
}
100100
]
@@ -106,9 +106,9 @@
106106
"resource": "r8",
107107
"data": [
108108
{
109-
"type": "rect-node",
109+
"type": "@ocwg/node/rect",
110110
"strokeColor": "#FFB733",
111-
"strokeWidth": "4px",
111+
"strokeWidth": 4,
112112
"fillColor": "#C18A26"
113113
}
114114
]
@@ -120,9 +120,9 @@
120120
"resource": "r9",
121121
"data": [
122122
{
123-
"type": "rect-node",
123+
"type": "@ocwg/node/rect",
124124
"strokeColor": "#33FFB7",
125-
"strokeWidth": "4px",
125+
"strokeWidth": 4,
126126
"fillColor": "#269E85"
127127
}
128128
]
@@ -134,9 +134,9 @@
134134
"resource": "r10",
135135
"data": [
136136
{
137-
"type": "rect-node",
137+
"type": "@ocwg/node/rect",
138138
"strokeColor": "#A1FF33",
139-
"strokeWidth": "4px",
139+
"strokeWidth": 4,
140140
"fillColor": "#6EA626"
141141
}
142142
]
@@ -148,9 +148,9 @@
148148
"resource": "r11",
149149
"data": [
150150
{
151-
"type": "rect-node",
151+
"type": "@ocwg/node/rect",
152152
"strokeColor": "#FF338D",
153-
"strokeWidth": "4px",
153+
"strokeWidth": 4,
154154
"fillColor": "#A62663"
155155
}
156156
]
@@ -162,9 +162,9 @@
162162
"resource": "r12",
163163
"data": [
164164
{
165-
"type": "rect-node",
165+
"type": "@ocwg/node/rect",
166166
"strokeColor": "#33A1FF",
167-
"strokeWidth": "4px",
167+
"strokeWidth": 4,
168168
"fillColor": "#2672A6"
169169
}
170170
]
@@ -176,9 +176,9 @@
176176
"resource": "r13",
177177
"data": [
178178
{
179-
"type": "rect-node",
179+
"type": "@ocwg/node/rect",
180180
"strokeColor": "#F633FF",
181-
"strokeWidth": "4px",
181+
"strokeWidth": 4,
182182
"fillColor": "#B526C1"
183183
}
184184
]
@@ -190,9 +190,9 @@
190190
"resource": "r14",
191191
"data": [
192192
{
193-
"type": "rect-node",
193+
"type": "@ocwg/node/rect",
194194
"strokeColor": "#FF9E33",
195-
"strokeWidth": "4px",
195+
"strokeWidth": 4,
196196
"fillColor": "#C17826"
197197
}
198198
]
@@ -204,9 +204,9 @@
204204
"resource": "r15",
205205
"data": [
206206
{
207-
"type": "rect-node",
207+
"type": "@ocwg/node/rect",
208208
"strokeColor": "#33FF73",
209-
"strokeWidth": "4px",
209+
"strokeWidth": 4,
210210
"fillColor": "#269E53"
211211
}
212212
]
@@ -218,9 +218,9 @@
218218
"resource": "r16",
219219
"data": [
220220
{
221-
"type": "rect-node",
221+
"type": "@ocwg/node/rect",
222222
"strokeColor": "#FF33E4",
223-
"strokeWidth": "4px",
223+
"strokeWidth": 4,
224224
"fillColor": "#A626AB"
225225
}
226226
]

libs/app-canvas/src/app/exporters/export-ocwg.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ export class OCWGExporter extends BaseExporter<OCWGFile, OCWGInfo> {
3636

3737
isOCIFNodeThatCodeFlowCanvasSupports(node: any): boolean {
3838
if (node.data && Array.isArray(node.data)) {
39-
const result = node.data.some((d: any) => d.type === 'rect-node');
39+
const result = node.data.some(
40+
(d: any) => d.type === 'rect-node' || d.type === '@ocwg/node/rect'
41+
);
4042
if (result) {
4143
return true;
4244
}

libs/app-canvas/src/app/importers/ocif-importer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ function isSupportedOCIFNode(ocifNode: any): boolean {
1212
return (
1313
ocifNode.data &&
1414
Array.isArray(ocifNode.data) &&
15-
ocifNode.data.some((d: any) => d.type === 'rect-node')
15+
ocifNode.data.some(
16+
(d: any) => d.type === 'rect-node' || d.type === '@ocwg/node/rect'
17+
)
1618
);
1719
}
1820

@@ -128,7 +130,9 @@ export const importOCIF = (ocif: any) => {
128130
});
129131
}
130132
} else if (node.data && isSupportedOCIFNode(node)) {
131-
const data = getExtenstionData(node, 'rect-node');
133+
const data =
134+
getExtenstionData(node, 'rect-node') ??
135+
getExtenstionData(node, '@ocwg/node/rect');
132136
let text = '';
133137
const resource = getResourceById(ocif, node.resource);
134138
if (resource) {

0 commit comments

Comments
 (0)