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
2 changes: 1 addition & 1 deletion app/src/Assets/css/modal.css
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ body:has(.ad-modal[open]) {
overflow: auto;
min-height: 0;
flex: 1;
padding: var(--ad-dialog-padding);
padding: var(--ad-dialog-padding-block) var(--ad-dialog-padding);
}

/* Cancel first, primary action last: the order every mac dialog uses, and muscle memory puts
Expand Down
105 changes: 99 additions & 6 deletions app/src/Assets/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,13 @@ dialog#desktop-settings p.message {

#desktop-panels > div {
display: none;
padding: 0 0.4em var(--ad-panel-gap);
/* Here and not as a margin on each panel's first child: a margin is in that child's font size,
so the tabs started at different heights. */
padding: var(--ad-dialog-padding-block) 0.4em var(--ad-panel-gap);
}

#desktop-panels > div > :first-child {
margin-top: var(--ad-dialog-padding);
margin-top: 0;
}

#desktop-settings:has(#desktop-tab-plugins:checked) #desktop-panel-plugins,
Expand Down Expand Up @@ -185,7 +187,7 @@ dialog#desktop-settings p.message {
padding-bottom: calc(2 * var(--ad-panel-gap));
}

#desktop-panel-mcp > p:first-child {
#desktop-panel-mcp > p:first-child:has(> input[type="checkbox"]) {
margin-top: 0;
}

Expand Down Expand Up @@ -410,6 +412,71 @@ dialog#desktop-settings p.message {
flex: none;
}

/* --- Preference rows --------------------------------------------------------- */

/* Label and control side by side, every control starting on one line, a hairline between rows.
Subgrid so the rows can draw that line and still share their columns. `dialog#` to outrank the rule that takes the sidebar's styling off this dialog's
paragraphs. */
.ad-settings-rows {
display: grid;
grid-template-columns: minmax(max-content, 12em) 1fr;
align-items: center;
column-gap: 2.5em;
margin-block: calc(2 * var(--ad-panel-gap));
}

.ad-settings-row {
display: grid;
grid-column: 1 / -1;
grid-template-columns: subgrid;
align-items: center;
padding-block: 0.9em;
}

.ad-settings-row + .ad-settings-row {
border-top: 1px solid color-mix(in srgb, var(--fg) 7%, transparent);
}

.ad-settings-row h4 {
margin: 0;
font-weight: 400;
}

dialog#desktop-settings .ad-settings-row p {
display: flex;
flex-wrap: wrap;
gap: 0.5em 2em;
margin: 0;
}

.ad-settings-row label {
white-space: nowrap;
}

.ad-settings-row input {
margin-inline-end: 0.5em;
}

/* One width, so a short list's select is not narrower than a long one's. */
.ad-settings-row select {
min-width: 16em;
}

/* A section's title runs on as a hairline to the panel's edge. */
#desktop-panel-themes > h4 {
display: flex;
align-items: center;
gap: 0.8em;
margin-block: calc(3 * var(--ad-panel-gap)) calc(1.5 * var(--ad-panel-gap));
font-weight: 400;
}

#desktop-panel-themes > h4::after {
content: "";
flex: 1;
border-top: 1px solid color-mix(in srgb, var(--fg) 7%, transparent);
}

/* --- Tables ------------------------------------------------------------------- */

/* Striping is Adminer's own .odds class, which dark.css overrides, so rows follow the
Expand All @@ -428,11 +495,11 @@ dialog#desktop-settings p.message {
scrolling past do not show through it, and its 1px spread covers the table's side borders. */
#desktop-panels thead {
z-index: 1;
top: var(--ad-dialog-padding);
top: var(--ad-dialog-padding-block);
}

#desktop-panels thead th {
box-shadow: 0 calc(-1 * var(--ad-dialog-padding)) 0 1px var(--bg);
box-shadow: 0 calc(-1 * var(--ad-dialog-padding-block)) 0 1px var(--bg);
}

#desktop-panels td {
Expand All @@ -443,10 +510,36 @@ dialog#desktop-settings p.message {
target - clicking the name, the description or the preview all select it. */
#desktop-panels td label {
display: block;
padding: 0.5em 0.75em;
padding: 0.5em var(--ad-settings-cell-px);
cursor: pointer;
}

#desktop-panels th {
padding-inline: var(--ad-settings-cell-px);
}

/* The radio or checkbox the row starts with sits outside any label, so nothing else holds it off
the table's edge. */
#desktop-panels td:has(> input):first-child {
padding-inline-start: var(--ad-settings-cell-px);
}

/* The plugin list is read rather than scanned, so larger than a data table. The first cell
starts with the checkbox, outside any label, which would otherwise touch the table's edge. */
#desktop-panel-plugins :is(th, td) {
font-size: 1.05em;
}

#desktop-panel-plugins th,
#desktop-panel-plugins td label {
padding-block: 0.7em;
}

/* Its corners take the row's mass, so at the same height it reads as lower than the others. */
#desktop-panel-plugins tbody tr:last-child td label {
padding-block: 0.95em;
}

#desktop-panels tbody tr:hover {
background: var(--dim);
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/Assets/css/shortcuts.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
* menu lists them. */

