@tscircuit/core 0.0.198 → 0.0.200
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 +4 -2
- package/dist/index.js +20 -7
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ declare class Circuit {
|
|
|
118
118
|
_eventListeners: Record<RootCircuitEventName, Array<(...args: any[]) => void>>;
|
|
119
119
|
emit(event: RootCircuitEventName, ...args: any[]): void;
|
|
120
120
|
on(event: RootCircuitEventName, listener: (...args: any[]) => void): void;
|
|
121
|
+
getClientOrigin(): string;
|
|
121
122
|
}
|
|
122
123
|
/**
|
|
123
124
|
* @deprecated
|
|
@@ -805,6 +806,7 @@ declare class NormalComponent<ZodProps extends ZodType = any, PortNames extends
|
|
|
805
806
|
_getSchematicPortArrangement(): SchematicPortArrangement | null;
|
|
806
807
|
_getSchematicBoxDimensions(): SchematicBoxDimensions | null;
|
|
807
808
|
doInitialCadModelRender(): void;
|
|
809
|
+
private _addCachebustToModelUrl;
|
|
808
810
|
doInitialPartsEngineRender(): void;
|
|
809
811
|
updatePartsEngineRender(): void;
|
|
810
812
|
}
|
|
@@ -6205,7 +6207,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
6205
6207
|
}>, {
|
|
6206
6208
|
pinCount: zod.ZodNumber;
|
|
6207
6209
|
pitch: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
6208
|
-
gender: zod.ZodOptional<zod.ZodEnum<["male", "female"]
|
|
6210
|
+
gender: zod.ZodDefault<zod.ZodOptional<zod.ZodEnum<["male", "female"]>>>;
|
|
6209
6211
|
showSilkscreenPinLabels: zod.ZodOptional<zod.ZodBoolean>;
|
|
6210
6212
|
doubleRow: zod.ZodOptional<zod.ZodBoolean>;
|
|
6211
6213
|
holeDiameter: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
@@ -6215,6 +6217,7 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
6215
6217
|
}>, "strip", zod.ZodTypeAny, {
|
|
6216
6218
|
name: string;
|
|
6217
6219
|
pinCount: number;
|
|
6220
|
+
gender: "male" | "female";
|
|
6218
6221
|
pcbX?: number | undefined;
|
|
6219
6222
|
pcbY?: number | undefined;
|
|
6220
6223
|
pcbRotation?: number | undefined;
|
|
@@ -6283,7 +6286,6 @@ declare class PinHeader extends NormalComponent<typeof pinHeaderProps> {
|
|
|
6283
6286
|
holeDiameter?: number | undefined;
|
|
6284
6287
|
pinLabels?: string[] | undefined;
|
|
6285
6288
|
pitch?: number | undefined;
|
|
6286
|
-
gender?: "male" | "female" | undefined;
|
|
6287
6289
|
showSilkscreenPinLabels?: boolean | undefined;
|
|
6288
6290
|
doubleRow?: boolean | undefined;
|
|
6289
6291
|
platedDiameter?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -3110,12 +3110,17 @@ var NormalComponent = class extends PrimitiveComponent {
|
|
|
3110
3110
|
},
|
|
3111
3111
|
pcb_component_id: this.pcb_component_id,
|
|
3112
3112
|
source_component_id: this.source_component_id,
|
|
3113
|
-
model_stl_url: "stlUrl" in (cadModel ?? {}) ? cadModel.stlUrl : void 0,
|
|
3114
|
-
model_obj_url: "objUrl" in (cadModel ?? {}) ? cadModel.objUrl : void 0,
|
|
3113
|
+
model_stl_url: "stlUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.stlUrl) : void 0,
|
|
3114
|
+
model_obj_url: "objUrl" in (cadModel ?? {}) ? this._addCachebustToModelUrl(cadModel.objUrl) : void 0,
|
|
3115
3115
|
model_jscad: "jscad" in (cadModel ?? {}) ? cadModel.jscad : void 0,
|
|
3116
3116
|
footprinter_string: typeof this.props.footprint === "string" && !cadModel ? this.props.footprint : void 0
|
|
3117
3117
|
});
|
|
3118
3118
|
}
|
|
3119
|
+
_addCachebustToModelUrl(url) {
|
|
3120
|
+
if (!url || !url.includes("modelcdn.tscircuit.com")) return url;
|
|
3121
|
+
const origin = this.root?.getClientOrigin() ?? "";
|
|
3122
|
+
return `${url}${url.includes("?") ? "&" : "?"}cachebust_origin=${encodeURIComponent(origin)}`;
|
|
3123
|
+
}
|
|
3119
3124
|
doInitialPartsEngineRender() {
|
|
3120
3125
|
const { partsEngine } = this.getSubcircuit()._parsedProps;
|
|
3121
3126
|
if (!partsEngine) return;
|
|
@@ -5282,12 +5287,11 @@ var PinHeader = class extends NormalComponent {
|
|
|
5282
5287
|
const { db } = this.root;
|
|
5283
5288
|
const { _parsedProps: props } = this;
|
|
5284
5289
|
const source_component = db.source_component.insert({
|
|
5285
|
-
ftype: "
|
|
5290
|
+
ftype: "simple_pin_header",
|
|
5286
5291
|
name: props.name,
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
// pitch: props.pitch,
|
|
5292
|
+
supplier_part_numbers: props.supplierPartNumbers,
|
|
5293
|
+
pin_count: props.pinCount,
|
|
5294
|
+
gender: props.gender
|
|
5291
5295
|
});
|
|
5292
5296
|
const dimensions = this._getSchematicBoxDimensions();
|
|
5293
5297
|
const schematic_box_width = dimensions?.getSize().width;
|
|
@@ -5574,6 +5578,15 @@ var Circuit = class {
|
|
|
5574
5578
|
}
|
|
5575
5579
|
this._eventListeners[event].push(listener);
|
|
5576
5580
|
}
|
|
5581
|
+
getClientOrigin() {
|
|
5582
|
+
if (typeof window !== "undefined") {
|
|
5583
|
+
return window.location.origin;
|
|
5584
|
+
}
|
|
5585
|
+
if (typeof self !== "undefined") {
|
|
5586
|
+
return self.origin;
|
|
5587
|
+
}
|
|
5588
|
+
return "";
|
|
5589
|
+
}
|
|
5577
5590
|
};
|
|
5578
5591
|
var Project = Circuit;
|
|
5579
5592
|
|
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.200",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"@tscircuit/footprinter": "^0.0.77",
|
|
42
42
|
"@tscircuit/infgrid-ijump-astar": "^0.0.24",
|
|
43
43
|
"@tscircuit/math-utils": "^0.0.5",
|
|
44
|
-
"@tscircuit/props": "^0.0.
|
|
44
|
+
"@tscircuit/props": "^0.0.105",
|
|
45
45
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
46
46
|
"@tscircuit/soup-util": "^0.0.40",
|
|
47
|
-
"circuit-json": "^0.0.
|
|
47
|
+
"circuit-json": "^0.0.108",
|
|
48
48
|
"circuit-json-to-connectivity-map": "^0.0.17",
|
|
49
49
|
"format-si-unit": "^0.0.2",
|
|
50
50
|
"nanoid": "^5.0.7",
|