@tscircuit/core 0.0.179 → 0.0.181
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 +5 -5
- package/dist/index.js +9 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7113,19 +7113,19 @@ declare const useRenderedCircuit: (reactElements: React.ReactElement) => {
|
|
|
7113
7113
|
circuitJson?: AnyCircuitElement[];
|
|
7114
7114
|
};
|
|
7115
7115
|
|
|
7116
|
-
type PinLabelSpec<PinLabel extends string> = readonly PinLabel[] | readonly (readonly PinLabel[])[] |
|
|
7117
|
-
[key: string]: readonly PinLabel[];
|
|
7118
|
-
};
|
|
7116
|
+
type PinLabelSpec<PinLabel extends string, PinNumberKey extends string = never> = readonly PinLabel[] | readonly (readonly PinLabel[])[] | Record<PinNumberKey, readonly PinLabel[]>;
|
|
7119
7117
|
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">) & {
|
|
7120
7118
|
[key in PinLabel]?: string;
|
|
7121
7119
|
}> & {
|
|
7122
7120
|
[key in PinLabel]: string;
|
|
7123
7121
|
};
|
|
7124
|
-
|
|
7122
|
+
type CreateUseComponentConstPinLabels = <Props, PinLabel extends string | never = never>(Component: React.ComponentType<Props>, pins: readonly PinLabel[]) => <PropsFromHook extends Omit<Props, "name"> | undefined = undefined>(name: string, props?: PropsFromHook) => ComponentWithPins<Props, PinLabel, PropsFromHook>;
|
|
7123
|
+
type CreateUseComponentPinLabelMap = <Props, PinLabel extends string | never = never, PinNumberKey extends string = never>(Component: React.ComponentType<Props>, pins: Record<PinNumberKey, readonly PinLabel[] | PinLabel[]>) => <PropsFromHook extends Omit<Props, "name"> | undefined = undefined>(name: string, props?: PropsFromHook) => ComponentWithPins<Props, PinLabel | PinNumberKey, PropsFromHook>;
|
|
7124
|
+
declare const createUseComponent: CreateUseComponentConstPinLabels & CreateUseComponentPinLabelMap;
|
|
7125
7125
|
|
|
7126
7126
|
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>;
|
|
7127
7127
|
|
|
7128
|
-
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>;
|
|
7128
|
+
declare const useChip: <PinLabel extends string>(pinLabels: Record<string, PinLabel[]>) => <PropsFromHook extends Omit<ChipProps, "name"> | undefined = undefined>(name: string, props?: PropsFromHook | undefined) => ComponentWithPins<ChipProps, string | PinLabel, PropsFromHook>;
|
|
7129
7129
|
|
|
7130
7130
|
declare const useDiode: <PropsFromHook extends Omit<{
|
|
7131
7131
|
name: string;
|
package/dist/index.js
CHANGED
|
@@ -5006,20 +5006,12 @@ var Battery = class extends NormalComponent {
|
|
|
5006
5006
|
};
|
|
5007
5007
|
}
|
|
5008
5008
|
initPorts() {
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
);
|
|
5016
|
-
this.add(
|
|
5017
|
-
new Port({
|
|
5018
|
-
name: "pin2",
|
|
5019
|
-
pinNumber: 2,
|
|
5020
|
-
aliases: ["cathode", "neg", "right"]
|
|
5021
|
-
})
|
|
5022
|
-
);
|
|
5009
|
+
super.initPorts({
|
|
5010
|
+
additionalAliases: {
|
|
5011
|
+
pin1: ["anode", "pos", "left"],
|
|
5012
|
+
pin2: ["cathode", "neg", "right"]
|
|
5013
|
+
}
|
|
5014
|
+
});
|
|
5023
5015
|
}
|
|
5024
5016
|
doInitialSourceRender() {
|
|
5025
5017
|
const { db } = this.root;
|
|
@@ -5330,7 +5322,9 @@ var createUseComponent = (Component2, pins) => {
|
|
|
5330
5322
|
if (Array.isArray(pins)) {
|
|
5331
5323
|
pinLabelsFlatArray.push(...pins.flat());
|
|
5332
5324
|
} else if (typeof pins === "object") {
|
|
5333
|
-
pinLabelsFlatArray.push(
|
|
5325
|
+
pinLabelsFlatArray.push(
|
|
5326
|
+
...Object.values(pins).flat()
|
|
5327
|
+
);
|
|
5334
5328
|
pinLabelsFlatArray.push(...Object.keys(pins));
|
|
5335
5329
|
}
|
|
5336
5330
|
const R = (props2) => {
|