@tscircuit/core 0.0.559 → 0.0.561
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 +93 -2
- package/dist/index.js +181 -10
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _tscircuit_props from '@tscircuit/props';
|
|
2
|
-
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicBoxProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
2
|
+
import { PlatformConfig, subcircuitGroupProps, AutorouterConfig, traceProps, SupplierPartNumbers, SchematicPortArrangement, groupProps, boardProps, capacitorProps, chipProps, diodeProps, fuseProps, jumperProps, solderjumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, subcircuitProps, breakoutProps, breakoutPointProps, holeProps, pcbKeepoutProps, netLabelProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, silkscreenLineProps, smtPadProps, traceHintProps, viaProps, cutoutProps, batteryProps, pinHeaderProps, resonatorProps, inductorProps, potentiometerProps, pushButtonProps, crystalProps, transistorProps, mosfetProps, switchProps, testpointProps, schematicTextProps, schematicBoxProps, schematicTableProps, schematicRowProps, schematicCellProps, CapacitorProps, ChipProps, DiodeProps, ResistorProps, ManualEditEvent, ManualEditsFile, ChipConnections, manual_edits_file } from '@tscircuit/props';
|
|
3
3
|
import React, { ReactElement, DetailedHTMLProps, SVGProps } from 'react';
|
|
4
4
|
export { createElement } from 'react';
|
|
5
5
|
import * as zod from 'zod';
|
|
@@ -331,6 +331,7 @@ declare abstract class PrimitiveComponent<ZodProps extends ZodType = any> extend
|
|
|
331
331
|
*
|
|
332
332
|
*/
|
|
333
333
|
isPrimitiveContainer: boolean;
|
|
334
|
+
canHaveTextChildren: boolean;
|
|
334
335
|
source_group_id: string | null;
|
|
335
336
|
source_component_id: string | null;
|
|
336
337
|
schematic_component_id: string | null;
|
|
@@ -14686,6 +14687,93 @@ declare class SchematicBox extends PrimitiveComponent<typeof schematicBoxProps>
|
|
|
14686
14687
|
doInitialSchematicPrimitiveRender(): void;
|
|
14687
14688
|
}
|
|
14688
14689
|
|
|
14690
|
+
declare class SchematicTable extends PrimitiveComponent<typeof schematicTableProps> {
|
|
14691
|
+
isSchematicPrimitive: boolean;
|
|
14692
|
+
schematic_table_id: string | null;
|
|
14693
|
+
get config(): {
|
|
14694
|
+
componentName: string;
|
|
14695
|
+
zodProps: zod.ZodObject<{
|
|
14696
|
+
schX: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14697
|
+
schY: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14698
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
14699
|
+
cellPadding: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14700
|
+
borderWidth: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14701
|
+
anchor: zod.ZodOptional<zod.ZodEnum<["top_left", "top_center", "top_right", "center_left", "center", "center_right", "bottom_left", "bottom_center", "bottom_right"]>>;
|
|
14702
|
+
fontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14703
|
+
}, "strip", zod.ZodTypeAny, {
|
|
14704
|
+
anchor?: "center" | "top_left" | "top_right" | "bottom_left" | "bottom_right" | "top_center" | "center_left" | "center_right" | "bottom_center" | undefined;
|
|
14705
|
+
schX?: number | undefined;
|
|
14706
|
+
schY?: number | undefined;
|
|
14707
|
+
children?: any;
|
|
14708
|
+
fontSize?: number | undefined;
|
|
14709
|
+
cellPadding?: number | undefined;
|
|
14710
|
+
borderWidth?: number | undefined;
|
|
14711
|
+
}, {
|
|
14712
|
+
anchor?: "center" | "top_left" | "top_right" | "bottom_left" | "bottom_right" | "top_center" | "center_left" | "center_right" | "bottom_center" | undefined;
|
|
14713
|
+
schX?: string | number | undefined;
|
|
14714
|
+
schY?: string | number | undefined;
|
|
14715
|
+
children?: any;
|
|
14716
|
+
fontSize?: string | number | undefined;
|
|
14717
|
+
cellPadding?: string | number | undefined;
|
|
14718
|
+
borderWidth?: string | number | undefined;
|
|
14719
|
+
}>;
|
|
14720
|
+
};
|
|
14721
|
+
doInitialSchematicPrimitiveRender(): void;
|
|
14722
|
+
}
|
|
14723
|
+
|
|
14724
|
+
declare class SchematicRow extends PrimitiveComponent<typeof schematicRowProps> {
|
|
14725
|
+
isSchematicPrimitive: boolean;
|
|
14726
|
+
get config(): {
|
|
14727
|
+
componentName: string;
|
|
14728
|
+
zodProps: zod.ZodObject<{
|
|
14729
|
+
children: zod.ZodOptional<zod.ZodAny>;
|
|
14730
|
+
height: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14731
|
+
}, "strip", zod.ZodTypeAny, {
|
|
14732
|
+
children?: any;
|
|
14733
|
+
height?: number | undefined;
|
|
14734
|
+
}, {
|
|
14735
|
+
children?: any;
|
|
14736
|
+
height?: string | number | undefined;
|
|
14737
|
+
}>;
|
|
14738
|
+
};
|
|
14739
|
+
}
|
|
14740
|
+
|
|
14741
|
+
declare class SchematicCell extends PrimitiveComponent<typeof schematicCellProps> {
|
|
14742
|
+
isSchematicPrimitive: boolean;
|
|
14743
|
+
canHaveTextChildren: boolean;
|
|
14744
|
+
get config(): {
|
|
14745
|
+
componentName: string;
|
|
14746
|
+
zodProps: zod.ZodObject<{
|
|
14747
|
+
children: zod.ZodOptional<zod.ZodString>;
|
|
14748
|
+
horizontalAlign: zod.ZodOptional<zod.ZodEnum<["left", "center", "right"]>>;
|
|
14749
|
+
verticalAlign: zod.ZodOptional<zod.ZodEnum<["top", "middle", "bottom"]>>;
|
|
14750
|
+
fontSize: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14751
|
+
rowSpan: zod.ZodOptional<zod.ZodNumber>;
|
|
14752
|
+
colSpan: zod.ZodOptional<zod.ZodNumber>;
|
|
14753
|
+
width: zod.ZodOptional<zod.ZodEffects<zod.ZodUnion<[zod.ZodString, zod.ZodNumber]>, number, string | number>>;
|
|
14754
|
+
text: zod.ZodOptional<zod.ZodString>;
|
|
14755
|
+
}, "strip", zod.ZodTypeAny, {
|
|
14756
|
+
children?: string | undefined;
|
|
14757
|
+
width?: number | undefined;
|
|
14758
|
+
text?: string | undefined;
|
|
14759
|
+
fontSize?: number | undefined;
|
|
14760
|
+
horizontalAlign?: "left" | "right" | "center" | undefined;
|
|
14761
|
+
verticalAlign?: "top" | "bottom" | "middle" | undefined;
|
|
14762
|
+
rowSpan?: number | undefined;
|
|
14763
|
+
colSpan?: number | undefined;
|
|
14764
|
+
}, {
|
|
14765
|
+
children?: string | undefined;
|
|
14766
|
+
width?: string | number | undefined;
|
|
14767
|
+
text?: string | undefined;
|
|
14768
|
+
fontSize?: string | number | undefined;
|
|
14769
|
+
horizontalAlign?: "left" | "right" | "center" | undefined;
|
|
14770
|
+
verticalAlign?: "top" | "bottom" | "middle" | undefined;
|
|
14771
|
+
rowSpan?: number | undefined;
|
|
14772
|
+
colSpan?: number | undefined;
|
|
14773
|
+
}>;
|
|
14774
|
+
};
|
|
14775
|
+
}
|
|
14776
|
+
|
|
14689
14777
|
declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
|
|
14690
14778
|
isLoading: boolean;
|
|
14691
14779
|
error?: Error | null;
|
|
@@ -15055,6 +15143,9 @@ interface TscircuitElements {
|
|
|
15055
15143
|
schematicline: _tscircuit_props.SchematicLineProps;
|
|
15056
15144
|
schematicpath: _tscircuit_props.SchematicPathProps;
|
|
15057
15145
|
schematictext: _tscircuit_props.SchematicTextProps;
|
|
15146
|
+
schematictable: _tscircuit_props.SchematicTableProps;
|
|
15147
|
+
schematicrow: _tscircuit_props.SchematicRowProps;
|
|
15148
|
+
schematiccell: _tscircuit_props.SchematicCellProps;
|
|
15058
15149
|
smtpad: _tscircuit_props.SmtPadProps;
|
|
15059
15150
|
platedhole: _tscircuit_props.PlatedHoleProps;
|
|
15060
15151
|
keepout: _tscircuit_props.PcbKeepoutProps;
|
|
@@ -15106,4 +15197,4 @@ declare module "react/jsx-runtime" {
|
|
|
15106
15197
|
}
|
|
15107
15198
|
}
|
|
15108
15199
|
|
|
15109
|
-
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Cutout, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, 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, SchematicBox, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, TestPoint, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
|
15200
|
+
export { type AsyncEffect, type AutorouterCompleteEvent, type AutorouterErrorEvent, type AutorouterEvent, type AutorouterProgressEvent, type AutoroutingEndEvent, type AutoroutingErrorEvent, type AutoroutingProgressEvent, type AutoroutingStartEvent, Battery, Board, Breakout, BreakoutPoint, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Crystal, Cutout, Diode, FabricationNotePath, FabricationNoteText, Footprint, Fuse, type GenericConnectionsAndSelectorsSel, type GenericLocalAutorouter, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, type LocalCacheEngine, Mosfet, Net, NetLabel, 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, SchematicBox, SchematicCell, SchematicRow, SchematicTable, SchematicText, type Sel, SilkscreenCircle, SilkscreenLine, SilkscreenPath, SilkscreenRect, SilkscreenText, type SimpleRouteConnection, type SimpleRouteJson, type SimplifiedPcbTrace, SmtPad, SolderJumper, Subcircuit, Switch, TestPoint, Trace, TraceHint, Transistor, Via, applyEditEvents, applyEditEventsToManualEditsFile, applyPcbEditEventsToManualEditsFile, applySchematicEditEventsToManualEditsFile, createUseComponent, getPhaseTimingsFromRenderEvents, getSimpleRouteJsonFromCircuitJson, normalizePinLabels, orderedRenderPhases, sel, useCapacitor, useChip, useDiode, useLed, useRenderedCircuit, useResistor };
|
package/dist/index.js
CHANGED
|
@@ -43,6 +43,9 @@ __export(components_exports, {
|
|
|
43
43
|
Resistor: () => Resistor,
|
|
44
44
|
Resonator: () => Resonator,
|
|
45
45
|
SchematicBox: () => SchematicBox,
|
|
46
|
+
SchematicCell: () => SchematicCell,
|
|
47
|
+
SchematicRow: () => SchematicRow,
|
|
48
|
+
SchematicTable: () => SchematicTable,
|
|
46
49
|
SchematicText: () => SchematicText,
|
|
47
50
|
SilkscreenCircle: () => SilkscreenCircle,
|
|
48
51
|
SilkscreenLine: () => SilkscreenLine,
|
|
@@ -573,6 +576,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
573
576
|
*
|
|
574
577
|
*/
|
|
575
578
|
isPrimitiveContainer = false;
|
|
579
|
+
canHaveTextChildren = false;
|
|
576
580
|
source_group_id = null;
|
|
577
581
|
source_component_id = null;
|
|
578
582
|
schematic_component_id = null;
|
|
@@ -882,12 +886,19 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
882
886
|
this.parent?.onChildChanged?.(child);
|
|
883
887
|
}
|
|
884
888
|
add(component) {
|
|
889
|
+
if (Object.keys(component).length === 0) {
|
|
890
|
+
if (this.canHaveTextChildren) {
|
|
891
|
+
return;
|
|
892
|
+
}
|
|
893
|
+
}
|
|
885
894
|
if (this.lowercaseComponentName === "board" && component.lowercaseComponentName === "board") {
|
|
886
895
|
throw new Error("Nested boards are not supported");
|
|
887
896
|
}
|
|
888
897
|
if (!component.onAddToParent) {
|
|
889
898
|
throw new Error(
|
|
890
|
-
`Invalid JSX Element: Expected a React component but received "${JSON.stringify(
|
|
899
|
+
`Invalid JSX Element: Expected a React component but received "${JSON.stringify(
|
|
900
|
+
component
|
|
901
|
+
)}"`
|
|
891
902
|
);
|
|
892
903
|
}
|
|
893
904
|
component.onAddToParent(this);
|
|
@@ -2470,7 +2481,8 @@ var createComponentsFromCircuitJson = ({
|
|
|
2470
2481
|
componentName,
|
|
2471
2482
|
componentRotation,
|
|
2472
2483
|
footprint,
|
|
2473
|
-
pinLabels
|
|
2484
|
+
pinLabels,
|
|
2485
|
+
pcbPinLabels
|
|
2474
2486
|
}, soup) => {
|
|
2475
2487
|
const components = [];
|
|
2476
2488
|
for (const elm of soup) {
|
|
@@ -2566,7 +2578,7 @@ var createComponentsFromCircuitJson = ({
|
|
|
2566
2578
|
components.push(
|
|
2567
2579
|
createPinrowSilkscreenText({
|
|
2568
2580
|
elm,
|
|
2569
|
-
pinLabels,
|
|
2581
|
+
pinLabels: pcbPinLabels ?? pinLabels,
|
|
2570
2582
|
layer: elm.layer,
|
|
2571
2583
|
readableRotation: ccwRotation,
|
|
2572
2584
|
anchorAlignment: elm.anchor_alignment
|
|
@@ -5916,7 +5928,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
5916
5928
|
return s.startsWith("http://") || s.startsWith("https://");
|
|
5917
5929
|
}
|
|
5918
5930
|
_addChildrenFromStringFootprint() {
|
|
5919
|
-
const { pcbRotation, pinLabels } = this.props;
|
|
5931
|
+
const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
|
|
5920
5932
|
let { footprint } = this.props;
|
|
5921
5933
|
footprint ??= this._getImpliedFootprintString?.();
|
|
5922
5934
|
if (!footprint) return;
|
|
@@ -5928,7 +5940,8 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
5928
5940
|
componentName: this.name ?? this.componentName,
|
|
5929
5941
|
componentRotation: pcbRotation,
|
|
5930
5942
|
footprint,
|
|
5931
|
-
pinLabels
|
|
5943
|
+
pinLabels,
|
|
5944
|
+
pcbPinLabels
|
|
5932
5945
|
},
|
|
5933
5946
|
fpSoup
|
|
5934
5947
|
);
|
|
@@ -6175,7 +6188,7 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6175
6188
|
let { footprint } = this.props;
|
|
6176
6189
|
footprint ??= this._getImpliedFootprintString?.();
|
|
6177
6190
|
if (!footprint) return;
|
|
6178
|
-
const { pcbRotation, pinLabels } = this.props;
|
|
6191
|
+
const { pcbRotation, pinLabels, pcbPinLabels } = this.props;
|
|
6179
6192
|
if (typeof footprint === "string" && this._isFootprintUrl(footprint)) {
|
|
6180
6193
|
if (this._hasStartedFootprintUrlLoad) return;
|
|
6181
6194
|
this._hasStartedFootprintUrlLoad = true;
|
|
@@ -6188,7 +6201,8 @@ var NormalComponent = class extends PrimitiveComponent2 {
|
|
|
6188
6201
|
componentName: this.name,
|
|
6189
6202
|
componentRotation: pcbRotation,
|
|
6190
6203
|
footprint: url,
|
|
6191
|
-
pinLabels
|
|
6204
|
+
pinLabels,
|
|
6205
|
+
pcbPinLabels
|
|
6192
6206
|
},
|
|
6193
6207
|
soup
|
|
6194
6208
|
);
|
|
@@ -10778,6 +10792,160 @@ var SchematicBox = class extends PrimitiveComponent2 {
|
|
|
10778
10792
|
}
|
|
10779
10793
|
};
|
|
10780
10794
|
|
|
10795
|
+
// lib/components/primitive-components/SchematicTable.ts
|
|
10796
|
+
import { schematicTableProps } from "@tscircuit/props";
|
|
10797
|
+
var SchematicTable = class extends PrimitiveComponent2 {
|
|
10798
|
+
isSchematicPrimitive = true;
|
|
10799
|
+
schematic_table_id = null;
|
|
10800
|
+
get config() {
|
|
10801
|
+
return {
|
|
10802
|
+
componentName: "SchematicTable",
|
|
10803
|
+
zodProps: schematicTableProps
|
|
10804
|
+
};
|
|
10805
|
+
}
|
|
10806
|
+
doInitialSchematicPrimitiveRender() {
|
|
10807
|
+
if (this.root?.schematicDisabled) return;
|
|
10808
|
+
const { db } = this.root;
|
|
10809
|
+
const { _parsedProps: props } = this;
|
|
10810
|
+
const rows = this.children.filter(
|
|
10811
|
+
(c) => c.componentName === "SchematicRow"
|
|
10812
|
+
);
|
|
10813
|
+
if (rows.length === 0) return;
|
|
10814
|
+
const grid = [];
|
|
10815
|
+
let maxCols = 0;
|
|
10816
|
+
for (const row of rows) {
|
|
10817
|
+
const cells = row.children.filter(
|
|
10818
|
+
(c) => c.componentName === "SchematicCell"
|
|
10819
|
+
);
|
|
10820
|
+
maxCols = Math.max(maxCols, cells.length);
|
|
10821
|
+
}
|
|
10822
|
+
for (let i = 0; i < rows.length; i++) {
|
|
10823
|
+
grid[i] = [];
|
|
10824
|
+
}
|
|
10825
|
+
for (let i = 0; i < rows.length; i++) {
|
|
10826
|
+
const row = rows[i];
|
|
10827
|
+
const cells = row.children.filter(
|
|
10828
|
+
(c) => c.componentName === "SchematicCell"
|
|
10829
|
+
);
|
|
10830
|
+
let k = 0;
|
|
10831
|
+
for (let j = 0; j < cells.length; j++) {
|
|
10832
|
+
while (grid[i][k]) {
|
|
10833
|
+
k++;
|
|
10834
|
+
}
|
|
10835
|
+
const cell = cells[j];
|
|
10836
|
+
const colSpan = cell._parsedProps.colSpan ?? 1;
|
|
10837
|
+
const rowSpan = cell._parsedProps.rowSpan ?? 1;
|
|
10838
|
+
for (let r = 0; r < rowSpan; r++) {
|
|
10839
|
+
for (let c = 0; c < colSpan; c++) {
|
|
10840
|
+
if (!grid[i + r]) grid[i + r] = [];
|
|
10841
|
+
grid[i + r][k + c] = cell;
|
|
10842
|
+
}
|
|
10843
|
+
}
|
|
10844
|
+
k += colSpan;
|
|
10845
|
+
}
|
|
10846
|
+
}
|
|
10847
|
+
maxCols = Math.max(0, ...grid.map((r) => r.length));
|
|
10848
|
+
const rowHeights = rows.map(
|
|
10849
|
+
(row, i) => row._parsedProps.height ?? 1
|
|
10850
|
+
);
|
|
10851
|
+
const colWidths = Array.from({ length: maxCols }, (_, j) => {
|
|
10852
|
+
let maxWidth = 0;
|
|
10853
|
+
for (let i = 0; i < rows.length; i++) {
|
|
10854
|
+
const cell = grid[i]?.[j];
|
|
10855
|
+
if (cell) {
|
|
10856
|
+
const text = cell._parsedProps.text ?? cell._parsedProps.children;
|
|
10857
|
+
const cellWidth = cell._parsedProps.width ?? (text?.length ?? 2) * 0.5;
|
|
10858
|
+
if (cellWidth > maxWidth) {
|
|
10859
|
+
maxWidth = cellWidth;
|
|
10860
|
+
}
|
|
10861
|
+
}
|
|
10862
|
+
}
|
|
10863
|
+
return maxWidth || 10;
|
|
10864
|
+
});
|
|
10865
|
+
const anchorPos = this._getGlobalSchematicPositionBeforeLayout();
|
|
10866
|
+
const table = db.schematic_table.insert({
|
|
10867
|
+
anchor_position: anchorPos,
|
|
10868
|
+
column_widths: colWidths,
|
|
10869
|
+
row_heights: rowHeights,
|
|
10870
|
+
cell_padding: props.cellPadding,
|
|
10871
|
+
border_width: props.borderWidth,
|
|
10872
|
+
anchor: props.anchor,
|
|
10873
|
+
subcircuit_id: this.getSubcircuit()?.subcircuit_id || "",
|
|
10874
|
+
schematic_component_id: this.parent?.schematic_component_id || ""
|
|
10875
|
+
});
|
|
10876
|
+
this.schematic_table_id = table.schematic_table_id;
|
|
10877
|
+
const processedCells = /* @__PURE__ */ new Set();
|
|
10878
|
+
let yOffset = 0;
|
|
10879
|
+
for (let i = 0; i < rows.length; i++) {
|
|
10880
|
+
let xOffset = 0;
|
|
10881
|
+
for (let j = 0; j < maxCols; j++) {
|
|
10882
|
+
const cell = grid[i]?.[j];
|
|
10883
|
+
if (cell && !processedCells.has(cell)) {
|
|
10884
|
+
processedCells.add(cell);
|
|
10885
|
+
const cellProps = cell._parsedProps;
|
|
10886
|
+
const rowSpan = cellProps.rowSpan ?? 1;
|
|
10887
|
+
const colSpan = cellProps.colSpan ?? 1;
|
|
10888
|
+
let cellWidth = 0;
|
|
10889
|
+
for (let c = 0; c < colSpan; c++) {
|
|
10890
|
+
cellWidth += colWidths[j + c];
|
|
10891
|
+
}
|
|
10892
|
+
let cellHeight = 0;
|
|
10893
|
+
for (let r = 0; r < rowSpan; r++) {
|
|
10894
|
+
cellHeight += rowHeights[i + r];
|
|
10895
|
+
}
|
|
10896
|
+
db.schematic_table_cell.insert({
|
|
10897
|
+
schematic_table_id: this.schematic_table_id,
|
|
10898
|
+
start_row_index: i,
|
|
10899
|
+
end_row_index: i + rowSpan - 1,
|
|
10900
|
+
start_column_index: j,
|
|
10901
|
+
end_column_index: j + colSpan - 1,
|
|
10902
|
+
text: cellProps.text ?? cellProps.children,
|
|
10903
|
+
center: {
|
|
10904
|
+
x: anchorPos.x + xOffset + cellWidth / 2,
|
|
10905
|
+
y: anchorPos.y - yOffset - cellHeight / 2
|
|
10906
|
+
},
|
|
10907
|
+
width: cellWidth,
|
|
10908
|
+
height: cellHeight,
|
|
10909
|
+
horizontal_align: cellProps.horizontalAlign,
|
|
10910
|
+
vertical_align: cellProps.verticalAlign,
|
|
10911
|
+
font_size: cellProps.fontSize ?? props.fontSize,
|
|
10912
|
+
subcircuit_id: this.getSubcircuit()?.subcircuit_id || ""
|
|
10913
|
+
});
|
|
10914
|
+
}
|
|
10915
|
+
if (colWidths[j]) {
|
|
10916
|
+
xOffset += colWidths[j];
|
|
10917
|
+
}
|
|
10918
|
+
}
|
|
10919
|
+
yOffset += rowHeights[i];
|
|
10920
|
+
}
|
|
10921
|
+
}
|
|
10922
|
+
};
|
|
10923
|
+
|
|
10924
|
+
// lib/components/primitive-components/SchematicRow.ts
|
|
10925
|
+
import { schematicRowProps } from "@tscircuit/props";
|
|
10926
|
+
var SchematicRow = class extends PrimitiveComponent2 {
|
|
10927
|
+
isSchematicPrimitive = true;
|
|
10928
|
+
get config() {
|
|
10929
|
+
return {
|
|
10930
|
+
componentName: "SchematicRow",
|
|
10931
|
+
zodProps: schematicRowProps
|
|
10932
|
+
};
|
|
10933
|
+
}
|
|
10934
|
+
};
|
|
10935
|
+
|
|
10936
|
+
// lib/components/primitive-components/SchematicCell.ts
|
|
10937
|
+
import { schematicCellProps } from "@tscircuit/props";
|
|
10938
|
+
var SchematicCell = class extends PrimitiveComponent2 {
|
|
10939
|
+
isSchematicPrimitive = true;
|
|
10940
|
+
canHaveTextChildren = true;
|
|
10941
|
+
get config() {
|
|
10942
|
+
return {
|
|
10943
|
+
componentName: "SchematicCell",
|
|
10944
|
+
zodProps: schematicCellProps
|
|
10945
|
+
};
|
|
10946
|
+
}
|
|
10947
|
+
};
|
|
10948
|
+
|
|
10781
10949
|
// lib/RootCircuit.ts
|
|
10782
10950
|
import { su as su5 } from "@tscircuit/circuit-json-util";
|
|
10783
10951
|
import { isValidElement as isValidElement2 } from "react";
|
|
@@ -10787,7 +10955,7 @@ import { identity as identity5 } from "transformation-matrix";
|
|
|
10787
10955
|
var package_default = {
|
|
10788
10956
|
name: "@tscircuit/core",
|
|
10789
10957
|
type: "module",
|
|
10790
|
-
version: "0.0.
|
|
10958
|
+
version: "0.0.560",
|
|
10791
10959
|
types: "dist/index.d.ts",
|
|
10792
10960
|
main: "dist/index.js",
|
|
10793
10961
|
module: "dist/index.js",
|
|
@@ -10818,7 +10986,7 @@ var package_default = {
|
|
|
10818
10986
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
10819
10987
|
"@tscircuit/log-soup": "^1.0.2",
|
|
10820
10988
|
"@tscircuit/math-utils": "^0.0.18",
|
|
10821
|
-
"@tscircuit/props": "^0.0.
|
|
10989
|
+
"@tscircuit/props": "^0.0.257",
|
|
10822
10990
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
10823
10991
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
10824
10992
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -10836,7 +11004,7 @@ var package_default = {
|
|
|
10836
11004
|
"circuit-json-to-bpc": "^0.0.13",
|
|
10837
11005
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
10838
11006
|
"circuit-json-to-simple-3d": "^0.0.2",
|
|
10839
|
-
"circuit-to-svg": "^0.0.
|
|
11007
|
+
"circuit-to-svg": "^0.0.166",
|
|
10840
11008
|
concurrently: "^9.1.2",
|
|
10841
11009
|
debug: "^4.3.6",
|
|
10842
11010
|
"graphics-debug": "^0.0.60",
|
|
@@ -11308,6 +11476,9 @@ export {
|
|
|
11308
11476
|
Resonator,
|
|
11309
11477
|
RootCircuit,
|
|
11310
11478
|
SchematicBox,
|
|
11479
|
+
SchematicCell,
|
|
11480
|
+
SchematicRow,
|
|
11481
|
+
SchematicTable,
|
|
11311
11482
|
SchematicText,
|
|
11312
11483
|
SilkscreenCircle,
|
|
11313
11484
|
SilkscreenLine,
|
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.561",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@tscircuit/infgrid-ijump-astar": "^0.0.33",
|
|
33
33
|
"@tscircuit/log-soup": "^1.0.2",
|
|
34
34
|
"@tscircuit/math-utils": "^0.0.18",
|
|
35
|
-
"@tscircuit/props": "^0.0.
|
|
35
|
+
"@tscircuit/props": "^0.0.257",
|
|
36
36
|
"@tscircuit/schematic-autolayout": "^0.0.6",
|
|
37
37
|
"@tscircuit/schematic-corpus": "^0.0.52",
|
|
38
38
|
"@tscircuit/schematic-match-adapt": "^0.0.16",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"circuit-json-to-bpc": "^0.0.13",
|
|
51
51
|
"circuit-json-to-connectivity-map": "^0.0.22",
|
|
52
52
|
"circuit-json-to-simple-3d": "^0.0.2",
|
|
53
|
-
"circuit-to-svg": "^0.0.
|
|
53
|
+
"circuit-to-svg": "^0.0.166",
|
|
54
54
|
"concurrently": "^9.1.2",
|
|
55
55
|
"debug": "^4.3.6",
|
|
56
56
|
"graphics-debug": "^0.0.60",
|