circuit-bricks
Version:
A modular, Lego-style SVG circuit component system for React (ALPHA - Not for production use)
536 lines (526 loc) • 10.7 kB
JavaScript
"use client";
//#region src/registry/components/resistor.json
var id$9 = "resistor";
var name$9 = "Resistor";
var category$9 = "passive";
var description$9 = "A passive two-terminal electrical component that implements electrical resistance";
var defaultWidth$9 = 80;
var defaultHeight$9 = 30;
var ports$9 = [{
"id": "left",
"x": 0,
"y": 15,
"type": "inout"
}, {
"id": "right",
"x": 80,
"y": 15,
"type": "inout"
}];
var properties$9 = [{
"key": "resistance",
"label": "Resistance",
"type": "number",
"unit": "Ω",
"default": 1e3,
"min": 0
}, {
"key": "tolerance",
"label": "Tolerance",
"type": "number",
"unit": "%",
"default": 5,
"min": 0,
"max": 20
}];
var svgPath$9 = "M10,15 h10 l5,-10 l10,20 l10,-20 l10,20 l10,-20 l5,10 h10";
var resistor_default = {
id: id$9,
name: name$9,
category: category$9,
description: description$9,
defaultWidth: defaultWidth$9,
defaultHeight: defaultHeight$9,
ports: ports$9,
properties: properties$9,
svgPath: svgPath$9
};
//#endregion
//#region src/registry/components/capacitor.json
var id$8 = "capacitor";
var name$8 = "Capacitor";
var category$8 = "passive";
var description$8 = "A passive two-terminal electrical component that stores electrical energy in an electric field";
var defaultWidth$8 = 60;
var defaultHeight$8 = 40;
var ports$8 = [{
"id": "left",
"x": 0,
"y": 20,
"type": "inout"
}, {
"id": "right",
"x": 60,
"y": 20,
"type": "inout"
}];
var properties$8 = [{
"key": "capacitance",
"label": "Capacitance",
"type": "number",
"unit": "μF",
"default": 10,
"min": 0
}, {
"key": "voltageRating",
"label": "Voltage Rating",
"type": "number",
"unit": "V",
"default": 50,
"min": 0
}];
var svgPath$8 = "M10,20 h15 M35,5 v30 M45,5 v30 M45,20 h15";
var capacitor_default = {
id: id$8,
name: name$8,
category: category$8,
description: description$8,
defaultWidth: defaultWidth$8,
defaultHeight: defaultHeight$8,
ports: ports$8,
properties: properties$8,
svgPath: svgPath$8
};
//#endregion
//#region src/registry/components/battery.json
var id$7 = "battery";
var name$7 = "Battery";
var category$7 = "sources";
var description$7 = "A source of electrical energy that can be used to power circuits";
var defaultWidth$7 = 60;
var defaultHeight$7 = 40;
var ports$7 = [{
"id": "positive",
"x": 60,
"y": 20,
"type": "output"
}, {
"id": "negative",
"x": 0,
"y": 20,
"type": "output"
}];
var properties$7 = [{
"key": "voltage",
"label": "Voltage",
"type": "number",
"unit": "V",
"default": 9,
"min": 0
}, {
"key": "internal_resistance",
"label": "Internal Resistance",
"type": "number",
"unit": "Ω",
"default": .1,
"min": 0
}];
var svgPath$7 = "M10,20 h10 M20,5 v30 M30,10 v20 M40,5 v30 M40,20 h10";
var battery_default = {
id: id$7,
name: name$7,
category: category$7,
description: description$7,
defaultWidth: defaultWidth$7,
defaultHeight: defaultHeight$7,
ports: ports$7,
properties: properties$7,
svgPath: svgPath$7
};
//#endregion
//#region src/registry/components/ground.json
var id$6 = "ground";
var name$6 = "Ground";
var category$6 = "basic";
var description$6 = "A reference point in an electrical circuit from which voltages are measured";
var defaultWidth$6 = 30;
var defaultHeight$6 = 30;
var ports$6 = [{
"id": "terminal",
"x": 15,
"y": 0,
"type": "inout"
}];
var properties$6 = [];
var svgPath$6 = "M15,0 v15 M5,15 h20 M8,20 h14 M11,25 h8";
var ground_default = {
id: id$6,
name: name$6,
category: category$6,
description: description$6,
defaultWidth: defaultWidth$6,
defaultHeight: defaultHeight$6,
ports: ports$6,
properties: properties$6,
svgPath: svgPath$6
};
//#endregion
//#region src/registry/components/switch.json
var id$5 = "switch";
var name$5 = "Switch";
var category$5 = "basic";
var description$5 = "A component that can be open or closed to control current flow";
var defaultWidth$5 = 60;
var defaultHeight$5 = 30;
var ports$5 = [{
"id": "left",
"x": 0,
"y": 15,
"type": "inout"
}, {
"id": "right",
"x": 60,
"y": 15,
"type": "inout"
}];
var properties$5 = [{
"key": "state",
"label": "State",
"type": "select",
"options": [{
"value": "open",
"label": "Open"
}, {
"value": "closed",
"label": "Closed"
}],
"default": "open"
}];
var svgPath$5 = "M10,15 h10 M20,15 l20,-10 M40,15 h10";
var switch_default = {
id: id$5,
name: name$5,
category: category$5,
description: description$5,
defaultWidth: defaultWidth$5,
defaultHeight: defaultHeight$5,
ports: ports$5,
properties: properties$5,
svgPath: svgPath$5
};
//#endregion
//#region src/registry/components/voltage-source.json
var id$4 = "voltage-source";
var name$4 = "Voltage Source";
var category$4 = "sources";
var description$4 = "An ideal voltage source with constant voltage";
var defaultWidth$4 = 50;
var defaultHeight$4 = 50;
var ports$4 = [{
"id": "positive",
"x": 25,
"y": 0,
"type": "output"
}, {
"id": "negative",
"x": 25,
"y": 50,
"type": "output"
}];
var properties$4 = [
{
"key": "voltage",
"label": "Voltage",
"type": "number",
"unit": "V",
"default": 5,
"min": 0
},
{
"key": "frequency",
"label": "Frequency",
"type": "number",
"unit": "Hz",
"default": 0,
"min": 0
},
{
"key": "sourceType",
"label": "Source Type",
"type": "select",
"options": [{
"value": "dc",
"label": "DC"
}, {
"value": "ac",
"label": "AC"
}],
"default": "dc"
}
];
var svgPath$4 = "M25,10 v10 M20,25 h10 M25,30 v10 M25,25 m-15,0 a15,15 0 1,0 30,0 a15,15 0 1,0 -30,0";
var voltage_source_default = {
id: id$4,
name: name$4,
category: category$4,
description: description$4,
defaultWidth: defaultWidth$4,
defaultHeight: defaultHeight$4,
ports: ports$4,
properties: properties$4,
svgPath: svgPath$4
};
//#endregion
//#region src/registry/components/diode.json
var id$3 = "diode";
var name$3 = "Diode";
var category$3 = "semiconductor";
var description$3 = "A semiconductor device that allows current to flow in only one direction";
var defaultWidth$3 = 60;
var defaultHeight$3 = 30;
var ports$3 = [{
"id": "anode",
"x": 0,
"y": 15,
"type": "inout"
}, {
"id": "cathode",
"x": 60,
"y": 15,
"type": "inout"
}];
var properties$3 = [{
"key": "forwardVoltage",
"label": "Forward Voltage",
"type": "number",
"unit": "V",
"default": .7,
"min": 0
}, {
"key": "maxCurrent",
"label": "Max Current",
"type": "number",
"unit": "A",
"default": 1,
"min": 0
}];
var svgPath$3 = "M10,15 h10 M20,5 l0,20 L40,15 L20,5 M40,5 v20 M40,15 h10";
var diode_default = {
id: id$3,
name: name$3,
category: category$3,
description: description$3,
defaultWidth: defaultWidth$3,
defaultHeight: defaultHeight$3,
ports: ports$3,
properties: properties$3,
svgPath: svgPath$3
};
//#endregion
//#region src/registry/components/transistor-npn.json
var id$2 = "transistor-npn";
var name$2 = "NPN Transistor";
var category$2 = "semiconductor";
var description$2 = "An NPN bipolar junction transistor for amplification and switching";
var defaultWidth$2 = 50;
var defaultHeight$2 = 60;
var ports$2 = [
{
"id": "collector",
"x": 25,
"y": 0,
"type": "inout"
},
{
"id": "base",
"x": 0,
"y": 30,
"type": "input"
},
{
"id": "emitter",
"x": 25,
"y": 60,
"type": "inout"
}
];
var properties$2 = [{
"key": "gain",
"label": "Current Gain (β)",
"type": "number",
"default": 100,
"min": 1
}];
var svgPath$2 = "M25,0 v15 M25,45 v15 M0,30 h15 M15,15 v30 M15,30 l20,-10 l0,20 Z";
var transistor_npn_default = {
id: id$2,
name: name$2,
category: category$2,
description: description$2,
defaultWidth: defaultWidth$2,
defaultHeight: defaultHeight$2,
ports: ports$2,
properties: properties$2,
svgPath: svgPath$2
};
//#endregion
//#region src/registry/components/led.json
var id$1 = "led";
var name$1 = "LED";
var category$1 = "semiconductor";
var description$1 = "Light-emitting diode that emits light when current flows through it";
var defaultWidth$1 = 60;
var defaultHeight$1 = 40;
var ports$1 = [{
"id": "anode",
"x": 0,
"y": 20,
"type": "inout"
}, {
"id": "cathode",
"x": 60,
"y": 20,
"type": "inout"
}];
var properties$1 = [
{
"key": "color",
"label": "Color",
"type": "color",
"default": "#ff0000"
},
{
"key": "forwardVoltage",
"label": "Forward Voltage",
"type": "number",
"unit": "V",
"default": 1.8,
"min": 0
},
{
"key": "maxCurrent",
"label": "Max Current",
"type": "number",
"unit": "mA",
"default": 20,
"min": 0
}
];
var svgPath$1 = "M10,20 h10 M20,5 l0,30 L40,20 L20,5 M40,5 v30 M40,20 h10 M25,5 l5,-5 l5,10 l5,-5 M25,10 l5,-5 l5,10 l5,-5";
var led_default = {
id: id$1,
name: name$1,
category: category$1,
description: description$1,
defaultWidth: defaultWidth$1,
defaultHeight: defaultHeight$1,
ports: ports$1,
properties: properties$1,
svgPath: svgPath$1
};
//#endregion
//#region src/registry/components/ic.json
var id = "ic";
var name = "Integrated Circuit";
var category = "advanced";
var description = "A general-purpose integrated circuit with configurable pins";
var defaultWidth = 80;
var defaultHeight = 100;
var ports = [
{
"id": "vcc",
"x": 20,
"y": 0,
"type": "input",
"label": "VCC"
},
{
"id": "gnd",
"x": 60,
"y": 100,
"type": "input",
"label": "GND"
},
{
"id": "in1",
"x": 0,
"y": 20,
"type": "input",
"label": "IN1"
},
{
"id": "in2",
"x": 0,
"y": 40,
"type": "input",
"label": "IN2"
},
{
"id": "in3",
"x": 0,
"y": 60,
"type": "input",
"label": "IN3"
},
{
"id": "in4",
"x": 0,
"y": 80,
"type": "input",
"label": "IN4"
},
{
"id": "out1",
"x": 80,
"y": 20,
"type": "output",
"label": "OUT1"
},
{
"id": "out2",
"x": 80,
"y": 40,
"type": "output",
"label": "OUT2"
},
{
"id": "out3",
"x": 80,
"y": 60,
"type": "output",
"label": "OUT3"
},
{
"id": "out4",
"x": 80,
"y": 80,
"type": "output",
"label": "OUT4"
}
];
var properties = [{
"key": "name",
"label": "IC Name",
"type": "text",
"default": "IC1"
}, {
"key": "type",
"label": "IC Type",
"type": "text",
"default": "Custom IC"
}];
var svgPath = "<svg width='80' height='100'><rect x='10' y='10' width='60' height='80' fill='none' stroke='white' stroke-width='2'/><text x='40' y='50' text-anchor='middle' font-family='monospace' font-size='12' fill='white'>IC</text><circle cx='20' cy='10' r='3' fill='none' stroke='white'/></svg>";
var ic_default = {
id,
name,
category,
description,
defaultWidth,
defaultHeight,
ports,
properties,
svgPath
};
//#endregion
export { battery_default, capacitor_default, diode_default, ground_default, ic_default, led_default, resistor_default, switch_default, transistor_npn_default, voltage_source_default };
//# sourceMappingURL=ic-DjodI3kT.mjs.map