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

Move logic from Polymer elements to plain JS files #320

Merged
merged 14 commits into from
Jan 9, 2017
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ bower_components/
node_modules/
/.idea
/build
/dist
npm-debug.log
/spec/*.js
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/bower_components
*.tgz
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## dev

## 0.7.0 (unreleased)

Breaking changes

* Polymer elements no longer automatically include the neccesary JS files.
Instead users must include `dist/the-graph.js`, which bundles the needed JavaScript and provides API under `window.TheGraph`.
The file is included in `the-graph` NPM packages.
This is preparation for removing the Polymer dependency, instead providing JS APIs and React components.

## 0.6.0 (2017 January 5)

* Add all dependencies besides Polymer to NPM.
Expand Down
16 changes: 8 additions & 8 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"* Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>; Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n";

var sources = {
scripts: ['Gruntfile.js', 'the-*/*.js', 'the-*/*.html'],
scripts: ['Gruntfile.js', 'the-*/*.js', 'the-*/*.html', 'index.js'],
// elements: ['the-*/*.html'],
stylus: ['themes/*/*.styl'],
css: ['themes/*.css'],
Expand Down Expand Up @@ -51,20 +51,20 @@
browserify: {
libs: {
files: {
'build/the-graph.js': ['index.js'],
'dist/the-graph.js': ['index.js'],
},
options: {
transform: ['coffeeify']
},
browserifyOptions: {
require: 'noflo'
transform: ['coffeeify'],
browserifyOptions: {
standalone: 'TheGraph'
}
}
}
},
jshint: {
options: {
extract: 'auto',
strict: true,
strict: false,
newcap: false,
"globals": { "Polymer": true }
},
Expand All @@ -88,7 +88,7 @@
watch: {
scripts: {
files: sources.scripts,
tasks: ['jshint:force'],
tasks: ['jshint:force', 'browserify:libs'],
options: {
livereload: true
}
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-full.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script src="../bower_components/react.animate-djdeath/react.animate.js"></script>

<!-- Browserify Libraries -->
<script src="../build/the-graph.js"></script>
<script src="../dist/the-graph.js"></script>

<!-- Custom elements -->
<link rel="import" href="../bower_components/polymer/polymer.html">
Expand Down
2 changes: 1 addition & 1 deletion examples/demo-simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script src="../bower_components/react.animate-djdeath/react.animate.js"></script>

<!-- Browserify Libraries -->
<script src="../build/the-graph.js"></script>
<script src="../dist/the-graph.js"></script>

<!-- Custom elements -->
<link rel="import" href="../bower_components/polymer/polymer.html">
Expand Down
6 changes: 4 additions & 2 deletions examples/demo-thumbnail.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<title>the-graph-thumb documentation</title>
<meta charset="utf-8">

<!-- Polymer deps -->
<!-- Deps -->
<script src="../node_modules/webcomponents.js/webcomponents.js"></script>
<script src="../build/the-graph.js"></script>
<script src="../node_modules/react/dist/react.js"></script>
<script src="../node_modules/react-dom/dist/react-dom.js"></script>
<script src="../dist/the-graph.js"></script>

<link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../the-graph-thumb/the-graph-thumb.html">
Expand Down
26 changes: 26 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,28 @@
// Build required libs
fbpGraph = require('fbp-graph');

var g = { TheGraph: {} };

require("./the-graph/the-graph.js").register(g);
require("./the-graph/the-graph-app.js").register(g);
require("./the-graph/the-graph-graph.js").register(g);
require("./the-graph/the-graph-node.js").register(g);
require("./the-graph/the-graph-node-menu.js").register(g);
require("./the-graph/the-graph-node-menu-port.js").register(g);
require("./the-graph/the-graph-node-menu-ports.js").register(g);
require("./the-graph/the-graph-port.js").register(g);
require("./the-graph/the-graph-edge.js").register(g);
require("./the-graph/the-graph-iip.js").register(g);
require("./the-graph/the-graph-group.js").register(g);
require("./the-graph/the-graph-tooltip.js").register(g);
require("./the-graph/the-graph-menu.js").register(g);
require("./the-graph/the-graph-clipboard.js").register(g);
require("./the-graph/font-awesome-unicode-map.js").register(g);

g.TheGraph.thumb = require('./the-graph-thumb/the-graph-thumb.js');
g.TheGraph.nav = require('./the-graph-nav/the-graph-nav.js');
g.TheGraph.autolayout = require('./the-graph/the-graph-autolayout.js');
g.TheGraph.library = require('./the-graph/the-graph-library.js');
g.TheGraph.editor = require('./the-graph-editor/the-graph-editor.js');

module.exports = g.TheGraph;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "flow-based programming graph editing",
"author": "Forrest Oliphant, the Grid",
"license": "MIT",
"main": "the-graph-editor/index.html",
"main": "index.js",
"dependencies": {
"fbp-graph": "^0.1.0",
"font-awesome": "^4.6.3",
Expand Down
8 changes: 4 additions & 4 deletions scripts/build-font-awesome-javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ var generateFile = function (err, data) {
});

var output = "/*\n this file is generated via `grunt build` \n*/\n\n"+
"(function (context) {\n"+
"\"use strict\";\n\n"+
"module.exports.register = function (context) {\n"+
"\n"+
"context.TheGraph.FONT_AWESOME = "+JSON.stringify(icons, null, 2)+";\n\n"+
"})(this);";
"};";

fs.writeFile(__dirname+'/../the-graph/font-awesome-unicode-map.js', output, function (err) {
if (err) {
Expand All @@ -39,4 +39,4 @@ var generateFile = function (err, data) {
});
};

fs.readFile( __dirname+'/../node_modules/font-awesome/less/variables.less', 'utf8', generateFile );
fs.readFile( __dirname+'/../node_modules/font-awesome/less/variables.less', 'utf8', generateFile);
2 changes: 1 addition & 1 deletion spec/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script src="../bower_components/react.animate-djdeath/react.animate.js"></script>

<!-- Browserify Libraries -->
<script src="../build/the-graph.js"></script>
<script src="../dist/the-graph.js"></script>

<!-- Custom elements -->
<link rel="import" href="../bower_components/polymer/polymer.html">
Expand Down
Loading