diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..f8658b4 --- /dev/null +++ b/.babelrc @@ -0,0 +1,22 @@ +{ + "plugins": [ + ["@babel/plugin-transform-runtime", { + "helpers": true, + "forceAllTransforms": false + }] + ], + "presets": [ + ["@babel/preset-env", { + "debug": false, + "useBuiltIns": "usage", + "corejs": "3.6", + "modules": "auto", + "targets": { + "browsers": [ + "last 2 versions", + "ie >= 11" + ] + } + }] + ] +} \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 976ba4c..0000000 --- a/.eslintrc +++ /dev/null @@ -1,168 +0,0 @@ -{ - "env": { - "browser": true, - "node": true, - "jquery": true, - "es6": true - }, - - "ecmaFeatures": { - "modules": true - }, - - "rules": { - "accessor-pairs": 2, - "array-bracket-spacing": 0, - "block-scoped-var": 0, - "brace-style": [2, "stroustrup", { "allowSingleLine": true }], - "camelcase": 0, - "comma-dangle": [2, "never"], - "comma-spacing": [2, { "before": false, "after": true }], - "comma-style": [2, "last"], - "complexity": 0, - "computed-property-spacing": 0, - "consistent-return": 0, - "consistent-this": 0, - "constructor-super": 2, - "curly": [2, "multi-line"], - "default-case": 0, - "dot-location": [2, "property"], - "dot-notation": 0, - "eol-last": 0, - "eqeqeq": [2, "allow-null"], - "func-names": 0, - "func-style": 0, - "generator-star-spacing": [2, { "before": true, "after": true }], - "guard-for-in": 0, - "handle-callback-err": [2, "^(err|error)$" ], - "indent": [2, 2, { "SwitchCase": 1 }], - "key-spacing": [2, { "beforeColon": false, "afterColon": true }], - "linebreak-style": 0, - "lines-around-comment": 0, - "max-nested-callbacks": 0, - "new-cap": [2, { "newIsCap": true, "capIsNew": false }], - "new-parens": 2, - "newline-after-var": 0, - "no-alert": 0, - "no-array-constructor": 2, - "no-caller": 2, - "no-catch-shadow": 0, - "no-cond-assign": 2, - "no-console": 0, - "no-constant-condition": 0, - "no-continue": 0, - "no-control-regex": 2, - "no-debugger": 2, - "no-delete-var": 2, - "no-div-regex": 0, - "no-dupe-args": 2, - "no-dupe-keys": 2, - "no-duplicate-case": 2, - "no-else-return": 0, - "no-empty": 0, - "no-empty-character-class": 2, - "no-empty-label": 2, - "no-eq-null": 0, - "no-eval": 2, - "no-ex-assign": 2, - "no-extend-native": 2, - "no-extra-bind": 2, - "no-extra-boolean-cast": 2, - "no-extra-parens": 0, - "no-extra-semi": 0, - "no-fallthrough": 2, - "no-floating-decimal": 2, - "no-func-assign": 2, - "no-implied-eval": 2, - "no-inline-comments": 0, - "no-inner-declarations": [2, "functions"], - "no-invalid-regexp": 2, - "no-irregular-whitespace": 2, - "no-iterator": 2, - "no-label-var": 2, - "no-labels": 2, - "no-lone-blocks": 2, - "no-lonely-if": 0, - "no-loop-func": 0, - "no-mixed-requires": 0, - "no-mixed-spaces-and-tabs": 2, - "no-multi-spaces": 2, - "no-multi-str": 2, - "no-multiple-empty-lines": [2, { "max": 1 }], - "no-native-reassign": 2, - "no-negated-in-lhs": 2, - "no-nested-ternary": 0, - "no-new": 2, - "no-new-func": 0, - "no-new-object": 2, - "no-new-require": 2, - "no-new-wrappers": 2, - "no-obj-calls": 2, - "no-octal": 2, - "no-octal-escape": 2, - "no-param-reassign": 0, - "no-path-concat": 0, - "no-process-env": 0, - "no-process-exit": 0, - "no-proto": 0, - "no-redeclare": 2, - "no-regex-spaces": 2, - "no-restricted-modules": 0, - "no-return-assign": 2, - "no-script-url": 0, - "no-self-compare": 2, - "no-sequences": 2, - "no-shadow": 0, - "no-shadow-restricted-names": 2, - "no-spaced-func": 2, - "no-sparse-arrays": 2, - "no-sync": 0, - "no-ternary": 0, - "no-this-before-super": 2, - "no-throw-literal": 2, - "no-trailing-spaces": 0, - "no-undef": 2, - "no-undef-init": 2, - "no-undefined": 0, - "no-underscore-dangle": 0, - "no-unexpected-multiline": 2, - "no-unneeded-ternary": 2, - "no-unreachable": 2, - "no-unused-expressions": 0, - "no-unused-vars": [2, { "vars": "all", "args": "none" }], - "no-use-before-define": 0, - "no-var": 0, - "no-void": 0, - "no-warning-comments": 0, - "no-with": 2, - "object-curly-spacing": 0, - "object-shorthand": 0, - "one-var": [2, { "initialized": "never" }], - "operator-assignment": 0, - "operator-linebreak": [2, "after", { "overrides": { "?": "before", ":": "before" } }], - "padded-blocks": 0, - "prefer-const": 0, - "quote-props": 0, - "quotes": [2, "single", "avoid-escape"], - "radix": 2, - "semi": [2, "never"], - "semi-spacing": 0, - "sort-vars": 0, - "space-after-keywords": [2, "always"], - "space-before-blocks": [2, "always"], - "space-before-function-paren": [2, "always"], - "space-in-parens": [2, "never"], - "space-infix-ops": 2, - "space-return-throw-case": 2, - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": [2, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!"] }], - "strict": 0, - "use-isnan": 2, - "valid-jsdoc": 0, - "valid-typeof": 2, - "vars-on-top": 0, - "wrap-iife": [2, "any"], - "wrap-regex": 0, - "yoda": [2, "never"] - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5ad9089..8754931 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules/ -demo/dist/ \ No newline at end of file +demo/dist/ +mix-manifest.json +mix.js +package-lock.json \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..9cf9495 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/README.md b/README.md index 4704aae..946a1f3 100644 --- a/README.md +++ b/README.md @@ -6,18 +6,18 @@ Interactive web components inspired from [Material Design](https://www.google.co ## Layout components -- [x] [Drawer](https://github.com/themekit/material-design-kit/tree/master/src/drawer) - A navigation drawer that can slide in from the left or right. -- [x] [Drawer Layout](https://github.com/themekit/material-design-kit/tree/master/src/drawer-layout) - A wrapper element that positions a Drawer and other content. -- [x] [Header](https://github.com/themekit/material-design-kit/tree/master/src/header) - A container element for navigation and other content at the top of the screen with visual effects based on scroll position. -- [x] [Header Layout](https://github.com/themekit/material-design-kit/tree/master/src/header-layout) - A wrapper element that positions a Header and other content. -- [x] [Box](https://github.com/themekit/material-design-kit/tree/master/src/box) - A container element for generic content with visual effects based on scroll position. +- [x] [Drawer](https://github.com/FrontendMatter/material-design-kit/tree/master/src/drawer) - A navigation drawer that can slide in from the left or right. +- [x] [Drawer Layout](https://github.com/FrontendMatter/material-design-kit/tree/master/src/drawer-layout) - A wrapper element that positions a Drawer and other content. +- [x] [Header](https://github.com/FrontendMatter/material-design-kit/tree/master/src/header) - A container element for navigation and other content at the top of the screen with visual effects based on scroll position. +- [x] [Header Layout](https://github.com/FrontendMatter/material-design-kit/tree/master/src/header-layout) - A wrapper element that positions a Header and other content. +- [x] [Box](https://github.com/FrontendMatter/material-design-kit/tree/master/src/box) - A container element for generic content with visual effects based on scroll position. - [ ] *Tabs* - [ ] *Footer* ## Media components -- [x] [Reveal](https://github.com/themekit/material-design-kit/tree/master/src/reveal) - A content area that reveals on user interaction. -- [x] [Carousel](https://github.com/themekit/material-design-kit/tree/master/src/carousel) - A component for cycling through elements with Mouse Grab (desktop) and Touch support. +- [x] [Reveal](https://github.com/FrontendMatter/material-design-kit/tree/master/src/reveal) - A content area that reveals on user interaction. +- [x] [Carousel](https://github.com/FrontendMatter/material-design-kit/tree/master/src/carousel) - A component for cycling through elements with Mouse Grab (desktop) and Touch support. - [ ] *Overlay* ## Form components @@ -37,8 +37,8 @@ Interactive web components inspired from [Material Design](https://www.google.co ## Behaviors -- [x] [Scroll Target](https://github.com/themekit/material-design-kit/tree/master/src/scroll-target-behavior) - Allows an element to respond to scroll events from a designated scroll target. -- [x] [Scroll Effect](https://github.com/themekit/material-design-kit/tree/master/src/scroll-effect-behavior) - Allows a consumer of the Scroll Target behavior to use scroll effects. +- [x] [Scroll Target](https://github.com/FrontendMatter/material-design-kit/tree/master/src/scroll-target-behavior) - Allows an element to respond to scroll events from a designated scroll target. +- [x] [Scroll Effect](https://github.com/FrontendMatter/material-design-kit/tree/master/src/scroll-effect-behavior) - Allows a consumer of the Scroll Target behavior to use scroll effects. - [ ] *Ripple* - [ ] *Swipe Dismiss* @@ -57,7 +57,18 @@ Interactive web components inspired from [Material Design](https://www.google.co ## Compatibility -- [ ] Supports ES5-compliant browsers (IE9+) - **currently IE10+**. +> Supports the last two versions of every major browser. + +- Chrome +- Safari +- Firefox +- IE 11/Edge +- Opera +- Mobile Safari +- Chrome on Android + +> Library + - [x] Compatible with projects using (or not using) jQuery, Bootstrap and MDL. - [x] UMD library format - supports AMD, CommonJS (browserify), ES6 imports and global namespace. @@ -65,13 +76,13 @@ Interactive web components inspired from [Material Design](https://www.google.co > Note there are many more demos included with the source of each component. -- [Left drawer](http://mdk-demo.themekit.io/drawer-left.html) - Slides in from the left -- [Drawer layout with header layout](http://mdk-demo.themekit.io/drawer-layout-with-header-layout.html) - Uses a Header Layout with a custom scrolling region -- [Header layout within drawer](http://mdk-demo.themekit.io/header-layout-drawer.html) - Positions a header and other content within a drawer -- [Header layout within drawer with transform effects](http://mdk-demo.themekit.io/header-layout-drawer-transform-fx.html) - Positions a header and other content within a drawer and use transform effects on header elements based on scroll position -- [Header with parallax and blend background effects](http://mdk-demo.themekit.io/header-parallax-blend.html) -- [Reveal](http://mdk-demo.themekit.io/reveal.html) -- [Carousel](http://mdk-demo.themekit.io/carousel.html) +- [Left drawer](http://mdk.frontendmatter.com/drawer-left.html) - Slides in from the left +- [Drawer layout with header layout](http://mdk.frontendmatter.com/drawer-layout-with-header-layout.html) - Uses a Header Layout with a custom scrolling region +- [Header layout within drawer](http://mdk.frontendmatter.com/header-layout-drawer.html) - Positions a header and other content within a drawer +- [Header layout within drawer with transform effects](http://mdk.frontendmatter.com/header-layout-drawer-transform-fx.html) - Positions a header and other content within a drawer and use transform effects on header elements based on scroll position +- [Header with parallax and blend background effects](http://mdk.frontendmatter.com/header-parallax-blend.html) +- [Reveal](http://mdk.frontendmatter.com/reveal.html) +- [Carousel](http://mdk.frontendmatter.com/carousel.html) ## Installation @@ -90,6 +101,7 @@ npm install material-design-kit dom-factory + ``` diff --git a/build/webpack.config.dev.js b/build/webpack.config.dev.js deleted file mode 100644 index 72c676f..0000000 --- a/build/webpack.config.dev.js +++ /dev/null @@ -1,4 +0,0 @@ -var config = require('./webpack.config') -module.exports = config.map(function(config) { - return config.dev({ devtool: 'eval-source-maps' }).getConfig() -}) \ No newline at end of file diff --git a/build/webpack.config.js b/build/webpack.config.js deleted file mode 100644 index 2ca4396..0000000 --- a/build/webpack.config.js +++ /dev/null @@ -1,48 +0,0 @@ -var WebpackConfig = require('themekit-webpack-config') -var camelCase = require('camelcase') -var entries = [ - 'material-design-kit', - 'box/index', - 'drawer/index', - 'drawer-layout/index', - 'header/index', - 'header-layout/index', - 'reveal/index', - 'carousel/index' -] - -module.exports = entries.map(function (entry, index) { - var name = entry.match(/(.*)\//) - name = name ? name[1] : entry - - var library = camelCase('mdk-' + name) - var config = new WebpackConfig() - - if (index === 0) { - library = 'MDK' - config.withStandaloneEntry(entry) - } - else { - config.withStandaloneEntry(name, entry) - } - - return config - .withLibrary(library) - .webpack({ - sassLoader: { - importer: require('sass-importer-npm') - }, - sassImportLoader: { - base: './src/_variables.scss' - }, - externals: [{ - 'dom-factory': { - root: 'domFactory', - commonjs2: 'dom-factory', - commonjs: 'dom-factory', - amd: 'dom-factory' - } - }] - }) - .use('extract') -}) \ No newline at end of file diff --git a/build/webpack.config.production.js b/build/webpack.config.production.js deleted file mode 100644 index e2714eb..0000000 --- a/build/webpack.config.production.js +++ /dev/null @@ -1,4 +0,0 @@ -var config = require('./webpack.config') -module.exports = config.map(function (config) { - return config.production().getConfig() -}) \ No newline at end of file diff --git a/demo/.babelrc b/demo/.babelrc new file mode 100644 index 0000000..827ed89 --- /dev/null +++ b/demo/.babelrc @@ -0,0 +1,11 @@ +{ + "plugins": ["@babel/transform-runtime"], + "presets": [ + ["@babel/env", { + "targets": { + "ie": "11", + "browsers": ["last 2 versions"] + } + }] + ] +} \ No newline at end of file diff --git a/demo/.gitignore b/demo/.gitignore new file mode 100644 index 0000000..19a3b3a --- /dev/null +++ b/demo/.gitignore @@ -0,0 +1,3 @@ +mix.js +mix-manifest.json +node_modules/ \ No newline at end of file diff --git a/demo/.npmrc b/demo/.npmrc new file mode 100644 index 0000000..9cf9495 --- /dev/null +++ b/demo/.npmrc @@ -0,0 +1 @@ +package-lock=false \ No newline at end of file diff --git a/demo/bs-config.json b/demo/bs-config.json deleted file mode 100644 index a1e7844..0000000 --- a/demo/bs-config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "port": 3000, - "files": ["./dist/**/*.{html,css,js}"], - "server": { "baseDir": "./dist" } -} \ No newline at end of file diff --git a/demo/dist/CNAME b/demo/dist/CNAME index 2223f26..9d0fafa 100644 --- a/demo/dist/CNAME +++ b/demo/dist/CNAME @@ -1 +1 @@ -mdk-demo.themekit.io \ No newline at end of file +mdk.frontendmatter.com \ No newline at end of file diff --git a/demo/dist/assets/images/300_1.jpg b/demo/dist/assets/images/300_1.jpg new file mode 100644 index 0000000..b06a4df Binary files /dev/null and b/demo/dist/assets/images/300_1.jpg differ diff --git a/demo/dist/assets/images/300_2.jpg b/demo/dist/assets/images/300_2.jpg new file mode 100644 index 0000000..a53bc9f Binary files /dev/null and b/demo/dist/assets/images/300_2.jpg differ diff --git a/demo/dist/assets/images/300_3.jpg b/demo/dist/assets/images/300_3.jpg new file mode 100644 index 0000000..a2cd348 Binary files /dev/null and b/demo/dist/assets/images/300_3.jpg differ diff --git a/demo/dist/assets/images/300_4.jpg b/demo/dist/assets/images/300_4.jpg new file mode 100644 index 0000000..5f4a24d Binary files /dev/null and b/demo/dist/assets/images/300_4.jpg differ diff --git a/demo/dist/assets/images/300_5.jpg b/demo/dist/assets/images/300_5.jpg new file mode 100644 index 0000000..0a60fa9 Binary files /dev/null and b/demo/dist/assets/images/300_5.jpg differ diff --git a/demo/dist/assets/images/300_6.jpg b/demo/dist/assets/images/300_6.jpg new file mode 100644 index 0000000..6591354 Binary files /dev/null and b/demo/dist/assets/images/300_6.jpg differ diff --git a/demo/dist/assets/images/300_7.jpg b/demo/dist/assets/images/300_7.jpg new file mode 100644 index 0000000..dfa0087 Binary files /dev/null and b/demo/dist/assets/images/300_7.jpg differ diff --git a/demo/dist/assets/images/300_8.jpg b/demo/dist/assets/images/300_8.jpg new file mode 100644 index 0000000..3a2f796 Binary files /dev/null and b/demo/dist/assets/images/300_8.jpg differ diff --git a/demo/dist/assets/images/500_1.jpg b/demo/dist/assets/images/500_1.jpg new file mode 100644 index 0000000..86e21b8 Binary files /dev/null and b/demo/dist/assets/images/500_1.jpg differ diff --git a/demo/dist/assets/images/500_2.jpg b/demo/dist/assets/images/500_2.jpg new file mode 100644 index 0000000..a017bec Binary files /dev/null and b/demo/dist/assets/images/500_2.jpg differ diff --git a/demo/dist/assets/images/500_3.jpg b/demo/dist/assets/images/500_3.jpg new file mode 100644 index 0000000..7657235 Binary files /dev/null and b/demo/dist/assets/images/500_3.jpg differ diff --git a/demo/dist/assets/images/500_4.jpg b/demo/dist/assets/images/500_4.jpg new file mode 100644 index 0000000..7a28c33 Binary files /dev/null and b/demo/dist/assets/images/500_4.jpg differ diff --git a/demo/dist/assets/images/500_5.jpg b/demo/dist/assets/images/500_5.jpg new file mode 100644 index 0000000..45db544 Binary files /dev/null and b/demo/dist/assets/images/500_5.jpg differ diff --git a/demo/dist/assets/images/avatar1.png b/demo/dist/assets/images/avatar1.png new file mode 100644 index 0000000..b3d3c4e Binary files /dev/null and b/demo/dist/assets/images/avatar1.png differ diff --git a/demo/dist/assets/images/avatar2.png b/demo/dist/assets/images/avatar2.png new file mode 100644 index 0000000..5ab4f46 Binary files /dev/null and b/demo/dist/assets/images/avatar2.png differ diff --git a/demo/dist/assets/images/avatar3.png b/demo/dist/assets/images/avatar3.png new file mode 100644 index 0000000..875b5ae Binary files /dev/null and b/demo/dist/assets/images/avatar3.png differ diff --git a/demo/dist/assets/images/photo-1463580009491-9111ca5c3f84.jpg b/demo/dist/assets/images/photo-1463580009491-9111ca5c3f84.jpg index eab3d12..5f36d84 100644 Binary files a/demo/dist/assets/images/photo-1463580009491-9111ca5c3f84.jpg and b/demo/dist/assets/images/photo-1463580009491-9111ca5c3f84.jpg differ diff --git a/demo/gulpfile.js b/demo/gulpfile.js deleted file mode 100644 index 90829b8..0000000 --- a/demo/gulpfile.js +++ /dev/null @@ -1,344 +0,0 @@ -var gulp = require('gulp'); -var $ = require('gulp-load-plugins')(); -var runSequence = require('run-sequence'); - -///////////// -// OPTIONS // -///////////// - -// enable extra debug information, when possible -var __DEBUG = true; -// enable sourcemaps for Browserify bundles and Sass -var __SOURCEMAPS = true; -// clean dist files before (re)builds -var __CLEAN = true; -// minify .css and .js files -var __MINIFY = true; -// copy vendor assets from node_modules/ -var __VENDOR_ASSETS = []; - -/////////// -// PATHS // -/////////// - -// SOURCE PATH OPTIONS -var __SRC = './src'; -var __SRC_BROWSERIFY = [__SRC + '/js/**/**.browserify.js']; -var __SRC_SASS = [ - __SRC + '/sass/**/*.scss', - // Ignore partials (file names prefixed with _) - '!' + __SRC + '/sass/**/_*.scss' -]; -var __SRC_HTML = __SRC + '/html/pages/**/*.html'; - -// WATCH PATHS -var __WATCH_SASS = [ - __SRC + '/sass/**/**.scss', - './node_modules/material-design-kit/src/**/**.scss' -]; -var __WATCH_BROWSERIFY = __SRC_BROWSERIFY; -var __WATCH_HTML = __SRC + '/html/**/**'; - -// DIST PATH OPTIONS -var __DIST = './dist'; -var __DIST_JS = __DIST + '/assets/js'; -var __DIST_CSS = __DIST + '/assets/css'; -var __DIST_VENDOR = __DIST + '/assets/vendor'; - -// CLEAN PATHS -// clean Browserify bundles -var __CLEAN_BROWSERIFY = [ - // Bundles - __DIST_JS + '/**/**.browserify.js', - // Minified bundles - __DIST_JS + '/**/**.browserify.min.js', - // .map files - __DIST_JS + '/**/**.browserify.js.map', - __DIST_JS + '/**/**.browserify.min.js.map' -]; -var __CLEAN_CSS = __DIST_CSS; -var __CLEAN_HTML = __DIST + '/**/**.html'; -var __CLEAN_VENDOR = __DIST_VENDOR; - -///////////////// -// CLEAN TASKS // -///////////////// - -var del = require('del'); - -// CLEAN DIST JS BROWSERIFY BUNDLES -gulp.task('clean-browserify', function (cb) { - if (!__CLEAN) { - return cb() - } - del(__CLEAN_BROWSERIFY).then(function () { - cb() - }); -}); - -// CLEAN DIST CSS -gulp.task('clean-css', function (cb) { - if (!__CLEAN) { - return cb() - } - del(__CLEAN_CSS).then(function () { - cb() - }); -}); - -//////////////// -// SASS TASKS // -//////////////// - -// Compile Sass -gulp.task('sass', function () { - return gulp.src(__SRC_SASS) - // (optional) sourcemaps - .pipe($.if(__SOURCEMAPS, $.sourcemaps.init())) - // Compile Sass - .pipe($.sass({ - // Resolve Sass file imports from node_modules - importer: require('sass-importer-npm') - }) - // Handle errors - .on('error', $.sass.logError)) - // Post CSS - .pipe($.postcss([ - // autoprefixer - require('autoprefixer')({ browsers: ['last 2 versions'] }) - ])) - // (optional) Minify CSS - .pipe($.if(__MINIFY, $.rename({ extname: '.min.css' }))) - .pipe($.if(__MINIFY, $.cleanCss())) - // (optional) Write .map file - .pipe($.if(__SOURCEMAPS, $.sourcemaps.write('./'))) - // Write CSS file - .pipe(gulp.dest(__DIST_CSS)) -}); - -// Clean CSS & Compile Sass -gulp.task('sass:build', function (callback) { - runSequence('clean-css', 'sass', callback) -}); - -// Watch Sass -gulp.task('sass:watch', function () { - gulp.watch(__WATCH_SASS, ['sass']) -}); - -//////////////// -// BROWSERIFY // -//////////////// - -// BROWSERIFY DEPENDENCIES -var browserify = require('browserify'); -var watchify = require('watchify'); -var source = require('vinyl-source-stream'); -var buffer = require('vinyl-buffer'); -var globby = require('globby'); -var path = require('path'); -var assign = require('lodash.assign'); - -/** - * bundleLogger - * Provides logs for browserify bundles - */ -var prettyHrtime = require('pretty-hrtime'); -var _startTime; -var bundleLogger = { - start: function (filepath) { - _startTime = process.hrtime(); - $.util.log('Bundling', $.util.colors.green(filepath) + '...'); - }, - end: function (filepath) { - var taskTime = process.hrtime(_startTime); - var prettyTime = prettyHrtime(taskTime); - $.util.log('Bundled', $.util.colors.green(filepath), 'in', $.util.colors.magenta(prettyTime)); - } -} - -// Compile Browserify bundles -gulp.task('browserify', function (callback) { - - globby(__SRC_BROWSERIFY).then(function (bundles) { - - var bundleQueue = bundles.length; - bundles = bundles.map(function (bundle) { - return { - src: bundle, - dest: __DIST_JS, - bundleName: path.basename(bundle) - } - }); - - var browserifyThis = function (bundleConfig) { - var opts = assign({}, watchify.args, { - // Specify the entry point of your app - entries: bundleConfig.src, - // Enable source maps! - debug: __DEBUG, - paths: [ - // Resolve files from node_modules - path.resolve(__dirname, 'node_modules') - ] - }); - var bundler = browserify(opts); - - var bundle = function () { - // Log when bundling starts - bundleLogger.start(path.join(bundleConfig.dest, bundleConfig.bundleName)); - - return bundler - .bundle() - // Report compile errors - .on('error', $.util.log) - // Use vinyl-source-stream to make the - // stream gulp compatible. Specifiy the - // desired output filename here. - .pipe(source(bundleConfig.bundleName)) - // buffer file contents - .pipe(buffer()) - // (optional) sourcemaps - // loads map from browserify file - .pipe($.if(__SOURCEMAPS, $.sourcemaps.init({ loadMaps: true }))) - // Add transformation tasks to the pipeline here. - // (optional) Minify CSS - .pipe($.if(__MINIFY, $.rename({ extname: '.min.js' }))) - .pipe($.if(__MINIFY, $.uglify())) - // (optional) Write .map file - .pipe($.if(__SOURCEMAPS, $.sourcemaps.write('./'))) - // Write JS file - .pipe(gulp.dest(bundleConfig.dest)) - .on('end', reportFinished) - }; - - if (global.__WATCHING) { - // Wrap with watchify and rebundle on changes - bundler = watchify(bundler); - // Rebundle on update - bundler.on('update', bundle); - } - - var reportFinished = function () { - // Log when bundling completes - bundleLogger.end(path.join(bundleConfig.dest, bundleConfig.bundleName)); - - if (bundleQueue) { - bundleQueue --; - if (bundleQueue === 0) { - // If queue is empty, tell gulp the task is complete. - // https://github.com/gulpjs/gulp/blob/master/docs/API.md#accept-a-callback - callback(); - } - } - }; - - return bundle(); - }; - - // Start bundling source files with Browserify - bundles.forEach(browserifyThis); - }); -}); - -// Clean & Compile bundles -gulp.task('browserify:build', function (callback) { - runSequence('clean-browserify', 'browserify', callback) -}); - -// Watch Browserify Bundles -gulp.task('browserify:watch', function () { - gulp.watch(__WATCH_BROWSERIFY, ['browserify']) -}); - -////////// -// HTML // -////////// - -// CLEAN DIST HTML -gulp.task('html:clean', function (cb) { - if (!__CLEAN) { return cb() } - del(__CLEAN_HTML).then(function () { cb() }); -}); - -var swigMarked = require('swig-marked'); -swigMarked.configure({ - highlight: function (code) { - return require('highlight.js').highlightAuto(code).value - } -}); - -// Compile Swig -gulp.task('html', function () { - return gulp.src(__SRC_HTML) - .pipe($.frontMatter({ property: 'data' })) - .pipe($.swig({ - defaults: { - cache: false, - loader: require('fs-resolver')([ - path.join(process.cwd(), __SRC, 'html') - ]) - }, - setup: function(swig) { - swigMarked.useTag(swig, 'markdown'); - } - })) - .pipe($.changed(__DIST, { hasChanged: $.changed.compareSha1Digest })) - .pipe(gulp.dest(__DIST)); -}); - -// Compile Swig & Prettify HTML -gulp.task('html:prettify', ['html'], function () { - return gulp.src(__DIST + '/**/*.html') - .pipe($.changed(__DIST, { hasChanged: $.changed.compareSha1Digest })) - .pipe($.prettify({ - indent: 4, - indent_inner_html: false, - preserve_newlines: true, - max_preserve_newlines: 1, - brace_style: "condense", - unformatted: [ "a", "span", "i", "pre", "code" ] - })) - .pipe(gulp.dest(__DIST)); -}); - -// Clean HTML, Compile Swig & Prettify HTML -gulp.task('html:build', function (callback) { - runSequence('html:clean', 'html:prettify', callback) -}); - -// Watch HTML -gulp.task('html:watch', ['watch:set'], function () { - gulp.watch(__WATCH_HTML, ['html:prettify']) -}); - -//////////////////////// -// COPY VENDOR ASSETS // -//////////////////////// - -gulp.task('vendor:clean', function (cb) { - if (!__CLEAN) { return cb() } - del(__CLEAN_VENDOR).then(function () { cb() }); -}); - -gulp.task('copy:vendor', ['vendor:clean'], function () { - return gulp.src(__VENDOR_ASSETS, { cwd: 'node_modules/' }) - .pipe(gulp.dest(__DIST_VENDOR)); -}); - -///////////// -// GENERAL // -///////////// - -// Called before running any watcher -// Sets a global __WATCHING flag -gulp.task('watch:set', function (cb) { - global.__WATCHING = true - cb() -}); - -// Watchers -gulp.task('watch', ['sass:watch', 'browserify:watch', 'html:watch']); - -// Default -gulp.task('default', ['copy:vendor', 'sass:build', 'browserify:build', 'html:build']); \ No newline at end of file diff --git a/demo/package.json b/demo/package.json index 9584c85..64d6ba4 100644 --- a/demo/package.json +++ b/demo/package.json @@ -1,47 +1,28 @@ { "name": "mdk-demo", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", - "deploy": "surge --project ./dist", - "serve": "lite-server" + "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", + "serve": "lite-server -c node_modules/theme-mix/bs-config.json ./dist", + "deploy": "surge --project ./dist" }, "author": "Laza Bogdan ", "license": "ISC", "dependencies": { - "bootstrap": "4.0.0-alpha.2", - "dom-factory": "^1.0.0-alpha.3", - "material-design-kit": "^1.0.0-alpha.6", + "bootstrap": "^4.5.2", + "dom-factory": "^1.0.3", + "material-design-kit": "1.0.0-alpha.22", "sass-md-colors": "^1.0.0" }, "devDependencies": { - "autoprefixer": "^6.3.3", - "browserify": "^13.0.0", - "del": "^2.2.0", - "fs-resolver": "^1.0.0", - "globby": "^4.0.0", - "gulp": "^3.9.1", - "gulp-changed": "^1.3.0", - "gulp-clean-css": "^2.0.2", - "gulp-front-matter": "^1.3.0", - "gulp-if": "^2.0.0", - "gulp-load-plugins": "^1.2.0", - "gulp-postcss": "^6.1.0", - "gulp-prettify": "^0.4.0", - "gulp-rename": "^1.2.2", - "gulp-sass": "^2.2.0", - "gulp-sourcemaps": "^1.6.0", - "gulp-swig": "^0.8.0", - "gulp-uglify": "^1.5.3", - "gulp-util": "^3.0.7", - "lite-server": "^2.2.0", - "lodash.assign": "^4.0.4", - "pretty-hrtime": "^1.0.2", - "run-sequence": "^1.2.0", - "sass-importer-npm": "^1.0.2", - "surge": "^0.17.7", - "swig-marked": "0.0.1", - "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^1.1.0", - "watchify": "^3.7.0" + "browser-sync": "^2.26.12", + "browser-sync-webpack-plugin": "^2.2.2", + "concurrently": "^3.4.0", + "cross-env": "^4.0.0", + "expose-loader": "^1.0.0", + "lite-server": "^2.5.4", + "surge": "^0.21.6", + "theme-mix": "^1.3.0" } } diff --git a/demo/src/html/_box.html b/demo/src/html/_box.html index adc0f42..32a4518 100644 --- a/demo/src/html/_box.html +++ b/demo/src/html/_box.html @@ -1,9 +1,9 @@ -{% markdown %} -# Box +

Box

-A container element for generic content with (optional) visual effects based on scroll position. +

A container element for generic content with (optional) visual effects based on scroll position.

-- [Parallax box demo](box-parallax.html) - Moves a background image at a different rate than the foreground when scrolling -- [Blend background color box demo](box-blend.html) - Changes the box background color to an interpolated color between the background and foreground when scrolling -- [Fade background color box demo](box-fade.html) - Fades the box background color when scrolling past a threshold -{% endmarkdown %} \ No newline at end of file + \ No newline at end of file diff --git a/demo/src/html/_drawer-layout.html b/demo/src/html/_drawer-layout.html index 59523a0..1703ee1 100644 --- a/demo/src/html/_drawer-layout.html +++ b/demo/src/html/_drawer-layout.html @@ -1,12 +1,12 @@ -{% markdown %} -# Drawer Layout +

Drawer Layout

-A wrapper element that positions a Drawer and other content. +

A wrapper element that positions a Drawer and other content.

-- [Basic drawer layout demo](drawer-layout.html) -- [Push drawer layout demo](drawer-layout-push.html) - Enables a push effect on the layout content when toggling the drawer -- [Right drawer layout demo](drawer-layout-right.html) - Aligns the drawer on the right -- [Force narrow drawer layout demo](drawer-layout-force-narrow.html) - Ignores the responsiveWidth option and uses the narrow layout on any screen size -- [Drawer layout with header layout demo](drawer-layout-with-header-layout.html) - Uses a Header Layout with a custom scrolling region -- [Drawer layout with custom scrolling region](drawer-layout-with-custom-scrolling.html) - Uses a custom scrolling region instead of the document -{% endmarkdown %} \ No newline at end of file + \ No newline at end of file diff --git a/demo/src/html/_drawer.html b/demo/src/html/_drawer.html index 669e553..6e8b769 100644 --- a/demo/src/html/_drawer.html +++ b/demo/src/html/_drawer.html @@ -1,9 +1,8 @@ -{% markdown %} -# Drawer +

Drawer

-A navigation drawer that can slide in from the left or right. +

A navigation drawer that can slide in from the left or right.

-- [Left drawer](drawer-left.html) - Slides in from the left -- [Right drawer](drawer-right.html) - Slides in from the right - -{% endmarkdown %} \ No newline at end of file + \ No newline at end of file diff --git a/demo/src/html/_header-layout.html b/demo/src/html/_header-layout.html index eb37f32..212869d 100644 --- a/demo/src/html/_header-layout.html +++ b/demo/src/html/_header-layout.html @@ -1,9 +1,9 @@ -{% markdown %} -# Header Layout +

Header Layout

-A wrapper element that positions a Header and other content. +

A wrapper element that positions a Header and other content.

-- [Basic header layout](header-layout.html) - Positions a header and other content in a custom scrolling region -- [Header layout within drawer](header-layout-drawer.html) - Positions a header and other content within a drawer -- [Header layout within drawer with header transform effects](header-layout-drawer-transform-fx.html) - Positions a header and other content within a drawer and use transform effects on header elements based on scroll position -{% endmarkdown %} \ No newline at end of file + \ No newline at end of file diff --git a/demo/src/html/_header.html b/demo/src/html/_header.html index 361e8aa..9eaaec5 100644 --- a/demo/src/html/_header.html +++ b/demo/src/html/_header.html @@ -1,16 +1,16 @@ -{% markdown %} -# Header +

Header

-A container element for navigation and other content at the top of the screen with (optional) visual effects based on scroll position. +

A container element for navigation and other content at the top of the screen with (optional) visual effects based on scroll position.

-- [Basic header demo #1](header.html) - Scrolls with the page -- [Basic header blend demo #2](header-blend.html) - Scrolls with the page and changes the header background color when scrolling -- [Basic parallax header demo #3](header-parallax.html) - Scrolls with the page and moves the header background image at a different rate than the foreground when scrolling -- [Condenses header demo](header-condenses.html) - Shrinks when scrolling down -- [Reveals header demo](header-reveals.html) - Slides back the header when scrolling up -- [Fixed header demo](header-fixed.html) - Stays at the top of the visible viewport when scrolling -- [Blend background color header demo](header-blend-color.html) - Changes the header background color when scrolling -- [Blend background image header demo](header-blend-image.html) - Changes the header background image when scrolling -- [Parallax and fade background header demo](header-parallax-fade.html) - Moves the header background image at a different rate than the foreground when scrolling and fades the background image into a background color after the header condenses -- [Parallax and blend background header demo](header-parallax-blend.html) -{% endmarkdown %} \ No newline at end of file + \ No newline at end of file diff --git a/demo/src/html/layouts/_footer.html b/demo/src/html/layouts/_footer.html index ca4e7ab..ebeee14 100644 --- a/demo/src/html/layouts/_footer.html +++ b/demo/src/html/layouts/_footer.html @@ -1,2 +1,8 @@ - - \ No newline at end of file + + + + + + + + \ No newline at end of file diff --git a/demo/src/html/layouts/_header.html b/demo/src/html/layouts/_header.html index 09fc3a9..87cba0b 100644 --- a/demo/src/html/layouts/_header.html +++ b/demo/src/html/layouts/_header.html @@ -8,7 +8,10 @@ - + - \ No newline at end of file + + + + \ No newline at end of file diff --git a/demo/src/html/layouts/demo.html b/demo/src/html/layouts/default.html similarity index 95% rename from demo/src/html/layouts/demo.html rename to demo/src/html/layouts/default.html index c4bd5bd..8e8a761 100644 --- a/demo/src/html/layouts/demo.html +++ b/demo/src/html/layouts/default.html @@ -1,5 +1,5 @@ - + diff --git a/demo/src/html/pages/box-blend.html b/demo/src/html/pages/box-blend.html index e99b0c9..56c81e9 100644 --- a/demo/src/html/pages/box-blend.html +++ b/demo/src/html/pages/box-blend.html @@ -1,7 +1,7 @@ --- title: Blend box --- -{% extends "layouts/demo.html" %} +{% extends "layouts/default.html" %} {% block page %} @@ -81,14 +84,14 @@

Carousel

A component for cycling through elements with Mouse Grab (desktop) and Touch support.


-