Compare commits

...
12 Commits
Author SHA1 Message Date
shmyga 32956af5f0 ci(version): 0.10.8
test / test (push) Successful in 1m6s
release / release (push) Failing after 1m26s
2026-11-02 22:57:56 +03:00
shmyga 57112793e7 fix(weather): fix rp5 and yandexweather parsers 2026-11-02 22:57:23 +03:00
shmyga ecfa9caecc ci(version): 0.10.7
test / test (push) Successful in 42s
release / release (push) Successful in 11m53s
2026-10-13 18:01:05 +03:00
shmyga c0ae3f3be8 fix(gismeteo): add sky parser value variant 2026-10-13 18:00:47 +03:00
shmyga 4a31aad423 ci(version): 0.10.6
release / release (push) Successful in 12m45s
test / test (push) Successful in 52s
2026-10-05 21:16:14 +03:00
shmyga 0946aacc3f feat(schedule): add schedule categorie icons
test / test (push) Successful in 56s
2026-10-05 20:46:04 +03:00
shmyga f9e810049d feat(static): add favicon
test / test (push) Successful in 1m19s
2026-10-05 19:31:08 +03:00
shmyga 160e1f9156 ci(version): 0.10.5
release / release (push) Successful in 3m53s
test / test (push) Successful in 52s
2026-09-30 20:57:43 +03:00
shmyga ad8f29c5ef feat(easel): add api link button to views
test / test (push) Successful in 59s
2026-09-30 20:56:17 +03:00
shmyga 4fc1c8c8e5 docs(readme): add test status badge
test / test (push) Successful in 56s
2026-09-30 19:43:27 +03:00
shmyga e414a93242 ci(action): add deploy action
release / release (push) Successful in 46s
test / test (push) Successful in 44s
2026-09-30 19:23:07 +03:00
shmyga 714fd1567c ci(action): use project-manager action
release / release (push) Successful in 39s
test / test (push) Successful in 49s
2026-09-30 16:03:23 +03:00
45 changed files with 225 additions and 67 deletions
-32
View File
@@ -1,32 +0,0 @@
name: "Setup"
description: "Setup project"
inputs:
python-version:
default: "3.14"
runs:
using: "composite"
steps:
- id: setup-python
uses: actions/setup-python@v7
with:
python-version: ${{ inputs.python-version }}
cache: "pip"
- run: |
pip install project-manager \
--index-url https://git.shmyga.ru/api/packages/InfernalGames/pypi/simple/ \
--extra-index-url https://pypi.org/simple
- run: pm setup:config -vv
# setup python venv
- run: pip install poetry
- id: cache-venv
uses: actions/cache@v6
with:
path: .venv
key: venv-${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}-v1
- if: steps.cache-venv.outputs.cache-hit != 'true'
run: pm setup:python -vv
+22
View File
@@ -0,0 +1,22 @@
name: deploy
on:
workflow_run:
workflows: [release]
types: [completed]
jobs:
deploy:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USERNAME }}
key: ${{ secrets.DEPLOY_KEY }}
passphrase: ${{ secrets.DEPLOY_PASSPHRASE }}
script: |
cd /opt/gallery
docker compose pull
docker compose up -d
+5 -6
View File
@@ -2,20 +2,19 @@ name: release
on: on:
push: push:
tags: ["*"] tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- uses: ./.gitea/actions/setup - uses: https://git.shmyga.ru/InfernalGames/project-manager@master
- run: pm lint -vv
- run: pm test -vv
- run: pm build:docker -vv - run: pm build:docker -vv
- uses: docker/login-action@v4 - uses: docker/login-action@v4
with: with:
registry: git.shmyga.ru registry: git.shmyga.ru
username: ${{ vars.DOCKERHUB_USERNAME }} username: ${{ vars.PUBLISH_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.PUBLISH_TOKEN }}
- run: pm publish:docker -vv - run: pm publish:docker -vv
+3 -1
View File
@@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v7 - uses: actions/checkout@v7
- uses: ./.gitea/actions/setup - uses: https://git.shmyga.ru/InfernalGames/project-manager@master
with:
setup-python: true
- run: pm lint -vv - run: pm lint -vv
- run: pm test -vv - run: pm test -vv
+2
View File
@@ -1,5 +1,7 @@
# API Gallery # API Gallery
[![test](https://git.shmyga.ru/InfernalGames/gallery/actions/workflows/test.yaml/badge.svg?branch=master)](https://git.shmyga.ru/InfernalGames/gallery/actions?workflow=test.yaml)
Currently implemented APIs: Currently implemented APIs:
- Weather forecast - Weather forecast
@@ -14,7 +14,7 @@
<script type="module" <script type="module"
src="/static/gallery.js?v={{version}}"></script> src="/static/gallery.js?v={{version}}"></script>
<link rel="icon" <link rel="icon"
href="/favicon.ico?v={{version}}" href="/static/favicon.ico?v={{version}}"
type="image/x-icon"> type="image/x-icon">
{% endblock %} {% endblock %}
</head> </head>
+23 -11
View File
@@ -1,4 +1,3 @@
import datetime
from pathlib import Path from pathlib import Path
from urllib import parse from urllib import parse
@@ -13,9 +12,7 @@ from gallery.easel.depends.schedule import (
ScheduleApiDepends, ScheduleApiDepends,
ScheduleGroupChannelsDepends, ScheduleGroupChannelsDepends,
) )
from gallery.sketch.bundle import ApiBundle
from gallery.sketch.schedule.api import ScheduleApi from gallery.sketch.schedule.api import ScheduleApi
from gallery.sketch.schedule.model import Schedule
from ..common.utils.template import build_templates from ..common.utils.template import build_templates
from .filters import timedelta_format from .filters import timedelta_format
@@ -52,12 +49,6 @@ async def get_schedule_index(request: AppRequest, provider: str | None = None, q
) )
async def _get_group_schedule(api: ApiBundle, channels: list[tuple[str, str]], date: datetime.date) -> list[Schedule]:
return [
await api.get_api(ScheduleApi, provider).get_schedule(channel_id, date) for provider, channel_id in channels
]
@router.get("/group/{group_id}", response_class=RedirectResponse) @router.get("/group/{group_id}", response_class=RedirectResponse)
async def get_group_default(group_id: str): async def get_group_default(group_id: str):
return RedirectResponse(f"{parse.quote(group_id)}/today") return RedirectResponse(f"{parse.quote(group_id)}/today")
@@ -72,7 +63,16 @@ async def get_group(request: AppRequest, channels: ScheduleGroupChannelsDepends,
return templates.TemplateResponse( return templates.TemplateResponse(
request=request, request=request,
name="group.html", name="group.html",
context={"responses": responses}, context={
"responses": responses,
"api_route": "/".join(
[
"/api/schedule/group",
request.path_params["group_id"],
request.path_params["date"],
]
),
},
) )
@@ -87,5 +87,17 @@ async def get_channel(request: AppRequest, schedule_api: ScheduleApiDepends, cha
return templates.TemplateResponse( return templates.TemplateResponse(
request=request, request=request,
name="channel.html", name="channel.html",
context={"response": response}, context={
"response": response,
"api_route": (
"/".join(
[
"/api/schedule",
request.path_params["provider"],
request.path_params["channel"],
request.path_params["date"],
]
)
),
},
) )
@@ -10,6 +10,9 @@ locale=request.state.language)}}
{% block header %} {% block header %}
<app-link href="/schedule" <app-link href="/schedule"
icon="tv">{{_("TV program")}}</app-link> icon="tv">{{_("TV program")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@@ -44,9 +47,17 @@ locale=request.state.language)}}
{% for value in response.values %} {% for value in response.values %}
<tr class="{{'d-none' if (live and not value.live) else 'table-success' if (not live and value.live) else ''}}"> <tr class="{{'d-none' if (live and not value.live) else 'table-success' if (not live and value.live) else ''}}">
<td> <td>
<span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) | timedelta_format}})</span> <span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) |
timedelta_format}})</span>
</td>
<td>
{% if value.category %}
<schedule-icon icon="{{value.category}}"
data-bs-toggle="tooltip"
data-bs-title="{{value.category}}"></schedule-icon>
{% endif %}
<span>{{value.label}}</span>
</td> </td>
<td>{{value.label}}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -9,6 +9,9 @@
{% block header %} {% block header %}
<app-link href="/schedule" <app-link href="/schedule"
icon="tv">{{_("TV program")}}</app-link> icon="tv">{{_("TV program")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@@ -50,7 +53,14 @@
<span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) | <span>{{value.start.strftime('%H:%M')}}</span>&nbsp;<span class="small ms-1">({{(value.end - value.start) |
timedelta_format}})</span> timedelta_format}})</span>
</td> </td>
<td>{{value.label}}</td> <td>
{% if value.category %}
<schedule-icon icon="{{value.category}}"
data-bs-toggle="tooltip"
data-bs-title="{{value.category}}"></schedule-icon>
{% endif %}
<span>{{value.label}}</span>
</td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
@@ -29,6 +29,7 @@ def cloudness_icon(sky: Sky, date: datetime.datetime, period: str) -> list[str]:
Precipitation.RAIN: "thunderstorm", Precipitation.RAIN: "thunderstorm",
Precipitation.HEAVY_RAIN: "thunderstorm", Precipitation.HEAVY_RAIN: "thunderstorm",
Precipitation.SHOWER: "thunderstorm", Precipitation.SHOWER: "thunderstorm",
Precipitation.SMALL_SNOW: "storm-showers",
Precipitation.SNOW: "storm-showers", Precipitation.SNOW: "storm-showers",
Precipitation.HEAVY_SNOW: "storm-showers", Precipitation.HEAVY_SNOW: "storm-showers",
}[sky.precipitation] }[sky.precipitation]
@@ -47,6 +48,7 @@ def cloudness_icon(sky: Sky, date: datetime.datetime, period: str) -> list[str]:
Precipitation.RAIN: "rain-mix", Precipitation.RAIN: "rain-mix",
Precipitation.HEAVY_RAIN: "rain", Precipitation.HEAVY_RAIN: "rain",
Precipitation.SHOWER: "rain", Precipitation.SHOWER: "rain",
Precipitation.SMALL_SNOW: "snow",
Precipitation.SNOW: "snow", Precipitation.SNOW: "snow",
Precipitation.HEAVY_SNOW: "snow", Precipitation.HEAVY_SNOW: "snow",
Precipitation.HAIL: "hail", Precipitation.HAIL: "hail",
+12 -1
View File
@@ -37,7 +37,18 @@ def build_weather_response(request: AppRequest, response: WeatherResponse):
return templates.TemplateResponse( return templates.TemplateResponse(
request=request, request=request,
name="weather.html", name="weather.html",
context={"response": response}, context={
"response": response,
"api_route": "/".join(
[
"/api/weather",
request.path_params["provider"],
request.path_params["location"],
response.period,
request.path_params.get("date") or request.path_params.get("days") or "",
]
),
},
) )
@@ -7,6 +7,9 @@ locale=request.state.language)}}{% endblock %}
{% block header %} {% block header %}
<app-link href="/weather" <app-link href="/weather"
icon="brightness-high">{{_("Weather")}}</app-link> icon="brightness-high">{{_("Weather")}}</app-link>
<app-link target="_blank"
href="{{ api_route }}"
icon="filetype-json"></app-link>
{% endblock %} {% endblock %}
{% block content %} {% block content %}
+1
View File
@@ -81,6 +81,7 @@ class SkyParser(TableValueParser[Sky]):
"небольшой снег с дождём": Precipitation.SNOW, "небольшой снег с дождём": Precipitation.SNOW,
"небольшой мокрый снег": Precipitation.SNOW, "небольшой мокрый снег": Precipitation.SNOW,
"град": Precipitation.HAIL, "град": Precipitation.HAIL,
"небольшая морось": Precipitation.SMALL_RAIN,
} }
THUNDER = {"гроза"} THUNDER = {"гроза"}
+4 -1
View File
@@ -6,6 +6,7 @@ from typing import Any
from gallery.sketch.parse.core import ParsedContext, Parser from gallery.sketch.parse.core import ParsedContext, Parser
from gallery.sketch.parse.json import JSONContextParser from gallery.sketch.parse.json import JSONContextParser
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
from gallery.sketch.schedule.parse.category import CATEGORY_PARSER
from . import PROVIDER from . import PROVIDER
@@ -28,6 +29,7 @@ class MatchTVScheduleParser(JSONContextParser[ScheduleData, Schedule]):
def extract(self, data: ParsedContext[ScheduleData, Any]) -> Schedule: def extract(self, data: ParsedContext[ScheduleData, Any]) -> Schedule:
channel_data = data.data["result"]["channels"][0] channel_data = data.data["result"]["channels"][0]
channel = Channel(id=channel_data["alias"], name=channel_data["name"], provider=PROVIDER) channel = Channel(id=channel_data["alias"], name=channel_data["name"], provider=PROVIDER)
default_category = CATEGORY_PARSER.parse(channel.name)
values = [] values = []
start = datetime.datetime.combine(data.context.date, datetime.time.min) start = datetime.datetime.combine(data.context.date, datetime.time.min)
end = start + datetime.timedelta(days=1, hours=6) end = start + datetime.timedelta(days=1, hours=6)
@@ -41,7 +43,8 @@ class MatchTVScheduleParser(JSONContextParser[ScheduleData, Schedule]):
start += datetime.timedelta(days=1) start += datetime.timedelta(days=1)
item_date += datetime.timedelta(days=1) item_date += datetime.timedelta(days=1)
live = "Прямая трансляция" in title live = "Прямая трансляция" in title
value = ScheduleValue(start=item_date, end=end, label=title, live=live) category = CATEGORY_PARSER.parse(title) or default_category
value = ScheduleValue(start=item_date, end=end, label=title, category=category, live=live)
values.append(value) values.append(value)
if prev_value is not None: if prev_value is not None:
prev_value.end = item_date prev_value.end = item_date
+4
View File
@@ -86,6 +86,10 @@ class PrecipitationParser(TableValueParser[tuple[Precipitation, float]]):
"Явления погоды отсутствуют": Precipitation.NO, "Явления погоды отсутствуют": Precipitation.NO,
"Cлабый дождь": Precipitation.SMALL_RAIN, "Cлабый дождь": Precipitation.SMALL_RAIN,
"Умеренный дождь": Precipitation.RAIN, "Умеренный дождь": Precipitation.RAIN,
"Cлабый дождь со снегом": Precipitation.SMALL_SNOW,
"Слабый снег с дождём": Precipitation.SMALL_SNOW,
"Cлабый снег": Precipitation.SMALL_SNOW,
"Снег": Precipitation.SNOW,
} }
def extract(self, data: Tag) -> tuple[Precipitation, float]: def extract(self, data: Tag) -> tuple[Precipitation, float]:
+2 -1
View File
@@ -29,6 +29,7 @@ class YandexTVApi(ScheduleApi):
return self.channel_parser.parse(data) return self.channel_parser.parse(data)
async def get_schedule(self, channel_id: str, date: datetime.date) -> Schedule: async def get_schedule(self, channel_id: str, date: datetime.date) -> Schedule:
endpoint = f"{self.lr}/channel/{channel_id}?date={date:%Y-%m-%d}" channel_path_part = "channel" if "-" in channel_id else "channels"
endpoint = f"{self.lr}/{channel_path_part}/{channel_id}?date={date:%Y-%m-%d}"
data = await self.source.request(endpoint) data = await self.source.request(endpoint)
return self.schedule_parser.parse(ScheduleData(date, channel_id, data)) return self.schedule_parser.parse(ScheduleData(date, channel_id, data))
+4 -2
View File
@@ -5,10 +5,11 @@ from typing import Any
from bs4 import Tag from bs4 import Tag
from gallery.sketch.parse.core import ParsedContext, ParseError from gallery.sketch.parse.core import ParsedContext, ParseError
from gallery.sketch.parse.html import HTMLContextParser
from gallery.sketch.parse.json import JSONParser from gallery.sketch.parse.json import JSONParser
from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue from gallery.sketch.schedule.model import Channel, Schedule, ScheduleValue
from gallery.sketch.schedule.parse.category import CATEGORY_PARSER
from ...sketch.parse.html import HTMLContextParser
from . import PROVIDER from . import PROVIDER
@@ -37,7 +38,8 @@ class YandexTVScheduleParser(HTMLContextParser[ScheduleData, Schedule]):
current_day += datetime.timedelta(days=1) current_day += datetime.timedelta(days=1)
item_date += datetime.timedelta(days=1) item_date += datetime.timedelta(days=1)
live = item.select_one(".channel-schedule__info .icon_live") is not None live = item.select_one(".channel-schedule__info .icon_live") is not None
value = ScheduleValue(start=item_date, end=end, label=title, live=live) category = CATEGORY_PARSER.parse(title)
value = ScheduleValue(start=item_date, end=end, label=title, category=category, live=live)
values.append(value) values.append(value)
if prev_value is not None: if prev_value is not None:
prev_value.end = item_date prev_value.end = item_date
+3 -1
View File
@@ -61,7 +61,7 @@ class TemperatureParser(TableValueParser[list[int]]):
model_key = "temperature" model_key = "temperature"
def extract(self, data: Tag) -> list[int]: def extract(self, data: Tag) -> list[int]:
return [int(data.text.strip().rstrip("°"))] return [int(data.text.strip().rstrip("°").replace("−", "-"))]
class SkyParser(TableValueParser[Sky]): class SkyParser(TableValueParser[Sky]):
@@ -79,6 +79,8 @@ class SkyParser(TableValueParser[Sky]):
"небольшой дождь": Precipitation.SMALL_RAIN, "небольшой дождь": Precipitation.SMALL_RAIN,
"дождь": Precipitation.RAIN, "дождь": Precipitation.RAIN,
"ливень": Precipitation.SHOWER, "ливень": Precipitation.SHOWER,
"дождь со снегом": Precipitation.SNOW,
"снег": Precipitation.SNOW,
} }
def extract(self, data: Tag) -> Sky: def extract(self, data: Tag) -> Sky:
+28
View File
@@ -0,0 +1,28 @@
from gallery.sketch.parse.core import Parser
class CategoryParser(Parser[str, str | None]):
CATEGORY_MAP = {
"гандбол": "handball",
"хоккей": "hockey",
"бильярд": "billiards",
"волейбол": "volleyball",
"футбол": "soccer",
"футзал": "futsal",
"баскетбол": "basketball",
"плавание": "swimming",
"автоспорт": "motorsport",
"регби": "rugby",
"велоспорт": "cycling",
"гимнастика": "gymnastics",
}
def parse(self, data: str) -> str | None:
data = data.lower()
for k, v in self.CATEGORY_MAP.items():
if k in data:
return v
return None
CATEGORY_PARSER = CategoryParser()
+1
View File
@@ -40,6 +40,7 @@ class Precipitation(StrEnum):
RAIN = auto() RAIN = auto()
HEAVY_RAIN = auto() HEAVY_RAIN = auto()
SHOWER = auto() SHOWER = auto()
SMALL_SNOW = auto()
SNOW = auto() SNOW = auto()
HEAVY_SNOW = auto() HEAVY_SNOW = auto()
HAIL = auto() HAIL = auto()
+1 -1
View File
@@ -1,7 +1,7 @@
[project] [project]
name = "gallery" name = "gallery"
description = "" description = ""
version = "0.10.4" version = "0.10.8"
readme = "README.md" readme = "README.md"
authors = [{ name = "shmyga", email = "shmyga.z@gmail.com" }] authors = [{ name = "shmyga", email = "shmyga.z@gmail.com" }]
requires-python = ">=3.14,<4.0" requires-python = ">=3.14,<4.0"
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "gallery", "name": "gallery",
"version": "0.10.4", "version": "0.10.8",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "gallery", "name": "gallery",
"version": "0.10.4", "version": "0.10.8",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@popperjs/core": "^2.11.8", "@popperjs/core": "^2.11.8",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "gallery", "name": "gallery",
"version": "0.10.4", "version": "0.10.8",
"type": "module", "type": "module",
"scripts": { "scripts": {
"build": "webpack --mode production", "build": "webpack --mode production",
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+4 -2
View File
@@ -4,5 +4,7 @@ import "./app/common/tooltips";
import "./app/components/app-link"; import "./app/components/app-link";
import "./app/schedule"; import "./app/schedule";
import "./app/weather"; import "./app/weather";
import { init } from "./lib/weather-icons"; import { init as scheduleIconsInit } from "./lib/schedule-icons";
init("/static/weather-icons/icons"); import { init as weatherIconsInit } from "./lib/weather-icons";
weatherIconsInit("/static/weather-icons/icons");
scheduleIconsInit("/static/schedule-icons/icons");
+3
View File
@@ -48,4 +48,7 @@
&.bi-cast { &.bi-cast {
mask-image: url(bootstrap-icons/icons/cast.svg); mask-image: url(bootstrap-icons/icons/cast.svg);
} }
&.bi-filetype-json {
mask-image: url(bootstrap-icons/icons/filetype-json.svg);
}
} }
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2.34,14.63C2.94,14.41 3.56,14.3 4.22,14.3C5.56,14.3 6.73,14.72 7.73,15.56L4.59,18.7C3.53,17.5 2.78,16.13 2.34,14.63M15.56,9.8C17.53,11.27 19.66,11.63 21.94,10.88C21.97,11.09 22,11.47 22,12C22,13.03 21.75,14.18 21.28,15.45C20.81,16.71 20.23,17.73 19.55,18.5L13.22,12.19L15.56,9.8M8.77,16.64C9.83,18.17 10.05,19.84 9.42,21.66C8,21.25 6.73,20.61 5.67,19.73L8.77,16.64M12.19,13.22L18.5,19.55C16.33,21.45 13.78,22.25 10.88,21.94C11.09,21.28 11.2,20.56 11.2,19.78C11.2,19.16 11.06,18.43 10.78,17.6C10.5,16.77 10.17,16.09 9.8,15.56L12.19,13.22M8.81,14.5C7.88,13.67 6.8,13.15 5.58,12.91C4.36,12.68 3.19,12.75 2.06,13.13C2.03,12.91 2,12.53 2,12C2,10.97 2.25,9.82 2.72,8.55C3.19,7.29 3.77,6.27 4.45,5.5L11.11,12.19L8.81,14.5M15.56,7.73C14.22,6.08 13.91,4.28 14.63,2.34C15.25,2.5 15.96,2.8 16.76,3.26C17.55,3.71 18.2,4.16 18.7,4.59L15.56,7.73M21.66,9.38C21.06,9.59 20.44,9.7 19.78,9.7C18.69,9.7 17.64,9.38 16.64,8.72L19.73,5.67C20.61,6.77 21.25,8 21.66,9.38M12.19,11.11L5.5,4.45C7.67,2.55 10.22,1.75 13.13,2.06C12.91,2.72 12.8,3.44 12.8,4.22C12.8,4.94 12.96,5.75 13.29,6.66C13.62,7.56 14,8.28 14.5,8.81L12.19,11.11Z" /></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11,13H13V15H11M11,9H13V11H11M11,17H13A2,2 0 0,0 15,15V13.5A1.5,1.5 0 0,0 13.5,12A1.5,1.5 0 0,0 15,10.5V9A2,2 0 0,0 13,7H11A2,2 0 0,0 9,9V10.5A1.5,1.5 0 0,0 10.5,12A1.5,1.5 0 0,0 9,13.5V15A2,2 0 0,0 11,17M12,1C5.92,1 1,5.92 1,12C1,18.08 5.92,23 12,23C18.08,23 23,18.08 23,12C23,5.92 18.08,1 12,1M12,19A7,7 0 0,1 5,12A7,7 0 0,1 12,5A7,7 0 0,1 19,12A7,7 0 0,1 12,19Z" /></svg>

