Replaced ant build script with jake build script. Files moved around. Created package.json and component.json

This commit is contained in:
josdejong 2013-05-03 22:55:15 +02:00
parent a03ea9a2d0
commit b287c4bfbc
42 changed files with 7139 additions and 265 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.idea
build
downloads
node_modules

13
.npmignore Normal file
View File

@ -0,0 +1,13 @@
app
build
downloads
jsoneditor
misc
node_modules
test
tools
.idea
component.json
Jakefile.js
.npmignore
.gitignore

View File

@ -1,4 +1,4 @@
# JSON Editor Online - Changelog
# JSON Editor Online - History
http://jsoneditoronline.org
@ -6,6 +6,7 @@ http://jsoneditoronline.org
- Unified JSONFormatter and JSONEditor in one editor with a switchable mode.
- Urls are navigable now.
- Added jsoneditor to npm and bower.
## 2013-03-11, version 2.1.1

313
Jakefile.js Normal file
View File

@ -0,0 +1,313 @@
/**
* Jake build script
*/
var jake = require('jake'),
path = require('path'),
cleanCss = require('clean-css'),
archiver = require('archiver'),
fs = require('fs');
require('jake-utils');
// constants
var JSONEDITOR = './jsoneditor.js',
JSONEDITOR_CSS = './jsoneditor.css',
JSONEDITOR_MIN = './jsoneditor-min.js',
JSONEDITOR_CSS_MIN = './jsoneditor-min.css',
BUILD = './build';
/**
* default task
*/
desc('Execute all tasks: build, minify, and zip the library and web app');
task('default', ['clear', 'build', 'minify', 'zip', 'webapp', 'chromeapp'], function () {
console.log('Done');
});
/**
* build the library
*/
desc('Clear the build directory');
task('clear', function () {
jake.rmRf(BUILD);
});
/**
* build the library
*/
desc('Build the library');
task('build', ['clear'], function () {
// concatenate the javascript files
concat({
src: [
'./src/js/jsoneditor.js',
'./src/js/treeeditor.js',
'./src/js/texteditor.js',
'./src/js/node.js',
'./src/js/appendnode.js',
'./src/js/contextmenu.js',
'./src/js/history.js',
'./src/js/searchbox.js',
'./src/js/highlighter.js',
'./src/js/util.js',
'./src/js/module.js'
],
dest: JSONEDITOR,
header: read('./src/js/header.js') + '\n' +
'(function () {\n',
separator: '\n',
footer: '\n})();\n'
});
// update version number and stuff in the javascript files
replacePlaceholders(JSONEDITOR);
console.log('Created ' + JSONEDITOR);
// concatenate and stringify the css files
concat({
src: [
'./src/css/jsoneditor.css',
'./src/css/contextmenu.css',
'./src/css/menu.css',
'./src/css/searchbox.css'
],
dest: JSONEDITOR_CSS,
separator: '\n'
});
console.log('Created ' + JSONEDITOR_CSS);
// minify the css file
write(JSONEDITOR_CSS_MIN, cleanCss.process(String(read(JSONEDITOR_CSS))));
// create a folder img and copy the icons
jake.mkdirP('./img');
jake.cpR('./src/css/img/jsoneditor-icons.png', './img/');
console.log('Copied jsoneditor-icons.png to ./img/');
});
/**
* minify the library
*/
desc('Minify the library');
task('minify', ['build'], function () {
// minify javascript
minify({
src: JSONEDITOR,
dest: JSONEDITOR_MIN,
header: read('./src/js/header.js')
});
// update version number and stuff in the javascript files
replacePlaceholders(JSONEDITOR_MIN);
console.log('Created ' + JSONEDITOR_MIN);
});
/**
* zip the library
*/
desc('Zip the library');
task('zip', ['build', 'minify'], {async: true}, function () {
var zipfolder = BUILD + '/lib';
var pkg = 'jsoneditor-' + version();
var zipfile = zipfolder + '/' + pkg + '.zip';
jake.mkdirP(zipfolder);
var output = fs.createWriteStream(zipfile);
var archive = archiver('zip');
archive.on('error', function(err) {
throw err;
});
archive.pipe(output);
var filelist = new jake.FileList();
filelist.include([
'README.md',
'NOTICE',
'LICENSE',
'HISTORY.md',
JSONEDITOR,
JSONEDITOR_CSS,
JSONEDITOR_MIN,
JSONEDITOR_CSS_MIN,
'img/*.*',
'examples/**/*.*'
]);
var files = filelist.toArray();
files.forEach(function (file) {
archive.append(fs.createReadStream(file), {
name: pkg + '/' + file
})
});
archive.finalize(function(err, written) {
if (err) {
throw err;
}
console.log('Zipped ' + zipfile);
complete();
});
});
/**
* build the web app
*/
desc('Build web app');
task('webapp', ['build', 'minify'], function () {
var webAppSrc = './app/web/';
var webApp = BUILD + '/app/web/';
var webAppLib = webApp + 'lib/';
var webAppAce = webAppLib + 'ace/';
var webAppImg = webApp + 'img/';
var webAppDoc = webApp + 'doc/';
var appJs = webApp + 'app.js';
var appCss = webApp + 'app.css';
var appCssMin = webApp + 'app-min.css';
var appJsMin = webApp + 'app-min.js';
// create directories
// TODO: should be created automatically...
jake.mkdirP(webApp);
jake.mkdirP(webAppLib);
jake.mkdirP(webAppLib + 'ace/');
jake.mkdirP(webAppLib + 'jsoneditor/');
jake.mkdirP(webAppLib + 'jsoneditor/img/');
jake.mkdirP(webAppLib + 'jsonlint/');
jake.mkdirP(webAppImg);
jake.mkdirP(webAppDoc);
// concatenate the javascript files
concat({
src: [
webAppSrc + 'queryparams.js',
webAppSrc + 'ajax.js',
webAppSrc + 'fileretriever.js',
webAppSrc + 'notify.js',
webAppSrc + 'splitter.js',
webAppSrc + 'app.js'
],
dest: appJs,
separator: '\n'
});
// minify javascript
minify({
src: appJs,
dest: appJsMin
});
// concatenate the css files
concat({
src: [
webAppSrc + 'fileretriever.css',
webAppSrc + 'app.css'
],
dest: appCss,
separator: '\n'
});
// minify css file
write(appCssMin, cleanCss.process(String(read(appCss))));
// remove non minified javascript and css file
fs.unlinkSync(appJs);
fs.unlinkSync(appCss);
// copy files
jake.cpR('./README.md', webApp);
jake.cpR('./HISTORY.md', webApp);
jake.cpR('./NOTICE', webApp);
jake.cpR('./LICENSE', webApp);
jake.cpR('./LICENSE', webApp);
jake.cpR(webAppSrc + 'robots.txt', webApp);
jake.cpR(webAppSrc + 'datapolicy.txt', webApp);
jake.cpR(webAppSrc + 'index.html', webApp);
jake.cpR(webAppSrc + 'favicon.ico', webApp);
jake.cpR(webAppSrc + 'fileretriever.php', webApp);
jake.cpR(webAppSrc + 'googlea47c4a0b36d11021.html', webApp);
jake.cpR(webAppSrc + 'img/logo.png', webAppImg);
jake.cpR(webAppSrc + 'img/header_background.png', webAppImg);
jake.cpR(webAppSrc + 'doc/', webAppDoc);
// update date and verison in index.html
replacePlaceholders(webApp + 'index.html');
replacePlaceholders(webApp + 'index.html'); // TODO: fix bug in replace, should replace all occurrences
// concatenate and copy ace files
concat({
src: [
webAppSrc + 'lib/ace/ace.js',
webAppSrc + 'lib/ace/mode-json.js',
webAppSrc + 'lib/ace/theme-textmate.js',
webAppSrc + 'lib/ace/theme-jso.js'
],
dest: webAppAce + 'ace-min.js',
separator: '\n'
});
jake.cpR(webAppSrc + 'lib/ace/worker-json.js', webAppAce);
// copy json lint file
jake.cpR(webAppSrc + 'lib/jsonlint/jsonlint.js', webAppLib + 'jsonlint/')
// copy jsoneditor files
jake.cpR(JSONEDITOR_MIN, webAppLib + 'jsoneditor/');
jake.cpR(JSONEDITOR_CSS_MIN, webAppLib + 'jsoneditor/');
jake.cpR('img', webAppLib + 'jsoneditor/');
});
/**
* build the chrome app
*/
desc('Build chrome app');
task('chromeapp', {async: true}, function () {
var folder = BUILD + '/app/';
var file = folder + 'chrome.zip';
jake.mkdirP(folder);
var output = fs.createWriteStream(file);
var archive = archiver('zip');
archive.on('error', function(err) {
throw err;
});
// create a temporary manifest file with version number
var manifestTmp = folder + 'manifest.json.tmp';
jake.cpR('./app/chrome/manifest.json', manifestTmp);
replacePlaceholders(manifestTmp);
archive.pipe(output);
archive.append(fs.createReadStream(manifestTmp), {name: 'manifest.json'});
archive.append(fs.createReadStream('./app/web/img/icon_16.png'), {name: 'icon_16.png'});
archive.append(fs.createReadStream('./app/web/img/icon_128.png'), {name: 'icon_128.png'});
// cleanup temporary manifest file
fs.unlinkSync(manifestTmp);
archive.finalize(function(err, written) {
if (err) {
throw err;
}
console.log('Created chrome app ' + file);
complete();
});
});
/**
* replace version, date, and name placeholders in the provided file
* @param {String} filename
*/
var replacePlaceholders = function (filename) {
replace({
replacements: [
{pattern: '@@date', replacement: today()},
{pattern: '@@version', replacement: version()}
],
src: filename
});
};

