提交 ec9a7feb 编写于 作者: M Minwe LUO

Merge pull request #107 from allmobilize/codename-h

Codename h
......@@ -19,6 +19,7 @@ node_modules/
.idea
/vendor/codemirror-emmet
/vendor/less.js
/vendor/seaUse*.js
/.bower-cache/
/.bower-registry/
/dist/test/*
......
此差异已折叠。
此差异已折叠。
......@@ -15,7 +15,7 @@ Modal 交互窗口,可以用来模拟浏览器的 `alert`、`confirm`、`promp
<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">
<div class="am-modal-dialog">
<div class="am-modal-hd">Modal 标题
<a href="" class="am-close am-close-spin" data-am-modal-close>&times;</a>
<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
</div>
<div class="am-modal-bd">
Modal 内容。
......@@ -30,7 +30,7 @@ Modal 交互窗口,可以用来模拟浏览器的 `alert`、`confirm`、`promp
<div class="am-modal am-modal-no-btn" tabindex="-1" id="doc-modal-1">
<div class="am-modal-dialog">
<div class="am-modal-hd">Modal 标题
<a href="" class="am-close am-close-spin" data-am-modal-close>&times;</a>
<a href="javascript: void(0)" class="am-close am-close-spin" data-am-modal-close>&times;</a>
</div>
<div class="am-modal-bd">
Modal 内容。
......
......@@ -5,7 +5,7 @@ Amaze UI Web 组件把一些常见的网页组件拆分成不同的部分,进
## Web 组件演示
Amaze UI 目前封装了 10 余个主要面向移动端的 Web 组件。
Amaze UI 目前封装了 10 余个主要面向移动端的 Web 组件[独立窗口中浏览 Demo](/widgets/m)
<iframe src="/widgets/m" frameborder="0" id="doc-widget-frame" frameborder="0"></iframe>
......
......@@ -16,6 +16,7 @@ var rename = require('gulp-rename');
var bower = require('gulp-bower');
var transport = require('gulp-cmd-transport');
var header = require('gulp-header');
var footer = require('gulp-footer');
var clean = require('gulp-clean');
var zip = require('gulp-zip');
var replace = require('gulp-replace');
......@@ -47,9 +48,9 @@ var jsBase = [
];
var seajs = path.join(__dirname, 'vendor/seajs/sea.js');
var seaUse = path.join(__dirname, '/.build/seaUse.js');
var seaUseBasic = path.join(__dirname, '/.build/seaUseBasic.js');
var seaUseWidgets = path.join(__dirname, '/.build/seaUseWidgets.js');
var seaUse = '';
var seaUseBasic = '';
var seaUseWidgets = '';
var jsWidgets = [];
var plugins;
var allPlugins;
......@@ -167,14 +168,14 @@ var preparingData = function() {
}
});
fs.outputFileSync(seaUse, 'seajs.use(' + JSON.stringify(modules) + ');');
fs.outputFileSync(seaUseBasic, 'seajs.use(' + JSON.stringify(modulesBasic) + ');');
fs.outputFileSync(seaUseWidgets, 'seajs.use(' + JSON.stringify(modulesWidgets) + ');');
seaUse = 'seajs.use(' + JSON.stringify(modules) + ');';
seaUseBasic = 'seajs.use(' + JSON.stringify(modulesBasic) + ');';
seaUseWidgets = 'seajs.use(' + JSON.stringify(modulesWidgets) + ');';
// sort for concat
jsWidgetsSorted = _.union([seajs], jsWidgets, [seaUseWidgets]);
jsAllSorted = _.union([seajs], jsAll, [seaUse]);
jsAllSorted = _.union([seajs], jsAll);
jsBasicSorted = _.union([seajs], jsBasic, [seaUseBasic]);
......@@ -254,6 +255,7 @@ gulp.task('concatAll', ['transport'], function() {
return gulp.src(jsAllSorted, {cwd: transportDir})
.pipe(concat(pkg.name + '.js'))
.pipe(header(banner, {pkg: pkg, ver: ''}))
.pipe(footer('\n<%=use%>', {use: seaUse}))
.pipe(gulp.dest(dist.js))
.pipe(uglify({
mangle: {
......@@ -273,6 +275,7 @@ gulp.task('concatBasic', ['concatAll'], function() {
return gulp.src(jsBasicSorted, {cwd: transportDir})
.pipe(concat(pkg.name + '.basic.js'))
.pipe(header(banner, {pkg: pkg, ver: ' ~ basic'}))
.pipe(footer('\n<%=use%>', {use: seaUseBasic}))
.pipe(gulp.dest(dist.js))
.pipe(uglify({
mangle: {
......@@ -292,6 +295,7 @@ gulp.task('concatWidgets', ['concatBasic'], function() {
return gulp.src(jsWidgetsSorted, {cwd: transportDir})
.pipe(concat(pkg.name + '.widgets.js'))
.pipe(header(banner, {pkg: pkg, ver: ' ~ widgets'}))
.pipe(footer('\n<%=use%>', {use: seaUseWidgets}))
.pipe(gulp.dest(dist.js))
.pipe(uglify({
mangle: {
......@@ -359,17 +363,26 @@ gulp.task('zipCopyCSS', function() {
});
gulp.task('zipCopyJs', ['zipCopyCSS'], function() {
return gulp.src('./dist/js/*.js')
return gulp.src(['./dist/js/*.js', './vendor/handlebars/handlebars.min.js', './vendor/zepto/zepto.min.js'])
.pipe(gulp.dest('./docs/examples/assets/js'));
});
gulp.task('zip', ['zipCopyJs'], function() {
gulp.task('zipAdd', ['zipCopyJs'], function() {
return gulp.src(['docs/examples/**/*'])
.pipe(replace(/\{\{assets\}\}/g, 'assets/', {skipBinary: true}))
.pipe(zip(format('AmazeUI-%s-%s.zip', pkg.version, gutil.date(Date.now(), 'UTC:yyyymmdd')), {comment: 'Created on ' + gutil.date(Date.now(), dateFormat)}))
.pipe(gulp.dest('dist'));
});
gulp.task('zipClean', ['zipAdd'], function() { // zipClean
return gulp.src(['docs/examples/assets/*/amazeui.*',
'./docs/examples/assets/js/handlebars.min.js',
'./docs/examples/assets/js/zepto.min.js'], {read: false})
.pipe(clean({force: true}));
});
gulp.task('zip', ['zipClean']);
gulp.task('buildJs', ['copyWidgetJs', 'copyUIJs', 'transport', 'concat', 'clean']);
......
......@@ -155,9 +155,9 @@ define(function(require, exports, module) {
if (!called) {
$($el).trigger(UI.support.transition.end);
}
$el.transitionHandle = undefined;
$el.transitionEndTimmer = undefined;
};
this.transitionHandle = setTimeout(callback, duration);
this.transitionEndTimmer = setTimeout(callback, duration);
return this;
};
......@@ -397,6 +397,11 @@ define(function(require, exports, module) {
UI.support.animation && $html.addClass('cssanimations');
// iOS standalone mode
if (window.navigator.standalone) {
$html.addClass('am-standalone');
}
$('.am-topbar-fixed-top').length && $body.addClass('am-with-topbar-fixed-top');
$('.am-topbar-fixed-bottom').length && $body.addClass('am-with-topbar-fixed-bottom');
......
define(function(require, exports, module) {
require('core');
var dimmer = require('ui.dimmer');
var $ = window.Zepto;
var UI = $.AMUI;
var $win = $(window),
var dimmer = require('ui.dimmer'),
$ = window.Zepto,
UI = $.AMUI,
$doc = $(document),
$body = $('body'),
supportTransition = UI.support.transition;
/**
......@@ -45,7 +40,8 @@ define(function(require, exports, module) {
},
onCancel: function() {
},
duration: 300 // must equal the CSS transition duration
duration: 300, // must equal the CSS transition duration
transitionEnd: supportTransition.end && supportTransition.end + '.modal.amui'
};
Modal.prototype.toggle = function(relatedElement) {
......@@ -61,14 +57,11 @@ define(function(require, exports, module) {
if (!this.$element.length) return;
var hasAnimation = this.transitioning;
// 判断如果还在动画,就先触发之前的closed事件
if (hasAnimation) {
clearTimeout($element.transitionHandle);
$element.transitionHandle = null;
$element.trigger(supportTransition.end);
$element.off(supportTransition.end);
if (this.transitioning) {
clearTimeout($element.transitionEndTimmer);
$element.transitionEndTimmer = null;
$element.trigger(options.transitionEnd).off(options.transitionEnd);
}
isPopup && this.$element.show();
......@@ -81,7 +74,7 @@ define(function(require, exports, module) {
$element.show().redraw();
!isPopup && $element.css({marginTop: - parseInt($element.height() / 2, 10) + 'px'});
!isPopup && $element.css({marginTop: -parseInt($element.height() / 2, 10) + 'px'});
$element.removeClass(options.className.out).addClass(options.className.active);
......@@ -94,25 +87,22 @@ define(function(require, exports, module) {
if (!supportTransition) return complete.call(this);
$element.one(supportTransition.end, $.proxy(complete, this)).emulateTransitionEnd(options.duration);
$element.one(options.transitionEnd, $.proxy(complete, this)).emulateTransitionEnd(options.duration);
};
Modal.prototype.close = function(relatedElement) {
if (!this.active) return;
var hasAnimation = this.transitioning;
var $element = this.$element,
options = this.options,
isPopup = this.isPopup,
that = this;
// 判断如果还在动画,就先触发之前的opened事件
if (hasAnimation) {
clearTimeout($element.transitionHandle);
$element.transitionHandle = null;
$element.trigger(supportTransition.end);
$element.off(supportTransition.end);
if (this.transitioning) {
clearTimeout($element.transitionEndTimmer);
$element.transitionEndTimmer = null;
$element.trigger(options.transitionEnd).off(options.transitionEnd);
}
this.$element.trigger($.Event('close:modal:amui', {relatedElement: relatedElement}));
......@@ -131,7 +121,7 @@ define(function(require, exports, module) {
if (!supportTransition) return complete.call(this);
$element
.one(supportTransition.end, $.proxy(complete, this))
.one(options.transitionEnd, $.proxy(complete, this))
.emulateTransitionEnd(options.duration);
dimmer.close($element);
......
......@@ -95,6 +95,7 @@
content: @fa-var-spinner;
.am-icon-spin;
font-size: 24px;
line-height: 24px;
color: #eee;
position: absolute;
top: 50%;
......@@ -114,8 +115,7 @@
z-index: 2;
-webkit-user-drag: none;
user-drag: none;
.transition(opacity .15s ease-in);
.transition(opacity .15s linear);
&.am-img-loaded {
opacity: 1;
......@@ -127,7 +127,7 @@
position: absolute;
top: 50%;
width: 100%;
margin-top: -18px;
margin-top: -18px !important;
z-index: @z-index-pureview + 2;
.am-touch &,
......
......@@ -40,11 +40,8 @@
"body-parser": "~1.0.0",
"cookie-parser": "~1.0.1",
"debug": "1.0.x",
"express": "4.x",
"hbs": "~2.7.0",
"less-middleware": "1.0.x",
"morgan": "~1.0.0",
"errorhandler": "^1.1.1",
"express": "4.x",
"fs-extra": "^0.10.0",
"gulp": "^3.8.1",
"gulp-bower": "^0.0.6",
......@@ -52,6 +49,7 @@
"gulp-clean": "^0.3.0",
"gulp-cmd-transport": "^0.1.1",
"gulp-concat": "latest",
"gulp-footer": "^1.0.5",
"gulp-header": "^1.0.2",
"gulp-less": "^1.2.3",
"gulp-minify-css": "^0.3.0",
......@@ -61,7 +59,10 @@
"gulp-util": "^2.2.14",
"gulp-watch": "latest",
"gulp-zip": "^0.4.0",
"hbs": "~2.7.0",
"less-middleware": "1.0.x",
"lodash": "^2.4.1",
"morgan": "~1.0.0",
"underscore": "~1.6.0"
},
"license": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册