@tscircuit/core 0.0.137 → 0.0.139

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 CHANGED
@@ -6,7 +6,7 @@ import { PcbTraceError, PcbPlacementError, LayerRef, AnyCircuitElement, AnySourc
6
6
  import { SoupUtilObjects } from '@tscircuit/soup-util';
7
7
  import { Matrix } from 'transformation-matrix';
8
8
  import * as _tscircuit_props from '@tscircuit/props';
9
- import { traceProps, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, traceHintProps, viaProps, batteryProps, inductorProps } from '@tscircuit/props';
9
+ import { traceProps, groupProps, boardProps, capacitorProps, chipProps, diodeProps, jumperProps, ledProps, powerSourceProps, resistorProps, constraintProps, fabricationNotePathProps, fabricationNoteTextProps, footprintProps, holeProps, pcbKeepoutProps, netAliasProps, platedHoleProps, silkscreenCircleProps, silkscreenPathProps, silkscreenRectProps, silkscreenTextProps, smtPadProps, traceHintProps, viaProps, batteryProps, inductorProps, CapacitorProps, ChipProps, ResistorProps } from '@tscircuit/props';
10
10
 
11
11
  declare const orderedRenderPhases: readonly ["ReactSubtreesRender", "InitializePortsFromChildren", "CreateNetsFromProps", "CreateTracesFromProps", "CreateTraceHintsFromProps", "SourceRender", "SourceParentAttachment", "PortDiscovery", "PortMatching", "SourceTraceRender", "SchematicComponentRender", "SchematicPortRender", "SchematicLayout", "SchematicTraceRender", "PcbComponentRender", "PcbPrimitiveRender", "PcbFootprintLayout", "PcbPortRender", "PcbPortAttachment", "PcbLayout", "PcbTraceRender", "PcbTraceHintRender", "PcbRouteNetIslands", "PcbComponentSizeCalculation", "CadModelRender"];
12
12
  type RenderPhase = (typeof orderedRenderPhases)[number];
@@ -6220,14 +6220,21 @@ declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
6220
6220
  circuitJson?: AnyCircuitElement[];
6221
6221
  };
6222
6222
 
6223
+ type PinLabelSpec<PinLabel extends string> = readonly PinLabel[] | readonly (readonly PinLabel[])[] | {
6224
+ [key: string]: readonly PinLabel[];
6225
+ };
6223
6226
  type ComponentWithPins<Props, PinLabel extends string | never = never, PropsFromHook extends Omit<Props, "name"> | undefined = undefined> = React.ComponentType<(PropsFromHook extends undefined ? Omit<Props, "name"> : Omit<Partial<Props>, "name">) & {
6224
6227
  [key in PinLabel]?: string;
6225
6228
  }> & {
6226
6229
  [key in PinLabel]: string;
6227
6230
  };
6228
- declare const createUseComponent: <Props, PinLabel extends string | never = never>(Component: React.ComponentType<Props>, pins: readonly PinLabel[] | readonly (readonly PinLabel[])[] | {
6229
- [key: string]: readonly PinLabel[];
6230
- }) => (<PropsFromHook extends Omit<Props, "name"> | undefined = undefined>(name: string, props?: PropsFromHook) => ComponentWithPins<Props, PinLabel, PropsFromHook>);
6231
+ declare const createUseComponent: <Props, PinLabel extends string | never = never>(Component: React.ComponentType<Props>, pins: PinLabelSpec<PinLabel>) => (<PropsFromHook extends Omit<Props, "name"> | undefined = undefined>(name: string, props?: PropsFromHook) => ComponentWithPins<Props, PinLabel, PropsFromHook>);
6232
+
6233
+ declare const useCapacitor: <PropsFromHook extends Omit<CapacitorProps, "name"> | undefined = undefined>(name: string, props?: PropsFromHook | undefined) => ComponentWithPins<CapacitorProps, "left" | "right" | "pin1" | "pin2" | "anode" | "cathode" | "pos" | "neg", PropsFromHook>;
6234
+
6235
+ declare const useChip: <PinLabel extends string>(pinLabels: Record<string, PinLabel[]>) => <PropsFromHook extends Omit<ChipProps, "name"> | undefined = undefined>(name: string, props?: PropsFromHook | undefined) => ComponentWithPins<ChipProps, PinLabel, PropsFromHook>;
6236
+
6237
+ declare const useResistor: <PropsFromHook extends Omit<ResistorProps, "name"> | undefined = undefined>(name: string, props?: PropsFromHook | undefined) => ComponentWithPins<ResistorProps, "left" | "right" | "pin1" | "pin2", PropsFromHook>;
6231
6238
 
6232
6239
  declare global {
6233
6240
  namespace JSX {
@@ -6276,4 +6283,4 @@ declare global {
6276
6283
  }
6277
6284
  }
6278
6285
 
6279
- export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, PlatedHole, Port, PowerSource, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenCircle, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Trace, TraceHint, Via, createUseComponent, useRenderedCircuit };
6286
+ export { Battery, Board, Capacitor, Chip, Circuit, type ComponentWithPins, Constraint, Diode, FabricationNotePath, FabricationNoteText, Footprint, Group, Hole, type IRenderable, Inductor, Jumper, Keepout, Led, Net, NetAlias, NormalComponent, type PinLabelSpec, PlatedHole, Port, PowerSource, PrimitiveComponent, Project, Renderable, Resistor, SilkscreenCircle, SilkscreenPath, SilkscreenRect, SilkscreenText, SmtPad, Trace, TraceHint, Via, createUseComponent, useCapacitor, useChip, useRenderedCircuit, useResistor };
package/dist/index.js CHANGED
@@ -4694,6 +4694,29 @@ var createUseComponent = (Component2, pins) => {
4694
4694
  };
4695
4695
  };
4696
4696
 
4697
+ // lib/hooks/use-capacitor.tsx
4698
+ import { capacitorPins } from "@tscircuit/props";
4699
+ import { jsx as jsx2 } from "react/jsx-runtime";
4700
+ var useCapacitor = createUseComponent(
4701
+ (props) => /* @__PURE__ */ jsx2("capacitor", { ...props }),
4702
+ capacitorPins
4703
+ );
4704
+
4705
+ // lib/hooks/use-chip.tsx
4706
+ import { jsx as jsx3 } from "react/jsx-runtime";
4707
+ var useChip = (pinLabels) => createUseComponent(
4708
+ (props) => /* @__PURE__ */ jsx3("chip", { pinLabels, ...props }),
4709
+ pinLabels
4710
+ );
4711
+
4712
+ // lib/hooks/use-resistor.tsx
4713
+ import { resistorPins as resistorPins2 } from "@tscircuit/props";
4714
+ import { jsx as jsx4 } from "react/jsx-runtime";
4715
+ var useResistor = createUseComponent(
4716
+ (props) => /* @__PURE__ */ jsx4("resistor", { ...props }),
4717
+ resistorPins2
4718
+ );
4719
+
4697
4720
  // lib/register-catalogue.ts
4698
4721
  extendCatalogue(components_exports);
4699
4722
  extendCatalogue({
@@ -4735,5 +4758,8 @@ export {
4735
4758
  TraceHint,
4736
4759
  Via,
4737
4760
  createUseComponent,
4738
- useRenderedCircuit
4761
+ useCapacitor,
4762
+ useChip,
4763
+ useRenderedCircuit,
4764
+ useResistor
4739
4765
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.137",
4
+ "version": "0.0.139",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",