@shumoku/renderer 0.2.23 → 0.2.25

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/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  /**
2
2
  * @shumoku/renderer - SVG and HTML renderers for network diagrams
3
+ * Browser entry point (PNG throws error)
3
4
  */
4
5
  import * as html from './html/index.js';
6
+ import * as png from './png.browser.js';
5
7
  import * as svg from './svg.js';
6
- export { svg, html };
8
+ export { svg, html, png };
7
9
  export type { SheetData } from './html/index.js';
8
10
  export type { DataAttributeOptions, DeviceInfo, EndpointInfo, HTMLRendererOptions, InteractiveInstance, InteractiveOptions, LinkInfo, PortInfo, RenderMode, } from './types.js';
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AAEvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA;AAGpB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAGzB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @shumoku/renderer - SVG and HTML renderers for network diagrams
3
+ * Browser entry point (PNG throws error)
3
4
  */
4
5
  import * as html from './html/index.js';
5
- // Namespace exports
6
+ import * as png from './png.browser.js';
6
7
  import * as svg from './svg.js';
7
- export { svg, html };
8
+ export { svg, html, png };
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,oBAAoB;AACpB,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @shumoku/renderer - SVG, HTML, and PNG renderers for network diagrams
3
+ * Node.js entry point (includes PNG support)
4
+ */
5
+ import * as html from './html/index.js';
6
+ import * as png from './png.js';
7
+ import * as svg from './svg.js';
8
+ export { svg, html, png };
9
+ export type { SheetData } from './html/index.js';
10
+ export type { DataAttributeOptions, DeviceInfo, EndpointInfo, HTMLRendererOptions, InteractiveInstance, InteractiveOptions, LinkInfo, PortInfo, RenderMode, } from './types.js';
11
+ //# sourceMappingURL=index.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.d.ts","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA;AAGzB,YAAY,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhD,YAAY,EACV,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @shumoku/renderer - SVG, HTML, and PNG renderers for network diagrams
3
+ * Node.js entry point (includes PNG support)
4
+ */
5
+ import * as html from './html/index.js';
6
+ import * as png from './png.js';
7
+ import * as svg from './svg.js';
8
+ export { svg, html, png };
9
+ //# sourceMappingURL=index.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.node.js","sourceRoot":"","sources":["../src/index.node.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * PNG Renderer - Browser stub
3
+ * Throws error when called in browser environment
4
+ */
5
+ import type { LayoutResult, NetworkGraph } from '@shumoku/core';
6
+ export interface PngOptions {
7
+ /** Scale factor for output resolution (default: 2) */
8
+ scale?: number;
9
+ /** Load system fonts (default: true) */
10
+ loadSystemFonts?: boolean;
11
+ }
12
+ /**
13
+ * Render NetworkGraph to PNG buffer (Node.js only)
14
+ * @throws Error when called in browser
15
+ */
16
+ export declare function render(_graph: NetworkGraph, _layout: LayoutResult, _options?: PngOptions): Buffer;
17
+ //# sourceMappingURL=png.browser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"png.browser.d.ts","sourceRoot":"","sources":["../src/png.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE/D,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;;GAGG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,YAAY,EACrB,QAAQ,GAAE,UAAe,GACxB,MAAM,CAER"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * PNG Renderer - Browser stub
3
+ * Throws error when called in browser environment
4
+ */
5
+ /**
6
+ * Render NetworkGraph to PNG buffer (Node.js only)
7
+ * @throws Error when called in browser
8
+ */
9
+ export function render(_graph, _layout, _options = {}) {
10
+ throw new Error('PNG rendering is only available in Node.js environment');
11
+ }
12
+ //# sourceMappingURL=png.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"png.browser.js","sourceRoot":"","sources":["../src/png.browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH;;;GAGG;AACH,MAAM,UAAU,MAAM,CACpB,MAAoB,EACpB,OAAqB,EACrB,WAAuB,EAAE;IAEzB,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;AAC3E,CAAC"}
package/dist/png.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * PNG Renderer
3
+ * Renders NetworkGraph to PNG (Node.js only)
4
+ */
5
+ import type { LayoutResult, NetworkGraph } from '@shumoku/core';
6
+ export interface PngOptions {
7
+ /** Scale factor for output resolution (default: 2) */
8
+ scale?: number;
9
+ /** Load system fonts (default: true) */
10
+ loadSystemFonts?: boolean;
11
+ }
12
+ /**
13
+ * Render NetworkGraph to PNG buffer
14
+ */
15
+ export declare function render(graph: NetworkGraph, layout: LayoutResult, options?: PngOptions): Buffer;
16
+ //# sourceMappingURL=png.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../src/png.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAI/D,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED;;GAEG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,UAAe,GACvB,MAAM,CAWR"}
package/dist/png.js ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * PNG Renderer
3
+ * Renders NetworkGraph to PNG (Node.js only)
4
+ */
5
+ import { Resvg } from '@resvg/resvg-js';
6
+ import * as svg from './svg.js';
7
+ /**
8
+ * Render NetworkGraph to PNG buffer
9
+ */
10
+ export function render(graph, layout, options = {}) {
11
+ const scale = options.scale ?? 2;
12
+ const loadSystemFonts = options.loadSystemFonts ?? true;
13
+ const svgString = svg.render(graph, layout);
14
+ const resvg = new Resvg(svgString, {
15
+ fitTo: { mode: 'zoom', value: scale },
16
+ font: { loadSystemFonts },
17
+ });
18
+ return resvg.render().asPng();
19
+ }
20
+ //# sourceMappingURL=png.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"png.js","sourceRoot":"","sources":["../src/png.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAS/B;;GAEG;AACH,MAAM,UAAU,MAAM,CACpB,KAAmB,EACnB,MAAoB,EACpB,UAAsB,EAAE;IAExB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA;IAChC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,CAAA;IAEvD,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IAC3C,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE;QACjC,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;QACrC,IAAI,EAAE,EAAE,eAAe,EAAE;KAC1B,CAAC,CAAA;IAEF,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAA;AAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shumoku/renderer",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "SVG and HTML renderers for Shumoku network diagrams",
5
5
  "license": "MIT",
