Skip to content

Commit 6c9ed90

Browse files
authored
v1.0.0 🚀 (#27)
- Enable strict mode - Simplify class names and html structure - Add preview variant - Showcase preview variant in demo - Internal props as @State protected properties - Fix [issues with class fields](https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields), use declare and define defaults in constructor - Remove excess `request.update()` calls - Hide protected properties from docs - Add eslint
1 parent 4e9b310 commit 6c9ed90

10 files changed

+616
-1508
lines changed

.eslintrc

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/** @type {import("eslint").Linter.Config} */
2+
{
3+
"extends": ["plugin:@typescript-eslint/recommended"],
4+
"rules": {},
5+
"reportUnusedDisableDirectives": true
6+
}

CHANGELOG.md

+18-8
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,45 @@
1-
# Changelog
1+
## 1.0.0 (2023-03-02)
22

3-
## [1.0.0-beta.4] - 2023-03-01
3+
- Enable strict mode
4+
- Simplify class names and html structure
5+
- Add preview variant
6+
- Showcase preview variant in demo
7+
- Internal props as @state protected properties
8+
- Fix [issues with class fields](https://lit.dev/docs/components/properties/#avoiding-issues-with-class-fields), use declare and define defaults in constructor
9+
- Remove excess `request.update()` calls
10+
- Hide protected properties from docs
11+
- Add eslint
12+
13+
## 1.0.0-beta.4 (2023-03-01)
414

515
- Change bg-color on img components to `bg-inherit`
616

7-
## [1.0.0-beta.3] - 2023-03-01
17+
## 1.0.0-beta.3 (2023-03-01)
818

919
- Add "./lit-weather" to package.json exports
1020
- Add `.js` extension to import in `./lit-weather.ts`
1121
- Add bg color to img element
1222

13-
## [1.0.0-beta.2] - 2023-03-01
23+
## 1.0.0-beta.2 (2023-03-01)
1424

1525
- Add global JSX.IntrinsicElements def for react
1626
- Include custom-elements.json in package.json files array
1727
- Mark optional properties as optional in typescript
1828

19-
## [1.0.0-beta.1] - 2023-02-28
29+
## 1.0.0-beta.1 (2023-02-28)
2030

2131
- Add icons to package.json files array
2232
- Add "demo/assets" to package.json files array
2333

24-
## [1.0.0-beta.0] - 2023-02-28
34+
## 1.0.0-beta.0 (2023-02-28)
2535

2636
- Typescript
2737

28-
## [1.0.0-alpha.2] - 2020-03-11
38+
## 1.0.0-alpha.2 (2020-03-11)
2939

3040
- Add number type support for query property
3141
- dispatch data-changed event
3242

33-
## [1.0.0-alpha.1] - 2020-03-10
43+
## 1.0.0-alpha.1 (2020-03-10)
3444

3545
- Initial commit

custom-elements.json

+96-50
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,45 @@
1414
{
1515
"kind": "method",
1616
"name": "createRenderRoot",
17-
"privacy": "protected"
17+
"privacy": "protected",
18+
"description": "Disable shadow-dom"
1819
},
1920
{
2021
"kind": "method",
21-
"name": "render"
22+
"name": "render",
23+
"privacy": "protected"
24+
},
25+
{
26+
"kind": "field",
27+
"name": "Header",
28+
"privacy": "protected"
2229
},
2330
{
2431
"kind": "field",
25-
"name": "Header"
32+
"name": "Forecast",
33+
"privacy": "protected"
2634
},
2735
{
2836
"kind": "field",
29-
"name": "Forecast"
37+
"name": "Preview",
38+
"privacy": "protected"
3039
},
3140
{
3241
"kind": "field",
33-
"name": "Content"
42+
"name": "Content",
43+
"privacy": "protected"
3444
},
3545
{
3646
"kind": "field",
37-
"name": "ErrorContent"
47+
"name": "ErrorContent",
48+
"privacy": "protected"
3849
},
3950
{
4051
"kind": "field",
4152
"name": "query",
4253
"type": {
4354
"text": "string"
4455
},
45-
"default": "''",
4656
"description": "The query to lookup via openweatherapi. <br/>\n<code>{city}</code> <br/>\n<code>{city}, {state}</code> <br/>\n<code>{city}, {state}, {country}</code> <br/>\n<code>{zip code}</code> <br/>\n<code>{zip code},{country code}</code>"
4757
},
4858
{
@@ -51,7 +61,6 @@
5161
"type": {
5262
"text": "string"
5363
},
54-
"default": "''",
5564
"description": "Your openweather API token"
5665
},
5766
{
@@ -60,34 +69,33 @@
6069
"type": {
6170
"text": "'Imperial' | 'Metric' | undefined"
6271
},
63-
"default": "'Imperial'",
64-
"description": "The units to use for the weather"
72+
"description": "The units to use for the weather",
73+
"default": "'Imperial'"
6574
},
6675
{
6776
"kind": "field",
6877
"name": "variant",
6978
"type": {
70-
"text": "'stacked' | 'horizontal' | undefined"
79+
"text": "'stacked' | 'preview' | undefined"
7180
},
72-
"default": "'stacked'",
73-
"description": "Variant for pre-defined tw classes"
81+
"description": "Variant for pre-defined tw classes",
82+
"default": "'stacked'"
7483
},
7584
{
7685
"kind": "field",
7786
"name": "cn",
7887
"type": {
79-
"text": "typeof classNames | undefined"
88+
"text": "typeof defaultCn | undefined"
8089
},
81-
"default": "{\n wrapper: 'block',\n 'location-wrapper': '',\n location: 'text-2xl font-medium',\n today: `text-base ${secondaryTextColorClasses}`,\n description: `text-sm mb-3 capitalize ${secondaryTextColorClasses}`,\n time: `text-base mb-4 ${secondaryTextColorClasses}`,\n 'temp-wrapper-desktop': 'flex flex-col-reverse',\n 'temp-wrapper': 'flex horizontal',\n 'img-temp-wrapper': 'flex',\n img: 'h-[70px] w-[70px] mr-3 bg-inherit rounded',\n 'unit-toggle': `text-lg mt-1.5 ml-2 ${secondaryTextColorClasses}`,\n 'unit-toggle-active': `text-black dark:text-white`,\n temp: 'text-7xl',\n 'extra-info': `flex-col text-xs ml-6 mt-2 hidden sm:flex ${secondaryTextColorClasses}`,\n 'forecast-wrapper': 'flex flex-wrap gap-6 sm:gap-8 mt-4',\n 'forecast-item': 'flex flex-col items-center',\n 'forecast-item-title': `text-center text-sm font-medium mb-1 ${secondaryTextColorClasses}`,\n 'forecast-item-high': 'text-sm',\n 'forecast-item-low': `text-sm ${secondaryTextColorClasses}`,\n 'forecast-item-img': 'mb-1 bg-inherit',\n 'error-img': 'h-[120px] w-[120px] mb-4',\n 'error-text': 'text-2xl text-center',\n 'mobile-header': 'md:hidden',\n loading: 'text-center',\n}",
82-
"description": "Class names applied to elements"
90+
"description": "Class names applied to elements",
91+
"default": "{\n wrapper: 'block',\n location: 'text-2xl font-medium',\n today: `text-base ${grayTxt}`,\n description: `text-sm mb-3 capitalize ${grayTxt}`,\n time: `text-base mb-4 ${grayTxt}`,\n img: 'h-[70px] w-[70px] mr-3 bg-inherit rounded',\n 'img-loading': 'h-[70px] w-[70px] bg-gray-50 dark:bg-gray-800 mr-3 bg-inherit rounded',\n 'extra-info': `flex-col text-xs ml-6 mt-2 hidden sm:flex ${grayTxt}`,\n 'temp-wrapper': 'flex horizontal',\n 'temp-content': 'flex',\n temp: 'text-7xl',\n 'unit-toggle': `text-lg mt-1.5 ml-2 ${grayTxt}`,\n 'unit-toggle-active': `text-black dark:text-white`,\n 'forecast-wrapper': 'flex flex-wrap gap-6 sm:gap-8 mt-4',\n 'forecast-item': 'flex flex-col items-center',\n 'forecast-item-title': `text-center text-sm font-medium mb-1 ${grayTxt}`,\n 'forecast-item-high': 'text-sm',\n 'forecast-item-low': `text-sm ${grayTxt}`,\n 'forecast-item-img': 'mb-1 bg-inherit',\n 'forecast-item-img-loading': 'h-[48px] w-[48px] rounded-lg bg-gray-50 dark:bg-gray-800',\n error: 'text-sm',\n 'preview-wrapper': 'flex items-center',\n 'preview-img': 'h-6 w-6 mr-2 bg-inherit rounded',\n 'preview-img-loading': 'h-6 w-6 bg-gray-50 dark:bg-gray-800 rounded-xl',\n 'preview-temp': 'text-lg',\n 'preview-temp-content': 'flex',\n 'preview-unit-toggle': `text-xs mt-0.5 ml-1 ${grayTxt}`,\n}"
8392
},
8493
{
8594
"kind": "field",
8695
"name": "icons",
8796
"type": {
8897
"text": "'default' | 'openweather' | undefined"
8998
},
90-
"default": "'default'",
9199
"description": "Icon type, defaults to a combination of material weather icons and openweather icons"
92100
},
93101
{
@@ -96,60 +104,76 @@
96104
"type": {
97105
"text": "string | undefined"
98106
},
99-
"default": "'https://www.unpkg.com/lit-weather/icons/'",
100-
"description": "If you are self-hosting the iconset"
107+
"description": "If you are self-hosting the iconset",
108+
"default": "'https://www.unpkg.com/lit-weather/icons/'"
101109
},
102110
{
103111
"kind": "field",
104-
"name": "loading",
112+
"name": "_loading",
105113
"type": {
106114
"text": "boolean | undefined"
107115
},
108-
"default": "true",
109-
"description": "When true, a request is being made and the skeleton state is shown"
116+
"privacy": "protected",
117+
"description": "When true, a request is being made and the skeleton state is shown",
118+
"default": "true"
110119
},
111120
{
112121
"kind": "field",
113-
"name": "error",
122+
"name": "_error",
114123
"type": {
115124
"text": "boolean | undefined"
116125
},
117-
"default": "false",
118-
"description": "true when there is an error"
126+
"privacy": "protected",
127+
"description": "true when there is an error",
128+
"default": "false"
119129
},
120130
{
121131
"kind": "field",
122-
"name": "weekDayName",
132+
"name": "_weekDayName",
123133
"type": {
124134
"text": "string | undefined"
125135
},
136+
"privacy": "protected",
126137
"description": "The day of the week"
127138
},
128139
{
129140
"kind": "field",
130-
"name": "time",
141+
"name": "_time",
131142
"type": {
132143
"text": "string | undefined"
133144
},
145+
"privacy": "protected",
134146
"description": "The current time"
135147
},
136148
{
137149
"kind": "field",
138-
"name": "forecast",
150+
"name": "_forecast",
139151
"type": {
140-
"text": "Forecast | undefined"
152+
"text": "{\n weekDayName: string;\n high: number;\n low: number;\n weatherImgSrc: string;\n }[] | undefined"
141153
},
142-
"default": "[]",
143-
"description": "The forecast data"
154+
"privacy": "protected",
155+
"description": "The forecast data",
156+
"default": "[]"
144157
},
145158
{
146159
"kind": "field",
147-
"name": "data",
160+
"name": "_data",
148161
"type": {
149-
"text": "Data | undefined"
162+
"text": "{\n name?: string;\n id?: number;\n sunrise?: string;\n sunset?: string;\n temp?: number;\n description?: string;\n humidity?: string;\n wind?: string;\n weatherImgSrc?: string;\n fullForecastUrl?: string;\n tempFeelsLike?: number;\n }"
150163
},
151-
"default": "{}",
152-
"description": "API response for the current weather"
164+
"privacy": "protected",
165+
"description": "API response for the current weather",
166+
"default": "{}"
167+
},
168+
{
169+
"kind": "field",
170+
"name": "_cn",
171+
"privacy": "protected",
172+
"default": "{\n wrapper: 'block',\n location: 'text-2xl font-medium',\n today: `text-base ${grayTxt}`,\n description: `text-sm mb-3 capitalize ${grayTxt}`,\n time: `text-base mb-4 ${grayTxt}`,\n img: 'h-[70px] w-[70px] mr-3 bg-inherit rounded',\n 'img-loading': 'h-[70px] w-[70px] bg-gray-50 dark:bg-gray-800 mr-3 bg-inherit rounded',\n 'extra-info': `flex-col text-xs ml-6 mt-2 hidden sm:flex ${grayTxt}`,\n 'temp-wrapper': 'flex horizontal',\n 'temp-content': 'flex',\n temp: 'text-7xl',\n 'unit-toggle': `text-lg mt-1.5 ml-2 ${grayTxt}`,\n 'unit-toggle-active': `text-black dark:text-white`,\n 'forecast-wrapper': 'flex flex-wrap gap-6 sm:gap-8 mt-4',\n 'forecast-item': 'flex flex-col items-center',\n 'forecast-item-title': `text-center text-sm font-medium mb-1 ${grayTxt}`,\n 'forecast-item-high': 'text-sm',\n 'forecast-item-low': `text-sm ${grayTxt}`,\n 'forecast-item-img': 'mb-1 bg-inherit',\n 'forecast-item-img-loading': 'h-[48px] w-[48px] rounded-lg bg-gray-50 dark:bg-gray-800',\n error: 'text-sm',\n 'preview-wrapper': 'flex items-center',\n 'preview-img': 'h-6 w-6 mr-2 bg-inherit rounded',\n 'preview-img-loading': 'h-6 w-6 bg-gray-50 dark:bg-gray-800 rounded-xl',\n 'preview-temp': 'text-lg',\n 'preview-temp-content': 'flex',\n 'preview-unit-toggle': `text-xs mt-0.5 ml-1 ${grayTxt}`,\n}",
173+
"description": "Applied classnames",
174+
"type": {
175+
"text": "object"
176+
}
153177
},
154178
{
155179
"kind": "method",
@@ -180,10 +204,16 @@
180204
"name": "_generateRequests",
181205
"parameters": [
182206
{
183-
"name": "key"
207+
"name": "key",
208+
"type": {
209+
"text": "typeof this.token"
210+
}
184211
},
185212
{
186-
"name": "query"
213+
"name": "query",
214+
"type": {
215+
"text": "typeof this.query"
216+
}
187217
}
188218
]
189219
},
@@ -192,7 +222,10 @@
192222
"name": "_getLocationParam",
193223
"parameters": [
194224
{
195-
"name": "query"
225+
"name": "query",
226+
"type": {
227+
"text": "string"
228+
}
196229
}
197230
]
198231
},
@@ -201,10 +234,16 @@
201234
"name": "_getCurrentWeather",
202235
"parameters": [
203236
{
204-
"name": "key"
237+
"name": "key",
238+
"type": {
239+
"text": "string"
240+
}
205241
},
206242
{
207-
"name": "locationParam"
243+
"name": "locationParam",
244+
"type": {
245+
"text": "string"
246+
}
208247
}
209248
]
210249
},
@@ -213,28 +252,32 @@
213252
"name": "_getForecast",
214253
"parameters": [
215254
{
216-
"name": "key"
255+
"name": "key",
256+
"type": {
257+
"text": "string"
258+
}
217259
},
218260
{
219-
"name": "locationParam"
261+
"name": "locationParam",
262+
"type": {
263+
"text": "string"
264+
}
220265
}
221266
]
222267
},
223268
{
224269
"kind": "method",
225-
"name": "_handleWeatherError",
226-
"parameters": [
227-
{
228-
"name": "err"
229-
}
230-
]
270+
"name": "_handleWeatherError"
231271
},
232272
{
233273
"kind": "method",
234274
"name": "_computeForecast",
235275
"parameters": [
236276
{
237-
"name": "items"
277+
"name": "items",
278+
"type": {
279+
"text": "any"
280+
}
238281
}
239282
]
240283
},
@@ -243,7 +286,10 @@
243286
"name": "_imgSrc",
244287
"parameters": [
245288
{
246-
"name": "{ icon, id, dynamicDayOrNightString = false }"
289+
"name": "{\n icon,\n id,\n dynamicDayOrNightString = false,\n }",
290+
"type": {
291+
"text": "{\n icon: string;\n id: number;\n dynamicDayOrNightString?: boolean;\n }"
292+
}
247293
}
248294
]
249295
}

0 commit comments

Comments
 (0)