@slxu/graphsx 0.1.1 → 0.1.2

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 CHANGED
@@ -571,6 +571,16 @@ new EditorView({
571
571
 
572
572
  When the cursor is outside a `graphsx` fence, the fence renders as an SVG widget. Clicking the widget moves the cursor into the original fenced code. `graphsx-defs` fences render as compact library markers and feed reusable shapes/styles to later fences.
573
573
 
574
+ ## VS Code Markdown Preview
575
+
576
+ This repo also contains a VS Code extension scaffold in `packages/vscode-graphsx`. It teaches VS Code's built-in Markdown preview to render `graphsx` fenced blocks.
577
+
578
+ Build the extension bundle from the repo root:
579
+
580
+ ```bash
581
+ npm run build:vscode
582
+ ```
583
+
574
584
  ## Development
575
585
 
576
586
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slxu/graphsx",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "A small React-like inline graph DSL parser and model builder.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -31,6 +31,7 @@
31
31
  "scripts": {
32
32
  "build": "vite build",
33
33
  "build:pages": "vite build --base=/graphsx/",
34
+ "build:vscode": "node scripts/build-vscode-extension.js",
34
35
  "dev": "vite --host 127.0.0.1",
35
36
  "generate:readme-assets": "node scripts/generate-readme-assets.js",
36
37
  "playground": "vite --host 127.0.0.1",
@@ -61,6 +62,7 @@
61
62
  "@codemirror/state": "^6.6.0",
62
63
  "@codemirror/view": "^6.43.1",
63
64
  "codemirror": "^6.0.2",
65
+ "esbuild": "^0.27.7",
64
66
  "katex": "^0.17.0",
65
67
  "markdown-it": "^14.2.0",
66
68
  "vite": "^7.0.0"
package/src/renderer.js CHANGED
@@ -163,6 +163,9 @@ function drawShape(context, node, offsetX, offsetY) {
163
163
  cx: node.transform ? node.x : node.x + offsetX,
164
164
  cy: node.transform ? node.y : node.y + offsetY,
165
165
  r,
166
+ fill: "#ffffff",
167
+ stroke: "#26312d",
168
+ "stroke-width": 2,
166
169
  ...(transform ? { transform } : {})
167
170
  });
168
171
  }
@@ -174,6 +177,9 @@ function drawShape(context, node, offsetX, offsetY) {
174
177
  width: Number(node.attrs.w ?? 100),
175
178
  height: Number(node.attrs.h ?? 60),
176
179
  rx: Number(node.attrs.corner ?? node.attrs.rx ?? 6),
180
+ fill: "#ffffff",
181
+ stroke: "#26312d",
182
+ "stroke-width": 2,
177
183
  ...(transform ? { transform } : {})
178
184
  });
179
185
  }
@@ -189,7 +195,10 @@ function drawGroupBox(context, node, offsetX, offsetY) {
189
195
  y: bounds.minY + offsetY - padding,
190
196
  width: Math.max(80, bounds.maxX - bounds.minX + padding * 2),
191
197
  height: Math.max(54, bounds.maxY - bounds.minY + padding * 2),
192
- rx: 8
198
+ rx: 8,
199
+ fill: "rgba(45, 108, 223, 0.05)",
200
+ stroke: "rgba(45, 108, 223, 0.45)",
201
+ "stroke-dasharray": "6 5"
193
202
  }));
194
203
  appendMaybe(box, drawNodeLabel(context, node, offsetX, offsetY, {
195
204
  x: node.x,
@@ -217,7 +226,10 @@ function drawLeg(context, leg, offsetX, offsetY) {
217
226
  class: "leg-dot",
218
227
  cx: leg.x + offsetX,
219
228
  cy: leg.y + offsetY,
220
- r: Number(leg.attrs.r ?? 5)
229
+ r: Number(leg.attrs.r ?? 5),
230
+ fill: "#16846f",
231
+ stroke: "#ffffff",
232
+ "stroke-width": 2
221
233
  }));
222
234
  if (leg.attrs.label != null) {
223
235
  group.append(drawLabel(context, leg.attrs.label, leg.x + offsetX + 10, leg.y + offsetY - 10, "leg-label", "start"));
@@ -228,6 +240,9 @@ function drawLeg(context, leg, offsetX, offsetY) {
228
240
  function drawEdge(context, edge, from, to, offsetX, offsetY) {
229
241
  return styledEl(context, "path", edge.attrs.style, {
230
242
  class: "edge",
243
+ fill: "none",
244
+ stroke: "#2d6cdf",
245
+ "stroke-width": 2.5,
231
246
  ...arrowMarkerAttrs(context, edge.attrs),
232
247
  d: edgePathData(edge, from, to, offsetX, offsetY, context)
233
248
  });
@@ -238,7 +253,7 @@ function drawPath(context, path, offsetX, offsetY) {
238
253
  class: "path",
239
254
  fill: "none",
240
255
  stroke: "#111111",
241
- strokeWidth: 2,
256
+ "stroke-width": 2,
242
257
  ...arrowMarkerAttrs(context, path.attrs),
243
258
  d: explicitPathData(path, offsetX, offsetY)
244
259
  };