After

Width:  |  Height:  |  Size: 443 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5,20.5A3.5,3.5 0 0,1 1.5,17A3.5,3.5 0 0,1 5,13.5A3.5,3.5 0 0,1 8.5,17A3.5,3.5 0 0,1 5,20.5M5,12A5,5 0 0,0 0,17A5,5 0 0,0 5,22A5,5 0 0,0 10,17A5,5 0 0,0 5,12M14.8,10H19V8.2H15.8L13.86,4.93C13.57,4.43 13,4.1 12.4,4.1C11.93,4.1 11.5,4.29 11.2,4.6L7.5,8.29C7.19,8.6 7,9 7,9.5C7,10.13 7.33,10.66 7.85,10.97L11.2,13V18H13V11.5L10.75,9.85L13.07,7.5M19,20.5A3.5,3.5 0 0,1 15.5,17A3.5,3.5 0 0,1 19,13.5A3.5,3.5 0 0,1 22.5,17A3.5,3.5 0 0,1 19,20.5M19,12A5,5 0 0,0 14,17A5,5 0 0,0 19,22A5,5 0 0,0 24,17A5,5 0 0,0 19,12M16,4.8C17,4.8 17.8,4 17.8,3C17.8,2 17,1.2 16,1.2C15,1.2 14.2,2 14.2,3C14.2,4 15,4.8 16,4.8Z" /></svg>

