@crombolo/backoffice-host 0.41.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.
Files changed (35) hide show
  1. package/NOTICE +9 -0
  2. package/package.json +3 -3
  3. package/plugin/addresses-dashboard.js +3 -2
  4. package/plugin/app-preview/umbraco-package.json +1 -1
  5. package/plugin/approvals-active.js +40 -0
  6. package/plugin/audit-dashboard.js +3 -2
  7. package/plugin/branding/localization-en.js +9 -3
  8. package/plugin/branding/sign-in.js +0 -31
  9. package/plugin/branding/theme-dark.css +19 -5
  10. package/plugin/branding/theme.css +41 -19
  11. package/plugin/breadcrumb.js +29 -0
  12. package/plugin/changes-dashboard.js +3 -2
  13. package/plugin/edit-conflicts.js +11 -21
  14. package/plugin/jobs-dashboard.js +3 -2
  15. package/plugin/localizations/umbraco-package.json +1 -1
  16. package/plugin/notifications-dialog.js +8 -35
  17. package/plugin/overview-dashboard.js +412 -0
  18. package/plugin/overview-format.js +71 -0
  19. package/plugin/seo/umbraco-package.json +1 -1
  20. package/plugin/settings-cards.js +189 -0
  21. package/plugin/settings-section.js +436 -0
  22. package/plugin/side-panel/host.js +7 -63
  23. package/plugin/side-panel/layout.js +0 -15
  24. package/plugin/sign-in/umbraco-package.json +1 -1
  25. package/plugin/tsx-editors.js +56 -164
  26. package/plugin/umbraco-package.json +26 -55
  27. package/plugin/workflow-client.js +3 -0
  28. package/plugin/workflow-designer.js +17 -2
  29. package/src/branding.ts +4 -0
  30. package/plugin/branding/branding.js +0 -188
  31. package/plugin/branding/client-credentials.js +0 -49
  32. package/plugin/branding/log-viewer-menu.js +0 -70
  33. package/plugin/branding/query-builder.js +0 -28
  34. package/plugin/settings-dashboard.js +0 -123
  35. package/plugin/welcome-dashboard.js +0 -103
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/backoffice-host",
3
- "version": "0.41.1",
3
+ "version": "0.43.1",
4
4
  "description": "Internal to crombolo, with no compatibility promise: use @crombolo/crombolo. Serves the Umbraco backoffice SPA: shell HTML, import map and package manifests.",
5
5
  "license": "MIT",
6
6
  "author": "Crombolo",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@crombolo/core": "0.41.1",
36
- "@crombolo/backoffice-dist": "18.2.0"
35
+ "@crombolo/core": "0.43.1",
36
+ "@crombolo/backoffice-dist": "0.43.1"
37
37
  }
38
38
  }
@@ -3,12 +3,13 @@
3
3
  * below it, as Umbraco's `HideTopLevelNodeFromPath` sets it. Saving moves the
4
4
  * addresses, and the old ones redirect to the new. docs/rendering.md, "URLs".
5
5
  */
6
- import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
6
+ import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
7
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
7
8
 
8
9
  const endpoint = () =>
9
10
  `${(document.querySelector('base')?.getAttribute('href') ?? '/umbraco/').replace(/\/$/, '')}/crombolo/api/url-options`
10
11
 
