Skip to content

Commit

Permalink
allow users to zoom in and out
Browse files Browse the repository at this point in the history
  • Loading branch information
remojansen committed Nov 19, 2016
1 parent 014ddaa commit 9d2b32d
Show file tree
Hide file tree
Showing 4 changed files with 303 additions and 113 deletions.
16 changes: 8 additions & 8 deletions src/core/parser/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ function parse(fileNames: string[], options: ts.CompilerOptions): interfaces.Ent
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
// This is a top level class, get its symbol
let symbol = checker.getSymbolAtLocation((<ts.ClassDeclaration>node).name);
output.push(serializeClass(symbol));
output.push(parseClass(symbol));
} else if (node.kind === ts.SyntaxKind.ModuleDeclaration) {
// This is a namespace, visit its children
ts.forEachChild(node, visit);
}

}

// Serialize a class symbol infomration
function serializeClass(symbol: ts.Symbol) {
// Parse a class symbol imformation
function parseClass(symbol: ts.Symbol) {

let EntityDetails: interfaces.EntityDetails = {
kind: "class",
methods: [],
name: symbol.getName(),
props: [],
relationships: []
relationships: [] // TODO
};

EntityDetails.props = serializeProperties(symbol);
EntityDetails.methods = serializeMethods(symbol);
EntityDetails.props = parseProperties(symbol);
EntityDetails.methods = parseMethods(symbol);
return EntityDetails;

}

function serializeProperties(symbol: ts.Symbol): interfaces.PropDetails[] {
function parseProperties(symbol: ts.Symbol): interfaces.PropDetails[] {

let props: interfaces.PropDetails[] = [];

Expand All @@ -72,7 +72,7 @@ function parse(fileNames: string[], options: ts.CompilerOptions): interfaces.Ent

}

function serializeMethods(symbol: ts.Symbol): interfaces.MethodDetails[] {
function parseMethods(symbol: ts.Symbol): interfaces.MethodDetails[] {

let methods: interfaces.MethodDetails[] = [];

Expand Down
5 changes: 4 additions & 1 deletion src/core/serializer/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function serialize(entities: interfaces.EntityDetails[]) {
default:
throw new Error("Entity Kind Not Supported!");
}
}).reduce((a, b) => `${a}${b}`, "").split("<").join("-").split(">").join("-");
}).reduce((a, b) => `${a}${b}`, "")
.split("=>").join("⇒")
.split("<").join("◅")
.split(">").join("▻");

// Add relationships
let extensionDsl = entities.map(serializeInheritanceRelationships).reduce((a, b) => `${a}${b}`, "");
Expand Down
107 changes: 3 additions & 104 deletions src/provider.ts
Original file line number Diff line number Diff line change
@@ -1,79 +1,5 @@
import * as vscode from "vscode";

