@tscircuit/core 0.0.1103 → 0.0.1104
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 +10 -2
- package/dist/index.js +97 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -174,9 +174,9 @@ interface IIsolatedCircuit {
|
|
|
174
174
|
interface IRootCircuit extends IIsolatedCircuit {
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
|
|
177
|
+
declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "RenderIsolatedSubcircuits", "InflateSubcircuitCircuitJson", "SourceNameDuplicateComponentRemoval", "PcbFootprintStringRender", "InitializePortsFromChildren", "CreateNetsFromProps", "AssignFallbackProps", "CreateTracesFromProps", "CreateTracesFromNetLabels", "CreateTraceHintsFromProps", "SourceGroupRender", "AssignNameToUnnamedComponents", "SourceRender", "SourceParentAttachment", "PortMatching", "OptimizeSelectorCache", "SourceTraceRender", "SourceAddConnectivityMapKey", "SourceDesignRuleChecks", "SimulationRender", "SchematicComponentRender", "SchematicPortRender", "SymbolContainerRender", "SchematicPrimitiveRender", "SchematicSymbolResize", "SchematicComponentSizeCalculation", "SchematicLayout", "SchematicTraceRender", "SchematicReplaceNetLabelsWithSymbols", "PanelBoardLayout", "ValidatePcbCoordinates", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbComponentSizeCalculation", "PcbComponentAnchorAlignment", "PcbCalcPlacementResolution", "PcbLayout", "PcbBoardAutoSize", "PanelLayout", "PcbTraceHintRender", "PcbManualTraceRender", "PcbTraceRender", "PcbRouteNetIslands", "PcbCopperPourRender", "PcbDesignRuleChecks", "SilkscreenOverlapAdjustment", "CadModelRender", "PartsEngineRender", "SimulationSpiceEngineRender"];
|
|
178
178
|
type RenderPhase = (typeof orderedRenderPhases)[number];
|
|
179
|
-
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
|
|
179
|
+
declare const renderPhaseIndexMap: Map<"ReactSubtreesRender" | "RenderIsolatedSubcircuits" | "InflateSubcircuitCircuitJson" | "SourceNameDuplicateComponentRemoval" | "PcbFootprintStringRender" | "InitializePortsFromChildren" | "CreateNetsFromProps" | "AssignFallbackProps" | "CreateTracesFromProps" | "CreateTracesFromNetLabels" | "CreateTraceHintsFromProps" | "SourceGroupRender" | "AssignNameToUnnamedComponents" | "SourceRender" | "SourceParentAttachment" | "PortMatching" | "OptimizeSelectorCache" | "SourceTraceRender" | "SourceAddConnectivityMapKey" | "SourceDesignRuleChecks" | "SimulationRender" | "SchematicComponentRender" | "SchematicPortRender" | "SymbolContainerRender" | "SchematicPrimitiveRender" | "SchematicSymbolResize" | "SchematicComponentSizeCalculation" | "SchematicLayout" | "SchematicTraceRender" | "SchematicReplaceNetLabelsWithSymbols" | "PanelBoardLayout" | "ValidatePcbCoordinates" | "PcbComponentRender" | "PcbPrimitiveRender" | "PcbFootprintLayout" | "PcbPortRender" | "PcbPortAttachment" | "PcbComponentSizeCalculation" | "PcbComponentAnchorAlignment" | "PcbCalcPlacementResolution" | "PcbLayout" | "PcbBoardAutoSize" | "PanelLayout" | "PcbTraceHintRender" | "PcbManualTraceRender" | "PcbTraceRender" | "PcbRouteNetIslands" | "PcbCopperPourRender" | "PcbDesignRuleChecks" | "SilkscreenOverlapAdjustment" | "CadModelRender" | "PartsEngineRender" | "SimulationSpiceEngineRender", number>;
|
|
180
180
|
type RenderPhaseFn<K extends RenderPhase = RenderPhase> = `doInitial${K}` | `update${K}` | `remove${K}`;
|
|
181
181
|
type RenderPhaseStates = Record<RenderPhase, {
|
|
182
182
|
initialized: boolean;
|
|
@@ -499,6 +499,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
499
499
|
pcb_component_id: string | null;
|
|
500
500
|
cad_component_id: string | null;
|
|
501
501
|
_reportedInvalidPcbCalcWarnings: Set<string>;
|
|
502
|
+
private _reportInvalidComponentPropertyError;
|
|
502
503
|
fallbackUnassignedName?: string;
|
|
503
504
|
constructor(props: z.input<ZodProps>);
|
|
504
505
|
setProps(props: Partial<z.input<ZodProps>>): void;
|
|
@@ -507,6 +508,12 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
507
508
|
pcbX: number;
|
|
508
509
|
pcbY: number;
|
|
509
510
|
};
|
|
511
|
+
doInitialValidatePcbCoordinates(): void;
|
|
512
|
+
protected _validatePcbCoordinateReferences(params: {
|
|
513
|
+
rawValue: unknown;
|
|
514
|
+
axis: "pcbX" | "pcbY";
|
|
515
|
+
propertyNameForError?: string;
|
|
516
|
+
}): void;
|
|
510
517
|
protected _resolvePcbCoordinate(rawValue: unknown, axis: "pcbX" | "pcbY", options?: {
|
|
511
518
|
allowBoardVariables?: boolean;
|
|
512
519
|
allowComponentVariables?: boolean;
|
|
@@ -1685,6 +1692,7 @@ declare class NormalComponent<ZodProps extends z.ZodType = any, PortNames extend
|
|
|
1685
1692
|
doInitialCreateTracesFromProps(): void;
|
|
1686
1693
|
_createTracesFromConnectionsProp(): void;
|
|
1687
1694
|
doInitialSourceDesignRuleChecks(): void;
|
|
1695
|
+
doInitialValidatePcbCoordinates(): void;
|
|
1688
1696
|
doInitialPcbLayout(): void;
|
|
1689
1697
|
/**
|
|
1690
1698
|
* Get the minimum flex container size for this component on PCB
|
package/dist/index.js
CHANGED
|
@@ -327,6 +327,7 @@ var orderedRenderPhases = [
|
|
|
327
327
|
"SchematicTraceRender",
|
|
328
328
|
"SchematicReplaceNetLabelsWithSymbols",
|
|
329
329
|
"PanelBoardLayout",
|
|
330
|
+
"ValidatePcbCoordinates",
|
|
330
331
|
"PcbComponentRender",
|
|
331
332
|
"PcbPrimitiveRender",
|
|
332
333
|
"PcbFootprintLayout",
|
|
@@ -373,6 +374,7 @@ var asyncPhaseDependencies = {
|
|
|
373
374
|
PartsEngineRender: ["PcbFootprintStringRender"],
|
|
374
375
|
PcbComponentAnchorAlignment: ["PcbFootprintStringRender"],
|
|
375
376
|
PcbCalcPlacementResolution: ["PcbFootprintStringRender"],
|
|
377
|
+
ValidatePcbCoordinates: ["PcbFootprintStringRender"],
|
|
376
378
|
SourceTraceRender: ["PcbFootprintStringRender"]
|
|
377
379
|
};
|
|
378
380
|
var globalRenderCounter = 0;
|
|
@@ -1200,6 +1202,18 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1200
1202
|
pcb_component_id = null;
|
|
1201
1203
|
cad_component_id = null;
|
|
1202
1204
|
_reportedInvalidPcbCalcWarnings = /* @__PURE__ */ new Set();
|
|
1205
|
+
_reportInvalidComponentPropertyError(propertyName, message) {
|
|
1206
|
+
if (!this.root || this._reportedInvalidPcbCalcWarnings.has(propertyName)) {
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
this.root.db.source_invalid_component_property_error.insert({
|
|
1210
|
+
source_component_id: this.source_component_id || "",
|
|
1211
|
+
property_name: propertyName,
|
|
1212
|
+
message,
|
|
1213
|
+
error_type: "source_invalid_component_property_error"
|
|
1214
|
+
});
|
|
1215
|
+
this._reportedInvalidPcbCalcWarnings.add(propertyName);
|
|
1216
|
+
}
|
|
1203
1217
|
fallbackUnassignedName;
|
|
1204
1218
|
constructor(props) {
|
|
1205
1219
|
super(props);
|
|
@@ -1249,6 +1263,47 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
1249
1263
|
pcbY: this._resolvePcbCoordinate(this._parsedProps.pcbY, "pcbY")
|
|
1250
1264
|
};
|
|
1251
1265
|
}
|
|
1266
|
+
doInitialValidatePcbCoordinates() {
|
|
1267
|
+
if (this.root?.pcbDisabled) return;
|
|
1268
|
+
const rawProps = this.props;
|
|
1269
|
+
const rawPcbX = rawProps.pcbX;
|
|
1270
|
+
const rawPcbY = rawProps.pcbY;
|
|
1271
|
+
this._validatePcbCoordinateReferences({
|
|
1272
|
+
rawValue: rawPcbX,
|
|
1273
|
+
axis: "pcbX",
|
|
1274
|
+
propertyNameForError: "pcbX"
|
|
1275
|
+
});
|
|
1276
|
+
this._validatePcbCoordinateReferences({
|
|
1277
|
+
rawValue: rawPcbY,
|
|
1278
|
+
axis: "pcbY",
|
|
1279
|
+
propertyNameForError: "pcbY"
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
_validatePcbCoordinateReferences(params) {
|
|
1283
|
+
const { rawValue, axis, propertyNameForError = axis } = params;
|
|
1284
|
+
if (typeof rawValue !== "string") return;
|
|
1285
|
+
const isNormalComponent = this._isNormalComponent === true;
|
|
1286
|
+
const allowComponentVariables = !isNormalComponent && !this._isInsideFootprint();
|
|
1287
|
+
let calcIdentifiers = [];
|
|
1288
|
+
try {
|
|
1289
|
+
calcIdentifiers = extractCalcIdentifiers(rawValue);
|
|
1290
|
+
} catch {
|
|
1291
|
+
this._reportInvalidComponentPropertyError(
|
|
1292
|
+
propertyNameForError,
|
|
1293
|
+
`Invalid ${propertyNameForError} value for ${this.componentName}: Invalid calc() expression. expression="${rawValue}"`
|
|
1294
|
+
);
|
|
1295
|
+
return;
|
|
1296
|
+
}
|
|
1297
|
+
const includesComponentVariable = calcIdentifiers.some(
|
|
1298
|
+
(identifier) => !identifier.startsWith("board.")
|
|
1299
|
+
);
|
|
1300
|
+
if (includesComponentVariable && !allowComponentVariables) {
|
|
1301
|
+
this._reportInvalidComponentPropertyError(
|
|
1302
|
+
propertyNameForError,
|
|
1303
|
+
`Invalid ${propertyNameForError} value for ${this.componentName}: component-relative calc references are not supported for footprint elements (${this.componentName}); ${propertyNameForError} will be ignored. expression="${rawValue}"`
|
|
1304
|
+
);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1252
1307
|
_resolvePcbCoordinate(rawValue, axis, options = {}) {
|
|
1253
1308
|
if (rawValue == null) return 0;
|
|
1254
1309
|
if (typeof rawValue === "number") return rawValue;
|
|
@@ -11140,6 +11195,46 @@ var NormalComponent3 = class extends PrimitiveComponent2 {
|
|
|
11140
11195
|
doInitialSourceDesignRuleChecks() {
|
|
11141
11196
|
NormalComponent_doInitialSourceDesignRuleChecks(this);
|
|
11142
11197
|
}
|
|
11198
|
+
doInitialValidatePcbCoordinates() {
|
|
11199
|
+
super.doInitialValidatePcbCoordinates();
|
|
11200
|
+
if (this.root?.pcbDisabled) return;
|
|
11201
|
+
const props = this._parsedProps;
|
|
11202
|
+
const rawProps = this.props;
|
|
11203
|
+
const pcbLeftEdgeX = typeof rawProps.pcbLeftEdgeX === "string" ? rawProps.pcbLeftEdgeX : props.pcbLeftEdgeX ?? rawProps.pcbLeftEdgeX;
|
|
11204
|
+
const pcbRightEdgeX = typeof rawProps.pcbRightEdgeX === "string" ? rawProps.pcbRightEdgeX : props.pcbRightEdgeX ?? rawProps.pcbRightEdgeX;
|
|
11205
|
+
const pcbTopEdgeY = typeof rawProps.pcbTopEdgeY === "string" ? rawProps.pcbTopEdgeY : props.pcbTopEdgeY ?? rawProps.pcbTopEdgeY;
|
|
11206
|
+
const pcbBottomEdgeY = typeof rawProps.pcbBottomEdgeY === "string" ? rawProps.pcbBottomEdgeY : props.pcbBottomEdgeY ?? rawProps.pcbBottomEdgeY;
|
|
11207
|
+
const hasExplicitPcbPosition = props.pcbX !== void 0 || props.pcbY !== void 0 || pcbLeftEdgeX !== void 0 || pcbRightEdgeX !== void 0 || pcbTopEdgeY !== void 0 || pcbBottomEdgeY !== void 0;
|
|
11208
|
+
if (!hasExplicitPcbPosition) return;
|
|
11209
|
+
if (pcbLeftEdgeX !== void 0) {
|
|
11210
|
+
this._validatePcbCoordinateReferences({
|
|
11211
|
+
rawValue: pcbLeftEdgeX,
|
|
11212
|
+
axis: "pcbX",
|
|
11213
|
+
propertyNameForError: "pcbLeftEdgeX"
|
|
11214
|
+
});
|
|
11215
|
+
}
|
|
11216
|
+
if (pcbRightEdgeX !== void 0) {
|
|
11217
|
+
this._validatePcbCoordinateReferences({
|
|
11218
|
+
rawValue: pcbRightEdgeX,
|
|
11219
|
+
axis: "pcbX",
|
|
11220
|
+
propertyNameForError: "pcbRightEdgeX"
|
|
11221
|
+
});
|
|
11222
|
+
}
|
|
11223
|
+
if (pcbTopEdgeY !== void 0) {
|
|
11224
|
+
this._validatePcbCoordinateReferences({
|
|
11225
|
+
rawValue: pcbTopEdgeY,
|
|
11226
|
+
axis: "pcbY",
|
|
11227
|
+
propertyNameForError: "pcbTopEdgeY"
|
|
11228
|
+
});
|
|
11229
|
+
}
|
|
11230
|
+
if (pcbBottomEdgeY !== void 0) {
|
|
11231
|
+
this._validatePcbCoordinateReferences({
|
|
11232
|
+
rawValue: pcbBottomEdgeY,
|
|
11233
|
+
axis: "pcbY",
|
|
11234
|
+
propertyNameForError: "pcbBottomEdgeY"
|
|
11235
|
+
});
|
|
11236
|
+
}
|
|
11237
|
+
}
|
|
11143
11238
|
doInitialPcbLayout() {
|
|
11144
11239
|
if (this.root?.pcbDisabled) return;
|
|
11145
11240
|
if (!this.pcb_component_id) return;
|
|
@@ -18264,7 +18359,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
18264
18359
|
var package_default = {
|
|
18265
18360
|
name: "@tscircuit/core",
|
|
18266
18361
|
type: "module",
|
|
18267
|
-
version: "0.0.
|
|
18362
|
+
version: "0.0.1103",
|
|
18268
18363
|
types: "dist/index.d.ts",
|
|
18269
18364
|
main: "dist/index.js",
|
|
18270
18365
|
module: "dist/index.js",
|
|
@@ -18296,8 +18391,8 @@ var package_default = {
|
|
|
18296
18391
|
"@biomejs/biome": "^1.8.3",
|
|
18297
18392
|
"@resvg/resvg-js": "^2.6.2",
|
|
18298
18393
|
"@tscircuit/alphabet": "0.0.18",
|
|
18394
|
+
"@tscircuit/checks": "0.0.108",
|
|
18299
18395
|
"@tscircuit/capacity-autorouter": "^0.0.326",
|
|
18300
|
-
"@tscircuit/checks": "0.0.107",
|
|
18301
18396
|
"@tscircuit/circuit-json-util": "^0.0.82",
|
|
18302
18397
|
"@tscircuit/common": "^0.0.20",
|
|
18303
18398
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.1104",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"@biomejs/biome": "^1.8.3",
|
|
34
34
|
"@resvg/resvg-js": "^2.6.2",
|
|
35
35
|
"@tscircuit/alphabet": "0.0.18",
|
|
36
|
+
"@tscircuit/checks": "0.0.108",
|
|
36
37
|
"@tscircuit/capacity-autorouter": "^0.0.326",
|
|
37
|
-
"@tscircuit/checks": "0.0.107",
|
|
38
38
|
"@tscircuit/circuit-json-util": "^0.0.82",
|
|
39
39
|
"@tscircuit/common": "^0.0.20",
|
|
40
40
|
"@tscircuit/copper-pour-solver": "^0.0.20",
|