After

Width:  |  Height:  |  Size: 679 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.93 17.12L16.13 15.76L17.59 11.39L19 10.92L20 11.67C20 11.7 20 11.75 20 11.81C20 11.88 20.03 11.94 20.03 12C20.03 13.97 19.37 15.71 18.06 17.21L16.93 17.12M9.75 15L8.38 10.97L12 8.43L15.62 10.97L14.25 15H9.75M12 20.03C11.12 20.03 10.29 19.89 9.5 19.61L8.81 18.1L9.47 17H14.58L15.19 18.1L14.5 19.61C13.71 19.89 12.88 20.03 12 20.03M5.94 17.21C5.41 16.59 4.95 15.76 4.56 14.75C4.17 13.73 3.97 12.81 3.97 12C3.97 11.94 4 11.88 4 11.81C4 11.75 4 11.7 4 11.67L5 10.92L6.41 11.39L7.87 15.76L7.07 17.12L5.94 17.21M11 5.29V6.69L7 9.46L5.66 9.04L5.24 7.68C5.68 7 6.33 6.32 7.19 5.66S8.87 4.57 9.65 4.35L11 5.29M14.35 4.35C15.13 4.57 15.95 5 16.81 5.66C17.67 6.32 18.32 7 18.76 7.68L18.34 9.04L17 9.47L13 6.7V5.29L14.35 4.35M4.93 4.93C3 6.89 2 9.25 2 12S3 17.11 4.93 19.07 9.25 22 12 22 17.11 21 19.07 19.07 22 14.75 22 12 21 6.89 19.07 4.93 14.75 2 12 2 6.89 3 4.93 4.93Z" /></svg>

