Skip to content

Commit

Permalink
v1.0.0 🚀 (#27)
Browse files Browse the repository at this point in the history
 - 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
  • Loading branch information
ryanburns23 authored Mar 2, 2023
1 parent 4e9b310 commit 6c9ed90
Show file tree
Hide file tree
Showing 10 changed files with 616 additions and 1,508 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** @type {import("eslint").Linter.Config} */
{
"extends": ["plugin:@typescript-eslint/recommended"],
"rules": {},
"reportUnusedDisableDirectives": true
}
26 changes: 18 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
# Changelog
## 1.0.0 (2023-03-02)

## [1.0.0-beta.4] - 2023-03-01
- 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.0.0-beta.4 (2023-03-01)

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

## [1.0.0-beta.3] - 2023-03-01
## 1.0.0-beta.3 (2023-03-01)

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

## [1.0.0-beta.2] - 2023-03-01
## 1.0.0-beta.2 (2023-03-01)

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

## [1.0.0-beta.1] - 2023-02-28
## 1.0.0-beta.1 (2023-02-28)

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

## [1.0.0-beta.0] - 2023-02-28
## 1.0.0-beta.0 (2023-02-28)

- Typescript

## [1.0.0-alpha.2] - 2020-03-11
## 1.0.0-alpha.2 (2020-03-11)

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

## [1.0.0-alpha.1] - 2020-03-10
## 1.0.0-alpha.1 (2020-03-10)

- Initial commit
146 changes: 96 additions & 50 deletions custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,45 @@
{
"kind": "method",
"name": "createRenderRoot",
"privacy": "protected"
"privacy": "protected",
"description": "Disable shadow-dom"
},
{
"kind": "method",
"name": "render"
"name": "render",
"privacy": "protected"
},
{
"kind": "field",
"name": "Header",
"privacy": "protected"
},
{
"kind": "field",
"name": "Header"
"name": "Forecast",
"privacy": "protected"
},
{
"kind": "field",
"name": "Forecast"
"name": "Preview",
"privacy": "protected"
},
{
"kind": "field",
"name": "Content"
"name": "Content",
"privacy": "protected"
},
{
"kind": "field",
"name": "ErrorContent"
"name": "ErrorContent",
"privacy": "protected"
},
{
"kind": "field",
"name": "query",
"type": {
"text": "string"
},
"default": "''",
"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>"
},
{
Expand All @@ -51,7 +61,6 @@
"type": {
"text": "string"
},
"default": "''",
"description": "Your openweather API token"
},
{
Expand All @@ -60,34 +69,33 @@
"type": {
"text": "'Imperial' | 'Metric' | undefined"
},
"default": "'Imperial'",
"description": "The units to use for the weather"
"description": "The units to use for the weather",
"default": "'Imperial'"
},
{
"kind": "field",
"name": "variant",
"type": {
"text": "'stacked' | 'horizontal' | undefined"
"text": "'stacked' | 'preview' | undefined"
},
"default": "'stacked'",
"description": "Variant for pre-defined tw classes"
"description": "Variant for pre-defined tw classes",
"default": "'stacked'"
},
{
"kind": "field",
"name": "cn",
"type": {
"text": "typeof classNames | undefined"
"text": "typeof defaultCn | undefined"
},
"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}",
"description": "Class names applied to elements"
"description": "Class names applied to elements",
"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}"
},
{
"kind": "field",
"name": "icons",
"type": {
"text": "'default' | 'openweather' | undefined"
},
"default": "'default'",
"description": "Icon type, defaults to a combination of material weather icons and openweather icons"
},
{
Expand All @@ -96,60 +104,76 @@
"type": {
"text": "string | undefined"
},
"default": "'https://www.unpkg.com/lit-weather/icons/'",
"description": "If you are self-hosting the iconset"
"description": "If you are self-hosting the iconset",
"default": "'https://www.unpkg.com/lit-weather/icons/'"
},
{
"kind": "field",
"name": "loading",
"name": "_loading",
"type": {
"text": "boolean | undefined"
},
"default": "true",
"description": "When true, a request is being made and the skeleton state is shown"
"privacy": "protected",
"description": "When true, a request is being made and the skeleton state is shown",
"default": "true"
},
{
"kind": "field",
"name": "error",
"name": "_error",
"type": {
"text": "boolean | undefined"
},
"default": "false",
"description": "true when there is an error"
"privacy": "protected",
"description": "true when there is an error",
"default": "false"
},
{
"kind": "field",
"name": "weekDayName",
"name": "_weekDayName",
"type": {
"text": "string | undefined"
},
"privacy": "protected",
"description": "The day of the week"
},
{
"kind": "field",
"name": "time",
"name": "_time",
"type": {
"text": "string | undefined"
},
"privacy": "protected",
"description": "The current time"
},
{
"kind": "field",
"name": "forecast",
"name": "_forecast",
"type": {
"text": "Forecast | undefined"
"text": "{\n weekDayName: string;\n high: number;\n low: number;\n weatherImgSrc: string;\n }[] | undefined"
},
"default": "[]",
"description": "The forecast data"
"privacy": "protected",
"description": "The forecast data",
"default": "[]"
},
{
"kind": "field",
"name": "data",
"name": "_data",
"type": {
"text": "Data | undefined"
"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 }"
},
"default": "{}",
"description": "API response for the current weather"
"privacy": "protected",
"description": "API response for the current weather",
"default": "{}"
},
{
"kind": "field",
"name": "_cn",
"privacy": "protected",
"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}",
"description": "Applied classnames",
"type": {
"text": "object"
}
},
{
"kind": "method",
Expand Down Expand Up @@ -180,10 +204,16 @@
"name": "_generateRequests",
"parameters": [
{
"name": "key"
"name": "key",
"type": {
"text": "typeof this.token"
}
},
{
"name": "query"
"name": "query",
"type": {
"text": "typeof this.query"
}
}
]
},
Expand All @@ -192,7 +222,10 @@
"name": "_getLocationParam",
"parameters": [
{
"name": "query"
"name": "query",
"type": {
"text": "string"
}
}
]
},
Expand All @@ -201,10 +234,16 @@
"name": "_getCurrentWeather",
"parameters": [
{
"name": "key"
"name": "key",
"type": {
"text": "string"
}
},
{
"name": "locationParam"
"name": "locationParam",
"type": {
"text": "string"
}
}
]
},
Expand All @@ -213,28 +252,32 @@
"name": "_getForecast",
"parameters": [
{
"name": "key"
"name": "key",
"type": {
"text": "string"
}
},
{
"name": "locationParam"
"name": "locationParam",
"type": {
"text": "string"
}
}
]
},
{
"kind": "method",
"name": "_handleWeatherError",
"parameters": [
{
"name": "err"
}
]
"name": "_handleWeatherError"
},
{
"kind": "method",
"name": "_computeForecast",
"parameters": [
{
"name": "items"
"name": "items",
"type": {
"text": "any"
}
}
]
},
Expand All @@ -243,7 +286,10 @@
"name": "_imgSrc",
"parameters": [
{
"name": "{ icon, id, dynamicDayOrNightString = false }"
"name": "{\n icon,\n id,\n dynamicDayOrNightString = false,\n }",
"type": {
"text": "{\n icon: string;\n id: number;\n dynamicDayOrNightString?: boolean;\n }"
}
}
]
}
Expand Down
Loading

1 comment on commit 6c9ed90

@vercel
Copy link

@vercel vercel bot commented on 6c9ed90 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.