@tscircuit/core 0.0.254 → 0.0.256
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 +9 -3
- package/dist/index.js +18 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,12 @@ type RenderPhaseStates = Record<RenderPhase, {
|
|
|
16
16
|
initialized: boolean;
|
|
17
17
|
dirty: boolean;
|
|
18
18
|
}>;
|
|
19
|
+
type AsyncEffect = {
|
|
20
|
+
effectName: string;
|
|
21
|
+
promise: Promise<void>;
|
|
22
|
+
phase: RenderPhase;
|
|
23
|
+
complete: boolean;
|
|
24
|
+
};
|
|
19
25
|
type RenderPhaseFunctions = {
|
|
20
26
|
[T in RenderPhaseFn]?: () => void;
|
|
21
27
|
};
|
|
@@ -41,7 +47,7 @@ declare abstract class Renderable implements IRenderable {
|
|
|
41
47
|
constructor(props: any);
|
|
42
48
|
protected _markDirty(phase: RenderPhase): void;
|
|
43
49
|
protected _queueAsyncEffect(effectName: string, effect: () => Promise<void>): void;
|
|
44
|
-
protected _emitRenderLifecycleEvent(phase: RenderPhase,
|
|
50
|
+
protected _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
|
|
45
51
|
getString(): string;
|
|
46
52
|
_hasIncompleteAsyncEffects(): boolean;
|
|
47
53
|
getCurrentRenderPhase(): RenderPhase | null;
|
|
@@ -81,7 +87,7 @@ interface SchematicBoxDimensions {
|
|
|
81
87
|
};
|
|
82
88
|
}
|
|
83
89
|
|
|
84
|
-
type RootCircuitEventName = "
|
|
90
|
+
type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | "external:evalError";
|
|
85
91
|
declare class RootCircuit {
|
|
86
92
|
firstChild: PrimitiveComponent | null;
|
|
87
93
|
children: PrimitiveComponent[];
|
|
@@ -9926,4 +9932,4 @@ declare module "react/jsx-runtime" {
|
|
|
9926
9932
|
}
|
|
9927
9933
|
}
|
|
9928
9934
|
|
|
9929
|
-
export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, Renderable, Resistor, Resonator, RootCircuit, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
9935
|
+
export { type AsyncEffect, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, orderedRenderPhases, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -127,11 +127,19 @@ var Renderable = class {
|
|
|
127
127
|
complete: false
|
|
128
128
|
};
|
|
129
129
|
this._asyncEffects.push(asyncEffect);
|
|
130
|
+
if ("root" in this && this.root) {
|
|
131
|
+
;
|
|
132
|
+
this.root.emit("asyncEffect:start", {
|
|
133
|
+
effectName,
|
|
134
|
+
componentDisplayName: this.getString(),
|
|
135
|
+
phase: asyncEffect.phase
|
|
136
|
+
});
|
|
137
|
+
}
|
|
130
138
|
asyncEffect.promise.then(() => {
|
|
131
139
|
asyncEffect.complete = true;
|
|
132
140
|
if ("root" in this && this.root) {
|
|
133
141
|
;
|
|
134
|
-
this.root.emit("
|
|
142
|
+
this.root.emit("asyncEffect:end", {
|
|
135
143
|
effectName,
|
|
136
144
|
componentDisplayName: this.getString(),
|
|
137
145
|
phase: asyncEffect.phase
|
|
@@ -145,7 +153,7 @@ ${error.stack}`
|
|
|
145
153
|
asyncEffect.complete = true;
|
|
146
154
|
if ("root" in this && this.root) {
|
|
147
155
|
;
|
|
148
|
-
this.root.emit("
|
|
156
|
+
this.root.emit("asyncEffect:end", {
|
|
149
157
|
effectName,
|
|
150
158
|
componentDisplayName: this.getString(),
|
|
151
159
|
phase: asyncEffect.phase,
|
|
@@ -154,21 +162,19 @@ ${error.stack}`
|
|
|
154
162
|
}
|
|
155
163
|
});
|
|
156
164
|
}
|
|
157
|
-
_emitRenderLifecycleEvent(phase,
|
|
165
|
+
_emitRenderLifecycleEvent(phase, startOrEnd) {
|
|
166
|
+
const granular_event_type = `renderable:renderLifecycle:${phase}:${startOrEnd}`;
|
|
158
167
|
const eventPayload = {
|
|
159
168
|
renderId: this._renderId,
|
|
160
|
-
componentDisplayName: this.getString()
|
|
169
|
+
componentDisplayName: this.getString(),
|
|
170
|
+
type: granular_event_type
|
|
161
171
|
};
|
|
162
|
-
const eventName = `renderable:renderLifecycle:${phase}:${eventType}`;
|
|
163
172
|
if ("root" in this && this.root) {
|
|
164
173
|
;
|
|
165
|
-
this.root.emit(
|
|
166
|
-
...eventPayload,
|
|
167
|
-
type: eventName
|
|
168
|
-
});
|
|
174
|
+
this.root.emit(granular_event_type, eventPayload);
|
|
169
175
|
this.root.emit("renderable:renderLifecycle:anyEvent", {
|
|
170
176
|
...eventPayload,
|
|
171
|
-
type:
|
|
177
|
+
type: granular_event_type
|
|
172
178
|
});
|
|
173
179
|
}
|
|
174
180
|
}
|
|
@@ -1175,6 +1181,7 @@ var Net = class extends PrimitiveComponent {
|
|
|
1175
1181
|
*/
|
|
1176
1182
|
doInitialPcbRouteNetIslands() {
|
|
1177
1183
|
if (this.root?.pcbDisabled) return;
|
|
1184
|
+
if (this.getSubcircuit()._parsedProps.routingDisabled) return;
|
|
1178
1185
|
const { db } = this.root;
|
|
1179
1186
|
const { _parsedProps: props } = this;
|
|
1180
1187
|
const traces = this._getAllDirectlyConnectedTraces().filter(
|
|
@@ -6492,6 +6499,7 @@ export {
|
|
|
6492
6499
|
Via,
|
|
6493
6500
|
applyEditEventsToManualEditsFile,
|
|
6494
6501
|
createUseComponent,
|
|
6502
|
+
orderedRenderPhases,
|
|
6495
6503
|
useCapacitor,
|
|
6496
6504
|
useChip,
|
|
6497
6505
|
useDiode,
|