After

Width:  |  Height:  |  Size: 944 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 6C4 4.9 4.9 4 6 4S8 4.9 8 6 7.1 8 6 8 4 7.1 4 6M1 9H7L14 4L15.31 5.5L11.14 8.5H14L21.8 4L23 5.4L14.5 12L14 22H12L11.5 12L8 11H1V9Z" /></svg>

After

Width:  |  Height:  |  Size: 212 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.83 10.43A6.93 6.93 0 0 1 18.39 14.86A6.64 6.64 0 0 1 17.5 19.5L15.78 18.5A5 5 0 0 0 16.44 16A5.22 5.22 0 0 0 15.46 13.06L9.18 23.93L7.44 22.95L10.44 17.75L8.71 16.76L7.21 19.34L5.5 18.36L10.63 9.45A7 7 0 0 1 8.8 5.46A6.91 6.91 0 0 1 9.69 1.1L11.43 2.13A4.84 4.84 0 0 0 10.91 5.9A4.74 4.74 0 0 0 13.21 8.93M16 5A2 2 0 1 0 18 7A2 2 0 0 0 16 5M13.5 1A1.5 1.5 0 1 0 15 2.5A1.5 1.5 0 0 0 13.5 1Z" /></svg>

After

Width:  |  Height:  |  Size: 473 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,5C6.5,5 2,6.57 2,8.5C2,10.43 6.5,12 12,12C17.5,12 22,10.43 22,8.5C22,6.57 17.5,5 12,5M2,11.76V16.5C2,18.43 6.5,20 12,20C17.5,20 22,18.43 22,16.5V11.76C21.33,12.22 20.58,12.57 19.73,12.86C17.62,13.6 14.95,14 12,14C9.05,14 6.38,13.6 4.27,12.86C3.42,12.57 2.67,12.22 2,11.76Z" /></svg>

