From e5b3b82fff5277208322b0f44a62987705b5e306 Mon Sep 17 00:00:00 2001
From: staubibr <staubin.bruno@gmail.com>
Date: Fri, 18 Jun 2021 16:29:39 -0400
Subject: [PATCH] Working on linker and new spec integration.

---
 application.css | 17 ++++++++++-------
 application.js  | 33 ++++++++-------------------------
 index.html      |  3 +--
 3 files changed, 19 insertions(+), 34 deletions(-)

diff --git a/application.css b/application.css
index 6c09597..8effd38 100644
--- a/application.css
+++ b/application.css
@@ -101,11 +101,19 @@ body.Simple button:disabled {
     border-color: #7e7e7e;
 }
 
-body.Simple button:not(:disabled):hover {
-  background: #0051A3;
+body.Simple :not(.popup) button:not(:disabled):hover {
+  background: #0a54a2;
   transition: all .2s ease;
 }
 
+body.Simple button.clear:not(:disabled):hover {
+  background: #980000;
+}
+
+body.Simple .popup button.close:hover {
+   background:none;	
+}
+
 body.Simple select, 
 body.Simple input[type=text], 
 body.Simple input[type=number] {
@@ -180,11 +188,6 @@ body.Simple input[type=number] {
     width: 29%;
 }
 
-.body .clear:hover {
-	background:#980000;
-}
-
-
 .body .parse {
     width: 69%;
 	margin-top : 10px;
diff --git a/application.js b/application.js
index 71b71c9..7bedd70 100644
--- a/application.js
+++ b/application.js
@@ -18,8 +18,6 @@ import Zip from '../api-web-devs/tools/zip.js';
 
 export default Core.Templatable("Application", class Application extends Templated { 
 
-	get Settings() { return this.Widget("settings").Settings; }
-
 	constructor(node) {		
 		super(node);
 		
@@ -28,8 +26,6 @@ export default Core.Templatable("Application", class Application extends Templat
 		this.simulation = null;
 		this.files = null;
 		
-		this.popup = new Popup();
-		
 		this.AddWidget("rise", new Rise());
 		this.AddWidget("settings", new Settings());
 		
@@ -45,11 +41,10 @@ export default Core.Templatable("Application", class Application extends Templat
 		this.Widget("rise").On("error", this.OnWidget_Error.bind(this));
 	}
 	
-	OnUpload_Ready(ev) {							
+	OnUpload_Ready(ev) {
 		this.simulation = ev.simulation;
 		this.files = ev.files;
-		
-		this.Configure(ev.configuration, ev.style);
+		this.settings = ev.configuration;
 		
 		this.Elem("btnViz").disabled = false;
 		this.Elem("btnSettings").disabled = false;
@@ -60,7 +55,7 @@ export default Core.Templatable("Application", class Application extends Templat
 		this.ShowDropzone(false);
 		this.ShowView(this.Elem("view"));
 		
-		this.Widget("playback").Recorder = new Recorder(this.view.Widget.Canvas);
+		this.Widget("playback").recorder = new Recorder(this.view.widget.canvas);
 		this.Widget("playback").Initialize(this.simulation, this.settings.playback);
 		this.Widget('settings').Initialize(this.simulation, this.settings);	
 	}
@@ -82,15 +77,11 @@ export default Core.Templatable("Application", class Application extends Templat
 		this.Widget("settings").Show();
 	}
 	
-	OnButtonDownload_Click(ev) {
-		var structure = this.files.find(f => f.name == "structure.json");
-		var messages = this.files.find(f => f.name == "messages.log");
-		var diagram = this.files.find(f => f.name == "diagram.svg");
+	OnButtonDownload_Click(ev) {		
+		var files = [this.files.structure, this.files.messages, this.settings.ToFile()];
 		
-		var files = [structure, messages, this.settings.ToFile()];
+		if (this.files.diagram) files.push(this.files.diagram);
 		
-		if (diagram) files.push(diagram);
-				
 		Zip.SaveZipStream(this.simulation.name, files);
 	}
 		
@@ -105,14 +96,6 @@ export default Core.Templatable("Application", class Application extends Templat
 		alert (ev.error);
 	}
 	
-	Configure(config, style) {
-		if (config) this.settings = Configuration.FromJson(config);
-		
-		else this.settings = Configuration.FromSimulation(this.simulation);
-		
-		if (this.simulation.Type == "Cell-DEVS" && style) this.settings.grid.styles = style;
-	}
-	
 	ShowDropzone(visible) {
 		Dom.ToggleCss(this.Elem("dropzone"), "hidden", !visible);
 		Dom.ToggleCss(this.Elem("views"), "hidden", visible);
@@ -121,10 +104,10 @@ export default Core.Templatable("Application", class Application extends Templat
 	ShowView(container) {
 		this.Clear();
 		
-		if (this.simulation.Type == "DEVS") {			
+		if (this.simulation.type == "DEVS") {			
 			this.view = new DiagramAuto(container, this.simulation, this.settings.diagram);
 		}
-		else if (this.simulation.Type === "Cell-DEVS") {
+		else if (this.simulation.type === "Cell-DEVS") {
 			this.view = new GridAuto(container, this.simulation, this.settings.grid);
 		}
 		
diff --git a/index.html b/index.html
index 027f697..f98c36b 100644
--- a/index.html
+++ b/index.html
@@ -23,12 +23,11 @@
 		<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
 		<link rel="stylesheet" href="../api-web-devs/api-web-devs.css">
 		<link rel="stylesheet" href="application.css">
-
+        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
 		<script src="../api-web-devs/references//zip/zip.js"></script>
 		<script src="../api-web-devs/references/StreamSaver/StreamSaver.js"></script>
 		<script src="../api-web-devs/references/StreamSaver/zip-stream.js"></script>
 		<script src="../api-web-devs/references/iro/iro@5.js"></script>
-		<script src="../api-web-devs/polyfill/promise.min.js"></script>
 		<script src='main.js' type='module'></script>
 		
 		<!-- Hotjar Tracking Code for https://staubibr.github.io/web-devs-simple-viewer/ -->