11
- export default class CromboloAddressesDashboardElement extends LitElement {
12
+ export default class CromboloAddressesDashboardElement extends UmbLitElement {
12
13
  static properties = {
13
14
  _settings: { state: true },
14
15
  _showTopLevel: { state: true },
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo App Preview",
4
4
  "id": "Crombolo.AppPreview",
5
- "version": "0.41.1",
5
+ "version": "0.43.1",
6
6
  "allowPublicAccess": false,
7
7
  "extensions": [
8
8
  {
@@ -0,0 +1,40 @@
1
+ /**
2
+ * `Crombolo.Condition.ApprovalsActive`: the Approvals section and a page's
3
+ * Workflow tab show only while the site has a workflow or a request is open
4
+ * (story 234). The designer calls `approvalsChanged()` after a save or a delete,
5
+ * so the first workflow brings them in without a reload.
6
+ */
7
+ import { UmbConditionBase } from '@umbraco-cms/backoffice/extension-registry'
8
+ import { approvalsActive } from './workflow-client.js'
9
+
10
+ const listeners = new Set()
11
+
12
+ /** Asks every condition to check again. */
13
+ export function approvalsChanged() {
14
+ for (const listener of listeners) listener()
15
+ }
16
+
17
+ export class CromboloApprovalsActiveCondition extends UmbConditionBase {
18
+ #listener = () => this.#check()
19
+
20
+ constructor(host, args) {
21
+ super(host, args)
22
+ listeners.add(this.#listener)
23
+ this.#check()
24
+ }
25
+
26
+ async #check() {
27
+ const answer = await approvalsActive()
28
+ // A failed check leaves Approvals where people can still reach their requests.
29
+ this.permitted = answer.ok ? answer.active === true : true
30
+ }
31
+
32
+ destroy() {
33
+ listeners.delete(this.#listener)
34
+ super.destroy()
35
+ }
36
+ }
37
+
38
+ export default CromboloApprovalsActiveCondition
39
+
40
+ export { CromboloApprovalsActiveCondition as api }
@@ -3,7 +3,8 @@
3
3
  * newest first, filtered by person, kind of change, words and dates.
4
4
  * docs/audit-log.md.
5
5
  */
6
- import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
6
+ import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
7
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
7
8
 
8
9
  const PAGE_SIZE = 50
9
10
 
@@ -133,7 +134,7 @@ function fromWhere(entry) {
133
134
  return forwarded || entry.ipAddress || '—'
134
135
  }
135
136
 
136
- export default class CromboloAuditDashboardElement extends LitElement {
137
+ export default class CromboloAuditDashboardElement extends UmbLitElement {
137
138
  static properties = {
138
139
  _page: { state: true },
139
140
  _users: { state: true },
@@ -11,9 +11,10 @@
11
11
  * one that wins. See `localization.registry.js`: `$weight: extension.weight ?? 100`.
12
12
  *
13
13
  * Only what a person reads in a flow this CMS implements. Strings about
14
- * `appsettings.json`, IIS permissions, Examine or the .NET installer are left
15
- * alone: they name real things that are not ours to rename, and the features they
16
- * belong to are not built.
14
+ * `appsettings.json`, IIS permissions or the .NET installer are left alone: they
15
+ * name real things that are not ours to rename, and the features they belong to
16
+ * are not built. Examine is the exception: the search dashboard is built, over
17
+ * the database's own indexes, so its tab and heading say what it is.
17
18
  *
18
19
  * `sections` and `packager` are the other kind of rename: not the product's name
19
20
  * but a feature's. Umbraco's Packages section builds a `.umb` file; the artifact
@@ -65,6 +66,11 @@ export default {
65
66
  },
66
67
  dashboardTabs: {
67
68
  contentIntro: 'Welcome to Crombolo',
69
+ // Search here is the database's own (docs/search.md), not Examine.
70
+ settingsExamine: 'Search indexes',
71
+ },
72
+ examineManagement: {
73
+ manageIndexes: 'Manage search indexes',
68
74
  },
69
75
  languages: {
70
76
  defaultLanguageHelp: 'A Crombolo site can only have one default language set.',
@@ -66,38 +66,7 @@ class CromboloAuthProviderElement extends LitElement {
66
66
 
67
67
  if (!customElements.get(TAG)) customElements.define(TAG, CromboloAuthProviderElement)
68
68
 
69
- /**
70
- * Signing in again after a timeout closes its modal twice.
71
- *
72
- * `umb-app-auth-modal` submits when the session reports itself authorised, and
73
- * `umb-auth-view` calls the same submit as its `onSuccess` once
74
- * `makeAuthorizationRequest` returns. Whichever runs first closes the modal and
75
- * destroys its value state, so the second's `value = { success: true }` throws
76
- * `_subject is undefined` — and the view shows that as a sign-in error, though
77
- * the editor is signed in. The second assignment has nothing left to say, so it
78
- * is dropped. Patched on the element's prototype, as `tsx-editors.js` patches
79
- * upstream, rather than in the vendored bundle.
80
- */
81
- async function guardTimedOutSignIn() {
82
- const Modal = await customElements.whenDefined('umb-app-auth-modal')
83
- let descriptor
84
- for (let proto = Modal.prototype; proto && !descriptor; proto = Object.getPrototypeOf(proto))
85
- descriptor = Object.getOwnPropertyDescriptor(proto, 'value')
86
- if (!descriptor?.set) return
87
- const { get, set } = descriptor
88
- Object.defineProperty(Modal.prototype, 'value', {
89
- configurable: true,
90
- get,
91
- set(value) {
92
- if (this.__cromboloSubmitted) return
93
- set.call(this, value)
94
- this.__cromboloSubmitted = true
95
- },
96
- })
97
- }
98
-
99
69
  export const onInit = (_host, extensionRegistry) => {
100
- void guardTimedOutSignIn()
101
70
  extensionRegistry.unregister(VENDORED)
102
71
  extensionRegistry.register({
103
72
  type: 'authProvider',
@@ -19,6 +19,8 @@
19
19
  --crombolo-night-alt: #342922;
20
20
  --crombolo-night-header: #2b1d15;
21
21
  --crombolo-cocoa-deep: #25160e;
22
+ /* Terracotta light enough to read as text on the night surfaces (7.7:1 and up). */
23
+ --crombolo-terracotta-light: #e8a688;
22
24
 
23
25
  --uui-color-background: var(--crombolo-night);
24
26
  --uui-color-surface: var(--crombolo-night-surface);
@@ -27,7 +29,7 @@
27
29
  --uui-color-text: var(--crombolo-ink);
28
30
  --uui-color-text-alt: var(--crombolo-ink-dimmed);
29
31
  --uui-color-interactive: var(--crombolo-ink);
30
- --uui-color-interactive-emphasis: var(--crombolo-orange-light);
32
+ --uui-color-interactive-emphasis: var(--crombolo-terracotta-light);
31
33
 
32
34
  /* The accent is light, so what sits on it is dark, as in the light mode. */
33
35
  --uui-color-default: var(--crombolo-orange);
@@ -38,16 +40,28 @@
38
40
  --uui-color-selected-emphasis: var(--crombolo-orange-light);
39
41
  --uui-color-selected-standalone: var(--crombolo-orange);
40
42
  --uui-color-selected-contrast: var(--crombolo-cocoa-deep);
41
- --uui-color-current: var(--crombolo-orange);
43
+ /* "Current" marks the active tab; the tree's current item has its own tokens (237). */
44
+ --uui-color-current: var(--crombolo-terracotta-light);
42
45
  --uui-color-current-emphasis: var(--crombolo-orange-light);
43
46
  --uui-color-current-contrast: var(--crombolo-cocoa-deep);
47
+ --uui-menu-item-background-color-active: var(--crombolo-night-alt);
48
+ --uui-menu-item-background-color-active-hover: #3b2e26;
49
+ --uui-menu-item-color-active: var(--crombolo-terracotta-light);
44
50
  --uui-color-focus: var(--crombolo-orange);
45
51
 
46
- /* A dark header with cream text; the active section's marker is the accent. */
47
- --uui-color-header-surface: var(--crombolo-night-header);
52
+ /*
53
+ * The header is a panel like the cards, with a hairline under it; the current
54
+ * section's name and marker are terracotta, as in light (story 237).
55
+ */
56
+ --uui-color-header-surface: var(--crombolo-night-surface);
48
57
  --uui-color-header-contrast: rgb(246 237 228 / 80%);
49
58
  --uui-color-header-contrast-emphasis: var(--crombolo-ink);
50
- --crombolo-header-current: var(--crombolo-orange);
59
+ --crombolo-header-current: var(--crombolo-terracotta-light);
60
+ --crombolo-header-current-text: var(--crombolo-terracotta-light);
61
+ --crombolo-header-line: #3b2e25;
62
+ --crombolo-section-sidebar-background: var(--crombolo-night-surface);
63
+ --crombolo-card-shadow: none;
64
+ --crombolo-terracotta-tint: var(--crombolo-night-alt);
51
65
 
52
66
  /* The SEO view's search-result preview, in Google's dark-mode link blue. */
53
67
  --crombolo-snippet-title: #8ab4f8;
@@ -1,5 +1,6 @@
1
1
  /*
2
- * Crombolo's colour scheme: white surfaces, terracotta accents taken from the logo.
2
+ * Crombolo's colour scheme: white cards on a cream ground, a light header, and one
3
+ * deep terracotta accent taken from the logo (story 237).
3
4
  *
4
5
  * Loaded by both shells immediately after the vendored `light.css`, rather than
5
6
  * registered as a `theme` extension, so it reaches the login page too — the
@@ -17,6 +18,14 @@
17
18
  --crombolo-orange-deep: #cb6f48;
18
19
  /* The darkest of the three, and the only one that clears AA as body text. */
19
20
  --crombolo-orange-text: #974b2b;
21
+ /*
22
+ * The accent: the logo's terracotta, deepened until white on it clears AA
23
+ * (5.3:1). It fills buttons and the selected item, and is the links' colour.
24
+ */
25
+ --crombolo-terracotta: #ad4f2c;
26
+ --crombolo-terracotta-hover: #9b4526;
27
+ /* A pale tint of it, behind the current tree item and the Overview's labels. */
28
+ --crombolo-terracotta-tint: #fbeee7;
20
29
  --crombolo-cocoa: #54321f;
21
30
  --crombolo-cream: #fff7ea;
22
31
 
@@ -24,8 +33,8 @@
24
33
  * `light.css` routes default, selected and interactive-emphasis through the
25
34
  * violet-blue palette, so swapping the palette carries all of them at once.
26
35
  */
27
- --uui-palette-violet-blue: var(--crombolo-orange);
28
- --uui-palette-violet-blue-light: var(--crombolo-orange-light);
36
+ --uui-palette-violet-blue: var(--crombolo-terracotta);
37
+ --uui-palette-violet-blue-light: var(--crombolo-terracotta-hover);
29
38
  --uui-palette-violet-blue-dark: var(--crombolo-orange-text);
30
39
  --uui-palette-violet-blue-dimmed: #bd8b75;
31
40
 
@@ -39,9 +48,12 @@
39
48
  --uui-palette-space-cadet-dark: #25160e;
40
49
  --uui-palette-space-cadet-dimmed: #8a6c5c;
41
50
 
42
- /* The "current item" marker, warmed from pink to the same orange family. */
43
- --uui-palette-spanish-pink: #fdebd4;
44
- --uui-palette-spanish-pink-light: #fef4e7;
51
+ /*
52
+ * "Current": the accent, which is what marks the active tab. The tree's
53
+ * current item takes its own tokens below, so it can be a tint instead.
54
+ */
55
+ --uui-palette-spanish-pink: var(--crombolo-terracotta);
56
+ --uui-palette-spanish-pink-light: var(--crombolo-terracotta-hover);
45
57
  --uui-palette-spanish-pink-dark: #ebc7b8;
46
58
  --uui-palette-spanish-pink-dimmed: #f3e3ce;
47
59
 
@@ -56,20 +68,31 @@
56
68
  --uui-palette-white-dark: #fffaf2;
57
69
  --uui-palette-white-dimmed: #f4ede1;
58
70
 
71
+ /* White on the deep accent, 5.3:1. */
72
+ --uui-color-default-contrast: #fff;
73
+ --uui-color-selected-contrast: #fff;
74
+ --uui-color-current-contrast: #fff;
75
+ /* The tree's current item: a pale tint, its text and icon in the accent (4.7:1). */
76
+ --uui-menu-item-background-color-active: var(--crombolo-terracotta-tint);
77
+ --uui-menu-item-background-color-active-hover: #faeae1;
78
+ --uui-menu-item-color-active: var(--crombolo-terracotta);
79
+
59
80
  /*
60
- * The accent is light, so what sits on it has to be dark. Stock `light.css`
61
- * puts white on the accent, which against this orange is about 2.4:1; cocoa
62
- * on the same fill is 4.7:1.
81
+ * A white header with a hairline under it. The current section's name and
82
+ * marker are the accent; the fork reads the line and the name's colour from
83
+ * these tokens.
63
84
  */
64
- --uui-color-default-contrast: var(--crombolo-cocoa);
65
- --uui-color-selected-contrast: var(--crombolo-cocoa);
66
-
67
- /* An orange header bar, with its own text dark for the same reason. */
68
- --uui-color-header-surface: var(--crombolo-orange);
85
+ --uui-color-header-surface: #fff;
69
86
  --uui-color-header-contrast: rgb(84 50 31 / 80%);
70
87
  --uui-color-header-contrast-emphasis: var(--crombolo-cocoa);
71
- /* The active section's marker, dark so it stands out from the white submenu below. */
72
- --crombolo-header-current: var(--crombolo-orange-text);
88
+ --crombolo-header-current: var(--crombolo-terracotta);
89
+ --crombolo-header-current-text: var(--crombolo-terracotta);
90
+ --crombolo-header-line: #efe3d6;
91
+
92
+ /* The sidebar is a white panel, like the cards, beside the cream page. */
93
+ --crombolo-section-sidebar-background: #fff;
94
+ /* Crombolo's own cards (the Overview, Settings) stand off the page; Umbraco's stay flat. */
95
+ --crombolo-card-shadow: 0 1px 2px rgb(84 50 31 / 6%), 0 10px 28px -18px rgb(84 50 31 / 30%);
73
96
 
74
97
  /* Pure white panels on a warm off-white page, so cards still separate. */
75
98
  --uui-color-background: var(--crombolo-cream);
@@ -79,9 +102,8 @@
79
102
 
80
103
  --uui-color-focus: var(--crombolo-orange-deep);
81
104
 
82
- /* Hover text on an unfilled interactive element: the palette's light orange
83
- would be 2:1 here, so it takes the text-weight orange instead. */
84
- --uui-color-interactive-emphasis: var(--crombolo-orange-text);
105
+ /* Hover text and links: the accent itself, 5.0:1 on cream and 5.3:1 on white. */
106
+ --uui-color-interactive-emphasis: var(--crombolo-terracotta);
85
107
 
86
108
  --uui-color-border: #e7dcd2;
87
109
  --uui-color-border-standalone: #cdbcac;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * A trail of links to where a page sits (story 234): UUI's breadcrumbs, as
3
+ * Umbraco's own editors show them, given `items` of `{ label, href? }`. The last
4
+ * item is the page itself; an item without `href` is not a link.
5
+ */
6
+ import { html, ifDefined } from '@umbraco-cms/backoffice/external/lit'
7
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
8
+
9
+ export class CromboloBreadcrumbElement extends UmbLitElement {
10
+ static properties = { items: { attribute: false } }
11
+
12
+ constructor() {
13
+ super()
14
+ this.items = []
15
+ }
16
+
17
+ render() {
18
+ return html`<nav aria-label="Breadcrumb">
19
+ <uui-breadcrumbs>
20
+ ${this.items.map(
21
+ (item) =>
22
+ html`<uui-breadcrumb-item href=${ifDefined(item.href)}>${item.label}</uui-breadcrumb-item>`,
23
+ )}
24
+ </uui-breadcrumbs>
25
+ </nav>`
26
+ }
27
+ }
28
+
29
+ customElements.define('crombolo-breadcrumb', CromboloBreadcrumbElement)
@@ -14,7 +14,8 @@
14
14
  * by those allowed to install packages: each finding offers the answers its
15
15
  * kind allows, and the import runs once nothing is outstanding.
16
16
  */
17
- import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
17
+ import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
18
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
18
19
  import { downloadFile } from './download.js'
19
20
  import { answersUrl, fetchReport, transferAction } from './report-client.js'
20
21
 
@@ -32,7 +33,7 @@ const ANSWERED_LABEL = {
32
33
  skip: 'is left out',
33
34
  }
34
35
 
35
- export default class CromboloChangesDashboardElement extends LitElement {
36
+ export default class CromboloChangesDashboardElement extends UmbLitElement {
36
37
  static properties = {
37
38
  _report: { state: true },
38
39
  _error: { state: true },
@@ -92,37 +92,27 @@ export const CONFLICT_BANNER = {
92
92
  }
93
93
 
94
94
  /**
95
- * Wraps a workspace's `load` and `reload` so the tracker knows the page's read
96
- * is the editor's own. Patched on the shared base class, for documents only.
95
+ * What the fork's `onEntityLoad` seam calls as an editor reads its entity: for a
96
+ * page, the tracker knows the read is the editor's own until it ends.
97
97
  */
98
- export function watchLoads(base, revisions = tracker) {
99
- for (const method of ['load', 'reload']) {
100
- const original = base.prototype[method]
101
- if (typeof original !== 'function' || original.cromboloRevisions) continue
102
- const wrapped = async function (unique) {
103
- const key = String(unique ?? this.getUnique?.() ?? '').toLowerCase()
104
- if (this.getEntityType?.() !== 'document' || !key) return original.call(this, unique)
105
- revisions.beginLoad(key)
106
- try {
107
- return await original.call(this, unique)
108
- } finally {
109
- revisions.endLoad(key)
110
- }
111
- }
112
- wrapped.cromboloRevisions = true
113
- base.prototype[method] = wrapped
98
+ export function entityLoads(revisions = tracker) {
99
+ return (entityType, unique) => {
100
+ const key = String(unique ?? '').toLowerCase()
101
+ if (entityType !== 'document' || !key) return undefined
102
+ revisions.beginLoad(key)
103
+ return () => revisions.endLoad(key)
114
104
  }
115
105
  }
116
106
 
117
107
  export const onInit = async (_host, extensionRegistry) => {
118
- const [{ umbHttpClient }, { UmbEntityDetailWorkspaceContextBase }] = await Promise.all([
108
+ const [{ umbHttpClient }, { umbCromboloHooks }] = await Promise.all([
119
109
  import('@umbraco-cms/backoffice/http-client'),
120
- import('@umbraco-cms/backoffice/workspace'),
110
+ import('@umbraco-cms/backoffice/extension-registry'),
121
111
  ])
122
112
  umbHttpClient.interceptors.request.use((request) => tracker.onRequest(request))
123
113
  umbHttpClient.interceptors.response.use((response, request) =>
124
114
  tracker.onResponse(response, request),
125
115
  )
126
- watchLoads(UmbEntityDetailWorkspaceContextBase)
116
+ umbCromboloHooks.onEntityLoad = entityLoads()
127
117
  extensionRegistry.register(CONFLICT_BANNER)
128
118
  }
@@ -3,7 +3,8 @@
3
3
  * bundles' jobs, newest first, filtered by state, each with how far it got and
4
4
  * why it failed, and a failed one run again by hand.
5
5
  */
6
- import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
6
+ import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
7
+ import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
7
8
 
8
9
  const PAGE_SIZE = 50
9
10
 
@@ -45,7 +46,7 @@ function progressOf(job) {
45
46
  return p.note ? `${count}: ${p.note}` : count
46
47
  }
47
48
 
48
- export default class CromboloJobsDashboardElement extends LitElement {
49
+ export default class CromboloJobsDashboardElement extends UmbLitElement {
49
50
  static properties = {
50
51
  _items: { state: true },
51
52
  _total: { state: true },
@@ -2,7 +2,7 @@
2
2
  "$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
3
3
  "name": "Crombolo Localizations",
4
4
  "id": "Crombolo.Localizations",
5
- "version": "0.41.1",
5
+ "version": "0.43.1",
6
6
  "allowPublicAccess": true,
7
7
  "extensions": [
8
8
  {
@@ -1,17 +1,10 @@
1
1
  /**
2
2
  * Umbraco's notifications dialog, on a site that cannot send e-mail (story
3
3
  * 045): a banner saying so, and every toggle disabled, rather than choices
4
- * saved for e-mails that never come.
5
- *
6
- * The dialog is not an extension point and its class is not exported, so it is
7
- * patched rather than replaced, as the log viewer's menu is: once the element
8
- * is defined, each update disables its toggles and Save and puts the banner
9
- * above them. `tests/notifications-dialog.test.ts` pins the vendored dialog
10
- * this relies on, so a re-vendor that moves it fails the suite rather than the
11
- * editor. The server refuses a new subscription regardless.
4
+ * saved for e-mails that never come. The dialog asks the fork's
5
+ * `notificationsUnavailable` seam, which this answers. The server refuses a new
6
+ * subscription regardless.
12
7
  */
13
- const TAG = 'umb-document-notifications-modal'
14
- export const BANNER_CLASS = 'crombolo-notifications-unavailable'
15
8
  export const UNAVAILABLE =
16
9
  "This site can't send e-mail yet, so it can't tell you when this page changes. Ask an administrator to set up e-mail, then come back to choose what to hear about."
17
10
 
@@ -31,32 +24,12 @@ export function canSendNotifications(fetcher = fetch) {
31
24
  return answer
32
25
  }
33
26
 
34
- /** Disables the dialog's choices and says why. Safe to call on every update. */
35
- export function markUnavailable(root, message = UNAVAILABLE) {
36
- for (const toggle of root.querySelectorAll('uui-toggle')) toggle.disabled = true
37
- for (const button of root.querySelectorAll('uui-button[color="positive"]')) button.disabled = true
38
- const box = root.querySelector('uui-box')
39
- if (!box || box.querySelector(`.${BANNER_CLASS}`)) return
40
- const banner = box.ownerDocument.createElement('p')
41
- banner.className = BANNER_CLASS
42
- banner.setAttribute('role', 'status')
43
- banner.setAttribute(
44
- 'style',
45
- 'margin: 0 0 var(--uui-size-space-4); color: var(--uui-color-text-alt);',
46
- )
47
- banner.textContent = message
48
- box.prepend(banner)
27
+ /** Why the dialog's choices are off, or undefined when this site can send them. */
28
+ export async function notificationsUnavailable(fetcher = fetch) {
29
+ return (await canSendNotifications(fetcher)) ? undefined : UNAVAILABLE
49
30
  }
50
31
 
51
32
  export const onInit = async () => {
52
- // The dialog is loaded the first time someone opens it.
53
- const element = await customElements.whenDefined(TAG)
54
- const prototype = element.prototype
55
- const original = prototype.updated
56
- prototype.updated = function patched(changed) {
57
- original?.call(this, changed)
58
- void canSendNotifications().then((ok) => {
59
- if (!ok && this.renderRoot) markUnavailable(this.renderRoot)
60
- })
61
- }
33
+ const { umbCromboloHooks } = await import('@umbraco-cms/backoffice/extension-registry')
34
+ umbCromboloHooks.notificationsUnavailable = () => notificationsUnavailable()
62
35
  }