Skip to content

Commit

Permalink
Beginings of Devices UI
Browse files Browse the repository at this point in the history
- device summary
- start of offcanvas

Signed-off-by: Rachel <[email protected]>
  • Loading branch information
Ryex committed Apr 1, 2024
1 parent 41cdf86 commit a626430
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 430 deletions.
131 changes: 1 addition & 130 deletions cspell.json
Original file line number Diff line number Diff line change
@@ -1,130 +1 @@
{
"version": "0.2",
"language": "en",
"flagWords": [],
"words": [
"Astroloy",
"Autolathe",
"bapal",
"bapz",
"bapzal",
"batchmode",
"batchmodes",
"bdns",
"bdnsal",
"bdse",
"bdseal",
"beqal",
"beqz",
"beqzal",
"bgeal",
"bgez",
"bgezal",
"bgtal",
"bgtz",
"bgtzal",
"bindgen",
"bleal",
"blez",
"blezal",
"bltal",
"bltz",
"bltzal",
"bnaal",
"bnan",
"bnaz",
"bnazal",
"bneal",
"bnez",
"bnezal",
"brap",
"brapz",
"brdns",
"brdse",
"breq",
"breqz",
"brge",
"brgez",
"brgt",
"brgtz",
"brle",
"brlez",
"brlt",
"brltz",
"brna",
"brnan",
"brnaz",
"brne",
"brnez",
"Circuitboard",
"codegen",
"conv",
"cstyle",
"endpos",
"getd",
"Hardsuit",
"hashables",
"inext",
"inextp",
"infile",
"itertools",
"jetpack",
"kbshortcutmenu",
"Keybind",
"lbns",
"logicable",
"logictype",
"logictypes",
"lzma",
"Mineables",
"mscorlib",
"MSEED",
"ninf",
"nomatch",
"oprs",
"overcolumn",
"Overlength",
"pedia",
"peekable",
"prec",
"preproc",
"putd",
"QUICKFIX",
"reagentmode",
"reagentmodes",
"repr",
"retval",
"rocketstation",
"sapz",
"sattellite",
"sdns",
"sdse",
"searchbox",
"searchbtn",
"seqz",
"serde",
"settingsmenu",
"sgez",
"sgtz",
"slez",
"slotlogic",
"slotlogicable",
"slotlogictype",
"slotlogictypes",
"slottype",
"sltz",
"snan",
"snanz",
"snaz",
"snez",
"splitn",
"Stationeers",
"stationpedia",
"stdweb",
"thiserror",
"tokentype",
"trunc",
"Tsify",
"whos"
]
}
{"language":"en","flagWords":[],"version":"0.2","words":["Astroloy","Autolathe","bapal","bapz","bapzal","batchmode","batchmodes","bdns","bdnsal","bdse","bdseal","beqal","beqz","beqzal","bgeal","bgez","bgezal","bgtal","bgtz","bgtzal","bindgen","bleal","blez","blezal","bltal","bltz","bltzal","bnaal","bnan","bnaz","bnazal","bneal","bnez","bnezal","brap","brapz","brdns","brdse","breq","breqz","brge","brgez","brgt","brgtz","brle","brlez","brlt","brltz","brna","brnan","brnaz","brne","brnez","Circuitboard","codegen","conv","cstyle","endpos","getd","Hardsuit","hashables","inext","inextp","infile","itertools","jetpack","kbshortcutmenu","Keybind","lbns","logicable","logictype","logictypes","lzma","Mineables","mscorlib","MSEED","ninf","nomatch","oprs","overcolumn","Overlength","pedia","peekable","prec","preproc","putd","QUICKFIX","reagentmode","reagentmodes","repr","retval","rocketstation","sapz","sattellite","sdns","sdse","searchbox","searchbtn","seqz","serde","settingsmenu","sgez","sgtz","slez","slotlogic","slotlogicable","slotlogictype","slotlogictypes","slottype","sltz","snan","snanz","snaz","snez","splitn","Stationeers","stationpedia","stdweb","thiserror","tokentype","trunc","Tsify","whos","Depressurising","Pressurising","logicslottypes","lparen","rparen","hstack","dylib"]}
2 changes: 1 addition & 1 deletion ic10emu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["lib"]
crate-type = ["lib", "cdylib"]


