@tscircuit/core 0.0.241 → 0.0.243
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 +13 -6
- package/dist/index.js +14 -6
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -82,14 +82,21 @@ interface SchematicBoxDimensions {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
type RootCircuitEventName = "asyncEffectComplete" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | "external:evalError";
|
|
85
|
-
declare class
|
|
85
|
+
declare class RootCircuit {
|
|
86
86
|
firstChild: PrimitiveComponent | null;
|
|
87
87
|
children: PrimitiveComponent[];
|
|
88
88
|
db: SoupUtilObjects;
|
|
89
|
-
root:
|
|
89
|
+
root: RootCircuit | null;
|
|
90
90
|
isRoot: boolean;
|
|
91
91
|
schematicDisabled: boolean;
|
|
92
92
|
pcbDisabled: boolean;
|
|
93
|
+
pcbRoutingDisabled: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The RootCircuit name is usually set by the platform, it's not required but
|
|
96
|
+
* if supplied can identify the circuit in certain effects, e.g. it is passed
|
|
97
|
+
* as the display_name parameter for autorouting effects.
|
|
98
|
+
*/
|
|
99
|
+
name?: string;
|
|
93
100
|
_hasRenderedAtleastOnce: boolean;
|
|
94
101
|
constructor();
|
|
95
102
|
add(componentOrElm: PrimitiveComponent | ReactElement): void;
|
|
@@ -129,7 +136,7 @@ declare class Circuit {
|
|
|
129
136
|
/**
|
|
130
137
|
* @deprecated
|
|
131
138
|
*/
|
|
132
|
-
declare const Project: typeof
|
|
139
|
+
declare const Project: typeof RootCircuit;
|
|
133
140
|
|
|
134
141
|
interface ISubcircuit extends PrimitiveComponent {
|
|
135
142
|
_shouldUseTraceByTraceRouting(): boolean;
|
|
@@ -268,7 +275,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
268
275
|
x: number;
|
|
269
276
|
y: number;
|
|
270
277
|
};
|
|
271
|
-
get root():
|
|
278
|
+
get root(): RootCircuit | null;
|
|
272
279
|
onAddToParent(parent: PrimitiveComponent): void;
|
|
273
280
|
/**
|
|
274
281
|
* Called whenever the props change
|
|
@@ -8297,7 +8304,7 @@ declare class Crystal extends NormalComponent<typeof crystalProps, PolarizedPass
|
|
|
8297
8304
|
declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
|
|
8298
8305
|
isLoading: boolean;
|
|
8299
8306
|
error?: Error | null;
|
|
8300
|
-
circuit?:
|
|
8307
|
+
circuit?: RootCircuit;
|
|
8301
8308
|
circuitJson?: AnyCircuitElement[];
|
|
8302
8309
|
};
|
|
8303
8310
|
|
|
@@ -8664,4 +8671,4 @@ declare module "react/jsx-runtime" {
|
|
|
8664
8671
|
}
|
|
8665
8672
|
}
|
|
8666
8673
|
|
|
8667
|
-
export { Battery, Board, Capacitor, Chip,
|
|
8674
|
+
export { Battery, Board, Capacitor, Chip, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, RootCircuit, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Via, applyEditEventsToManualEditsFile, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -3552,7 +3552,8 @@ var Group = class extends NormalComponent {
|
|
|
3552
3552
|
body: JSON.stringify({
|
|
3553
3553
|
input_circuit_json: this.root.db.toArray(),
|
|
3554
3554
|
provider: "freerouting",
|
|
3555
|
-
autostart: true
|
|
3555
|
+
autostart: true,
|
|
3556
|
+
display_name: this.root?.name
|
|
3556
3557
|
}),
|
|
3557
3558
|
headers: { "Content-Type": "application/json" }
|
|
3558
3559
|
}
|
|
@@ -5883,11 +5884,11 @@ var Crystal = class extends NormalComponent {
|
|
|
5883
5884
|
}
|
|
5884
5885
|
};
|
|
5885
5886
|
|
|
5886
|
-
// lib/
|
|
5887
|
+
// lib/RootCircuit.ts
|
|
5887
5888
|
import { su } from "@tscircuit/soup-util";
|
|
5888
5889
|
import { isValidElement as isValidElement2 } from "react";
|
|
5889
5890
|
import { identity as identity5 } from "transformation-matrix";
|
|
5890
|
-
var
|
|
5891
|
+
var RootCircuit = class {
|
|
5891
5892
|
firstChild = null;
|
|
5892
5893
|
children;
|
|
5893
5894
|
db;
|
|
@@ -5895,6 +5896,13 @@ var Circuit = class {
|
|
|
5895
5896
|
isRoot = true;
|
|
5896
5897
|
schematicDisabled = false;
|
|
5897
5898
|
pcbDisabled = false;
|
|
5899
|
+
pcbRoutingDisabled = false;
|
|
5900
|
+
/**
|
|
5901
|
+
* The RootCircuit name is usually set by the platform, it's not required but
|
|
5902
|
+
* if supplied can identify the circuit in certain effects, e.g. it is passed
|
|
5903
|
+
* as the display_name parameter for autorouting effects.
|
|
5904
|
+
*/
|
|
5905
|
+
name;
|
|
5898
5906
|
_hasRenderedAtleastOnce = false;
|
|
5899
5907
|
constructor() {
|
|
5900
5908
|
this.children = [];
|
|
@@ -6026,7 +6034,7 @@ var Circuit = class {
|
|
|
6026
6034
|
return "";
|
|
6027
6035
|
}
|
|
6028
6036
|
};
|
|
6029
|
-
var Project =
|
|
6037
|
+
var Project = RootCircuit;
|
|
6030
6038
|
|
|
6031
6039
|
// lib/hooks/use-rendered-circuit.ts
|
|
6032
6040
|
import React from "react";
|
|
@@ -6041,7 +6049,7 @@ var useRenderedCircuit = (reactElements) => {
|
|
|
6041
6049
|
if (reactElements) {
|
|
6042
6050
|
setTimeout(() => {
|
|
6043
6051
|
try {
|
|
6044
|
-
const circuit2 = new
|
|
6052
|
+
const circuit2 = new RootCircuit();
|
|
6045
6053
|
circuit2.add(reactElements);
|
|
6046
6054
|
setCircuit(circuit2);
|
|
6047
6055
|
setCircuitJson(circuit2.toJson());
|
|
@@ -6192,7 +6200,6 @@ export {
|
|
|
6192
6200
|
Board,
|
|
6193
6201
|
Capacitor,
|
|
6194
6202
|
Chip,
|
|
6195
|
-
Circuit,
|
|
6196
6203
|
Constraint2 as Constraint,
|
|
6197
6204
|
Crystal,
|
|
6198
6205
|
Diode,
|
|
@@ -6218,6 +6225,7 @@ export {
|
|
|
6218
6225
|
PushButton,
|
|
6219
6226
|
Renderable,
|
|
6220
6227
|
Resistor,
|
|
6228
|
+
RootCircuit,
|
|
6221
6229
|
SilkscreenCircle,
|
|
6222
6230
|
SilkscreenLine,
|
|
6223
6231
|
SilkscreenPath,
|