Merge branch 'current' into next

This commit is contained in:
Jesse Hills 2024-05-20 17:14:00 +12:00
commit 881594ab83
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A
19 changed files with 241 additions and 32 deletions

View File

@ -18,9 +18,14 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
-
name: Install pagefind
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: cloudcannon/pagefind
- -
name: Checkout source code name: Checkout source code
uses: actions/checkout@v4.1.5 uses: actions/checkout@v4.1.6
- -
name: Set up QEMU name: Set up QEMU
uses: docker/setup-qemu-action@v3 uses: docker/setup-qemu-action@v3

View File

@ -19,7 +19,11 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4.1.5 - name: Install pagefind
uses: jaxxstorm/action-install-gh-release@v1.10.0
with:
repo: cloudcannon/pagefind
- uses: actions/checkout@v4.1.6
- name: Set up Python 3.8 - name: Set up Python 3.8
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:

View File

@ -1,15 +1,24 @@
ESPHOME_PATH = ../esphome ESPHOME_PATH = ../esphome
ESPHOME_REF = dev ESPHOME_REF = dev
PAGEFIND_VERSION=1.1.0
PAGEFIND=pagefind
NET_PAGEFIND=../pagefindbin/pagefind
.PHONY: html html-strict cleanhtml deploy help live-html Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify .PHONY: html html-strict cleanhtml deploy help live-html live-pagefind Makefile netlify netlify-api api netlify-dependencies svg2png copy-svg2png minify
html: html:
sphinx-build -M html . _build -j auto -n $(O) sphinx-build -M html . _build -j auto -n $(O)
live-html: ${PAGEFIND}
live-html: html
sphinx-autobuild . _build -j auto -n $(O) --host 0.0.0.0 sphinx-autobuild . _build -j auto -n $(O) --host 0.0.0.0
live-pagefind: html
${PAGEFIND} --serve
html-strict: html-strict:
sphinx-build -M html . _build -W -j auto -n $(O) sphinx-build -M html . _build -W -j auto -n $(O)
${PAGEFIND}
minify: minify:
minify _static/webserver-v1.js > _static/webserver-v1.min.js minify _static/webserver-v1.js > _static/webserver-v1.min.js
@ -32,6 +41,10 @@ api:
fi fi
ESPHOME_PATH=$(ESPHOME_PATH) doxygen Doxygen ESPHOME_PATH=$(ESPHOME_PATH) doxygen Doxygen
net-html:
sphinx-build -M html . _build -j auto -n $(O)
${NET_PAGEFIND}
netlify-api: netlify-dependencies netlify-api: netlify-dependencies
mkdir -p _build/html/api mkdir -p _build/html/api
@if [ ! -d "$(ESPHOME_PATH)" ]; then \ @if [ ! -d "$(ESPHOME_PATH)" ]; then \
@ -40,15 +53,23 @@ netlify-api: netlify-dependencies
fi fi
ESPHOME_PATH=$(ESPHOME_PATH) ../doxybin/doxygen Doxygen ESPHOME_PATH=$(ESPHOME_PATH) ../doxybin/doxygen Doxygen
netlify-dependencies: netlify-dependencies: pagefind-binary
mkdir -p ../doxybin mkdir -p ../doxybin
curl -L https://github.com/esphome/esphome-docs/releases/download/v1.10.1/doxygen-1.8.13.xz | xz -d >../doxybin/doxygen curl -L https://github.com/esphome/esphome-docs/releases/download/v1.10.1/doxygen-1.8.13.xz | xz -d >../doxybin/doxygen
chmod +x ../doxybin/doxygen chmod +x ../doxybin/doxygen
pagefind-binary:
mkdir -p ../pagefindbin
curl -o pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz https://github.com/CloudCannon/pagefind/releases/download/v$(PAGEFIND_VERSION)/pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz -L
tar xzf pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz
rm pagefind-v$(PAGEFIND_VERSION)-x86_64-unknown-linux-musl.tar.gz
mv pagefind ${NET_PAGEFIND}
copy-svg2png: copy-svg2png:
cp svg2png/*.png _build/html/_images/ cp svg2png/*.png _build/html/_images/
netlify: netlify-dependencies netlify-api html copy-svg2png netlify: netlify-dependencies netlify-api net-html copy-svg2png
lint: html-strict lint: html-strict
python3 lint.py python3 lint.py

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 KiB

After

Width:  |  Height:  |  Size: 111 KiB

View File

@ -248,6 +248,34 @@ a:has(> img:only-child) {
div.body p, div.body dd, div.body li, div.body blockquote { div.body p, div.body dd, div.body li, div.body blockquote {
hyphens: none; hyphens: none;
} }
.pagefind-ui__form {
width: 100%;
max-width: 300px;
left: auto;
right: auto;
position: relative;
}
.pagefind-modular-list-excerpt, .pagefind-modular-list-title {
color: #111111 !important;
}
.search-results {
background-color: #f8f8f8;
box-shadow: 0 6px 10px rgb(0 0 0 / 0.2);
position: absolute;
z-index: 1500;
margin-top: 4px;
padding-right: 6px;
padding-left: 6px;
border-radius: 12px;
overflow: auto;
width: 0;
height: fit-content;
max-width: 650px;
transition: height, width 0.1s ease-in-out;
display: none;
}
/* dark theme */ /* dark theme */
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
@ -344,4 +372,24 @@ div.body p, div.body dd, div.body li, div.body blockquote {
background-color: #8e8129; background-color: #8e8129;
} }
.search-results {
background-color: #313131;
box-shadow: 0 6px 10px rgb(0 0 0 / 0.8);
}
.pagefind-modular-list-excerpt, .pagefind-modular-list-title {
color: #eeeeee !important;
}
.pagefind-ui__form, .pagefind-modular-input, .search-results {
color: #ececec !important;
}
:root {
--pagefind-ui-primary: #eeeeee;
--pagefind-ui-text: #eeeeee;
--pagefind-ui-background: #152028;
--pagefind-ui-border: #152028;
--pagefind-ui-tag: #152028;
}
} }

