Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
spring-raining committed Apr 8, 2016
2 parents d13bc73 + db06e4c commit 4d9749e
Show file tree
Hide file tree
Showing 45 changed files with 2,245 additions and 1,106 deletions.
11 changes: 11 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"presets": [
"es2015",
"react"
],
"plugins": [
["react-intl", {
"messagesDir": "./.tmp/messages/"
}]
]
}
Binary file modified .gitignore
Binary file not shown.
19 changes: 17 additions & 2 deletions css/_defs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ $color-timeline-handle-shadow: rgba(90, 30, 18, 0.5);
$color-timeline-cell-cached: #4BDC4B;
$color-timeline-overlay-ctrl-border: #FF53B2;
$color-timeline-overlay-ctrl-bg: transparentize($color-timeline-overlay-ctrl-border, 0.9);
$color-timeline-draghere-border: $color-giraf;
$color-timeline-draghere-bg: transparentize($color-giraf, 0.9);
$color-timeline-drophere-border: $color-giraf;
$color-timeline-drophere-bg: transparentize($color-giraf, 0.9);
$color-project-body: $color-white;
$color-project-bg: rgb(109, 90, 68);
$color-project-card-footage-bg: rgb(89, 100, 101);
Expand Down Expand Up @@ -265,6 +265,21 @@ $create-video-layer-modal-info-height: 150px;
text-align: center;
}

@mixin giraf-link($body-color: $color-a, $hover-color: darken($body-color, 20%)) {
color: $body-color;
text-decoration: none;
cursor: pointer;

&:active, &:hover {
outline: 0;
}

&:hover, &:focus {
color: $hover-color;
text-decoration: underline;
}
}

@mixin calculate-z-index($global-tag, $local-tag) {
$global: index($z-order-global, $global-tag);
$local: index(map-get($z-order, $global-tag), $local-tag);
Expand Down
12 changes: 1 addition & 11 deletions css/elements/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,7 @@ q:before, q:after {
}

a {
color: $color-a;
text-decoration: none;

&:active, &:hover {
outline: 0;
}

&:hover, &:focus {
color: darken($color-a, 20%);
text-decoration: underline;
}
@include giraf-link();
}

h1 {
Expand Down
5 changes: 5 additions & 0 deletions css/elements/_effect.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
.effect__legend {
width: 100%;
height: 36px;
line-height: 36px;
font-size: 16px;
margin-bottom: 8px;

Expand Down Expand Up @@ -54,6 +55,10 @@
}
}
}

a {
@include giraf-link($color-giraf);
}
}

.effect__header {
Expand Down
16 changes: 8 additions & 8 deletions css/elements/_timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@
}
}