After

Width:  |  Height:  |  Size: 355 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12,16A3,3 0 0,1 9,13C9,11.88 9.61,10.9 10.5,10.39L20.21,4.77L14.68,14.35C14.18,15.33 13.17,16 12,16M12,3C13.81,3 15.5,3.5 16.97,4.32L14.87,5.53C14,5.19 13,5 12,5A8,8 0 0,0 4,13C4,15.21 4.89,17.21 6.34,18.65H6.35C6.74,19.04 6.74,19.67 6.35,20.06C5.96,20.45 5.32,20.45 4.93,20.07V20.07C3.12,18.26 2,15.76 2,13A10,10 0 0,1 12,3M22,13C22,15.76 20.88,18.26 19.07,20.07V20.07C18.68,20.45 18.05,20.45 17.66,20.06C17.27,19.67 17.27,19.04 17.66,18.65V18.65C19.11,17.2 20,15.21 20,13C20,12 19.81,11 19.46,10.1L20.67,8C21.5,9.5 22,11.18 22,13Z" /></svg>

After

Width:  |  Height:  |  Size: 612 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.22,16.22C18.25,14.19 19.33,11.5 19.45,8.2C18.36,10.61 16.81,12.81 14.81,14.81C12.81,16.81 10.61,18.36 8.2,19.45C11.5,19.36 14.16,18.28 16.22,16.22M7.78,7.78C5.75,9.81 4.67,12.5 4.55,15.8C5,14.8 5.7,13.65 6.61,12.35C7.5,11.05 8.38,10 9.19,9.19C11.19,7.19 13.39,5.64 15.8,4.55C12.5,4.64 9.84,5.72 7.78,7.78M20.5,3.5C21,4.05 21.34,5.11 21.47,6.7C21.59,8.3 21.35,10.16 20.74,12.3C20.13,14.45 19.11,16.23 17.67,17.67C16.36,19 14.8,19.95 13,20.55C11.21,21.16 9.44,21.47 7.69,21.47C5.56,21.47 4.17,21.14 3.5,20.5C3,19.95 2.66,18.89 2.53,17.3C2.41,15.7 2.65,13.84 3.26,11.7C3.87,9.55 4.89,7.77 6.33,6.33C7.64,5 9.2,4.05 11,3.45C12.79,2.84 14.56,2.53 16.31,2.53C18.44,2.53 19.83,2.86 20.5,3.5Z" /></svg>

