@strategicprojects/rpic 0.12.0 → 0.13.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 +1 -1
- package/index.d.ts +54 -0
- package/package.json +1 -1
- package/pkg/rpic_wasm_bg.wasm +0 -0
- package/pkg/rpic_wasm_math_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -81,7 +81,7 @@ first build. In Node, pass the math artifact's bytes:
|
|
|
81
81
|
| Function | Description |
|
|
82
82
|
|----------|-------------|
|
|
83
83
|
| `ready(wasmInput?, {math?})` | Initialize WASM. Browser: no arg. Node: pass `.wasm` bytes/URL. `math: true` loads the math-enabled build; conflicting later calls reject. |
|
|
84
|
-
| `compile(src, {circuits?, texlabels?})` | → `{ svg, animations, diagnostics, warnings, objects }` (throws on a pic error with `errorInfo`). |
|
|
84
|
+
| `compile(src, {circuits?, texlabels?, scene?, flatten?, outline?})` | → `{ svg, animations, diagnostics, warnings, objects, places?, passthrough?, scene? }` (throws on a pic error with `errorInfo`; `places` = named `Label: position` points in SVG units, `passthrough` = troff `.` lines, each present only when the source has some). `scene: true` adds the device-independent resolved draw list ([docs/scene.md](https://github.com/milkway/rpic-lang/blob/main/docs/scene.md)); `flatten` (inches) delivers its curves as polylines. |
|
|
85
85
|
| `renderSvg(src, {circuits?, texlabels?})` | → SVG string. |
|
|
86
86
|
| `animate(root, animations, gsap)` | Build/play a GSAP timeline (`draw`/`fade`/`pop`). Browser only. |
|
|
87
87
|
|
package/index.d.ts
CHANGED
|
@@ -108,6 +108,54 @@ export interface SceneItem {
|
|
|
108
108
|
}[];
|
|
109
109
|
/** block items: the child item ids */
|
|
110
110
|
items?: string[];
|
|
111
|
+
/**
|
|
112
|
+
* block items: where the block came from — the outermost macro call that
|
|
113
|
+
* expanded to it, or its opening `[` when written inline
|
|
114
|
+
*/
|
|
115
|
+
span?: SourceSpan;
|
|
116
|
+
/** block items made by a macro: that outermost call */
|
|
117
|
+
call?: { name: string; args: string[] };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** A source position, relative to its own source unit (like diagnostics). */
|
|
121
|
+
export interface SourceSpan {
|
|
122
|
+
line: number;
|
|
123
|
+
col: number;
|
|
124
|
+
end_col: number;
|
|
125
|
+
/** absent = the user's input; `"circuits"` = the `-c` library; else the `copy` name */
|
|
126
|
+
file?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** A named place (`Label: position`) in the scene. */
|
|
130
|
+
export interface ScenePlace {
|
|
131
|
+
/** the resolved label, subscripts included (`R[2]`) */
|
|
132
|
+
label: string;
|
|
133
|
+
/** scene units, the same frame as the items */
|
|
134
|
+
at: [number, number];
|
|
135
|
+
/** enclosing block item ids, outermost first */
|
|
136
|
+
block?: string[];
|
|
137
|
+
span?: SourceSpan;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** A named place in the compile bundle: SVG user units, the `objects` frame. */
|
|
141
|
+
export interface Place {
|
|
142
|
+
label: string;
|
|
143
|
+
x: number;
|
|
144
|
+
y: number;
|
|
145
|
+
line?: number;
|
|
146
|
+
col?: number;
|
|
147
|
+
end_col?: number;
|
|
148
|
+
file?: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/** A troff request line (`.` in column 1) set aside before lexing. */
|
|
152
|
+
export interface Passthrough {
|
|
153
|
+
/** the line as written, leading `.` included */
|
|
154
|
+
text: string;
|
|
155
|
+
line: number;
|
|
156
|
+
col: number;
|
|
157
|
+
end_col: number;
|
|
158
|
+
file?: string;
|
|
111
159
|
}
|
|
112
160
|
|
|
113
161
|
/**
|
|
@@ -129,6 +177,8 @@ export interface Scene {
|
|
|
129
177
|
source?: string;
|
|
130
178
|
/** final values of every variable (user + pic built-ins) */
|
|
131
179
|
vars: Record<string, number>;
|
|
180
|
+
/** named places (`Label: position`), evaluation order; empty when none */
|
|
181
|
+
places: ScenePlace[];
|
|
132
182
|
items: SceneItem[];
|
|
133
183
|
}
|
|
134
184
|
|
|
@@ -143,6 +193,10 @@ export interface Bundle {
|
|
|
143
193
|
warnings: Diagnostic[];
|
|
144
194
|
/** per-object geometry, index-aligned with the `<g id="sN">` groups */
|
|
145
195
|
objects: ObjectGeometry[];
|
|
196
|
+
/** named places (`Label: position`) in SVG user units. Present only when the source defines some. */
|
|
197
|
+
places?: Place[];
|
|
198
|
+
/** troff request lines set aside before lexing. Present only when the source has some. */
|
|
199
|
+
passthrough?: Passthrough[];
|
|
146
200
|
/**
|
|
147
201
|
* `true` when the source used `animate scroll`, hinting the host to scrub
|
|
148
202
|
* the timeline on scroll rather than autoplay. Present only when set.
|
package/package.json
CHANGED
package/pkg/rpic_wasm_bg.wasm
CHANGED
|
Binary file
|
|
Binary file
|