@modular-circuit/ir 0.1.0 → 0.1.2
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 +24 -4
- package/dist/index.d.ts +24 -4
- package/dist/index.js +14 -0
- package/dist/index.mjs +12 -0
- package/package.json +3 -4
package/dist/index.d.mts
CHANGED
|
@@ -689,12 +689,14 @@ interface IR_Port extends IR_GraphItem {
|
|
|
689
689
|
type: PortType | string;
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
type ModuleCircuitId = string;
|
|
693
|
+
declare const block_is_associated_with_concrete_module: (block_type: IR_Block["type"]) => block_type is ModuleCircuitId;
|
|
692
694
|
interface IR_Block extends IR_GraphItem {
|
|
693
695
|
name?: string;
|
|
694
696
|
/**
|
|
695
|
-
* 模块类型
|
|
697
|
+
* 模块类型(索引),可以是作者+名称,或者直接就是模块ID
|
|
696
698
|
*/
|
|
697
|
-
type: ModuleName;
|
|
699
|
+
type: ModuleName | ModuleCircuitId;
|
|
698
700
|
/**
|
|
699
701
|
* 模块摆到画布上之后的ID
|
|
700
702
|
*/
|
|
@@ -709,6 +711,21 @@ interface IR_GND extends PowerBase {
|
|
|
709
711
|
param?: GroundParam;
|
|
710
712
|
}
|
|
711
713
|
|
|
714
|
+
/**
|
|
715
|
+
* @since 0.1.1 Port generated by AI or manual mock data
|
|
716
|
+
*/
|
|
717
|
+
interface AbstractPort extends IR_GraphItem {
|
|
718
|
+
port: PortLike | string;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* @since 0.1.1 Block generated by AI or manual mock data
|
|
723
|
+
*/
|
|
724
|
+
interface AbstractBlock extends IR_GraphItem {
|
|
725
|
+
name: string;
|
|
726
|
+
ports: AbstractPort[];
|
|
727
|
+
}
|
|
728
|
+
|
|
712
729
|
interface IR_Junction extends IR_GraphItem {
|
|
713
730
|
}
|
|
714
731
|
|
|
@@ -724,9 +741,10 @@ interface IR_PowerSym extends PowerBase {
|
|
|
724
741
|
interface IR_Wire extends IR_GraphItem, Connection {
|
|
725
742
|
}
|
|
726
743
|
|
|
744
|
+
type IR_BLOCK_T = IR_Block | AbstractBlock;
|
|
727
745
|
interface IR_Graph extends IR_GraphItem {
|
|
728
746
|
name?: string;
|
|
729
|
-
blocks?:
|
|
747
|
+
blocks?: IR_BLOCK_T[];
|
|
730
748
|
wires?: IR_Wire[];
|
|
731
749
|
gnd?: IR_GND[];
|
|
732
750
|
pwr?: IR_PowerSym[];
|
|
@@ -734,6 +752,8 @@ interface IR_Graph extends IR_GraphItem {
|
|
|
734
752
|
junctions?: IR_Junction[];
|
|
735
753
|
}
|
|
736
754
|
|
|
755
|
+
declare const block_is_abstract: (block: IR_BLOCK_T) => block is AbstractBlock;
|
|
756
|
+
|
|
737
757
|
declare const MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
|
|
738
758
|
|
|
739
|
-
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 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, parse_eda_annotation };
|
|
759
|
+
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 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_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 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_abstract, block_is_associated_with_concrete_module, parse_eda_annotation };
|
package/dist/index.d.ts
CHANGED
|
@@ -689,12 +689,14 @@ interface IR_Port extends IR_GraphItem {
|
|
|
689
689
|
type: PortType | string;
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
type ModuleCircuitId = string;
|
|
693
|
+
declare const block_is_associated_with_concrete_module: (block_type: IR_Block["type"]) => block_type is ModuleCircuitId;
|
|
692
694
|
interface IR_Block extends IR_GraphItem {
|
|
693
695
|
name?: string;
|
|
694
696
|
/**
|
|
695
|
-
* 模块类型
|
|
697
|
+
* 模块类型(索引),可以是作者+名称,或者直接就是模块ID
|
|
696
698
|
*/
|
|
697
|
-
type: ModuleName;
|
|
699
|
+
type: ModuleName | ModuleCircuitId;
|
|
698
700
|
/**
|
|
699
701
|
* 模块摆到画布上之后的ID
|
|
700
702
|
*/
|
|
@@ -709,6 +711,21 @@ interface IR_GND extends PowerBase {
|
|
|
709
711
|
param?: GroundParam;
|
|
710
712
|
}
|
|
711
713
|
|
|
714
|
+
/**
|
|
715
|
+
* @since 0.1.1 Port generated by AI or manual mock data
|
|
716
|
+
*/
|
|
717
|
+
interface AbstractPort extends IR_GraphItem {
|
|
718
|
+
port: PortLike | string;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* @since 0.1.1 Block generated by AI or manual mock data
|
|
723
|
+
*/
|
|
724
|
+
interface AbstractBlock extends IR_GraphItem {
|
|
725
|
+
name: string;
|
|
726
|
+
ports: AbstractPort[];
|
|
727
|
+
}
|
|
728
|
+
|
|
712
729
|
interface IR_Junction extends IR_GraphItem {
|
|
713
730
|
}
|
|
714
731
|
|
|
@@ -724,9 +741,10 @@ interface IR_PowerSym extends PowerBase {
|
|
|
724
741
|
interface IR_Wire extends IR_GraphItem, Connection {
|
|
725
742
|
}
|
|
726
743
|
|
|
744
|
+
type IR_BLOCK_T = IR_Block | AbstractBlock;
|
|
727
745
|
interface IR_Graph extends IR_GraphItem {
|
|
728
746
|
name?: string;
|
|
729
|
-
blocks?:
|
|
747
|
+
blocks?: IR_BLOCK_T[];
|
|
730
748
|
wires?: IR_Wire[];
|
|
731
749
|
gnd?: IR_GND[];
|
|
732
750
|
pwr?: IR_PowerSym[];
|
|
@@ -734,6 +752,8 @@ interface IR_Graph extends IR_GraphItem {
|
|
|
734
752
|
junctions?: IR_Junction[];
|
|
735
753
|
}
|
|
736
754
|
|
|
755
|
+
declare const block_is_abstract: (block: IR_BLOCK_T) => block is AbstractBlock;
|
|
756
|
+
|
|
737
757
|
declare const MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
|
|
738
758
|
|
|
739
|
-
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 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, parse_eda_annotation };
|
|
759
|
+
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 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_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 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_abstract, block_is_associated_with_concrete_module, parse_eda_annotation };
|
package/dist/index.js
CHANGED
|
@@ -28,6 +28,8 @@ __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,
|
|
32
|
+
block_is_associated_with_concrete_module: () => block_is_associated_with_concrete_module,
|
|
31
33
|
parse_eda_annotation: () => parse_eda_annotation
|
|
32
34
|
});
|
|
33
35
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -108,6 +110,16 @@ function parse_eda_annotation(eda_annotation) {
|
|
|
108
110
|
return { pin_type: import_electronics_model.ELECTRICAL_PINTYPE.PT_POWER_IN, port_annot_type: 2 /* GLOBAL_POWER_PIN */ };
|
|
109
111
|
}
|
|
110
112
|
|
|
113
|
+
// src/graph/ir_block.ts
|
|
114
|
+
var block_is_associated_with_concrete_module = (block_type) => {
|
|
115
|
+
return typeof block_type === "string";
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
// src/graph/utils/block_is_abstract.ts
|
|
119
|
+
var block_is_abstract = (block) => {
|
|
120
|
+
return !("type" in block);
|
|
121
|
+
};
|
|
122
|
+
|
|
111
123
|
// src/constraints/index.ts
|
|
112
124
|
var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
|
|
113
125
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -120,5 +132,7 @@ var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
|
|
|
120
132
|
PaperSize,
|
|
121
133
|
SHAPE_T,
|
|
122
134
|
SHEET_FIELD_TYPE,
|
|
135
|
+
block_is_abstract,
|
|
136
|
+
block_is_associated_with_concrete_module,
|
|
123
137
|
parse_eda_annotation
|
|
124
138
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -74,6 +74,16 @@ function parse_eda_annotation(eda_annotation) {
|
|
|
74
74
|
return { pin_type: ELECTRICAL_PINTYPE.PT_POWER_IN, port_annot_type: 2 /* GLOBAL_POWER_PIN */ };
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
// src/graph/ir_block.ts
|
|
78
|
+
var block_is_associated_with_concrete_module = (block_type) => {
|
|
79
|
+
return typeof block_type === "string";
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/graph/utils/block_is_abstract.ts
|
|
83
|
+
var block_is_abstract = (block) => {
|
|
84
|
+
return !("type" in block);
|
|
85
|
+
};
|
|
86
|
+
|
|
77
87
|
// src/constraints/index.ts
|
|
78
88
|
var MODULAR_CIRCUIT_SCH_EXT = "modular_circuit";
|
|
79
89
|
export {
|
|
@@ -85,5 +95,7 @@ export {
|
|
|
85
95
|
PaperSize,
|
|
86
96
|
SHAPE_T,
|
|
87
97
|
SHEET_FIELD_TYPE,
|
|
98
|
+
block_is_abstract,
|
|
99
|
+
block_is_associated_with_concrete_module,
|
|
88
100
|
parse_eda_annotation
|
|
89
101
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@modular-circuit/ir",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
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.
|
|
29
|
+
"@modular-circuit/electronics-model": "0.1.1"
|
|
31
30
|
},
|
|
32
31
|
"scripts": {
|
|
33
32
|
"clean": "rimraf dist",
|