After

Width:  |  Height:  |  Size: 767 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.93 17.12L16.13 15.76L17.59 11.39L19 10.92L20 11.67C20 11.7 20 11.75 20 11.81C20 11.88 20.03 11.94 20.03 12C20.03 13.97 19.37 15.71 18.06 17.21L16.93 17.12M9.75 15L8.38 10.97L12 8.43L15.62 10.97L14.25 15H9.75M12 20.03C11.12 20.03 10.29 19.89 9.5 19.61L8.81 18.1L9.47 17H14.58L15.19 18.1L14.5 19.61C13.71 19.89 12.88 20.03 12 20.03M5.94 17.21C5.41 16.59 4.95 15.76 4.56 14.75C4.17 13.73 3.97 12.81 3.97 12C3.97 11.94 4 11.88 4 11.81C4 11.75 4 11.7 4 11.67L5 10.92L6.41 11.39L7.87 15.76L7.07 17.12L5.94 17.21M11 5.29V6.69L7 9.46L5.66 9.04L5.24 7.68C5.68 7 6.33 6.32 7.19 5.66S8.87 4.57 9.65 4.35L11 5.29M14.35 4.35C15.13 4.57 15.95 5 16.81 5.66C17.67 6.32 18.32 7 18.76 7.68L18.34 9.04L17 9.47L13 6.7V5.29L14.35 4.35M4.93 4.93C3 6.89 2 9.25 2 12S3 17.11 4.93 19.07 9.25 22 12 22 17.11 21 19.07 19.07 22 14.75 22 12 21 6.89 19.07 4.93 14.75 2 12 2 6.89 3 4.93 4.93Z" /></svg>

