amazeui-doc-util
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
var gulp = require('gulp'); | ||
var webpack = require('webpack-stream'); | ||
var $ = require('gulp-load-plugins')(); | ||
@@ -44,2 +45,7 @@ var markJSON = require('markit-json'); | ||
return gulp.src(paths.js) | ||
.pipe(webpack({ | ||
output: { | ||
filename: 'app.js', | ||
}, | ||
})) | ||
.pipe($.uglify()) | ||
@@ -56,3 +62,6 @@ .pipe($.rename(function(file) { | ||
.pipe(markJSON(docUtil.markedOptions)) | ||
.pipe(docUtil.applyTemplate()) | ||
.pipe(docUtil.applyTemplate(null, { | ||
pluginTitle: 'Amaze UI Plugin', | ||
pluginDesc: 'Just another Amaze UI plugin.' | ||
})) | ||
.pipe($.rename({extname: '.html'})) | ||
@@ -59,0 +68,0 @@ .pipe(gulp.dest('./dist')); |
{ | ||
"name": "amazeui-doc-util", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Amaze UI Markdown docs parsing util.", | ||
@@ -25,22 +25,24 @@ "main": "index.js", | ||
"dependencies": { | ||
"handlebars": "^3.0.3", | ||
"highlight.js": "^8.4.0", | ||
"marked": "^0.3.2", | ||
"object.assign": "^3.0.0", | ||
"through2": "^0.6.3", | ||
"handlebars": "^4.0.5", | ||
"highlight.js": "^8.9.1", | ||
"marked": "^0.3.5", | ||
"object.assign": "^4.0.3", | ||
"through2": "^2.0.0", | ||
"unidecode": "^0.1.7" | ||
}, | ||
"devDependencies": { | ||
"amazeui": "^2.1.0", | ||
"gulp": "^3.8.10", | ||
"gulp-autoprefixer": "^2.1.0", | ||
"gulp-csso": "^0.2.9", | ||
"gulp-header": "^1.2.2", | ||
"gulp-less": "^2.0.1", | ||
"gulp-load-plugins": "^0.8.0", | ||
"amazeui": "^2.5.0", | ||
"clipboard": "^1.5.5", | ||
"gulp": "^3.9.0", | ||
"gulp-autoprefixer": "^3.1.0", | ||
"gulp-csso": "^1.0.1", | ||
"gulp-header": "^1.7.1", | ||
"gulp-less": "^3.0.5", | ||
"gulp-load-plugins": "^1.1.0", | ||
"gulp-qndn": "0.0.3", | ||
"gulp-rename": "^1.2.0", | ||
"gulp-uglify": "^1.0.2", | ||
"markit-json": "^0.2.1" | ||
"gulp-rename": "^1.2.2", | ||
"gulp-uglify": "^1.5.1", | ||
"markit-json": "^0.2.1", | ||
"webpack-stream": "^2.2.0" | ||
} | ||
} |
(function() { | ||
var $ = this.jQuery; | ||
var Clipboard = require('clipboard'); | ||
var $ = window.jQuery; | ||
@@ -10,3 +11,4 @@ if (!$ || !$.AMUI) { | ||
var $testCode = $('<!--[if lte IE 9]><span id="old-ie-tester"></span><![endif]-->'); | ||
var isOldIE = $(document.body).append($testCode).find('#old-ie-tester').length; | ||
var isOldIE = $(document.body).append($testCode) | ||
.find('#old-ie-tester').length; | ||
$testCode.remove(); | ||
@@ -26,3 +28,3 @@ return !!isOldIE; | ||
AMPlugin.prototype.toolbar = function() { | ||
var _this = this; | ||
var _this = this; | ||
var $w = $(window); | ||
@@ -70,5 +72,56 @@ var $toolbar = $('#amp-toolbar'); | ||
function initClipboard() { | ||
var copyBtn = '<div class="doc-actions"><div class="doc-act-inner">' + | ||
'<span class="doc-act-clip am-icon-copy"> Copy</span></div></div>'; | ||
$('.doc-code').each(function() { | ||
var $code = $(this); | ||
var $prev = $code.prev(); | ||
if ($prev.hasClass('doc-example')) { | ||
$prev.before(copyBtn); | ||
} else { | ||
$code.before(copyBtn); | ||
} | ||
}); | ||
// https://zenorocha.github.io/clipboard.js/ | ||
var clipboard = new Clipboard('.doc-act-clip', { | ||
text: function(trigger) { | ||
var $next = $(trigger).parent().parent().next(); | ||
var $reqCode = $next.is('.doc-code') ? $next : $next.next('.doc-code'); | ||
return $reqCode.text(); | ||
} | ||
}); | ||
var timer; | ||
clipboard.on('success', function(e) { | ||
var $trigger = $(e.trigger); | ||
var oldText = ' Copy'; | ||
var success = 'success'; | ||
$trigger.addClass(success).text(' Copied'); | ||
timer && clearTimeout(timer); | ||
timer = setTimeout(function() { | ||
$trigger.removeClass(success).text(oldText); | ||
}, 3000); | ||
console.info('Copied text to clipboard: ' + e.text); | ||
e.clearSelection(); | ||
}); | ||
clipboard.on('error', function(e) { | ||
$(e.trigger).text(' Error!').addClass('error'); | ||
console.error('Action:', e.action); | ||
console.error('Trigger:', e.trigger); | ||
}); | ||
} | ||
$(function() { | ||
new AMPlugin(); | ||
initClipboard(); | ||
}); | ||
}).call(this); | ||
}).call(window); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31235
337
13
+ Addedcall-bind@1.0.8(transitive)
+ Addedcall-bind-apply-helpers@1.0.1(transitive)
+ Addedcall-bound@1.0.3(transitive)
+ Addeddunder-proto@1.0.1(transitive)
+ Addedes-object-atoms@1.1.1(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.7(transitive)
+ Addedget-proto@1.0.1(transitive)
+ Addedhandlebars@4.7.8(transitive)
+ Addedhas-symbols@1.1.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedmath-intrinsics@1.1.0(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedneo-async@2.6.2(transitive)
+ Addedobject.assign@4.1.7(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedthrough2@2.0.5(transitive)
+ Addeduglify-js@3.19.3(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwordwrap@1.0.0(transitive)
- Removedalign-text@0.1.4(transitive)
- Removedamdefine@1.0.1(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedcliui@2.1.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedhandlebars@3.0.8(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedisarray@0.0.1(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedminimist@0.0.10(transitive)
- Removedobject.assign@3.0.1(transitive)
- Removedoptimist@0.6.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsource-map@0.1.430.5.7(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedthrough2@0.6.5(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.20.0.3(transitive)
- Removedyargs@3.10.0(transitive)
Updatedhandlebars@^4.0.5
Updatedhighlight.js@^8.9.1
Updatedmarked@^0.3.5
Updatedobject.assign@^4.0.3
Updatedthrough2@^2.0.0