Skip to content

Commit

Permalink
Extract Core/StandardLibrary.ts to separate module Std
Browse files Browse the repository at this point in the history
Symbol module is replaced by std which will hold the standard dictionary for Sanara.
  • Loading branch information
alshakh committed May 12, 2015
1 parent b054093 commit c992db4
Show file tree
Hide file tree
Showing 16 changed files with 50 additions and 78 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@


all: coreLib
all: coreLib stdLib

#symbolLib editorLib testsLib
#editorLib testsLib


coreLib:
(cd components/Core; make all)

symbolLib:
(cd components/Symbol; make all)
stdLib:
(cd components/Std; make all)

editorLib:
(cd components/Editor; make all)
Expand Down
2 changes: 1 addition & 1 deletion components/Core/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OutputName=coreLib
SourceFiles=src/Core.ts src/Fragment.ts src/Paper.ts src/Value.ts src/StandardLibrary.ts src/Dictionary.ts
SourceFiles=src/Core.ts src/Fragment.ts src/Paper.ts src/Value.ts src/Dictionary.ts
BaseDir=../..
OutputDir=$(BaseDir)/js
Out=$(OutputDir)/$(OutputName).js
Expand Down
1 change: 0 additions & 1 deletion components/Core/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/// <reference path="src/Fragment.ts" />
/// <reference path="src/Paper.ts" />
/// <reference path="src/Value.ts" />
/// <reference path="src/StandardLibrary.ts"/>
/// <reference path="src/Dictionary.ts"/>
4 changes: 2 additions & 2 deletions components/Symbol/Makefile → components/Std/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OutputName=symbolLib
SourceFiles=src/Rect.ts
OutputName=stdLib
SourceFiles=src/justAnExample.ts

BaseDir=../..
OutputDir=$(BaseDir)/js
Expand Down
File renamed without changes.
13 changes: 13 additions & 0 deletions components/Std/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/// <reference path="./src/justAnExample"/>

module Sanara.Std {
export var dictionary : Sanara.Core.Dictionary = (function() {
var entries = <Sanara.Core.DictionaryEntry[]>[];
//
entries.push(Sanara.Std.Circle);
entries.push(Sanara.Std.Bitree);
entries.push(Sanara.Std.FillColor);
//
return new Sanara.Core.Dictionary(entries);
})();
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/// <reference path="Fragment.ts"/>
/// <reference path="Dictionary.ts"/>
/// <reference path="../declareFiles/coreLib.d.ts"/>


module Sanara.Std {

export class Bitree extends Sanara.Core.Fragment {
static doc:Sanara.Core.FragmentClassDoc = {
name : "bitree",
Expand Down Expand Up @@ -147,14 +145,4 @@ module Sanara.Std {
this.child.paint(context);
}
}

export var dictionary : Sanara.Core.Dictionary = (function() {
var entries = <Sanara.Core.DictionaryEntry[]>[];
//
entries.push(Sanara.Std.Circle);
entries.push(Sanara.Std.Bitree);
entries.push(Sanara.Std.FillColor);
//
return new Sanara.Core.Dictionary(entries);
})();
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"files": [
"./declareFiles/coreLib.d.ts",
"./lib.ts",
"./src/Rect.ts"
"./src/justAnExample.ts"
]
}
1 change: 0 additions & 1 deletion components/Symbol/lib.ts

This file was deleted.

16 changes: 0 additions & 16 deletions components/Symbol/src/Rect.ts

This file was deleted.

24 changes: 0 additions & 24 deletions components/declareFiles/coreLib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,3 @@ declare module Sanara.Core {
listNames(): string[];
}
}
declare module Sanara.Std {
class Bitree extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private content;
private lefty;
private righty;
constructor(children: Sanara.Core.Fragment[]);
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
class Circle extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private static CIRCLE;
constructor();
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
class FillColor extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private color;
private child;
constructor(children: Sanara.Core.Fragment[], parameters: Sanara.Core.Value[]);
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
var dictionary: Sanara.Core.Dictionary;
}
Empty file.
26 changes: 26 additions & 0 deletions components/declareFiles/stdLib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
declare module Sanara.Std {
class Bitree extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private content;
private lefty;
private righty;
constructor(children: Sanara.Core.Fragment[]);
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
class Circle extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private static CIRCLE;
constructor();
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
class FillColor extends Sanara.Core.Fragment {
static doc: Sanara.Core.FragmentClassDoc;
private color;
private child;
constructor(children: Sanara.Core.Fragment[], parameters: Sanara.Core.Value[]);
paintImplementation(context: Sanara.Core.SanaraContext): void;
}
}
declare module Sanara.Std {
var dictionary: Sanara.Core.Dictionary;
}
8 changes: 0 additions & 8 deletions components/declareFiles/symbolLib.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions components/declareFiles/testsLib.d.ts

This file was deleted.

4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<html>
<body>
<script src="js/coreLib.js"></script>
<script src="js/stdLib.js"></script>
<script>
var paper = new Sanara.Core.BasicPaper(1000,1000);
document.body.appendChild(paper.domElement);
//
var dict = Sanara.Std.dictionary;
var c = new (dict.getEntry("circle"))();
console.log((dict.getEntry("circle")).doc);
console.log(dict.listNames());
//
var c = Sanara.Std.Circle();
var btree = new Sanara.Std.Bitree([c,c,c]);
Expand Down

0 comments on commit c992db4

Please sign in to comment.