View File

@ -5,6 +5,7 @@
{% endblock %} {% endblock %}
{%- block extrahead %} {%- block extrahead %}
<link href="/pagefind/pagefind-modular-ui.css" rel="stylesheet">
<link rel="stylesheet" href="{{ pathto('_static/custom.css', 1) }}?hash={{ custom_css_hash }}" type="text/css" /> <link rel="stylesheet" href="{{ pathto('_static/custom.css', 1) }}?hash={{ custom_css_hash }}" type="text/css" />
<link rel="apple-touch-icon" sizes="180x180" href="/_static/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="/_static/apple-touch-icon.png">
<link rel="shortcut icon" href="/_static/favicon.ico"> <link rel="shortcut icon" href="/_static/favicon.ico">
@ -29,14 +30,16 @@
{% endblock %} {% endblock %}
{% block relbar_top %} {% block relbar_top %}
{% if parents|length > 0 %}
<ul class="breadcrumbs"> <ul class="breadcrumbs">
{% if parents|length > 0 %}
{%- for doc in parents %} {%- for doc in parents %}
<li><a href="{{ doc.link|e }}">{{ doc.title }}</a></li> <li><a href="{{ doc.link|e }}">{{ doc.title }}</a></li>
{%- endfor %} {%- endfor %}
<li>{{title}}</li> <li>{{title}}</li>
</ul>
{% endif %} {% endif %}
</ul>
<div class="search-results" id="search-results"></div>
{% endblock %} {% endblock %}
{% block footer %} {% block footer %}

36
_templates/search.html Normal file
View File

@ -0,0 +1,36 @@
<!-- docs/_templates/search.html -->
{% extends "page.html" %}
{%- block htmltitle -%}
<title>{{ _("Search") }} - {{ docstitle }}</title>
{%- endblock htmltitle -%}
{% block content %}
<h1>{{ _("Search") }}</h1>
<div id="search"></div>
{% endblock %}
{% block scripts -%}
{{ super() }}
{%- endblock scripts %}
{% block extra_styles -%}
{{ super() }}
<style type="text/css">
#search form input[type="text"] {
box-sizing: border-box;
width: 100%;
line-height: 2em;
padding-inline: 0.6em;
font-size: 1.2rem;
border-radius: 0.05rem;
border: 2px solid var(--color-foreground-border);
border-bottom-color: 2px solid var(--color-foreground-secondary);
transition: border-color 20ms ease;
}
#search form input[type="text"]:focus {
border-color: var(--color-foreground-primary);
}
</style>
{%- endblock extra_styles %}