6
6
  "author": "konoe-akitoshi",
@@ -31,8 +31,14 @@
31
31
  },
32
32
  "exports": {
33
33
  ".": {
34
- "types": "./dist/index.d.ts",
35
- "import": "./dist/index.js"
34
+ "node": {
35
+ "types": "./dist/index.node.d.ts",
36
+ "import": "./dist/index.node.js"
37
+ },
38
+ "default": {
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.js"
41
+ }
36
42
  },
37
43
  "./style.css": "./dist/style.css",
38
44
  "./iife": "./dist/shumoku-interactive.iife.js",
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @shumoku/renderer - SVG, HTML, and PNG renderers for network diagrams
3
+ * Node.js entry point (includes PNG support)
4
+ */
5
+
6
+ import * as html from './html/index.js'
7
+ import * as png from './png.js'
8
+ import * as svg from './svg.js'
9
+
10
+ export { svg, html, png }
11
+
12
+ // Re-export SheetData for hierarchical rendering
13
+ export type { SheetData } from './html/index.js'
14
+ // Types
15
+ export type {
16
+ DataAttributeOptions,
17
+ DeviceInfo,
18
+ EndpointInfo,
19
+ HTMLRendererOptions,
20
+ InteractiveInstance,
21
+ InteractiveOptions,
22
+ LinkInfo,
23
+ PortInfo,
24
+ RenderMode,
25
+ } from './types.js'
package/src/index.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * @shumoku/renderer - SVG and HTML renderers for network diagrams
3
+ * Browser entry point (PNG throws error)
3
4
  */
4
5
 
5
6
  import * as html from './html/index.js'
6
- // Namespace exports
7
+ import * as png from './png.browser.js'
7
8
  import * as svg from './svg.js'
8
9
 
9
- export { svg, html }
10
+ export { svg, html, png }
10
11
 
11
12
  // Re-export SheetData for hierarchical rendering
12
13
  export type { SheetData } from './html/index.js'
@@ -0,0 +1,25 @@
1
+ /**
2
+ * PNG Renderer - Browser stub
3
+ * Throws error when called in browser environment
4
+ */
5
+
6
+ import type { LayoutResult, NetworkGraph } from '@shumoku/core'
7
+
8
+ export interface PngOptions {
9
+ /** Scale factor for output resolution (default: 2) */
10
+ scale?: number
11
+ /** Load system fonts (default: true) */
12
+ loadSystemFonts?: boolean
13
+ }
14
+
15
+ /**
16
+ * Render NetworkGraph to PNG buffer (Node.js only)
17
+ * @throws Error when called in browser
18
+ */
19
+ export function render(
20
+ _graph: NetworkGraph,
21
+ _layout: LayoutResult,
22
+ _options: PngOptions = {},
23
+ ): Buffer {
24
+ throw new Error('PNG rendering is only available in Node.js environment')
25
+ }
package/src/png.ts ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * PNG Renderer
3
+ * Renders NetworkGraph to PNG (Node.js only)
4
+ */
5
+
6
+ import type { LayoutResult, NetworkGraph } from '@shumoku/core'
7
+ import { Resvg } from '@resvg/resvg-js'
8
+ import * as svg from './svg.js'
9
+
10
+ export interface PngOptions {
11
+ /** Scale factor for output resolution (default: 2) */
12
+ scale?: number
13
+ /** Load system fonts (default: true) */
14
+ loadSystemFonts?: boolean
15
+ }
16
+
17
+ /**
18
+ * Render NetworkGraph to PNG buffer
19
+ */
20
+ export function render(
21
+ graph: NetworkGraph,
22
+ layout: LayoutResult,
23
+ options: PngOptions = {},
24
+ ): Buffer {
25
+ const scale = options.scale ?? 2
26
+ const loadSystemFonts = options.loadSystemFonts ?? true
27
+
28
+ const svgString = svg.render(graph, layout)
29
+ const resvg = new Resvg(svgString, {
30
+ fitTo: { mode: 'zoom', value: scale },
31
+ font: { loadSystemFonts },
32
+ })
33
+
34
+ return resvg.render().asPng()
35
+ }