@tscircuit/core 0.0.422 → 0.0.424
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 +11 -3
- package/dist/index.js +42 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1002,6 +1002,8 @@ declare class NormalComponent<ZodProps extends ZodType = any, PortNames extends
|
|
|
1002
1002
|
_getSchematicBoxDimensions(): SchematicBoxDimensions | null;
|
|
1003
1003
|
doInitialCadModelRender(): void;
|
|
1004
1004
|
private _addCachebustToModelUrl;
|
|
1005
|
+
private _getPartsEngineCacheKey;
|
|
1006
|
+
private _getSupplierPartNumbers;
|
|
1005
1007
|
doInitialPartsEngineRender(): void;
|
|
1006
1008
|
updatePartsEngineRender(): void;
|
|
1007
1009
|
doInitialCreateTracesFromProps(): void;
|
|
@@ -12243,7 +12245,7 @@ declare const getPhaseTimingsFromRenderEvents: (renderEvents: RenderEvent[]) =>
|
|
|
12243
12245
|
type Nums16 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16";
|
|
12244
12246
|
type Nums40 = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "19" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "30" | "31" | "32" | "33" | "34" | "35" | "36" | "37" | "38" | "39" | "40";
|
|
12245
12247
|
type PinNumbers100 = "pin0" | "pin1" | "pin2" | "pin3" | "pin4" | "pin5" | "pin6" | "pin7" | "pin8" | "pin9" | "pin10" | "pin11" | "pin12" | "pin13" | "pin14" | "pin15" | "pin16" | "pin17" | "pin18" | "pin19" | "pin20" | "pin21" | "pin22" | "pin23" | "pin24" | "pin25" | "pin26" | "pin27" | "pin28" | "pin29" | "pin30" | "pin31" | "pin32" | "pin33" | "pin34" | "pin35" | "pin36" | "pin37" | "pin38" | "pin39" | "pin40" | "pin41" | "pin42" | "pin43" | "pin44" | "pin45" | "pin46" | "pin47" | "pin48" | "pin49" | "pin50" | "pin51" | "pin52" | "pin53" | "pin54" | "pin55" | "pin56" | "pin57" | "pin58" | "pin59" | "pin60" | "pin61" | "pin62" | "pin63" | "pin64" | "pin65" | "pin66" | "pin67" | "pin68" | "pin69" | "pin70" | "pin71" | "pin72" | "pin73" | "pin74" | "pin75" | "pin76" | "pin77" | "pin78" | "pin79" | "pin80" | "pin81" | "pin82" | "pin83" | "pin84" | "pin85" | "pin86" | "pin87" | "pin88" | "pin89" | "pin90" | "pin91" | "pin92" | "pin93" | "pin94" | "pin95" | "pin96" | "pin97" | "pin98" | "pin99" | "pin100";
|
|
12246
|
-
type CommonPinNames = "pos" | "neg" | "V5" | "V3_3" | "PWR" | "VCC" | "VDD" | "GND" | "SHLD" | `D${Nums40}` | `GP${Nums40}` | `GPIO${Nums40}` | "DP" | "DN" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "OUT" | "DISCH" | "EN" | "IN" | "CLK" | "DATA" | "THRES" | "TRIG" | "RESET" | `A${Nums40}` | `B${Nums40}` | PinNumbers100;
|
|
12248
|
+
type CommonPinNames = "pos" | "neg" | "V5" | "V3_3" | "PWR" | "VCC" | "VDD" | "GND" | "SHLD" | `D${Nums40}` | `GP${Nums40}` | `GPIO${Nums40}` | "DP" | "DN" | "VIN" | "VOUT" | "VREF" | "VIN" | "VOUT" | "VREF" | "VUSB" | "VIN" | "VOUT" | "VREF" | "OUT" | "DISCH" | "EN" | "IN" | "CLK" | "DATA" | "THRES" | "TRIG" | "RESET" | "DM" | "DP" | "CC1" | "CC2" | `A${Nums40}` | `B${Nums40}` | PinNumbers100;
|
|
12247
12249
|
type TransistorPinNames = "base" | "collector" | "emitter";
|
|
12248
12250
|
|
|
12249
12251
|
type NonPolarizedSel = Record<`R${Nums40}`, {
|
|
@@ -12270,7 +12272,7 @@ type PolarizedSel = Record<`C${Nums40}` | `L${Nums40}` | `LED${Nums40}` | `D${Nu
|
|
|
12270
12272
|
}>;
|
|
12271
12273
|
type CommonNetNames = "VCC" | "GND" | "VDD" | "PWR" | "V5" | "V3_3" | "VIN" | "SHLD" | "EN";
|
|
12272
12274
|
type TransistorSel = Record<`Q${Nums40}`, Record<TransistorPinNames, string>>;
|
|
12273
|
-
type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string
|
|
12275
|
+
type JumperSel = Record<`J${Nums40}` | `CN${Nums40}`, Record<PinNumbers100 | CommonPinNames, string> & ChipFnSel>;
|
|
12274
12276
|
type ChipSel = Record<`U${Nums40}`, Record<CommonPinNames, string> & ChipFnSel>;
|
|
12275
12277
|
type NetSel = Record<"net", Record<CommonNetNames, string>>;
|
|
12276
12278
|
type ExplicitModuleSel = Record<"subcircuit" | "module" | "group", Record<`S${Nums40}` | `M${Nums40}` | `G${Nums40}`, SelWithoutSubcircuit>>;
|
|
@@ -12290,6 +12292,12 @@ type ChipFnSel = <T extends ChipFn<any> | string>(chipFn?: T) => UnionToIntersec
|
|
|
12290
12292
|
type Sel = ExplicitModuleSel & SelWithoutSubcircuit;
|
|
12291
12293
|
declare const sel: Sel;
|
|
12292
12294
|
|
|
12295
|
+
interface LocalCacheEngine {
|
|
12296
|
+
getItem(key: string): string | Promise<string | null> | null;
|
|
12297
|
+
setItem(key: string, value: string): void | Promise<void>;
|
|
12298
|
+
removeItem?(key: string): void | Promise<void>;
|
|
12299
|
+
}
|
|
12300
|
+
|
|
12293
12301
|
type AutorouterCompleteEvent = {
|
|
12294
12302
|
type: "complete";
|
|
12295
12303
|
traces: SimplifiedPcbTrace[];
|
|
@@ -12396,4 +12404,4 @@ declare module "react/jsx-runtime" {
|
|
|
12396
12404
|
}
|
|
12397
12405
|
}
|
|
12398
12406
|
|
|
12399
|
-
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Cutout, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
12407
|
+
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Cutout, Diode, FabricationNotePath, FabricationNoteText, Footprint, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetAlias, NormalComponent, type Obstacle, PcbTrace, PinHeader, type PinLabelSpec, PlatedHole, Port, Potentiometer, PowerSource, PrimitiveComponent, Project, PushButton, type RenderPhase, type RenderPhaseFn, type RenderPhaseFunctions, type RenderPhaseStates, Renderable, Resistor, Resonator, RootCircuit, type RootCircuitEventName, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, Subcircuit, Switch, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -5707,6 +5707,43 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
5707
5707
|
const origin = this.root?.getClientOrigin() ?? "";
|
|
5708
5708
|
return `${url}${url.includes("?") ? "&" : "?"}cachebust_origin=${encodeURIComponent(origin)}`;
|
|
5709
5709
|
}
|
|
5710
|
+
_getPartsEngineCacheKey(source_component, footprinterString) {
|
|
5711
|
+
return JSON.stringify({
|
|
5712
|
+
ftype: source_component.ftype,
|
|
5713
|
+
name: source_component.name,
|
|
5714
|
+
manufacturer_part_number: source_component.manufacturer_part_number,
|
|
5715
|
+
footprinterString
|
|
5716
|
+
});
|
|
5717
|
+
}
|
|
5718
|
+
async _getSupplierPartNumbers(partsEngine, source_component, footprinterString) {
|
|
5719
|
+
const cacheEngine = this.root?.platform?.localCacheEngine;
|
|
5720
|
+
const cacheKey = this._getPartsEngineCacheKey(
|
|
5721
|
+
source_component,
|
|
5722
|
+
footprinterString
|
|
5723
|
+
);
|
|
5724
|
+
if (cacheEngine) {
|
|
5725
|
+
const cached = await cacheEngine.getItem(cacheKey);
|
|
5726
|
+
if (cached) {
|
|
5727
|
+
try {
|
|
5728
|
+
return JSON.parse(cached);
|
|
5729
|
+
} catch {
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
}
|
|
5733
|
+
const result = await Promise.resolve(
|
|
5734
|
+
partsEngine.findPart({
|
|
5735
|
+
sourceComponent: source_component,
|
|
5736
|
+
footprinterString
|
|
5737
|
+
})
|
|
5738
|
+
);
|
|
5739
|
+
if (cacheEngine) {
|
|
5740
|
+
try {
|
|
5741
|
+
await cacheEngine.setItem(cacheKey, JSON.stringify(result));
|
|
5742
|
+
} catch {
|
|
5743
|
+
}
|
|
5744
|
+
}
|
|
5745
|
+
return result;
|
|
5746
|
+
}
|
|
5710
5747
|
doInitialPartsEngineRender() {
|
|
5711
5748
|
const partsEngine = this.getInheritedProperty("partsEngine");
|
|
5712
5749
|
if (!partsEngine) return;
|
|
@@ -5718,10 +5755,11 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
5718
5755
|
if (this.props.footprint && typeof this.props.footprint === "string") {
|
|
5719
5756
|
footprinterString = this.props.footprint;
|
|
5720
5757
|
}
|
|
5721
|
-
const supplierPartNumbersMaybePromise =
|
|
5722
|
-
|
|
5758
|
+
const supplierPartNumbersMaybePromise = this._getSupplierPartNumbers(
|
|
5759
|
+
partsEngine,
|
|
5760
|
+
source_component,
|
|
5723
5761
|
footprinterString
|
|
5724
|
-
|
|
5762
|
+
);
|
|
5725
5763
|
if (!(supplierPartNumbersMaybePromise instanceof Promise)) {
|
|
5726
5764
|
db.source_component.update(this.source_component_id, {
|
|
5727
5765
|
supplier_part_numbers: supplierPartNumbersMaybePromise
|
|
@@ -8481,7 +8519,7 @@ import { identity as identity4 } from "transformation-matrix";
|
|
|
8481
8519
|
var package_default = {
|
|
8482
8520
|
name: "@tscircuit/core",
|
|
8483
8521
|
type: "module",
|
|
8484
|
-
version: "0.0.
|
|
8522
|
+
version: "0.0.423",
|
|
8485
8523
|
types: "dist/index.d.ts",
|
|
8486
8524
|
main: "dist/index.js",
|
|
8487
8525
|
module: "dist/index.js",
|