@tscircuit/core 0.0.693 → 0.0.695

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
@@ -54,6 +54,7 @@ declare abstract class Renderable implements IRenderable {
54
54
  protected _emitRenderLifecycleEvent(phase: RenderPhase, startOrEnd: "start" | "end"): void;
55
55
  getString(): string;
56
56
  _hasIncompleteAsyncEffects(): boolean;
57
+ private _hasIncompleteAsyncEffectsInSubtreeForPhase;
57
58
  getCurrentRenderPhase(): RenderPhase | null;
58
59
  getRenderGraph(): Record<string, any>;
59
60
  runRenderCycle(): void;
@@ -965,6 +966,7 @@ declare class Port extends PrimitiveComponent<typeof portProps> {
965
966
  doInitialSourceRender(): void;
966
967
  doInitialSourceParentAttachment(): void;
967
968
  doInitialPcbPortRender(): void;
969
+ updatePcbPortRender(): void;
968
970
  doInitialSchematicPortRender(): void;
969
971
  _getSubcircuitConnectivityKey(): string | undefined;
970
972
  _setPositionFromLayout(newCenter: {
package/dist/index.js CHANGED
@@ -126,6 +126,9 @@ var orderedRenderPhases = [
126
126
  "CadModelRender",
127
127
  "PartsEngineRender"
128
128
  ];
129
+ var asyncPhaseDependencies = {
130
+ PcbTraceRender: ["PcbFootprintStringRender"]
131
+ };
129
132
  var globalRenderCounter = 0;
130
133
  var Renderable = class {
131
134
  renderPhaseStates;
@@ -227,6 +230,17 @@ ${error.stack}`
227
230
  _hasIncompleteAsyncEffects() {
228
231
  return this._asyncEffects.some((effect) => !effect.complete);
229
232
  }
233
+ _hasIncompleteAsyncEffectsInSubtreeForPhase(phase) {
234
+ for (const e of this._asyncEffects) {
235
+ if (!e.complete && e.phase === phase) return true;
236
+ }
237
+ for (const child of this.children) {
238
+ const renderableChild = child;
239
+ if (renderableChild._hasIncompleteAsyncEffectsInSubtreeForPhase(phase))
240
+ return true;
241
+ }
242
+ return false;
243
+ }
230
244
  getCurrentRenderPhase() {
231
245
  return this._currentRenderPhase;
232
246
  }
@@ -274,6 +288,10 @@ ${error.stack}`
274
288
  const hasIncompleteEffects = this._asyncEffects.filter((e) => e.phase === prevPhase).some((e) => !e.complete);
275
289
  if (hasIncompleteEffects) return;
276
290
  }
291
+ const deps = asyncPhaseDependencies[phase] || [];
292
+ for (const depPhase of deps) {
293
+ if (this._hasIncompleteAsyncEffectsInSubtreeForPhase(depPhase)) return;
294
+ }
277
295
  this._emitRenderLifecycleEvent(phase, "start");
278
296
  if (isInitialized) {
279
297
  if (isDirty) {
@@ -3280,6 +3298,36 @@ var Port = class extends PrimitiveComponent2 {
3280
3298
  );
3281
3299
  }
3282
3300
  }
3301
+ updatePcbPortRender() {
3302
+ if (this.root?.pcbDisabled) return;
3303
+ const { db } = this.root;
3304
+ if (this.pcb_port_id) return;
3305
+ const pcbMatches = this.matchedComponents.filter((c) => c.isPcbPrimitive);
3306
+ if (pcbMatches.length === 0) return;
3307
+ let matchCenter = null;
3308
+ if (pcbMatches.length === 1) {
3309
+ matchCenter = pcbMatches[0]._getPcbCircuitJsonBounds().center;
3310
+ }
3311
+ if (pcbMatches.length > 1) {
3312
+ try {
3313
+ if (areAllPcbPrimitivesOverlapping(pcbMatches)) {
3314
+ matchCenter = getCenterOfPcbPrimitives(pcbMatches);
3315
+ }
3316
+ } catch {
3317
+ }
3318
+ }
3319
+ if (!matchCenter) return;
3320
+ const subcircuit = this.getSubcircuit();
3321
+ const pcb_port = db.pcb_port.insert({
3322
+ pcb_component_id: this.parent?.pcb_component_id,
3323
+ layers: this.getAvailablePcbLayers(),
3324
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
3325
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0,
3326
+ ...matchCenter,
3327
+ source_port_id: this.source_port_id
3328
+ });
3329
+ this.pcb_port_id = pcb_port.pcb_port_id;
3330
+ }
3283
3331
  doInitialSchematicPortRender() {
3284
3332
  const { db } = this.root;
3285
3333
  const { _parsedProps: props } = this;
@@ -6527,6 +6575,11 @@ function NormalComponent_doInitialPcbFootprintStringRender(component, queueAsync
6527
6575
  circuitJson
6528
6576
  );
6529
6577
  component.addAll(fpComponents);
6578
+ for (const child of component.children) {
6579
+ if (child.componentName === "Port") {
6580
+ child._markDirty?.("PcbPortRender");
6581
+ }
6582
+ }
6530
6583
  component._markDirty("InitializePortsFromChildren");
6531
6584
  });
6532
6585
  return;
@@ -14184,7 +14237,7 @@ import { identity as identity6 } from "transformation-matrix";
14184
14237
  var package_default = {
14185
14238
  name: "@tscircuit/core",
14186
14239
  type: "module",
14187
- version: "0.0.692",
14240
+ version: "0.0.694",
14188
14241
  types: "dist/index.d.ts",
14189
14242
  main: "dist/index.js",
14190
14243
  module: "dist/index.js",
@@ -14221,7 +14274,7 @@ var package_default = {
14221
14274
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
14222
14275
  "@tscircuit/log-soup": "^1.0.2",
14223
14276
  "@tscircuit/matchpack": "^0.0.16",
14224
- "@tscircuit/math-utils": "^0.0.19",
14277
+ "@tscircuit/math-utils": "^0.0.21",
14225
14278
  "@tscircuit/miniflex": "^0.0.4",
14226
14279
  "@tscircuit/props": "0.0.298",
14227
14280
  "@tscircuit/schematic-autolayout": "^0.0.6",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.693",
4
+ "version": "0.0.695",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "@tscircuit/infgrid-ijump-astar": "^0.0.33",
39
39
  "@tscircuit/log-soup": "^1.0.2",
40
40
  "@tscircuit/matchpack": "^0.0.16",
41
- "@tscircuit/math-utils": "^0.0.19",
41
+ "@tscircuit/math-utils": "^0.0.21",
42
42
  "@tscircuit/miniflex": "^0.0.4",
43
43
  "@tscircuit/props": "0.0.298",
44
44
  "@tscircuit/schematic-autolayout": "^0.0.6",