Skip to content

Commit

Permalink
Merge pull request #643 from impress/dev
Browse files Browse the repository at this point in the history
1.0.0-beta1: Merge 2 years worth of work from dev to master!

Highlights

* New plugin based architecture allows adding more features without bloating core src/impress.js file
* Source files are in src/ and compiled into js/impress.js with npm run build. End users should continue to use js/impress.js as before.
* 19 new plugins
* Integrates impressConsole.js by default (press 'P' to open speaker console)
* Markdown support for those that are too much in a hurry to type HTML
* 5 new demo presentations under examples/ show case the new features
* Removes the code that prevented impress.js from running on mobile phones
  • Loading branch information
henrikingo authored Nov 12, 2017
2 parents 525e4fc + 8a13847 commit 7354dbf
Show file tree
Hide file tree
Showing 87 changed files with 14,857 additions and 523 deletions.
30 changes: 0 additions & 30 deletions .github/CONTRIBUTING.md

This file was deleted.

5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE.md

This file was deleted.

6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/js/impress.min.js
/node_modules
/npm-debug.log
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "extras"]
path = extras
url = https://github.com/impress/impress-extras
5 changes: 5 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"preset": "jquery",
// Since we check quotemarks already in jshint, this can be turned off
"validateQuoteMarks": false
}
2 changes: 2 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"module": true
},
"boss": true,
"browser": true,
"curly": true,
"esversion": 6,
"eqeqeq": true,
"eqnull": true,
"expr": true,
Expand Down
41 changes: 37 additions & 4 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ Define the pixel based position in which the **center** of the [Step Element](#s
</div>
```

**Note:** The introduction of the [rel](src/plugins/rel/README.md) plugin includes a slight backward incompatible change.
Previously the default value for `data-x`, `data-y` and `data-z` was zero. The `rel` plugin changes the default to inherit
the value of the previous slide. This means, you need to explicitly set these values to zero, if they ever were non-zero.


#### 3D Rotation (data-rotate-x, data-rotate-y, data-rotate-z)

You can not only position a [Step Element](#step-element) in 3D, but also rotate it around any axis.
Expand All @@ -106,6 +111,13 @@ You can of course rotate it around Z axis with `data-rotate-z` - it has exactly
</div>
```

#### 3D Rotation Order (data-rotate-order)

The order in which the CSS `rotateX(), rotateY(), rotateZ()` transforms are applied matters. This is because each rotation is relative to the then current position of the element.

By default the rotation order is `data-rotate-order="xyz"`. For some advanced uses you may need to change it. The demo presentation [3D rotations](examples/3D-rotations/index.html) sets this attribute to rotate some steps into positions that are impossible to reach with the default order.


## CSS

### 4D States (.past, .present and .future classes)
Expand Down Expand Up @@ -189,6 +201,11 @@ It is recommended to add the class manually to the `body` element though, becaus
}
```

## Plugins

Many new features are implemented as plugins. The [Plugins documentation](src/plugins/README.md) is the starting place to learn about those, as well as the README.md of [each plugin](src/plugins/).


## JavaScript

### impress( [ id ] )
Expand Down Expand Up @@ -229,6 +246,21 @@ rootElement.addEventListener( "impress:init", function() {
impress().init();
```

#### .tear()

Resets the DOM to its original state, as it was before `init()` was called.

This can be used to "unload" impress.js. A particular use case for this is, if you want to do
dynamic changes to the presentation, you can do a teardown, apply changes, then call `init()`
again. (In most cases, this will not cause flickering or other visible effects to the user,
beyond the intended dynamic changes.)

**Example:**

```JavaScript
impress().tear();
```

#### .next()

