Skip to content

Commit 3750f9c

Browse files
committed
Moved web-animations-js polyfill back outside of the library
Closes #91 and #92
1 parent 7b30d89 commit 3750f9c

File tree

7 files changed

+43
-13
lines changed

7 files changed

+43
-13
lines changed

components/collapse/collapse.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {Directive, ElementRef, Input, HostBinding, Renderer2, HostListener} from '@angular/core';
2-
import "web-animations-js";
32

43
@Directive({
54
selector: '[suiCollapse]'

demo/src/app/pages/accordion/accordion.page.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@
66
</demo-page-title>
77
<demo-page-content>
88
<h2 class="ui dividing header">Examples</h2>
9+
10+
<sui-message class="warning" [isDismissable]="false">
11+
<div class="header">Important Note</div>
12+
<p>
13+
The accordion depends on the Web Animations API, which requires a polyfill for full browser
14+
support. Read the <a routerLink="/components/collapse">collapse docs</a> for guidance.
15+
</p>
16+
</sui-message>
17+
<br>
18+
919
<demo-example [code]="exampleStandardTemplate">
1020
<div info>
1121
<h4 class="ui header">Accordion</h4>
@@ -23,7 +33,10 @@ <h4 class="ui header">Styled</h4>
2333
<demo-example [code]="exampleManualTemplate">
2434
<div info>
2535
<h4 class="ui header">Manual</h4>
26-
<p>By using <code>isDisabled</code> and <code>isOpen</code> you can change the element controlling the accordion. Click the arrow to open the panel.</p>
36+
<p>
37+
By using <code>isDisabled</code> and <code>isOpen</code> you can change
38+
the element controlling the accordion. Click the arrow to open the panel.
39+
</p>
2740
</div>
2841
<accordion-example-manual result></accordion-example-manual>
2942
</demo-example>

demo/src/app/pages/collapse/collapse.page.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ <h4 class="ui header">Collapse</h4>
1414
<collapse-example-standard result></collapse-example-standard>
1515
</demo-example>
1616

17+
<sui-message class="warning" [isDismissable]="false">
18+
<div class="header">Important Note</div>
19+
<p>The collapse component uses the <a href="https://w3c.github.io/web-animations/">Web Animations API.</a></p>
20+
<p>
21+
This isn't yet supported in all browsers so if using this
22+
component please use the <code>web-animations-js</code> polyfill:
23+
</p>
24+
<div class="ui segment">
25+
<demo-codeblock language="bash" [src]="polyfillInstall"></demo-codeblock>
26+
</div>
27+
<p>Then import it in <code>polyfills.ts</code>:
28+
<div class="ui segment">
29+
<demo-codeblock language="bash" [src]="polyfillInclude"></demo-codeblock>
30+
</div>
31+
</sui-message>
32+
1733
<h2 id="api" class="ui dividing header">API</h2>
1834
<demo-api [api]="api"></demo-api>
1935
</demo-page-content>

demo/src/app/pages/collapse/collapse.page.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ export class CollapsePage {
4444
}
4545
];
4646
public exampleStandardTemplate = exampleStandardTemplate;
47+
48+
public polyfillInstall = `$ npm install web-animations-js --save`;
49+
public polyfillInclude = `import 'web-animations-js';`;
4750
}
4851

4952
@Component({

demo/src/polyfills.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ import 'core-js/es6/reflect';
1717

1818
import 'core-js/es7/reflect';
1919
import 'zone.js/dist/zone';
20+
21+
import 'web-animations-js';

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"main": "bundles/ng2-semantic-ui.umd.min.js",
44
"module": "index.js",
55
"typings": "index.d.ts",
6-
"version": "0.8.1",
6+
"version": "0.8.2",
77
"description": "Angular 2 Semantic UI Components",
88
"repository": {
99
"type": "git",
@@ -38,22 +38,20 @@
3838
"@types/popper.js": "^1.8.0",
3939
"element-closest": "^2.0.2",
4040
"popper.js": "^1.0.6",
41-
"rxjs": "^5.0.1",
42-
"web-animations-js": "^2.2.5"
41+
"rxjs": "^5.0.1"
4342
},
4443
"devDependencies": {
45-
"core-js": "^2.4.1",
46-
"zone.js": "^0.8.4",
4744
"@angular/cli": "^1.0.0",
48-
"@angular/http": "^4.1.0",
49-
"@angular/platform-browser": "^4.1.0",
5045
"@angular/compiler": "^4.1.0",
5146
"@angular/compiler-cli": "^4.1.0",
47+
"@angular/http": "^4.1.0",
48+
"@angular/platform-browser": "^4.1.0",
5249
"@angular/platform-browser-dynamic": "^4.1.0",
5350
"@angular/router": "^4.1.0",
5451
"@types/prismjs": "~1.4.18",
5552
"@types/protractor": "~4.0.0",
5653
"codelyzer": "~2.0.0-beta.4",
54+
"core-js": "^2.4.1",
5755
"jasmine-core": "~2.5.2",
5856
"jasmine-spec-reporter": "~3.2.0",
5957
"karma": "~1.4.0",
@@ -68,7 +66,9 @@
6866
"rollup-plugin-uglify": "~1.0.1",
6967
"ts-node": "~2.0.0",
7068
"tslint": "~4.3.1",
71-
"typescript": "^2.3.0"
69+
"typescript": "^2.3.0",
70+
"web-animations-js": "^2.2.5",
71+
"zone.js": "^0.8.4"
7272
},
7373
"peerDependencies": {
7474
"typescript": "^2.3.0"

rollup.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export default {
3131
commonjs({
3232
include: [
3333
'node_modules/element-closest/**',
34-
'node_modules/web-animations-js/**',
3534
'node_modules/popper.js/**'
3635
]
3736
}),
@@ -41,8 +40,6 @@ export default {
4140
'@angular/common',
4241
'@angular/core',
4342
'@angular/forms',
44-
'@angular/http',
45-
'@angular/platform-browser',
4643
'rxjs/Subscription',
4744
],
4845
}

0 commit comments

Comments
 (0)