umbral-admin 0.0.11

Auto-generated CRUD admin UI for umbral models.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
{% extends "admin/wrapper.html" %} {% block extra_head %}
<style>
    body {
        font-family: "Inter", sans-serif;
        -webkit-font-smoothing: antialiased;
    }
    /* Tabular numerals: apply on data-heavy contexts */
    .tabular-nums {
        font-variant-numeric: tabular-nums;
    }
    /* ============================================================
       Theme-aware scrollbars — inline because in DEV the admin
       loads the Tailwind CDN (utility classes only), NOT the
       pre-compiled admin.css, so any custom CSS in `css/input.css`
       never reaches the browser in dev. The sidebar's tighter
       3-4px rail used to live here for the same reason; the
       global rule for everywhere else now joins it.
       ============================================================ */
    /* Sidebar — tightest rail (every horizontal pixel matters in
       a nav column). */
    #umbral-admin-sidebar,
    #sidebar-nav {
        scrollbar-width: thin;
        scrollbar-color: var(--outline-variant) var(--surface-container);
    }
    #umbral-admin-sidebar::-webkit-scrollbar { width: 4px; }
    #sidebar-nav::-webkit-scrollbar         { width: 3px; }
    #umbral-admin-sidebar::-webkit-scrollbar-track,
    #sidebar-nav::-webkit-scrollbar-track {
        background: var(--surface-container);
    }
    #umbral-admin-sidebar::-webkit-scrollbar-thumb,
    #sidebar-nav::-webkit-scrollbar-thumb {
        background: var(--outline-variant);
        border-radius: 10px;
    }

    /* Global — applies to every scrollable surface in the admin
       (feed widget, dropdowns, tables, dialogs, main content).
       Targets the actual Tailwind utility classes used by those
       surfaces so the selectors survive any minification quirk
       and have enough specificity to win against UA defaults. */
    html {
        scrollbar-width: thin;
        scrollbar-color: var(--outline-variant) var(--surface-container);
    }
    .overflow-auto,
    .overflow-y-auto,
    .overflow-x-auto,
    .overflow-y-scroll,
    .overflow-x-scroll {
        scrollbar-width: thin;
        scrollbar-color: var(--outline-variant) var(--surface-container);
    }
    html ::-webkit-scrollbar,
    .overflow-auto::-webkit-scrollbar,
    .overflow-y-auto::-webkit-scrollbar,
    .overflow-x-auto::-webkit-scrollbar,
    .overflow-y-scroll::-webkit-scrollbar,
    .overflow-x-scroll::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
    html ::-webkit-scrollbar-track,
    .overflow-auto::-webkit-scrollbar-track,
    .overflow-y-auto::-webkit-scrollbar-track,
    .overflow-x-auto::-webkit-scrollbar-track,
    .overflow-y-scroll::-webkit-scrollbar-track,
    .overflow-x-scroll::-webkit-scrollbar-track {
        background: var(--surface-container);
    }
    html ::-webkit-scrollbar-thumb,
    .overflow-auto::-webkit-scrollbar-thumb,
    .overflow-y-auto::-webkit-scrollbar-thumb,
    .overflow-x-auto::-webkit-scrollbar-thumb,
    .overflow-y-scroll::-webkit-scrollbar-thumb,
    .overflow-x-scroll::-webkit-scrollbar-thumb {
        background: var(--outline-variant);
        border-radius: 10px;
    }
    html ::-webkit-scrollbar-thumb:hover,
    .overflow-auto::-webkit-scrollbar-thumb:hover,
    .overflow-y-auto::-webkit-scrollbar-thumb:hover,
    .overflow-x-auto::-webkit-scrollbar-thumb:hover {
        background: var(--outline);
    }
    html ::-webkit-scrollbar-corner {
        background: transparent;
    }
    /* Topbar glass effect — translucent over the page background.
     Uses var(--surface-container) so light mode gets a light glass,
     dark mode a dark glass. */
    .topbar-glass {
        background: color-mix(
            in srgb,
            var(--surface-container) 85%,
            transparent
        );
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }
    /* Sidebar link sizing. */
    .sidebar-model-link {
        font-size: 13px;
        line-height: 18px;
    }