82
_templates/searchbox.html Normal file
View File

@ -0,0 +1,82 @@
<script src="/pagefind/pagefind-modular-ui.js"></script>
<div class="pagefind-ui__form" id="search"></div>
<div class="search-results" id="mobile-search-results"></div>
<script>
let callbackAdded = null;
window.addEventListener('DOMContentLoaded', (event) => {
const std_target = document.getElementById("search-results");
const mobile_target = document.getElementById("mobile-search-results");
const inpel = document.getElementById("search");
function showTarget() {
var target = std_target;
if (window.innerWidth <= 875) {
target = mobile_target;
std_target.style.display = "none";
} else {
mobile_target.style.display = "none";
}
target.style.display = "block";
const rect = target.getBoundingClientRect();
const height = window.innerHeight;
target.style.width = "100%";
target.style.height = "fit-content";
target.style.maxHeight = (height - rect.top - 10) + "px";
if (!callbackAdded) {
callbackAdded = true;
document.addEventListener('click', clickCallback);
}
}
function hideTargets() {
std_target.style.display = "none";
mobile_target.style.display = "none";
std_target.style.height = "0";
mobile_target.style.height = "0";
if (callbackAdded) {
document.removeEventListener('click', clickCallback);
callbackAdded = false;
}
}
const instance = new PagefindModularUI.Instance({
showSubResults: true,
showImages: false,
ranking: {
pageLength: 0.0,
termSaturation: 1.6,
termFrequency: 0.4,
termSimilarity: 6.0
}
});
instance.add(new PagefindModularUI.Input({
containerElement: "#search"
}));
instance.add(new PagefindModularUI.ResultList({
containerElement: "#search-results"
}));
instance.add(new PagefindModularUI.ResultList({
containerElement: "#mobile-search-results"
}));
const clickCallback = (event) => {
const path = event.composedPath();
if (path.includes(std_target) || path.includes(mobile_target) || path.includes(inpel))
return;
hideTargets();
};
if (std_target && mobile_target) {
instance.on("results", (results) => {
if (results.results.length) {
showTarget();
} else {
hideTargets();
}
});
}
});
</script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -80,24 +80,24 @@ Image Settings:
- **resolution** (*Optional*, enum): The resolution the camera will capture images at. Higher - **resolution** (*Optional*, enum): The resolution the camera will capture images at. Higher
resolutions require more memory, if there's not enough memory you will see an error during startup. resolutions require more memory, if there's not enough memory you will see an error during startup.
- ``160x120`` (QQVGA) - ``160x120`` (QQVGA, 4:3)
- ``176x144`` (QCIF) - ``176x144`` (QCIF, 11:9)
- ``240x176`` (HQVGA) - ``240x176`` (HQVGA, 15:11)
- ``320x240`` (QVGA) - ``320x240`` (QVGA, 4:3)
- ``400x296`` (CIF) - ``400x296`` (CIF, 50:37)
- ``640x480`` (VGA, default) - ``640x480`` (VGA, 4:3, default)
- ``800x600`` (SVGA) - ``800x600`` (SVGA, 4:3)
- ``1024x768`` (XGA) - ``1024x768`` (XGA, 4:3)
- ``1280x1024`` (SXGA) - ``1280x1024`` (SXGA, 5:4)
- ``1600x1200`` (UXGA) - ``1600x1200`` (UXGA, 4:3)
- ``1920x1080`` (FHD) - ``1920x1080`` (FHD, 16:9)
- ``720x1280`` (Portrait HD) - ``720x1280`` (Portrait HD, 9:16)
- ``864x1536`` (Portrait 3MP) - ``864x1536`` (Portrait 3MP, 9:16)
- ``2048x1536`` (QXGA) - ``2048x1536`` (QXGA, 4:3)
- ``2560x1440`` (QHD) - ``2560x1440`` (QHD, 16:9)
- ``2560x1600`` (WQXGA) - ``2560x1600`` (WQXGA, 8:5)
- ``1080x1920`` (Portrait FHD) - ``1080x1920`` (Portrait FHD, 9:16)
- ``2560x1920`` (QSXGA) - ``2560x1920`` (QSXGA, 4:3)
- **jpeg_quality** (*Optional*, int): The JPEG quality that the camera should encode images with. - **jpeg_quality** (*Optional*, int): The JPEG quality that the camera should encode images with.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -58,7 +58,7 @@ Configuration variables:
- **frequency** (*Optional*, float): The frequency to let the - **frequency** (*Optional*, float): The frequency to let the
component drive all PWM outputs at. Must be in range from 24Hz to component drive all PWM outputs at. Must be in range from 24Hz to
1525.88Hz. Default ``1000Hz``. 1525.88Hz. Defaults to ``1000Hz``.
- **external_clock_input** (*Optional*, bool): Enable external clock input. PRE_SCALE register will by set to 3. Default to ``false``. - **external_clock_input** (*Optional*, bool): Enable external clock input. PRE_SCALE register will by set to 3. Default to ``false``.
- **address** (*Optional*, int): The I²C address of the driver. - **address** (*Optional*, int): The I²C address of the driver.
Defaults to ``0x40``. Defaults to ``0x40``.
@ -96,7 +96,7 @@ Configuration variables:
************************ ************************
- **id** (**Required**, :ref:`config-id`): The id to use for this output component. - **id** (**Required**, :ref:`config-id`): The id to use for this output component.
- **channel** (**Required**, int): Chose the channel of the PCA9685 of - **channel** (**Required**, int): Choose the channel of the PCA9685 of
this output component. Must be in range from 0 to 15. this output component. Must be in range from 0 to 15.
- **pca9685_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the - **pca9685_id** (*Optional*, :ref:`config-id`): Manually specify the ID of the
:ref:`PCA9685 hub <pca9685-component>`. :ref:`PCA9685 hub <pca9685-component>`.

