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
4 changes: 2 additions & 2 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2026-10-10 00:10:32 UTC using RuboCop version 1.91.0.
# on 2026-12-02 05:27:22 UTC using RuboCop version 1.91.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -43,7 +43,7 @@ RSpec/ExampleLength:
RSpec/MessageSpies:
EnforcedStyle: receive

# Offense count: 42
# Offense count: 47
RSpec/MultipleExpectations:
Max: 4

Expand Down
76 changes: 62 additions & 14 deletions app/assets/stylesheets/generator.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.stage .top { fill: var(--birch-light); }
.stage .left { fill: var(--birch); }
.stage .right { fill: var(--birch-dark); }
.stage .tilted { fill: color-mix(in oklab, var(--birch-light) 55%, var(--birch)); }
.stage .inside { stroke: #2a1a0c; stroke-width: 1; }
.stage .floor { fill: #6b5231; }
.stage .far { fill: #a98a57; }
Expand All @@ -44,12 +45,19 @@
.panel {
position: relative; margin: 0;
background: var(--panel); border-top: 3px solid var(--amber); border-bottom: 1px solid var(--rule);
display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(0, 1.3fr) minmax(140px, 1.1fr);
/* The choices, the three sides, thickness, notch, Generate. */
display: grid; grid-template-columns: minmax(max-content, 1.3fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(140px, 1.1fr);
}
.hint { position: absolute; left: var(--gutter); bottom: calc(100% + 10px); margin: 0; font-size: 14px; color: var(--alarm); }
/* Why the box cannot be made: a bright red pill above the strip. */
.hint {
position: absolute; left: var(--gutter); bottom: calc(100% + 10px); margin: 0; max-width: calc(100% - 2 * var(--gutter));
padding: 6px 16px; border-radius: 99px; background: var(--error); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.35;
box-shadow: 0 2px 10px rgb(0 0 0 / 0.35);
}
.hint:empty { display: none; }

.field { position: relative; padding: 16px clamp(12px, 1.5vw, 22px) 14px; border-right: 1px solid var(--rule); display: grid; gap: 10px; align-content: start; }
.field > label { font-size: 13px; color: var(--mute); font-stretch: 110%; cursor: ew-resize; user-select: none; touch-action: none; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; overflow: hidden; }
.field > label { font-size: 13px; color: var(--mute); font-stretch: 110%; cursor: move; user-select: none; touch-action: none; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; overflow: hidden; }
.field > label i { font-style: normal; opacity: 0; transition: opacity 0.15s; white-space: nowrap; }
.field:hover > label i, .field:focus-within > label i { opacity: 0.7; }
.num { display: flex; align-items: baseline; gap: 6px; }
Expand All @@ -73,7 +81,24 @@
font-size: 13px; color: var(--soft); cursor: pointer;
}
.chips button:hover, .more:hover, .pick select:hover { border-color: var(--soft); }
.field .restart { justify-self: start; white-space: nowrap; }
/* Wraps to "Reset to / defaults" when the Width cell is too narrow for one line. */
.field .restart { text-align: left; border-radius: 14px; }
.reset { position: relative; justify-self: start; }
/* Reset, and the Yes that carries it out, warn in red. */
.field .restart:hover, .field .restart[aria-expanded="true"], .reset .yes:hover { color: var(--error); border-color: var(--error); }
/* The popup sits to the right of Reset, over the next cell, with a point towards the button. */
.reset .confirm {
position: absolute; z-index: 5; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
display: flex; align-items: center; gap: 6px; white-space: nowrap;
padding: 6px 8px 6px 12px; border: 1px solid var(--edge); border-radius: 12px;
background: var(--sheet); box-shadow: 0 4px 16px rgb(0 0 0 / 0.45); font-size: 13px; color: var(--soft);
}
.reset .confirm[hidden] { display: none; }
.reset .confirm::before {
content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px;
background: var(--sheet); border-left: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
transform: translateY(-50%) rotate(45deg);
}
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.side { padding: 14px clamp(12px, 1.5vw, 22px); border-right: 1px solid var(--rule); display: grid; gap: 8px; align-content: center; justify-items: start; }
Expand All @@ -83,8 +108,17 @@
.seg input:checked + span { background: var(--ink); color: var(--panel); }
.seg input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.pick select { padding: 4px 10px; max-width: 100%; }
/* The column is as wide as its longest option; both dropdowns fill it, so they line up. */
.side .pick { justify-self: stretch; }
.side .pick select { width: 100%; }
.pick select option { background: var(--panel); color: var(--ink); }
.soon { color: var(--mute); font-size: 12.5px; line-height: 1.3; }

/* The slope and front height of a sloped box: a row of its own under the strip, after Generate. */
.sloped { grid-column: 1 / -1; order: 1; display: grid; grid-template-columns: subgrid; border-top: 1px solid var(--rule); }
.sloped[hidden] { display: none; }
/* A text input is twenty characters wide unless told otherwise; without this the Slope input would widen the choices column. */
.sloped > .field { contain: inline-size; }
.sloped .note { grid-column: 3 / -1; margin: 0; padding: 16px clamp(12px, 1.5vw, 22px); align-self: center; max-width: 72ch; font-size: 13px; line-height: 1.4; color: var(--mute); }

.go {
background: var(--beam); color: #160a04; border: 0; cursor: pointer;
Expand All @@ -101,23 +135,37 @@
/* As tall as the drawing needs and no taller, so no empty band above and below it. */
.stage { height: auto; min-height: 0; margin-top: 8px; }
.stage svg { height: auto; max-height: 50vh; }
.panel { grid-template-columns: repeat(3, 1fr); }
.field.thickness { grid-column: span 2; }
.side, .go { grid-column: span 3; }
.field.thickness, .field.notch, .side, .go { border-top: 1px solid var(--rule); }
.side { grid-auto-flow: column; justify-content: start; align-items: center; gap: 10px 14px; grid-auto-flow: row; }
/* Twelve columns: three sides in fourths, then thickness and notch, with slope and front height between them. */
.panel { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.panel > .field { grid-column: span 4; }
.field.thickness { grid-column: span 8; }
.side, .go, .sloped .note { grid-column: 1 / -1; }
.sloped { display: contents; }
.sloped[hidden] { display: none; }
.sloped:not([hidden]) > .field,
.panel:has(.sloped:not([hidden])) .field.thickness,
.panel:has(.sloped:not([hidden])) .field.notch { grid-column: span 3; }
/* Every control comes before Generate. */
.field.notch { order: 1; }
.sloped .note { order: 2; }
.go { order: 3; }
/* The choices come first, so every row under them gets a rule. */
.panel > .field, .sloped > .field, .go { border-top: 1px solid var(--rule); }
/* Above the measurements, the choices sit in one line beside the units pill, wrapping only when there is no room. */
.side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.side .pick select { width: auto; }
.go { padding: 18px; }
.hint { position: static; grid-column: span 3; padding: 8px var(--gutter) 0; }
.hint:empty { display: none; }
.hint { position: static; grid-column: 1 / -1; justify-self: start; margin: 10px var(--gutter) 0; max-width: none; border-radius: 18px; }
.sloped .note { grid-column: 1 / -1; padding-top: 0; }
}

/* A phone-width Width cell only has room for "Reset". */
@media (max-width: 520px) {
.field .restart .wide { display: none; }
}

/* On a phone, a slim Generate bar sits above the controls instead of below them. */
/* On a phone, Generate is a slim bar under the controls. */
@media (max-width: 640px) {
.go { order: -1; padding: 9px 14px; font-size: 18px; border-top: 0; }
.go { padding: 9px 14px; font-size: 18px; }
.go small { display: none; }
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
--beam: #ff5a2b; /* the laser */
--amber: #ffb53d; /* the accent: headings, edges, whatever is being edited */
--alarm: #ff7a6b;
--error: #ff2020;
--error: #ff2020; /* the error pill */

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

🙁 White on #ff2020 has a contrast of about 3.8:1. The pill text is 14px bold, which is not WCAG large text (that starts at 18.66px bold), so this fails AA's 4.5:1. Something like #d00000 (about 5.7:1) is still a loud red and passes.

--birch: #e2c48f; /* plywood */
--birch-light: #efd9aa;
--birch-dark: #c4a269;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/boxes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class BoxesController < ApplicationController
# ActionController::Live's own thread, which Rack::Timeout never interrupts.
RENDER_SECONDS = 20

PERMITTED = (BoxRequest::DIMENSIONS + BoxRequest::OPTIONAL + %i[units page_size page_layout metadata lid]).freeze
PERMITTED = (BoxRequest::DIMENSIONS + BoxRequest::OPTIONAL + BoxRequest::SLOPED + %i[units page_size page_layout metadata lid]).freeze

# Draws the SVG, reporting progress as it goes and sending the drawing last.
def stream
Expand Down
5 changes: 2 additions & 3 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
class HomeController < ApplicationController
def index
@settings = {
defaults: BoxRequest.defaults,
pageSizes: BoxRequest.page_sizes,
lidsSupported: BoxRequest.lids_supported?
defaults: BoxRequest.defaults,
pageSizes: BoxRequest.page_sizes
}
end
end
Loading
Loading