</style>
{% endblock %} {% block body_attrs %}class="bg-background text-on-background
antialiased flex admin-shell" id="umbral-admin-body"{% endblock %} {% block body %}
<button
    id="umbral-admin-mobile-scrim"
    type="button"
    class="fixed inset-0 z-40 bg-background/65 backdrop-blur-sm"
    onclick="umbral.closeSidebar()"
    aria-label="Close navigation"
></button>

<!-- ========================================================
     SIDEBAR  260px fixed left, full height, independent scroll
     ======================================================== -->
<aside
    id="umbral-admin-sidebar"
    class="fixed left-0 top-0 h-full bg-surface-container border-r border-outline-variant flex flex-col z-50 overflow-y-auto"
    aria-label="Admin navigation"
>
    <!-- Logo area -->
    <div class="p-md flex items-center gap-sm flex-shrink-0">
        <div
            class="w-9 h-9 rounded-lg bg-primary text-on-primary flex items-center justify-center flex-shrink-0"
        >
            <i
                data-lucide="layers"
                class="w-[18px] h-[18px]"
            ></i>
        </div>
        <div class="sidebar-text min-w-0 flex-1">
            <h2 class="font-h3 text-h3 text-on-surface leading-none">
                {{ site_title }}
            </h2>
            <p
                class="sidebar-meta text-[10px] text-outline tracking-widest uppercase mt-0.5 truncate"
            >
                {% if site_description %}{{ site_description }}{% elif admin_version %}{{ admin_version }}{% endif %}
            </p>
        </div>
        <button
            type="button"
            class="md:hidden w-8 h-8 flex items-center justify-center rounded-lg text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-all"
            onclick="umbral.closeSidebar()"
            aria-label="Close navigation"
        >
            <i data-lucide="x" class="w-4 h-4"></i>
        </button>
    </div>

    <!-- Model search box -->
    <div class="sidebar-search-wrap px-md mb-md flex-shrink-0">
        <div class="relative group">
            <i
                data-lucide="search"
                class="absolute left-3 top-1/2 -translate-y-1/2 w-[16px] h-[16px] text-outline pointer-events-none"
            ></i>
            <input
                id="sidebar-search"
                type="text"
                placeholder="Search models"
                oninput="umbral.sidebarFilter(this.value)"
                class="w-full bg-surface-container-high border border-transparent rounded-xl pl-9 pr-md py-2 text-body-sm text-on-surface focus:outline-none focus:ring-1 focus:ring-outline focus:border-transparent transition-all placeholder:text-outline"
                aria-label="Filter sidebar models"
            />
        </div>
    </div>

    <!-- Navigation scroll area -->
    <nav
        class="flex-1 overflow-y-auto px-sm space-y-md pb-md"
        id="sidebar-nav"
        aria-label="Models"
    >
        <!-- Pinned dashboard link -->
        <div id="sidebar-group-core">
            <p
                class="sidebar-section-label px-md mb-xs font-label-sm text-label-sm text-outline uppercase tracking-wider"
            >
                Core
            </p>
            <div class="space-y-1 px-md">
                <a
                    href="{{ admin_base }}/{% if restore_last_path %}?dashboard=1{% endif %}"
                    class="sidebar-link sidebar-model-link flex items-center gap-2 px-sm py-1.5 rounded-xl border border-transparent {% if active_table == '' %}bg-primary-container text-on-primary-container{% else %}text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface{% endif %} font-body-sm transition-all"
                    data-model-name="dashboard"
                    data-sidebar-tooltip="Dashboard"
                    aria-label="Dashboard"
                >
                    <i
                        data-lucide="layout-dashboard"
                        class="w-[18px] h-[18px] flex-shrink-0"
                    ></i>
                    <span class="sidebar-text truncate">Dashboard</span>
                </a>
            </div>
        </div>

        <!-- Per-plugin model groups from AdminRegistry -->
        {%- for app in apps %}
        <div class="sidebar-plugin-group" id="sidebar-group-{{ app.plugin }}">
            <p
                class="sidebar-section-label px-md mb-xs font-label-sm text-label-sm text-outline uppercase tracking-wider"
            >
                {{ app.label }}
            </p>
            <div class="space-y-1 px-md">
                {%- for reg in app.models %}
                <a
                    href="{{ admin_base }}/{{ reg.table }}/"
                    class="sidebar-link sidebar-model-link flex items-center gap-2 px-sm py-1.5 rounded-xl border border-transparent {% if active_table == reg.table %}bg-primary-container text-on-primary-container{% else %}text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface{% endif %} font-body-sm transition-all"
                    data-model-name="{{ reg.label | lower }}"
                    data-sidebar-tooltip="{{ reg.label }}"
                    aria-label="{{ reg.label }}"
                >
                    <i
                        data-lucide="{{ reg.icon }}"
                        class="w-[18px] h-[18px] flex-shrink-0"
                    ></i>
                    <span class="sidebar-text flex-1 truncate">{{ reg.label }}</span>
                </a>
                {%- endfor %}
            </div>
        </div>
        {%- endfor %}

        <!-- Custom view groups -->
        {%- for vg in view_groups | default(value=[]) %}
        <div class="sidebar-plugin-group" id="sidebar-group-view-{{ loop.index }}">
            <p class="sidebar-section-label px-md mb-xs font-label-sm text-label-sm text-outline uppercase tracking-wider">{{ vg.label }}</p>
            <div class="space-y-1 px-md">
                {%- for v in vg.views %}
                <a
                    href="{{ v.href | safe }}"
                    class="sidebar-link sidebar-model-link flex items-center gap-2 px-sm py-1.5 rounded-xl border border-transparent {% if active_view is defined and active_view == v.slug %}bg-primary-container text-on-primary-container{% else %}text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface{% endif %} font-body-sm transition-all"
                    data-sidebar-tooltip="{{ v.label }}"
                    aria-label="{{ v.label }}"
                >
                    <i data-lucide="{{ v.icon }}" class="w-[18px] h-[18px] flex-shrink-0"></i>
                    <span class="sidebar-text flex-1 truncate">{{ v.label }}</span>
                </a>
                {%- endfor %}
            </div>
        </div>
        {%- endfor %}
    </nav>

    <!-- Sidebar footer -->
    <div
        class="p-md border-t border-outline-variant bg-surface-container-low flex-shrink-0"
    >
        <a
            href="{{ admin_base }}/logout"
            class="sidebar-link flex items-center gap-3 px-md py-2 rounded-xl text-on-surface-variant hover:text-on-surface hover:bg-surface-container-high font-body-sm transition-all"
            data-sidebar-tooltip="Sign out"
            aria-label="Sign out"
        >
            <i data-lucide="log-out" class="w-[18px] h-[18px]"></i>
            <span class="sidebar-footer-text">Sign out</span>
        </a>
    </div>