After

Width:  |  Height:  |  Size: 944 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2,15C3.67,14.25 5.33,13.5 7,13.17V5A3,3 0 0,1 10,2C11.31,2 12.42,2.83 12.83,4H10A1,1 0 0,0 9,5V6H14V5A3,3 0 0,1 17,2C18.31,2 19.42,2.83 19.83,4H17A1,1 0 0,0 16,5V14.94C18,14.62 20,13 22,13V15C19.78,15 17.56,17 15.33,17C13.11,17 10.89,15 8.67,15C6.44,15 4.22,16 2,17V15M14,8H9V10H14V8M14,12H9V13C10.67,13.16 12.33,14.31 14,14.79V12M2,19C4.22,18 6.44,17 8.67,17C10.89,17 13.11,19 15.33,19C17.56,19 19.78,17 22,17V19C19.78,19 17.56,21 15.33,21C13.11,21 10.89,19 8.67,19C6.44,19 4.22,20 2,21V19Z" /></svg>

After

Width:  |  Height:  |  Size: 571 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19.04 4.85C17.34 3.2 15.33 2.25 13 2V5.62L22 10.8C21.72 8.5 20.73 6.5 19.04 4.85M12 22C15.44 22 18.16 20.62 20.17 17.86L17.06 16L8.07 21.2C9.32 21.73 10.64 22 12 22M13 11.41L21.15 16.07C21.59 15.13 21.88 14.14 22 13.11L13 7.93V11.41M3.88 17.81C4.54 18.72 5.26 19.46 6.05 20L15.04 14.9L12 13.15L3.88 17.81M11.04 2C10 2.09 9 2.36 8 2.8V13.15L11.04 11.41V2M2 12C2 13.39 2.3 14.77 2.89 16.12L6 14.28V4C3.33 6 2 8.65 2 12Z" /></svg>

