@crombolo/backoffice-host 0.42.1 → 0.43.1

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.
@@ -1,123 +0,0 @@
1
- /**
2
- * The Settings dashboard, in place of Umbraco's.
3
- *
4
- * Its manifest declares `overwrites: ['Umb.Dashboard.SettingsWelcome']`, the same
5
- * way the Welcome dashboard takes the place of the news one. What it replaces is
6
- * marketing for Umbraco's own training and consultancy — accurate for Umbraco and
7
- * misleading here, and not the sort of thing to fix by renaming, since the
8
- * services it points at are real and are not this project's.
9
- *
10
- * What it says instead is the thing a person in Settings actually needs to know:
11
- * that types are files, and that changing one here writes that file.
12
- */
13
- // UmbLitElement, not plain LitElement: a dashboard is used as a controller host,
14
- // and a plain element fails with `controllerHost.provideContext is not a function`.
15
- import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
16
- import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
17
-
18
- /** Whether this site can send e-mail; the server answers with the reason. */
19
- const emailStatus = async () => {
20
- const href = document.querySelector('base')?.getAttribute('href') ?? '/umbraco/'
21
- const response = await fetch(`${href.replace(/\/$/, '')}/crombolo/api/email`, {
22
- credentials: 'include',
23
- headers: { accept: 'application/json' },
24
- })
25
- if (!response.ok) throw new Error(`email responded ${response.status}`)
26
- return response.json()
27
- }
28
-
29
- export default class CromboloSettingsDashboardElement extends UmbLitElement {
30
- static properties = {
31
- _email: { state: true },
32
- }
33
-
34
- connectedCallback() {
35
- super.connectedCallback()
36
- // A failure here leaves the section out rather than the dashboard broken:
37
- // this is an explanation, not a control.
38
- emailStatus().then(
39
- (status) => {
40
- this._email = status
41
- },
42
- () => {},
43
- )
44
- }
45
-
46
- #email() {
47
- const status = this._email
48
- if (!status) return nothing
49
- if (status.available)
50
- return html`
51
- <uui-box headline="E-mail">
52
- <p>E-mail is sent through <strong>${status.provider}</strong>.</p>
53
- </uui-box>
54
- `
55
- return html`
56
- <uui-box headline="E-mail">
57
- <p>${status.reason}</p>
58
- ${
59
- status.affects.length > 0
60
- ? html`<p>Until one is configured, these are unavailable:</p>
61
- <ul>
62
- ${status.affects.map((feature) => html`<li>${feature}</li>`)}
63
- </ul>`
64
- : nothing
65
- }
66
- </uui-box>
67
- `
68
- }
69
-
70
- render() {
71
- return html`
72
- <uui-box headline="Settings">
73
- <p>
74
- Content types, data types and languages are <strong>files</strong>, in
75
- <code>schema/</code>, written as TOML. The database is a view of them: what you change
76
- here is written to the file, and the file is what a deploy and every other node reads.
77
- </p>
78
- <p>
79
- That is why a type can be reviewed in a pull request, and why a schema change carries a
80
- version — a change that converts existing content is a major, and the backoffice moves
81
- the number for you.
82
- </p>
83
- <p class="links">
84
- <a href="https://github.com/kineco-au/crombolo-cms#schema-as-code" target="_blank" rel="noopener">
85
- Schema as code
86
- </a>
87
- <a href="https://github.com/kineco-au/crombolo-cms#schema-in-shared-storage" target="_blank" rel="noopener">
88
- Schema in shared storage
89
- </a>
90
- <a href="https://github.com/kineco-au/crombolo-cms/issues" target="_blank" rel="noopener">
91
- Report an issue
92
- </a>
93
- </p>
94
- </uui-box>
95
- ${this.#email()}
96
- `
97
- }
98
-
99
- static styles = css`
100
- :host {
101
- display: block;
102
- padding: var(--uui-size-layout-1, 24px);
103
- }
104
- p {
105
- max-width: 60ch;
106
- line-height: 1.5;
107
- }
108
- .links {
109
- display: flex;
110
- gap: var(--uui-size-space-5, 18px);
111
- flex-wrap: wrap;
112
- }
113
- uui-box + uui-box {
114
- margin-top: var(--uui-size-layout-1, 24px);
115
- }
116
- ul {
117
- max-width: 60ch;
118
- line-height: 1.5;
119
- }
120
- `
121
- }
122
-
123
- customElements.define('crombolo-settings-dashboard', CromboloSettingsDashboardElement)
@@ -1,103 +0,0 @@
1
- /**
2
- * The Welcome dashboard in the Content section. Its manifest declares
3
- * `overwrites: ['Umb.Dashboard.UmbracoNews']`, which takes the place of
4
- * Umbraco's news dashboard without mutating the registry while the backoffice
5
- * is rendering — the hazard the TSX entry point documents.
6
- */
7
- // UmbLitElement, not plain LitElement: a dashboard is used as a controller host,
8
- // and a plain element fails with `controllerHost.provideContext is not a function`.
9
- import { css, html } from '@umbraco-cms/backoffice/external/lit'
10
- import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
11
-
12
- const STEPS = [
13
- {
14
- title: 'Model the content',
15
- body: html`Open <strong>Settings → Content Types</strong> and describe a page: its
16
- properties, its tabs, and which types may sit beneath it.`,
17
- },
18
- {
19
- title: 'Write a template',
20
- body: html`Templates are <strong>TSX</strong>, not Razor. A template is a file in
21
- <code>components/</code> that default-exports a component and receives the page as
22
- <code>model</code>; <code>export const layout = 'alias'</code> names its master.
23
- The editor under Settings → Templates writes that shape for you.`,
24
- },
25
- {
26
- title: 'Create and publish',
27
- body: html`Back in <strong>Content</strong>, create a page from your content type, fill it
28
- in and publish. Publishing is per culture, and the published version is what the
29
- site renders — drafts stay invisible until you say otherwise.`,
30
- },
31
- {
32
- title: 'Keep the schema in the repository',
33
- body: html`Content types, data types and templates are also files:
34
- <code>schema/*.toml</code>. <code>crombolo types sync</code> writes changes made in
35
- the backoffice back out, and <code>crombolo types check</code> tells you whether a
36
- database matches. Schema travels through Git, not a database export.`,
37
- },
38
- ]
39
-
40
- export default class CromboloWelcomeDashboardElement extends UmbLitElement {
41
- render() {
42
- return html`
43
- <uui-box headline="Welcome to Crombolo">
44
- <p class="lede">
45
- Crombolo is a content management system that runs on
46
- <strong>Bun and TypeScript</strong>: the server, the templates and the schema are
47
- TypeScript, and the database is SQLite or Postgres.
48
- </p>
49
- <p class="lede">
50
- There is no .NET anywhere in it: templates are TSX rather than Razor, and a
51
- site's schema lives in TOML files beside its code.
52
- </p>
53
- </uui-box>
54
-
55
- <uui-box headline="Getting started">
56
- <ol>
57
- ${STEPS.map(
58
- (step) => html`<li>
59
- <h4>${step.title}</h4>
60
- <p>${step.body}</p>
61
- </li>`,
62
- )}
63
- </ol>
64
- </uui-box>
65
-
66
- <uui-box headline="Worth knowing">
67
- <ul>
68
- <li>
69
- The <strong>Settings</strong> section holds templates, partial views,
70
- stylesheets and scripts — all served from your site's folders.
71
- </li>
72
- <li>
73
- <strong>Upgrade</strong>, also under Settings, reports anything a version
74
- change needs from you before it will run.
75
- </li>
76
- <li>
77
- The log viewer under Settings reads the server's own structured logs, so a
78
- failed publish or a broken template is searchable rather than guessed at.
79
- </li>
80
- </ul>
81
- </uui-box>
82
- `
83
- }
84
-
85
- static styles = css`
86
- :host { display: block; padding: var(--uui-size-layout-1); }
87
- uui-box { margin-bottom: var(--uui-size-layout-1); }
88
- .lede { max-width: 70ch; line-height: 1.6; }
89
- ol { margin: 0; padding-left: var(--uui-size-layout-1); }
90
- ol li { margin-bottom: var(--uui-size-space-5); max-width: 70ch; }
91
- ol h4 { margin: 0 0 var(--uui-size-space-2); }
92
- ol p { margin: 0; line-height: 1.6; }
93
- ul { margin: 0; padding-left: var(--uui-size-layout-1); }
94
- ul li { margin-bottom: var(--uui-size-space-3); max-width: 70ch; line-height: 1.6; }
95
- code {
96
- background: var(--uui-color-surface-alt);
97
- padding: 0 var(--uui-size-space-1);
98
- border-radius: var(--uui-border-radius);
99
- }
100
- `
101
- }
102
-
103
- customElements.define('crombolo-welcome-dashboard', CromboloWelcomeDashboardElement)