@glw907/cairn-cms 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/components/AdminLayout.svelte +52 -19
- package/dist/components/EditPage.svelte +372 -110
- package/dist/components/EditPage.svelte.d.ts +2 -1
- package/dist/components/EditorToolbar.svelte +26 -10
- package/dist/components/MarkdownEditor.svelte +108 -14
- package/dist/components/MarkdownHelpDialog.svelte +5 -0
- package/dist/components/ShortcutsDialog.svelte +37 -0
- package/dist/components/ShortcutsDialog.svelte.d.ts +13 -0
- package/dist/components/ShortcutsGrid.svelte +18 -0
- package/dist/components/ShortcutsGrid.svelte.d.ts +23 -0
- package/dist/components/cairn-admin.css +138 -108
- package/dist/components/editor-folding.d.ts +7 -0
- package/dist/components/editor-folding.js +331 -0
- package/dist/components/editor-highlight.js +55 -6
- package/dist/components/editor-shortcuts.d.ts +16 -0
- package/dist/components/editor-shortcuts.js +36 -0
- package/dist/components/markdown-directives.d.ts +17 -0
- package/dist/components/markdown-directives.js +41 -0
- package/dist/components/topbar-context.d.ts +13 -0
- package/dist/components/topbar-context.js +17 -0
- package/package.json +1 -1
- package/src/lib/components/AdminLayout.svelte +52 -19
- package/src/lib/components/EditPage.svelte +372 -110
- package/src/lib/components/EditorToolbar.svelte +26 -10
- package/src/lib/components/MarkdownEditor.svelte +108 -14
- package/src/lib/components/MarkdownHelpDialog.svelte +5 -0
- package/src/lib/components/ShortcutsDialog.svelte +37 -0
- package/src/lib/components/ShortcutsGrid.svelte +18 -0
- package/src/lib/components/cairn-admin.css +24 -11
- package/src/lib/components/editor-folding.ts +356 -0
- package/src/lib/components/editor-highlight.ts +54 -4
- package/src/lib/components/editor-shortcuts.ts +42 -0
- package/src/lib/components/markdown-directives.ts +42 -0
- package/src/lib/components/topbar-context.ts +30 -0
|
@@ -11,6 +11,7 @@ identical on every host regardless of the site's own theme.
|
|
|
11
11
|
import type { LayoutData } from '../sveltekit/content-routes.js';
|
|
12
12
|
import CsrfField from './CsrfField.svelte';
|
|
13
13
|
import { CSRF_CONTEXT_KEY } from './csrf-context.js';
|
|
14
|
+
import { provideTopbar, type TopbarHolder } from './topbar-context.js';
|
|
14
15
|
import { MenuIcon, LogOutIcon, SunIcon, MoonIcon, ChevronRightIcon, SearchIcon } from './admin-icons.js';
|
|
15
16
|
import CairnLogo from './CairnLogo.svelte';
|
|
16
17
|
import { cairnFaviconHref } from './cairn-favicon.js';
|
|
@@ -225,6 +226,16 @@ identical on every host regardless of the site's own theme.
|
|
|
225
226
|
|
|
226
227
|
// The browser-tab title: the deepest breadcrumb (the active concept or entry), then the brand.
|
|
227
228
|
const pageTitle = $derived(crumbs.length ? crumbs[crumbs.length - 1].label : 'Admin');
|
|
229
|
+
|
|
230
|
+
// A desk route is an open document (/admin/<concept>/<id>): the third path segment is the entry.
|
|
231
|
+
// The band has one job there, so the topbar drops the palette trigger and the site-wide Publish
|
|
232
|
+
// button and renders the document's own desk controls instead.
|
|
233
|
+
const isDeskRoute = $derived(data.pathname.split('/').filter(Boolean).length > 2);
|
|
234
|
+
|
|
235
|
+
// The topbar context portal: a reactive holder a descendant document fills with its desk snippet.
|
|
236
|
+
// EditPage registers on mount and nulls it on teardown; the office routes leave it null.
|
|
237
|
+
let topbar = $state<TopbarHolder>({ desk: null, zen: false });
|
|
238
|
+
provideTopbar(topbar);
|
|
228
239
|
</script>
|
|
229
240
|
|
|
230
241
|
<svelte:head>
|
|
@@ -239,16 +250,30 @@ identical on every host regardless of the site's own theme.
|
|
|
239
250
|
itself never matches. Keeping the drawer and its base/utility classes one level in lets the
|
|
240
251
|
scoped sheet style them. -->
|
|
241
252
|
<div data-theme={theme} bind:this={rootEl}>
|
|
242
|
-
|
|
253
|
+
<!-- The persistent desktop sidebar (lg:drawer-open) recedes inside an open document: a desk route
|
|
254
|
+
renders the drawer shell without it, so the nav starts closed at desktop width and the
|
|
255
|
+
manuscript takes the shell. This resolves at SSR from data.pathname (isDeskRoute), never in an
|
|
256
|
+
effect, so the chrome-free state does not flash. The checkbox still governs the overlay, so the
|
|
257
|
+
toggle (and Cmd/Ctrl+B) reopens the nav over the document on demand. -->
|
|
258
|
+
<div class="drawer min-h-screen bg-base-200 text-base-content" class:lg:drawer-open={!isDeskRoute}>
|
|
243
259
|
<input id="cairn-drawer" type="checkbox" class="drawer-toggle" bind:checked={drawerOpen} />
|
|
244
260
|
|
|
245
261
|
<div class="drawer-content flex flex-col">
|
|
262
|
+
<!-- Zen (rung 4) drops the whole topbar element, not just its contents: a desk document
|
|
263
|
+
registers zen through the topbar holder and the band slides away entirely. The desk's
|
|
264
|
+
three clusters include AdminLayout-owned chrome (the drawer toggle, the breadcrumb), so
|
|
265
|
+
emptying the band would leave that chrome behind; the band must be GONE. The manuscript
|
|
266
|
+
and EditPage's own floating zen chip carry on below. -->
|
|
267
|
+
{#if !topbar.zen}
|
|
246
268
|
<!-- The topbar is a flat, opaque continuation of the sidebar's brand band: same surface and the
|
|
247
269
|
same hairline, no shadow, so the two form one clean header strip across the sidebar seam.
|
|
248
270
|
The height is pinned to the brand band's h-16 (a content-driven navbar drifts with font
|
|
249
271
|
metrics, and the two border-bottoms stop meeting at the seam). -->
|
|
250
272
|
<div class="navbar bg-base-100 border-b border-[var(--cairn-card-border)] sticky top-0 z-30 h-16 min-h-16 gap-2 px-4 py-0 lg:px-8">
|
|
251
|
-
|
|
273
|
+
<!-- The drawer toggle is hidden at desktop width on the office routes (the persistent sidebar
|
|
274
|
+
stands in for it); on a desk route the sidebar is closed, so the toggle stays visible and
|
|
275
|
+
reopens the nav as an overlay. -->
|
|
276
|
+
<div class="flex-none" class:lg:hidden={!isDeskRoute}>
|
|
252
277
|
<label for="cairn-drawer" aria-label="Open menu" class="btn btn-square btn-ghost">
|
|
253
278
|
<MenuIcon class="h-5 w-5" />
|
|
254
279
|
</label>
|
|
@@ -268,25 +293,32 @@ identical on every host regardless of the site's own theme.
|
|
|
268
293
|
<span class="font-semibold tracking-tight">{data.siteName}</span>
|
|
269
294
|
{/if}
|
|
270
295
|
</div>
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
<
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
296
|
+
{#if isDeskRoute}
|
|
297
|
+
<!-- An open document takes the band: the registered desk snippet (the status and action
|
|
298
|
+
clusters) fills the row to the right of the breadcrumb. The palette trigger and the
|
|
299
|
+
site-wide Publish button stand down so the band has one job here. -->
|
|
300
|
+
{@render topbar.desk?.()}
|
|
301
|
+
{:else}
|
|
302
|
+
<!-- The command-palette trigger fills the center: a quick jump-to over the admin, opened
|
|
303
|
+
here or with Cmd/Ctrl+K. -->
|
|
304
|
+
<div class="flex min-w-0 flex-1 justify-center">
|
|
305
|
+
<button
|
|
306
|
+
type="button"
|
|
307
|
+
onclick={openPalette}
|
|
308
|
+
class="flex w-full max-w-md items-center gap-2 rounded-field border border-[var(--cairn-card-border)] bg-base-200/70 px-3 py-1.5 text-sm text-[var(--color-muted)] transition-colors hover:bg-base-200 hover:text-base-content"
|
|
309
|
+
>
|
|
310
|
+
<SearchIcon class="h-4 w-4 shrink-0" aria-hidden="true" />
|
|
311
|
+
<span class="truncate">Search or jump to…</span>
|
|
312
|
+
<kbd class="ml-auto hidden rounded border border-[var(--cairn-card-border)] px-1.5 text-[0.6875rem] font-medium sm:inline">⌘K</kbd>
|
|
288
313
|
</button>
|
|
289
314
|
</div>
|
|
315
|
+
{#if pendingCount > 0}
|
|
316
|
+
<div class="flex-none">
|
|
317
|
+
<button type="button" class="btn btn-primary btn-sm" aria-haspopup="dialog" onclick={() => publishAllDialog?.showModal()}>
|
|
318
|
+
Publish site ({pendingCount})
|
|
319
|
+
</button>
|
|
320
|
+
</div>
|
|
321
|
+
{/if}
|
|
290
322
|
{/if}
|
|
291
323
|
<div class="flex-none">
|
|
292
324
|
<button type="button" class="btn btn-square btn-ghost" aria-label="Toggle theme" onclick={toggleTheme}>
|
|
@@ -294,6 +326,7 @@ identical on every host regardless of the site's own theme.
|
|
|
294
326
|
</button>
|
|
295
327
|
</div>
|
|
296
328
|
</div>
|
|
329
|
+
{/if}
|
|
297
330
|
|
|
298
331
|
<main class="flex-1 p-4 lg:px-10 lg:py-8">
|
|
299
332
|
{@render children()}
|