@retikz/vanilla 0.3.0-alpha.3 → 0.3.0-alpha.4
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 +50 -50
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
# @retikz/vanilla
|
|
2
|
-
|
|
3
|
-
Framework-free runtime + SSR entry for [retikz](https://pionpill.github.io/retikz/). No JSX, no UI framework — mount a diagram to the DOM, render it to an SVG string on the server, or compose one with an imperative named builder.
|
|
4
|
-
|
|
5
|
-
retikz 的无框架 runtime / SSR 入口:不依赖任何 UI 框架。`renderToSvgString` 走服务端 / 构建期(零 DOM)产 SVG 字符串;`mountSvg` 在浏览器把图形挂到 DOM;命令式 builder(`figure`/`node`/`draw`/`coordinate`/`scope`)让你像 React 一样具名构图、产同一份 IR。组合 `@retikz/render` 内核,不自维护第二套渲染逻辑。
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
pnpm add @retikz/vanilla @retikz/core @retikz/render
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Render IR / Scene
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import { renderToSvgString, mountSvg } from '@retikz/vanilla';
|
|
17
|
-
|
|
18
|
-
// server / build time — no DOM
|
|
19
|
-
const svg = renderToSvgString(ir);
|
|
20
|
-
|
|
21
|
-
// browser
|
|
22
|
-
mountSvg(document.querySelector('#diagram'), ir);
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Imperative builder
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import { figure, node, draw } from '@retikz/vanilla';
|
|
29
|
-
|
|
30
|
-
const fig = figure([
|
|
31
|
-
node('a', { position: [0, 0], text: 'A' }),
|
|
32
|
-
node('b', { position: [120, 0], text: 'B' }),
|
|
33
|
-
draw(['a', 'b'], { arrow: '->' }),
|
|
34
|
-
]);
|
|
35
|
-
|
|
36
|
-
const svg = fig.toSvgString(); // also: fig.mount(el) / fig.toCanvas(canvas)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Exports
|
|
40
|
-
|
|
41
|
-
- Runtime: `renderToSvgString`, `mountSvg`
|
|
42
|
-
- Builder: `figure` / `node` / `draw` / `coordinate` / `scope` + the `Figure` view (`.toSvgString` / `.mount` / `.toCanvas`)
|
|
43
|
-
|
|
44
|
-
## Docs
|
|
45
|
-
|
|
46
|
-
<https://pionpill.github.io/retikz/>
|
|
47
|
-
|
|
48
|
-
## License
|
|
49
|
-
|
|
50
|
-
MIT
|
|
1
|
+
# @retikz/vanilla
|
|
2
|
+
|
|
3
|
+
Framework-free runtime + SSR entry for [retikz](https://pionpill.github.io/retikz/). No JSX, no UI framework — mount a diagram to the DOM, render it to an SVG string on the server, or compose one with an imperative named builder.
|
|
4
|
+
|
|
5
|
+
retikz 的无框架 runtime / SSR 入口:不依赖任何 UI 框架。`renderToSvgString` 走服务端 / 构建期(零 DOM)产 SVG 字符串;`mountSvg` 在浏览器把图形挂到 DOM;命令式 builder(`figure`/`node`/`draw`/`coordinate`/`scope`)让你像 React 一样具名构图、产同一份 IR。组合 `@retikz/render` 内核,不自维护第二套渲染逻辑。
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @retikz/vanilla @retikz/core @retikz/render
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Render IR / Scene
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { renderToSvgString, mountSvg } from '@retikz/vanilla';
|
|
17
|
+
|
|
18
|
+
// server / build time — no DOM
|
|
19
|
+
const svg = renderToSvgString(ir);
|
|
20
|
+
|
|
21
|
+
// browser
|
|
22
|
+
mountSvg(document.querySelector('#diagram'), ir);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Imperative builder
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import { figure, node, draw } from '@retikz/vanilla';
|
|
29
|
+
|
|
30
|
+
const fig = figure([
|
|
31
|
+
node('a', { position: [0, 0], text: 'A' }),
|
|
32
|
+
node('b', { position: [120, 0], text: 'B' }),
|
|
33
|
+
draw(['a', 'b'], { arrow: '->' }),
|
|
34
|
+
]);
|
|
35
|
+
|
|
36
|
+
const svg = fig.toSvgString(); // also: fig.mount(el) / fig.toCanvas(canvas)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Exports
|
|
40
|
+
|
|
41
|
+
- Runtime: `renderToSvgString`, `mountSvg`
|
|
42
|
+
- Builder: `figure` / `node` / `draw` / `coordinate` / `scope` + the `Figure` view (`.toSvgString` / `.mount` / `.toCanvas`)
|
|
43
|
+
|
|
44
|
+
## Docs
|
|
45
|
+
|
|
46
|
+
<https://pionpill.github.io/retikz/>
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retikz/vanilla",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.4",
|
|
4
4
|
"description": "Framework-free runtime for retikz: mount Scene/IR to SVG DOM, or render to SVG string for SSR.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Pionpill",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
18
|
"url": "git+https://github.com/Pionpill/retikz.git",
|
|
19
|
-
"directory": "packages/vanilla"
|
|
19
|
+
"directory": "packages/core/vanilla"
|
|
20
20
|
},
|
|
21
21
|
"bugs": {
|
|
22
22
|
"url": "https://github.com/Pionpill/retikz/issues"
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"dist/**/*"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@retikz/core": "0.3.0-alpha.
|
|
43
|
-
"@retikz/render": "0.3.0-alpha.
|
|
42
|
+
"@retikz/core": "0.3.0-alpha.4",
|
|
43
|
+
"@retikz/render": "0.3.0-alpha.4"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "^25.6.0",
|