@tscircuit/core 0.0.1368 → 0.0.1370
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 +20 -12
- package/dist/index.js +409 -43
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -66742,6 +66742,7 @@ declare class CurrentSource extends NormalComponent<typeof currentSourceProps, "
|
|
|
66742
66742
|
}
|
|
66743
66743
|
|
|
66744
66744
|
declare class Ammeter extends NormalComponent<typeof ammeterProps, "pos" | "neg"> {
|
|
66745
|
+
simulation_current_probe_id: string | null;
|
|
66745
66746
|
get config(): {
|
|
66746
66747
|
componentName: string;
|
|
66747
66748
|
schematicSymbolName: BaseSymbolName;
|
|
@@ -70109,8 +70110,8 @@ declare class Ammeter extends NormalComponent<typeof ammeterProps, "pos" | "neg"
|
|
|
70109
70110
|
color: zod.ZodOptional<zod.ZodString>;
|
|
70110
70111
|
graphDisplayName: zod.ZodOptional<zod.ZodString>;
|
|
70111
70112
|
graphCenter: zod.ZodOptional<zod.ZodNumber>;
|
|
70112
|
-
|
|
70113
|
-
|
|
70113
|
+
graphVerticalOffset: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
70114
|
+
graphCurrentPerDiv: zod.ZodOptional<zod.ZodUnion<[zod.ZodNumber, zod.ZodString]>>;
|
|
70114
70115
|
}, "strip", zod.ZodTypeAny, {
|
|
70115
70116
|
name: string;
|
|
70116
70117
|
connections: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>>;
|
|
@@ -70693,8 +70694,8 @@ declare class Ammeter extends NormalComponent<typeof ammeterProps, "pos" | "neg"
|
|
|
70693
70694
|
color?: string | undefined;
|
|
70694
70695
|
graphDisplayName?: string | undefined;
|
|
70695
70696
|
graphCenter?: number | undefined;
|
|
70696
|
-
|
|
70697
|
-
|
|
70697
|
+
graphVerticalOffset?: string | number | undefined;
|
|
70698
|
+
graphCurrentPerDiv?: string | number | undefined;
|
|
70698
70699
|
}, {
|
|
70699
70700
|
name: string;
|
|
70700
70701
|
connections: Partial<Record<"pin1" | "pin2" | "pos" | "neg", string | readonly string[] | string[]>>;
|
|
@@ -71279,8 +71280,8 @@ declare class Ammeter extends NormalComponent<typeof ammeterProps, "pos" | "neg"
|
|
|
71279
71280
|
color?: string | undefined;
|
|
71280
71281
|
graphDisplayName?: string | undefined;
|
|
71281
71282
|
graphCenter?: number | undefined;
|
|
71282
|
-
|
|
71283
|
-
|
|
71283
|
+
graphVerticalOffset?: string | number | undefined;
|
|
71284
|
+
graphCurrentPerDiv?: string | number | undefined;
|
|
71284
71285
|
}>;
|
|
71285
71286
|
sourceFtype: Ftype;
|
|
71286
71287
|
};
|
|
@@ -71289,6 +71290,7 @@ declare class Ammeter extends NormalComponent<typeof ammeterProps, "pos" | "neg"
|
|
|
71289
71290
|
initPorts(): void;
|
|
71290
71291
|
doInitialSourceRender(): void;
|
|
71291
71292
|
doInitialSimulationRender(): void;
|
|
71293
|
+
doInitialSchematicLayout(): void;
|
|
71292
71294
|
pos: Port;
|
|
71293
71295
|
neg: Port;
|
|
71294
71296
|
}
|
|
@@ -77714,6 +77716,7 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
|
77714
77716
|
componentName: string;
|
|
77715
77717
|
zodProps: zod.ZodObject<{
|
|
77716
77718
|
children: zod.ZodOptional<zod.ZodAny>;
|
|
77719
|
+
name: zod.ZodOptional<zod.ZodString>;
|
|
77717
77720
|
originalLayer: zod.ZodOptional<zod.ZodDefault<zod.ZodEffects<zod.ZodUnion<[zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>, zod.ZodObject<{
|
|
77718
77721
|
name: zod.ZodEnum<["top", "bottom", "inner1", "inner2", "inner3", "inner4", "inner5", "inner6"]>;
|
|
77719
77722
|
}, "strip", zod.ZodTypeAny, {
|
|
@@ -77727,12 +77730,14 @@ declare class Footprint extends PrimitiveComponent<typeof footprintProps> {
|
|
|
77727
77730
|
src: zod.ZodOptional<zod.ZodType<_tscircuit_props.FootprintProp, zod.ZodTypeDef, _tscircuit_props.FootprintProp>>;
|
|
77728
77731
|
insertionDirection: zod.ZodOptional<zod.ZodEnum<["from_above", "from_left", "from_right", "from_front", "from_back"]>>;
|
|
77729
77732
|
}, "strip", zod.ZodTypeAny, {
|
|
77733
|
+
name?: string | undefined;
|
|
77730
77734
|
children?: any;
|
|
77731
77735
|
circuitJson?: any[] | undefined;
|
|
77732
77736
|
originalLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | undefined;
|
|
77733
77737
|
src?: _tscircuit_props.FootprintProp | undefined;
|
|
77734
77738
|
insertionDirection?: "from_above" | "from_left" | "from_right" | "from_front" | "from_back" | undefined;
|
|
77735
77739
|
}, {
|
|
77740
|
+
name?: string | undefined;
|
|
77736
77741
|
children?: any;
|
|
77737
77742
|
circuitJson?: any[] | undefined;
|
|
77738
77743
|
originalLayer?: "top" | "bottom" | "inner1" | "inner2" | "inner3" | "inner4" | "inner5" | "inner6" | {
|
|
@@ -152986,6 +152991,7 @@ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulatio
|
|
|
152986
152991
|
abstol?: string | number | undefined;
|
|
152987
152992
|
vntol?: string | number | undefined;
|
|
152988
152993
|
}>>;
|
|
152994
|
+
graphIndependentAxes: zod.ZodOptional<zod.ZodBoolean>;
|
|
152989
152995
|
}, "strip", zod.ZodTypeAny, {
|
|
152990
152996
|
simulationType: "spice_transient_analysis";
|
|
152991
152997
|
name?: string | undefined;
|
|
@@ -152999,6 +153005,7 @@ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulatio
|
|
|
152999
153005
|
abstol?: string | number | undefined;
|
|
153000
153006
|
vntol?: string | number | undefined;
|
|
153001
153007
|
} | undefined;
|
|
153008
|
+
graphIndependentAxes?: boolean | undefined;
|
|
153002
153009
|
}, {
|
|
153003
153010
|
name?: string | undefined;
|
|
153004
153011
|
duration?: string | number | undefined;
|
|
@@ -153012,6 +153019,7 @@ declare class AnalogSimulation extends PrimitiveComponent<typeof analogSimulatio
|
|
|
153012
153019
|
abstol?: string | number | undefined;
|
|
153013
153020
|
vntol?: string | number | undefined;
|
|
153014
153021
|
} | undefined;
|
|
153022
|
+
graphIndependentAxes?: boolean | undefined;
|
|
153015
153023
|
}>;
|
|
153016
153024
|
};
|
|
153017
153025
|
doInitialSimulationRender(): void;
|
|
@@ -156390,8 +156398,8 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
|
|
|
156390
156398
|
color: z.ZodOptional<z.ZodString>;
|
|
156391
156399
|
graphDisplayName: z.ZodOptional<z.ZodString>;
|
|
156392
156400
|
graphCenter: z.ZodOptional<z.ZodNumber>;
|
|
156393
|
-
|
|
156394
|
-
|
|
156401
|
+
graphVerticalOffset: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
156402
|
+
graphVoltagePerDiv: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
156395
156403
|
}, "strip", z.ZodTypeAny, {
|
|
156396
156404
|
connectsTo: string;
|
|
156397
156405
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
@@ -156975,8 +156983,8 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
|
|
|
156975
156983
|
referenceTo?: string | undefined;
|
|
156976
156984
|
graphDisplayName?: string | undefined;
|
|
156977
156985
|
graphCenter?: number | undefined;
|
|
156978
|
-
|
|
156979
|
-
|
|
156986
|
+
graphVerticalOffset?: string | number | undefined;
|
|
156987
|
+
graphVoltagePerDiv?: string | number | undefined;
|
|
156980
156988
|
}, {
|
|
156981
156989
|
connectsTo: string;
|
|
156982
156990
|
symbol?: _tscircuit_props.SymbolProp | undefined;
|
|
@@ -157562,8 +157570,8 @@ declare class VoltageProbe extends PrimitiveComponent<typeof voltageProbeProps>
|
|
|
157562
157570
|
referenceTo?: string | undefined;
|
|
157563
157571
|
graphDisplayName?: string | undefined;
|
|
157564
157572
|
graphCenter?: number | undefined;
|
|
157565
|
-
|
|
157566
|
-
|
|
157573
|
+
graphVerticalOffset?: string | number | undefined;
|
|
157574
|
+
graphVoltagePerDiv?: string | number | undefined;
|
|
157567
157575
|
}>;
|
|
157568
157576
|
};
|
|
157569
157577
|
doInitialSimulationRender(): void;
|
package/dist/index.js
CHANGED
|
@@ -11290,7 +11290,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11290
11290
|
x: -sideLengths.bottom / 2 + p.distanceFromOrthogonalEdge,
|
|
11291
11291
|
len: getLabelLen(p.pinNumber)
|
|
11292
11292
|
})).filter((p) => p.len > 0);
|
|
11293
|
-
const
|
|
11293
|
+
const rectsOverlap2 = (a, b) => Math.min(a.maxX, b.maxX) > Math.max(a.minX, b.minX) && Math.min(a.maxY, b.maxY) > Math.max(a.minY, b.minY);
|
|
11294
11294
|
const getLeftRect = (label, width) => ({
|
|
11295
11295
|
minX: -width / 2 + LABEL_EDGE_OFFSET,
|
|
11296
11296
|
maxX: -width / 2 + LABEL_EDGE_OFFSET + label.len,
|
|
@@ -11319,7 +11319,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11319
11319
|
let hasTopBottomLabelCollision = false;
|
|
11320
11320
|
for (const topLabel of topLabels) {
|
|
11321
11321
|
for (const bottomLabel of bottomLabels) {
|
|
11322
|
-
if (
|
|
11322
|
+
if (rectsOverlap2(
|
|
11323
11323
|
getTopRect(topLabel, schHeight),
|
|
11324
11324
|
getBottomRect(bottomLabel, schHeight)
|
|
11325
11325
|
)) {
|
|
@@ -11336,7 +11336,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11336
11336
|
const topRect = getTopRect(topLabel, schHeight);
|
|
11337
11337
|
for (const leftLabel of leftLabels) {
|
|
11338
11338
|
const leftRect = getLeftRect(leftLabel, resolvedSchWidth);
|
|
11339
|
-
if (
|
|
11339
|
+
if (rectsOverlap2(topRect, leftRect)) {
|
|
11340
11340
|
schHeight = Math.max(
|
|
11341
11341
|
schHeight,
|
|
11342
11342
|
2 * (leftRect.maxY + LABEL_EDGE_OFFSET + topLabel.len)
|
|
@@ -11345,7 +11345,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11345
11345
|
}
|
|
11346
11346
|
for (const rightLabel of rightLabels) {
|
|
11347
11347
|
const rightRect = getRightRect(rightLabel, resolvedSchWidth);
|
|
11348
|
-
if (
|
|
11348
|
+
if (rectsOverlap2(topRect, rightRect)) {
|
|
11349
11349
|
schHeight = Math.max(
|
|
11350
11350
|
schHeight,
|
|
11351
11351
|
2 * (rightRect.maxY + LABEL_EDGE_OFFSET + topLabel.len)
|
|
@@ -11357,7 +11357,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11357
11357
|
const bottomRect = getBottomRect(bottomLabel, schHeight);
|
|
11358
11358
|
for (const leftLabel of leftLabels) {
|
|
11359
11359
|
const leftRect = getLeftRect(leftLabel, resolvedSchWidth);
|
|
11360
|
-
if (
|
|
11360
|
+
if (rectsOverlap2(bottomRect, leftRect)) {
|
|
11361
11361
|
schHeight = Math.max(
|
|
11362
11362
|
schHeight,
|
|
11363
11363
|
2 * (LABEL_EDGE_OFFSET + bottomLabel.len - leftRect.minY)
|
|
@@ -11366,7 +11366,7 @@ var getAllDimensionsForSchematicBox = (params) => {
|
|
|
11366
11366
|
}
|
|
11367
11367
|
for (const rightLabel of rightLabels) {
|
|
11368
11368
|
const rightRect = getRightRect(rightLabel, resolvedSchWidth);
|
|
11369
|
-
if (
|
|
11369
|
+
if (rectsOverlap2(bottomRect, rightRect)) {
|
|
11370
11370
|
schHeight = Math.max(
|
|
11371
11371
|
schHeight,
|
|
11372
11372
|
2 * (LABEL_EDGE_OFFSET + bottomLabel.len - rightRect.minY)
|
|
@@ -20772,6 +20772,178 @@ var getSpiceyEngine = () => {
|
|
|
20772
20772
|
};
|
|
20773
20773
|
};
|
|
20774
20774
|
|
|
20775
|
+
// lib/utils/simulation/parseSimulationGraphValue.ts
|
|
20776
|
+
var SI_PREFIX_MULTIPLIERS = {
|
|
20777
|
+
p: 1e-12,
|
|
20778
|
+
n: 1e-9,
|
|
20779
|
+
u: 1e-6,
|
|
20780
|
+
\u00B5: 1e-6,
|
|
20781
|
+
m: 1e-3,
|
|
20782
|
+
"": 1,
|
|
20783
|
+
k: 1e3,
|
|
20784
|
+
K: 1e3,
|
|
20785
|
+
M: 1e6,
|
|
20786
|
+
G: 1e9
|
|
20787
|
+
};
|
|
20788
|
+
var parseSimulationGraphValue = (value) => {
|
|
20789
|
+
if (value === void 0) return void 0;
|
|
20790
|
+
if (typeof value === "number") return value;
|
|
20791
|
+
const trimmed = value.trim();
|
|
20792
|
+
const match = trimmed.match(
|
|
20793
|
+
/^([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*([pnumµkKMG]?)/
|
|
20794
|
+
);
|
|
20795
|
+
if (!match) return void 0;
|
|
20796
|
+
const numericValue = Number(match[1]);
|
|
20797
|
+
if (!Number.isFinite(numericValue)) return void 0;
|
|
20798
|
+
return numericValue * (SI_PREFIX_MULTIPLIERS[match[2] ?? ""] ?? 1);
|
|
20799
|
+
};
|
|
20800
|
+
|
|
20801
|
+
// lib/components/primitive-components/Group/getGraphDisplayOverrides.ts
|
|
20802
|
+
var getVoltageProbeGraphDisplayOverrides = (probe) => {
|
|
20803
|
+
const {
|
|
20804
|
+
graphDisplayName,
|
|
20805
|
+
graphCenter,
|
|
20806
|
+
graphVerticalOffset,
|
|
20807
|
+
graphVoltagePerDiv
|
|
20808
|
+
} = probe._parsedProps;
|
|
20809
|
+
return {
|
|
20810
|
+
displayName: graphDisplayName,
|
|
20811
|
+
color: probe.color ?? void 0,
|
|
20812
|
+
center: graphCenter,
|
|
20813
|
+
verticalOffset: parseSimulationGraphValue(graphVerticalOffset),
|
|
20814
|
+
valuePerDiv: parseSimulationGraphValue(graphVoltagePerDiv)
|
|
20815
|
+
};
|
|
20816
|
+
};
|
|
20817
|
+
var getAmmeterGraphDisplayOverrides = (ammeter) => {
|
|
20818
|
+
const {
|
|
20819
|
+
color,
|
|
20820
|
+
graphDisplayName,
|
|
20821
|
+
graphCenter,
|
|
20822
|
+
graphVerticalOffset,
|
|
20823
|
+
graphCurrentPerDiv
|
|
20824
|
+
} = ammeter._parsedProps;
|
|
20825
|
+
return {
|
|
20826
|
+
displayName: graphDisplayName,
|
|
20827
|
+
color,
|
|
20828
|
+
center: graphCenter,
|
|
20829
|
+
verticalOffset: parseSimulationGraphValue(graphVerticalOffset),
|
|
20830
|
+
valuePerDiv: parseSimulationGraphValue(graphCurrentPerDiv)
|
|
20831
|
+
};
|
|
20832
|
+
};
|
|
20833
|
+
|
|
20834
|
+
// lib/components/primitive-components/Group/getFiniteBounds.ts
|
|
20835
|
+
var getFiniteBounds = (values) => {
|
|
20836
|
+
let min = Number.POSITIVE_INFINITY;
|
|
20837
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
20838
|
+
for (const value of values) {
|
|
20839
|
+
if (!Number.isFinite(value)) continue;
|
|
20840
|
+
min = Math.min(min, value);
|
|
20841
|
+
max = Math.max(max, value);
|
|
20842
|
+
}
|
|
20843
|
+
if (min === Number.POSITIVE_INFINITY || max === Number.NEGATIVE_INFINITY) {
|
|
20844
|
+
return null;
|
|
20845
|
+
}
|
|
20846
|
+
return { min, max };
|
|
20847
|
+
};
|
|
20848
|
+
|
|
20849
|
+
// lib/components/primitive-components/Group/getGraphLevels.ts
|
|
20850
|
+
var getGraphLevels = (graph) => graph.type === "simulation_transient_current_graph" ? graph.current_levels : graph.voltage_levels;
|
|
20851
|
+
|
|
20852
|
+
// lib/components/primitive-components/Group/getAutoDisplayScale.ts
|
|
20853
|
+
var DISPLAY_SECTION_HEIGHT_DIVS = 2;
|
|
20854
|
+
var DISPLAY_SECTION_DATA_FILL = 0.8;
|
|
20855
|
+
var getAutoDisplayScale = ({
|
|
20856
|
+
graph,
|
|
20857
|
+
index,
|
|
20858
|
+
graphCount
|
|
20859
|
+
}) => {
|
|
20860
|
+
const bounds = getFiniteBounds(getGraphLevels(graph));
|
|
20861
|
+
if (!bounds) return null;
|
|
20862
|
+
const center = (bounds.min + bounds.max) / 2;
|
|
20863
|
+
const span = bounds.max - bounds.min;
|
|
20864
|
+
const valuePerDiv = span > 0 ? span / (DISPLAY_SECTION_HEIGHT_DIVS * DISPLAY_SECTION_DATA_FILL) : Math.max(Math.abs(center) / 10, Number.EPSILON);
|
|
20865
|
+
return {
|
|
20866
|
+
display_center_value: center,
|
|
20867
|
+
display_center_offset_divs: ((graphCount - 1) / 2 - index) * DISPLAY_SECTION_HEIGHT_DIVS,
|
|
20868
|
+
value_per_div: valuePerDiv
|
|
20869
|
+
};
|
|
20870
|
+
};
|
|
20871
|
+
|
|
20872
|
+
// lib/components/primitive-components/Group/insertIndependentAxisScopeTraces.ts
|
|
20873
|
+
var isDefinedString = (value) => value !== void 0;
|
|
20874
|
+
var getTraceByVoltageProbeId = (traces) => {
|
|
20875
|
+
const traceByVoltageProbeId = /* @__PURE__ */ new Map();
|
|
20876
|
+
for (const trace of traces) {
|
|
20877
|
+
if (trace.simulation_voltage_probe_id) {
|
|
20878
|
+
traceByVoltageProbeId.set(trace.simulation_voltage_probe_id, trace);
|
|
20879
|
+
}
|
|
20880
|
+
}
|
|
20881
|
+
return traceByVoltageProbeId;
|
|
20882
|
+
};
|
|
20883
|
+
var getTraceByCurrentProbeId = (traces) => {
|
|
20884
|
+
const traceByCurrentProbeId = /* @__PURE__ */ new Map();
|
|
20885
|
+
for (const trace of traces) {
|
|
20886
|
+
if (trace.simulation_current_probe_id) {
|
|
20887
|
+
traceByCurrentProbeId.set(trace.simulation_current_probe_id, trace);
|
|
20888
|
+
}
|
|
20889
|
+
}
|
|
20890
|
+
return traceByCurrentProbeId;
|
|
20891
|
+
};
|
|
20892
|
+
var insertIndependentAxisScopeTraces = ({
|
|
20893
|
+
db,
|
|
20894
|
+
graphs,
|
|
20895
|
+
graphDisplayOverridesByProbeId
|
|
20896
|
+
}) => {
|
|
20897
|
+
if (graphs.length === 0) return;
|
|
20898
|
+
const existingScopeTraces = db.simulation_oscilloscope_trace.list();
|
|
20899
|
+
const traceByVoltageProbeId = getTraceByVoltageProbeId(existingScopeTraces);
|
|
20900
|
+
const traceByCurrentProbeId = getTraceByCurrentProbeId(existingScopeTraces);
|
|
20901
|
+
const graphIdsWithTrace = new Set(
|
|
20902
|
+
existingScopeTraces.flatMap((trace) => [
|
|
20903
|
+
trace.simulation_transient_voltage_graph_id,
|
|
20904
|
+
trace.simulation_transient_current_graph_id
|
|
20905
|
+
]).filter(isDefinedString)
|
|
20906
|
+
);
|
|
20907
|
+
for (const [index, { type, graph }] of graphs.entries()) {
|
|
20908
|
+
const scale2 = getAutoDisplayScale({
|
|
20909
|
+
graph,
|
|
20910
|
+
index,
|
|
20911
|
+
graphCount: graphs.length
|
|
20912
|
+
});
|
|
20913
|
+
if (!scale2) continue;
|
|
20914
|
+
const graphId = type === "voltage" ? graph.simulation_transient_voltage_graph_id : graph.simulation_transient_current_graph_id;
|
|
20915
|
+
if (graphIdsWithTrace.has(graphId)) continue;
|
|
20916
|
+
const sourceProbeId = graph.source_probe_id ?? void 0;
|
|
20917
|
+
const probeTrace = sourceProbeId === void 0 ? void 0 : type === "voltage" ? traceByVoltageProbeId.get(sourceProbeId) : traceByCurrentProbeId.get(sourceProbeId);
|
|
20918
|
+
const overrides = sourceProbeId === void 0 ? void 0 : graphDisplayOverridesByProbeId?.get(sourceProbeId);
|
|
20919
|
+
const valuePerDiv = overrides?.valuePerDiv ?? scale2.value_per_div;
|
|
20920
|
+
const displayCenter = overrides?.center ?? scale2.display_center_value;
|
|
20921
|
+
const displayCenterOffsetDivs = overrides?.verticalOffset !== void 0 && valuePerDiv !== 0 ? overrides.verticalOffset / valuePerDiv : probeTrace?.display_center_offset_divs ?? scale2.display_center_offset_divs;
|
|
20922
|
+
db.simulation_oscilloscope_trace.insert({
|
|
20923
|
+
...type === "voltage" ? {
|
|
20924
|
+
simulation_transient_voltage_graph_id: graph.simulation_transient_voltage_graph_id,
|
|
20925
|
+
volts_per_div: valuePerDiv
|
|
20926
|
+
} : {
|
|
20927
|
+
simulation_transient_current_graph_id: graph.simulation_transient_current_graph_id,
|
|
20928
|
+
amps_per_div: valuePerDiv
|
|
20929
|
+
},
|
|
20930
|
+
display_name: overrides?.displayName ?? probeTrace?.display_name,
|
|
20931
|
+
color: overrides?.color ?? probeTrace?.color ?? graph.color,
|
|
20932
|
+
display_center_value: displayCenter,
|
|
20933
|
+
display_center_offset_divs: displayCenterOffsetDivs
|
|
20934
|
+
});
|
|
20935
|
+
}
|
|
20936
|
+
};
|
|
20937
|
+
|
|
20938
|
+
// lib/components/primitive-components/Group/isCircuitElementInput.ts
|
|
20939
|
+
var isCircuitElementInput = (element) => Boolean(element && typeof element === "object" && "type" in element);
|
|
20940
|
+
|
|
20941
|
+
// lib/components/primitive-components/Group/isCurrentGraph.ts
|
|
20942
|
+
var isCurrentGraph = (element) => element.type === "simulation_transient_current_graph";
|
|
20943
|
+
|
|
20944
|
+
// lib/components/primitive-components/Group/isVoltageGraph.ts
|
|
20945
|
+
var isVoltageGraph = (element) => element.type === "simulation_transient_voltage_graph";
|
|
20946
|
+
|
|
20775
20947
|
// lib/components/primitive-components/Group/Group_doInitialSimulationSpiceEngineRender.ts
|
|
20776
20948
|
var debug11 = Debug13("tscircuit:core:Group_doInitialSimulationSpiceEngineRender");
|
|
20777
20949
|
function Group_doInitialSimulationSpiceEngineRender(group) {
|
|
@@ -20781,6 +20953,7 @@ function Group_doInitialSimulationSpiceEngineRender(group) {
|
|
|
20781
20953
|
const analogSims = group.selectAll("analogsimulation");
|
|
20782
20954
|
if (analogSims.length === 0) return;
|
|
20783
20955
|
const voltageProbes = group.selectAll("voltageprobe");
|
|
20956
|
+
const ammeters = group.selectAll("ammeter");
|
|
20784
20957
|
resetSimulationColorState();
|
|
20785
20958
|
const spiceEngineMap = { ...root.platform?.spiceEngineMap };
|
|
20786
20959
|
if (!spiceEngineMap.spicey) {
|
|
@@ -20804,15 +20977,33 @@ ${spiceString}`);
|
|
|
20804
20977
|
graphNameToProbe.set(probe.finalProbeName, probe);
|
|
20805
20978
|
}
|
|
20806
20979
|
}
|
|
20807
|
-
const voltageProbesById = new Map(
|
|
20808
|
-
|
|
20809
|
-
)
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20980
|
+
const voltageProbesById = /* @__PURE__ */ new Map();
|
|
20981
|
+
const graphDisplayOverridesByProbeId = /* @__PURE__ */ new Map();
|
|
20982
|
+
for (const probe of voltageProbes) {
|
|
20983
|
+
if (probe.simulation_voltage_probe_id) {
|
|
20984
|
+
voltageProbesById.set(probe.simulation_voltage_probe_id, probe);
|
|
20985
|
+
graphDisplayOverridesByProbeId.set(
|
|
20986
|
+
probe.simulation_voltage_probe_id,
|
|
20987
|
+
getVoltageProbeGraphDisplayOverrides(probe)
|
|
20988
|
+
);
|
|
20989
|
+
}
|
|
20990
|
+
}
|
|
20991
|
+
for (const ammeter of ammeters) {
|
|
20992
|
+
if (ammeter.simulation_current_probe_id) {
|
|
20993
|
+
graphDisplayOverridesByProbeId.set(
|
|
20994
|
+
ammeter.simulation_current_probe_id,
|
|
20995
|
+
getAmmeterGraphDisplayOverrides(ammeter)
|
|
20996
|
+
);
|
|
20997
|
+
}
|
|
20998
|
+
}
|
|
20999
|
+
const currentProbesById = /* @__PURE__ */ new Map();
|
|
21000
|
+
const currentProbesByName = /* @__PURE__ */ new Map();
|
|
21001
|
+
for (const probe of root.db.simulation_current_probe.list()) {
|
|
21002
|
+
currentProbesById.set(probe.simulation_current_probe_id, probe);
|
|
21003
|
+
if (probe.name !== void 0) {
|
|
21004
|
+
currentProbesByName.set(probe.name, probe);
|
|
21005
|
+
}
|
|
21006
|
+
}
|
|
20816
21007
|
const orderedSimulationProbes = root.db.simulation_voltage_probe.list().filter((probe) => voltageProbesById.has(probe.simulation_voltage_probe_id));
|
|
20817
21008
|
const graphNamesFromNetlist = getTransientVoltageGraphNamesFromSpiceNetlist(spiceNetlist);
|
|
20818
21009
|
if (graphNamesFromNetlist.length === orderedSimulationProbes.length) {
|
|
@@ -20856,16 +21047,23 @@ ${spiceString}`);
|
|
|
20856
21047
|
debug11("No simulation experiment found, skipping result insertion");
|
|
20857
21048
|
return;
|
|
20858
21049
|
}
|
|
20859
|
-
|
|
20860
|
-
|
|
21050
|
+
const insertedVoltageGraphs = [];
|
|
21051
|
+
const insertedCurrentGraphs = [];
|
|
21052
|
+
for (const rawElement of result.simulationResultCircuitJson) {
|
|
21053
|
+
if (!isCircuitElementInput(rawElement)) {
|
|
21054
|
+
debug11("Skipping invalid simulation result element");
|
|
21055
|
+
continue;
|
|
21056
|
+
}
|
|
21057
|
+
const element = rawElement;
|
|
21058
|
+
if (isVoltageGraph(element)) {
|
|
20861
21059
|
element.simulation_experiment_id = simulationExperiment.simulation_experiment_id;
|
|
20862
21060
|
const probeMatch = element.name ? graphNameToProbe.get(element.name) : void 0;
|
|
20863
21061
|
if (probeMatch) {
|
|
20864
|
-
element.color = probeMatch.color;
|
|
20865
|
-
element.source_probe_id = probeMatch.simulation_voltage_probe_id;
|
|
21062
|
+
element.color = probeMatch.color ?? void 0;
|
|
21063
|
+
element.source_probe_id = probeMatch.simulation_voltage_probe_id ?? void 0;
|
|
20866
21064
|
}
|
|
20867
21065
|
}
|
|
20868
|
-
if (element
|
|
21066
|
+
if (isCurrentGraph(element)) {
|
|
20869
21067
|
element.simulation_experiment_id = simulationExperiment.simulation_experiment_id;
|
|
20870
21068
|
const probeMatch = (element.source_probe_id ? currentProbesById.get(element.source_probe_id) : void 0) ?? (element.name ? currentProbesByName.get(element.name) : void 0);
|
|
20871
21069
|
if (probeMatch) {
|
|
@@ -20873,17 +21071,27 @@ ${spiceString}`);
|
|
|
20873
21071
|
element.source_probe_id = probeMatch.simulation_current_probe_id;
|
|
20874
21072
|
}
|
|
20875
21073
|
}
|
|
20876
|
-
const
|
|
20877
|
-
if (
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
|
|
20883
|
-
|
|
20884
|
-
|
|
20885
|
-
|
|
21074
|
+
const insertedElement = root.db.insert(element);
|
|
21075
|
+
if (isVoltageGraph(insertedElement)) {
|
|
21076
|
+
insertedVoltageGraphs.push({
|
|
21077
|
+
type: "voltage",
|
|
21078
|
+
graph: insertedElement
|
|
21079
|
+
});
|
|
21080
|
+
}
|
|
21081
|
+
if (isCurrentGraph(insertedElement)) {
|
|
21082
|
+
insertedCurrentGraphs.push({
|
|
21083
|
+
type: "current",
|
|
21084
|
+
graph: insertedElement
|
|
21085
|
+
});
|
|
20886
21086
|
}
|
|
21087
|
+
debug11(`Inserted ${element.type} into database`);
|
|
21088
|
+
}
|
|
21089
|
+
if (analogSim._parsedProps.graphIndependentAxes) {
|
|
21090
|
+
insertIndependentAxisScopeTraces({
|
|
21091
|
+
db: root.db,
|
|
21092
|
+
graphs: [...insertedVoltageGraphs, ...insertedCurrentGraphs],
|
|
21093
|
+
graphDisplayOverridesByProbeId
|
|
21094
|
+
});
|
|
20887
21095
|
}
|
|
20888
21096
|
group._markDirty("SimulationSpiceEngineRender");
|
|
20889
21097
|
} catch (error) {
|
|
@@ -24367,7 +24575,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
24367
24575
|
var package_default = {
|
|
24368
24576
|
name: "@tscircuit/core",
|
|
24369
24577
|
type: "module",
|
|
24370
|
-
version: "0.0.
|
|
24578
|
+
version: "0.0.1369",
|
|
24371
24579
|
types: "dist/index.d.ts",
|
|
24372
24580
|
main: "dist/index.js",
|
|
24373
24581
|
module: "dist/index.js",
|
|
@@ -24416,7 +24624,7 @@ var package_default = {
|
|
|
24416
24624
|
"@tscircuit/math-utils": "^0.0.36",
|
|
24417
24625
|
"@tscircuit/miniflex": "^0.0.4",
|
|
24418
24626
|
"@tscircuit/ngspice-spice-engine": "^0.0.18",
|
|
24419
|
-
"@tscircuit/props": "^0.0.
|
|
24627
|
+
"@tscircuit/props": "^0.0.565",
|
|
24420
24628
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
24421
24629
|
"@tscircuit/schematic-trace-solver": "^0.0.72",
|
|
24422
24630
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -24434,7 +24642,6 @@ var package_default = {
|
|
|
24434
24642
|
"circuit-json-to-bpc": "^0.0.13",
|
|
24435
24643
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
24436
24644
|
"circuit-json-to-gltf": "^0.0.105",
|
|
24437
|
-
"circuit-json-to-simple-3d": "^0.0.9",
|
|
24438
24645
|
"circuit-json-to-spice": "^0.0.40",
|
|
24439
24646
|
"circuit-to-svg": "^0.0.367",
|
|
24440
24647
|
concurrently: "^9.1.2",
|
|
@@ -27100,7 +27307,158 @@ var CurrentSource = class extends NormalComponent3 {
|
|
|
27100
27307
|
// lib/components/normal-components/Ammeter.ts
|
|
27101
27308
|
import { ammeterProps } from "@tscircuit/props";
|
|
27102
27309
|
import { symbols as symbols5 } from "schematic-symbols";
|
|
27310
|
+
|
|
27311
|
+
// lib/components/normal-components/Ammeter_doInitialSchematicLayout.ts
|
|
27312
|
+
var PLACEMENT_MARGIN = 0.25;
|
|
27313
|
+
var rectForComponent = (component, margin) => ({
|
|
27314
|
+
left: component.center.x - component.size.width / 2 - margin,
|
|
27315
|
+
right: component.center.x + component.size.width / 2 + margin,
|
|
27316
|
+
bottom: component.center.y - component.size.height / 2 - margin,
|
|
27317
|
+
top: component.center.y + component.size.height / 2 + margin
|
|
27318
|
+
});
|
|
27319
|
+
var rectsOverlap = (a, b) => a.left < b.right && a.right > b.left && a.bottom < b.top && a.top > b.bottom;
|
|
27320
|
+
var getCandidateCenters = ({
|
|
27321
|
+
baseCenter,
|
|
27322
|
+
size
|
|
27323
|
+
}) => {
|
|
27324
|
+
const xStep = size.width + PLACEMENT_MARGIN * 2;
|
|
27325
|
+
const yStep = size.height + PLACEMENT_MARGIN * 2;
|
|
27326
|
+
return [
|
|
27327
|
+
baseCenter,
|
|
27328
|
+
{ x: baseCenter.x, y: baseCenter.y + yStep },
|
|
27329
|
+
{ x: baseCenter.x, y: baseCenter.y - yStep },
|
|
27330
|
+
{ x: baseCenter.x + xStep, y: baseCenter.y },
|
|
27331
|
+
{ x: baseCenter.x - xStep, y: baseCenter.y },
|
|
27332
|
+
{ x: baseCenter.x + xStep, y: baseCenter.y + yStep },
|
|
27333
|
+
{ x: baseCenter.x - xStep, y: baseCenter.y + yStep },
|
|
27334
|
+
{ x: baseCenter.x + xStep, y: baseCenter.y - yStep },
|
|
27335
|
+
{ x: baseCenter.x - xStep, y: baseCenter.y - yStep },
|
|
27336
|
+
{ x: baseCenter.x, y: baseCenter.y + yStep * 2 },
|
|
27337
|
+
{ x: baseCenter.x, y: baseCenter.y - yStep * 2 }
|
|
27338
|
+
];
|
|
27339
|
+
};
|
|
27340
|
+
var getConnectedSchematicPort = ({
|
|
27341
|
+
ammeterSourcePortId,
|
|
27342
|
+
schematicPorts,
|
|
27343
|
+
sourceTraces
|
|
27344
|
+
}) => {
|
|
27345
|
+
for (const sourceTrace of sourceTraces) {
|
|
27346
|
+
if (!sourceTrace.connected_source_port_ids.includes(ammeterSourcePortId)) {
|
|
27347
|
+
continue;
|
|
27348
|
+
}
|
|
27349
|
+
const connectedSourcePortId = sourceTrace.connected_source_port_ids.find(
|
|
27350
|
+
(sourcePortId) => sourcePortId !== ammeterSourcePortId
|
|
27351
|
+
);
|
|
27352
|
+
if (connectedSourcePortId === void 0) continue;
|
|
27353
|
+
const schematicPort = schematicPorts.find(
|
|
27354
|
+
(port) => port.source_port_id === connectedSourcePortId
|
|
27355
|
+
);
|
|
27356
|
+
if (schematicPort) return schematicPort;
|
|
27357
|
+
}
|
|
27358
|
+
return null;
|
|
27359
|
+
};
|
|
27360
|
+
var midpoint = (ports) => ({
|
|
27361
|
+
x: ports.reduce((sum, port) => sum + port.center.x, 0) / ports.length,
|
|
27362
|
+
y: ports.reduce((sum, port) => sum + port.center.y, 0) / ports.length
|
|
27363
|
+
});
|
|
27364
|
+
var shiftAmmeterSchematicElements = ({
|
|
27365
|
+
ammeter,
|
|
27366
|
+
db,
|
|
27367
|
+
oldCenter,
|
|
27368
|
+
newCenter
|
|
27369
|
+
}) => {
|
|
27370
|
+
const schematicComponentId = ammeter.schematic_component_id;
|
|
27371
|
+
if (!schematicComponentId) return;
|
|
27372
|
+
const deltaX = newCenter.x - oldCenter.x;
|
|
27373
|
+
const deltaY = newCenter.y - oldCenter.y;
|
|
27374
|
+
if (deltaX === 0 && deltaY === 0) return;
|
|
27375
|
+
db.schematic_component.update(schematicComponentId, {
|
|
27376
|
+
center: newCenter
|
|
27377
|
+
});
|
|
27378
|
+
for (const port of db.schematic_port.list({
|
|
27379
|
+
schematic_component_id: schematicComponentId
|
|
27380
|
+
})) {
|
|
27381
|
+
db.schematic_port.update(port.schematic_port_id, {
|
|
27382
|
+
center: {
|
|
27383
|
+
x: port.center.x + deltaX,
|
|
27384
|
+
y: port.center.y + deltaY
|
|
27385
|
+
}
|
|
27386
|
+
});
|
|
27387
|
+
}
|
|
27388
|
+
for (const text of db.schematic_text.list({
|
|
27389
|
+
schematic_component_id: schematicComponentId
|
|
27390
|
+
})) {
|
|
27391
|
+
db.schematic_text.update(text.schematic_text_id, {
|
|
27392
|
+
position: {
|
|
27393
|
+
x: text.position.x + deltaX,
|
|
27394
|
+
y: text.position.y + deltaY
|
|
27395
|
+
}
|
|
27396
|
+
});
|
|
27397
|
+
}
|
|
27398
|
+
updateSchematicPrimitivesForLayoutShift({
|
|
27399
|
+
db,
|
|
27400
|
+
schematicComponentId,
|
|
27401
|
+
deltaX,
|
|
27402
|
+
deltaY
|
|
27403
|
+
});
|
|
27404
|
+
};
|
|
27405
|
+
var Ammeter_doInitialSchematicLayout = (ammeter) => {
|
|
27406
|
+
const { root } = ammeter;
|
|
27407
|
+
if (!root || root.schematicDisabled) return;
|
|
27408
|
+
if (!ammeter.schematic_component_id) return;
|
|
27409
|
+
if (ammeter._parsedProps.schX !== void 0 || ammeter._parsedProps.schY !== void 0) {
|
|
27410
|
+
return;
|
|
27411
|
+
}
|
|
27412
|
+
if (ammeter.getGroup()?._getSchematicLayoutMode() !== "relative") return;
|
|
27413
|
+
const { db } = root;
|
|
27414
|
+
const schematicComponent = db.schematic_component.get(
|
|
27415
|
+
ammeter.schematic_component_id
|
|
27416
|
+
);
|
|
27417
|
+
if (!schematicComponent) return;
|
|
27418
|
+
const ammeterSourcePortIds = [
|
|
27419
|
+
ammeter.portMap.pos.source_port_id,
|
|
27420
|
+
ammeter.portMap.neg.source_port_id
|
|
27421
|
+
].filter(
|
|
27422
|
+
(sourcePortId) => typeof sourcePortId === "string"
|
|
27423
|
+
);
|
|
27424
|
+
if (ammeterSourcePortIds.length === 0) return;
|
|
27425
|
+
const schematicPorts = db.schematic_port.list();
|
|
27426
|
+
const sourceTraces = db.source_trace.list();
|
|
27427
|
+
const connectedSchematicPorts = ammeterSourcePortIds.map(
|
|
27428
|
+
(ammeterSourcePortId) => getConnectedSchematicPort({
|
|
27429
|
+
ammeterSourcePortId,
|
|
27430
|
+
schematicPorts,
|
|
27431
|
+
sourceTraces
|
|
27432
|
+
})
|
|
27433
|
+
).filter((port) => port !== null);
|
|
27434
|
+
if (connectedSchematicPorts.length === 0) return;
|
|
27435
|
+
const baseCenter = midpoint(connectedSchematicPorts);
|
|
27436
|
+
const obstacles = db.schematic_component.list().filter(
|
|
27437
|
+
(component) => component.schematic_component_id !== schematicComponent.schematic_component_id && !component.is_schematic_group && component.schematic_sheet_id === schematicComponent.schematic_sheet_id
|
|
27438
|
+
).map((component) => rectForComponent(component, PLACEMENT_MARGIN));
|
|
27439
|
+
const bestCenter = getCandidateCenters({
|
|
27440
|
+
baseCenter,
|
|
27441
|
+
size: schematicComponent.size
|
|
27442
|
+
}).find((candidateCenter) => {
|
|
27443
|
+
const candidateRect = rectForComponent(
|
|
27444
|
+
{ ...schematicComponent, center: candidateCenter },
|
|
27445
|
+
PLACEMENT_MARGIN
|
|
27446
|
+
);
|
|
27447
|
+
return !obstacles.some(
|
|
27448
|
+
(obstacle) => rectsOverlap(candidateRect, obstacle)
|
|
27449
|
+
);
|
|
27450
|
+
}) ?? baseCenter;
|
|
27451
|
+
shiftAmmeterSchematicElements({
|
|
27452
|
+
ammeter,
|
|
27453
|
+
db,
|
|
27454
|
+
oldCenter: schematicComponent.center,
|
|
27455
|
+
newCenter: bestCenter
|
|
27456
|
+
});
|
|
27457
|
+
};
|
|
27458
|
+
|
|
27459
|
+
// lib/components/normal-components/Ammeter.ts
|
|
27103
27460
|
var Ammeter = class extends NormalComponent3 {
|
|
27461
|
+
simulation_current_probe_id = null;
|
|
27104
27462
|
get config() {
|
|
27105
27463
|
return {
|
|
27106
27464
|
componentName: "Ammeter",
|
|
@@ -27158,8 +27516,8 @@ var Ammeter = class extends NormalComponent3 {
|
|
|
27158
27516
|
color,
|
|
27159
27517
|
graphDisplayName,
|
|
27160
27518
|
graphCenter,
|
|
27161
|
-
|
|
27162
|
-
|
|
27519
|
+
graphVerticalOffset,
|
|
27520
|
+
graphCurrentPerDiv
|
|
27163
27521
|
} = this._parsedProps;
|
|
27164
27522
|
const posPort = this.portMap.pos;
|
|
27165
27523
|
const negPort = this.portMap.neg;
|
|
@@ -27172,18 +27530,24 @@ var Ammeter = class extends NormalComponent3 {
|
|
|
27172
27530
|
subcircuit_id: this.getSubcircuit()?.subcircuit_id ?? void 0,
|
|
27173
27531
|
color
|
|
27174
27532
|
});
|
|
27175
|
-
|
|
27533
|
+
this.simulation_current_probe_id = simulation_current_probe_id;
|
|
27534
|
+
const hasGraphDisplayProps = graphDisplayName !== void 0 || graphCenter !== void 0 || graphVerticalOffset !== void 0 || graphCurrentPerDiv !== void 0;
|
|
27176
27535
|
if (hasGraphDisplayProps) {
|
|
27536
|
+
const graphCurrentPerDivValue = parseSimulationGraphValue(graphCurrentPerDiv);
|
|
27537
|
+
const graphVerticalOffsetValue = parseSimulationGraphValue(graphVerticalOffset);
|
|
27177
27538
|
db.simulation_oscilloscope_trace.insert({
|
|
27178
27539
|
simulation_current_probe_id,
|
|
27179
27540
|
display_name: graphDisplayName,
|
|
27180
27541
|
color,
|
|
27181
27542
|
display_center_value: graphCenter,
|
|
27182
|
-
|
|
27183
|
-
|
|
27543
|
+
amps_per_div: graphCurrentPerDivValue,
|
|
27544
|
+
display_center_offset_divs: graphVerticalOffsetValue !== void 0 && graphCurrentPerDivValue !== void 0 && graphCurrentPerDivValue !== 0 ? graphVerticalOffsetValue / graphCurrentPerDivValue : void 0
|
|
27184
27545
|
});
|
|
27185
27546
|
}
|
|
27186
27547
|
}
|
|
27548
|
+
doInitialSchematicLayout() {
|
|
27549
|
+
Ammeter_doInitialSchematicLayout(this);
|
|
27550
|
+
}
|
|
27187
27551
|
pos = this.portMap.pos;
|
|
27188
27552
|
neg = this.portMap.neg;
|
|
27189
27553
|
};
|
|
@@ -31150,8 +31514,8 @@ var VoltageProbe = class extends PrimitiveComponent2 {
|
|
|
31150
31514
|
color,
|
|
31151
31515
|
graphDisplayName,
|
|
31152
31516
|
graphCenter,
|
|
31153
|
-
|
|
31154
|
-
|
|
31517
|
+
graphVerticalOffset,
|
|
31518
|
+
graphVoltagePerDiv
|
|
31155
31519
|
} = this._parsedProps;
|
|
31156
31520
|
const subcircuit = this.getSubcircuit();
|
|
31157
31521
|
if (!subcircuit) {
|
|
@@ -31229,15 +31593,17 @@ var VoltageProbe = class extends PrimitiveComponent2 {
|
|
|
31229
31593
|
color: this.color
|
|
31230
31594
|
});
|
|
31231
31595
|
this.simulation_voltage_probe_id = simulation_voltage_probe_id;
|
|
31232
|
-
const hasGraphDisplayProps = graphDisplayName !== void 0 || graphCenter !== void 0 ||
|
|
31596
|
+
const hasGraphDisplayProps = graphDisplayName !== void 0 || graphCenter !== void 0 || graphVerticalOffset !== void 0 || graphVoltagePerDiv !== void 0;
|
|
31233
31597
|
if (hasGraphDisplayProps) {
|
|
31598
|
+
const graphVoltagePerDivValue = parseSimulationGraphValue(graphVoltagePerDiv);
|
|
31599
|
+
const graphVerticalOffsetValue = parseSimulationGraphValue(graphVerticalOffset);
|
|
31234
31600
|
db.simulation_oscilloscope_trace.insert({
|
|
31235
31601
|
simulation_voltage_probe_id,
|
|
31236
31602
|
display_name: graphDisplayName,
|
|
31237
31603
|
color: color ?? void 0,
|
|
31238
31604
|
display_center_value: graphCenter,
|
|
31239
|
-
|
|
31240
|
-
|
|
31605
|
+
volts_per_div: graphVoltagePerDivValue,
|
|
31606
|
+
display_center_offset_divs: graphVerticalOffsetValue !== void 0 && graphVoltagePerDivValue !== void 0 && graphVoltagePerDivValue !== 0 ? graphVerticalOffsetValue / graphVoltagePerDivValue : void 0
|
|
31241
31607
|
});
|
|
31242
31608
|
}
|
|
31243
31609
|
}
|
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.1370",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@tscircuit/math-utils": "^0.0.36",
|
|
51
51
|
"@tscircuit/miniflex": "^0.0.4",
|
|
52
52
|
"@tscircuit/ngspice-spice-engine": "^0.0.18",
|
|
53
|
-
"@tscircuit/props": "^0.0.
|
|
53
|
+
"@tscircuit/props": "^0.0.565",
|
|
54
54
|
"@tscircuit/schematic-match-adapt": "^0.0.18",
|
|
55
55
|
"@tscircuit/schematic-trace-solver": "^0.0.72",
|
|
56
56
|
"@tscircuit/solver-utils": "^0.0.16",
|
|
@@ -68,7 +68,6 @@
|
|
|
68
68
|
"circuit-json-to-bpc": "^0.0.13",
|
|
69
69
|
"circuit-json-to-connectivity-map": "^0.0.23",
|
|
70
70
|
"circuit-json-to-gltf": "^0.0.105",
|
|
71
|
-
"circuit-json-to-simple-3d": "^0.0.9",
|
|
72
71
|
"circuit-json-to-spice": "^0.0.40",
|
|
73
72
|
"circuit-to-svg": "^0.0.367",
|
|
74
73
|
"concurrently": "^9.1.2",
|