kymostudio 0.1.0 → 0.2.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.
- package/README.md +52 -29
- package/dist/bpmn-shapes.d.ts +15 -0
- package/dist/bpmn-shapes.d.ts.map +1 -0
- package/dist/bpmn-shapes.js +344 -0
- package/dist/bpmn-shapes.js.map +1 -0
- package/dist/from-bpmn.d.ts +15 -0
- package/dist/from-bpmn.d.ts.map +1 -0
- package/dist/from-bpmn.js +228 -0
- package/dist/from-bpmn.js.map +1 -0
- package/dist/icons-builtin.d.ts +14 -0
- package/dist/icons-builtin.d.ts.map +1 -0
- package/{src/js → dist}/icons-builtin.js +70 -115
- package/dist/icons-builtin.js.map +1 -0
- package/dist/icons-loader.d.ts +29 -0
- package/dist/icons-loader.d.ts.map +1 -0
- package/dist/icons-loader.js +88 -0
- package/dist/icons-loader.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/model.d.ts +166 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/model.js +165 -0
- package/dist/model.js.map +1 -0
- package/dist/render.d.ts +27 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +161 -0
- package/dist/render.js.map +1 -0
- package/dist/xml.d.ts +22 -0
- package/dist/xml.d.ts.map +1 -0
- package/dist/xml.js +116 -0
- package/dist/xml.js.map +1 -0
- package/package.json +29 -11
- package/src/js/icons-loader.js +0 -91
- package/src/js/index.js +0 -13
- package/src/js/model.js +0 -176
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hand-coded SVG icon library — JS mirror of `src/icons.py`.
|
|
2
|
+
* Hand-coded SVG icon library — JS mirror of `packages/python/src/kymo/icons.py`.
|
|
3
3
|
*
|
|
4
4
|
* Each entry in `ICONS` is an SVG fragment centred at (0, 0). The
|
|
5
5
|
* renderer wraps it in a `<g transform="translate(cx, cy)">`. Helper
|
|
@@ -10,39 +10,32 @@
|
|
|
10
10
|
* The file-backed icons (icons/<provider>/<name>.png) live in
|
|
11
11
|
* `icons-loader.js`.
|
|
12
12
|
*/
|
|
13
|
-
|
|
14
13
|
// ── Numeric formatter ─────────────────────────────────────────────────
|
|
15
14
|
function r(x) {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const s = x.toFixed(2);
|
|
16
|
+
return s.replace(/\.?0+$/, "");
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
// ── Isometric cube (NVIDIA green) ─────────────────────────────────────
|
|
21
19
|
function _cube(innerUnit, size = 80) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
`<g class="icon-shadow" transform="translate(-${h},-${h})">` +
|
|
35
|
-
`<polygon points="${p["50"]},${p["06"]} ${p["94"]},${p["28"]} ${p["50"]},${p["49"]} ${p["06"]},${p["28"]}" ` +
|
|
20
|
+
const s = size;
|
|
21
|
+
const h = (s / 2) | 0;
|
|
22
|
+
const a = r(s * 0.44);
|
|
23
|
+
const b = r(s * 0.21);
|
|
24
|
+
const d = r(s * 0.44);
|
|
25
|
+
const e = r(s * 0.06);
|
|
26
|
+
const f = r(s * 0.28);
|
|
27
|
+
const p = Object.fromEntries([["06", 0.06], ["28", 0.28], ["49", 0.49], ["72", 0.72], ["94", 0.94], ["50", 0.50]]
|
|
28
|
+
.map(([k, v]) => [k, r(s * v)]));
|
|
29
|
+
return (`<g class="icon-shadow" transform="translate(-${h},-${h})">` +
|
|
30
|
+
`<polygon points="${p["50"]},${p["06"]} ${p["94"]},${p["28"]} ${p["50"]},${p["49"]} ${p["06"]},${p["28"]}" ` +
|
|
36
31
|
`fill="url(#g-face-top)" stroke="#3d5d00" stroke-width="1"/>` +
|
|
37
|
-
|
|
32
|
+
`<polygon points="${p["50"]},${p["49"]} ${p["94"]},${p["28"]} ${p["94"]},${p["72"]} ${p["50"]},${p["94"]}" ` +
|
|
38
33
|
`fill="url(#g-face-side)" stroke="#3d5d00" stroke-width="1"/>` +
|
|
39
|
-
|
|
34
|
+
`<polygon points="${p["06"]},${p["28"]} ${p["50"]},${p["49"]} ${p["50"]},${p["94"]} ${p["06"]},${p["72"]}" ` +
|
|
40
35
|
`fill="url(#g-face-front)" stroke="#3d5d00" stroke-width="1"/>` +
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
);
|
|
36
|
+
`<g transform="matrix(${a},${b},0,${d},${e},${f})" stroke-linejoin="round">${innerUnit}</g>` +
|
|
37
|
+
`</g>`);
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
// ── Inner cube glyphs (unit space) ────────────────────────────────────
|
|
47
40
|
const _NOTEBOOK_GLYPH = `
|
|
48
41
|
<g stroke="white" stroke-width="0.045" stroke-linecap="round" fill="none">
|
|
@@ -51,7 +44,6 @@ const _NOTEBOOK_GLYPH = `
|
|
|
51
44
|
<line x1="0.18" y1="0.72" x2="0.60" y2="0.72"/>
|
|
52
45
|
</g>
|
|
53
46
|
`;
|
|
54
|
-
|
|
55
47
|
const _DOCKER_GLYPH = `
|
|
56
48
|
<g fill="white">
|
|
57
49
|
<rect x="0.10" y="0.30" width="0.34" height="0.18"/>
|
|
@@ -60,7 +52,6 @@ const _DOCKER_GLYPH = `
|
|
|
60
52
|
<rect x="0.56" y="0.56" width="0.34" height="0.18"/>
|
|
61
53
|
</g>
|
|
62
54
|
`;
|
|
63
|
-
|
|
64
55
|
const _NEURAL_GLYPH = `
|
|
65
56
|
<g stroke="white" stroke-width="0.032" fill="white">
|
|
66
57
|
<line x1="0.50" y1="0.50" x2="0.20" y2="0.22"/>
|
|
@@ -74,7 +65,6 @@ const _NEURAL_GLYPH = `
|
|
|
74
65
|
<circle cx="0.80" cy="0.78" r="0.055"/>
|
|
75
66
|
</g>
|
|
76
67
|
`;
|
|
77
|
-
|
|
78
68
|
const _HEX_NET_GLYPH = `
|
|
79
69
|
<g stroke="white" stroke-width="0.04" fill="white">
|
|
80
70
|
<line x1="0.50" y1="0.20" x2="0.20" y2="0.50"/>
|
|
@@ -89,29 +79,23 @@ const _HEX_NET_GLYPH = `
|
|
|
89
79
|
<circle cx="0.50" cy="0.80" r="0.055"/>
|
|
90
80
|
</g>
|
|
91
81
|
`;
|
|
92
|
-
|
|
93
82
|
// ── Flat orange box wrapper ───────────────────────────────────────────
|
|
94
83
|
function _box(inner) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`<rect x="-35" y="-35" width="70" height="70" rx="8" ` +
|
|
84
|
+
return (`<g class="icon-shadow">` +
|
|
85
|
+
`<rect x="-35" y="-35" width="70" height="70" rx="8" ` +
|
|
98
86
|
`fill="url(#g-box-orange)" stroke="#c2410c" stroke-width="1.5"/>` +
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
);
|
|
87
|
+
`${inner}` +
|
|
88
|
+
`</g>`);
|
|
102
89
|
}
|
|
103
|
-
|
|
104
90
|
const _SEND_GLYPH = `
|
|
105
91
|
<g transform="translate(-13, -13)">
|
|
106
92
|
<line x1="28" y1="2" x2="13" y2="17" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
107
93
|
<polygon points="28,2 21,28 13,17 2,11 28,2" fill="white" stroke="white" stroke-width="1.2" stroke-linejoin="round"/>
|
|
108
94
|
</g>
|
|
109
95
|
`;
|
|
110
|
-
|
|
111
96
|
const _ZAP_GLYPH = `
|
|
112
97
|
<polygon points="2,-18 -12,4 -1,4 -3,18 11,-4 0,-4 2,-18" fill="white" stroke="white" stroke-width="1.2" stroke-linejoin="round"/>
|
|
113
98
|
`;
|
|
114
|
-
|
|
115
99
|
const _ARCHIVE_GLYPH = `
|
|
116
100
|
<g transform="translate(0,-2)">
|
|
117
101
|
<rect x="-20" y="-15" width="40" height="9" rx="2" fill="white"/>
|
|
@@ -119,12 +103,10 @@ const _ARCHIVE_GLYPH = `
|
|
|
119
103
|
<line x1="-6" y1="3" x2="6" y2="3" stroke="white" stroke-width="2" stroke-linecap="round"/>
|
|
120
104
|
</g>
|
|
121
105
|
`;
|
|
122
|
-
|
|
123
106
|
const _CLOUD_GLYPH = `
|
|
124
107
|
<path d="M -10,12 a 12,12 0 1 1 5,-23 a 16,16 0 0 1 22,15 a 9,9 0 0 1 -2,17 H -10 a 9,9 0 0 1 0,-9 z"
|
|
125
108
|
fill="white" stroke="white" stroke-width="1" stroke-linejoin="round"/>
|
|
126
109
|
`;
|
|
127
|
-
|
|
128
110
|
// ── Standalone shapes ─────────────────────────────────────────────────
|
|
129
111
|
const _USER_CIRCLE = `
|
|
130
112
|
<g class="icon-shadow">
|
|
@@ -133,7 +115,6 @@ const _USER_CIRCLE = `
|
|
|
133
115
|
<path d="M -18,20 a 18,14 0 0 1 36,0 z" fill="white"/>
|
|
134
116
|
</g>
|
|
135
117
|
`;
|
|
136
|
-
|
|
137
118
|
const _CYLINDER = `
|
|
138
119
|
<g class="icon-shadow" transform="translate(-35, -35)">
|
|
139
120
|
<ellipse cx="35" cy="12" rx="28" ry="8" fill="#fdba74" stroke="#c2410c" stroke-width="1.4"/>
|
|
@@ -143,7 +124,6 @@ const _CYLINDER = `
|
|
|
143
124
|
<path d="M 7,42 a 28,8 0 0 0 56,0" fill="none" stroke="#c2410c" stroke-width="0.8" opacity="0.55"/>
|
|
144
125
|
</g>
|
|
145
126
|
`;
|
|
146
|
-
|
|
147
127
|
const _KEY = `
|
|
148
128
|
<g stroke="#d97706" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
|
149
129
|
<circle cx="-10" cy="0" r="6" fill="#fff4e0"/>
|
|
@@ -152,7 +132,6 @@ const _KEY = `
|
|
|
152
132
|
<line x1="16" y1="-2" x2="16" y2="5"/>
|
|
153
133
|
</g>
|
|
154
134
|
`;
|
|
155
|
-
|
|
156
135
|
const _HEX_AGENT = `
|
|
157
136
|
<g class="icon-shadow">
|
|
158
137
|
<polygon points="-30,-17 0,-32 30,-17 30,17 0,32 -30,17"
|
|
@@ -164,7 +143,6 @@ const _HEX_AGENT = `
|
|
|
164
143
|
<path d="M -4,6 L 0,12 L 4,6" fill="#e9f5d0" stroke="none"/>
|
|
165
144
|
</g>
|
|
166
145
|
`;
|
|
167
|
-
|
|
168
146
|
// ── More _box-inner glyphs ────────────────────────────────────────────
|
|
169
147
|
const _GEAR_GLYPH = `
|
|
170
148
|
<g fill="white" stroke="white" stroke-width="1.4" stroke-linejoin="round">
|
|
@@ -176,13 +154,11 @@ const _GEAR_GLYPH = `
|
|
|
176
154
|
<circle cx="2" cy="-2" r="4" fill="#f59e0b" stroke="#f59e0b"/>
|
|
177
155
|
</g>
|
|
178
156
|
`;
|
|
179
|
-
|
|
180
157
|
const _FOLDER_GLYPH = `
|
|
181
158
|
<g fill="white" stroke="white" stroke-width="1.2" stroke-linejoin="round">
|
|
182
159
|
<path d="M -22,-12 L -8,-12 L -4,-7 L 22,-7 L 22,16 L -22,16 Z"/>
|
|
183
160
|
</g>
|
|
184
161
|
`;
|
|
185
|
-
|
|
186
162
|
const _FILES_STACK = `
|
|
187
163
|
<g fill="white" stroke="white" stroke-width="1.2" stroke-linejoin="round">
|
|
188
164
|
<rect x="-18" y="-18" width="20" height="26" rx="2" fill="white" opacity="0.6"/>
|
|
@@ -192,7 +168,6 @@ const _FILES_STACK = `
|
|
|
192
168
|
<line x1="-3" y1="9" x2="6" y2="9" stroke="#d97706" stroke-width="1.2"/>
|
|
193
169
|
</g>
|
|
194
170
|
`;
|
|
195
|
-
|
|
196
171
|
const _CHECKLIST_GLYPH = `
|
|
197
172
|
<g stroke="#94a3b8" fill="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
198
173
|
<rect x="-22" y="-22" width="44" height="44" rx="2" fill="white"/>
|
|
@@ -204,7 +179,6 @@ const _CHECKLIST_GLYPH = `
|
|
|
204
179
|
<line x1="-4" y1="11" x2="14" y2="11" stroke="#94a3b8"/>
|
|
205
180
|
</g>
|
|
206
181
|
`;
|
|
207
|
-
|
|
208
182
|
const _MAGNIFIER_GLYPH = `
|
|
209
183
|
<g fill="none" stroke="white" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
210
184
|
<circle cx="-3" cy="-3" r="11" fill="white" stroke="white" stroke-width="0"/>
|
|
@@ -212,35 +186,29 @@ const _MAGNIFIER_GLYPH = `
|
|
|
212
186
|
<line x1="5" y1="5" x2="14" y2="14" stroke="white" stroke-width="4"/>
|
|
213
187
|
</g>
|
|
214
188
|
`;
|
|
215
|
-
|
|
216
189
|
// ── Halo wrapper ──────────────────────────────────────────────────────
|
|
217
190
|
function _halo(inner, size = 124) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
191
|
+
const s = (size / 2) | 0;
|
|
192
|
+
return `<circle r="${s}" fill="#76b900" opacity="0.10"/>` +
|
|
193
|
+
`<circle r="${s - 6}" fill="#76b900" opacity="0.08"/>` +
|
|
194
|
+
`${inner}`;
|
|
222
195
|
}
|
|
223
|
-
|
|
224
196
|
// ── AWS-style coloured tile ───────────────────────────────────────────
|
|
225
197
|
function _awsTile(color, dark, glyph, hero = false) {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
`<rect x="-${h}" y="-${h}" width="${size}" height="${size}" rx="10" ` +
|
|
198
|
+
const size = hero ? 80 : 64;
|
|
199
|
+
const h = (size / 2) | 0;
|
|
200
|
+
return (`<g class="icon-shadow">` +
|
|
201
|
+
`<rect x="-${h}" y="-${h}" width="${size}" height="${size}" rx="10" ` +
|
|
231
202
|
`fill="${color}" stroke="${dark}" stroke-width="1.4"/>` +
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
);
|
|
203
|
+
`${glyph}` +
|
|
204
|
+
`</g>`);
|
|
235
205
|
}
|
|
236
|
-
|
|
237
206
|
const _AMPLIFY_GLYPH = `
|
|
238
207
|
<g fill="white" stroke="none">
|
|
239
208
|
<path d="M -14,12 L -3,-12 L 3,-12 L 14,12 L 7,12 L 4,5 L -4,5 L -7,12 Z"/>
|
|
240
209
|
<path d="M -1,-1 L 1,-1 L 2,2 L -2,2 Z"/>
|
|
241
210
|
</g>
|
|
242
211
|
`;
|
|
243
|
-
|
|
244
212
|
const _LEX_GLYPH = `
|
|
245
213
|
<g fill="white" stroke="none">
|
|
246
214
|
<path d="M -14,-8 a 4,4 0 0 1 4,-4 H 10 a 4,4 0 0 1 4,4 V 4 a 4,4 0 0 1 -4,4 H -2 L -8,14 V 8 H -10 a 4,4 0 0 1 -4,-4 Z"/>
|
|
@@ -249,18 +217,15 @@ const _LEX_GLYPH = `
|
|
|
249
217
|
<circle cx="6" cy="-2" r="1.6" fill="#C925D1"/>
|
|
250
218
|
</g>
|
|
251
219
|
`;
|
|
252
|
-
|
|
253
220
|
const _LAMBDA_GLYPH = `
|
|
254
221
|
<text x="0" y="11" text-anchor="middle"
|
|
255
222
|
style="font-size:38px;font-weight:700;fill:white;font-family:Georgia,serif">λ</text>
|
|
256
223
|
`;
|
|
257
|
-
|
|
258
224
|
const _CONNECT_GLYPH = `
|
|
259
225
|
<g fill="white" stroke="none">
|
|
260
226
|
<path d="M -12,-8 q 0,-4 4,-4 l 4,0 q 3,0 4,3 l 1,4 q 1,3 -2,5 l -3,2 q 3,6 9,9 l 2,-3 q 2,-3 5,-2 l 4,1 q 3,1 3,4 l 0,4 q 0,4 -4,4 q -16,0 -27,-11 q -11,-11 -11,-16 z"/>
|
|
261
227
|
</g>
|
|
262
228
|
`;
|
|
263
|
-
|
|
264
229
|
const _DYNAMODB_GLYPH = `
|
|
265
230
|
<g fill="white" stroke="white" stroke-width="0" stroke-linejoin="round">
|
|
266
231
|
<ellipse cx="0" cy="-9" rx="12" ry="3.5"/>
|
|
@@ -271,7 +236,6 @@ const _DYNAMODB_GLYPH = `
|
|
|
271
236
|
<path d="M -12,9 V 12 a 12,3.5 0 0 0 24,0 V 9" fill="white"/>
|
|
272
237
|
</g>
|
|
273
238
|
`;
|
|
274
|
-
|
|
275
239
|
const _BEDROCK_GLYPH = `
|
|
276
240
|
<g fill="white" stroke="white" stroke-width="1.6" stroke-linecap="round">
|
|
277
241
|
<circle cx="0" cy="0" r="3.5" fill="white"/>
|
|
@@ -285,7 +249,6 @@ const _BEDROCK_GLYPH = `
|
|
|
285
249
|
<line x1="7" y1="5" x2="2" y2="1"/>
|
|
286
250
|
</g>
|
|
287
251
|
`;
|
|
288
|
-
|
|
289
252
|
const _S3_GLYPH = `
|
|
290
253
|
<g fill="white" stroke="none">
|
|
291
254
|
<path d="M -12,-8 L 12,-8 L 10,12 a 2,2 0 0 1 -2,2 L -8,14 a 2,2 0 0 1 -2,-2 Z"/>
|
|
@@ -293,14 +256,12 @@ const _S3_GLYPH = `
|
|
|
293
256
|
<ellipse cx="0" cy="-8" rx="12" ry="3" fill="none" stroke="white" stroke-width="1.2"/>
|
|
294
257
|
</g>
|
|
295
258
|
`;
|
|
296
|
-
|
|
297
259
|
const _KENDRA_GLYPH = `
|
|
298
260
|
<g fill="none" stroke="white" stroke-width="2.5" stroke-linecap="round">
|
|
299
261
|
<circle cx="-3" cy="-3" r="8"/>
|
|
300
262
|
<line x1="3" y1="3" x2="11" y2="11"/>
|
|
301
263
|
</g>
|
|
302
264
|
`;
|
|
303
|
-
|
|
304
265
|
const _CUSTOMER_PERSON = `
|
|
305
266
|
<g class="icon-shadow">
|
|
306
267
|
<circle r="34" fill="url(#g-user-blue)"/>
|
|
@@ -308,7 +269,6 @@ const _CUSTOMER_PERSON = `
|
|
|
308
269
|
<path d="M -16,18 a 16,12 0 0 1 32,0 z" fill="white"/>
|
|
309
270
|
</g>
|
|
310
271
|
`;
|
|
311
|
-
|
|
312
272
|
const _INTERNET_CLOUD = `
|
|
313
273
|
<g class="icon-shadow">
|
|
314
274
|
<path d="M -22,8 a 14,14 0 1 1 6,-26 a 18,18 0 0 1 26,16 a 11,11 0 0 1 -3,21 H -22 a 11,11 0 0 1 -7,-11 z"
|
|
@@ -317,7 +277,6 @@ const _INTERNET_CLOUD = `
|
|
|
317
277
|
style="font-size:9.5px;font-weight:700;fill:#1d4ed8;letter-spacing:0.05em">WWW</text>
|
|
318
278
|
</g>
|
|
319
279
|
`;
|
|
320
|
-
|
|
321
280
|
const _SLACK_BADGE = `
|
|
322
281
|
<g class="icon-shadow">
|
|
323
282
|
<rect x="-16" y="-16" width="32" height="32" rx="7" fill="white" stroke="#cbd5e1" stroke-width="1"/>
|
|
@@ -329,14 +288,12 @@ const _SLACK_BADGE = `
|
|
|
329
288
|
</g>
|
|
330
289
|
</g>
|
|
331
290
|
`;
|
|
332
|
-
|
|
333
291
|
const _PLUS_MARK = `
|
|
334
292
|
<g fill="#475569" stroke="#475569" stroke-width="2" stroke-linecap="round">
|
|
335
293
|
<line x1="-6" y1="0" x2="6" y2="0"/>
|
|
336
294
|
<line x1="0" y1="-6" x2="0" y2="6"/>
|
|
337
295
|
</g>
|
|
338
296
|
`;
|
|
339
|
-
|
|
340
297
|
const _AWS_LOGO = `
|
|
341
298
|
<g class="icon-shadow">
|
|
342
299
|
<rect x="-18" y="-18" width="36" height="36" rx="4" fill="#232f3e"/>
|
|
@@ -345,7 +302,6 @@ const _AWS_LOGO = `
|
|
|
345
302
|
<path d="M -9,8 Q 0,13 9,8" fill="none" stroke="#ff9900" stroke-width="1.8" stroke-linecap="round"/>
|
|
346
303
|
</g>
|
|
347
304
|
`;
|
|
348
|
-
|
|
349
305
|
const _SITE_GLOBE = `
|
|
350
306
|
<g fill="none" stroke="#475569" stroke-width="1.4" stroke-linecap="round">
|
|
351
307
|
<circle r="9"/>
|
|
@@ -353,47 +309,46 @@ const _SITE_GLOBE = `
|
|
|
353
309
|
<line x1="-9" y1="0" x2="9" y2="0"/>
|
|
354
310
|
</g>
|
|
355
311
|
`;
|
|
356
|
-
|
|
357
312
|
function _stepBadge(n) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
313
|
+
return `<circle r="14" fill="#fff4e0" stroke="#d97706" stroke-width="1.8"/>` +
|
|
314
|
+
`<text x="0" y="4.5" text-anchor="middle" ` +
|
|
315
|
+
`style="font-size:14px;font-weight:700;fill:#92400e">${n}</text>`;
|
|
361
316
|
}
|
|
362
|
-
|
|
363
317
|
// ── Public registry ───────────────────────────────────────────────────
|
|
364
318
|
export const ICONS = {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
319
|
+
"user": _USER_CIRCLE,
|
|
320
|
+
"notebook": _cube(_NOTEBOOK_GLYPH),
|
|
321
|
+
"boxes": _cube(_DOCKER_GLYPH),
|
|
322
|
+
"neural": _halo(_cube(_NEURAL_GLYPH, 100)),
|
|
323
|
+
"neural-sm": _cube(_HEX_NET_GLYPH),
|
|
324
|
+
"send": _box(_SEND_GLYPH),
|
|
325
|
+
"zap": _box(_ZAP_GLYPH),
|
|
326
|
+
"archive": _box(_ARCHIVE_GLYPH),
|
|
327
|
+
"cloud": _box(_CLOUD_GLYPH),
|
|
328
|
+
"cylinder": _CYLINDER,
|
|
329
|
+
"key": _KEY,
|
|
330
|
+
"hex-agent": _HEX_AGENT,
|
|
331
|
+
"gear": _box(_GEAR_GLYPH),
|
|
332
|
+
"folder": _box(_FOLDER_GLYPH),
|
|
333
|
+
"files": _box(_FILES_STACK),
|
|
334
|
+
"checklist": _box(_CHECKLIST_GLYPH),
|
|
335
|
+
"magnifier": _box(_MAGNIFIER_GLYPH),
|
|
336
|
+
"aws-amplify": _awsTile("#DD344C", "#a31836", _AMPLIFY_GLYPH),
|
|
337
|
+
"aws-lex": _awsTile("#C925D1", "#8a1690", _LEX_GLYPH),
|
|
338
|
+
"aws-lambda": _awsTile("#ED7100", "#a44a00", _LAMBDA_GLYPH, true),
|
|
339
|
+
"aws-connect": _awsTile("#DD344C", "#a31836", _CONNECT_GLYPH),
|
|
340
|
+
"aws-dynamodb": _awsTile("#4D72F3", "#2a4ec2", _DYNAMODB_GLYPH),
|
|
341
|
+
"aws-bedrock": _awsTile("#01A88D", "#017364", _BEDROCK_GLYPH),
|
|
342
|
+
"aws-s3": _awsTile("#7AA116", "#506b0e", _S3_GLYPH),
|
|
343
|
+
"aws-kendra": _awsTile("#C925D1", "#8a1690", _KENDRA_GLYPH),
|
|
344
|
+
"customer-person": _CUSTOMER_PERSON,
|
|
345
|
+
"internet-cloud": _INTERNET_CLOUD,
|
|
346
|
+
"step-1": _stepBadge(1),
|
|
347
|
+
"step-2": _stepBadge(2),
|
|
348
|
+
"step-3": _stepBadge(3),
|
|
349
|
+
"aws-logo": _AWS_LOGO,
|
|
350
|
+
"site-globe": _SITE_GLOBE,
|
|
351
|
+
"slack": _SLACK_BADGE,
|
|
352
|
+
"plus": _PLUS_MARK,
|
|
399
353
|
};
|
|
354
|
+
//# sourceMappingURL=icons-builtin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons-builtin.js","sourceRoot":"","sources":["../src/icons-builtin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,yEAAyE;AACzE,SAAS,CAAC,CAAC,CAAS;IAClB,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAED,yEAAyE;AACzE,S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C/B,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC;IACnC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC;IACnC,aAAa,EAAG,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9D,SAAS,EAAO,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC;IAC1D,YAAY,EAAI,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC;IACnE,aAAa,EAAG,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9D,cAAc,EAAE,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC;IAC/D,aAAa,EAAG,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9D,QAAQ,EAAQ,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;IACzD,YAAY,EAAI,QAAQ,CAAC,SAAS,EAAE,SAAS,EAAE,aAAa,CAAC;IAC7D,iBAAiB,EAAE,gBAAgB;IACnC,gBAAgB,EAAG,eAAe;IAClC,QAAQ,EAAM,UAAU,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAM,UAAU,CAAC,CAAC,CAAC;IAC3B,QAAQ,EAAM,UAAU,CAAC,CAAC,CAAC;IAC3B,UAAU,EAAK,SAAS;IACxB,YAAY,EAAG,WAAW;IAC1B,OAAO,EAAQ,YAAY;IAC3B,MAAM,EAAS,UAAU;CAC1B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon loader — JS mirror of `packages/python/src/kymo/icons.py:get_icon`.
|
|
3
|
+
*
|
|
4
|
+
* Built-in glyphs (from `icons-builtin.ts`) are returned synchronously
|
|
5
|
+
* wrapped in `Promise.resolve()`. File-backed PNG icons are resolved
|
|
6
|
+
* lazily: on first request the manifest is fetched, then the PNG bytes
|
|
7
|
+
* are fetched and embedded as a base64 `<image>` tag inside an SVG
|
|
8
|
+
* fragment. Subsequent lookups are cache hits.
|
|
9
|
+
*
|
|
10
|
+
* Configure the base URL with `setIconBaseURL(url)` before the first
|
|
11
|
+
* call — defaults to `""` (paths are relative to the page).
|
|
12
|
+
*/
|
|
13
|
+
import { ICONS } from "./icons-builtin.js";
|
|
14
|
+
type Manifest = Record<string, string>;
|
|
15
|
+
/** Set the URL prefix used to fetch the manifest + icon files. */
|
|
16
|
+
export declare function setIconBaseURL(url: string): void;
|
|
17
|
+
/** Optional override for tests: inject a manifest map directly. */
|
|
18
|
+
export declare function setManifest(map: Manifest): void;
|
|
19
|
+
/** Optional override for tests: register a single key → SVG fragment. */
|
|
20
|
+
export declare function registerIcon(key: string, svg: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve `key` to an SVG fragment. Returns a Promise; built-in icons
|
|
23
|
+
* resolve immediately, file-backed PNGs/SVGs after a network fetch.
|
|
24
|
+
* Throws when the key is not in the built-in registry and not in the
|
|
25
|
+
* manifest.
|
|
26
|
+
*/
|
|
27
|
+
export declare function getIcon(key: string): Promise<string>;
|
|
28
|
+
export { ICONS };
|
|
29
|
+
//# sourceMappingURL=icons-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons-loader.d.ts","sourceRoot":"","sources":["../src/icons-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,KAAK,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAQvC,kEAAkE;AAClE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhD;AAED,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAE/C;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3D;AA6BD;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB1D;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon loader — JS mirror of `packages/python/src/kymo/icons.py:get_icon`.
|
|
3
|
+
*
|
|
4
|
+
* Built-in glyphs (from `icons-builtin.ts`) are returned synchronously
|
|
5
|
+
* wrapped in `Promise.resolve()`. File-backed PNG icons are resolved
|
|
6
|
+
* lazily: on first request the manifest is fetched, then the PNG bytes
|
|
7
|
+
* are fetched and embedded as a base64 `<image>` tag inside an SVG
|
|
8
|
+
* fragment. Subsequent lookups are cache hits.
|
|
9
|
+
*
|
|
10
|
+
* Configure the base URL with `setIconBaseURL(url)` before the first
|
|
11
|
+
* call — defaults to `""` (paths are relative to the page).
|
|
12
|
+
*/
|
|
13
|
+
import { ICONS } from "./icons-builtin.js";
|
|
14
|
+
const IMAGE_SIZE = 64;
|
|
15
|
+
const _cache = new Map(Object.entries(ICONS)); // builtin keys start cached
|
|
16
|
+
let _manifest = null;
|
|
17
|
+
let _manifestPromise = null;
|
|
18
|
+
let _baseURL = "";
|
|
19
|
+
/** Set the URL prefix used to fetch the manifest + icon files. */
|
|
20
|
+
export function setIconBaseURL(url) {
|
|
21
|
+
_baseURL = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
22
|
+
}
|
|
23
|
+
/** Optional override for tests: inject a manifest map directly. */
|
|
24
|
+
export function setManifest(map) {
|
|
25
|
+
_manifest = { ...map };
|
|
26
|
+
}
|
|
27
|
+
/** Optional override for tests: register a single key → SVG fragment. */
|
|
28
|
+
export function registerIcon(key, svg) {
|
|
29
|
+
_cache.set(key, svg);
|
|
30
|
+
}
|
|
31
|
+
async function loadManifest() {
|
|
32
|
+
if (_manifest)
|
|
33
|
+
return _manifest;
|
|
34
|
+
if (_manifestPromise)
|
|
35
|
+
return _manifestPromise;
|
|
36
|
+
const url = `${_baseURL}/icons-manifest.json`.replace(/^\//, "");
|
|
37
|
+
_manifestPromise = fetch(url).then((r) => {
|
|
38
|
+
if (!r.ok)
|
|
39
|
+
throw new Error(`manifest fetch failed: ${r.status}`);
|
|
40
|
+
return r.json();
|
|
41
|
+
}).then((m) => (_manifest = m));
|
|
42
|
+
return _manifestPromise;
|
|
43
|
+
}
|
|
44
|
+
function pngBytesToImageTag(bytes, size = IMAGE_SIZE) {
|
|
45
|
+
// Base64-encode the PNG bytes for embedding in an SVG `<image>` tag.
|
|
46
|
+
let bin = "";
|
|
47
|
+
for (let i = 0; i < bytes.length; i++)
|
|
48
|
+
bin += String.fromCharCode(bytes[i]);
|
|
49
|
+
const b64 = (typeof btoa !== "undefined") ? btoa(bin) : Buffer.from(bytes).toString("base64");
|
|
50
|
+
const half = (size / 2) | 0;
|
|
51
|
+
return `<image href="data:image/png;base64,${b64}" ` +
|
|
52
|
+
`x="-${half}" y="-${half}" width="${size}" height="${size}"/>`;
|
|
53
|
+
}
|
|
54
|
+
function svgTextToInline(text, size = IMAGE_SIZE) {
|
|
55
|
+
const half = (size / 2) | 0;
|
|
56
|
+
return `<svg x="-${half}" y="-${half}" width="${size}" height="${size}" ` +
|
|
57
|
+
`overflow="visible">${text}</svg>`;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Resolve `key` to an SVG fragment. Returns a Promise; built-in icons
|
|
61
|
+
* resolve immediately, file-backed PNGs/SVGs after a network fetch.
|
|
62
|
+
* Throws when the key is not in the built-in registry and not in the
|
|
63
|
+
* manifest.
|
|
64
|
+
*/
|
|
65
|
+
export async function getIcon(key) {
|
|
66
|
+
if (_cache.has(key))
|
|
67
|
+
return _cache.get(key);
|
|
68
|
+
const manifest = await loadManifest();
|
|
69
|
+
const path = manifest[key];
|
|
70
|
+
if (!path)
|
|
71
|
+
throw new Error(`unknown icon: ${JSON.stringify(key)}`);
|
|
72
|
+
const url = _baseURL ? `${_baseURL}/${path}` : path;
|
|
73
|
+
const res = await fetch(url);
|
|
74
|
+
if (!res.ok)
|
|
75
|
+
throw new Error(`icon fetch failed: ${path} (${res.status})`);
|
|
76
|
+
let svg;
|
|
77
|
+
if (path.endsWith(".svg")) {
|
|
78
|
+
svg = svgTextToInline(await res.text());
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
const buf = new Uint8Array(await res.arrayBuffer());
|
|
82
|
+
svg = pngBytesToImageTag(buf);
|
|
83
|
+
}
|
|
84
|
+
_cache.set(key, svg);
|
|
85
|
+
return svg;
|
|
86
|
+
}
|
|
87
|
+
export { ICONS };
|
|
88
|
+
//# sourceMappingURL=icons-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons-loader.js","sourceRoot":"","sources":["../src/icons-loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAiB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAG,4BAA4B;AAC7F,IAAI,SAAS,GAAoB,IAAI,CAAC;AACtC,IAAI,gBAAgB,GAA6B,IAAI,CAAC;AACtD,IAAI,QAAQ,GAAG,EAAE,CAAC;AAElB,kEAAkE;AAClE,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACxD,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,WAAW,CAAC,GAAa;IACvC,SAAS,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;AACzB,CAAC;AAED,yEAAyE;A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AAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;QACpD,GAAG,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kymostudio — an independent TypeScript implementation of the diagram-as-code
|
|
3
|
+
* toolkit (data model + icon library + SVG renderer + BPMN importer). It is
|
|
4
|
+
* developed in parallel with the Python package at `packages/python/src/kymo/`
|
|
5
|
+
* and kept at feature parity — not a port of it. Dependency-free.
|
|
6
|
+
*
|
|
7
|
+
* Public surface:
|
|
8
|
+
* - data model: `makeComponent`, `makeEdge`, `makeRegion`, `makeDiagram`,
|
|
9
|
+
* `anchor`, `resolveAnchors`, …
|
|
10
|
+
* - icons: `ICONS`, `getIcon`, `setIconBaseURL`, `setManifest`, `registerIcon`
|
|
11
|
+
* - renderer: `renderSVG`
|
|
12
|
+
* - BPMN import: `parseBpmn` (BPMN 2.0 `.bpmn` XML → Diagram)
|
|
13
|
+
*/
|
|
14
|
+
export * from "./model.js";
|
|
15
|
+
export * from "./icons-loader.js";
|
|
16
|
+
export * from "./render.js";
|
|
17
|
+
export { parseBpmn } from "./from-bpmn.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kymostudio — an independent TypeScript implementation of the diagram-as-code
|
|
3
|
+
* toolkit (data model + icon library + SVG renderer + BPMN importer). It is
|
|
4
|
+
* developed in parallel with the Python package at `packages/python/src/kymo/`
|
|
5
|
+
* and kept at feature parity — not a port of it. Dependency-free.
|
|
6
|
+
*
|
|
7
|
+
* Public surface:
|
|
8
|
+
* - data model: `makeComponent`, `makeEdge`, `makeRegion`, `makeDiagram`,
|
|
9
|
+
* `anchor`, `resolveAnchors`, …
|
|
10
|
+
* - icons: `ICONS`, `getIcon`, `setIconBaseURL`, `setManifest`, `registerIcon`
|
|
11
|
+
* - renderer: `renderSVG`
|
|
12
|
+
* - BPMN import: `parseBpmn` (BPMN 2.0 `.bpmn` XML → Diagram)
|
|
13
|
+
*/
|
|
14
|
+
export * from "./model.js";
|
|
15
|
+
export * from "./icons-loader.js"; // ICONS, getIcon, setIconBaseURL, setManifest, registerIcon
|
|
16
|
+
export * from "./render.js"; // renderSVG
|
|
17
|
+
export { parseBpmn } from "./from-bpmn.js";
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC,CAAC,4DAA4D;AAC/F,cAAc,aAAa,CAAC,CAAO,YAAY;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|