@modular-circuit/ir 0.1.1 → 0.1.3

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.mts CHANGED
@@ -380,6 +380,32 @@ declare enum SHEET_FIELD_TYPE {
380
380
  SHEET_MANDATORY_FIELDS = 2
381
381
  }
382
382
 
383
+ interface NamedContent {
384
+ filename: string;
385
+ content: string;
386
+ }
387
+ interface FootprintContent {
388
+ footprint: NamedContent;
389
+ models: NamedContent[];
390
+ }
391
+ interface ComponentContent {
392
+ symbol: NamedContent;
393
+ attributes: {
394
+ name: string;
395
+ value: string;
396
+ }[];
397
+ footprints: FootprintContent[];
398
+ }
399
+ interface PcbContent {
400
+ pcb: NamedContent;
401
+ }
402
+ interface DesignBlockContent {
403
+ root: string | null;
404
+ schematics: NamedContent[];
405
+ pcb: PcbContent | null;
406
+ components: ComponentContent[];
407
+ }
408
+
383
409
  interface ComponentProperty {
384
410
  /**
385
411
  * 器件的类型
@@ -711,6 +737,21 @@ interface IR_GND extends PowerBase {
711
737
  param?: GroundParam;
712
738
  }
713
739
 
740
+ /**
741
+ * @since 0.1.1 Port generated by AI or manual mock data
742
+ */
743
+ interface AbstractPort extends IR_GraphItem {
744
+ port: PortLike | string;
745
+ }
746
+
747
+ /**
748
+ * @since 0.1.1 Block generated by AI or manual mock data
749
+ */
750
+ interface AbstractBlock extends IR_GraphItem {
751
+ name: string;
752
+ ports: AbstractPort[];
753
+ }
754
+
714
755
  interface IR_Junction extends IR_GraphItem {
715
756
  }
716
757
 
@@ -726,9 +767,10 @@ interface IR_PowerSym extends PowerBase {
726
767
  interface IR_Wire extends IR_GraphItem, Connection {
727
768
  }
728
769
 
770
+ type IR_BLOCK_T = IR_Block | AbstractBlock;
729
771
  interface IR_Graph extends IR_GraphItem {
730
772
  name?: string;
731
- blocks?: IR_Block[];
773
+ blocks?: IR_BLOCK_T[];
732
774
  wires?: IR_Wire[];
733
775
  gnd?: IR_GND[];
734
776
  pwr?: IR_PowerSym[];
@@ -736,6 +778,8 @@ interface IR_Graph extends IR_GraphItem {
736
778
  junctions?: IR_Junction[];
737
779
  }
738
780
 
781
+ declare const block_is_abstract: (block: IR_BLOCK_T) => block is AbstractBlock;
782
+
739
783
  declare const MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
740
784
 
741
- export { type Arc, type BASE_SYMBOL, type Bezier, type BlockBase, type BlockPort, type BomItem, type Bus, type BusAlias, type BusEntry, type Circle, type Component, type ComponentProperty, type ConcreteBlockDesign, type Design, type DesignPort, type Drawing, type EDA_DESIGN, type EDA_ITEM, type EDA_PORT_ANNOTATION, type EDA_PORT_ELECTRICAL_ANNOT, type EDA_TEXT, type EMBEDDED_FILE, type EMBEDDED_FILES, type Effects, FILE_TYPE, type Fill, type Font, type GeneralModuleDesign, type GlobalLabel, type GraphicItem, type HierarchicalLabel, type IR_Block, type IR_GND, type IR_Graph, type IR_GraphItem, type IR_Junction, type IR_Label, type IR_Port, type IR_PowerSym, type IR_Wire, type Junction, type Justify, KICAD_GND_NAME, type KiCadBlock, type LABEL_META, type LIB_SYMBOL, type LIB_SYMBOLS, type LabelType, MODULAR_CIRCUIT_EXT, MODULAR_CIRCUIT_SCH_EXT, type ModuleBlock, type ModuleBom, type ModuleCircuit, type ModuleCircuitId, type ModuleDesignBase, type ModuleIndex, type ModuleName, type ModuleResolver, type ModuleSpec, type NetLabel, type NoConnect, type PIN_ALTERNATE, type PIN_DEFINITION, type PIN_DISPLAY_OPT, type PIN_INSTANCE, PORT_ANNOT_TYPE, type Paper, PaperSize, type PaperSizeName, type Polyline, type Project, type ProjectDesign, type PublishedProjectDesign, type Rectangle, type ReusableDesign, type RuntimeModuleCircuit, type SCHEMATIC, type SCH_FIELD, type SCH_IMAGE, type SCH_ITEM, type SCH_ITEM_PROPERTY, type SCH_LABEL, type SCH_LINE, type SCH_SHEET, type SCH_SHEET_INSTANCE, type SCH_SHEET_PIN, type SCH_SYMBOL, type SCH_SYMBOL_META, type SCH_SYMBOL_PROPERTIES, type SCH_TEXT, type SCH_TEXT_BOX, type SERIALIZABLE, SHAPE_T, SHEET_FIELD_TYPE, type SYMBOL_INSTANCE, type SheetInstance, type SheetInstances, type Stroke, type Tag, type TextBox, type TitleBlock, block_is_associated_with_concrete_module, parse_eda_annotation };
785
+ export { type AbstractBlock, type AbstractPort, type Arc, type BASE_SYMBOL, type Bezier, type BlockBase, type BlockPort, type BomItem, type Bus, type BusAlias, type BusEntry, type Circle, type Component, type ComponentContent, type ComponentProperty, type ConcreteBlockDesign, type Design, type DesignBlockContent, type DesignPort, type Drawing, type EDA_DESIGN, type EDA_ITEM, type EDA_PORT_ANNOTATION, type EDA_PORT_ELECTRICAL_ANNOT, type EDA_TEXT, type EMBEDDED_FILE, type EMBEDDED_FILES, type Effects, FILE_TYPE, type Fill, type Font, type FootprintContent, type GeneralModuleDesign, type GlobalLabel, type GraphicItem, type HierarchicalLabel, type IR_BLOCK_T, type IR_Block, type IR_GND, type IR_Graph, type IR_GraphItem, type IR_Junction, type IR_Label, type IR_Port, type IR_PowerSym, type IR_Wire, type Junction, type Justify, KICAD_GND_NAME, type KiCadBlock, type LABEL_META, type LIB_SYMBOL, type LIB_SYMBOLS, type LabelType, MODULAR_CIRCUIT_EXT, MODULAR_CIRCUIT_SCH_EXT, type ModuleBlock, type ModuleBom, type ModuleCircuit, type ModuleCircuitId, type ModuleDesignBase, type ModuleIndex, type ModuleName, type ModuleResolver, type ModuleSpec, type NamedContent, type NetLabel, type NoConnect, type PIN_ALTERNATE, type PIN_DEFINITION, type PIN_DISPLAY_OPT, type PIN_INSTANCE, PORT_ANNOT_TYPE, type Paper, PaperSize, type PaperSizeName, type PcbContent, type Polyline, type Project, type ProjectDesign, type PublishedProjectDesign, type Rectangle, type ReusableDesign, type RuntimeModuleCircuit, type SCHEMATIC, type SCH_FIELD, type SCH_IMAGE, type SCH_ITEM, type SCH_ITEM_PROPERTY, type SCH_LABEL, type SCH_LINE, type SCH_SHEET, type SCH_SHEET_INSTANCE, type SCH_SHEET_PIN, type SCH_SYMBOL, type SCH_SYMBOL_META, type SCH_SYMBOL_PROPERTIES, type SCH_TEXT, type SCH_TEXT_BOX, type SERIALIZABLE, SHAPE_T, SHEET_FIELD_TYPE, type SYMBOL_INSTANCE, type SheetInstance, type SheetInstances, type Stroke, type Tag, type TextBox, type TitleBlock, block_is_abstract, block_is_associated_with_concrete_module, parse_eda_annotation };
package/dist/index.d.ts CHANGED
@@ -380,6 +380,32 @@ declare enum SHEET_FIELD_TYPE {
380
380
  SHEET_MANDATORY_FIELDS = 2
381
381
  }
382
382
 
383
+ interface NamedContent {
384
+ filename: string;
385
+ content: string;
386
+ }
387
+ interface FootprintContent {
388
+ footprint: NamedContent;
389
+ models: NamedContent[];
390
+ }
391
+ interface ComponentContent {
392
+ symbol: NamedContent;
393
+ attributes: {
394
+ name: string;
395
+ value: string;
396
+ }[];
397
+ footprints: FootprintContent[];
398
+ }
399
+ interface PcbContent {
400
+ pcb: NamedContent;
401
+ }
402
+ interface DesignBlockContent {
403
+ root: string | null;
404
+ schematics: NamedContent[];
405
+ pcb: PcbContent | null;
406
+ components: ComponentContent[];
407
+ }
408
+
383
409
  interface ComponentProperty {
384
410
  /**
385
411
  * 器件的类型
@@ -711,6 +737,21 @@ interface IR_GND extends PowerBase {
711
737
  param?: GroundParam;
712
738
  }
713
739
 
740
+ /**
741
+ * @since 0.1.1 Port generated by AI or manual mock data
742
+ */
743
+ interface AbstractPort extends IR_GraphItem {
744
+ port: PortLike | string;
745
+ }
746
+
747
+ /**
748
+ * @since 0.1.1 Block generated by AI or manual mock data
749
+ */
750
+ interface AbstractBlock extends IR_GraphItem {
751
+ name: string;
752
+ ports: AbstractPort[];
753
+ }
754
+
714
755
  interface IR_Junction extends IR_GraphItem {
715
756
  }
716
757
 
@@ -726,9 +767,10 @@ interface IR_PowerSym extends PowerBase {
726
767
  interface IR_Wire extends IR_GraphItem, Connection {
727
768
  }
728
769
 
770
+ type IR_BLOCK_T = IR_Block | AbstractBlock;
729
771
  interface IR_Graph extends IR_GraphItem {
730
772
  name?: string;
731
- blocks?: IR_Block[];
773
+ blocks?: IR_BLOCK_T[];
732
774
  wires?: IR_Wire[];
733
775
  gnd?: IR_GND[];
734
776
  pwr?: IR_PowerSym[];
@@ -736,6 +778,8 @@ interface IR_Graph extends IR_GraphItem {
736
778
  junctions?: IR_Junction[];
737
779
  }
738
780
 
781
+ declare const block_is_abstract: (block: IR_BLOCK_T) => block is AbstractBlock;
782
+
739
783
  declare const MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
740
784
 
741
- export { type Arc, type BASE_SYMBOL, type Bezier, type BlockBase, type BlockPort, type BomItem, type Bus, type BusAlias, type BusEntry, type Circle, type Component, type ComponentProperty, type ConcreteBlockDesign, type Design, type DesignPort, type Drawing, type EDA_DESIGN, type EDA_ITEM, type EDA_PORT_ANNOTATION, type EDA_PORT_ELECTRICAL_ANNOT, type EDA_TEXT, type EMBEDDED_FILE, type EMBEDDED_FILES, type Effects, FILE_TYPE, type Fill, type Font, type GeneralModuleDesign, type GlobalLabel, type GraphicItem, type HierarchicalLabel, type IR_Block, type IR_GND, type IR_Graph, type IR_GraphItem, type IR_Junction, type IR_Label, type IR_Port, type IR_PowerSym, type IR_Wire, type Junction, type Justify, KICAD_GND_NAME, type KiCadBlock, type LABEL_META, type LIB_SYMBOL, type LIB_SYMBOLS, type LabelType, MODULAR_CIRCUIT_EXT, MODULAR_CIRCUIT_SCH_EXT, type ModuleBlock, type ModuleBom, type ModuleCircuit, type ModuleCircuitId, type ModuleDesignBase, type ModuleIndex, type ModuleName, type ModuleResolver, type ModuleSpec, type NetLabel, type NoConnect, type PIN_ALTERNATE, type PIN_DEFINITION, type PIN_DISPLAY_OPT, type PIN_INSTANCE, PORT_ANNOT_TYPE, type Paper, PaperSize, type PaperSizeName, type Polyline, type Project, type ProjectDesign, type PublishedProjectDesign, type Rectangle, type ReusableDesign, type RuntimeModuleCircuit, type SCHEMATIC, type SCH_FIELD, type SCH_IMAGE, type SCH_ITEM, type SCH_ITEM_PROPERTY, type SCH_LABEL, type SCH_LINE, type SCH_SHEET, type SCH_SHEET_INSTANCE, type SCH_SHEET_PIN, type SCH_SYMBOL, type SCH_SYMBOL_META, type SCH_SYMBOL_PROPERTIES, type SCH_TEXT, type SCH_TEXT_BOX, type SERIALIZABLE, SHAPE_T, SHEET_FIELD_TYPE, type SYMBOL_INSTANCE, type SheetInstance, type SheetInstances, type Stroke, type Tag, type TextBox, type TitleBlock, block_is_associated_with_concrete_module, parse_eda_annotation };
785
+ export { type AbstractBlock, type AbstractPort, type Arc, type BASE_SYMBOL, type Bezier, type BlockBase, type BlockPort, type BomItem, type Bus, type BusAlias, type BusEntry, type Circle, type Component, type ComponentContent, type ComponentProperty, type ConcreteBlockDesign, type Design, type DesignBlockContent, type DesignPort, type Drawing, type EDA_DESIGN, type EDA_ITEM, type EDA_PORT_ANNOTATION, type EDA_PORT_ELECTRICAL_ANNOT, type EDA_TEXT, type EMBEDDED_FILE, type EMBEDDED_FILES, type Effects, FILE_TYPE, type Fill, type Font, type FootprintContent, type GeneralModuleDesign, type GlobalLabel, type GraphicItem, type HierarchicalLabel, type IR_BLOCK_T, type IR_Block, type IR_GND, type IR_Graph, type IR_GraphItem, type IR_Junction, type IR_Label, type IR_Port, type IR_PowerSym, type IR_Wire, type Junction, type Justify, KICAD_GND_NAME, type KiCadBlock, type LABEL_META, type LIB_SYMBOL, type LIB_SYMBOLS, type LabelType, MODULAR_CIRCUIT_EXT, MODULAR_CIRCUIT_SCH_EXT, type ModuleBlock, type ModuleBom, type ModuleCircuit, type ModuleCircuitId, type ModuleDesignBase, type ModuleIndex, type ModuleName, type ModuleResolver, type ModuleSpec, type NamedContent, type NetLabel, type NoConnect, type PIN_ALTERNATE, type PIN_DEFINITION, type PIN_DISPLAY_OPT, type PIN_INSTANCE, PORT_ANNOT_TYPE, type Paper, PaperSize, type PaperSizeName, type PcbContent, type Polyline, type Project, type ProjectDesign, type PublishedProjectDesign, type Rectangle, type ReusableDesign, type RuntimeModuleCircuit, type SCHEMATIC, type SCH_FIELD, type SCH_IMAGE, type SCH_ITEM, type SCH_ITEM_PROPERTY, type SCH_LABEL, type SCH_LINE, type SCH_SHEET, type SCH_SHEET_INSTANCE, type SCH_SHEET_PIN, type SCH_SYMBOL, type SCH_SYMBOL_META, type SCH_SYMBOL_PROPERTIES, type SCH_TEXT, type SCH_TEXT_BOX, type SERIALIZABLE, SHAPE_T, SHEET_FIELD_TYPE, type SYMBOL_INSTANCE, type SheetInstance, type SheetInstances, type Stroke, type Tag, type TextBox, type TitleBlock, block_is_abstract, block_is_associated_with_concrete_module, parse_eda_annotation };
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ __export(index_exports, {
28
28
  PaperSize: () => PaperSize,
29
29
  SHAPE_T: () => SHAPE_T,
30
30
  SHEET_FIELD_TYPE: () => SHEET_FIELD_TYPE,
31
+ block_is_abstract: () => block_is_abstract,
31
32
  block_is_associated_with_concrete_module: () => block_is_associated_with_concrete_module,
32
33
  parse_eda_annotation: () => parse_eda_annotation
33
34
  });
@@ -114,6 +115,11 @@ var block_is_associated_with_concrete_module = (block_type) => {
114
115
  return typeof block_type === "string";
115
116
  };
116
117
 
118
+ // src/graph/utils/block_is_abstract.ts
119
+ var block_is_abstract = (block) => {
120
+ return !("type" in block);
121
+ };
122
+
117
123
  // src/constraints/index.ts
118
124
  var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
119
125
  // Annotate the CommonJS export names for ESM import in node:
@@ -126,6 +132,7 @@ var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
126
132
  PaperSize,
127
133
  SHAPE_T,
128
134
  SHEET_FIELD_TYPE,
135
+ block_is_abstract,
129
136
  block_is_associated_with_concrete_module,
130
137
  parse_eda_annotation
131
138
  });
package/dist/index.mjs CHANGED
@@ -79,6 +79,11 @@ var block_is_associated_with_concrete_module = (block_type) => {
79
79
  return typeof block_type === "string";
80
80
  };
81
81
 
82
+ // src/graph/utils/block_is_abstract.ts
83
+ var block_is_abstract = (block) => {
84
+ return !("type" in block);
85
+ };
86
+
82
87
  // src/constraints/index.ts
83
88
  var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
84
89
  export {
@@ -90,6 +95,7 @@ export {
90
95
  PaperSize,
91
96
  SHAPE_T,
92
97
  SHEET_FIELD_TYPE,
98
+ block_is_abstract,
93
99
  block_is_associated_with_concrete_module,
94
100
  parse_eda_annotation
95
101
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@modular-circuit/ir",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Intermediate representation of the modular circuit",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -8,8 +8,7 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/index.mjs",
11
- "require": "./dist/index.js",
12
- "types": "./dist/index.d.ts"
11
+ "require": "./dist/index.js"
13
12
  }
14
13
  },
15
14
  "files": [
@@ -27,7 +26,7 @@
27
26
  "typescript": "^5.4.5"
28
27
  },
29
28
  "dependencies": {
30
- "@modular-circuit/electronics-model": "0.1.0"
29
+ "@modular-circuit/electronics-model": "0.1.1"
31
30
  },
32
31
  "scripts": {
33
32
  "clean": "rimraf dist",