Give visions a tint, and offer the whole palette

319490f · Gabriel Morell · 2026-08-11 19:27

37 files +338 -15
Message
{commit_body(@commit)}

Files changed

modified ?
+0 −0

Binary file — not rendered.

modified ?
+0 −0

Binary file — not rendered.

modified ?
+0 −0

Binary file — not rendered.

modified apps/room_sanctum/assets/tailwind.config.js
+11 −0
@@ -83,6 +83,17 @@ module.exports = {
83 83 '../lib/*_web.ex',
84 84 '../lib/*_web/**/*.*ex'
85 85 ],
86 + // Tint classes are assembled at runtime -- text-${tint}-500 and friends --
87 + // so nothing in the source ever contains them for Tailwind to find. Until
88 + // now they survived only because of literal dummy spans in a few
89 + // templates, which is why text-red-500 was missing while bg-red-500 was
90 + // not. Keep this in step with RoomSanctum.Tints.
91 + safelist: [
92 + {
93 + pattern: /^(text|bg|border|ring)-(red|orange|amber|yellow|lime|green|emerald|teal|cyan|sky|blue|indigo|violet|purple|fuchsia|pink|rose|slate|gray|zinc|stone)-(50|100|200|300|400|500|600|700|800|900)$/,
94 + variants: ['hover'],
95 + },
96 + ],
86 97 theme: {
87 98 extend: {},
88 99 },
modified apps/room_sanctum/lib/room_sanctum/configuration.ex
+8 −3
@@ -371,11 +371,16 @@ defmodule RoomSanctum.Configuration do
371 371 |> Repo.update()
372 372 end
373 373
374 − defp inj_fake_ids(attrs) do
375 − q = attrs["queries"] |> Enum.map(fn {ctr, val} -> val |> Map.put("id", ctr) end)
376 − Map.put(attrs, "queries", q)
374 + # The form submits its queries as an index-keyed map and each one needs an id
375 + # to survive the round trip. Anything else -- an update that only touches the
376 + # name, or the tint -- has no queries to renumber and used to die on
377 + # `nil |> Enum.map`.
378 + defp inj_fake_ids(%{"queries" => queries} = attrs) when is_map(queries) or is_list(queries) do
379 + Map.put(attrs, "queries", Enum.map(queries, fn {ctr, val} -> Map.put(val, "id", ctr) end))
377 380 end
378 381
382 + defp inj_fake_ids(attrs), do: attrs
383 +
379 384 @doc """
380 385 Deletes a vision.
381 386
modified apps/room_sanctum/lib/room_sanctum/configuration/vision.ex
+21 −0

Click to load diff…

added apps/room_sanctum/lib/room_sanctum/tints.ex
+25 −0

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/form_component.ex
+1 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_query_live/show.html.heex
+5 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/form_component.ex
+1 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_source_live/show.ex
+1 −5

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_vision_live/form_component.ex
+16 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_vision_live/form_component.html.heex
+29 −0

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_vision_live/index.html.heex
+4 −1

Click to load diff…

added apps/room_sanctum/priv/repo/migrations/20260811160000_add_meta_to_cfg_visions.exs
+14 −0

Click to load diff…

added apps/room_sanctum/test/room_sanctum/tints_test.exs
+74 −0

Click to load diff…

modified apps/room_sanctum/test/room_sanctum_web/live/source_live_bulk_paint_test.exs
+3 −2

Click to load diff…

added apps/room_sanctum/test/room_sanctum_web/live/vision_tint_test.exs
+125 −0

Click to load diff…

Parents: 8d60c25