Skip to content

Commit 7354dbf

Browse files
authored
Merge pull request impress#643 from impress/dev
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
2 parents 525e4fc + 8a13847 commit 7354dbf

87 files changed

Lines changed: 14857 additions & 523 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/CONTRIBUTING.md‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE.md‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
/js/impress.min.js
12
/node_modules
23
/npm-debug.log

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "extras"]
2+
path = extras
3+
url = https://github.com/impress/impress-extras

‎.jscsrc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"preset": "jquery",
3+
// Since we check quotemarks already in jshint, this can be turned off
4+
"validateQuoteMarks": false
5+
}

‎.jshintrc‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"module": true
44
},
55
"boss": true,
6+
"browser": true,
67
"curly": true,
8+
"esversion": 6,
79
"eqeqeq": true,
810
"eqnull": true,
911
"expr": true,

‎DOCUMENTATION.md‎

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ Define the pixel based position in which the **center** of the [Step Element](#s
8282
</div>
8383
```
8484

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

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

114+
#### 3D Rotation Order (data-rotate-order)
115+
116+
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.
117+
118+
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.
119+
120+
109121
## CSS
110122

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

204+
## Plugins
205+
206+
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/).
207+
208+
192209
## JavaScript
193210

194211
### impress( [ id ] )
@@ -229,6 +246,21 @@ rootElement.addEventListener( "impress:init", function() {
229246
impress().init();
230247
```
231248

249+
#### .tear()
250+
251+
Resets the DOM to its original state, as it was before `init()` was called.
252+
253+
This can be used to "unload" impress.js. A particular use case for this is, if you want to do
254+
dynamic changes to the presentation, you can do a teardown, apply changes, then call `init()`
255+
again. (In most cases, this will not cause flickering or other visible effects to the user,
256+
beyond the intended dynamic changes.)
257+
258+
**Example:**
259+
260+
```JavaScript
261+
impress().tear();
262+
```
263+
232264
#### .next()
233265

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

301333
```JavaScript
302334
var rootElement = document.getElementById( "impress" );
303-
rootElement.addEventListener( "impress:stepenter", function() {
304-
var currentStep = document.querySelector( ".present" );
335+
rootElement.addEventListener( "impress:stepenter", function(event) {
336+
var currentStep = event.target;
305337
console.log( "Entered the Step Element '" + currentStep.id + "'" );
306338
});
307339
```
@@ -312,8 +344,9 @@ Triggers the `impress:stepleave` event in the [Root Element](#root-element) when
312344
```JavaScript
313345
var rootElement = document.getElementById( "impress" );
314346
rootElement.addEventListener( "impress:stepleave", function(event) {
315-
var currentStep = event.target
316-
console.log( "Left the Step Element '" + currentStep.id + "'" );
347+
var currentStep = event.target;
348+
var nextStep = event.detail.next;
349+
console.log( "Left the Step Element '" + currentStep.id + "' and about to enter '" + nextStep.id );
317350
});
318351
```
319352

‎README.md‎

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,28 @@ impress.js may not help you if you have nothing interesting to say ;)
1414
HOW TO USE IT
1515
---------------
1616

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

19-
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!
19+
git clone --recursive https://github.com/impress/impress.js.git
20+
cd impress.js
2021

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

24+
### Documentation
2325

24-
EXAMPLES AND OTHER LEARNING RESOURCES
25-
---------------------------------------
26+
27+
Reference documentation of core impress.js features and API you can find it in [DOCUMENTATION.md](DOCUMENTATION.md).
28+
29+
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!
2630

2731
### Official demo
2832

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

3135
### Examples and demos
3236

37+
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.
38+
3339
More examples and demos can be found on [Examples and demos wiki page](http://github.com/impress/impress.js/wiki/Examples-and-demos).
3440

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

4248
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.
4349

50+
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.
51+
52+
### Mailing list
53+
54+
You're welcome to ask impress.js related questions on the [impressionist-presentations](https://groups.google.com/forum/#!forum/impressionist-presentations) mailing list.
55+
56+
57+
REPOSITORY STRUCTURE
58+
--------------------
59+
60+
* [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.
61+
* As already mentioned, this file is well commented and acts as the official tutorial.
62+
* [examples/](examples/): Contains several demos showcasing additional features available.
63+
* [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.
64+
* [src/](src/): The main file is [src/impress.js](src/impress.js). Additional functionality is implemented as plugins in [src/plugins/](src/plugins/).
65+
* See [src/plugins/README.md](src/plugins/README.md) for information about the plugin API and how to write plugins.
66+
* [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.
67+
* [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.
68+
* [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.
69+
* [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.
70+
* [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.
71+
* [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.
72+
* [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.
4473

4574
WANT TO CONTRIBUTE?
4675
---------------------
4776

48-
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).
77+
For developers, once you've made changes to the code, you should run these commands for testing:
4978

50-
**Note:** The team has changed, so there will be many changes in the upcoming versions.
51-
If you need informations about versions, check the [changelog](CHANGELOG.md).
79+
npm run build
80+
npm run test
81+
npm run lint
82+
83+
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.
84+
85+
More info about the [src/](src/) directory can be found in [src/plugins/README.md](src/plugins/README.md).
5286

5387

5488
ABOUT THE NAME
5589
----------------
5690

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

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

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

69-
This project supports only the major [evergreen](http://eisenbergeffect.bluespire.com/evergreen-browsers/) desktop browsers that have implemented:
103+
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.
104+
105+
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.
106+
107+
In particular, impress.js makes use of the following JS and CSS features:
70108

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

76-
Copyright 2011-2016 Bartek Szopka - Released under the MIT [License](LICENSE)
114+
COPYRIGHT AND LICENSE
115+
---------------------
116+
117+
Copyright 2011-2016 Bartek Szopka
118+
Copyright 2015-2017 Henrik Ingo
119+
120+
Released under the MIT [License](LICENSE)

‎build.js‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
var buildify = require('buildify');
2+
3+
4+
buildify()
5+
.load('src/impress.js')
6+
// Libraries from src/lib
7+
.concat(['src/lib/gc.js'])
8+
.concat(['src/lib/util.js'])
9+
// Plugins from src/plugins
10+
.concat(['src/plugins/autoplay/autoplay.js',
11+
'src/plugins/blackout/blackout.js',
12+
'src/plugins/extras/extras.js',
13+
'src/plugins/form/form.js',
14+
'src/plugins/goto/goto.js',
15+
'src/plugins/help/help.js',
16+
'src/plugins/impressConsole/impressConsole.js',
17+
'src/plugins/mobile/mobile.js',
18+
'src/plugins/mouse-timeout/mouse-timeout.js',
19+
'src/plugins/navigation/navigation.js',
20+
'src/plugins/navigation-ui/navigation-ui.js',
21+
'src/plugins/progress/progress.js',
22+
'src/plugins/rel/rel.js',
23+
'src/plugins/resize/resize.js',
24+
'src/plugins/skip/skip.js',
25+
'src/plugins/stop/stop.js',
26+
'src/plugins/substep/substep.js',
27+
'src/plugins/touch/touch.js',
28+
'src/plugins/toolbar/toolbar.js'])
29+
.save('js/impress.js');
30+
/*
31+
* Disabled until uglify supports ES6: https://github.com/mishoo/UglifyJS2/issues/448
32+
.uglify()
33+
.save('js/impress.min.js');
34+
*/
35+
36+
37+
/* Auto generate an index.html that lists all the directories under examples/
38+
* This is useful for gh-pages, so you can link to http://impress.github.io/impress.js/examples
39+
*/
40+
var ls = require('ls');
41+
var fs = require('fs');
42+
var path = require('path');
43+
44+
var html_list = '<ul><br />\n'
45+
ls( 'examples/*', { type: 'dir' }).forEach(function(dir) {
46+
html_list += ' <li><a href="' + dir['file'] + '/">' + dir['name'] + '</a></li>\n';
47+
});
48+
html_list += '</ul>\n'
49+
50+
var html = '<html>\n<head>\n<title>Example presentations</title>\n</head>\n<body>'
51+
html += '<h1>Example presentations</h1>\n' + html_list
52+
html += '</body>\n</html>'
53+
54+
var filename = path.resolve(__dirname, 'examples', 'index.html');
55+
fs.writeFileSync(filename, html);
56+
console.log(filename);

0 commit comments

Comments
 (0)