@ohos-ports/polymer-paper-spinner 0.0.0-stage → 3.0.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +77 -0
- package/README.md +66 -2
- package/bower.json +4 -0
- package/demo/index.html +109 -0
- package/hero.svg +27 -0
- package/manifest.json +38 -0
- package/package.json +21 -4
- package/paper-spinner-behavior.d.ts +29 -0
- package/paper-spinner-behavior.js +73 -0
- package/paper-spinner-lite.d.ts +57 -0
- package/paper-spinner-lite.js +75 -0
- package/paper-spinner-styles.d.ts +12 -0
- package/paper-spinner-styles.js +346 -0
- package/paper-spinner.d.ts +62 -0
- package/paper-spinner.js +107 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
This file is autogenerated based on
|
|
3
|
+
https://github.com/PolymerElements/ContributionGuide/blob/master/CONTRIBUTING.md
|
|
4
|
+
|
|
5
|
+
If you edit that file, it will get updated everywhere else.
|
|
6
|
+
If you edit this file, your changes will get overridden :)
|
|
7
|
+
|
|
8
|
+
You can however override the jsbin link with one that's customized to this
|
|
9
|
+
specific element:
|
|
10
|
+
|
|
11
|
+
jsbin=https://jsbin.com/cagaye/edit?html,output
|
|
12
|
+
-->
|
|
13
|
+
|
|
14
|
+
# Polymer Elements
|
|
15
|
+
## Guide for Contributors
|
|
16
|
+
|
|
17
|
+
Polymer Elements are built in the open, and the Polymer authors eagerly encourage any and all forms of community contribution. When contributing, please follow these guidelines:
|
|
18
|
+
|
|
19
|
+
### Filing Issues
|
|
20
|
+
|
|
21
|
+
**If you are filing an issue to request a feature**, please provide a clear description of the feature. It can be helpful to describe answers to the following questions:
|
|
22
|
+
|
|
23
|
+
1. **Who will use the feature?** _“As someone filling out a form…”_
|
|
24
|
+
2. **When will they use the feature?** _“When I enter an invalid value…”_
|
|
25
|
+
3. **What is the user’s goal?** _“I want to be visually notified that the value needs to be corrected…”_
|
|
26
|
+
|
|
27
|
+
**If you are filing an issue to report a bug**, please provide:
|
|
28
|
+
|
|
29
|
+
1. **A clear description of the bug and related expectations.** Consider using the following example template for reporting a bug:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
The `paper-foo` element causes the page to turn pink when clicked.
|
|
33
|
+
|
|
34
|
+
## Expected outcome
|
|
35
|
+
|
|
36
|
+
The page stays the same color.
|
|
37
|
+
|
|
38
|
+
## Actual outcome
|
|
39
|
+
|
|
40
|
+
The page turns pink.
|
|
41
|
+
|
|
42
|
+
## Steps to reproduce
|
|
43
|
+
|
|
44
|
+
1. Put a `paper-foo` element in the page.
|
|
45
|
+
2. Open the page in a web browser.
|
|
46
|
+
3. Click the `paper-foo` element.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. **A reduced test case that demonstrates the problem.** If possible, please include the test case as a JSBin. Start with this template to easily import and use relevant Polymer Elements: [https://jsbin.com/cagaye/edit?html,output](https://jsbin.com/cagaye/edit?html,output).
|
|
50
|
+
|
|
51
|
+
3. **A list of browsers where the problem occurs.** This can be skipped if the problem is the same across all browsers.
|
|
52
|
+
|
|
53
|
+
### Submitting Pull Requests
|
|
54
|
+
|
|
55
|
+
**Before creating a pull request**, please ensure that an issue exists for the corresponding change in the pull request that you intend to make. **If an issue does not exist, please create one per the guidelines above**. The goal is to discuss the design and necessity of the proposed change with Polymer authors and community before diving into a pull request.
|
|
56
|
+
|
|
57
|
+
When submitting pull requests, please provide:
|
|
58
|
+
|
|
59
|
+
1. **A reference to the corresponding issue** or issues that will be closed by the pull request. Please refer to these issues in the pull request description using the following syntax:
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
(For a single issue)
|
|
63
|
+
Fixes #20
|
|
64
|
+
|
|
65
|
+
(For multiple issues)
|
|
66
|
+
Fixes #32, fixes #40
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
2. **A succinct description of the design** used to fix any related issues. For example:
|
|
70
|
+
|
|
71
|
+
```markdown
|
|
72
|
+
This fixes #20 by removing styles that leaked which would cause the page to turn pink whenever `paper-foo` is clicked.
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
3. **At least one test for each bug fixed or feature added** as part of the pull request. Pull requests that fix bugs or add features without accompanying tests will not be considered.
|
|
76
|
+
|
|
77
|
+
If a proposed change contains multiple commits, please [squash commits](https://www.google.com/url?q=http://blog.steveklabnik.com/posts/2012-11-08-how-to-squash-commits-in-a-github-pull-request) to as few as is necessary to succinctly express the change. A Polymer author can help you squash commits, so don’t be afraid to ask us if you need help with that!
|
package/README.md
CHANGED
|
@@ -1,3 +1,67 @@
|
|
|
1
|
-
|
|
1
|
+
[](https://www.npmjs.com/package/@polymer/paper-spinner)
|
|
2
|
+
[](https://travis-ci.org/PolymerElements/paper-spinner)
|
|
3
|
+
[](https://webcomponents.org/element/@polymer/paper-spinner)
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
## <paper-spinner>
|
|
6
|
+
Element providing a multiple color material design circular spinner.
|
|
7
|
+
|
|
8
|
+
See: [Documentation](https://www.webcomponents.org/element/@polymer/paper-spinner),
|
|
9
|
+
[Demo](https://www.webcomponents.org/element/@polymer/paper-spinner/demo/demo/index.html).
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
```
|
|
15
|
+
npm install --save @polymer/paper-spinner
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### In an html file
|
|
19
|
+
```html
|
|
20
|
+
<html>
|
|
21
|
+
<head>
|
|
22
|
+
<script type="module">
|
|
23
|
+
import '@polymer/paper-spinner/paper-spinner.js';
|
|
24
|
+
</script>
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<paper-spinner active></paper-spinner>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
30
|
+
```
|
|
31
|
+
### In a Polymer 3 element
|
|
32
|
+
```js
|
|
33
|
+
import {PolymerElement, html} from '@polymer/polymer';
|
|
34
|
+
import '@polymer/paper-spinner/paper-spinner.js';
|
|
35
|
+
|
|
36
|
+
class SampleElement extends PolymerElement {
|
|
37
|
+
static get template() {
|
|
38
|
+
return html`
|
|
39
|
+
<paper-spinner active></paper-spinner>
|
|
40
|
+
`;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
customElements.define('sample-element', SampleElement);
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Contributing
|
|
47
|
+
If you want to send a PR to this element, here are
|
|
48
|
+
the instructions for running the tests and demo locally:
|
|
49
|
+
|
|
50
|
+
### Installation
|
|
51
|
+
```sh
|
|
52
|
+
git clone https://github.com/PolymerElements/paper-spinner
|
|
53
|
+
cd paper-spinner
|
|
54
|
+
npm install
|
|
55
|
+
npm install -g polymer-cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Running the demo locally
|
|
59
|
+
```sh
|
|
60
|
+
polymer serve --npm
|
|
61
|
+
open http://127.0.0.1:<port>/demo/
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Running the tests
|
|
65
|
+
```sh
|
|
66
|
+
polymer test --npm
|
|
67
|
+
```
|
package/bower.json
ADDED
package/demo/index.html
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<!--
|
|
3
|
+
@license
|
|
4
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
5
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
|
6
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
|
7
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
|
8
|
+
Code distributed by Google as part of the polymer project is also
|
|
9
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
|
10
|
+
-->
|
|
11
|
+
<html lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<title>paper-spinner demo</title>
|
|
14
|
+
|
|
15
|
+
<meta charset="UTF-8">
|
|
16
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
17
|
+
<meta name="mobile-web-app-capable" content="yes">
|
|
18
|
+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
|
|
19
|
+
|
|
20
|
+
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@^2.0.0/webcomponents-loader.js"></script>
|
|
21
|
+
|
|
22
|
+
<script type="module">
|
|
23
|
+
import '@polymer/iron-demo-helpers/demo-snippet.js';
|
|
24
|
+
import '@polymer/iron-demo-helpers/demo-pages-shared-styles.js';
|
|
25
|
+
import '@ohos-ports/polymer-paper-styles/color.js';
|
|
26
|
+
import '../paper-spinner-lite.js';
|
|
27
|
+
import '../paper-spinner.js';
|
|
28
|
+
|
|
29
|
+
import {html} from '@ohos-ports/polymer-polymer/lib/utils/html-tag.js';
|
|
30
|
+
const template = html
|
|
31
|
+
`<custom-style><style is="custom-style" include="demo-pages-shared-styles"></style></custom-style>`;
|
|
32
|
+
document.body.appendChild(template.content);
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<custom-style>
|
|
36
|
+
<style is="custom-style">
|
|
37
|
+
.vertical-section-container {
|
|
38
|
+
max-width: 550px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
paper-spinner, paper-spinner-lite {
|
|
42
|
+
margin-right: 24px;
|
|
43
|
+
}
|
|
44
|
+
</style>
|
|
45
|
+
</custom-style>
|
|
46
|
+
</head>
|
|
47
|
+
<body unresolved>
|
|
48
|
+
<div class="vertical-section-container centered">
|
|
49
|
+
<h3>Spinners can be deactivated or activated</h3>
|
|
50
|
+
<demo-snippet class="centered-demo">
|
|
51
|
+
<template>
|
|
52
|
+
<paper-spinner></paper-spinner>
|
|
53
|
+
<paper-spinner active></paper-spinner>
|
|
54
|
+
|
|
55
|
+
<paper-spinner-lite></paper-spinner-lite>
|
|
56
|
+
<paper-spinner-lite active></paper-spinner-lite>
|
|
57
|
+
|
|
58
|
+
<button onclick="toggle(event)">Toggle</button>
|
|
59
|
+
</template>
|
|
60
|
+
</demo-snippet>
|
|
61
|
+
|
|
62
|
+
<h3>Spinners can be styled using custom properties</h3>
|
|
63
|
+
<demo-snippet class="centered-demo">
|
|
64
|
+
<template>
|
|
65
|
+
<custom-style>
|
|
66
|
+
<style is="custom-style">
|
|
67
|
+
paper-spinner.multi {
|
|
68
|
+
--paper-spinner-layer-1-color: var(--paper-purple-500);
|
|
69
|
+
--paper-spinner-layer-2-color: var(--paper-cyan-500);
|
|
70
|
+
--paper-spinner-layer-3-color: var(--paper-blue-grey-500);
|
|
71
|
+
--paper-spinner-layer-4-color: var(--paper-amber-500);
|
|
72
|
+
}
|
|
73
|
+
paper-spinner-lite.orange {
|
|
74
|
+
--paper-spinner-color: var(--google-yellow-500);
|
|
75
|
+
}
|
|
76
|
+
paper-spinner-lite.green {
|
|
77
|
+
--paper-spinner-color: var(--google-green-500);
|
|
78
|
+
}
|
|
79
|
+
paper-spinner-lite.thin {
|
|
80
|
+
--paper-spinner-stroke-width: 1px;
|
|
81
|
+
}
|
|
82
|
+
paper-spinner-lite.thick {
|
|
83
|
+
--paper-spinner-stroke-width: 6px;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
86
|
+
</custom-style>
|
|
87
|
+
|
|
88
|
+
<paper-spinner class="multi" active></paper-spinner>
|
|
89
|
+
|
|
90
|
+
<paper-spinner-lite class="orange" active></paper-spinner-lite>
|
|
91
|
+
<paper-spinner-lite class="green" active></paper-spinner-lite>
|
|
92
|
+
|
|
93
|
+
<paper-spinner-lite class="thin" active></paper-spinner-lite>
|
|
94
|
+
<paper-spinner-lite class="thick" active></paper-spinner-lite>
|
|
95
|
+
</template>
|
|
96
|
+
</demo-snippet>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<script>
|
|
100
|
+
function toggle(event) {
|
|
101
|
+
var spinners = event.target.parentElement.querySelectorAll(
|
|
102
|
+
'paper-spinner, paper-spinner-lite');
|
|
103
|
+
Array.prototype.forEach.call(spinners, function(spinner) {
|
|
104
|
+
spinner.active = !spinner.active;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
</script>
|
|
108
|
+
</body>
|
|
109
|
+
</html>
|
package/hero.svg
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
|
3
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
5
|
+
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
|
6
|
+
<g id="background" display="none">
|
|
7
|
+
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g id="label">
|
|
10
|
+
</g>
|
|
11
|
+
<g id="art">
|
|
12
|
+
<g>
|
|
13
|
+
<path d="M112.1,92.3c-13.4,0-25.1-9.1-28.4-22l1.9-0.5c3.1,12.1,13.9,20.5,26.4,20.5c15,0,27.3-12.2,27.3-27.3
|
|
14
|
+
s-12.2-27.3-27.3-27.3c-8.1,0-15.8,3.6-21,9.8l-1.5-1.3c5.6-6.7,13.8-10.6,22.5-10.6c16.1,0,29.3,13.1,29.3,29.3
|
|
15
|
+
S128.2,92.3,112.1,92.3z"/>
|
|
16
|
+
<path d="M112.7,87.3c-6.6,0-12.7-2.5-17.3-7.2c-4.6-4.6-7.2-10.8-7.2-17.3c0-6.6,2.5-12.7,7.2-17.3c7.9-7.9,20.2-9.5,29.8-3.8
|
|
17
|
+
l-1,1.7c-8.8-5.3-20.1-3.8-27.4,3.5c-4.2,4.2-6.6,9.9-6.6,15.9s2.3,11.7,6.6,15.9s9.9,6.6,15.9,6.6c6,0,11.7-2.3,15.9-6.6
|
|
18
|
+
c4.7-4.7,7.1-11.3,6.5-18l2-0.2c0.7,7.3-1.9,14.4-7.1,19.6C125.4,84.7,119.2,87.3,112.7,87.3z"/>
|
|
19
|
+
<path d="M112.5,43.5C101.8,43.5,93,52.3,93,63s8.7,19.5,19.5,19.5S132,73.7,132,63S123.2,43.5,112.5,43.5z M119,64h-6v6h-2v-6h-6
|
|
20
|
+
v-2h6v-6h2v6h6V64z"/>
|
|
21
|
+
</g>
|
|
22
|
+
<g id="ic_x5F_add_x0D_">
|
|
23
|
+
</g>
|
|
24
|
+
</g>
|
|
25
|
+
<g id="Guides">
|
|
26
|
+
</g>
|
|
27
|
+
</svg>
|
package/manifest.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": {
|
|
3
|
+
"paper-spinner.html": {
|
|
4
|
+
"convertedUrl": "paper-spinner.js",
|
|
5
|
+
"exports": {}
|
|
6
|
+
},
|
|
7
|
+
"paper-spinner-behavior.html": {
|
|
8
|
+
"convertedUrl": "paper-spinner-behavior.js",
|
|
9
|
+
"exports": {
|
|
10
|
+
"Polymer.PaperSpinnerBehavior": "PaperSpinnerBehavior"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"paper-spinner-styles.html": {
|
|
14
|
+
"convertedUrl": "paper-spinner-styles.js",
|
|
15
|
+
"exports": {}
|
|
16
|
+
},
|
|
17
|
+
"paper-spinner-lite.html": {
|
|
18
|
+
"convertedUrl": "paper-spinner-lite.js",
|
|
19
|
+
"exports": {}
|
|
20
|
+
},
|
|
21
|
+
"index.html": {
|
|
22
|
+
"convertedUrl": "index.html",
|
|
23
|
+
"exports": {}
|
|
24
|
+
},
|
|
25
|
+
"demo/index.html": {
|
|
26
|
+
"convertedUrl": "demo/index.html",
|
|
27
|
+
"exports": {}
|
|
28
|
+
},
|
|
29
|
+
"test/index.html": {
|
|
30
|
+
"convertedUrl": "test/index.html",
|
|
31
|
+
"exports": {}
|
|
32
|
+
},
|
|
33
|
+
"test/paper-spinner.html": {
|
|
34
|
+
"convertedUrl": "test/paper-spinner.html",
|
|
35
|
+
"exports": {}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
+
"description": "A material design spinner",
|
|
3
|
+
"keywords": [
|
|
4
|
+
"web-components",
|
|
5
|
+
"polymer",
|
|
6
|
+
"spinner",
|
|
7
|
+
"loading"
|
|
8
|
+
],
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
12
|
+
"directory": "ports/polymer-paper-spinner/3.0.2"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/PolymerElements/paper-spinner",
|
|
2
15
|
"name": "@ohos-ports/polymer-paper-spinner",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
16
|
+
"license": "BSD-3-Clause",
|
|
17
|
+
"version": "3.0.2-beta.0",
|
|
18
|
+
"author": "The Polymer Authors",
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@ohos-ports/polymer-paper-styles": "^3.0.1-beta.0",
|
|
21
|
+
"@ohos-ports/polymer-polymer": "^3.5.2-beta.1"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was automatically generated by
|
|
5
|
+
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
|
|
6
|
+
*
|
|
7
|
+
* To modify these typings, edit the source file(s):
|
|
8
|
+
* paper-spinner-behavior.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export {PaperSpinnerBehavior};
|
|
12
|
+
|
|
13
|
+
interface PaperSpinnerBehavior {
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Displays the spinner.
|
|
17
|
+
*/
|
|
18
|
+
active: boolean|null|undefined;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Alternative text content for accessibility support.
|
|
22
|
+
* If alt is present, it will add an aria-label whose content matches alt
|
|
23
|
+
* when active. If alt is not present, it will default to 'loading' as the
|
|
24
|
+
* alt value.
|
|
25
|
+
*/
|
|
26
|
+
alt: string|null|undefined;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare const PaperSpinnerBehavior: object;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
This code may only be used under the BSD style license found at
|
|
5
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
6
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
7
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
8
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
9
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
10
|
+
*/
|
|
11
|
+
import '@ohos-ports/polymer-polymer/polymer-legacy.js';
|
|
12
|
+
|
|
13
|
+
/** @polymerBehavior */
|
|
14
|
+
export const PaperSpinnerBehavior = {
|
|
15
|
+
|
|
16
|
+
properties: {
|
|
17
|
+
/**
|
|
18
|
+
* Displays the spinner.
|
|
19
|
+
*/
|
|
20
|
+
active: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
value: false,
|
|
23
|
+
reflectToAttribute: true,
|
|
24
|
+
observer: '__activeChanged'
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Alternative text content for accessibility support.
|
|
29
|
+
* If alt is present, it will add an aria-label whose content matches alt
|
|
30
|
+
* when active. If alt is not present, it will default to 'loading' as the
|
|
31
|
+
* alt value.
|
|
32
|
+
*/
|
|
33
|
+
alt: {type: String, value: 'loading', observer: '__altChanged'},
|
|
34
|
+
|
|
35
|
+
__coolingDown: {type: Boolean, value: false}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
__computeContainerClasses: function(active, coolingDown) {
|
|
39
|
+
return [
|
|
40
|
+
active || coolingDown ? 'active' : '',
|
|
41
|
+
coolingDown ? 'cooldown' : ''
|
|
42
|
+
].join(' ');
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
__activeChanged: function(active, old) {
|
|
46
|
+
this.__setAriaHidden(!active);
|
|
47
|
+
this.__coolingDown = !active && old;
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
__altChanged: function(alt) {
|
|
51
|
+
// user-provided `aria-label` takes precedence over prototype default
|
|
52
|
+
if (alt === 'loading') {
|
|
53
|
+
this.alt = this.getAttribute('aria-label') || alt;
|
|
54
|
+
} else {
|
|
55
|
+
this.__setAriaHidden(alt === '');
|
|
56
|
+
this.setAttribute('aria-label', alt);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
__setAriaHidden: function(hidden) {
|
|
61
|
+
var attr = 'aria-hidden';
|
|
62
|
+
if (hidden) {
|
|
63
|
+
this.setAttribute(attr, 'true');
|
|
64
|
+
} else {
|
|
65
|
+
this.removeAttribute(attr);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
__reset: function() {
|
|
70
|
+
this.active = false;
|
|
71
|
+
this.__coolingDown = false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was automatically generated by
|
|
5
|
+
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
|
|
6
|
+
*
|
|
7
|
+
* To modify these typings, edit the source file(s):
|
|
8
|
+
* paper-spinner-lite.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {Polymer} from '@ohos-ports/polymer-polymer/lib/legacy/polymer-fn.js';
|
|
12
|
+
|
|
13
|
+
import {html} from '@ohos-ports/polymer-polymer/lib/utils/html-tag.js';
|
|
14
|
+
|
|
15
|
+
import {PaperSpinnerBehavior} from './paper-spinner-behavior.js';
|
|
16
|
+
|
|
17
|
+
import {LegacyElementMixin} from '@ohos-ports/polymer-polymer/lib/legacy/legacy-element-mixin.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Material design: [Progress &
|
|
21
|
+
* activity](https://www.google.com/design/spec/components/progress-activity.html)
|
|
22
|
+
*
|
|
23
|
+
* Element providing a single color material design circular spinner.
|
|
24
|
+
*
|
|
25
|
+
* <paper-spinner-lite active></paper-spinner-lite>
|
|
26
|
+
*
|
|
27
|
+
* The default spinner is blue. It can be customized to be a different color.
|
|
28
|
+
*
|
|
29
|
+
* ### Accessibility
|
|
30
|
+
*
|
|
31
|
+
* Alt attribute should be set to provide adequate context for accessibility. If
|
|
32
|
+
* not provided, it defaults to 'loading'. Empty alt can be provided to mark the
|
|
33
|
+
* element as decorative if alternative content is provided in another form (e.g. a
|
|
34
|
+
* text block following the spinner).
|
|
35
|
+
*
|
|
36
|
+
* <paper-spinner-lite alt="Loading contacts list" active></paper-spinner-lite>
|
|
37
|
+
*
|
|
38
|
+
* ### Styling
|
|
39
|
+
*
|
|
40
|
+
* The following custom properties and mixins are available for styling:
|
|
41
|
+
*
|
|
42
|
+
* Custom property | Description | Default
|
|
43
|
+
* ----------------|-------------|----------
|
|
44
|
+
* `--paper-spinner-color` | Color of the spinner | `--google-blue-500`
|
|
45
|
+
* `--paper-spinner-stroke-width` | The width of the spinner stroke | 3px
|
|
46
|
+
*/
|
|
47
|
+
interface PaperSpinnerLiteElement extends PaperSpinnerBehavior, LegacyElementMixin, HTMLElement {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {PaperSpinnerLiteElement};
|
|
51
|
+
|
|
52
|
+
declare global {
|
|
53
|
+
|
|
54
|
+
interface HTMLElementTagNameMap {
|
|
55
|
+
"paper-spinner-lite": PaperSpinnerLiteElement;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
This code may only be used under the BSD style license found at
|
|
5
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
6
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
7
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
8
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
9
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
10
|
+
*/
|
|
11
|
+
import '@ohos-ports/polymer-polymer/polymer-legacy.js';
|
|
12
|
+
import '@ohos-ports/polymer-paper-styles/color.js';
|
|
13
|
+
import './paper-spinner-styles.js';
|
|
14
|
+
|
|
15
|
+
import {Polymer} from '@ohos-ports/polymer-polymer/lib/legacy/polymer-fn.js';
|
|
16
|
+
import {html} from '@ohos-ports/polymer-polymer/lib/utils/html-tag.js';
|
|
17
|
+
|
|
18
|
+
import {PaperSpinnerBehavior} from './paper-spinner-behavior.js';
|
|
19
|
+
|
|
20
|
+
const template = html`
|
|
21
|
+
<style include="paper-spinner-styles"></style>
|
|
22
|
+
|
|
23
|
+
<div id="spinnerContainer" class-name="[[__computeContainerClasses(active, __coolingDown)]]" on-animationend="__reset" on-webkit-animation-end="__reset">
|
|
24
|
+
<div class="spinner-layer">
|
|
25
|
+
<div class="circle-clipper left">
|
|
26
|
+
<div class="circle"></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="circle-clipper right">
|
|
29
|
+
<div class="circle"></div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
`;
|
|
34
|
+
template.setAttribute('strip-whitespace', '');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
Material design: [Progress &
|
|
38
|
+
activity](https://www.google.com/design/spec/components/progress-activity.html)
|
|
39
|
+
|
|
40
|
+
Element providing a single color material design circular spinner.
|
|
41
|
+
|
|
42
|
+
<paper-spinner-lite active></paper-spinner-lite>
|
|
43
|
+
|
|
44
|
+
The default spinner is blue. It can be customized to be a different color.
|
|
45
|
+
|
|
46
|
+
### Accessibility
|
|
47
|
+
|
|
48
|
+
Alt attribute should be set to provide adequate context for accessibility. If
|
|
49
|
+
not provided, it defaults to 'loading'. Empty alt can be provided to mark the
|
|
50
|
+
element as decorative if alternative content is provided in another form (e.g. a
|
|
51
|
+
text block following the spinner).
|
|
52
|
+
|
|
53
|
+
<paper-spinner-lite alt="Loading contacts list" active></paper-spinner-lite>
|
|
54
|
+
|
|
55
|
+
### Styling
|
|
56
|
+
|
|
57
|
+
The following custom properties and mixins are available for styling:
|
|
58
|
+
|
|
59
|
+
Custom property | Description | Default
|
|
60
|
+
----------------|-------------|----------
|
|
61
|
+
`--paper-spinner-color` | Color of the spinner | `--google-blue-500`
|
|
62
|
+
`--paper-spinner-stroke-width` | The width of the spinner stroke | 3px
|
|
63
|
+
|
|
64
|
+
@group Paper Elements
|
|
65
|
+
@element paper-spinner-lite
|
|
66
|
+
@hero hero.svg
|
|
67
|
+
@demo demo/index.html
|
|
68
|
+
*/
|
|
69
|
+
Polymer({
|
|
70
|
+
_template: template,
|
|
71
|
+
|
|
72
|
+
is: 'paper-spinner-lite',
|
|
73
|
+
|
|
74
|
+
behaviors: [PaperSpinnerBehavior]
|
|
75
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was automatically generated by
|
|
5
|
+
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
|
|
6
|
+
*
|
|
7
|
+
* To modify these typings, edit the source file(s):
|
|
8
|
+
* paper-spinner-styles.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
This code may only be used under the BSD style license found at
|
|
5
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
6
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
7
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
8
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
9
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
10
|
+
*/
|
|
11
|
+
const $_documentContainer = document.createElement('template');
|
|
12
|
+
$_documentContainer.setAttribute('style', 'display: none;');
|
|
13
|
+
|
|
14
|
+
$_documentContainer.innerHTML = `<dom-module id="paper-spinner-styles">
|
|
15
|
+
<template>
|
|
16
|
+
<style>
|
|
17
|
+
/*
|
|
18
|
+
/**************************/
|
|
19
|
+
/* STYLES FOR THE SPINNER */
|
|
20
|
+
/**************************/
|
|
21
|
+
|
|
22
|
+
/*
|
|
23
|
+
* Constants:
|
|
24
|
+
* ARCSIZE = 270 degrees (amount of circle the arc takes up)
|
|
25
|
+
* ARCTIME = 1333ms (time it takes to expand and contract arc)
|
|
26
|
+
* ARCSTARTROT = 216 degrees (how much the start location of the arc
|
|
27
|
+
* should rotate each time, 216 gives us a
|
|
28
|
+
* 5 pointed star shape (it's 360/5 * 3).
|
|
29
|
+
* For a 7 pointed star, we might do
|
|
30
|
+
* 360/7 * 3 = 154.286)
|
|
31
|
+
* SHRINK_TIME = 400ms
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
:host {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
position: relative;
|
|
37
|
+
width: 28px;
|
|
38
|
+
height: 28px;
|
|
39
|
+
|
|
40
|
+
/* 360 * ARCTIME / (ARCSTARTROT + (360-ARCSIZE)) */
|
|
41
|
+
--paper-spinner-container-rotation-duration: 1568ms;
|
|
42
|
+
|
|
43
|
+
/* ARCTIME */
|
|
44
|
+
--paper-spinner-expand-contract-duration: 1333ms;
|
|
45
|
+
|
|
46
|
+
/* 4 * ARCTIME */
|
|
47
|
+
--paper-spinner-full-cycle-duration: 5332ms;
|
|
48
|
+
|
|
49
|
+
/* SHRINK_TIME */
|
|
50
|
+
--paper-spinner-cooldown-duration: 400ms;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#spinnerContainer {
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 100%;
|
|
56
|
+
|
|
57
|
+
/* The spinner does not have any contents that would have to be
|
|
58
|
+
* flipped if the direction changes. Always use ltr so that the
|
|
59
|
+
* style works out correctly in both cases. */
|
|
60
|
+
direction: ltr;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#spinnerContainer.active {
|
|
64
|
+
-webkit-animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite;
|
|
65
|
+
animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@-webkit-keyframes container-rotate {
|
|
69
|
+
to { -webkit-transform: rotate(360deg) }
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@keyframes container-rotate {
|
|
73
|
+
to { transform: rotate(360deg) }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.spinner-layer {
|
|
77
|
+
position: absolute;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
opacity: 0;
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
color: var(--paper-spinner-color, var(--google-blue-500));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.layer-1 {
|
|
86
|
+
color: var(--paper-spinner-layer-1-color, var(--google-blue-500));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.layer-2 {
|
|
90
|
+
color: var(--paper-spinner-layer-2-color, var(--google-red-500));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.layer-3 {
|
|
94
|
+
color: var(--paper-spinner-layer-3-color, var(--google-yellow-500));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.layer-4 {
|
|
98
|
+
color: var(--paper-spinner-layer-4-color, var(--google-green-500));
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* IMPORTANT NOTE ABOUT CSS ANIMATION PROPERTIES (keanulee):
|
|
103
|
+
*
|
|
104
|
+
* iOS Safari (tested on iOS 8.1) does not handle animation-delay very well - it doesn't
|
|
105
|
+
* guarantee that the animation will start _exactly_ after that value. So we avoid using
|
|
106
|
+
* animation-delay and instead set custom keyframes for each color (as layer-2undant as it
|
|
107
|
+
* seems).
|
|
108
|
+
*/
|
|
109
|
+
.active .spinner-layer {
|
|
110
|
+
-webkit-animation-name: fill-unfill-rotate;
|
|
111
|
+
-webkit-animation-duration: var(--paper-spinner-full-cycle-duration);
|
|
112
|
+
-webkit-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
113
|
+
-webkit-animation-iteration-count: infinite;
|
|
114
|
+
animation-name: fill-unfill-rotate;
|
|
115
|
+
animation-duration: var(--paper-spinner-full-cycle-duration);
|
|
116
|
+
animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
117
|
+
animation-iteration-count: infinite;
|
|
118
|
+
opacity: 1;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.active .spinner-layer.layer-1 {
|
|
122
|
+
-webkit-animation-name: fill-unfill-rotate, layer-1-fade-in-out;
|
|
123
|
+
animation-name: fill-unfill-rotate, layer-1-fade-in-out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.active .spinner-layer.layer-2 {
|
|
127
|
+
-webkit-animation-name: fill-unfill-rotate, layer-2-fade-in-out;
|
|
128
|
+
animation-name: fill-unfill-rotate, layer-2-fade-in-out;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.active .spinner-layer.layer-3 {
|
|
132
|
+
-webkit-animation-name: fill-unfill-rotate, layer-3-fade-in-out;
|
|
133
|
+
animation-name: fill-unfill-rotate, layer-3-fade-in-out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.active .spinner-layer.layer-4 {
|
|
137
|
+
-webkit-animation-name: fill-unfill-rotate, layer-4-fade-in-out;
|
|
138
|
+
animation-name: fill-unfill-rotate, layer-4-fade-in-out;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@-webkit-keyframes fill-unfill-rotate {
|
|
142
|
+
12.5% { -webkit-transform: rotate(135deg) } /* 0.5 * ARCSIZE */
|
|
143
|
+
25% { -webkit-transform: rotate(270deg) } /* 1 * ARCSIZE */
|
|
144
|
+
37.5% { -webkit-transform: rotate(405deg) } /* 1.5 * ARCSIZE */
|
|
145
|
+
50% { -webkit-transform: rotate(540deg) } /* 2 * ARCSIZE */
|
|
146
|
+
62.5% { -webkit-transform: rotate(675deg) } /* 2.5 * ARCSIZE */
|
|
147
|
+
75% { -webkit-transform: rotate(810deg) } /* 3 * ARCSIZE */
|
|
148
|
+
87.5% { -webkit-transform: rotate(945deg) } /* 3.5 * ARCSIZE */
|
|
149
|
+
to { -webkit-transform: rotate(1080deg) } /* 4 * ARCSIZE */
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes fill-unfill-rotate {
|
|
153
|
+
12.5% { transform: rotate(135deg) } /* 0.5 * ARCSIZE */
|
|
154
|
+
25% { transform: rotate(270deg) } /* 1 * ARCSIZE */
|
|
155
|
+
37.5% { transform: rotate(405deg) } /* 1.5 * ARCSIZE */
|
|
156
|
+
50% { transform: rotate(540deg) } /* 2 * ARCSIZE */
|
|
157
|
+
62.5% { transform: rotate(675deg) } /* 2.5 * ARCSIZE */
|
|
158
|
+
75% { transform: rotate(810deg) } /* 3 * ARCSIZE */
|
|
159
|
+
87.5% { transform: rotate(945deg) } /* 3.5 * ARCSIZE */
|
|
160
|
+
to { transform: rotate(1080deg) } /* 4 * ARCSIZE */
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
@-webkit-keyframes layer-1-fade-in-out {
|
|
164
|
+
0% { opacity: 1 }
|
|
165
|
+
25% { opacity: 1 }
|
|
166
|
+
26% { opacity: 0 }
|
|
167
|
+
89% { opacity: 0 }
|
|
168
|
+
90% { opacity: 1 }
|
|
169
|
+
to { opacity: 1 }
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@keyframes layer-1-fade-in-out {
|
|
173
|
+
0% { opacity: 1 }
|
|
174
|
+
25% { opacity: 1 }
|
|
175
|
+
26% { opacity: 0 }
|
|
176
|
+
89% { opacity: 0 }
|
|
177
|
+
90% { opacity: 1 }
|
|
178
|
+
to { opacity: 1 }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@-webkit-keyframes layer-2-fade-in-out {
|
|
182
|
+
0% { opacity: 0 }
|
|
183
|
+
15% { opacity: 0 }
|
|
184
|
+
25% { opacity: 1 }
|
|
185
|
+
50% { opacity: 1 }
|
|
186
|
+
51% { opacity: 0 }
|
|
187
|
+
to { opacity: 0 }
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
@keyframes layer-2-fade-in-out {
|
|
191
|
+
0% { opacity: 0 }
|
|
192
|
+
15% { opacity: 0 }
|
|
193
|
+
25% { opacity: 1 }
|
|
194
|
+
50% { opacity: 1 }
|
|
195
|
+
51% { opacity: 0 }
|
|
196
|
+
to { opacity: 0 }
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
@-webkit-keyframes layer-3-fade-in-out {
|
|
200
|
+
0% { opacity: 0 }
|
|
201
|
+
40% { opacity: 0 }
|
|
202
|
+
50% { opacity: 1 }
|
|
203
|
+
75% { opacity: 1 }
|
|
204
|
+
76% { opacity: 0 }
|
|
205
|
+
to { opacity: 0 }
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
@keyframes layer-3-fade-in-out {
|
|
209
|
+
0% { opacity: 0 }
|
|
210
|
+
40% { opacity: 0 }
|
|
211
|
+
50% { opacity: 1 }
|
|
212
|
+
75% { opacity: 1 }
|
|
213
|
+
76% { opacity: 0 }
|
|
214
|
+
to { opacity: 0 }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@-webkit-keyframes layer-4-fade-in-out {
|
|
218
|
+
0% { opacity: 0 }
|
|
219
|
+
65% { opacity: 0 }
|
|
220
|
+
75% { opacity: 1 }
|
|
221
|
+
90% { opacity: 1 }
|
|
222
|
+
to { opacity: 0 }
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
@keyframes layer-4-fade-in-out {
|
|
226
|
+
0% { opacity: 0 }
|
|
227
|
+
65% { opacity: 0 }
|
|
228
|
+
75% { opacity: 1 }
|
|
229
|
+
90% { opacity: 1 }
|
|
230
|
+
to { opacity: 0 }
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.circle-clipper {
|
|
234
|
+
display: inline-block;
|
|
235
|
+
position: relative;
|
|
236
|
+
width: 50%;
|
|
237
|
+
height: 100%;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Patch the gap that appear between the two adjacent div.circle-clipper while the
|
|
243
|
+
* spinner is rotating (appears on Chrome 50, Safari 9.1.1, and Edge).
|
|
244
|
+
*/
|
|
245
|
+
.spinner-layer::after {
|
|
246
|
+
content: '';
|
|
247
|
+
left: 45%;
|
|
248
|
+
width: 10%;
|
|
249
|
+
border-top-style: solid;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.spinner-layer::after,
|
|
253
|
+
.circle-clipper .circle {
|
|
254
|
+
box-sizing: border-box;
|
|
255
|
+
position: absolute;
|
|
256
|
+
top: 0;
|
|
257
|
+
border-width: var(--paper-spinner-stroke-width, 3px);
|
|
258
|
+
border-radius: 50%;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.circle-clipper .circle {
|
|
262
|
+
bottom: 0;
|
|
263
|
+
width: 200%;
|
|
264
|
+
border-style: solid;
|
|
265
|
+
border-bottom-color: transparent !important;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.circle-clipper.left .circle {
|
|
269
|
+
left: 0;
|
|
270
|
+
border-right-color: transparent !important;
|
|
271
|
+
-webkit-transform: rotate(129deg);
|
|
272
|
+
transform: rotate(129deg);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.circle-clipper.right .circle {
|
|
276
|
+
left: -100%;
|
|
277
|
+
border-left-color: transparent !important;
|
|
278
|
+
-webkit-transform: rotate(-129deg);
|
|
279
|
+
transform: rotate(-129deg);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.active .gap-patch::after,
|
|
283
|
+
.active .circle-clipper .circle {
|
|
284
|
+
-webkit-animation-duration: var(--paper-spinner-expand-contract-duration);
|
|
285
|
+
-webkit-animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
286
|
+
-webkit-animation-iteration-count: infinite;
|
|
287
|
+
animation-duration: var(--paper-spinner-expand-contract-duration);
|
|
288
|
+
animation-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
289
|
+
animation-iteration-count: infinite;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.active .circle-clipper.left .circle {
|
|
293
|
+
-webkit-animation-name: left-spin;
|
|
294
|
+
animation-name: left-spin;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.active .circle-clipper.right .circle {
|
|
298
|
+
-webkit-animation-name: right-spin;
|
|
299
|
+
animation-name: right-spin;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
@-webkit-keyframes left-spin {
|
|
303
|
+
0% { -webkit-transform: rotate(130deg) }
|
|
304
|
+
50% { -webkit-transform: rotate(-5deg) }
|
|
305
|
+
to { -webkit-transform: rotate(130deg) }
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
@keyframes left-spin {
|
|
309
|
+
0% { transform: rotate(130deg) }
|
|
310
|
+
50% { transform: rotate(-5deg) }
|
|
311
|
+
to { transform: rotate(130deg) }
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
@-webkit-keyframes right-spin {
|
|
315
|
+
0% { -webkit-transform: rotate(-130deg) }
|
|
316
|
+
50% { -webkit-transform: rotate(5deg) }
|
|
317
|
+
to { -webkit-transform: rotate(-130deg) }
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
@keyframes right-spin {
|
|
321
|
+
0% { transform: rotate(-130deg) }
|
|
322
|
+
50% { transform: rotate(5deg) }
|
|
323
|
+
to { transform: rotate(-130deg) }
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
#spinnerContainer.cooldown {
|
|
327
|
+
-webkit-animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite, fade-out var(--paper-spinner-cooldown-duration) cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
328
|
+
animation: container-rotate var(--paper-spinner-container-rotation-duration) linear infinite, fade-out var(--paper-spinner-cooldown-duration) cubic-bezier(0.4, 0.0, 0.2, 1);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
@-webkit-keyframes fade-out {
|
|
332
|
+
0% { opacity: 1 }
|
|
333
|
+
to { opacity: 0 }
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
@keyframes fade-out {
|
|
337
|
+
0% { opacity: 1 }
|
|
338
|
+
to { opacity: 0 }
|
|
339
|
+
}
|
|
340
|
+
</style>
|
|
341
|
+
</template>
|
|
342
|
+
</dom-module>`;
|
|
343
|
+
|
|
344
|
+
document.head.appendChild($_documentContainer.content);
|
|
345
|
+
|
|
346
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file was automatically generated by
|
|
5
|
+
* https://github.com/Polymer/tools/tree/master/packages/gen-typescript-declarations
|
|
6
|
+
*
|
|
7
|
+
* To modify these typings, edit the source file(s):
|
|
8
|
+
* paper-spinner.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {Polymer} from '@ohos-ports/polymer-polymer/lib/legacy/polymer-fn.js';
|
|
12
|
+
|
|
13
|
+
import {html} from '@ohos-ports/polymer-polymer/lib/utils/html-tag.js';
|
|
14
|
+
|
|
15
|
+
import {PaperSpinnerBehavior} from './paper-spinner-behavior.js';
|
|
16
|
+
|
|
17
|
+
import {LegacyElementMixin} from '@ohos-ports/polymer-polymer/lib/legacy/legacy-element-mixin.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Material design: [Progress &
|
|
21
|
+
* activity](https://www.google.com/design/spec/components/progress-activity.html)
|
|
22
|
+
*
|
|
23
|
+
* Element providing a multiple color material design circular spinner.
|
|
24
|
+
*
|
|
25
|
+
* <paper-spinner active></paper-spinner>
|
|
26
|
+
*
|
|
27
|
+
* The default spinner cycles between four layers of colors; by default they are
|
|
28
|
+
* blue, red, yellow and green. It can be customized to cycle between four
|
|
29
|
+
* different colors. Use <paper-spinner-lite> for single color spinners.
|
|
30
|
+
*
|
|
31
|
+
* ### Accessibility
|
|
32
|
+
*
|
|
33
|
+
* Alt attribute should be set to provide adequate context for accessibility. If
|
|
34
|
+
* not provided, it defaults to 'loading'. Empty alt can be provided to mark the
|
|
35
|
+
* element as decorative if alternative content is provided in another form (e.g. a
|
|
36
|
+
* text block following the spinner).
|
|
37
|
+
*
|
|
38
|
+
* <paper-spinner alt="Loading contacts list" active></paper-spinner>
|
|
39
|
+
*
|
|
40
|
+
* ### Styling
|
|
41
|
+
*
|
|
42
|
+
* The following custom properties and mixins are available for styling:
|
|
43
|
+
*
|
|
44
|
+
* Custom property | Description | Default
|
|
45
|
+
* ----------------|-------------|----------
|
|
46
|
+
* `--paper-spinner-layer-1-color` | Color of the first spinner rotation | `--google-blue-500`
|
|
47
|
+
* `--paper-spinner-layer-2-color` | Color of the second spinner rotation | `--google-red-500`
|
|
48
|
+
* `--paper-spinner-layer-3-color` | Color of the third spinner rotation | `--google-yellow-500`
|
|
49
|
+
* `--paper-spinner-layer-4-color` | Color of the fourth spinner rotation | `--google-green-500`
|
|
50
|
+
* `--paper-spinner-stroke-width` | The width of the spinner stroke | 3px
|
|
51
|
+
*/
|
|
52
|
+
interface PaperSpinnerElement extends PaperSpinnerBehavior, LegacyElementMixin, HTMLElement {
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export {PaperSpinnerElement};
|
|
56
|
+
|
|
57
|
+
declare global {
|
|
58
|
+
|
|
59
|
+
interface HTMLElementTagNameMap {
|
|
60
|
+
"paper-spinner": PaperSpinnerElement;
|
|
61
|
+
}
|
|
62
|
+
}
|
package/paper-spinner.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
@license
|
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
|
4
|
+
This code may only be used under the BSD style license found at
|
|
5
|
+
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
|
|
6
|
+
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
|
|
7
|
+
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
|
|
8
|
+
part of the polymer project is also subject to an additional IP rights grant
|
|
9
|
+
found at http://polymer.github.io/PATENTS.txt
|
|
10
|
+
*/
|
|
11
|
+
import '@ohos-ports/polymer-polymer/polymer-legacy.js';
|
|
12
|
+
import '@ohos-ports/polymer-paper-styles/color.js';
|
|
13
|
+
import './paper-spinner-styles.js';
|
|
14
|
+
|
|
15
|
+
import {Polymer} from '@ohos-ports/polymer-polymer/lib/legacy/polymer-fn.js';
|
|
16
|
+
import {html} from '@ohos-ports/polymer-polymer/lib/utils/html-tag.js';
|
|
17
|
+
|
|
18
|
+
import {PaperSpinnerBehavior} from './paper-spinner-behavior.js';
|
|
19
|
+
|
|
20
|
+
const template = html`
|
|
21
|
+
<style include="paper-spinner-styles"></style>
|
|
22
|
+
|
|
23
|
+
<div id="spinnerContainer" class-name="[[__computeContainerClasses(active, __coolingDown)]]" on-animationend="__reset" on-webkit-animation-end="__reset">
|
|
24
|
+
<div class="spinner-layer layer-1">
|
|
25
|
+
<div class="circle-clipper left">
|
|
26
|
+
<div class="circle"></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div class="circle-clipper right">
|
|
29
|
+
<div class="circle"></div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="spinner-layer layer-2">
|
|
34
|
+
<div class="circle-clipper left">
|
|
35
|
+
<div class="circle"></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div class="circle-clipper right">
|
|
38
|
+
<div class="circle"></div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="spinner-layer layer-3">
|
|
43
|
+
<div class="circle-clipper left">
|
|
44
|
+
<div class="circle"></div>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="circle-clipper right">
|
|
47
|
+
<div class="circle"></div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="spinner-layer layer-4">
|
|
52
|
+
<div class="circle-clipper left">
|
|
53
|
+
<div class="circle"></div>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="circle-clipper right">
|
|
56
|
+
<div class="circle"></div>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
template.setAttribute('strip-whitespace', '');
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
Material design: [Progress &
|
|
65
|
+
activity](https://www.google.com/design/spec/components/progress-activity.html)
|
|
66
|
+
|
|
67
|
+
Element providing a multiple color material design circular spinner.
|
|
68
|
+
|
|
69
|
+
<paper-spinner active></paper-spinner>
|
|
70
|
+
|
|
71
|
+
The default spinner cycles between four layers of colors; by default they are
|
|
72
|
+
blue, red, yellow and green. It can be customized to cycle between four
|
|
73
|
+
different colors. Use <paper-spinner-lite> for single color spinners.
|
|
74
|
+
|
|
75
|
+
### Accessibility
|
|
76
|
+
|
|
77
|
+
Alt attribute should be set to provide adequate context for accessibility. If
|
|
78
|
+
not provided, it defaults to 'loading'. Empty alt can be provided to mark the
|
|
79
|
+
element as decorative if alternative content is provided in another form (e.g. a
|
|
80
|
+
text block following the spinner).
|
|
81
|
+
|
|
82
|
+
<paper-spinner alt="Loading contacts list" active></paper-spinner>
|
|
83
|
+
|
|
84
|
+
### Styling
|
|
85
|
+
|
|
86
|
+
The following custom properties and mixins are available for styling:
|
|
87
|
+
|
|
88
|
+
Custom property | Description | Default
|
|
89
|
+
----------------|-------------|----------
|
|
90
|
+
`--paper-spinner-layer-1-color` | Color of the first spinner rotation | `--google-blue-500`
|
|
91
|
+
`--paper-spinner-layer-2-color` | Color of the second spinner rotation | `--google-red-500`
|
|
92
|
+
`--paper-spinner-layer-3-color` | Color of the third spinner rotation | `--google-yellow-500`
|
|
93
|
+
`--paper-spinner-layer-4-color` | Color of the fourth spinner rotation | `--google-green-500`
|
|
94
|
+
`--paper-spinner-stroke-width` | The width of the spinner stroke | 3px
|
|
95
|
+
|
|
96
|
+
@group Paper Elements
|
|
97
|
+
@element paper-spinner
|
|
98
|
+
@hero hero.svg
|
|
99
|
+
@demo demo/index.html
|
|
100
|
+
*/
|
|
101
|
+
Polymer({
|
|
102
|
+
_template: template,
|
|
103
|
+
|
|
104
|
+
is: 'paper-spinner',
|
|
105
|
+
|
|
106
|
+
behaviors: [PaperSpinnerBehavior]
|
|
107
|
+
});
|