Skip to content
Merged
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
File renamed without changes
File renamed without changes
73 changes: 73 additions & 0 deletions assets/layout/landing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<header>
<nav>
<a href="https://github.com/Perryvw/TypescriptToLua/wiki">
<div class="nav-item">
Docs
</div>
</a>
<a href="https://github.com/Perryvw/TypescriptToLua">
<div class="nav-item">
Code
</div>
</a>
<a href="play.html">
<div class="nav-item">
Playground
</div>
</a>
</nav>
<div id="title"><span class="title-bold">Type</span>ScriptTo<span class="title-bold">Lua</span></div>
<div id="headline">Write Lua in TypeScript</div>
</header>
<main>
<div id="example">
<div id="ts">
<div class="example-item" id="ts-declarations"><b>// TS Declarations</b>

type Vector = [number, number, number];

declare class Unit {
getLevel(): number;
isEnemy(other: Unit): boolean;
kill(): void;
FindUnitsInRadius(radius: number): Unit[];
}</div>
<div class="example-item" id="ts-source"><b>// TS Source</b>

function onSpellStart(caster: Unit, targetLocation: Vector): void {
const units = caster.FindUnitsInRadius(event.targetLocation, 500);
const enemies = units.filter(unit => event.caster.isEnemy(unit));

for (const enemy of enemies) {
enemy.kill();
}
}</div>
</div>
<div class="example-item" id="lua"><b>-- Lua Output</b>

function onSpellStart(caster, targetLocation)
local units = FindUnitsInRadius(targetLocation, 500);
local enemies = __TS__ArrayFilter(units, function(unit) return caster:isEnemy(unit) end);
for _, enemy in ipairs(enemies) do
do
enemy:kill();
end
end
end</div>
</div>
<div id="features">
<div class="feature-item">
<div class="feature-header">Extend existing APIs</div>
This project is useful in any environment where Lua code is accepted,
with the powerful option of simply declaring any existing API using TypeScript declaration files.
</div>
<div class="feature-item">
<div class="feature-header">Type Safety</div>
Large projects written in lua can become hard to maintain and make it easy to make mistakes.
</div>
<div class="feature-item">
<div class="feature-header">IDE Support</div>
Types enable JavaScript developers to use highly-productive development tools and practices like static checking and code refactoring when developing JavaScript applications.
</div>
</div>
</main>
21 changes: 21 additions & 0 deletions assets/layout/play.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div id="header">
<div id="logo">
<span class="logo-bold">Type</span>ScriptTo<span class="logo-bold">Lua</span> Playground
</div>
</div>
<div id="content">
<div id="editor-container">
<div id="editor-ts" class="editor">
</div>
<div id="editor-lua" class="editor">
</div>
<div id="editor-output" class="editor">
<div id="editor-output-linenumbers">
>_
</div>
<div id="editor-output-content">

</div>
</div>
</div>
</div>
19 changes: 19 additions & 0 deletions assets/layout/template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="apple-touch-icon" sizes="180x180" href="<%= require('../images/favicons/apple-touch-icon.png') %>">
<link rel="icon" type="image/png" sizes="32x32" href="<%= require('../images/favicons/favicon-32x32.png') %>">
<link rel="icon" type="image/png" sizes="16x16" href="<%= require('../images/favicons/favicon-16x16.png') %>">
<link rel="manifest" href="<%= require('../images/favicons/site.webmanifest') %>">
<link rel="mask-icon" href="<%= require('../images/favicons/safari-pinned-tab.svg') %>" color="#418fd6">
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#ffffff">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<%= require('html-loader!./' + htmlWebpackPlugin.options.contentFile ) %>
</body>
</html>
15 changes: 15 additions & 0 deletions assets/styles/_base.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@import 'fonts';
@import 'colors';

html, body {
width: 100%; height: 100%;
padding: 0px;
margin: 0px;
font-family: "Open Sans";
background-color: $body-background;
color: $body-font-color;
}

div {
box-sizing: border-box;
}
6 changes: 6 additions & 0 deletions assets/styles/_colors.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$lua-purple: rgb(30, 40, 111);
$ts-blue: rgb(67, 119, 194);
$body-background: #1e1e1e;
$grey-accent: #333333;
$body-font-color: #ededed;
$card-color: #1d2021;
3 changes: 3 additions & 0 deletions assets/styles/_fonts.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import url('https://fonts.googleapis.com/css?family=Open+Sans:300,400,700|Raleway:300,400,700');

$console-fonts: "Lucida Console", Monaco, monospace;
98 changes: 98 additions & 0 deletions assets/styles/landing.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@import 'base';

main, header {
width: 900px;
overflow: hidden;
margin-left: auto;
margin-right: auto;
}

header {
#title {
margin-top: 10px;
font-size: 72px;
width: 100%;
text-align: center;
font-weight: 300;
}

.title-bold {
font-weight: 400;
}

#headline {
font-size: 24px;
text-align: center;
}

nav {
margin-top: 10px;
text-align: center;
color: #5690fc;
width: auto;
font-size: 28px;
font-weight: 400;

a {
color: inherit;
text-decoration: none;
}

a:hover {
color: $grey-accent;
}

.nav-item {
display: inline-block;
margin-left: 20px;
}
}
}

#features {
margin-top: 10px;
margin-bottom: 20px;
display: flex;
}

.feature-item {
flex: 33%;
padding: 10px;
}

.feature-header {
font-weight: 700;
font-size: 24px;
margin-bottom: 10px;
}

.example-item {
padding: (10px !important);
white-space: pre;
font-size: 12px;
font-family: $console-fonts;
}

#example #ts {
display: flex;
border-bottom: solid 2px #5690fc;
}

#example {
margin-top: 40px;
width: 100%;

#ts-declarations, #ts-source {
display: inline-block;
overflow: hidden;
}

#ts-declarations {
flex: 39%;
}

#ts-source {
flex: 61%;
border-left: solid 2px #5690fc;
}
}
80 changes: 80 additions & 0 deletions assets/styles/play.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
$header-height: 40px;
$output-height: 120px;

@import 'base';

#header {
width: 100%;
height: $header-height;
//border-bottom-left-radius: 10%;
//border-bottom-right-radius: 60%;
//background: linear-gradient(135deg, $ts-blue, $lua-purple);
//-webkit-clip-path: polygon(100% 0, 100% 70%, 80% 90%, 50% 100%, 20% 90%, 0% 70%, 0 0);
//clip-path: polygon(100% 0, 100% 70%, 80% 90%, 50% 100%, 20% 90%, 0% 70%, 0 0);
background-color: $grey-accent;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.75);
z-index: 10;
}

#logo {
position: absolute;
top: 7px;
left: 10px;
font-weight: 300;
font-size: 20px;
}

.logo-bold {
font-weight: 400;
}

#content {
height: calc(100% - #{$header-height});
}

#editor-container {
width: 100%;
height: 100%;
display: flex;
flex-wrap: wrap;

.editor {
height: calc(100% - #{$output-height});
background-color:$body-background;
color: white;
display: inline-block;
overflow: hidden;
border-bottom: 1px $grey-accent solid;
}

#editor-ts {
flex: 50%;
}

#editor-lua {
flex: 50%;
}

#editor-output {
height: $output-height;
flex: 100%;
overflow: scroll;
font-family: $console-fonts;
display: flex;
}

#editor-output-linenumbers {
width: 40px;
height: 100%;
border-right: 1px $grey-accent solid;
padding-top: 10px;
padding-left: 10px;
padding-right: 10px;
}

#editor-output-content {
padding-top: 10px;
padding-left: 10px;
width: calc(100% - 20px);
}
}
Loading