</aside>

<!-- ========================================================
     MAIN WRAPPER — everything to the right of the sidebar
     ======================================================== -->
<div id="umbral-admin-main" class="flex-1 flex flex-col min-h-screen min-w-0">
    <!-- TOPBAR: sticky 56px -->
    <header
        id="umbral-admin-topbar"
        class="sticky top-0 z-30 h-topbar-height topbar-glass border-b border-outline-variant flex items-center justify-between gap-md px-md sm:px-lg"
        aria-label="Admin top bar"
    >
        <div class="flex items-center gap-sm min-w-0">
            <button
                id="sidebar-toggle"
                aria-label="Toggle navigation"
                aria-expanded="true"
                type="button"
                onclick="umbral.toggleSidebar()"
                class="w-9 h-9 flex items-center justify-center rounded-lg text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-all flex-shrink-0"
            >
                <i data-lucide="panel-left" class="w-[18px] h-[18px]"></i>
            </button>
        <!-- Breadcrumbs (set by each handler via context variable `breadcrumbs`) -->
        <nav
            class="flex items-center gap-xs font-label-md text-label-md min-w-0"
            aria-label="Breadcrumb"
        >
            <a
                href="{{ admin_base }}/{% if restore_last_path %}?dashboard=1{% endif %}"
                class="text-outline hover:text-on-surface transition-colors shrink-0"
                >Home</a
            >
            {%- for crumb in breadcrumbs %}
            <i
                data-lucide="chevron-right"
                class="w-[14px] h-[14px] text-outline"
            ></i>
            {%- if loop.last %}
            <span class="text-primary font-semibold">{{ crumb.label }}</span>
            {%- else %}
            <a
                href="{{ crumb.url }}"
                class="text-outline hover:text-on-surface transition-colors"
                >{{ crumb.label }}</a
            >
            {%- endif %} {%- endfor %}
        </nav>
        </div>

        <!-- Center: command palette trigger -->
        <button
            id="cmd-palette-trigger"
            aria-label="Open command palette (Ctrl+K)"
            class="hidden md:flex bg-surface-container-high border border-transparent px-md py-1.5 rounded-xl items-center gap-xl hover:bg-surface-container-highest transition-colors min-w-[260px]"
            onclick="
                htmx.ajax('GET', '{{ admin_base }}/api/palette', {
                    target: '#umbral-palette-slot',
                    swap: 'innerHTML',
                })
            "
            type="button"
        >
            <div class="flex items-center gap-sm">
                <i
                    data-lucide="search"
                    class="w-[16px] h-[16px] text-outline"
                ></i>
                <span class="text-body-sm text-outline"
                    >Search everything</span
                >
            </div>
            <span
                class="ml-sm inline-flex items-center gap-1 text-[10px] text-outline"
                aria-hidden="true"
            >
                <kbd
                    class="rounded-md border border-transparent bg-surface-container-low px-1.5 py-0.5 font-medium text-on-surface-variant"
                    >Ctrl</kbd
                >
                <kbd
                    class="rounded-md border border-transparent bg-surface-container-low px-1.5 py-0.5 font-medium text-on-surface-variant"
                    >K</kbd
                >
            </span>
        </button>

        <!-- Right: theme toggle + user menu -->
        <div class="flex items-center gap-sm sm:gap-md">
            <!-- Theme toggle — persisted in localStorage under umbral-admin-theme -->
            <button
                id="theme-toggle"
                aria-label="Toggle light/dark theme"
                type="button"
                onclick="umbral.toggleTheme()"
                class="w-9 h-9 flex items-center justify-center rounded-lg text-on-surface-variant hover:bg-surface-container-high hover:text-on-surface transition-all"
            >
                <i
                    data-lucide="sun"
                    id="theme-icon-light"
                    class="w-[18px] h-[18px] hidden"
                ></i>
                <i
                    data-lucide="moon"
                    id="theme-icon-dark"
                    class="w-[18px] h-[18px]"
                ></i>
            </button>

            <div class="hidden sm:block w-px h-6 bg-outline-variant"></div>

            <!-- User menu -->
            <div
                class="hidden sm:flex items-center gap-3 cursor-pointer group"
                role="button"
                tabindex="0"
                aria-label="User menu"
                onclick="umbral.toggleUserMenu()"
            >
                <div class="text-right">
                    <p
                        class="text-body-sm font-semibold text-on-surface leading-none"
                    >
                        {{ user }}
                    </p>
                    <p
                        class="text-[10px] text-outline uppercase tracking-wider mt-0.5"
                    >
                        Staff
                    </p>
                </div>
                <!-- Avatar initials circle -->
                <div
                    class="w-9 h-9 rounded-lg bg-primary-container flex items-center justify-center border border-outline-variant group-hover:border-primary transition-colors"
                >
                    <span
                        class="font-label-sm text-label-sm text-on-primary-container uppercase"
                        >{{ user[:2] }}</span
                    >
                </div>
            </div>
        </div>
    </header>

    <!-- CONTENT region — overflow-x-hidden so wide tables don't push
         the entire main area; the table wrapper has overflow-x-auto. -->
    <main id="umbral-admin-content" class="flex-1 p-md sm:p-lg lg:p-xl overflow-x-hidden">
        {% block content %}{% endblock %}
    </main>
</div>
<!-- end main wrapper -->
<div id="umbral-sidebar-tooltip" role="tooltip" aria-hidden="true"></div>
{% endblock %}