After

Width:  |  Height:  |  Size: 497 B

+6
View File
@@ -0,0 +1,6 @@
import { ScheduleIconElement } from "./schedule-icons";
export const init = (iconsPath: string) => {
ScheduleIconElement.iconsPath = iconsPath;
customElements.define("schedule-icon", ScheduleIconElement);
};
@@ -0,0 +1,19 @@
schedule-icon {
display: inline-block;
text-transform: none;
line-height: 1;
vertical-align: 0.125em;
width: 1em;
height: 1em;
mask-size: contain;
mask-position: 50%;
mask-repeat: no-repeat;
color: currentColor;
> svg {
path {
fill: currentColor;
}
}
}
@@ -0,0 +1,19 @@
export class ScheduleIconElement extends HTMLElement {
static iconsPath = "./icons";
static observedAttributes = ["icon"];
constructor() {
super();
const icon = this.getAttribute("icon");
if (icon) {
this.icon = icon;
}
}
set icon(value: string) {
const src = `${ScheduleIconElement.iconsPath}/${value}.svg`;
fetch(src)
.then((response) => (response.ok ? response.text() : ""))
.then((data) => (this.innerHTML = data));
}
}
@@ -11,7 +11,6 @@ export class WeatherIconElement extends HTMLElement {
} }
set icon(value: string) { set icon(value: string) {
console.log('!', WeatherIconElement.iconsPath);
const src = `${WeatherIconElement.iconsPath}/wi-${value}.svg`; const src = `${WeatherIconElement.iconsPath}/wi-${value}.svg`;
fetch(src) fetch(src)
.then((response) => response.text()) .then((response) => response.text())
+1
View File
@@ -2,6 +2,7 @@
@import "./lib/bootstrap"; @import "./lib/bootstrap";
@import "./lib/bootstrap-icons"; @import "./lib/bootstrap-icons";
@import "./lib/weather-icons"; @import "./lib/weather-icons";
@import "./lib/schedule-icons/sass/schedule-icons.scss";
@import "./styles/weather.scss"; @import "./styles/weather.scss";
@import "./styles/app"; @import "./styles/app";
+13
View File
@@ -56,14 +56,22 @@ const config: webpack.Configuration = {
new MiniCssExtractPlugin({ filename: `${packageInfo.name}.css` }), new MiniCssExtractPlugin({ filename: `${packageInfo.name}.css` }),
new CopyPlugin({ new CopyPlugin({
patterns: [ patterns: [
// weather icons
{ {
from: "./src/lib/weather-icons/icons/*.svg", from: "./src/lib/weather-icons/icons/*.svg",
to: "weather-icons/icons/[name][ext]", to: "weather-icons/icons/[name][ext]",
}, },
// schedule icons
{
from: "./src/lib/schedule-icons/icons/*.svg",
to: "schedule-icons/icons/[name][ext]",
},
// bootstrap icons
{ {
from: "./node_modules/bootstrap-icons/icons/*.svg", from: "./node_modules/bootstrap-icons/icons/*.svg",
to: "bootstrap-icons/icons/[name][ext]", to: "bootstrap-icons/icons/[name][ext]",
}, },
// flag icons
{ {
from: "./node_modules/flag-icons/flags/1x1/*.svg", from: "./node_modules/flag-icons/flags/1x1/*.svg",
to: "flag-icons/flags/1x1/[name][ext]", to: "flag-icons/flags/1x1/[name][ext]",
@@ -72,6 +80,11 @@ const config: webpack.Configuration = {
from: "./node_modules/flag-icons/flags/4x3/*.svg", from: "./node_modules/flag-icons/flags/4x3/*.svg",
to: "flag-icons/flags/4x3/[name][ext]", to: "flag-icons/flags/4x3/[name][ext]",
}, },
// favicon
{
from: "./src/favicon.ico",
to: "favicon.ico",
},
], ],
}), }),
], ],