easyeda 0.0.376 → 0.0.378
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/browser/index.d.ts +31 -2
- package/dist/browser/index.js +21 -24
- package/dist/browser/index.js.map +1 -1
- package/dist/index.d.ts +31 -2
- package/dist/index.js +21 -24
- package/dist/index.js.map +1 -1
- package/dist/main.cjs +21 -25
- package/dist/main.cjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChipProps, CommonComponentProps } from '@tscircuit/props';
|
|
1
|
+
import { ChipProps, SupplierPartNumbers, CommonComponentProps } from '@tscircuit/props';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { AnyCircuitElement } from 'circuit-json';
|
|
4
4
|
|
|
@@ -5355,6 +5355,35 @@ declare const convertBetterEasyToTsx: ({ betterEasy, pinAttributes, }: {
|
|
|
5355
5355
|
pinAttributes?: ChipProps["pinAttributes"];
|
|
5356
5356
|
}) => Promise<string>;
|
|
5357
5357
|
|
|
5358
|
+
type GeneratedComponentType = "chip" | "diode" | "led" | "pushbutton" | "switch" | "capacitor" | "resistor" | "inductor" | "crystal" | "connector";
|
|
5359
|
+
type GenerateTypescriptComponentParams = {
|
|
5360
|
+
pinLabels: ChipProps["pinLabels"];
|
|
5361
|
+
pinAttributes?: ChipProps["pinAttributes"];
|
|
5362
|
+
componentName: string;
|
|
5363
|
+
objUrl?: string;
|
|
5364
|
+
stepUrl?: string;
|
|
5365
|
+
supplierPartNumbers: SupplierPartNumbers;
|
|
5366
|
+
manufacturerPartNumber: string;
|
|
5367
|
+
componentType?: GeneratedComponentType;
|
|
5368
|
+
isPolarizedCapacitor?: boolean;
|
|
5369
|
+
capacitance?: string;
|
|
5370
|
+
resistance?: string;
|
|
5371
|
+
inductance?: string;
|
|
5372
|
+
crystalFrequency?: string;
|
|
5373
|
+
crystalPinVariant?: "two_pin" | "four_pin";
|
|
5374
|
+
symbolTsx?: string;
|
|
5375
|
+
schPinArrangement?: ChipProps["schPinArrangement"];
|
|
5376
|
+
useSymbolPortsOnly?: boolean;
|
|
5377
|
+
inferPinAttributes?: boolean;
|
|
5378
|
+
} & ({
|
|
5379
|
+
circuitJson: AnyCircuitElement[];
|
|
5380
|
+
footprint?: string;
|
|
5381
|
+
} | {
|
|
5382
|
+
footprint: string;
|
|
5383
|
+
circuitJson?: AnyCircuitElement[];
|
|
5384
|
+
});
|
|
5385
|
+
declare const generateTypescriptComponent: ({ pinLabels, pinAttributes, componentName, objUrl, stepUrl, circuitJson, footprint, supplierPartNumbers, manufacturerPartNumber, componentType, isPolarizedCapacitor, capacitance, resistance, inductance, crystalFrequency, crystalPinVariant, symbolTsx, schPinArrangement, useSymbolPortsOnly, inferPinAttributes, }: GenerateTypescriptComponentParams) => string;
|
|
5386
|
+
|
|
5358
5387
|
declare function fetchEasyEDAComponent(jlcpcbPartNumber: string, { fetch, includeModelMetadata, }?: {
|
|
5359
5388
|
fetch?: typeof globalThis.fetch;
|
|
5360
5389
|
includeModelMetadata?: boolean;
|
|
@@ -5396,4 +5425,4 @@ interface Options {
|
|
|
5396
5425
|
}
|
|
5397
5426
|
declare const convertEasyEdaJsonToCircuitJson: (easyEdaJson: BetterEasyEdaJson, options?: Options) => AnyCircuitElement[];
|
|
5398
5427
|
|
|
5399
|
-
export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertBetterEasyToTsx, convertEasyEdaJsonToCircuitJson, convertRawEasyToTsx, fetchEasyEDAComponent, generateFootprintTsx, getModelCdnUrl, getModelObjCdnUrl, getModelStepCdnUrl, maybeNumber };
|
|
5428
|
+
export { BBoxSchema, type BetterEasyEdaJson, DataStrSchema, EasyEdaJsonSchema, type GenerateTypescriptComponentParams, type GeneratedComponentType, HeadSchema, LayerItemSchema, LcscSchema, ModelBoundsSchema, ObjectItemSchema, OwnerSchema, PackageDetailDataStrSchema, PackageDetailSchema, type RawEasyEdaJson, SzlcscSchema, convertBetterEasyToTsx, convertEasyEdaJsonToCircuitJson, convertRawEasyToTsx, fetchEasyEDAComponent, generateFootprintTsx, generateTypescriptComponent, getModelCdnUrl, getModelObjCdnUrl, getModelStepCdnUrl, maybeNumber };
|
package/dist/browser/index.js
CHANGED
|
@@ -19154,15 +19154,6 @@ var handleHole = (hole, index) => {
|
|
|
19154
19154
|
pcb_hole_id: `pcb_hole_${index + 1}`
|
|
19155
19155
|
});
|
|
19156
19156
|
};
|
|
19157
|
-
var handleHoleCutout = (hole, index) => {
|
|
19158
|
-
return pcb_cutout.parse({
|
|
19159
|
-
type: "pcb_cutout",
|
|
19160
|
-
pcb_cutout_id: `pcb_cutout_from_hole_${index + 1}`,
|
|
19161
|
-
shape: "circle",
|
|
19162
|
-
center: { x: milx10(hole.center.x), y: milx10(hole.center.y) },
|
|
19163
|
-
radius: milx10(hole.radius)
|
|
19164
|
-
});
|
|
19165
|
-
};
|
|
19166
19157
|
var handleVia = (via, index) => {
|
|
19167
19158
|
const holeDiameter = via.holeRadius * 2;
|
|
19168
19159
|
return pcb_via.parse({
|
|
@@ -19377,7 +19368,6 @@ var convertEasyEdaJsonToCircuitJsonWithPinAttributes = (easyEdaJson, {
|
|
|
19377
19368
|
(shape) => shape.type === "HOLE"
|
|
19378
19369
|
).forEach((h, index) => {
|
|
19379
19370
|
circuitElements.push(handleHole(h, index));
|
|
19380
|
-
circuitElements.push(handleHoleCutout(h, index));
|
|
19381
19371
|
});
|
|
19382
19372
|
easyEdaJson.packageDetail.dataStr.shape.filter((shape) => shape.type === "VIA").forEach((v, index) => {
|
|
19383
19373
|
circuitElements.push(handleVia(v, index));
|
|
@@ -21242,7 +21232,8 @@ var generateTypescriptComponent = ({
|
|
|
21242
21232
|
componentName,
|
|
21243
21233
|
objUrl,
|
|
21244
21234
|
stepUrl,
|
|
21245
|
-
circuitJson,
|
|
21235
|
+
circuitJson = [],
|
|
21236
|
+
footprint,
|
|
21246
21237
|
supplierPartNumbers,
|
|
21247
21238
|
manufacturerPartNumber,
|
|
21248
21239
|
componentType = "chip",
|
|
@@ -21254,17 +21245,22 @@ var generateTypescriptComponent = ({
|
|
|
21254
21245
|
crystalPinVariant,
|
|
21255
21246
|
symbolTsx,
|
|
21256
21247
|
schPinArrangement,
|
|
21257
|
-
useSymbolPortsOnly = false
|
|
21248
|
+
useSymbolPortsOnly = false,
|
|
21249
|
+
inferPinAttributes: inferPinAttributes2 = true
|
|
21258
21250
|
}) => {
|
|
21259
21251
|
const safePinLabels = pinLabels ?? {};
|
|
21260
21252
|
const polarizedPinMetadata = getPolarizedPinMetadata(safePinLabels);
|
|
21261
21253
|
const polarizedPortHintsMap = polarizedPinMetadata?.portHintsMap;
|
|
21262
21254
|
const polarizedPinLabels = polarizedPinMetadata?.pinLabels;
|
|
21263
21255
|
const cadComponent = circuitJson.find((item) => item.type === "cad_component");
|
|
21264
|
-
const footprintTsx = generateFootprintTsx(
|
|
21256
|
+
const footprintTsx = footprint !== void 0 ? JSON.stringify(footprint) : generateFootprintTsx(
|
|
21265
21257
|
circuitJson,
|
|
21266
21258
|
componentType === "diode" || componentType === "led" ? { portHintsMap: polarizedPortHintsMap } : void 0
|
|
21267
21259
|
);
|
|
21260
|
+
const serializedManufacturerPartNumber = JSON.stringify(
|
|
21261
|
+
manufacturerPartNumber
|
|
21262
|
+
);
|
|
21263
|
+
const manufacturerPartNumberTsx = serializedManufacturerPartNumber.slice(1, -1) !== manufacturerPartNumber || manufacturerPartNumber.includes("&") ? `{${serializedManufacturerPartNumber}}` : serializedManufacturerPartNumber;
|
|
21268
21264
|
const simplifiedPinLabels = Object.fromEntries(
|
|
21269
21265
|
Object.entries(safePinLabels).map(([pin, labels]) => {
|
|
21270
21266
|
if (Array.isArray(labels) && labels.length > 1 && labels[0] === pin) {
|
|
@@ -21274,7 +21270,7 @@ var generateTypescriptComponent = ({
|
|
|
21274
21270
|
})
|
|
21275
21271
|
);
|
|
21276
21272
|
const pinLabelsString = Object.entries(simplifiedPinLabels).map(([pin, labels]) => ` ${pin}: ${JSON.stringify(labels)}`).join(",\n");
|
|
21277
|
-
const inferredPinAttributes = componentType === "chip" ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
21273
|
+
const inferredPinAttributes = componentType === "chip" && inferPinAttributes2 ? inferPinAttributes(simplifiedPinLabels) : {};
|
|
21278
21274
|
const resolvedPinAttributes = { ...inferredPinAttributes, ...pinAttributes };
|
|
21279
21275
|
const pinAttributesString = Object.entries(resolvedPinAttributes).map(([pin, attributes]) => {
|
|
21280
21276
|
const attributesString = Object.entries(attributes).map(
|
|
@@ -21338,7 +21334,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
21338
21334
|
<diode
|
|
21339
21335
|
name={name}
|
|
21340
21336
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21341
|
-
manufacturerPartNumber
|
|
21337
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21342
21338
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21343
21339
|
${objUrl || stepUrl ? `cadModel={{
|
|
21344
21340
|
${cadModelLines}
|
|
@@ -21360,7 +21356,7 @@ ${polarizedPinLabelsBlock}${pinAttributesBlock}export const ${componentName} = (
|
|
|
21360
21356
|
<led
|
|
21361
21357
|
name={name}
|
|
21362
21358
|
${polarizedPinLabelsProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21363
|
-
manufacturerPartNumber
|
|
21359
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21364
21360
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21365
21361
|
${objUrl || stepUrl ? `cadModel={{
|
|
21366
21362
|
${cadModelLines}
|
|
@@ -21387,7 +21383,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: PushButtonProps<typ
|
|
|
21387
21383
|
name={name}
|
|
21388
21384
|
pinLabels={pinLabels}
|
|
21389
21385
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21390
|
-
manufacturerPartNumber
|
|
21386
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21391
21387
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21392
21388
|
${objUrl || stepUrl ? `cadModel={{
|
|
21393
21389
|
${cadModelLines}
|
|
@@ -21414,7 +21410,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: SwitchProps) => {
|
|
|
21414
21410
|
name={name}
|
|
21415
21411
|
pinLabels={pinLabels}
|
|
21416
21412
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21417
|
-
manufacturerPartNumber
|
|
21413
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21418
21414
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21419
21415
|
${objUrl || stepUrl ? `cadModel={{
|
|
21420
21416
|
${cadModelLines}
|
|
@@ -21440,7 +21436,7 @@ ${capacitorPolarizedPinLabelsBlock}${pinAttributesBlock}export const ${component
|
|
|
21440
21436
|
name={name}
|
|
21441
21437
|
capacitance=${JSON.stringify(capacitance2)}
|
|
21442
21438
|
${capacitorPolarizedPinLabelsProp}${polarizedProp}${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21443
|
-
manufacturerPartNumber
|
|
21439
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21444
21440
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21445
21441
|
${objUrl || stepUrl ? `cadModel={{
|
|
21446
21442
|
${cadModelLines}
|
|
@@ -21466,7 +21462,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<ResistorProps,
|
|
|
21466
21462
|
name={name}
|
|
21467
21463
|
resistance=${JSON.stringify(resistance2)}
|
|
21468
21464
|
${symbolProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21469
|
-
manufacturerPartNumber
|
|
21465
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21470
21466
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21471
21467
|
${objUrl || stepUrl ? `cadModel={{
|
|
21472
21468
|
${cadModelLines}
|
|
@@ -21489,7 +21485,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: Omit<InductorProps,
|
|
|
21489
21485
|
<inductor
|
|
21490
21486
|
inductance=${JSON.stringify(inductance2)}
|
|
21491
21487
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21492
|
-
manufacturerPartNumber
|
|
21488
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21493
21489
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21494
21490
|
${objUrl || stepUrl ? `cadModel={{
|
|
21495
21491
|
${cadModelLines}
|
|
@@ -21518,7 +21514,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ImportedCrystalProp
|
|
|
21518
21514
|
frequency=${JSON.stringify(crystalFrequency)}
|
|
21519
21515
|
pinVariant=${JSON.stringify(crystalPinVariant)}
|
|
21520
21516
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21521
|
-
manufacturerPartNumber
|
|
21517
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21522
21518
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21523
21519
|
${objUrl || stepUrl ? `cadModel={{
|
|
21524
21520
|
${cadModelLines}
|
|
@@ -21542,7 +21538,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ConnectorProps) =>
|
|
|
21542
21538
|
<connector
|
|
21543
21539
|
pinLabels={pinLabels}
|
|
21544
21540
|
supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21545
|
-
manufacturerPartNumber
|
|
21541
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21546
21542
|
${pinAttributesProp} footprint={${footprintTsx}}
|
|
21547
21543
|
${objUrl || stepUrl ? `cadModel={{
|
|
21548
21544
|
${cadModelLines}
|
|
@@ -21564,7 +21560,7 @@ ${pinAttributesBlock}export const ${componentName} = (props: ChipProps<typeof pi
|
|
|
21564
21560
|
return (
|
|
21565
21561
|
<chip
|
|
21566
21562
|
${useSymbolPortsOnly ? "" : " pinLabels={pinLabels}\n"}${pinAttributesProp}${symbolProp}${schPinArrangementProp} supplierPartNumbers={${JSON.stringify(supplierPartNumbers, null, " ")}}
|
|
21567
|
-
manufacturerPartNumber
|
|
21563
|
+
manufacturerPartNumber=${manufacturerPartNumberTsx}
|
|
21568
21564
|
footprint={${footprintTsx}}
|
|
21569
21565
|
${objUrl || stepUrl ? `cadModel={{
|
|
21570
21566
|
${cadModelLines}
|
|
@@ -22146,6 +22142,7 @@ export {
|
|
|
22146
22142
|
convertRawEasyToTsx,
|
|
22147
22143
|
fetchEasyEDAComponent,
|
|
22148
22144
|
generateFootprintTsx,
|
|
22145
|
+
generateTypescriptComponent,
|
|
22149
22146
|
getModelCdnUrl,
|
|
22150
22147
|
getModelObjCdnUrl,
|
|
22151
22148
|
getModelStepCdnUrl,
|