.timeline__draghere {
.timeline__drophere {
@include position(absolute, 0 0 0 0);
@include calculate-z-index(anyway, base);

border: 2px solid $color-timeline-draghere-border;
background-color: $color-timeline-draghere-bg;
border: 2px solid $color-timeline-drophere-border;
background-color: $color-timeline-drophere-bg;

.timeline__draghere__card {
.timeline__drophere__card {
@include giraf-card(2);
@include giraf-normal-body($color-timeline-draghere-border);
@include giraf-normal-body($color-timeline-drophere-border);
@include position(absolute, 6px 0 null 0);
margin: auto;
padding: 12px;
width: 200px;
background-color: $color-timeline-draghere-border;
background-color: $color-timeline-drophere-border;
text-align: center;

@include reveal(timeline-draghere-card, 0.2s, block, 0.2s) {
@include reveal(timeline-drophere-card, 0.2s, block, 0.2s) {
0% {
opacity: 0;
@include transform(translate3d(0, 20px , 0));
Expand All @@ -45,7 +45,7 @@
}
}

@include reveal(timeline-draghere, 0.2s) {
@include reveal(timeline-drophere, 0.2s) {
0% {
opacity: 0;
}
Expand Down
14 changes: 13 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var sequence = require("run-sequence");
var sass = require("gulp-sass");
var del = require("del");
var packager = require("electron-packager");
var exec = require("child_process").exec;

var packageJson = require("./package.json");

Expand Down Expand Up @@ -86,7 +87,14 @@ gulp.task("clean", del.bind(null, [
dir.dist,
]));

gulp.task("js", function() {
gulp.task("js", function(callback) {
return sequence(
"js:bundle",
"js:messages",
callback
);
});
gulp.task("js:bundle", function() {
return browserify({
entries: dir.src + "/giraf.jsx",
extensions: [".jsx", ".js"],
Expand All @@ -98,6 +106,10 @@ gulp.task("js", function() {
.pipe(gulp.dest(dir.dist));
});

gulp.task("js:messages", function() {
exec("node_modules/.bin/babel-node scripts/export-messages.js");
});

gulp.task("css", function() {
return gulp.src(dir.css + "/*.scss")
.pipe(sass())
Expand Down
17 changes: 13 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "giraf",
"version": "2.0.0-beta-6",
"description": "Make gif animations on the web.",
"version": "2.0.0",
"description": "Powerful & Free GIF Creator",
"main": "main.js",
"scripts": {
"install": "./node_modules/gulp/bin/gulp.js",
Expand All @@ -21,12 +21,19 @@
"bugs": {
"url": "https://github.com/spring-raining/giraf/issues"
},
"homepage": "https://github.com/spring-raining/giraf#readme",
"homepage": "https://spring-raining.github.io/Giraf",
"electronName": "Giraf",
"electronVersion": "0.36.3",
"dependencies": {
"babelify": "^6.3.0",
"babel-cli": "^6.6.5",
"babel-core": "^6.6.0",
"babel-plugin-react-intl": "^2.1.1",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babelify": "^7.2.0",
"bourbon": "^4.2.5",
"brace": "^0.7.0",
"brfs": "^1.4.3",
"browserify": "^11.2.0",
"decimal.js": "^4.0.3",
"deep-diff": "^0.3.3",
Expand All @@ -42,8 +49,10 @@
"lodash": "^3.10.1",
"mousetrap": "^1.5.3",
"react": "^0.14.3",
"react-ace": "^3.1.0",
"react-dom": "^0.14.3",
"react-inlinesvg": "~0.4.2",
"react-intl": "^2.0.1",
"react-split-pane": "0.1.15",
"run-sequence": "^1.1.5",
"ua-parser-js": "^0.7.9",
Expand Down
57 changes: 57 additions & 0 deletions scripts/export-messages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
"use strict";

import * as fs from "fs";
import * as path from "path";
import {sync as globSync} from "glob";
import {sync as mkdirpSync} from "mkdirp";

const BUILD_MESSAGES_PATTERN = "./.tmp/messages/**/*.json";
const TRANSLATED_MESSAGES_PATTERN = "./src/messages/*.json";
const LANG_DIR = "./dist/lang/";

const defaultMessages = globSync(BUILD_MESSAGES_PATTERN)
.map((filename) => fs.readFileSync(filename, "utf8"))
.map((file) => JSON.parse(file))
.reduce((collection, descriptors) => {
descriptors.forEach(({id, defaultMessage}) => {
if (collection.hasOwnProperty(id)) {
throw new Error(`Duplicate message id: ${id}`);
}

collection[id] = defaultMessage;
});

return collection;
}, {});

const translatedMessages = (filename) => {
const messages = JSON.parse(fs.readFileSync(filename, "utf8"));

return Object.keys(messages)
.reduce((collection, key) => {
if (defaultMessages.hasOwnProperty(key)) {
collection[key] = messages[key];
}
return collection;
}, {});
};

const sortedJSON = (obj) =>
JSON.stringify(
Object.keys(obj)
.sort()
.reduce((collection, key) => {
collection[key] = obj[key];
return collection;
}, {}),
null, 2);

mkdirpSync(LANG_DIR);
fs.writeFileSync(LANG_DIR + "en-US.json", sortedJSON(defaultMessages));
globSync(TRANSLATED_MESSAGES_PATTERN)
.forEach((filename) => {
fs.writeFileSync(
LANG_DIR + path.basename(filename),
sortedJSON(translatedMessages(filename)));
});

Loading

0 comments on commit 4d9749e

Please sign in to comment.