View File

@ -40,13 +40,29 @@ a code editor.
- Sourcecode: https://github.com/josdejong/jsoneditoronline/
### Install
with npm:
npm install jsoneditor
with bower:
npm install bower
downloads:
http://jsoneditoronline.org/downloads/
### Build
The code of the JSON Editor is located in the folder `jsoneditor`.
The code of the JSON Editor is located in the folder `src`.
The code for the web application in `app/web`.
To build the library from sourcecode, run
ant
jake
in the root of the project. This will generate a folder `build` containing
generated library and web application.
in the root of the project. This will generate the files `jsoneditor.js`,
`jsoneditor.css`, etc., and will create a folder `build` containing the
zipped library and the built web application.

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "JSON Editor",
"version": "2.1.1",
"version": "@@version",
"description": "JSON Editor is a tool to view, edit, and format JSON. It shows your data in an editable treeview and in a code editor.",
"app": {
"urls": [

View File

@ -180,7 +180,7 @@ span.header-light {
margin: 0 0 15px 0;
}
#splitter #toEditor {
#splitter #toTree {
margin: 40px 0 0 0 ;
}

View File

@ -37,7 +37,8 @@
Copyright (C) 2011-2013 Jos de Jong, http://jsoneditoronline.org
@author Jos de Jong, <wjosdejong@gmail.com>
@date 2013-03-08
@version @@version
@date @@date
-->
<meta name="description" content="JSON Editor Online is a web-based tool to view, edit, and format JSON. It shows your data side by side in a clear, editable treeview and in a code editor.">
@ -168,9 +169,9 @@
<div id="footer">
<div id="footer-inner">
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 2.1.1</a>
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online @@version</a>
&bull;
<a href="changelog.txt" target="_blank" class="footer">Changelog</a>
<a href="HISTORY.md" target="_blank" class="footer">History</a>
&bull;
<a href="https://github.com/josdejong/jsoneditoronline" target="_blank" class="footer">Sourcecode</a>
&bull;

View File

@ -36,7 +36,8 @@
Copyright (C) 2011-2013 Jos de Jong, http://jsoneditoronline.org
@author Jos de Jong, <wjosdejong@gmail.com>
@date 2013-03-08
@version @@version
@date @@date
-->
<meta name="description" content="JSON Editor Online is a web-based tool to view, edit, and format JSON. It shows your data side by side in a clear, editable treeview and in a code editor.">
@ -47,25 +48,25 @@
<link href="app.css" rel="stylesheet" type="text/css">
<link href="fileretriever.css" rel="stylesheet" type="text/css">
<link href="../../jsoneditor/css/jsoneditor.css" rel="stylesheet" type="text/css">
<link href="../../jsoneditor/css/menu.css" rel="stylesheet" type="text/css">
<link href="../../jsoneditor/css/searchbox.css" rel="stylesheet" type="text/css">
<link href="../../jsoneditor/css/contextmenu.css" rel="stylesheet" type="text/css">
<link href="../../src/css/jsoneditor.css" rel="stylesheet" type="text/css">
<link href="../../src/css/menu.css" rel="stylesheet" type="text/css">
<link href="../../src/css/searchbox.css" rel="stylesheet" type="text/css">
<link href="../../src/css/contextmenu.css" rel="stylesheet" type="text/css">
<!-- TODO: droid font
<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
-->
<script type="text/javascript" src="../../jsoneditor/js/jsoneditor.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/treeeditor.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/texteditor.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/node.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/appendnode.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/contextmenu.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/history.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/searchbox.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/highlighter.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/util.js"></script>
<script type="text/javascript" src="../../jsoneditor/js/module.js"></script>
<script type="text/javascript" src="../../src/js/jsoneditor.js"></script>
<script type="text/javascript" src="../../src/js/treeeditor.js"></script>
<script type="text/javascript" src="../../src/js/texteditor.js"></script>
<script type="text/javascript" src="../../src/js/node.js"></script>
<script type="text/javascript" src="../../src/js/appendnode.js"></script>
<script type="text/javascript" src="../../src/js/contextmenu.js"></script>
<script type="text/javascript" src="../../src/js/history.js"></script>
<script type="text/javascript" src="../../src/js/searchbox.js"></script>
<script type="text/javascript" src="../../src/js/highlighter.js"></script>
<script type="text/javascript" src="../../src/js/util.js"></script>
<script type="text/javascript" src="../../src/js/module.js"></script>
<script type="text/javascript" src="queryparams.js"></script>
<script type="text/javascript" src="ajax.js"></script>
<script type="text/javascript" src="fileretriever.js"></script>
@ -81,10 +82,10 @@
<style type="text/css">
div.convert-right {
background: url('../../jsoneditor/css/img/jsoneditor-icons.png') -0 -48px;
background: url('../../src/css/img/jsoneditor-icons.png') -0 -48px;
}
div.convert-left {
background: url('../../jsoneditor/css/img/jsoneditor-icons.png') -24px -48px;
background: url('../../src/css/img/jsoneditor-icons.png') -24px -48px;
}
</style>
</head>
@ -203,9 +204,9 @@
<div id="footer">
<div id="footer-inner">
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online 2.1.1</a>
<a href="http://jsoneditoronline.org" class="footer">JSON Editor Online @@version</a>
&bull;
<a href="../../changelog.txt" target="_blank" class="footer">Changelog</a>
<a href="../../HISTORY.md" target="_blank" class="footer">History</a>
&bull;
<a href="https://github.com/josdejong/jsoneditoronline" target="_blank" class="footer">Sourcecode</a>
&bull;

197
build.xml
View File

@ -1,197 +0,0 @@
<!-- ant build script for jsoneditoronline -->
<project name="jsoneditor-builder" default="main">
<!-- the version number of must be updated here (according to changelog.txt) -->
<property name="version" value="2.2.0-SNAPSHOT"/>
<!-- compression tools -->
<property name="compressor" value="tools/yuicompressor-2.4.7.jar" />
<!-- directories -->
<property name="lib" location="build/lib" />
<property name="web_app" location="build/app/web" />
<property name="chrome_app" location="build/app/chrome" />
<property name="web_app_src" location="app/web" />
<property name="src" location="jsoneditor" />
<property name="js_src" location="jsoneditor/js" />
<property name="css_src" location="jsoneditor/css" />
<property name="img_src" location="jsoneditor/css/img" />
<property name="jsoneditor" location="${lib}/jsoneditor-${version}" />
<property name="jsoneditor_min" location="${lib}/jsoneditor-${version}.min" />
<target name="build_lib" description="build jsoneditor library">
<delete dir="${jsoneditor}" />
<delete dir="${jsoneditor_min}" />
<!-- copy all files for the non-minified jsoneditor -->
<copy file="README.md" todir="${jsoneditor}" />
<copy file="LICENSE" todir="${jsoneditor}" />
<copy file="NOTICE" todir="${jsoneditor}" />
<copy file="changelog.txt" todir="${jsoneditor}" />
<copy todir="${jsoneditor}/examples">
<fileset dir="${src}/examples"/>
</copy>
<copy file="${img_src}/jsoneditor-icons.png" todir="${jsoneditor}/img" />
<!-- copy all files for the minified jsoneditor -->
<copy file="README.md" todir="${jsoneditor_min}" />
<copy file="LICENSE" todir="${jsoneditor_min}" />
<copy file="NOTICE" todir="${jsoneditor_min}" />
<copy file="changelog.txt" todir="${jsoneditor_min}" />
<copy todir="${jsoneditor_min}/examples">
<fileset dir="${src}/examples"/>
</copy>
<copy file="${img_src}/jsoneditor-icons.png" todir="${jsoneditor_min}/img" />
<!-- replace the library references with the references of the minified lib -->
<replace dir="${jsoneditor_min}/examples"
token="jsoneditor.js"
value="jsoneditor-min.js">
<include name="**/*.html"/>
</replace>
<replace dir="${jsoneditor_min}/examples"
token="jsoneditor.css"
value="jsoneditor-min.css">
<include name="**/*.html"/>
</replace>
<replace file="${jsoneditor_min}/examples/requirejs_demo/scripts/main.js"
token="../../../jsoneditor"
value="../../../jsoneditor-min" />
<!-- concatenate the javascript files -->
<concat destfile="${jsoneditor}/tmp.js">
<fileset dir="${js_src}" includes="jsoneditor.js"/>
<fileset dir="${js_src}" includes="treeeditor.js"/>
<fileset dir="${js_src}" includes="texteditor.js"/>
<fileset dir="${js_src}" includes="node.js"/>
<fileset dir="${js_src}" includes="appendnode.js"/>
<fileset dir="${js_src}" includes="contextmenu.js"/>
<fileset dir="${js_src}" includes="history.js"/>
<fileset dir="${js_src}" includes="searchbox.js"/>
<fileset dir="${js_src}" includes="highlighter.js"/>
<fileset dir="${js_src}" includes="util.js"/>
</concat>
<loadfile property="tmp" srcFile="${jsoneditor}/tmp.js"/>
<delete file="${jsoneditor}/tmp.js" />
<!-- inject the concatenated javascript files in the module file -->
<copy file="${js_src}/module.js" tofile="${jsoneditor}/jsoneditor.js" />
<replace file="${jsoneditor}/jsoneditor.js"
token="/***code_placeholder***/"
value="${tmp}" />
<!-- concatenate the css files -->
<concat destfile="${jsoneditor}/jsoneditor.css">
<fileset dir="${css_src}" includes="jsoneditor.css"/>
<fileset dir="${css_src}" includes="menu.css"/>
<fileset dir="${css_src}" includes="contextmenu.css"/>
<fileset dir="${css_src}" includes="searchbox.css"/>
</concat>
<!-- minify the jsoneditor files -->
<java jar="${compressor}" dir="${jsoneditor}/" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${jsoneditor_min}/jsoneditor-min.js"/>
<arg value="jsoneditor.js"/>
</java>
<java jar="${compressor}" dir="${jsoneditor}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="${jsoneditor_min}/jsoneditor-min.css"/>
<arg value="jsoneditor.css"/>
</java>
<!-- create a zip file with non-minified jsoneditor -->
<zip destfile="${lib}/jsoneditor-${version}.zip">
<fileset dir="${lib}" includes="jsoneditor-${version}/**" />
</zip>
<!-- create a zip file with minified jsoneditor -->
<zip destfile="${lib}/jsoneditor-${version}.min.zip">
<fileset dir="${lib}" includes="jsoneditor-${version}.min/**" />
</zip>
</target>
<target name="build_web_app" depends="build_lib" description="copy all files for the web application to the build directory">
<delete dir="${web_app}" />
<mkdir dir="${web_app}" />
<!-- concatenate the javascript and css app files -->
<concat destfile="${web_app}/app.js">
<fileset dir="${web_app_src}" includes="queryparams.js"/>
<fileset dir="${web_app_src}" includes="ajax.js"/>
<fileset dir="${web_app_src}" includes="fileretriever.js"/>
<fileset dir="${web_app_src}" includes="notify.js"/>
<fileset dir="${web_app_src}" includes="splitter.js"/>
<fileset dir="${web_app_src}" includes="app.js"/>
</concat>
<concat destfile="${web_app}/app.css">
<fileset dir="${web_app_src}" includes="fileretriever.css"/>
<fileset dir="${web_app_src}" includes="app.css"/>
</concat>
<!-- copy all other files and libraries-->
<copy file="changelog.txt" todir="${web_app}" />
<copy file="README.md" todir="${web_app}" />
<copy file="LICENSE" todir="${web_app}" />
<copy file="NOTICE" todir="${web_app}" />
<copy file="${web_app_src}/robots.txt" todir="${web_app}" />
<copy file="${web_app_src}/datapolicy.txt" todir="${web_app}" />
<copy file="${web_app_src}/index.html" todir="${web_app}" />
<copy file="${web_app_src}/favicon.ico" todir="${web_app}" />
<copy file="${web_app_src}/fileretriever.php" todir="${web_app}" />
<copy file="${web_app_src}/googlea47c4a0b36d11021.html" todir="${web_app}" />
<copy file="${web_app_src}/img/logo.png" todir="${web_app}/img" />
<copy file="${web_app_src}/img/header_background.png" todir="${web_app}/img" />
<copy todir="${web_app}/doc">
<fileset dir="${web_app_src}/doc"/>
</copy>
<!-- concatenate and copy the ace files -->
<concat destfile="${web_app}/lib/ace/ace-min.js">
<fileset dir="${web_app_src}/lib/ace" includes="ace.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="mode-json.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="theme-textmate.js"/>
<fileset dir="${web_app_src}/lib/ace" includes="theme-jso.js"/>
</concat>
<copy file="${web_app_src}/lib/ace/worker-json.js" todir="${web_app}/lib/ace" />
<copy file="${web_app_src}/lib/jsonlint/jsonlint.js" todir="${web_app}/lib/jsonlint" />
<copy file="${jsoneditor_min}/jsoneditor-min.js" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/jsoneditor-min.css" todir="${web_app}/lib/jsoneditor" />
<copy file="${jsoneditor_min}/img/jsoneditor-icons.png" todir="${web_app}/lib/jsoneditor/img" />
<!-- minify the javascript files -->
<java jar="${compressor}" dir="${web_app}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="app-min.js"/>
<arg value="app.js"/>
</java>
<java jar="${compressor}" dir="${web_app}" fork="true" failonerror="true">
<arg value="-o"/>
<arg value="app-min.css"/>
<arg value="app.css"/>
</java>
<!-- delete non-minified app files -->
<delete file="${web_app}/app.js" />
<delete file="${web_app}/app.css" />
</target>
<target name="build_chrome_app" depends="build_lib" description="copy and zip all files for the chrome app">
<!-- hosted app -->
<delete dir="${chrome_app}" />
<mkdir dir="${chrome_app}" />
<copy file="app/chrome/manifest.json" todir="${chrome_app}" />
<copy file="${web_app_src}/img/icon_16.png" todir="${chrome_app}" />
<copy file="${web_app_src}/img/icon_128.png" todir="${chrome_app}" />
<zip destfile="build/app/chrome.zip">
<fileset dir="${chrome_app}" />
</zip>
<delete dir="${chrome_app}" />
</target>
<target name="main" depends="build_lib, build_web_app, build_chrome_app" />
</project>

33
component.json Normal file
View File

@ -0,0 +1,33 @@
{
"name": "jsoneditor",
"version": "2.2.0-SNAPSHOT",
"description": "A web-based tool to view, edit and format JSON",
"tags": [
"json",
"editor",
"viewer",
"formatter"
],
"homepage": "http://jsoneditoronline.org/",
"repository": {
"type": "git",
"url": "https://github.com/josdejong/jsoneditoronline.git"
},
"bugs": "https://github.com/josdejong/jsoneditoronline/issues",
"ignore": [
"app",
"build",
"downloads",
"jsoneditor",
"misc",
"node_modules",
"test",
"tools",
".idea",
"Jakefile.js",
"package.json",
".npmignore",
".gitignore"
],
"dependencies": {}
}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

1
jsoneditor-min.css vendored Normal file

File diff suppressed because one or more lines are too long

33
jsoneditor-min.js vendored Normal file

File diff suppressed because one or more lines are too long

597
jsoneditor.css Normal file
View File

@ -0,0 +1,597 @@
.jsoneditor .field,
.jsoneditor .value,
.jsoneditor .readonly {
border: 1px solid transparent;
min-height: 16px;
min-width: 32px;
padding: 2px;
margin: 1px;
word-wrap: break-word;
float: left;
}
/* adjust margin of p elements inside editable divs, needed for Opera, IE */
.jsoneditor .field p,
.jsoneditor .value p {
margin: 0;
}
.jsoneditor .value {
word-break: break-word;
}
.jsoneditor .readonly {
min-width: 16px;
color: gray;
}
.jsoneditor .empty {
border-color: lightgray;
border-style: dashed;
border-radius: 2px;
}
.jsoneditor .field.empty {
background-image: url('img/jsoneditor-icons.png');
background-position: 0 -144px;
}
.jsoneditor .value.empty {
background-image: url('img/jsoneditor-icons.png');
background-position: -48px -144px;
}
.jsoneditor .value.url {
color: green;
text-decoration: underline;
}
.jsoneditor a.value.url:hover,
.jsoneditor a.value.url:focus {
color: red;
}
.jsoneditor .separator {
padding: 3px 0;
vertical-align: top;
color: gray;
}
.jsoneditor .field[contenteditable=true]:focus,
.jsoneditor .field[contenteditable=true]:hover,
.jsoneditor .value[contenteditable=true]:focus,
.jsoneditor .value[contenteditable=true]:hover,
.jsoneditor .field.highlight,
.jsoneditor .value.highlight {
background-color: #FFFFAB;
border: 1px solid yellow;
border-radius: 2px;
}
.jsoneditor .field.highlight-active,
.jsoneditor .field.highlight-active:focus,
.jsoneditor .field.highlight-active:hover,
.jsoneditor .value.highlight-active,
.jsoneditor .value.highlight-active:focus,
.jsoneditor .value.highlight-active:hover {
background-color: #ffee00;
border: 1px solid #ffc700;
border-radius: 2px;
}
.jsoneditor button {
width: 24px;
height: 24px;
padding: 0;
margin: 0;
border: none;
cursor: pointer;
background: transparent url('img/jsoneditor-icons.png');
}
.jsoneditor button.collapsed {
background-position: 0 -48px;
}
.jsoneditor button.expanded {
background-position: 0 -72px;
}
.jsoneditor button.contextmenu {
background-position: -48px -72px;
}
.jsoneditor button.contextmenu:hover,
.jsoneditor button.contextmenu:focus,
.jsoneditor button.contextmenu.selected {
background-position: -48px -48px;
}
.jsoneditor div.content *:focus {
outline: none;
}
.jsoneditor div.content button:focus {
/* TODO: nice outline for buttons with focus
outline: #97B0F8 solid 2px;
box-shadow: 0 0 8px #97B0F8;
*/
background-color: #f5f5f5;
outline: #e5e5e5 solid 1px;
}
.jsoneditor button.invisible {
visibility: hidden;
background: none;
}
div.jsoneditor {
color: #1A1A1A;
border: 1px solid #97B0F8;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
width: 100%;
height: 100%;
overflow: auto;
position: relative;
padding: 0;
}
.jsoneditor table.content {
border-collapse: collapse;
border-spacing: 0;
width: 100%;
margin: 0;
}
.jsoneditor div.outer {
width: 100%;
height: 100%;
margin: -35px 0 0 0;
padding: 35px 0 0 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
}
.jsoneditor div.content {
width: 100%;
height: 100%;
position: relative;
overflow: auto;
}
.jsoneditor textarea.content {
width: 100%;
height: 100%;
margin: 0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
border: none;
background-color: white;
resize: none;
}
.jsoneditor tr.highlight {
background-color: #FFFFAB;
}
.jsoneditor button.dragarea {
background: url('img/jsoneditor-icons.png') -72px -72px;
cursor: move;
}
.jsoneditor button.dragarea:hover,
.jsoneditor button.dragarea:focus {
background-position: -72px -48px;
}
.jsoneditor tr,
.jsoneditor th,
.jsoneditor td {
padding: 0;
margin: 0;
}
.jsoneditor td {
vertical-align: top;
}
.jsoneditor td.tree {
vertical-align: top;
}
.jsoneditor .field,
.jsoneditor .value,
.jsoneditor td,
.jsoneditor th,
.jsoneditor textarea {
font-family: droid sans mono, monospace, courier new, courier, sans-serif;
font-size: 10pt;
color: #1A1A1A;
}
/* ContextMenu - main menu */
.jsoneditor-contextmenu {
position: absolute;
}
.jsoneditor-contextmenu ul {
position: relative;
left: 0;
top: 0;
width: 124px;
background: white;
border: 1px solid #d3d3d3;
box-shadow: 2px 2px 12px rgba(128, 128, 128, 0.3);
z-index: 1;
list-style: none;
margin: 0;
padding: 0;
}
.jsoneditor-contextmenu ul li button {
padding: 0;
margin: 0;
width: 124px;
height: 24px;
border: none;
cursor: pointer;
color: #4d4d4d;
background: transparent;
line-height: 24px;
text-align: left;
}
/* Fix button padding in firefox */
.jsoneditor-contextmenu ul li button::-moz-focus-inner {
padding: 0;
border: 0;
}
.jsoneditor-contextmenu ul li button:hover,
.jsoneditor-contextmenu ul li button:focus {
color: #1a1a1a;
background-color: #f5f5f5;
outline: none;
}
.jsoneditor-contextmenu ul li button.default {
width: 92px;
}
.jsoneditor-contextmenu ul li button.expand {
float: right;
width: 32px;
height: 24px;
border-left: 1px solid #e5e5e5;
}
.jsoneditor-contextmenu div.icon {
float: left;
width: 24px;
height: 24px;
border: none;
padding: 0;
margin: 0;
background-image: url('img/jsoneditor-icons.png');
}
.jsoneditor-contextmenu ul li button div.expand {
float: right;
width: 24px;
height: 24px;
padding: 0;
margin: 0 4px 0 0;
background: url('img/jsoneditor-icons.png') 0 -72px;
opacity: 0.4;
}
.jsoneditor-contextmenu ul li button:hover div.expand,
.jsoneditor-contextmenu ul li button:focus div.expand,
.jsoneditor-contextmenu ul li.selected div.expand,
.jsoneditor-contextmenu ul li button.expand:hover div.expand,
.jsoneditor-contextmenu ul li button.expand:focus div.expand {
opacity: 1;
}
.jsoneditor-contextmenu .separator {
height: 0;
border-top: 1px solid #e5e5e5;
padding-top: 5px;
margin-top: 5px;
}
.jsoneditor-contextmenu button.remove > .icon {
background-position: -24px -24px;
}
.jsoneditor-contextmenu button.remove:hover > .icon,
.jsoneditor-contextmenu button.remove:focus > .icon {
background-position: -24px 0;
}
.jsoneditor-contextmenu button.append > .icon {
background-position: 0 -24px;
}
.jsoneditor-contextmenu button.append:hover > .icon,
.jsoneditor-contextmenu button.append:focus > .icon {
background-position: 0 0;
}
.jsoneditor-contextmenu button.insert > .icon {
background-position: 0 -24px;
}
.jsoneditor-contextmenu button.insert:hover > .icon,
.jsoneditor-contextmenu button.insert:focus > .icon {
background-position: 0 0;
}
.jsoneditor-contextmenu button.duplicate > .icon {
background-position: -48px -24px;
}
.jsoneditor-contextmenu button.duplicate:hover > .icon,
.jsoneditor-contextmenu button.duplicate:focus > .icon {
background-position: -48px 0;
}
.jsoneditor-contextmenu button.sort-asc > .icon {
background-position: -168px -24px;
}
.jsoneditor-contextmenu button.sort-asc:hover > .icon,
.jsoneditor-contextmenu button.sort-asc:focus > .icon {
background-position: -168px 0;
}
.jsoneditor-contextmenu button.sort-desc > .icon {
background-position: -192px -24px;
}
.jsoneditor-contextmenu button.sort-desc:hover > .icon,
.jsoneditor-contextmenu button.sort-desc:focus > .icon {
background-position: -192px 0;
}
/* ContextMenu - sub menu */
.jsoneditor-contextmenu ul li ul li .selected {
background-color: #D5DDF6;
}
.jsoneditor-contextmenu ul li {
overflow: hidden;
}
.jsoneditor-contextmenu ul li ul {
display: none;
position: relative;
left: -10px;
top: 0;
border: none;
box-shadow: inset 0 0 10px rgba(128, 128, 128, 0.5);
padding: 0 10px;
/* TODO: transition is not supported on IE8-9 */
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.jsoneditor-contextmenu ul li.selected ul {
}
.jsoneditor-contextmenu ul li ul li button {
padding-left: 24px;
}
.jsoneditor-contextmenu ul li ul li button:hover,
.jsoneditor-contextmenu ul li ul li button:focus {
background-color: #f5f5f5;
}
.jsoneditor-contextmenu button.type-string > .icon {
background-position: -144px -24px;
}
.jsoneditor-contextmenu button.type-string:hover > .icon,
.jsoneditor-contextmenu button.type-string:focus > .icon,
.jsoneditor-contextmenu button.type-string.selected > .icon{
background-position: -144px 0;
}
.jsoneditor-contextmenu button.type-auto > .icon {
background-position: -120px -24px;
}
.jsoneditor-contextmenu button.type-auto:hover > .icon,
.jsoneditor-contextmenu button.type-auto:focus > .icon,
.jsoneditor-contextmenu button.type-auto.selected > .icon {
background-position: -120px 0;
}
.jsoneditor-contextmenu button.type-object > .icon {
background-position: -72px -24px;
}
.jsoneditor-contextmenu button.type-object:hover > .icon,
.jsoneditor-contextmenu button.type-object:focus > .icon,
.jsoneditor-contextmenu button.type-object.selected > .icon{
background-position: -72px 0;
}
.jsoneditor-contextmenu button.type-array > .icon {
background-position: -96px -24px;
}
.jsoneditor-contextmenu button.type-array:hover > .icon,
.jsoneditor-contextmenu button.type-array:focus > .icon,
.jsoneditor-contextmenu button.type-array.selected > .icon{
background-position: -96px 0;
}
.jsoneditor .menu {
width: 100%;
height: 35px;
padding: 2px;
margin: 0;
overflow: hidden;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #1A1A1A;
background-color: #D5DDF6;
border-bottom: 1px solid #97B0F8;
}
.jsoneditor .menu button {
width: 26px;
height: 26px;
margin: 2px;
padding: 2px;
border-radius: 2px;
border: 1px solid #aec0f8;
background: #e3eaf6 url('img/jsoneditor-icons.png');
}
.jsoneditor .menu button:hover {
background-color: #f0f2f5;
}
.jsoneditor .menu button:active {
background-color: #ffffff;
}
.jsoneditor .menu button:disabled {
background-color: #e3eaf6;
}
.jsoneditor .menu button.collapse-all {
background-position: 0 -96px;
}
.jsoneditor .menu button.expand-all {
background-position: 0 -120px;
}
.jsoneditor .menu button.undo {
background-position: -24px -96px;
}
.jsoneditor .menu button.undo:disabled {
background-position: -24px -120px;
}
.jsoneditor .menu button.redo {
background-position: -48px -96px;
}
.jsoneditor .menu button.redo:disabled {
background-position: -48px -120px;
}
.jsoneditor .menu button.compact {
background-position: -72px -96px;
}
.jsoneditor .menu button.format {
background-position: -72px -120px;
}
.jsoneditor .menu a {
font-family: arial, sans-serif;
font-size: 10pt;
color: #97B0F8;
vertical-align: middle;
}
.jsoneditor .menu a:hover {
color: red;
}
.jsoneditor .menu a.poweredBy {
font-size: 8pt;
position: absolute;
right: 0;
top: 0;
padding: 10px;
}
/* TODO: css for button:disabled is not supported by IE8 */
.jsoneditor .search input,
.jsoneditor .search .results {
font-family: arial, sans-serif;
font-size: 10pt;
color: #1A1A1A;
}
.jsoneditor .search {
position: absolute;
right: 2px;
top: 2px;
}
.jsoneditor .search .frame {
border: 1px solid #97B0F8;
background-color: white;
padding: 0 2px;
margin: 0;
}
.jsoneditor .search .frame table {
border-collapse: collapse;
}
.jsoneditor .search input {
width: 120px;
border: none;
outline: none;
margin: 1px;
}
.jsoneditor .search .results {
color: #4d4d4d;
padding-right: 5px;
line-height: 24px;
}
.jsoneditor .search button {
width: 16px;
height: 24px;
padding: 0;
margin: 0;
border: none;
background: url('img/jsoneditor-icons.png');
vertical-align: top;
}
.jsoneditor .search button:hover {
background-color: transparent;
}
.jsoneditor .search button.refresh {
width: 18px;
background-position: -99px -73px;
}
.jsoneditor .search button.next {
cursor: pointer;
background-position: -124px -73px;
}
.jsoneditor .search button.next:hover {
background-position: -124px -49px;
}
.jsoneditor .search button.previous {
cursor: pointer;
background-position: -148px -73px;
margin-right: 2px;
}
.jsoneditor .search button.previous:hover {
background-position: -148px -49px;
}

6039
jsoneditor.js Normal file

File diff suppressed because it is too large Load Diff

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "jsoneditor",
"version": "2.2.0-SNAPSHOT",
"description": "A web-based tool to view, edit and format JSON",
"tags": [
"json",
"editor",
"viewer",
"formatter"
],
"author": "Jos de Jong <wjosdejong@gmail.com>",
"homepage": "http://jsoneditoronline.org/",
"repository": {
"type": "git",
"url": "https://github.com/josdejong/jsoneditoronline.git"
},
"bugs": "https://github.com/josdejong/jsoneditoronline/issues",
"scripts": {
"prepublish": "jake"
},
"dependencies": {},
"devDependencies": {
"jake": "latest",
"jake-utils": "latest",
"archiver": "latest",
"clean-css": "latest"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

32
src/js/header.js Normal file
View File

@ -0,0 +1,32 @@
/*!
* jsoneditor.js
*
* @brief
* JSONEditor is a web-based tool to view, edit, and format JSON.
* It shows data a clear, editable treeview.
*
* Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
*
* @license
* This json editor is open sourced with the intention to use the editor as
* a component in your own application. Not to just copy and monetize the editor
* as it is.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <wjosdejong@gmail.com>
* @version @@version
* @date @@date
*/

View File

@ -1,39 +1,3 @@
/*!
* @file jsoneditor.js
*
* @brief
* JSONEditor is a web-based tool to view, edit, and format JSON.
* It shows data a clear, editable treeview.
*
* Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
*
* @license
* This json editor is open sourced with the intention to use the editor as
* a component in your own application. Not to just copy and monetize the editor
* as it is.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
* Copyright (c) 2011-2013 Jos de Jong, http://jsoneditoronline.org
*
* @author Jos de Jong, <wjosdejong@gmail.com>
* @date 2013-04-29
*/
(function () {
// module
/***code_placeholder***/
// module exports
var jsoneditor = {
@ -84,5 +48,3 @@ else {
// attach the module to the window, load as a regular javascript file
window['jsoneditor'] = jsoneditor;
}
})();