Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- A file input with `multiple` now keeps every selected file, instead of only the last one. The new [`sqlpage.persist_uploaded_files`](https://sql-page.com/functions.sql?function=persist_uploaded_files) function saves them all and returns a JSON array with the `path`, original `name`, `mime_type` and `size` of each file.
- Set `wrap` on a `big_number` component to show long titles and descriptions across multiple lines.
- Inline icons now align with their labels in components such as tabs and steps.

## v0.48.0 (2026-11-12)

Expand Down
2 changes: 1 addition & 1 deletion examples/official-site/custom_components.sql
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ and SQLPage adds a few more:
- `array_contains`: returns true if a list contains a value
- `static_path`: returns the path to one of the static files bundled with SQLPage. Accepts arguments like `sqlpage.js`, `sqlpage.css`, `apexcharts.js`, etc.
- `app_config`: returns the value of a configuration parameter from sqlpage''s configuration file, such as `max_uploaded_file_size`, `site_prefix`, etc.
- `icon_img`: generate an svg icon from a *tabler* icon name
- `icon_img`: render a Tabler SVG icon aligned with adjacent text. An optional second argument sets its size in pixels (default 24).
- `markdown`: renders markdown text. Accepts an optional 2nd argument `''allow_unsafe''` that will render embedded html blocks: use only on trusted content. See the [Commonmark spec](https://spec.commonmark.org/0.31.2/#html-blocks) for more info.
- `each_row`: iterates over the rows of a query result
- `typeof`: returns the type of a value (`string`, `number`, `boolean`, `object`, `array`, `null`)
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/icons.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.sqlpage-icon {
/* An inline SVG's baseline is its bottom edge. Center it on capital letters. */
vertical-align: calc((1cap - attr(height px)) / 2);
}
1 change: 1 addition & 0 deletions scripts/build-frontend.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const STYLESHEET = [
"node_modules/@tabler/core/dist/css/tabler.min.css",
"node_modules/tom-select/dist/css/tom-select.bootstrap5.css",
"node_modules/@tabler/core/dist/css/tabler-vendors.min.css",
"frontend/src/icons.css",
"frontend/src/sqlpage.css",
];

Expand Down
2 changes: 1 addition & 1 deletion src/template_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl HelperDef for IconImgHelper {

write!(
writer,
r#"<svg viewBox="0 0 24 24" width="{size}" height="{size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">{inner_content}</svg>"#
r#"<svg class="sqlpage-icon" viewBox="0 0 24 24" width="{size}" height="{size}" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">{inner_content}</svg>"#
)?;
Ok(())
}
Expand Down
2 changes: 2 additions & 0 deletions tests/end-to-end/fixtures/steps/index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SELECT 'steps' AS component;
SELECT 'Review' AS title, 'eye' AS icon, '#review' AS link;
21 changes: 21 additions & 0 deletions tests/end-to-end/fixtures/steps/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect, test } from "../../fixture.ts";

test("the step icon aligns with the capital letters of its title", async ({
page,
}) => {
const icon = page.getByRole("link", { name: "Review" }).locator("svg");
const offset = await icon.evaluate((svg) => {
// An empty inline-block sits on the text baseline. Its top is one cap height above it.
const capital = document.createElement("span");
capital.style.cssText = "display: inline-block; height: 1cap";
svg.after(capital);
const centerY = (element: Element) => {
const { top, height } = element.getBoundingClientRect();
return top + height / 2;
};
const delta = centerY(svg) - centerY(capital);
capital.remove();
return delta;
});
expect(Math.abs(offset)).toBeLessThanOrEqual(1);
});
Loading