@internetarchive/ia-icons 1.3.7 → 1.3.11
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/.eslintrc +16 -0
- package/README.md +31 -21
- package/ia-icon.js +5 -0
- package/index.html +124 -0
- package/index.js +3 -0
- package/karma.bs.config.js +16 -0
- package/karma.conf.js +30 -0
- package/package.json +102 -6
- package/src/ia-icon.js +128 -0
- package/src/icon-donate.js +23 -0
- package/test/ia-icons.test.js +17 -0
- package/.eslintrc.cjs +0 -24
- package/.github/workflows/ci.yml +0 -23
- package/bin/build.sh +0 -63
- package/src/advance.js +0 -36
- package/src/applepay.js +0 -36
- package/src/audio.js +0 -29
- package/src/base.js +0 -32
- package/src/calendar-blank.js +0 -21
- package/src/calendar.js +0 -29
- package/src/close-circle.js +0 -21
- package/src/close.js +0 -22
- package/src/collapse-sidebar.js +0 -21
- package/src/credit-card.js +0 -29
- package/src/dl.js +0 -24
- package/src/donate.js +0 -21
- package/src/edit-pencil.js +0 -13
- package/src/ellipses.js +0 -21
- package/src/email.js +0 -17
- package/src/facebook.js +0 -17
- package/src/googlepay.js +0 -52
- package/src/ia-logo.js +0 -30
- package/src/images.js +0 -21
- package/src/info.js +0 -18
- package/src/link.js +0 -17
- package/src/locale-pin.js +0 -21
- package/src/lock.js +0 -20
- package/src/magnify-minus.js +0 -27
- package/src/magnify-plus.js +0 -27
- package/src/paypal.js +0 -53
- package/src/pinterest.js +0 -17
- package/src/search.js +0 -24
- package/src/share.js +0 -23
- package/src/software.js +0 -21
- package/src/sort-ascending.js +0 -13
- package/src/sort-descending.js +0 -13
- package/src/texts.js +0 -21
- package/src/toc.js +0 -21
- package/src/tumblr.js +0 -17
- package/src/twitter.js +0 -17
- package/src/upload.js +0 -21
- package/src/user.js +0 -21
- package/src/venmo.js +0 -23
- package/src/video.js +0 -21
- package/src/visual-adjustment.js +0 -21
- package/src/volumes.js +0 -21
- package/src/web.js +0 -21
- package/svg/advance.svg +0 -24
- package/svg/applepay.svg +0 -24
- package/svg/audio.svg +0 -17
- package/svg/calendar-blank.svg +0 -9
- package/svg/calendar.svg +0 -17
- package/svg/close-circle.svg +0 -9
- package/svg/close.svg +0 -10
- package/svg/collapse-sidebar.svg +0 -9
- package/svg/credit-card.svg +0 -17
- package/svg/dl.svg +0 -12
- package/svg/donate.svg +0 -9
- package/svg/edit-pencil.svg +0 -1
- package/svg/ellipses.svg +0 -9
- package/svg/email.svg +0 -5
- package/svg/facebook.svg +0 -5
- package/svg/googlepay.svg +0 -40
- package/svg/ia-logo.svg +0 -18
- package/svg/images.svg +0 -9
- package/svg/info.svg +0 -6
- package/svg/link.svg +0 -5
- package/svg/locale-pin.svg +0 -9
- package/svg/lock.svg +0 -8
- package/svg/magnify-minus.svg +0 -15
- package/svg/magnify-plus.svg +0 -15
- package/svg/paypal.svg +0 -41
- package/svg/pinterest.svg +0 -5
- package/svg/search.svg +0 -12
- package/svg/share.svg +0 -11
- package/svg/software.svg +0 -9
- package/svg/sort-ascending.svg +0 -1
- package/svg/sort-descending.svg +0 -1
- package/svg/texts.svg +0 -9
- package/svg/toc.svg +0 -9
- package/svg/tumblr.svg +0 -5
- package/svg/twitter.svg +0 -5
- package/svg/upload.svg +0 -9
- package/svg/user.svg +0 -9
- package/svg/venmo.svg +0 -11
- package/svg/video.svg +0 -9
- package/svg/visual-adjustment.svg +0 -9
- package/svg/volumes.svg +0 -9
- package/svg/web.svg +0 -9
- package/test/index.html +0 -391
package/.eslintrc
ADDED
package/README.md
CHANGED
|
@@ -1,35 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ia-icons: SVG icon library for use in archive.org components
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## Usage
|
|
4
4
|
|
|
5
|
-
[svg/](svg/)
|
|
6
|
-
|
|
7
|
-
Each `.svg` source file can then be individually imported via JS/TS like:
|
|
8
5
|
```js
|
|
9
|
-
import
|
|
6
|
+
import { IAIcon } from './src/ia-icon';
|
|
10
7
|
```
|
|
11
8
|
|
|
12
|
-
You can use in markup with the lit / web components definition like:
|
|
13
9
|
```html
|
|
14
|
-
<ia-icon
|
|
15
|
-
<script type="module" src="https://esm.archive.org/@internetarchive/ia-icons/src/video.js"></script>
|
|
10
|
+
<ia-icon icon="close" style="--iconFillColor: #0066cc; --iconStrokeColor: #ffffff;"></ia-icon>
|
|
16
11
|
```
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
```css
|
|
14
|
+
ia-icon {
|
|
15
|
+
--iconFillColor: #0066cc;
|
|
16
|
+
--iconStrokeColor: #ffffff;
|
|
17
|
+
--iconWidth: 40px;
|
|
18
|
+
--iconHeight: 40px;
|
|
19
|
+
}
|
|
20
|
+
```
|
|
19
21
|
|
|
20
|
-
##
|
|
21
|
-
**[test/](test/)**
|
|
22
|
+
## Testing
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
Unit tests are placed in the ./test directory with the suffix and extension
|
|
25
|
+
".test.js". Any other JS files in the test directory will be ignored by Karma.
|
|
26
|
+
Run the tests with `yarn test`.
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
./bin/build.sh
|
|
28
|
-
```
|
|
29
|
-
in a `git clone` of this repo to rebuild/update [src/](src/) and [test/](test/) files.
|
|
28
|
+
## Structure
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
* index.js - main component export
|
|
31
|
+
* index.html - file opened when running `yarn start`
|
|
32
|
+
* karma.conf.js - Karma runner config
|
|
33
|
+
* karma.bs.conf.js - Karma BrowserStack config. Note that BROWSER_STACK_USERNAME
|
|
34
|
+
and BROWSER_STACK_ACCESS_KEY need to be set as environment variables before
|
|
35
|
+
running.
|
|
36
|
+
* /src/ia-icons.js - Class definitions for each LitElement
|
|
37
|
+
* /src/icons - Place icon SVGs here. Convention is to export a Lit-html template
|
|
38
|
+
* /test - unit tests
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
the relevant JS and test files.
|
|
40
|
+
## Single Icons
|
|
35
41
|
|
|
42
|
+
This package is part of [a monorepo](https://github.com/internetarchive/iaux-icons)
|
|
43
|
+
that includes a published package for each icon included here. Each package
|
|
44
|
+
includes a raw SVG file, a LitHtml template literal, and a defined custom
|
|
45
|
+
element created with LitElement.
|
package/ia-icon.js
ADDED
package/index.html
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<script type="module" src="ia-icon.js"></script>
|
|
7
|
+
<script type="module" src="src/icon-donate.js"></script>
|
|
8
|
+
<title>IA SVG Icons</title>
|
|
9
|
+
<style>
|
|
10
|
+
html {
|
|
11
|
+
font: normal 10px 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
12
|
+
font-size: 10px;
|
|
13
|
+
--iconWidth: 40px;
|
|
14
|
+
--iconHeight: 40px;
|
|
15
|
+
}
|
|
16
|
+
body {
|
|
17
|
+
margin: 0;
|
|
18
|
+
padding: 0 2rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
h3 {
|
|
22
|
+
font-size: 2rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ul {
|
|
26
|
+
display: grid;
|
|
27
|
+
grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
|
|
28
|
+
grid-gap: 1rem;
|
|
29
|
+
padding: 0;
|
|
30
|
+
list-style: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
li {
|
|
34
|
+
padding: 1.5rem 0;
|
|
35
|
+
border: 2px solid #ccc;
|
|
36
|
+
text-align: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
li:hover {
|
|
40
|
+
color: #f0f0f0;
|
|
41
|
+
background: #222;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
p {
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
icon-donate {
|
|
49
|
+
width: 40px;
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
</style>
|
|
53
|
+
</head>
|
|
54
|
+
|
|
55
|
+
<body>
|
|
56
|
+
<script type="module">
|
|
57
|
+
import { render, html } from './node_modules/lit-html/lit-html.js';
|
|
58
|
+
|
|
59
|
+
const listItems = () => {
|
|
60
|
+
return [
|
|
61
|
+
'applePay',
|
|
62
|
+
'advance',
|
|
63
|
+
'audio',
|
|
64
|
+
'calendar',
|
|
65
|
+
'calendarBlank',
|
|
66
|
+
'close',
|
|
67
|
+
'closeCircle',
|
|
68
|
+
'collapseSidebar',
|
|
69
|
+
'creditCard',
|
|
70
|
+
'donate',
|
|
71
|
+
'download',
|
|
72
|
+
'editPencil',
|
|
73
|
+
'ellipses',
|
|
74
|
+
'email',
|
|
75
|
+
'facebook',
|
|
76
|
+
'googlePay',
|
|
77
|
+
'iaLogo',
|
|
78
|
+
'images',
|
|
79
|
+
'link',
|
|
80
|
+
'localePin',
|
|
81
|
+
'lock',
|
|
82
|
+
'magnifyMinus',
|
|
83
|
+
'magnifyPlus',
|
|
84
|
+
'paypal',
|
|
85
|
+
'pinterest',
|
|
86
|
+
'search',
|
|
87
|
+
'share',
|
|
88
|
+
'software',
|
|
89
|
+
'sortAscending',
|
|
90
|
+
'sortDescending',
|
|
91
|
+
'texts',
|
|
92
|
+
'toc',
|
|
93
|
+
'tumblr',
|
|
94
|
+
'twitter',
|
|
95
|
+
'upload',
|
|
96
|
+
'user',
|
|
97
|
+
'venmo',
|
|
98
|
+
'video',
|
|
99
|
+
'visualAdjustment',
|
|
100
|
+
'volumes',
|
|
101
|
+
'web',
|
|
102
|
+
'info',
|
|
103
|
+
].map((name) => {
|
|
104
|
+
const color = `rgb(${~~(Math.random() * 256)}, ${~~(Math.random() * 256)}, ${~~(Math.random() * 256)})`;
|
|
105
|
+
return html`
|
|
106
|
+
<li>
|
|
107
|
+
<ia-icon icon=${name} style="--iconFillColor: ${color}; --iconStrokeColor: ${color};"></ia-icon>
|
|
108
|
+
<p>${name}</p>
|
|
109
|
+
</li>
|
|
110
|
+
`;
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
render(html`
|
|
115
|
+
<h3>Icons using ${"<ia-icon>"}</h3>
|
|
116
|
+
<ul>
|
|
117
|
+
${listItems()}
|
|
118
|
+
</ul>
|
|
119
|
+
<h3>Icon created by extending IAIcon</h3>
|
|
120
|
+
<icon-donate></icon-donate>
|
|
121
|
+
`, document.body);
|
|
122
|
+
</script>
|
|
123
|
+
</body>
|
|
124
|
+
</html>
|
package/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
const merge = require('webpack-merge');
|
|
3
|
+
const bsSettings = require('@open-wc/testing-karma-bs/bs-settings.js');
|
|
4
|
+
const createBaseConfig = require('./karma.conf.js');
|
|
5
|
+
|
|
6
|
+
module.exports = (config) => {
|
|
7
|
+
config.set(
|
|
8
|
+
merge(bsSettings(config), createBaseConfig(config), {
|
|
9
|
+
browserStack: {
|
|
10
|
+
project: 'ia-icons',
|
|
11
|
+
},
|
|
12
|
+
}),
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return config;
|
|
16
|
+
};
|
package/karma.conf.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
const { createDefaultConfig } = require('@open-wc/testing-karma');
|
|
3
|
+
const merge = require('webpack-merge');
|
|
4
|
+
|
|
5
|
+
module.exports = (config) => {
|
|
6
|
+
config.set(
|
|
7
|
+
merge(createDefaultConfig(config), {
|
|
8
|
+
files: [
|
|
9
|
+
// runs all files ending with .test in the test folder,
|
|
10
|
+
// can be overwritten by passing a --grep flag. examples:
|
|
11
|
+
//
|
|
12
|
+
// npm run test -- --grep test/foo/bar.test.js
|
|
13
|
+
// npm run test -- --grep test/bar/*
|
|
14
|
+
{ pattern: config.grep ? config.grep : 'test/**/*.test.js', type: 'module' },
|
|
15
|
+
],
|
|
16
|
+
|
|
17
|
+
esm: {
|
|
18
|
+
nodeResolve: true,
|
|
19
|
+
},
|
|
20
|
+
// you can overwrite/extend the config further
|
|
21
|
+
coverageIstanbulReporter: {
|
|
22
|
+
thresholds: {
|
|
23
|
+
emitWarning: true, // set to `true` to not fail the test command when thresholds are not met
|
|
24
|
+
// thresholds for all files
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
29
|
+
return config;
|
|
30
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,108 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetarchive/ia-icons",
|
|
3
|
-
"
|
|
3
|
+
"version": "1.3.11",
|
|
4
|
+
"description": "SVG icon library for use in archive.org components",
|
|
4
5
|
"license": "AGPL-3.0-only",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"module": "ia-icon.js",
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "es-dev-server --app-index ./index.html --node-resolve --watch --open --preserve-symlinks",
|
|
13
|
+
"lint:eslint": "eslint --ext .js . --ignore-path .gitignore",
|
|
14
|
+
"format:eslint": "eslint --ext .js . --fix --ignore-path .gitignore",
|
|
15
|
+
"lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
|
|
16
|
+
"format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore",
|
|
17
|
+
"lint": "npm run lint:eslint",
|
|
18
|
+
"format": "npm run format:eslint && npm run format:prettier",
|
|
19
|
+
"test": "karma start --coverage",
|
|
20
|
+
"test:watch": "karma start --auto-watch=true --single-run=false",
|
|
21
|
+
"test:update-snapshots": "karma start --update-snapshots",
|
|
22
|
+
"test:prune-snapshots": "karma start --prune-snapshots",
|
|
23
|
+
"test:compatibility": "karma start --compatibility all --coverage",
|
|
24
|
+
"test:compatibility:watch": "karma start --compatibility all --auto-watch=true --single-run=false",
|
|
25
|
+
"test:bs": "karma start karma.bs.config.js --compatibility all --coverage"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@internetarchive/ia-icons": "^1.3.10",
|
|
29
|
+
"@internetarchive/icon-advance": "^1.3.4",
|
|
30
|
+
"@internetarchive/icon-applepay": "^1.3.4",
|
|
31
|
+
"@internetarchive/icon-audio": "^1.3.4",
|
|
32
|
+
"@internetarchive/icon-bookmark": "^1.3.4",
|
|
33
|
+
"@internetarchive/icon-calendar": "^1.3.4",
|
|
34
|
+
"@internetarchive/icon-calendar-blank": "^1.3.4",
|
|
35
|
+
"@internetarchive/icon-close": "^1.3.4",
|
|
36
|
+
"@internetarchive/icon-close-circle": "^1.3.6",
|
|
37
|
+
"@internetarchive/icon-collapse-sidebar": "^1.3.4",
|
|
38
|
+
"@internetarchive/icon-credit-card": "^1.3.4",
|
|
39
|
+
"@internetarchive/icon-dl": "^1.3.4",
|
|
40
|
+
"@internetarchive/icon-donate": "^1.3.4",
|
|
41
|
+
"@internetarchive/icon-edit-pencil": "^1.3.4",
|
|
42
|
+
"@internetarchive/icon-ellipses": "^1.3.4",
|
|
43
|
+
"@internetarchive/icon-email": "^1.3.4",
|
|
44
|
+
"@internetarchive/icon-facebook": "^1.3.4",
|
|
45
|
+
"@internetarchive/icon-googlepay": "^1.3.4",
|
|
46
|
+
"@internetarchive/icon-ia-logo": "^1.3.4",
|
|
47
|
+
"@internetarchive/icon-images": "^1.3.4",
|
|
48
|
+
"@internetarchive/icon-info": "^1.3.5",
|
|
49
|
+
"@internetarchive/icon-link": "^1.3.4",
|
|
50
|
+
"@internetarchive/icon-locale-pin": "^1.3.4",
|
|
51
|
+
"@internetarchive/icon-lock": "^1.3.4",
|
|
52
|
+
"@internetarchive/icon-magnify-minus": "^1.3.4",
|
|
53
|
+
"@internetarchive/icon-magnify-plus": "^1.3.4",
|
|
54
|
+
"@internetarchive/icon-paypal": "^1.3.4",
|
|
55
|
+
"@internetarchive/icon-pinterest": "^1.3.4",
|
|
56
|
+
"@internetarchive/icon-search": "^1.3.4",
|
|
57
|
+
"@internetarchive/icon-share": "^1.3.4",
|
|
58
|
+
"@internetarchive/icon-software": "^1.3.4",
|
|
59
|
+
"@internetarchive/icon-sort-ascending": "^1.3.4",
|
|
60
|
+
"@internetarchive/icon-sort-descending": "^1.3.5",
|
|
61
|
+
"@internetarchive/icon-texts": "^1.3.4",
|
|
62
|
+
"@internetarchive/icon-toc": "^1.3.4",
|
|
63
|
+
"@internetarchive/icon-tumblr": "^1.3.4",
|
|
64
|
+
"@internetarchive/icon-twitter": "^1.3.4",
|
|
65
|
+
"@internetarchive/icon-upload": "^1.3.4",
|
|
66
|
+
"@internetarchive/icon-user": "^1.3.4",
|
|
67
|
+
"@internetarchive/icon-venmo": "^1.3.4",
|
|
68
|
+
"@internetarchive/icon-video": "^1.3.4",
|
|
69
|
+
"@internetarchive/icon-visual-adjustment": "^1.3.4",
|
|
70
|
+
"@internetarchive/icon-volumes": "^1.3.4",
|
|
71
|
+
"@internetarchive/icon-web": "^1.3.4",
|
|
72
|
+
"lit": "^2.8.0"
|
|
73
|
+
},
|
|
5
74
|
"devDependencies": {
|
|
6
|
-
"eslint": "^
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
75
|
+
"@open-wc/eslint-config": "^1.3.0",
|
|
76
|
+
"@open-wc/polyfills-loader": "^0.2.2",
|
|
77
|
+
"@open-wc/prettier-config": "^0.1.14",
|
|
78
|
+
"@open-wc/testing": "^2.5.33",
|
|
79
|
+
"@open-wc/testing-karma": "^3.4.8",
|
|
80
|
+
"@open-wc/testing-karma-bs": "^1.3.94",
|
|
81
|
+
"es-dev-server": "^1.60.2",
|
|
82
|
+
"eslint": "^6.8.0",
|
|
83
|
+
"eslint-plugin-lit": "^0.5.0",
|
|
84
|
+
"gulp": "^4.0.2",
|
|
85
|
+
"husky": "^4.3.8",
|
|
86
|
+
"lint-staged": "^8.2.1",
|
|
87
|
+
"sinon": "^9.2.4",
|
|
88
|
+
"webpack-merge": "^4.2.2"
|
|
89
|
+
},
|
|
90
|
+
"husky": {
|
|
91
|
+
"hooks": {
|
|
92
|
+
"pre-commit": "lint-staged"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"lint-staged": {
|
|
96
|
+
"*.js": [
|
|
97
|
+
"eslint --fix",
|
|
98
|
+
"git add"
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"eslintConfig": {
|
|
102
|
+
"extends": [
|
|
103
|
+
"@open-wc/eslint-config",
|
|
104
|
+
"eslint-config-prettier"
|
|
105
|
+
]
|
|
10
106
|
},
|
|
11
|
-
"
|
|
107
|
+
"prettier": "@open-wc/prettier-config"
|
|
12
108
|
}
|
package/src/ia-icon.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LitElement, html, css, nothing
|
|
3
|
+
} from 'lit';
|
|
4
|
+
import advance from '@internetarchive/icon-advance/index';
|
|
5
|
+
import applePay from '@internetarchive/icon-applepay/index';
|
|
6
|
+
import audio from '@internetarchive/icon-audio/index';
|
|
7
|
+
import calendar from '@internetarchive/icon-calendar/index';
|
|
8
|
+
import calendarBlank from '@internetarchive/icon-calendar-blank/index';
|
|
9
|
+
import close from '@internetarchive/icon-close/index';
|
|
10
|
+
import closeCircle from '@internetarchive/icon-close-circle/index';
|
|
11
|
+
import collapseSidebar from '@internetarchive/icon-collapse-sidebar/index';
|
|
12
|
+
import creditCard from '@internetarchive/icon-credit-card/index';
|
|
13
|
+
import donate from '@internetarchive/icon-donate/index';
|
|
14
|
+
import download from '@internetarchive/icon-dl/index';
|
|
15
|
+
import editPencil from '@internetarchive/icon-edit-pencil/index';
|
|
16
|
+
import ellipses from '@internetarchive/icon-ellipses/index';
|
|
17
|
+
import email from '@internetarchive/icon-email/index';
|
|
18
|
+
import facebook from '@internetarchive/icon-facebook/index';
|
|
19
|
+
import googlePay from '@internetarchive/icon-googlepay/index';
|
|
20
|
+
import iaLogo from '@internetarchive/icon-ia-logo/index';
|
|
21
|
+
import images from '@internetarchive/icon-images/index';
|
|
22
|
+
import link from '@internetarchive/icon-link/index';
|
|
23
|
+
import localePin from '@internetarchive/icon-locale-pin/index';
|
|
24
|
+
import lock from '@internetarchive/icon-lock/index';
|
|
25
|
+
import magnifyMinus from '@internetarchive/icon-magnify-minus/index';
|
|
26
|
+
import magnifyPlus from '@internetarchive/icon-magnify-plus/index';
|
|
27
|
+
import paypal from '@internetarchive/icon-paypal/index';
|
|
28
|
+
import pinterest from '@internetarchive/icon-pinterest/index';
|
|
29
|
+
import search from '@internetarchive/icon-search/index';
|
|
30
|
+
import share from '@internetarchive/icon-share/index';
|
|
31
|
+
import software from '@internetarchive/icon-software/index';
|
|
32
|
+
import sortAscending from '@internetarchive/icon-sort-ascending/index';
|
|
33
|
+
import sortDescending from '@internetarchive/icon-sort-descending/index';
|
|
34
|
+
import texts from '@internetarchive/icon-texts/index';
|
|
35
|
+
import toc from '@internetarchive/icon-toc/index';
|
|
36
|
+
import tumblr from '@internetarchive/icon-tumblr/index';
|
|
37
|
+
import twitter from '@internetarchive/icon-twitter/index';
|
|
38
|
+
import upload from '@internetarchive/icon-upload/index';
|
|
39
|
+
import user from '@internetarchive/icon-user/index';
|
|
40
|
+
import venmo from '@internetarchive/icon-venmo/index';
|
|
41
|
+
import video from '@internetarchive/icon-video/index';
|
|
42
|
+
import visualAdjustment from '@internetarchive/icon-visual-adjustment/index';
|
|
43
|
+
import volumes from '@internetarchive/icon-volumes/index';
|
|
44
|
+
import web from '@internetarchive/icon-web/index';
|
|
45
|
+
import info from '@internetarchive/icon-info/index';
|
|
46
|
+
|
|
47
|
+
const iconTemplates = {
|
|
48
|
+
applePay,
|
|
49
|
+
advance,
|
|
50
|
+
audio,
|
|
51
|
+
calendar,
|
|
52
|
+
calendarBlank,
|
|
53
|
+
close,
|
|
54
|
+
closeCircle,
|
|
55
|
+
collapseSidebar,
|
|
56
|
+
creditCard,
|
|
57
|
+
donate,
|
|
58
|
+
download,
|
|
59
|
+
editPencil,
|
|
60
|
+
ellipses,
|
|
61
|
+
email,
|
|
62
|
+
facebook,
|
|
63
|
+
googlePay,
|
|
64
|
+
iaLogo,
|
|
65
|
+
images,
|
|
66
|
+
link,
|
|
67
|
+
localePin,
|
|
68
|
+
lock,
|
|
69
|
+
magnifyMinus,
|
|
70
|
+
magnifyPlus,
|
|
71
|
+
paypal,
|
|
72
|
+
pinterest,
|
|
73
|
+
search,
|
|
74
|
+
share,
|
|
75
|
+
software,
|
|
76
|
+
sortAscending,
|
|
77
|
+
sortDescending,
|
|
78
|
+
texts,
|
|
79
|
+
toc,
|
|
80
|
+
tumblr,
|
|
81
|
+
twitter,
|
|
82
|
+
upload,
|
|
83
|
+
user,
|
|
84
|
+
venmo,
|
|
85
|
+
video,
|
|
86
|
+
visualAdjustment,
|
|
87
|
+
volumes,
|
|
88
|
+
web,
|
|
89
|
+
info,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
class IAIcon extends LitElement {
|
|
93
|
+
static get properties() {
|
|
94
|
+
return {
|
|
95
|
+
icon: { type: String },
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
static get styles() {
|
|
100
|
+
return css`
|
|
101
|
+
svg {
|
|
102
|
+
width: var(--iconWidth, 'auto');
|
|
103
|
+
height: var(--iconHeight, 'auto');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.fill-color {
|
|
107
|
+
fill: var(--iconFillColor);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.stroke-color {
|
|
111
|
+
stroke: var(--iconStrokeColor);
|
|
112
|
+
}
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
constructor() {
|
|
117
|
+
super();
|
|
118
|
+
this.icon = '';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
render() {
|
|
122
|
+
return html`${iconTemplates[this.icon]}` || nothing;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
customElements.define('ia-icon', IAIcon);
|
|
127
|
+
|
|
128
|
+
export default IAIcon;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import IAIcon from './ia-icon';
|
|
3
|
+
|
|
4
|
+
class IconDonate extends IAIcon {
|
|
5
|
+
static get styles() {
|
|
6
|
+
return css`
|
|
7
|
+
.fill-color {
|
|
8
|
+
fill: #ff0000;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.stroke-color {
|
|
12
|
+
stroke: #ff0000;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
this.icon = 'donate';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
customElements.define('icon-donate', IconDonate);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { fixture, expect, html } from '@open-wc/testing';
|
|
2
|
+
|
|
3
|
+
import '../ia-icon';
|
|
4
|
+
|
|
5
|
+
describe('<ia-icon>', () => {
|
|
6
|
+
it('renders an empty element when icon type is unrecognized', async () => {
|
|
7
|
+
const el = await fixture(html`<ia-icon icon="foo"></ia-icon>`);
|
|
8
|
+
|
|
9
|
+
expect(el.shadowRoot.querySelector('svg')).to.equal(null);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('renders an icon', async () => {
|
|
13
|
+
const el = await fixture(html`<ia-icon icon="web"></ia-icon>`);
|
|
14
|
+
|
|
15
|
+
expect(el.shadowRoot.querySelector('svg')).to.exist;
|
|
16
|
+
});
|
|
17
|
+
});
|
package/.eslintrc.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
env: {
|
|
3
|
-
browser: true,
|
|
4
|
-
},
|
|
5
|
-
root: true,
|
|
6
|
-
extends: 'airbnb-base',
|
|
7
|
-
plugins: [
|
|
8
|
-
'eslint-plugin-import',
|
|
9
|
-
],
|
|
10
|
-
rules: {
|
|
11
|
-
// we use esm.sh self-hosted and `import from 'https://..' is fine
|
|
12
|
-
'import/no-unresolved': [2, {
|
|
13
|
-
ignore: [
|
|
14
|
-
'^https://esm.archive.org/',
|
|
15
|
-
'^https://offshoot.prod.archive.org/lit',
|
|
16
|
-
],
|
|
17
|
-
}],
|
|
18
|
-
|
|
19
|
-
// allow `import .. from '.js'` (.js suffix) in JS files
|
|
20
|
-
'import/extensions': ['off'],
|
|
21
|
-
|
|
22
|
-
'jsx-a11y/label-has-for': 0,
|
|
23
|
-
},
|
|
24
|
-
};
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
name: App CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v2
|
|
15
|
-
- uses: actions/setup-node@v1
|
|
16
|
-
with:
|
|
17
|
-
node-version: 19.x
|
|
18
|
-
|
|
19
|
-
- name: Install dependencies
|
|
20
|
-
run: npm install
|
|
21
|
-
|
|
22
|
-
- name: Run tests
|
|
23
|
-
run: npx eslint
|
package/bin/build.sh
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/bin/zsh -e
|
|
2
|
-
|
|
3
|
-
# (re)generates all `src/*.js` and `test/` files (from `svg/*.svg` source images).
|
|
4
|
-
|
|
5
|
-
MYDIR=${0:a:h}
|
|
6
|
-
|
|
7
|
-
cd $MYDIR/..
|
|
8
|
-
|
|
9
|
-
# start of the main test/display page
|
|
10
|
-
cat >| test/index.html << EOF
|
|
11
|
-
<style>
|
|
12
|
-
div {
|
|
13
|
-
display: inline-block;
|
|
14
|
-
width: 100px;
|
|
15
|
-
padding: 5px;
|
|
16
|
-
border: 1px solid gray;
|
|
17
|
-
border-radius: 5px;
|
|
18
|
-
vertical-align: top;
|
|
19
|
-
margin: 10px 5px;
|
|
20
|
-
background-color: #e9e9e9;
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
<body>
|
|
24
|
-
EOF
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
for SVG in svg/*.svg; do
|
|
28
|
-
BASENAME=$(basename $SVG .svg)
|
|
29
|
-
OUT=src/${BASENAME}.js
|
|
30
|
-
echo "generating $SVG => $OUT"
|
|
31
|
-
|
|
32
|
-
# create icon's `src/...js` JS file
|
|
33
|
-
cat >| $OUT << EOF
|
|
34
|
-
import IAIconBase from './base.js';
|
|
35
|
-
|
|
36
|
-
class IAIcon extends IAIconBase {
|
|
37
|
-
constructor() {
|
|
38
|
-
super(\`
|
|
39
|
-
$(cat $SVG)
|
|
40
|
-
\`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
customElements.define('ia-icon-$BASENAME', IAIcon);
|
|
45
|
-
|
|
46
|
-
export default IAIcon;
|
|
47
|
-
EOF
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# add the icon to the test page
|
|
51
|
-
cat >> test/index.html << EOF
|
|
52
|
-
|
|
53
|
-
<div>
|
|
54
|
-
<ia-icon-$BASENAME/>
|
|
55
|
-
<hr>
|
|
56
|
-
<ia-icon-$BASENAME></ia-icon-$BASENAME>
|
|
57
|
-
</div>
|
|
58
|
-
<script type="module" src="../src/$BASENAME.js"></script>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
EOF
|
|
62
|
-
|
|
63
|
-
done
|