Skip to content

Commit c0d900e

Browse files
author
Ryan Burns
committed
init
0 parents  commit c0d900e

Some content is hidden

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

46 files changed

+14467
-0
lines changed

.editorconfig

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
10+
# Change these settings to your own preference
11+
indent_style = space
12+
indent_size = 2
13+
14+
# We recommend you to keep these unchanged
15+
end_of_line = lf
16+
charset = utf-8
17+
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false
22+
23+
[*.json]
24+
indent_size = 2
25+
26+
[*.{html,js,md}]
27+
block_comment_start = /**
28+
block_comment = *
29+
block_comment_end = */

.gitignore

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## editors
2+
/.idea
3+
/.vscode
4+
5+
## system files
6+
.DS_Store
7+
8+
## npm
9+
/node_modules/
10+
/npm-debug.log
11+
12+
## testing
13+
/coverage/
14+
15+
## temp folders
16+
/.tmp/
17+
18+
# build
19+
/_site/
20+
/dist/

.storybook/main.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
stories: ['../stories/**/*.stories.{js,mdx}'],
3+
esDevServer: {
4+
// custom es-dev-server options
5+
},
6+
};

.storybook/preview.js

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import {
2+
addParameters,
3+
addDecorator,
4+
setCustomElements,
5+
withA11y
6+
} from '@open-wc/demoing-storybook';
7+
8+
async function run() {
9+
const customElements = await (
10+
await fetch(new URL('../custom-elements.json', import.meta.url))
11+
).json();
12+
setCustomElements(customElements);
13+
14+
addDecorator(withA11y);
15+
16+
addParameters({
17+
a11y: {
18+
config: {},
19+
options: {
20+
checks: { 'color-contrast': { options: { noScroll: true } } },
21+
restoreScroll: true
22+
}
23+
},
24+
docs: {
25+
iframeHeight: '200px'
26+
}
27+
});
28+
}
29+
30+
run();

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 lit-weather
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+103

custom-elements.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"version": 2,
3+
"tags": [
4+
{
5+
"name": "lit-weather",
6+
"description": "A component with a title and an action counter",
7+
"properties": [
8+
{
9+
"name": "title",
10+
"type": "String",
11+
"description": "The title of your component",
12+
"default": "Hey there"
13+
},
14+
{
15+
"name": "counter",
16+
"type": "Number",
17+
"description": "An action counter",
18+
"default": 0
19+
}
20+
],
21+
"events": [],
22+
"slots": [],
23+
"cssProperties": [
24+
{
25+
"name": "--lit-weather-text-color",
26+
"description": "Main Text Color",
27+
"type": "Color"
28+
}
29+
]
30+
}
31+
]
32+
}

demo/index.html

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html lang="en-GB">
3+
<head>
4+
<meta charset="utf-8" />
5+
<style>
6+
body {
7+
max-width: 700px;
8+
margin: 50px auto;
9+
background: #ffffff;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
<demo-element></demo-element>
15+
16+
<script type="module">
17+
import { LitElement, html } from 'lit-element';
18+
import '../lit-weather.js';
19+
20+
class DemoElement extends LitElement {
21+
render() {
22+
return html`
23+
<style>
24+
lit-weather {
25+
padding: 20px 16px 24px 16px;
26+
border: 1px solid #dfe1e5;
27+
border-radius: 8px;
28+
}
29+
30+
input {
31+
margin-bottom: 50px;
32+
}
33+
</style>
34+
35+
<input
36+
.value="${this.value}"
37+
@change="${e => {
38+
this.value = e.srcElement.value;
39+
}}"
40+
/>
41+
<button @click="${this.refresh}">Refresh</button>
42+
43+
<lit-weather
44+
.query="${this.value}"
45+
.apiKey=${`dbb6d88373f5de18206bd0c7c4249bed`}
46+
></lit-weather>
47+
`;
48+
}
49+
50+
static get properties() {
51+
return {
52+
value: { type: String },
53+
value2: { type: String },
54+
};
55+
}
56+
57+
constructor() {
58+
super();
59+
this.value = 'Santa Barbara';
60+
}
61+
62+
refresh() {
63+
this.shadowRoot.querySelector('lit-weather').refresh();
64+
}
65+
}
66+
67+
customElements.define('demo-element', DemoElement);
68+
</script>
69+
</body>
70+
</html>

icons/clear-day.png

11.2 KB

icons/clear-night.png

10.3 KB

icons/cloudy-weather.png

10.1 KB

icons/haze-day.png

13.8 KB

icons/haze-night.png

15 KB

icons/mostly-cloudy-day.png

19.3 KB

icons/mostly-cloudy-night.png

16.7 KB

icons/not used/haze-weather.png

12.3 KB

icons/not used/rain-snow-day.png

15.7 KB

icons/not used/rain-snow-night.png

16.9 KB

icons/not used/rain-snow.png

14.3 KB

icons/not used/rainy-weather.png

13.8 KB

icons/not used/snow-weather.png

14.2 KB

icons/not used/storm-weather-day.png

15.3 KB
16.3 KB

icons/not used/storm-weather.png

13.9 KB

icons/not used/thunder-weather.png

11.7 KB

icons/not used/windy-weather.png

11.5 KB

icons/partly-cloudy-day.png

16 KB

icons/partly-cloudy-night.png

16 KB

icons/rainy-day.png

14.9 KB

icons/rainy-night.png

16.1 KB

icons/snow-day.png

15.5 KB

icons/snow-night.png

16.6 KB

icons/thunder-day.png

13 KB

icons/thunder-night.png

14.2 KB

icons/unknown.png

19.5 KB

icons/windy-day.png

12.9 KB

icons/windy-night.png

13.9 KB

index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { LitWeather } from './src/LitWeather.js';

karma.bs.config.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const merge = require('deepmerge');
3+
const { bsSettings } = require('@open-wc/testing-karma-bs');
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: 'your-name',
11+
},
12+
}),
13+
);
14+
15+
return config;
16+
};

karma.conf.js

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* eslint-disable import/no-extraneous-dependencies */
2+
const { createDefaultConfig } = require('@open-wc/testing-karma');
3+
const merge = require('deepmerge');
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+
}),
22+
);
23+
return config;
24+
};

lit-weather.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { LitWeather } from './src/LitWeather.js';
2+
3+
window.customElements.define('lit-weather', LitWeather);

0 commit comments

Comments
 (0)