@tscircuit/core 0.0.253 → 0.0.255

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 CHANGED
@@ -41,7 +41,7 @@ declare abstract class Renderable implements IRenderable {
41
41
  constructor(props: any);
42
42
  protected _markDirty(phase: RenderPhase): void;
43
43
  protected _queueAsyncEffect(effectName: string, effect: () => Promise<void>): void;
44
- protected _emitRenderLifecycleEvent(phase: RenderPhase, eventType: "start" | "end"): void;
44
+ protected _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
45
45
  getString(): string;
46
46
  _hasIncompleteAsyncEffects(): boolean;
47
47
  getCurrentRenderPhase(): RenderPhase | null;
@@ -81,7 +81,7 @@ interface SchematicBoxDimensions {
81
81
  };
82
82
  }
83
83
 
84
- type RootCircuitEventName = "asyncEffectComplete" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | "external:evalError";
84
+ type RootCircuitEventName = "asyncEffect:start" | "asyncEffect:end" | "renderable:renderLifecycle:anyEvent" | `renderable:renderLifecycle:${RenderPhase}:start` | `renderable:renderLifecycle:${RenderPhase}:end` | "external:evalError";
85
85
  declare class RootCircuit {
86
86
  firstChild: PrimitiveComponent | null;
87
87
  children: PrimitiveComponent[];
@@ -1151,6 +1151,8 @@ declare class Board extends Group<typeof boardProps> {
1151
1151
  x: string | number;
1152
1152
  y: string | number;
1153
1153
  }>, "many">>;
1154
+ outlineOffsetX: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1155
+ outlineOffsetY: z.ZodOptional<z.ZodEffects<z.ZodUnion<[z.ZodString, z.ZodNumber]>, number, string | number>>;
1154
1156
  }>, "strip", z.ZodTypeAny, {
1155
1157
  pcbX?: number | undefined;
1156
1158
  pcbY?: number | undefined;
@@ -1209,6 +1211,8 @@ declare class Board extends Group<typeof boardProps> {
1209
1211
  x: number;
1210
1212
  y: number;
1211
1213
  }[] | undefined;
1214
+ outlineOffsetX?: number | undefined;
1215
+ outlineOffsetY?: number | undefined;
1212
1216
  }, {
1213
1217
  pcbX?: string | number | undefined;
1214
1218
  pcbY?: string | number | undefined;
@@ -1271,6 +1275,8 @@ declare class Board extends Group<typeof boardProps> {
1271
1275
  x: string | number;
1272
1276
  y: string | number;
1273
1277
  }[] | undefined;
1278
+ outlineOffsetX?: string | number | undefined;
1279
+ outlineOffsetY?: string | number | undefined;
1274
1280
  }>;
1275
1281
  };
1276
1282
  get boardThickness(): number;
@@ -9920,4 +9926,4 @@ declare module "react/jsx-runtime" {
9920
9926
  }
9921
9927
  }
9922
9928
 
9923
- 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 };
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, type RootCircuitEventName, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Subcircuit, Trace, TraceHint, Transistor, Via, applyEditEventsToManualEditsFile, createUseComponent, 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("asyncEffectComplete", {
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("asyncEffectComplete", {
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, eventType) {
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(eventName, {
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: eventName
177
+ type: granular_event_type
172
178
  });
173
179
  }
174
180
  }
@@ -3789,12 +3795,18 @@ var Board = class extends Group {
3789
3795
  throw new Error("Board width and height or an outline are required");
3790
3796
  }
3791
3797
  const pcb_board = db.pcb_board.insert({
3792
- center: { x: props.pcbX ?? 0, y: props.pcbY ?? 0 },
3798
+ center: {
3799
+ x: (props.pcbX ?? 0) + (props.outlineOffsetX ?? 0),
3800
+ y: (props.pcbY ?? 0) + (props.outlineOffsetY ?? 0)
3801
+ },
3793
3802
  thickness: this.boardThickness,
3794
3803
  num_layers: this.allLayers.length,
3795
3804
  width: props.width,
3796
3805
  height: props.height,
3797
- outline: props.outline
3806
+ outline: props.outline?.map((point) => ({
3807
+ x: point.x + (props.outlineOffsetX ?? 0),
3808
+ y: point.y + (props.outlineOffsetY ?? 0)
3809
+ }))
3798
3810
  });
3799
3811
  this.pcb_board_id = pcb_board.pcb_board_id;
3800
3812
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.253",
4
+ "version": "0.0.255",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "@tscircuit/footprinter": "^0.0.97",
44
44
  "@tscircuit/infgrid-ijump-astar": "^0.0.26",
45
45
  "@tscircuit/math-utils": "^0.0.5",
46
- "@tscircuit/props": "^0.0.126",
46
+ "@tscircuit/props": "^0.0.128",
47
47
  "@tscircuit/schematic-autolayout": "^0.0.6",
48
48
  "@tscircuit/soup-util": "^0.0.41",
49
49
  "circuit-json": "^0.0.128",