Navigates to the next step of the presentation using the [`goto()` function](#impressgotostepindexstepelementidstepelement-duration).
Expand Down Expand Up @@ -300,8 +332,8 @@ Triggers the `impress:stepenter` event in the [Root Element](#root-element) when

```JavaScript
var rootElement = document.getElementById( "impress" );
rootElement.addEventListener( "impress:stepenter", function() {
var currentStep = document.querySelector( ".present" );
rootElement.addEventListener( "impress:stepenter", function(event) {
var currentStep = event.target;
console.log( "Entered the Step Element '" + currentStep.id + "'" );
});
```
Expand All @@ -312,8 +344,9 @@ Triggers the `impress:stepleave` event in the [Root Element](#root-element) when
```JavaScript
var rootElement = document.getElementById( "impress" );
rootElement.addEventListener( "impress:stepleave", function(event) {
var currentStep = event.target
console.log( "Left the Step Element '" + currentStep.id + "'" );
var currentStep = event.target;
var nextStep = event.detail.next;
console.log( "Left the Step Element '" + currentStep.id + "' and about to enter '" + nextStep.id );
});
```

Expand Down
66 changes: 55 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,28 @@ impress.js may not help you if you have nothing interesting to say ;)
HOW TO USE IT
---------------

[Use the source](index.html), Luke ;)
### Checking out and initializing the git repository

The [HTML source code](index.html) serves as a good example usage and contains comments explaning various features of impress.js. For more information about styling you can look into [CSS code](css/impress-demo.css) which shows how classes provided by impress.js can be used. Last but not least [JavaScript code of impress.js](js/impress.js) has some useful comments if you are interested in how everything works. Feel free to explore!
git clone --recursive https://github.com/impress/impress.js.git
cd impress.js

If you want more straightforward reference documentation of all impress.js features and API you can find it in [DOCUMENTATION.md](DOCUMENTATION.md).
Note: For a minimal checkout, omit the `--recursive` option. This will leave out extra plugins.

### Documentation

EXAMPLES AND OTHER LEARNING RESOURCES
---------------------------------------

Reference documentation of core impress.js features and API you can find it in [DOCUMENTATION.md](DOCUMENTATION.md).

The [HTML source code](index.html) of the official [impress.js demo](http://impress.github.io/impress.js/) serves as a good example usage and contains comments explaning various features of impress.js. For more information about styling you can look into [CSS code](css/impress-demo.css) which shows how classes provided by impress.js can be used. Last but not least [JavaScript code of impress.js](js/impress.js) has some useful comments if you are interested in how everything works. Feel free to explore!

### Official demo

[impress.js demo](http://impress.github.io/impress.js/) by [@bartaz](http://twitter.com/bartaz)

### Examples and demos

The [Classic Slides](http://impress.github.io/impress.js/examples/classic-slides/) demo is targeted towards beginners, or can be used as a template for presentations that look like the traditional PowerPoint slide deck. Over time, it also grew into the example presentation that uses most of the features and addons available.

More examples and demos can be found on [Examples and demos wiki page](http://github.com/impress/impress.js/wiki/Examples-and-demos).

Feel free to add your own example presentations (or websites) there.
Expand All @@ -41,20 +47,48 @@ on the wiki, too.

There is also a book available about [Building impressive presentations with impress.js](http://www.packtpub.com/building-impressive-presentations-with-impressjs/book) by Rakhitha Nimesh Ratnayake.

You may want to check out the sibling project [Impressionist|https://github.com/henrikingo/impressionist]: a 3D GUI editor that can help you in creating impress.js presentations.

### Mailing list

You're welcome to ask impress.js related questions on the [impressionist-presentations](https://groups.google.com/forum/#!forum/impressionist-presentations) mailing list.


REPOSITORY STRUCTURE
--------------------

* [index.html](index.html): This is the official impress.js demo, showcasing all of the features of the original impress.js, as well as some new plugins as we add them.
* As already mentioned, this file is well commented and acts as the official tutorial.
* [examples/](examples/): Contains several demos showcasing additional features available.
* [Classic Slides](examples/classic-slides/index.html) is a simple demo that that you can use as template if you want to create very simple, rectangular, PowerPoint-like presentations.
* [src/](src/): The main file is [src/impress.js](src/impress.js). Additional functionality is implemented as plugins in [src/plugins/](src/plugins/).
* See [src/plugins/README.md](src/plugins/README.md) for information about the plugin API and how to write plugins.
* [test/](test/): Contains QUnit and Syn libraries that we use for writing tests, as well as some test coverage for core functionality. (Yes, more tests are much welcome.) Tests for plugins are in the directory of each plugin.
* [js/](js/): Contains [js/impress.js](js/impress.js), which contains a concatenation of the core `src/impress.js` and all the plugins. Traditionally this is the file that you'll link to in a browser. In fact both the demo and test files do exactly that.
* [css/](css/]: Contains a CSS file used by the demo. This file is **not required for using impress.js** in your own presentations. Impress.js creates the CSS it needs dynamically.
* [extras/](extras/) contains plugins that for various reasons aren't enabled by default. You have to explicitly add them with their own `script` element to use them.
* [build.js](build.js): Simple build file that creates `js/impress.js`. It also creates a minified version `impress.min.js`, but that one is not included in the github repository.
* [package.json](build.js): An NPM package specification. This was mainly added so you can easily install [buildify](https://www.npmjs.com/package/buildify) and run `node build.js`. Other than the build process, which is really just doing roughly `cat src/impress.js src/plugins/*/*.js > js/impress.js`, and testing, `impress.js` itself doesn't depend on Node or any NPM modules.
* [bower.json](bower.json): A Bower package file. We also don't depend on Bower, but provide this file if you want to use it.

WANT TO CONTRIBUTE?
---------------------

Please, read the [contributing guidelines](.github/CONTRIBUTING.md) on how to create [Issues](.github/CONTRIBUTING.md#issues) and [Pull Requests](.github/CONTRIBUTING.md#pull-requests).
For developers, once you've made changes to the code, you should run these commands for testing:

**Note:** The team has changed, so there will be many changes in the upcoming versions.
If you need informations about versions, check the [changelog](CHANGELOG.md).
npm run build
npm run test
npm run lint

Note that running `firefox qunit_test_runner.html` is usually more informative than running `karma` with `npm run test`. They both run the same tests.

More info about the [src/](src/) directory can be found in [src/plugins/README.md](src/plugins/README.md).


ABOUT THE NAME
----------------

impress.js name in [courtesy of @skuzniak](http://twitter.com/skuzniak/status/143627215165333504).
impress.js name is [courtesy of @skuzniak](http://twitter.com/skuzniak/status/143627215165333504).

It's an (un)fortunate coincidence that a Open/LibreOffice presentation tool is called Impress ;)

Expand All @@ -66,11 +100,21 @@ See the [Reference API](DOCUMENTATION.md)
BROWSER SUPPORT
-----------------

This project supports only the major [evergreen](http://eisenbergeffect.bluespire.com/evergreen-browsers/) desktop browsers that have implemented:
The design goal for impress.js has been to showcase awesome CSS3 features as found in modern browser versions. We also use some new DOM functionality, and specifically do not use jQuery or any other JavaScript libraries, nor our own functions, to support older browsers. In general, recent versions of Firefox and Chrome are known to work well. Reportedly IE now works too.

The typical use case for impress.js is to create presentations that you present from your own laptop, with a browser version you know works well. Some people also use impress.js successfully to embed animations or presentations in a web page, however, be aware that in this some of your visitors may not see the presentation correctly, or at all.

In particular, impress.js makes use of the following JS and CSS features:

* [DataSet API](http://caniuse.com/#search=dataset)
* [ClassList API](http://caniuse.com/#search=classlist)
* [CSS 3D Transforms](http://caniuse.com/#search=css%203d)
* [CSS Transitions](http://caniuse.com/#search=css%20transition)

Copyright 2011-2016 Bartek Szopka - Released under the MIT [License](LICENSE)
COPYRIGHT AND LICENSE
---------------------

Copyright 2011-2016 Bartek Szopka
Copyright 2015-2017 Henrik Ingo

Released under the MIT [License](LICENSE)
56 changes: 56 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
var buildify = require('buildify');


buildify()
.load('src/impress.js')
// Libraries from src/lib
.concat(['src/lib/gc.js'])
.concat(['src/lib/util.js'])
// Plugins from src/plugins
.concat(['src/plugins/autoplay/autoplay.js',
'src/plugins/blackout/blackout.js',
'src/plugins/extras/extras.js',
'src/plugins/form/form.js',
'src/plugins/goto/goto.js',
'src/plugins/help/help.js',
'src/plugins/impressConsole/impressConsole.js',
'src/plugins/mobile/mobile.js',
'src/plugins/mouse-timeout/mouse-timeout.js',
'src/plugins/navigation/navigation.js',
'src/plugins/navigation-ui/navigation-ui.js',
'src/plugins/progress/progress.js',
'src/plugins/rel/rel.js',
'src/plugins/resize/resize.js',
'src/plugins/skip/skip.js',
'src/plugins/stop/stop.js',
'src/plugins/substep/substep.js',
'src/plugins/touch/touch.js',
'src/plugins/toolbar/toolbar.js'])
.save('js/impress.js');
/*
* Disabled until uglify supports ES6: https://github.com/mishoo/UglifyJS2/issues/448
.uglify()
.save('js/impress.min.js');
*/


/* Auto generate an index.html that lists all the directories under examples/
* This is useful for gh-pages, so you can link to http://impress.github.io/impress.js/examples
*/
var ls = require('ls');
var fs = require('fs');
var path = require('path');

var html_list = '<ul><br />\n'
ls( 'examples/*', { type: 'dir' }).forEach(function(dir) {
html_list += ' <li><a href="' + dir['file'] + '/">' + dir['name'] + '</a></li>\n';
});
html_list += '</ul>\n'

var html = '<html>\n<head>\n<title>Example presentations</title>\n</head>\n<body>'
html += '<h1>Example presentations</h1>\n' + html_list
html += '</body>\n</html>'

var filename = path.resolve(__dirname, 'examples', 'index.html');
fs.writeFileSync(filename, html);
console.log(filename);
38 changes: 34 additions & 4 deletions css/impress-demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ a:focus {
}

#title h1 {
font-size: 190px;
font-size: 180px;

-webkit-transform: translateZ(50px);
-moz-transform: translateZ(50px);
Expand All @@ -294,6 +294,7 @@ a:focus {
line-height: 1;
}

#big strong,
#big b {
display: block;
font-size: 250px;
Expand Down Expand Up @@ -527,6 +528,35 @@ a:focus {
cursor: pointer;
}

/*
This version of impress.js supports plugins, and in particular, a UI toolbar
plugin that allows easy navigation between steps and autoplay.
*/
.impress-enabled div#impress-toolbar {
position: fixed;
right: 1px;
bottom: 1px;
opacity: 0.6;
}
.impress-enabled div#impress-toolbar > span {
margin-right: 10px;
}

/*
With help from the mouse-timeout plugin, we can hide the toolbar and
have it show only when you move/click/touch the mouse.
*/
body.impress-mouse-timeout div#impress-toolbar {
display: none;
}

/*
In fact, we can hide the mouse cursor itself too, when mouse isn't used.
*/
body.impress-mouse-timeout {
cursor: none;
}


/*
Now, when we have all the steps styled let's give users a hint how to navigate
Expand Down Expand Up @@ -682,9 +712,9 @@ a:focus {
So use it wisely ... or don't use at all.
*/
.impress-enabled { pointer-events: none }
.impress-enabled #impress { pointer-events: auto }

.impress-enabled { pointer-events: none }
.impress-enabled #impress { pointer-events: auto }
.impress-enabled #impress-toolbar { pointer-events: auto }
/*
There is one funny thing I just realized.
Expand Down
Loading

0 comments on commit 7354dbf

Please sign in to comment.