Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept Model Editor web view #152

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
"title": "Display model checking panel",
"category": "TLA+"
},
{
"command": "tlaplus.model.editor.display",
"title": "Display model editor",
"category": "TLA+"
},
{
"command": "tlaplus.out.visualize",
"title": "Visualize TLC output",
Expand Down Expand Up @@ -196,6 +201,10 @@
"command": "tlaplus.model.check.run",
"when": "editorLangId == tlaplus || editorLangId == tlaplus_cfg"
},
{
"command": "tlaplus.model.editor.display",
"when": "editorLangId == tlaplus"
},
{
"command": "tlaplus.model.check.runAgain",
"when": "tlaplus.tlc.canRunAgain"
Expand Down Expand Up @@ -226,6 +235,11 @@
"command": "tlaplus.model.check.run",
"when": "resourceLangId == tlaplus || resourceLangId == tlaplus_cfg",
"group": "z_commands"
},
{
"command": "tlaplus.model.editor.display",
"when": "resourceLangId == tlaplus",
"group": "z_commands"
}
],
"editor/context": [
Expand All @@ -234,6 +248,11 @@
"when": "editorLangId == tlaplus || editorLangId == tlaplus_cfg",
"group": "z_commands"
},
{
"command": "tlaplus.model.editor.display",
"when": "editorLangId == tlaplus",
"group": "z_commands"
},
{
"command": "tlaplus.out.visualize",
"when": "resourceExtname == .out",
Expand Down
8 changes: 8 additions & 0 deletions resources/model-editor-view.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.constant_definition_input {
margin: 0 0 0 9px;
}

.constant_definition_label {
margin: 0 6px;
}

89 changes: 89 additions & 0 deletions resources/model-editor-view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!DOCTYPE html>
<!--
This is the web view for the Model Editor display; it is visually hideous and functions
only as a proof of concept. Please read the comments in the associated TypeScript and
JavaScript files.
-->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self' ${cspSource}; style-src 'self' 'unsafe-inline' ${cspSource}; img-src 'self' ${cspSource};">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="${resourcesPath}/check-result-view.css">
<link rel="stylesheet" type="text/css" href="${resourcesPath}/model-editor-view.css">
<style>
.vscode-dark .var-button-copy {
background-image: url('${resourcesPath}/images/copy-dark.svg');
}
.vscode-light .var-button-copy {
background-image: url('${resourcesPath}/images/copy-light.svg');
}
.vscode-high-contrast .var-button-copy {
background-image: url('${resourcesPath}/images/copy-hc.svg');
}
.vscode-dark .var-button-display {
background-image: url('${resourcesPath}/images/display-val-dark.svg');
}
.vscode-light .var-button-display {
background-image: url('${resourcesPath}/images/display-val-light.svg');
}
.vscode-high-contrast .var-button-display {
background-image: url('${resourcesPath}/images/display-val-hc.svg');
}
</style>
<title>Model Editor</title>
</head>
<body>
<section>
<div class="header">
<h1>Choose spec:</h1>
</div>
<p>
<select id="editor-chooser">
</select>
</section>
<section>
<div class="header">
<h1>What is the behavior spec?</h1>
</div>
<p>
<select id="behavior-spec">
<option value="init-next">Initial predicate and next-state</option>
<option value="temporal">Temporal formula</option>
<option value="none">No behavior spec</option>
</select>

<div id="init-next-div">
Init: <textarea rows="4" cols="50" id="init-declaration"></textarea>
<br/>
Next: <textarea rows="4" cols="50" id="next-declaration"></textarea>
</div>

<div id="temporal-div" style="display: none;">
<textarea rows="5" cols="50" id="temporal-declaration"></textarea>
</div>
</section>
<section>
<div class="header">
<h1>What is the model?</h1>
</div>
<p>
<div id="model-constants-div">
<!--
population determined by the model and populated on view request (and, later, on spec save)
constant name: _value_textfield_ ( ) ordinary assignment ( ) model value ( ) set of model values [ ] symmetry set [ ] Type [A |v]
-->
</div>
</p>
</section>
<section>
<div id="action-start-model-check" class="action hidden">
<a href="#" title="Start the model check">Start Model Check</a>
</div>
<div id="action-stop-model-check" class="action hidden">
<a href="#" title="Stop the model check">Stop Model Checking</a>
</div>
</section>
</body>
</html>
<script src="${resourcesPath}/model-editor-view.js" />
Loading