@keroway/tdsl-wasm 1.19.0 → 1.21.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 +41 -0
- package/package.json +1 -1
- package/tdsl_wasm.d.ts +12 -0
- package/tdsl_wasm.js +22 -0
- package/tdsl_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -54,6 +54,45 @@ const diagnostics = JSON.parse(check_source(source));
|
|
|
54
54
|
const formatted = format_source(source);
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
### Render options (`JsRenderOptions`)
|
|
58
|
+
|
|
59
|
+
For finer control over the output, use the `*_with_options` entry points with a
|
|
60
|
+
`JsRenderOptions` instance:
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
import init, {
|
|
64
|
+
JsRenderOptions,
|
|
65
|
+
render_svg_from_source_with_options,
|
|
66
|
+
} from "@keroway/tdsl-wasm";
|
|
67
|
+
|
|
68
|
+
await init();
|
|
69
|
+
|
|
70
|
+
const opts = new JsRenderOptions();
|
|
71
|
+
opts.orientation = "vertical"; // "horizontal" (default) | "vertical"
|
|
72
|
+
opts.grid = "decade"; // "none" (default) | "decade" | "year" | "month"
|
|
73
|
+
opts.theme = "dark"; // "default" | "dark" | "print" | "pastel"
|
|
74
|
+
opts.show_table = true;
|
|
75
|
+
opts.show_event_labels = true;
|
|
76
|
+
opts.lane_height = 96; // px per lane; 0 (default) = renderer default (60)
|
|
77
|
+
|
|
78
|
+
// scale = pixels-per-year; pass 0 for auto.
|
|
79
|
+
const svg = render_svg_from_source_with_options(source, 0, opts);
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
`lane_height` controls vertical density. Increasing it makes the SVG taller and
|
|
83
|
+
proportionally thickens each lane band, bar, and intra-lane padding — useful for
|
|
84
|
+
timelines with few lanes but many overlapping spans. Leave it at `0` to keep the
|
|
85
|
+
default appearance.
|
|
86
|
+
|
|
87
|
+
| Field | Accepted values | Default |
|
|
88
|
+
|---|---|---|
|
|
89
|
+
| `orientation` | `"horizontal"`, `"vertical"` | `"horizontal"` |
|
|
90
|
+
| `grid` | `"none"`, `"decade"`, `"year"`, `"month"` | `"none"` |
|
|
91
|
+
| `theme` | `"default"`, `"dark"`, `"print"`, `"pastel"` | `"default"` |
|
|
92
|
+
| `show_table` | `true`, `false` | `false` |
|
|
93
|
+
| `show_event_labels` | `true`, `false` | `false` |
|
|
94
|
+
| `lane_height` | px per lane; `0` = renderer default (60) | `0` |
|
|
95
|
+
|
|
57
96
|
## API
|
|
58
97
|
|
|
59
98
|
| Function | Signature | Description |
|
|
@@ -61,7 +100,9 @@ const formatted = format_source(source);
|
|
|
61
100
|
| `init(module_or_path?)` | `(…) => Promise<InitOutput>` | Default export. Loads the `.wasm` binary. Must be awaited before any call. |
|
|
62
101
|
| `compile_to_ir` | `(source: string) => string` | Compile to JSON IR. Throws on compile error. |
|
|
63
102
|
| `render_svg_from_source` | `(source: string, scale: number) => string` | Render SVG. `scale` = pixels-per-year; pass `0` for auto. |
|
|
103
|
+
| `render_svg_from_source_with_options` | `(source: string, scale: number, opts: JsRenderOptions) => string` | Render SVG with explicit options (orientation, grid, theme, table, event labels, `lane_height`). |
|
|
64
104
|
| `render_html_from_source` | `(source: string) => string` | Render a standalone HTML document. |
|
|
105
|
+
| `render_html_from_source_with_options` | `(source: string, opts: JsRenderOptions) => string` | Render a standalone HTML document with explicit options. |
|
|
65
106
|
| `check_source` | `(source: string) => string` | Diagnostics as a JSON array `[{severity, message, line, col}]`. `line`/`col` are 1-based when a position is available, else `0`. |
|
|
66
107
|
| `format_source` | `(source: string) => string` | Re-emit normalized source from the AST. |
|
|
67
108
|
|
package/package.json
CHANGED
package/tdsl_wasm.d.ts
CHANGED
|
@@ -15,11 +15,21 @@
|
|
|
15
15
|
* | `theme` | `"default"`, `"dark"`, `"print"`, `"pastel"` | `"default"` |
|
|
16
16
|
* | `show_table` | `true`, `false` | `false` |
|
|
17
17
|
* | `show_event_labels` | `true`, `false` | `false` |
|
|
18
|
+
* | `lane_height` | px per lane; `0` = renderer default (60) | `0` |
|
|
19
|
+
*
|
|
20
|
+
* `lane_height` controls vertical density: the SVG height, each lane band, the
|
|
21
|
+
* bar thickness and intra-lane padding all follow it. Leave it at `0` (the
|
|
22
|
+
* default) to keep the historical appearance.
|
|
18
23
|
*/
|
|
19
24
|
export class JsRenderOptions {
|
|
20
25
|
free(): void;
|
|
21
26
|
[Symbol.dispose](): void;
|
|
22
27
|
constructor();
|
|
28
|
+
/**
|
|
29
|
+
* Height of each lane in pixels. `0` (default) uses the renderer default (60).
|
|
30
|
+
* Larger values increase vertical density (taller bands and thicker bars).
|
|
31
|
+
*/
|
|
32
|
+
lane_height: number;
|
|
23
33
|
/**
|
|
24
34
|
* When true, labels are rendered next to Event/EventRange items.
|
|
25
35
|
*/
|
|
@@ -133,9 +143,11 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
133
143
|
|
|
134
144
|
export interface InitOutput {
|
|
135
145
|
readonly memory: WebAssembly.Memory;
|
|
146
|
+
readonly __wbg_get_jsrenderoptions_lane_height: (a: number) => number;
|
|
136
147
|
readonly __wbg_get_jsrenderoptions_show_event_labels: (a: number) => number;
|
|
137
148
|
readonly __wbg_get_jsrenderoptions_show_table: (a: number) => number;
|
|
138
149
|
readonly __wbg_jsrenderoptions_free: (a: number, b: number) => void;
|
|
150
|
+
readonly __wbg_set_jsrenderoptions_lane_height: (a: number, b: number) => void;
|
|
139
151
|
readonly __wbg_set_jsrenderoptions_show_event_labels: (a: number, b: number) => void;
|
|
140
152
|
readonly __wbg_set_jsrenderoptions_show_table: (a: number, b: number) => void;
|
|
141
153
|
readonly check_source: (a: number, b: number, c: number) => void;
|
package/tdsl_wasm.js
CHANGED
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
* | `theme` | `"default"`, `"dark"`, `"print"`, `"pastel"` | `"default"` |
|
|
15
15
|
* | `show_table` | `true`, `false` | `false` |
|
|
16
16
|
* | `show_event_labels` | `true`, `false` | `false` |
|
|
17
|
+
* | `lane_height` | px per lane; `0` = renderer default (60) | `0` |
|
|
18
|
+
*
|
|
19
|
+
* `lane_height` controls vertical density: the SVG height, each lane band, the
|
|
20
|
+
* bar thickness and intra-lane padding all follow it. Leave it at `0` (the
|
|
21
|
+
* default) to keep the historical appearance.
|
|
17
22
|
*/
|
|
18
23
|
export class JsRenderOptions {
|
|
19
24
|
__destroy_into_raw() {
|
|
@@ -26,6 +31,15 @@ export class JsRenderOptions {
|
|
|
26
31
|
const ptr = this.__destroy_into_raw();
|
|
27
32
|
wasm.__wbg_jsrenderoptions_free(ptr, 0);
|
|
28
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Height of each lane in pixels. `0` (default) uses the renderer default (60).
|
|
36
|
+
* Larger values increase vertical density (taller bands and thicker bars).
|
|
37
|
+
* @returns {number}
|
|
38
|
+
*/
|
|
39
|
+
get lane_height() {
|
|
40
|
+
const ret = wasm.__wbg_get_jsrenderoptions_lane_height(this.__wbg_ptr);
|
|
41
|
+
return ret;
|
|
42
|
+
}
|
|
29
43
|
/**
|
|
30
44
|
* When true, labels are rendered next to Event/EventRange items.
|
|
31
45
|
* @returns {boolean}
|
|
@@ -129,6 +143,14 @@ export class JsRenderOptions {
|
|
|
129
143
|
wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
|
|
130
144
|
}
|
|
131
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Height of each lane in pixels. `0` (default) uses the renderer default (60).
|
|
148
|
+
* Larger values increase vertical density (taller bands and thicker bars).
|
|
149
|
+
* @param {number} arg0
|
|
150
|
+
*/
|
|
151
|
+
set lane_height(arg0) {
|
|
152
|
+
wasm.__wbg_set_jsrenderoptions_lane_height(this.__wbg_ptr, arg0);
|
|
153
|
+
}
|
|
132
154
|
/**
|
|
133
155
|
* When true, labels are rendered next to Event/EventRange items.
|
|
134
156
|
* @param {boolean} arg0
|
package/tdsl_wasm_bg.wasm
CHANGED
|
Binary file
|