@crombolo/server 0.42.1 → 0.44.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/NOTICE CHANGED
@@ -27,6 +27,15 @@ The Umbraco backoffice
27
27
  @umbraco-cms/backoffice 18.2.0 — MIT — https://github.com/umbraco/Umbraco-CMS
28
28
  @umbraco-ui/uui 2.0.2 — MIT — https://github.com/umbraco/Umbraco.UI
29
29
 
30
+ The Lato fonts
31
+ -------------
32
+ LatoLatin-*.woff2 — Copyright (c) 2011-2015 by tyPoland Lukasz Dziedzic, with
33
+ Reserved Font Name "Lato" — SIL Open Font License 1.1 — https://www.latofonts.com
34
+ Shipped unmodified, as @umbraco-ui/uui ships them, in @crombolo/backoffice-dist
35
+ under `dist/assets/fonts/`, with the licence beside them as `OFL.txt`
36
+ (`packages/backoffice-dist/licenses/Lato-OFL.txt` in this repository). The
37
+ fonts carry the same notice in their own metadata.
38
+
30
39
  Static files from the Umbraco client source tree
31
40
  ------------------------------------------------
32
41
  css/umb-css.css, css/rte-content.css, css/umbraco-blockgridlayout.css
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crombolo/server",
3
- "version": "0.42.1",
3
+ "version": "0.44.0",
4
4
  "description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. The crombolo HTTP server: routing, configuration, media stores and background jobs.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -31,18 +31,18 @@
31
31
  "access": "public"
32
32
  },