[dependencies]
Expand Down
6 changes: 6 additions & 0 deletions ic10emu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ pub struct Device {
pub name: Option<String>,
pub name_hash: Option<f64>,
pub fields: HashMap<grammar::LogicType, LogicField>,
pub prefab_name: Option<String>,
pub prefab_hash: Option<i32>,
pub slots: Vec<Slot>,
pub reagents: HashMap<ReagentMode, HashMap<i32, f64>>,
pub ic: Option<u16>,
Expand Down Expand Up @@ -253,6 +255,8 @@ impl Device {
id,
name: None,
name_hash: None,
prefab_name: None,
prefab_hash: None,
fields: HashMap::new(),
slots: Vec::new(),
reagents: HashMap::new(),
Expand All @@ -273,13 +277,15 @@ impl Device {
value: 0.0,
},
);
device.prefab_name = Some("StructureCircuitHousing".to_owned());
device.fields.insert(
LogicType::Error,
LogicField {
field_type: FieldType::ReadWrite,
value: 0.0,
},
);
device.prefab_hash = Some(-128473777);
device.fields.insert(
LogicType::PrefabHash,
LogicField {
Expand Down
10 changes: 10 additions & 0 deletions ic10emu_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ impl DeviceRef {
self.device.borrow().name_hash
}

#[wasm_bindgen(getter, js_name = "prefabName")]
pub fn prefab_name(&self) -> Option<String> {
self.device.borrow().prefab_name.clone()
}

#[wasm_bindgen(getter, js_name = "prefabHash")]
pub fn prefab_hash(&self) -> Option<i32> {
self.device.borrow().prefab_hash
}

#[wasm_bindgen(getter, skip_typescript)]
pub fn fields(&self) -> JsValue {
serde_wasm_bindgen::to_value(&self.device.borrow().fields).unwrap()
Expand Down
14 changes: 7 additions & 7 deletions ic10emu_wasm/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ type Defines = Map<string, number>;
type Pins = (number | undefined)[]

export interface DeviceRef {
readonly fields: Fields | undefined;
readonly slots: Slot[] | undefined;
readonly reagents: Reagents | undefined;
readonly connections: Connection[] | undefined;
readonly aliases: Aliases | undefined;
readonly defines: Defines | undefined;
readonly pins: Pins;
readonly fields: Fields;
readonly slots: Slot[];
readonly reagents: Reagents;
readonly connections: Connection[];
readonly aliases?: Aliases | undefined;
readonly defines?: Defines | undefined;
readonly pins?: Pins;
}
121 changes: 1 addition & 120 deletions www/cspell.json
Original file line number Diff line number Diff line change
@@ -1,120 +1 @@
{
"words": [
"Astroloy",
"Autolathe",
"bapal",
"bapz",
"bapzal",
"batchmode",
"batchmodes",
"bdns",
"bdnsal",
"bdse",
"bdseal",
"beqal",
"beqz",
"beqzal",
"bgeal",
"bgez",
"bgezal",
"bgtal",
"bgtz",
"bgtzal",
"bleal",
"blez",
"blezal",
"bltal",
"bltz",
"bltzal",
"bnaal",
"bnan",
"bnaz",
"bnazal",
"bneal",
"bnez",
"bnezal",
"brap",
"brapz",
"brdns",
"brdse",
"breq",
"breqz",
"brge",
"brgez",
"brgt",
"brgtz",
"brle",
"brlez",
"brlt",
"brltz",
"brna",
"brnan",
"brnaz",
"brne",
"brnez",
"Circuitboard",
"codegen",
"Depressurising",
"endpos",
"getd",
"Hardsuit",
"hardwrap",
"hashables",
"infile",
"jetpack",
"Keybind",
"lbns",
"logicable",
"logicslottypes",
"logictype",
"logictypes",
"lparen",
"Mineables",
"modelist",
"ninf",
"noconflict",
"offcanvas",
"overcolumn",
"Overlength",
"pedia",
"pinf",
"popperjs",
"preproc",
"Pressurising",
"putd",
"QUICKFIX",
"reagentmode",
"reagentmodes",
"rocketstation",
"rparen",
"sapz",
"sattellite",
"sdns",
"sdse",
"seqz",
"serde",
"sgez",
"sgtz",
"slez",
"slotlogic",
"slotlogicable",
"slotlogictype",
"slotlogictypes",
"slottype",
"sltz",
"snan",
"snanz",
"snaz",
"snez",
"splitn",
"Stationeers",
"stationpedia",
"themelist",
"tokentype",
"trunc",
"whos"
],
"version": "0.2",
"language": "en",
"flagWords": []
}
{"flagWords":[],"words":["Astroloy","Autolathe","bapal","bapz","bapzal","batchmode","batchmodes","bdns","bdnsal","bdse","bdseal","beqal","beqz","beqzal","bgeal","bgez","bgezal","bgtal","bgtz","bgtzal","bleal","blez","blezal","bltal","bltz","bltzal","bnaal","bnan","bnaz","bnazal","bneal","bnez","bnezal","brap","brapz","brdns","brdse","breq","breqz","brge","brgez","brgt","brgtz","brle","brlez","brlt","brltz","brna","brnan","brnaz","brne","brnez","Circuitboard","codegen","Depressurising","endpos","getd","Hardsuit","hardwrap","hashables","hstack","infile","jetpack","Keybind","lbns","logicable","logicslottypes","logictype","logictypes","lparen","Mineables","modelist","ninf","noconflict","offcanvas","overcolumn","Overlength","pedia","pinf","popperjs","preproc","Pressurising","putd","QUICKFIX","reagentmode","reagentmodes","rocketstation","rparen","sapz","sattellite","sdns","sdse","seqz","serde","sgez","sgtz","slez","slotlogic","slotlogicable","slotlogictype","slotlogictypes","slottype","sltz","snan","snanz","snaz","snez","splitn","Stationeers","stationpedia","themelist","tokentype","trunc","whos","regen"],"language":"en","version":"0.2"}
36 changes: 29 additions & 7 deletions www/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ <h6>Editor Cursor Style</h6>
<button id="vmControlReset" type="button" class="btn btn-warning">Reset</button>
</div>
</div>
<div id="vmActiveICState" class="mt-2 col-2 col-sm-4 col-md-10">
<div id="vmActiveICState" class="mt-2 col-9 g-4">

<div class="hstack g-0">
<div>Instruction Pointer</div>
Expand All @@ -218,12 +218,34 @@ <h6>Editor Cursor Style</h6>

</div>
</div>
<div class="row mt-2 p2">
<button type="button" class="btn btn-outline-secondary">View Devices <span
id="vmViewDeviceCount"></span></button>

<div class="row mt-1 ms-1 me-1">
<button type="button" class="btn btn-sm btn-outline-secondary" data-bs-toggle="offcanvas"
data-bs-target="#vmDevices" aria-expanded="false"
aria-controls="vmDevices">View All Devices <span id="vmViewDeviceCount"></span></button>
</div>
<div class="row p2">
<div class="collapse mt-1" id=vmDeviceSummaryCollapse>
</div>
</div>
<div class="row mt-2">
<div class="accordion" id="vmActiveIC">
<div class="accordion vm_accordion" id="vmActiveIC">
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
data-bs-target="#collapseDeviceSummary" aria-expanded="false"
aria-controls="collapseDeviceSummary">
Device Summary
</button>
</h2>
<div id="collapseDeviceSummary" class="accordion-collapse collapse">
<div class="accordion-body">
<div id="vmDeviceSummary" class="card card-body vm_device_summary">

</div>
</div>
</div>
</div>
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse"
Expand Down Expand Up @@ -268,7 +290,7 @@ <h2 class="accordion-header">
</script>


<div class="offcanvas offcanvas-start" tabindex="-1" id="vmDevices" aria-labelledby="vmDevicesLabel"
<div class="offcanvas offcanvas-bottom" tabindex="-1" id="vmDevices" aria-labelledby="vmDevicesLabel"
data-bs-scroll="true" data-bs-backdrop="false">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="vmDevicesLabel">Devices</h5>
Expand All @@ -280,4 +302,4 @@ <h5 class="offcanvas-title" id="vmDevicesLabel">Devices</h5>
</div>
</body>

</html>
</html>
Loading

0 comments on commit a626430

Please sign in to comment.