#desktop-panel-shortcuts td {
padding: 0.5em 0.75em;
padding: 0.5em var(--ad-settings-cell-px);
}

/* A pixel more than the gap the sticky thead's shadow fills (settings.css): its 1px spread
otherwise lands on the table above and paints out its bottom border. */
#desktop-panel-shortcuts table + table {
margin-top: calc(var(--ad-dialog-padding) + 1px);
margin-top: calc(var(--ad-dialog-padding-block) + 1px);
}

/* As narrow as its keys, so the action's column takes the rest. */
Expand Down
5 changes: 4 additions & 1 deletion app/src/Assets/css/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
--ad-dialog-width: 56em;
--ad-dialog-max-width: 92vw;
--ad-dialog-max-height: 88vh;
--ad-dialog-padding: 1.2em;
--ad-dialog-padding: 2em;
--ad-dialog-padding-block: 3em;
/* How far a settings table's cells hold their content off its borders. */
--ad-settings-cell-px: 1.5em;
/* How long a dialog and its backdrop take to fade in or out (modal.css). */
--ad-modal-speed: 200ms;

Expand Down
11 changes: 11 additions & 0 deletions app/src/Assets/javascript/before-paint/open-on-load.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
});

const open = (marker) => {
// A logged-out card's form opens because the card was clicked. Its URL stays, and a reload
// is not that click. Removed, so modal.js does not open it either.
if (
marker.hasAttribute("data-not-on-reload") &&
/** @type {PerformanceNavigationTiming | undefined} */ (
performance.getEntriesByType("navigation")[0]
)?.type === "reload"
) {
marker.remove();
return;
}
const dialog = document.getElementById(marker.dataset.openDialog);
if (!dialog || dialog.open) {
return;
Expand Down
25 changes: 25 additions & 0 deletions app/src/Assets/javascript/settings-table-stuck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Marks a table in the settings dialog whose header is stuck to the top of the dialog's body, for
* tables.css to square its corners: rows scrolling under a rounded header show in those corners.
* CSS cannot tell: the scroll-state query is not in WebKit.
*/

(() => {
const body = document.querySelector("#desktop-settings .ad-modal-body");
if (!body) {
return;
}
const mark = () => {
for (const table of body.querySelectorAll("table")) {
// Stuck is the header no longer sitting where its table starts. A hidden tab's measure
// the same, so that is not stuck, but it needs marking again once it is shown.
table.classList.toggle(
"ad-stuck",
table.tHead?.getBoundingClientRect().top >
table.getBoundingClientRect().top,
);
}
};
body.addEventListener("scroll", mark, { passive: true });
document.querySelector("#desktop-tabs")?.addEventListener("change", mark);
})();
2 changes: 1 addition & 1 deletion app/src/Connections/connections.latte
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@
{/embed}
{* Opened on load — see Connections::loginPage(). An attribute the script reads rather than an
inline script, which the CSP would want a nonce for. *}
<span n:if="$adding" hidden data-open-dialog="ad-new-connection-dialog"></span>
<span n:if="$adding" hidden data-open-dialog="ad-new-connection-dialog" n:attr="data-not-on-reload: empty($_POST['auth'])"></span>
29 changes: 29 additions & 0 deletions app/src/Settings/Theme/designs/adminer-desktop/tables.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ th,
border-bottom-right-radius: var(--ad-radius);
}

/* A settings table's corners, which everything drawing them reads from --ad-radius. */
.os-mac #desktop-panels table {
--ad-radius: var(--ad-card-radius);
}

/* Stuck to the top of the dialog's body, where rows would show in round corners
(settings-table-stuck.js). */
#desktop-panels table.ad-stuck th {
border-radius: 0;
}

td,
th {
padding: var(--ad-row-py) var(--ad-row-px);
Expand All @@ -63,6 +74,8 @@ thead td,
thead th {
background: var(--dim);
border-bottom: 1px solid var(--ad-border-strong);
padding-block: calc(var(--ad-row-py) * 1.4);
font-size: 1.05em;
font-weight: 600;
color: color-mix(in srgb, var(--fg) 88%, transparent);
}
Expand Down Expand Up @@ -356,3 +369,19 @@ span.ad-page-step {
-webkit-mask: url("/icons/edit.svg") center / 0.85rem no-repeat;
mask: url("/icons/edit.svg") center / 0.85rem no-repeat;
}

/* A notice inside the settings dialog, rounded as its tables are. */
.os-mac dialog#desktop-settings :is(.message, .error) {
border-radius: var(--ad-card-radius);
padding: 1.2em 1.5em;
}

/* A select in a dialog's body only: the sidebar's and the pages' keep the UI's tighter corners. */
.os-mac .ad-modal-body select {
border-radius: 10px;
}

/* The saved connections on the index. */
.os-mac :is(.ad-card, #ad-new-connection) {
border-radius: var(--ad-card-radius);
}
2 changes: 2 additions & 0 deletions app/src/Settings/Theme/designs/adminer-desktop/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ html {
corner cannot follow both; 20 sits between them and is the one that reads as parallel. */
.os-mac {
--ad-window-radius: 20px;
/* What stands on a surface, a table or a card: as round as a message in Mail. */
--ad-card-radius: 12px;
}

/* Row density. These set variables only; padding and line-height read them from
Expand Down
Loading
Loading