const logo = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAM0AAABjCAYAAAA4qo" +
"T3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lm" +
"lua3NjYXBlLm9yZ5vuPBoAABCHSURBVHic7Z17vB1FfcC/N7kMbxJDhFSeeRhABN0KnhI9IFgRkQ/qSr" +
"WVE6hVW7ooFShFWyBXMGJ90iIr+ACFA1UoW6sfDC8N5PDIIS2LpkQEkiiPAIGQAAlJBm5u/5jZnM3Jnn" +
"N2dvfc3Jwz33/m7O7Mb+bez/52fjPzm98MjIyMYLFYtsb1w1OAMvAacEngOS8BDG7TVlksY5vjgc/o3/" +
"OBWwDGbbPmWCxjn2tivydHP2xPY8mE64fTAR+4KvCcYBTqmwy8JfCcBd2uK8YDwEZgR5SJBlilsWTnCJ" +
"T5cqzrh9MCz3mqy/XdCrzD9cNq4DmzTQq6fjgInAYcAOwK3AuEwBM6yw6B52xsLhd4zrDrhyuAqcCfRP" +
"eteWbJyu063QE4ZBTqi770HzIp5PrhccBDwA+Bi4BzgQBYDizW6U9cP9yphQip0wnRDas0lqysAZbq3+" +
"8dhfq+qdPdXT/cL00B1w/HA1cAh+pbz6LavBjYBLwF2B+liJOTZKBMNFAmGmCVxpKRwHNGgEf15amuH+" +
"6RV6brh7NcPzzf9cPDEx5HdY0AwylFfgQ4WP++BpgReM6MwHMOB44Cluhnq4EXWshYo9M3RjfsmMaSh3" +
"uADwBTAs95ObqpTZ1LgVOAm4FzAs/Z1E6Q64dnoHqFccClrh9eGHjO3FiWV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" +
"uBRwyK/O9o+cltz2TZvmt61kmcL+co24rjMQss0W2WCyHGUpwDE3Pr37rWih7CWGmq5fqtwOoMda2rlu" +
"tXZSjXFv1lPIyxEfnxCcyPHuk2V5DOaVQKIW7odmN6gayBIn6cocw1GevqiBBiDeok4ke7VUcKlgBvFk" +
"KYRPLvOvqjksZULNI7uqfJqjSm+2yG6XLQDCHEBiHEQcBlFO+90I5NwMVCiEPH8FTt11Pk+VrXW9EjZF" +
"Ua00ict+uwt11HCHE2cBCwsMtVjQD3ADOEEHl9vbqKECKg/Vk264UQfX+ERlqyKs0xhvlHdZFPCPGYEO" +
"Io1EltN6Ki3RfFalRwvilCiPJ2tLNxfsZnliayHFT7F6SPMAPwsN7MNuoIIR4DPg6go+X/NXAcyhNgD9" +
"qv+I+gvs7PozbiLQD8NOdW5uAM0ntcmE4N/x3w0RbPbjaQcwfZQ3zdaZD354yNwIRbnZE0MDJiZv5Xaq" +
"WFmHn8vr9arttgc5aewUhpKrXSZNTUblqzbmW1XM8T/cViGXOYjmluMixjZ2QsPUfqnqZSKznAgway11" +
"XL9b6PMG/pPUx6DdMtz1mP7LBYxjSplKZSKy1CrbinRVKca7bFMqZoO+WsT2SeR+d4v81cXS3XrbespS" +
"dJVBq9FvM5VGR5073xG3RZi6UnGazUSs/r3+OBnVELl1mCSETMzbP/32IZ6wwCkwuUt6parndjz4zFMm" +
"Yo8gzJEeCkAuVZLGOSIpXmR9VyvduexRbLNqcopflNtVz/m4JkWSxjmiKU5lHgiALkWCzbBcZbA2KMAF" +
"dUy3U7vWzpK7IozQgqEv4Z1XK9XnB7LJYxTxql2QS8hIq0shC4oFquv9DVVlksY5j/B9iXTnoP4f09AA" +
"AAAElFTkSuQmCC";
import { getContent } from "./provider_content";

class TsUMLProvider implements vscode.TextDocumentContentProvider {

Expand All @@ -82,35 +8,8 @@ class TsUMLProvider implements vscode.TextDocumentContentProvider {

public provideTextDocumentContent(uri: vscode.Uri): string {
let file = uri.query.split("file=")[1];
return `<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color: #273746 !important;
padding: 5%;
}
.powered {
position: fixed;
bottom: 15px;
right: 25px;
color: #ffffff;
text-align: center;
}
.powered img {
width: 90px;
margin-top: -10px;
}
</style>
</head>
<body>
<img src="http://yuml.me/${file}"></div>
<div class="powered">
<p>Powered by</p>
<img src="${logo}"></img>
</div>
</body>
</html>`;
let url = `http://yuml.me/${file}`;
return getContent(url);
}

get onDidChange(): vscode.Event<vscode.Uri> {
Expand Down
Loading

0 comments on commit 9d2b32d

Please sign in to comment.