Use html plugin + handle URLs

This commit is contained in:
Misode
2020-06-03 21:39:15 +02:00
parent 575bfb4bc7
commit 65eac13082
9 changed files with 75 additions and 25 deletions

View File

@@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Minecraft Generators</title>
<link rel="stylesheet" href="./styles/global.css">
<link rel="stylesheet" href="./styles/nodes.css">
</head>
<body>
<div class="container">
<div class="header">
<select id="model-selector" class="btn">
<option value="loot-table">Loot Table</option>
<option value="predicate">Predicate</option>
<option value="advancement">Advancement</option>
<option value="sandbox">Sandbox</option>
</select>
</div>
<div class="content">
<div class="tree" id="tree-view"></div>
<div class="source" id="source-view">
<div class="source-controls">
<button class="btn" id="source-controls-toggle"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path d="M8 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm13 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3z"></path></svg></button>
<button class="btn" id="source-controls-copy">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M5.75 1a.75.75 0 00-.75.75v3c0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75v-3a.75.75 0 00-.75-.75h-4.5zm.75 3V2.5h3V4h-3zm-2.874-.467a.75.75 0 00-.752-1.298A1.75 1.75 0 002 3.75v9.5c0 .966.784 1.75 1.75 1.75h8.5A1.75 1.75 0 0014 13.25v-9.5a1.75 1.75 0 00-.874-1.515.75.75 0 10-.752 1.298.25.25 0 01.126.217v9.5a.25.25 0 01-.25.25h-8.5a.25.25 0 01-.25-.25v-9.5a.25.25 0 01.126-.217z"></path></svg>
<span>Copy</span>
</button>
</div>
<div class="source-controls-more" id="source-controls-menu">
<button class="btn" id="source-controls-download">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.47 10.78a.75.75 0 001.06 0l3.75-3.75a.75.75 0 00-1.06-1.06L8.75 8.44V1.75a.75.75 0 00-1.5 0v6.69L4.78 5.97a.75.75 0 00-1.06 1.06l3.75 3.75zM3.75 13a.75.75 0 000 1.5h8.5a.75.75 0 000-1.5h-8.5z"></path></svg>
<span>Download</span>
<a id="source-controls-download-anchor" style="display:none;"></a>
</button>
<button class="btn" id="source-controls-share">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg>
<span>Share</span>
</button>
</div>
<textarea id="source-view-output" spellcheck="false" autocorrect="off" autocapitalize="off"></textarea>
</div>
</div>
</div>
<script src="./build/bundle.js"></script>
</body>
</html>

View File

@@ -1,108 +0,0 @@
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.container {
background-color: #ffffff;
}
.header {
display: flex;
padding: 10px;
height: 56px;
/* background: #2e2e2e; */
border-bottom: 2px #ccc solid;
color: #343a40
}
.content {
display: flex;
height: calc(100vh - 56px);
overflow-y: hidden;
}
.tree {
padding: 1rem;
overflow-y: auto;
}
.source textarea {
width: 100%;
height: calc(100vh - 56px);
padding: 1.3rem 0.4rem;
border: none;
white-space: pre;
overflow-wrap: normal;
overflow-x: auto;
tab-size: 4;
-moz-tab-size: 4;
-o-tab-size: 4;
-webkit-tab-size: 4;
outline: none;
}
.source textarea::selection {
background-color: rgba(103, 134, 221, 0.6);
}
.source-controls {
display: flex;
flex-direction: row-reverse;
position: absolute;
right: 17px;
top: 56px;
padding: 5px;
}
.source-controls .btn:not(:first-child) {
margin-right: 5px;
}
.source-controls-more {
display: flex;
visibility: hidden;
flex-direction: column;
position: absolute;
right: 17px;
top: 91px;
padding: 5px;
}
.source-controls .btn,
.source-controls-more .btn {
background: #1f2020a6;
}
.gutter.gutter-horizontal {
border-left: 2px solid #ccc;
float: left;
cursor: ew-resize;
}
.btn {
display: flex;
align-items: center;
border: none;
color: #ffffff;
fill: #ffffff;
background-color: #1f2020a6;
padding: 7px 11px;
cursor: pointer;
outline: none;
transition: background-color 0.2s;
}
.btn.check {
fill: #97fa55;
color: #97fa55;
}
.btn svg:not(:last-child) {
margin-right: 5px;
}
.btn:hover {
background-color: #5d5f5fa6;
}

View File

@@ -1,35 +0,0 @@
.node {
font-size: 18px;
font-family: Arial, Helvetica, sans-serif
}
.list-entry:not(:last-child),
.map-entry:not(:last-child),
.object-node:not(:last-child) > .object-fields {
margin-bottom: 0.3rem;
}
.list-entry,
.map-entry,
.object-fields {
padding-left: 0.7rem;
}
.list-entry {
border-left: 2px solid #0b552a;
}
.map-fields {
border-left: 2px solid #066fb4;
}
.object-fields {
border-left: 2px solid #b9b9b9;
}
.object-node > label {
user-select: none;
}
.object-node > label.collapse {
cursor: pointer;
}