View File

@ -56,7 +56,9 @@ Configuration variables:
- **mirror_x** (*Optional*, boolean): If true, mirror the x axis. - **mirror_x** (*Optional*, boolean): If true, mirror the x axis.
- **mirror_y** (*Optional*, boolean): If true, mirror the y axis. - **mirror_y** (*Optional*, boolean): If true, mirror the y axis.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the touchscreen. Defaults to ``never``. **NOTE:** You should set this to ``50ms`` when you dont have set the **interupt_pin**.
- **update_interval** (*Optional*, :ref:`config-time`): The interval to check the touchscreen. Defaults to ``never``. **NOTE:** Set this to ``50ms`` when you dont have set the **interupt_pin**.
- **touch_timeout** (*Optional*, :ref:`config-time`): The time to automatically check if touch was released. Defaults to ``never``.
- **calibration** (*Optional*): When the touchscreen is not given the right configuration settings. You can set them here. - **calibration** (*Optional*): When the touchscreen is not given the right configuration settings. You can set them here.
- **x_min** (*Optional*, int): The raw value corresponding to the left - **x_min** (*Optional*, int): The raw value corresponding to the left

View File

@ -22,9 +22,7 @@ Configuration variables:
------------------------ ------------------------
- **id** (*Optional*, :ref:`config-id`): Manually set the ID of this touchscreen. - **id** (*Optional*, :ref:`config-id`): Manually set the ID of this touchscreen.
- **interrupt_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin. - **interrupt_pin** (*Optional*, :ref:`Pin Schema <config-pin_schema>`): The touch detection pin. Must be ``GPIO13``.
Must be ``GPIO13``.
- All other options from :ref:`config-touchscreen`. - All other options from :ref:`config-touchscreen`.
See Also See Also

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -167,6 +167,7 @@ html_sidebars = {
} }
# -- Options for HTMLHelp output ------------------------------------------ # -- Options for HTMLHelp output ------------------------------------------
# Output file base name for HTML help builder. # Output file base name for HTML help builder.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

9
pagefind.yml Normal file
View File

@ -0,0 +1,9 @@
site: _build/html
exclude_selectors:
- "a.headerlink"
- ".toctree-wrapper"
- ".sphinxsidebar"
- ".breadcrumbs"
glob: "{components,cookbook,guides,projects,web-api}/**/*.html"
root_selector: div[role=main]