33
33
  "dependencies": {
34
- "@crombolo/api-delivery": "0.42.1",
35
- "@crombolo/api-management": "0.42.1",
36
- "@crombolo/auth": "0.42.1",
37
- "@crombolo/backoffice-host": "0.42.1",
38
- "@crombolo/common": "0.42.1",
39
- "@crombolo/content": "0.42.1",
40
- "@crombolo/contracts": "0.42.1",
41
- "@crombolo/core": "0.42.1",
42
- "@crombolo/data": "0.42.1",
43
- "@crombolo/render": "0.42.1",
44
- "@crombolo/schema": "0.42.1",
45
- "@crombolo/transfer": "0.42.1",
34
+ "@crombolo/api-delivery": "0.44.0",
35
+ "@crombolo/api-management": "0.44.0",
36
+ "@crombolo/auth": "0.44.0",
37
+ "@crombolo/backoffice-host": "0.44.0",
38
+ "@crombolo/common": "0.44.0",
39
+ "@crombolo/content": "0.44.0",
40
+ "@crombolo/contracts": "0.44.0",
41
+ "@crombolo/core": "0.44.0",
42
+ "@crombolo/data": "0.44.0",
43
+ "@crombolo/render": "0.44.0",
44
+ "@crombolo/schema": "0.44.0",
45
+ "@crombolo/transfer": "0.44.0",
46
46
  "@logtape/logtape": "^2.3.8",
47
47
  "jose": "^6.2.12"
48
48
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The Workflows section's and the page tab's reads and actions (story 028),
2
+ * The Approvals section's and the page tab's reads and actions (story 028),
3
3
  * under `<backoffice>/crombolo/api/approvals/`, and saving a workflow drawn in
4
4
  * the designer back to `schema/workflows/`. docs/workflows.md.
5
5
  *
@@ -64,6 +64,17 @@ async function changePreview(approvals: Approvals, principal: Principal, workflo
64
64
  return waiting.map((r) => ({ key: r.key, page: r.nodeName, outcome: workflow.onChange }))
65
65
  }
66
66
 
67
+ /** What deleting a workflow would do: its waiting requests are withdrawn. */
68
+ async function removalPreview(approvals: Approvals, principal: Principal, alias: string) {
69
+ const stored = (await approvals.workflows()).find((s) => s.workflow.alias === alias)
70
+ if (!stored) return []
71
+ const id = stored.workflow.key ?? stored.workflow.alias
72
+ const waiting = (await approvals.inFlight(principal)).filter(
73
+ (r) => r.state === 'waiting' && (r.workflow.key ?? r.workflow.alias) === id,
74
+ )
75
+ return waiting.map((r) => ({ key: r.key, page: r.nodeName, outcome: 'withdraw' as const }))
76
+ }
77
+
67
78
  /**
68
79
  * `schedule`: `[{ culture, publishTime, unpublishTime }]`, times in ISO form.
69
80
  * A time that does not parse stays an invalid date, which the engine refuses.
@@ -129,6 +140,13 @@ export async function handleApprovalsApi(
129
140
  return json(await approvals.finished(principal, skip, take))
130
141
  }
131
142
 
143
+ // Whether Approvals and a page's Workflow tab show: a workflow, or a request still open.
144
+ if (path === 'active' && request.method === 'GET') {
145
+ const active =
146
+ (await approvals.workflows()).length > 0 || (await approvals.inFlight(principal)).length > 0
147
+ return json({ active })
148
+ }
149
+
132
150
  if (path === 'workflows' && request.method === 'GET') {
133
151
  const loaded = loadSchemaDirectory(ctx.schemaDir)
134
152
  return json({
@@ -149,6 +167,8 @@ export async function handleApprovalsApi(
149
167
  const alias = decodeURIComponent(match[1] as string)
150
168
  const file = join(ctx.schemaDir, 'workflows', fileNameFor(alias))
151
169
  if (request.method === 'DELETE') {
170
+ if (match[2])
171
+ return json({ ok: true, affected: await removalPreview(approvals, principal, alias) })
152
172
  if (!ctx.writable) return readOnly()
153
173
  if (!existsSync(file))
154
174
  return json({ ok: false, message: 'There is no such workflow.' }, 404)
package/src/config.ts CHANGED
@@ -46,8 +46,20 @@ export type UserLinkSender = (message: {
46
46
  message: string | null
47
47
  }) => Promise<void>
48
48
 
49
+ /**
50
+ * How much a site takes from the remote protocol (story 167), each level the
51
+ * ones before it and more: `read` pulls, `content` applies bundles of content,
52
+ * `all` takes whole-site pushes and bundles that change structure and code.
53
+ */
54
+ export type RemoteAccess = 'off' | 'read' | 'content' | 'all'
55
+
56
+ export const REMOTE_ACCESS_LEVELS: readonly RemoteAccess[] = ['off', 'read', 'content', 'all']
57
+
49
58
  export interface RemoteSettings {
59
+ /** Whether the site answers the protocol at all: its access is not `off`. */
50
60
  enabled: boolean
61
+ /** `CROMBOLO_REMOTE_ACCESS`; `all` when only `enabled` is given, as a test does. */
62
+ access?: RemoteAccess
51
63
  /** The environment this server is, as the remote protocol names it. */
52
64
  environment: string
53
65
  /** A push here replaces something people rely on: it needs its own permission. */
@@ -60,6 +72,24 @@ export interface RemoteSettings {
60
72
  * the server's.
61
73
  */
62
74
  maxUploadBytes: number
75
+ /**
76
+ * Issuers of CI identity tokens trusted beside GitHub's and gitlab.com's (story
77
+ * 160): a self-managed GitLab, as `CROMBOLO_REMOTE_OIDC_ISSUERS`, comma separated.
78
+ */
79
+ oidcIssuers?: string[]
80
+ }
81
+
82
+ /** `CROMBOLO_REMOTE_ACCESS`, refusing the switch it replaced so a site does not quietly stop being a remote. */
83
+ function remoteAccessSetting(): RemoteAccess {
84
+ // Read directly: it is no longer a setting, only a name to refuse.
85
+ if (Bun.env.CROMBOLO_REMOTE_ENABLED !== undefined)
86
+ throw new Error(
87
+ 'CROMBOLO_REMOTE_ENABLED has gone: set CROMBOLO_REMOTE_ACCESS to read, content or all instead (story 167).',
88
+ )
89
+ const value = (setting('CROMBOLO_REMOTE_ACCESS') ?? 'off').trim().toLowerCase()
90
+ if (!REMOTE_ACCESS_LEVELS.includes(value as RemoteAccess))
91
+ throw new Error(`CROMBOLO_REMOTE_ACCESS is "${value}": it is off, read, content or all.`)
92
+ return value as RemoteAccess
63
93
  }
64
94
 
65
95
  /** The prefix every API client id carries, as the Management API requires. */
@@ -800,11 +830,16 @@ export function loadConfig(
800
830
  memberIdentityProviders: [],
801
831
  backofficeIdentityProviders: [],
802
832
  remote: {
803
- enabled: setting('CROMBOLO_REMOTE_ENABLED') === 'true',
833
+ enabled: remoteAccessSetting() !== 'off',
834
+ access: remoteAccessSetting(),
804
835
  environment: setting('CROMBOLO_REMOTE_ENVIRONMENT') || 'production',
805
836
  protected: setting('CROMBOLO_REMOTE_PROTECTED') !== 'false',
806
837
  approvals: setting('CROMBOLO_REMOTE_APPROVALS') === 'true',
807
838
  maxUploadBytes: Number(setting('CROMBOLO_REMOTE_MAX_UPLOAD_GB') ?? 50) * 1024 ** 3,
839
+ oidcIssuers: (setting('CROMBOLO_REMOTE_OIDC_ISSUERS') ?? '')
840
+ .split(',')
841
+ .map((issuer) => issuer.trim())
842
+ .filter(Boolean),
808
843
  },
809
844
  redirects: [],
810
845
  trackRedirects: setting('CROMBOLO_TRACK_REDIRECTS') !== 'false',
@@ -866,6 +901,11 @@ export function loadConfig(
866
901
  // Field by field, so a site setting its title suffix keeps the environment's switches.
867
902
  merged.seo = { ...fromEnv.seo, ...stripUndefined(overrides.seo ?? {}) }
868
903
  merged.remote = { ...fromEnv.remote, ...stripUndefined(overrides.remote ?? {}) }
904
+ // An override that says only `enabled` means everything, as before story 167.
905
+ if (overrides.remote?.enabled !== undefined && overrides.remote.access === undefined)
906
+ merged.remote.access = overrides.remote.enabled ? 'all' : 'off'
907
+ merged.remote.access ??= merged.remote.enabled ? 'all' : 'off'
908
+ merged.remote.enabled = merged.remote.access !== 'off'
869
909
  merged.errors = {
870
910
  showDetails:
871
911
  overrides.errors?.showDetails ??
@@ -982,7 +1022,7 @@ export function describeDatabase(
982
1022
  }
983
1023
  }
984
1024
 
985
- export const VERSION = '0.42.1'
1025
+ export const VERSION = '0.44.0'
986
1026
 
987
1027
  /** A whole number of seconds from the environment; undefined when unset or not one. */
988
1028
  /** A positive number from a setting, else the default. */
package/src/core.ts CHANGED
@@ -230,7 +230,11 @@ export async function createCore(config: CromboloConfig, hooks: CoreHooks) {
230
230
  createMediaSource(db, { nodeState: schema.nodeState, nodeId: schema.nodeId }),
231
231
  { budgetBytes: (config.mediaCacheMegabytes ?? DEFAULT_MEDIA_CACHE_MEGABYTES) * 1024 * 1024 },
232
232
  )
233
- const cacheOptions = { form: (key: string) => forms.byKey(key), media: mediaCache }
233
+ const cacheOptions = {
234
+ form: (key: string) => forms.byKey(key),
235
+ forms: () => forms.all(),
236
+ media: mediaCache,
237
+ }
234
238
  if (config.errors.showDetails) enableComponentStack()
235
239
  const cache = new PublishedCache(publishedSource, {
236
240
  ...cacheOptions,
@@ -21,6 +21,7 @@ import {
21
21
  BUILT_IN_FORM_TYPES,
22
22
  DEFAULT_UPLOAD_SETTINGS,
23
23
  FORM_HONEYPOT_FIELD,
24
+ FORM_LIBRARY_FIELD,
24
25
  FORM_PAGE_FIELD,
25
26
  FORM_RENDERED_FIELD,
26
27
  FORM_RESERVED_FIELDS,
@@ -28,6 +29,7 @@ import {
28
29
  type FormFieldError,
29
30
  type FormSubmissionState,
30
31
  type FormTypes,
32
+ formTokenSubject,
31
33
  isUploadAllowed,
32
34
  type SchemaForm,
33
35
  type SubmittedValues,
@@ -215,6 +217,7 @@ export function readFlash(
215
217
  if (!parsed) return undefined
216
218
  return {
217
219
  formKey: parsed.formKey,
220
+ ...(parsed.libraryKey ? { libraryKey: parsed.libraryKey } : {}),
218
221
  formAlias: parsed.formAlias,
219
222
  values: parsed.values ?? {},
220
223
  errors: parsed.errors ?? [],
@@ -238,6 +241,8 @@ export interface FormSubmitDeps {
238
241
  urlOf?: (key: string) => Promise<string | undefined>
239
242
  /** Fills in the options of choices drawn from a source, as the page rendered them. */
240
243
  resolveForm?: (form: SchemaForm) => Promise<SchemaForm>
244
+ /** A published Library form's form, with its words (story 239). */
245
+ libraryForm?: (key: string) => Promise<SchemaForm | undefined>
241
246
  }
242
247
 
243
248
  export type FormSubmitOutcome =
@@ -289,9 +294,8 @@ export async function submitForm(
289
294
  formKey: string,
290
295
  options: { ip?: string; now?: number } = {},
291
296
  ): Promise<FormSubmitOutcome> {
292
- const definition = deps.forms.byKey(formKey)
293
- if (!definition) return { status: 'notFound' }
294
- const form = deps.resolveForm ? await deps.resolveForm(definition) : definition
297
+ const file = deps.forms.byKey(formKey)
298
+ if (!file) return { status: 'notFound' }
295
299
 
296
300
  const secret = await formSigningSecret(deps.db)
297
301
  const data = await request.formData()
@@ -299,9 +303,23 @@ export async function submitForm(
299
303
 
300
304
  const renderedAt = Number(data.get(FORM_RENDERED_FIELD) ?? 0)
301
305
  const token = String(data.get(FORM_TOKEN_FIELD) ?? '')
306
+ const libraryKey = String(data.get(FORM_LIBRARY_FIELD) ?? '').trim() || undefined
302
307
  // Always required: the renderer puts a token in every form it draws, so a
303
308
  // submission without a good one did not come from a page this site rendered.
304
- if (!verifyFormToken(secret, formKey, renderedAt, token)) return { status: 'badToken' }
309
+ // It covers the Library form too, so its words cannot be swapped for another's.
310
+ const subject = formTokenSubject(formKey, libraryKey)
311
+ if (!verifyFormToken(secret, subject, renderedAt, token)) return { status: 'badToken' }
312
+
313
+ // Shown through a Library form: its words, which must still be published
314
+ // and still be made from this form.
315
+ let definition = file
316
+ if (libraryKey) {
317
+ const library = await deps.libraryForm?.(libraryKey)
318
+ if (!library || (library.key ?? library.alias) !== (file.key ?? file.alias))
319
+ return { status: 'notFound' }
320
+ definition = library
321
+ }
322
+ const form = deps.resolveForm ? await deps.resolveForm(definition) : definition
305
323
 
306
324
  // A stepped form moving forward: this page's answers checked, and nothing else.
307
325
  const checking = data.get(FORM_PAGE_FIELD)
@@ -365,7 +383,13 @@ export async function submitForm(
365
383
  return {
366
384
  status: 'invalid',
367
385
  form,
368
- state: { formKey: key, formAlias: form.alias, values: submitted, errors: result.errors },
386
+ state: {
387
+ formKey: key,
388
+ ...(libraryKey ? { libraryKey } : {}),
389
+ formAlias: form.alias,
390
+ values: submitted,
391
+ errors: result.errors,
392
+ },
369
393
  }
370
394
 
371
395
  let entryId: string | undefined
@@ -375,6 +399,7 @@ export async function submitForm(
375
399
  formAlias: form.alias,
376
400
  culture: null,
377
401
  pageKey: null,
402
+ libraryKey: libraryKey ?? null,
378
403
  ipHash: hashIp(secret, options.ip),
379
404
  userAgent: request.headers.get('user-agent')?.slice(0, 500) ?? null,
380
405
  spam,
@@ -401,6 +426,7 @@ export async function submitForm(
401
426
  runOn: workflow.on,
402
427
  entryId: entryId ?? null,
403
428
  payload: result.values,
429
+ ...(form.library?.recipients ? { recipients: form.library.recipients } : {}),
404
430
  })),
405
431
  )
406
432
 
@@ -419,6 +445,7 @@ export async function submitForm(
419
445
  redirectTo,
420
446
  state: {
421
447
  formKey: key,
448
+ ...(libraryKey ? { libraryKey } : {}),
422
449
  formAlias: form.alias,
423
450
  values: {},
424
451
  errors: [],
@@ -45,6 +45,8 @@ export interface WorkflowContext {
45
45
  form: SchemaForm
46
46
  values: readonly FormValueToStore[]
47
47
  entryId: string | null
48
+ /** In place of a send-e-mail workflow's `to`: a Library form's recipients (story 239). */
49
+ recipients?: readonly string[]
48
50
  /** Which attempt this is, from 1. */
49
51
  attempt?: number
50
52
  /** When the run was queued; now when absent. */
@@ -232,7 +234,10 @@ async function sendEmail(
232
234
  // asks for them: an inbox is not covered by the sensitive-data permission.
233
235
  const leftOut = leftOutFields(context.form, workflow)
234
236
  const values = withoutLeftOut(context.values, leftOut)
235
- const to = asList(substitute(asString(settings.to) ?? '', values))
237
+ const to =
238
+ context.recipients && context.recipients.length > 0
239
+ ? [...context.recipients]
240
+ : asList(substitute(asString(settings.to) ?? '', values))
236
241
  if (to.length === 0) return { ok: false, retry: false, error: 'The workflow has no recipient.' }
237
242
  const subject = substitute(asString(settings.subject) ?? context.form.name, values).trim()
238
243
 
@@ -589,6 +594,7 @@ export function createWorkflowRunner(
589
594
  form,
590
595
  values: run.payload,
591
596
  entryId: run.entryId,
597
+ ...(run.recipients ? { recipients: run.recipients } : {}),
592
598
  attempt: run.attempts,
593
599
  submittedAt: run.createDate,
594
600
  }
package/src/index.ts CHANGED
@@ -90,6 +90,7 @@ export * from './ports.ts'
90
90
  export * from './rate-limit.ts'
91
91
  export * from './redirects.ts'
92
92
  export * from './remote.ts'
93
+ export * from './remote-ci.ts'
93
94
  export * from './remote-credentials.ts'
94
95
  export * from './remote-media.ts'
95
96
  export * from './routes.ts'
package/src/no-nodes.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * The holding page for a site with nothing published — Umbraco's "no nodes"
3
- * screen, which `docs/features.md` asks for.
3
+ * screen, which `docs/features.md` asks for — written as a one-page guide to
4
+ * getting a first page out (story 236).
4
5
  *
5
6
  * It answers 404, not 200: a brand-new site is not a working one, and anything
6
7
  * watching the URL should keep saying so until a page is published. It is only
7
8
  * reached when the published tree is empty, so a missing path on a live site is
8
9
  * the bare 404 it always was.
9
10
  */
11
+ import { faviconSvg, logoDarkSvg, logoSvg } from '@crombolo/backoffice-host/branding'
12
+
13
+ const DOCS = 'https://github.com/kineco-au/crombolo-cms#getting-started'
14
+
10
15
  export function noNodesPage(options: { siteName: string; backOfficePath: string }): string {
11
16
  const site = escapeHtml(options.siteName)
12
17
  const backoffice = escapeHtml(options.backOfficePath)
@@ -16,41 +21,161 @@ export function noNodesPage(options: { siteName: string; backOfficePath: string
16
21
  <meta charset="utf-8">
17
22
  <meta name="viewport" content="width=device-width, initial-scale=1">
18
23
  <meta name="robots" content="noindex">
19
- <title>${site} — nothing published yet</title>
24
+ <link rel="icon" type="image/svg+xml" href="data:image/svg+xml,${encodeURIComponent(faviconSvg)}">
25
+ <title>${site} — getting started</title>
20
26
  <style>
21
- :root { color-scheme: light dark; }
27
+ :root {
28
+ color-scheme: light dark;
29
+ --ink: #54321f; --muted: #7a5a47; --ground: #fff7ea; --panel: #fff; --line: #f0e2cf;
30
+ --code: #fbefe0; --accent: #ad4f2c; --on-accent: #fff; --accent-hover: #9b4526; --deep: #cb6f48; --link: #ad4f2c;
31
+ }
32
+ * { box-sizing: border-box; }
22
33
  body {
23
- margin: 0; min-height: 100vh; display: grid; place-items: center;
24
- font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
25
- background: #f6f5f3; color: #1b1b1b;
34
+ margin: 0;
35
+ font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
36
+ background: var(--ground); color: var(--ink);
37
+ }
38
+ a { color: var(--link); }
39
+ header.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.25rem 0; }
40
+ header.bar svg { height: 2.1rem; width: auto; display: block; }
41
+ .logo-dark { display: none; }
42
+ header.bar .site { color: var(--muted); font-size: .9rem; }
43
+ main { max-width: 52rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
44
+ .hero {
45
+ position: relative; overflow: hidden;
46
+ background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
47
+ padding: 2.5rem 2.25rem; margin-bottom: 2rem;
48
+ box-shadow: 0 1px 2px rgba(84, 50, 31, .06), 0 12px 32px -18px rgba(84, 50, 31, .25);
49
+ }
50
+ .hero > * { position: relative; z-index: 1; }
51
+ .hero::after {
52
+ content: ''; position: absolute; right: -4rem; top: -4rem; width: 14rem; height: 14rem;
53
+ border-radius: 50%; background: var(--deep); opacity: .12;
54
+ }
55
+ .eyebrow { margin: 0 0 .4rem; color: var(--link); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .8rem; }
56
+ h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 .75rem; letter-spacing: -.01em; }
57
+ .lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 1.5rem; max-width: 34rem; }
58
+ a.cta {
59
+ display: inline-block; padding: .7rem 1.25rem; border-radius: 999px;
60
+ background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 700;
61
+ }
62
+ a.cta:hover { background: var(--accent-hover); }
63
+ a.cta:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
64
+ details.setup > summary {
65
+ display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; list-style: none;
66
+ padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--line);
67
+ background: var(--panel); color: var(--link); font-weight: 600; margin-bottom: 1.25rem;
68
+ }
69
+ details.setup > summary::-webkit-details-marker { display: none; }
70
+ details.setup > summary::before { content: '›'; display: inline-block; transition: transform .15s; font-size: 1.2em; line-height: 1; }
71
+ details.setup[open] > summary::before { transform: rotate(90deg); }
72
+ details.setup .when-open, details.setup[open] .when-closed { display: none; }
73
+ details.setup[open] .when-open { display: inline; }
74
+ details.setup > summary:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
75
+ ol.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
76
+ ol.steps > li {
77
+ counter-increment: step; position: relative;
78
+ background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
79
+ padding: 1.4rem 1.5rem 1.4rem 4.5rem;
26
80
  }
27
- main { max-width: 34rem; padding: 2.5rem 1.5rem; }
28
- h1 { font-size: 1.6rem; margin: 0 0 .75rem; }
29
- p { margin: 0 0 1rem; }
30
- ol { margin: 0 0 1.5rem; padding-left: 1.25rem; }
31
- li { margin-bottom: .35rem; }
32
- code { font-size: .9em; background: #e9e7e2; padding: .1em .35em; border-radius: 3px; }
33
- a.cta { display: inline-block; padding: .55rem 1rem; border-radius: 4px; background: #1b1b1b; color: #fff; text-decoration: none; }
34
- .fine { font-size: .85rem; color: #6b6b63; }
81
+ ol.steps > li::before {
82
+ content: counter(step); position: absolute; left: 1.4rem; top: 1.3rem;
83
+ width: 2.1rem; height: 2.1rem; border-radius: 50%;
84
+ background: var(--accent); color: var(--on-accent);
85
+ display: grid; place-items: center; font-weight: 800;
86
+ }
87
+ h2 { font-size: 1.15rem; margin: 0 0 .4rem; }
88
+ section.where { margin-top: 2rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.4rem 1.5rem; }
89
+ p { margin: 0 0 .75rem; }
90
+ li p:last-child { margin-bottom: 0; }
91
+ pre { margin: .6rem 0 .8rem; padding: .85rem 1rem; background: var(--code); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-size: .86rem; line-height: 1.55; }
92
+ code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; }
93
+ p code, td code { background: var(--code); padding: .1em .4em; border-radius: 4px; overflow-wrap: anywhere; }
94
+ table { width: 100%; border-collapse: collapse; }
95
+ td { padding: .55rem 0; border-top: 1px solid var(--line); vertical-align: top; }
96
+ tr:first-child td { border-top: 0; }
97
+ td:first-child { width: 12rem; padding-right: 1rem; }
98
+ .fine { margin-top: 2rem; font-size: .85rem; color: var(--muted); text-align: center; }
35
99
  @media (prefers-color-scheme: dark) {
36
- body { background: #16171a; color: #e8e6e3; }
37
- code { background: #26282c; }
38
- a.cta { background: #e8e6e3; color: #16171a; }
39
- .fine { color: #9a9a93; }
100
+ :root {
101
+ --ink: #f6ede4; --muted: #c9b5a5; --ground: #1f1813; --panel: #2a211b; --line: #3b2e25;
102
+ --code: #342922; --accent: #da987c; --on-accent: #25160e; --accent-hover: #e2ae98; --deep: #cb6f48; --link: #e8a688;
103
+ }
104
+ .logo-light { display: none; }
105
+ .logo-dark { display: block; }
106
+ .hero { box-shadow: none; }
107
+ }
108
+ @media (max-width: 560px) {
109
+ .hero { padding: 1.75rem 1.25rem; }
110
+ .hero::after { width: 8rem; height: 8rem; right: -3rem; top: -3rem; }
111
+ ol.steps > li { padding: 3.9rem 1.1rem 1.2rem; }
112
+ td:first-child { width: auto; }
40
113
  }
41
114
  </style>
42
115
  </head>
43
116
  <body>
117
+ <header class="bar">
118
+ <span class="logo-light">${logoSvg}</span>
119
+ <span class="logo-dark">${logoDarkSvg}</span>
120
+ <span class="site">${site}</span>
121
+ </header>
44
122
  <main>
45
- <h1>Nothing is published yet</h1>
46
- <p>${site} is running. There is no published page for visitors to see, so this is what the site serves.</p>
47
- <ol>
48
- <li>Sign in to the backoffice.</li>
49
- <li>Create a page from one of the content types in <code>schema/</code> — if there are none, add one there first.</li>
50
- <li>Publish it. This page goes away.</li>
123
+ <section class="hero">
124
+ <p class="eyebrow">${site} is running</p>
125
+ <h1>Nothing is published yet</h1>
126
+ <p class="lede">Visitors see this page until the site has one of its own.</p>
127
+ <p><a class="cta" href="${backoffice}">Open the back office</a></p>
128
+ </section>
129
+
130
+ <details class="setup">
131
+ <summary><span class="when-closed">Show how to set up your first page</span><span class="when-open">Hide the setup steps</span></summary>
132
+ <ol class="steps">
133
+ <li>
134
+ <h2>Sign in</h2>
135
+ <p>Open the back office at <code>${backoffice}</code>. On your own machine, <code>bun start</code> prints a username and password to sign in with, and a fresh password each time it starts. Set <code>CROMBOLO_ADMIN_PASSWORD</code> to keep the same one.</p>
136
+ </li>
137
+ <li>
138
+ <h2>Configure page metadata</h2>
139
+ <p>A content type says what a kind of page holds: a title, a summary, a body. Add one in the back office under <strong>Settings → Structure</strong>, or from the command line:</p>
140
+ <pre><code>bunx crombolo types new content-type article --at-root
141
+ bunx crombolo types add-property article summary --type textarea</code></pre>
142
+ <p>Either way it is saved as a file, <code>schema/content-types/article.toml</code>, so it travels with your code.</p>
143
+ </li>
144
+ <li>
145
+ <h2>Write its template</h2>
146
+ <p>A new content type comes with a template, <code>components/article.tsx</code>: a function from the page to JSX, rendered to HTML on the server.</p>
147
+ <pre><code>import type { PageProps } from '@crombolo/crombolo'
148
+
149
+ export default function Article({ model }: PageProps) {
150
+ return (
151
+ &lt;html lang="en"&gt;
152
+ &lt;body&gt;
153
+ &lt;h1&gt;{model.text('title')}&lt;/h1&gt;
154
+ &lt;p&gt;{model.text('summary')}&lt;/p&gt;
155
+ &lt;/body&gt;
156
+ &lt;/html&gt;
157
+ )
158
+ }</code></pre>
159
+ <p>Save the file and the next request renders it. There is nothing to rebuild.</p>
160
+ </li>
161
+ <li>
162
+ <h2>Create and publish</h2>
163
+ <p>In the back office, choose <strong>New content</strong> on the Overview, pick your content type, fill it in and press <strong>Save and publish</strong>. This page goes away and your site serves its own.</p>
164
+ </li>
51
165
  </ol>
52
- <p><a class="cta" href="${backoffice}">Open the backoffice</a></p>
53
- <p class="fine">Served with a 404: nothing is published, and a crawler should be told that plainly.</p>
166
+
167
+ <section class="where">
168
+ <h2>Where things live</h2>
169
+ <table>
170
+ <tr><td><code>schema/</code></td><td>content types, data types and languages, as TOML files</td></tr>
171
+ <tr><td><code>components/</code></td><td>templates and the components they share, as <code>.tsx</code></td></tr>
172
+ <tr><td><code>content/</code></td><td>starting pages and media, as files</td></tr>
173
+ <tr><td><code>crombolo.config.ts</code></td><td>the site's settings: its name, its database, its addresses</td></tr>
174
+ </table>
175
+ </section>
176
+
177
+ <p class="fine">More in the <a href="${DOCS}">getting started guide</a>. This page is served with a 404 because nothing is published, which is what a crawler should be told.</p>
178
+ </details>
54
179
  </main>
55
180
  </body>
56
181
  </html>