@crombolo/backoffice-host 0.56.0 → 0.58.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/package.json +3 -3
- package/plugin/app-preview/umbraco-package.json +1 -1
- package/plugin/branding/theme-dark.css +4 -2
- package/plugin/branding/theme.css +5 -2
- package/plugin/bundle-editor-sections.js +5 -0
- package/plugin/bundle-editor.js +1 -1
- package/plugin/bundles-client.js +14 -4
- package/plugin/bundles-created-overview.js +30 -2
- package/plugin/bundles-installed.js +199 -13
- package/plugin/bundles-marketplace.js +82 -30
- package/plugin/bundles-signature-words.js +3 -0
- package/plugin/bundles-tool.js +2 -2
- package/plugin/changes-dashboard.js +6 -0
- package/plugin/ci-access-words.js +1 -1
- package/plugin/ci-access.js +27 -3
- package/plugin/localizations/umbraco-package.json +1 -1
- package/plugin/search-tool.js +88 -0
- package/plugin/seo/client.js +4 -0
- package/plugin/seo/document-view.js +244 -25
- package/plugin/seo/umbraco-package.json +5 -4
- package/plugin/seo/value-input.js +101 -0
- package/plugin/seo/value-model.js +36 -0
- package/plugin/settings-cards.js +18 -17
- package/plugin/settings-section.js +36 -4
- package/plugin/settings-title.js +46 -0
- package/plugin/sign-in/umbraco-package.json +1 -1
- package/plugin/template-picker-modal.js +1 -0
- package/plugin/template-picker-model.js +6 -2
- package/plugin/trusted-signers.js +374 -0
- package/plugin/umbraco-package.json +22 -3
- package/src/bundle-package.ts +98 -13
- package/src/bundle-permissions.ts +230 -18
- package/src/content-security.ts +78 -0
- package/src/extensions.ts +4 -1
- package/src/index.ts +1 -0
|
@@ -5,34 +5,55 @@
|
|
|
5
5
|
* The values come from the server, which works them out with the same code the
|
|
6
6
|
* page's head uses, so the preview cannot disagree with what is served. It
|
|
7
7
|
* reads the last saved version, so an editor sees a change once it is saved.
|
|
8
|
+
*
|
|
9
|
+
* An administrator may set where each value comes from (story 317), for this
|
|
10
|
+
* page, in its own field, or for every page of its type.
|
|
8
11
|
*/
|
|
9
12
|
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document'
|
|
10
13
|
import { css, html, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
11
14
|
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element'
|
|
12
15
|
import { UMB_PROPERTY_DATASET_CONTEXT } from '@umbraco-cms/backoffice/property'
|
|
13
|
-
import {
|
|
16
|
+
import { UmbVariantId } from '@umbraco-cms/backoffice/variant'
|
|
17
|
+
import { readPreview, saveTypeValues } from './client.js'
|
|
18
|
+
import './value-input.js'
|
|
14
19
|
|
|
15
20
|
const SOURCES = {
|
|
16
21
|
page: 'From this page',
|
|
22
|
+
type: "This type's setting",
|
|
23
|
+
metadata: 'From the page design',
|
|
17
24
|
template: 'From the page design',
|
|
18
25
|
site: 'Site setting',
|
|
19
26
|
name: 'Page name',
|
|
20
|
-
none: 'Not
|
|
27
|
+
none: 'Not configured',
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Each value, the page's own field for it, and what it is called. */
|
|
31
|
+
const FIELDS = {
|
|
32
|
+
title: { label: 'Title', alias: 'seoTitle' },
|
|
33
|
+
description: { label: 'Description', alias: 'seoDescription' },
|
|
34
|
+
image: { label: 'Sharing image', alias: 'seoImage' },
|
|
35
|
+
canonical: { label: 'Preferred address', alias: 'seoCanonical' },
|
|
21
36
|
}
|
|
22
37
|
|
|
23
38
|
export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
24
39
|
static properties = {
|
|
25
40
|
_preview: { state: true },
|
|
26
41
|
_error: { state: true },
|
|
42
|
+
_editing: { state: true },
|
|
43
|
+
_draft: { state: true },
|
|
44
|
+
_saving: { state: true },
|
|
45
|
+
_problem: { state: true },
|
|
27
46
|
}
|
|
28
47
|
|
|
29
48
|
#unique = undefined
|
|
30
49
|
#culture = null
|
|
50
|
+
#workspace = undefined
|
|
31
51
|
|
|
32
52
|
constructor() {
|
|
33
53
|
super()
|
|
34
54
|
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
|
|
35
55
|
if (!context) return
|
|
56
|
+
this.#workspace = context
|
|
36
57
|
this.observe(context.unique, (unique) => {
|
|
37
58
|
this.#unique = unique
|
|
38
59
|
this.#load()
|
|
@@ -54,12 +75,176 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
54
75
|
}
|
|
55
76
|
}
|
|
56
77
|
|
|
57
|
-
#row(
|
|
78
|
+
#row(field, item, render = (value) => value) {
|
|
79
|
+
const canEdit = this._preview?.mapping?.canEdit
|
|
58
80
|
return html`
|
|
59
81
|
<tr>
|
|
60
|
-
<th>${label}</th>
|
|
61
|
-
<td>${item.value ? render(item.value) :
|
|
62
|
-
<td
|
|
82
|
+
<th>${FIELDS[field].label}</th>
|
|
83
|
+
<td>${item.value ? render(item.value) : '-'}</td>
|
|
84
|
+
<td>
|
|
85
|
+
${
|
|
86
|
+
item.source === 'none'
|
|
87
|
+
? html`<span class="unset"><uui-icon name="icon-alert"></uui-icon>Not configured</span>`
|
|
88
|
+
: html`<uui-tag look="secondary">${SOURCES[item.source] ?? item.source}</uui-tag>`
|
|
89
|
+
}
|
|
90
|
+
${
|
|
91
|
+
item.over === 'type'
|
|
92
|
+
? html`<div class="note">The page design overrides this type's setting.</div>`
|
|
93
|
+
: nothing
|
|
94
|
+
}
|
|
95
|
+
</td>
|
|
96
|
+
${
|
|
97
|
+
canEdit
|
|
98
|
+
? html`<td class="action">
|
|
99
|
+
<uui-button
|
|
100
|
+
look="secondary"
|
|
101
|
+
compact
|
|
102
|
+
label="Change where the ${FIELDS[field].label.toLowerCase()} comes from"
|
|
103
|
+
@click=${() => this.#edit(field)}
|
|
104
|
+
>Change</uui-button>
|
|
105
|
+
</td>`
|
|
106
|
+
: nothing
|
|
107
|
+
}
|
|
108
|
+
</tr>
|
|
109
|
+
${this._editing === field ? this.#editor(field) : nothing}
|
|
110
|
+
`
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** The variant a page's own field is set in: its culture's, when the field varies. */
|
|
114
|
+
async #variantFor(alias) {
|
|
115
|
+
const property = await this.#workspace?.structure?.getPropertyStructureByAlias?.(alias)
|
|
116
|
+
return property?.variesByCulture && this.#culture
|
|
117
|
+
? UmbVariantId.CreateFromPartial({ culture: this.#culture })
|
|
118
|
+
: UmbVariantId.CreateInvariant()
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async #edit(field) {
|
|
122
|
+
const { alias } = FIELDS[field]
|
|
123
|
+
const typeValue = this._preview?.mapping?.type?.seo?.[field] ?? ''
|
|
124
|
+
const own =
|
|
125
|
+
field === 'image'
|
|
126
|
+
? ''
|
|
127
|
+
: this.#workspace?.getPropertyValue?.(alias, await this.#variantFor(alias))
|
|
128
|
+
this._draft = typeof own === 'string' && own.trim() ? own : typeValue
|
|
129
|
+
this._problem = undefined
|
|
130
|
+
this._editing = field
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async #saveForPage(field) {
|
|
134
|
+
const { alias } = FIELDS[field]
|
|
135
|
+
this._saving = true
|
|
136
|
+
try {
|
|
137
|
+
await this.#workspace.setPropertyValue(
|
|
138
|
+
alias,
|
|
139
|
+
this._draft ?? '',
|
|
140
|
+
await this.#variantFor(alias),
|
|
141
|
+
)
|
|
142
|
+
await this.#workspace.requestSave()
|
|
143
|
+
this._editing = undefined
|
|
144
|
+
await this.#load()
|
|
145
|
+
} catch (error) {
|
|
146
|
+
this._problem = error.message
|
|
147
|
+
} finally {
|
|
148
|
+
this._saving = false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async #saveForType(field) {
|
|
153
|
+
const type = this._preview.mapping.type
|
|
154
|
+
this._saving = true
|
|
155
|
+
try {
|
|
156
|
+
await saveTypeValues(type.alias, { ...type.seo, [field]: this._draft ?? '' })
|
|
157
|
+
this._editing = undefined
|
|
158
|
+
await this.#load()
|
|
159
|
+
} catch (error) {
|
|
160
|
+
this._problem = error.message
|
|
161
|
+
} finally {
|
|
162
|
+
this._saving = false
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
#editor(field) {
|
|
167
|
+
const { mapping } = this._preview
|
|
168
|
+
const type = mapping.type
|
|
169
|
+
const span = mapping.canEdit ? 4 : 3
|
|
170
|
+
const pages = `${type.pages} ${type.pages === 1 ? 'page' : 'pages'}`
|
|
171
|
+
return html`
|
|
172
|
+
<tr class="editing">
|
|
173
|
+
<td colspan=${span}>
|
|
174
|
+
${
|
|
175
|
+
field === 'image'
|
|
176
|
+
? html`<uui-select
|
|
177
|
+
label="Sharing image"
|
|
178
|
+
.options=${[
|
|
179
|
+
{ name: 'None', value: '', selected: !this._draft },
|
|
180
|
+
...mapping.properties
|
|
181
|
+
.filter((p) => p.mediaPicker)
|
|
182
|
+
.map((p) => ({
|
|
183
|
+
name: p.name,
|
|
184
|
+
value: p.alias,
|
|
185
|
+
selected: this._draft === p.alias,
|
|
186
|
+
})),
|
|
187
|
+
]}
|
|
188
|
+
@change=${(event) => {
|
|
189
|
+
this._draft = event.target.value
|
|
190
|
+
}}
|
|
191
|
+
></uui-select>
|
|
192
|
+
<p class="note">
|
|
193
|
+
The first image the chosen picker holds. A page's own sharing image is picked
|
|
194
|
+
in its Search & sharing fields.
|
|
195
|
+
</p>`
|
|
196
|
+
: html`<crombolo-seo-value-input
|
|
197
|
+
label=${FIELDS[field].label}
|
|
198
|
+
.value=${this._draft ?? ''}
|
|
199
|
+
.properties=${mapping.properties.map(({ alias, name }) => ({ alias, name }))}
|
|
200
|
+
@change=${(event) => {
|
|
201
|
+
this._draft = event.target.value
|
|
202
|
+
}}
|
|
203
|
+
></crombolo-seo-value-input>
|
|
204
|
+
<p class="note">
|
|
205
|
+
Type text, <code>{</code> for one of this page's values, or <code>{#</code> for a
|
|
206
|
+
dictionary word.
|
|
207
|
+
</p>`
|
|
208
|
+
}
|
|
209
|
+
${this._problem ? html`<p class="warning">${this._problem}</p>` : nothing}
|
|
210
|
+
<div class="choices">
|
|
211
|
+
${
|
|
212
|
+
field === 'image'
|
|
213
|
+
? nothing
|
|
214
|
+
: html`<uui-button
|
|
215
|
+
look="primary"
|
|
216
|
+
label="This page only"
|
|
217
|
+
?disabled=${this._saving}
|
|
218
|
+
@click=${() => this.#saveForPage(field)}
|
|
219
|
+
></uui-button>`
|
|
220
|
+
}
|
|
221
|
+
${
|
|
222
|
+
type.editable
|
|
223
|
+
? html`<uui-button
|
|
224
|
+
look=${field === 'image' ? 'primary' : 'secondary'}
|
|
225
|
+
label="Every ${type.name} page (${pages})"
|
|
226
|
+
?disabled=${this._saving}
|
|
227
|
+
@click=${() => this.#saveForType(field)}
|
|
228
|
+
></uui-button>`
|
|
229
|
+
: nothing
|
|
230
|
+
}
|
|
231
|
+
<uui-button
|
|
232
|
+
look="default"
|
|
233
|
+
label="Cancel"
|
|
234
|
+
@click=${() => {
|
|
235
|
+
this._editing = undefined
|
|
236
|
+
}}
|
|
237
|
+
></uui-button>
|
|
238
|
+
</div>
|
|
239
|
+
${
|
|
240
|
+
type.editable
|
|
241
|
+
? nothing
|
|
242
|
+
: html`<p class="note">
|
|
243
|
+
Every ${type.name} page's setting is kept with the site's files here, so it
|
|
244
|
+
changes with a deploy.
|
|
245
|
+
</p>`
|
|
246
|
+
}
|
|
247
|
+
</td>
|
|
63
248
|
</tr>
|
|
64
249
|
`
|
|
65
250
|
}
|
|
@@ -72,11 +257,11 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
72
257
|
return html`
|
|
73
258
|
<uui-box headline="In search results">
|
|
74
259
|
<div class="snippet">
|
|
75
|
-
|
|
76
|
-
<div class="
|
|
77
|
-
|
|
78
|
-
${snippet.description || html`<em>Search engines will pick some text from the page.</em>`}
|
|
260
|
+
${snippet.name ? html`<div class="field"><span class="label">Name:</span> ${snippet.name}</div>` : nothing}
|
|
261
|
+
<div class="field url">
|
|
262
|
+
<span class="label">URL:</span> ${snippet.url || 'This page has no address yet'}
|
|
79
263
|
</div>
|
|
264
|
+
${snippet.description ? html`<div class="description">${snippet.description}</div>` : nothing}
|
|
80
265
|
</div>
|
|
81
266
|
${
|
|
82
267
|
meta.noindex.value
|
|
@@ -89,22 +274,33 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
89
274
|
</p>`
|
|
90
275
|
: nothing
|
|
91
276
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
277
|
+
${
|
|
278
|
+
preview.differs === 'unpublished'
|
|
279
|
+
? html`<p class="note">This page is not published yet, so search engines do not see it.</p>`
|
|
280
|
+
: preview.differs === 'changed'
|
|
281
|
+
? html`<p class="note">Includes saved changes that are not published yet.</p>`
|
|
282
|
+
: nothing
|
|
283
|
+
}
|
|
284
|
+
<h4>Searchable property values</h4>
|
|
97
285
|
<table>
|
|
98
|
-
${this.#row('
|
|
99
|
-
${this.#row('
|
|
100
|
-
${this.#row('
|
|
101
|
-
${this.#row('
|
|
286
|
+
${this.#row('title', meta.title)}
|
|
287
|
+
${this.#row('description', meta.description)}
|
|
288
|
+
${this.#row('image', meta.image, (src) => html`<img src=${src} alt="" />`)}
|
|
289
|
+
${this.#row('canonical', meta.canonical)}
|
|
102
290
|
</table>
|
|
103
291
|
</uui-box>
|
|
104
292
|
`
|
|
105
293
|
}
|
|
106
294
|
|
|
107
295
|
static styles = css`
|
|
296
|
+
/* A value nothing sets: a warning, so it is put right. */
|
|
297
|
+
.unset {
|
|
298
|
+
display: inline-flex;
|
|
299
|
+
align-items: center;
|
|
300
|
+
gap: var(--uui-size-space-1);
|
|
301
|
+
color: var(--uui-color-warning-standalone, var(--uui-color-warning-emphasis));
|
|
302
|
+
font-weight: 600;
|
|
303
|
+
}
|
|
108
304
|
:host {
|
|
109
305
|
display: block;
|
|
110
306
|
padding: var(--uui-size-layout-1);
|
|
@@ -116,17 +312,22 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
116
312
|
max-width: 600px;
|
|
117
313
|
font-family: arial, sans-serif;
|
|
118
314
|
}
|
|
315
|
+
/* The page's name and address, each on a line with its label. */
|
|
316
|
+
.snippet .field {
|
|
317
|
+
font-size: 14px;
|
|
318
|
+
overflow-wrap: anywhere;
|
|
319
|
+
}
|
|
320
|
+
.snippet .field .label {
|
|
321
|
+
display: inline-block;
|
|
322
|
+
min-width: 3.5em;
|
|
323
|
+
color: var(--uui-color-text-alt);
|
|
324
|
+
font-weight: 600;
|
|
325
|
+
}
|
|
119
326
|
.snippet .url {
|
|
120
327
|
color: var(--uui-color-text-alt);
|
|
121
328
|
font-size: 14px;
|
|
122
329
|
overflow-wrap: anywhere;
|
|
123
330
|
}
|
|
124
|
-
.snippet .title {
|
|
125
|
-
/* A search result's link blue: Google's own, light and dark. */
|
|
126
|
-
color: var(--crombolo-snippet-title, #1a0dab);
|
|
127
|
-
font-size: 20px;
|
|
128
|
-
margin: 4px 0;
|
|
129
|
-
}
|
|
130
331
|
.snippet .description {
|
|
131
332
|
color: var(--uui-color-text);
|
|
132
333
|
font-size: 14px;
|
|
@@ -134,6 +335,11 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
134
335
|
.warning {
|
|
135
336
|
color: var(--uui-color-danger);
|
|
136
337
|
}
|
|
338
|
+
h4 {
|
|
339
|
+
margin: var(--uui-size-layout-1) 0 var(--uui-size-space-3);
|
|
340
|
+
padding-top: var(--uui-size-space-5);
|
|
341
|
+
border-top: 1px solid var(--uui-color-divider);
|
|
342
|
+
}
|
|
137
343
|
.note {
|
|
138
344
|
color: var(--uui-color-text-alt);
|
|
139
345
|
font-size: 12px;
|
|
@@ -156,6 +362,19 @@ export default class CromboloSeoDocumentViewElement extends UmbLitElement {
|
|
|
156
362
|
max-width: 240px;
|
|
157
363
|
max-height: 140px;
|
|
158
364
|
}
|
|
365
|
+
td.action {
|
|
366
|
+
width: 1%;
|
|
367
|
+
white-space: nowrap;
|
|
368
|
+
}
|
|
369
|
+
tr.editing td {
|
|
370
|
+
background: var(--uui-color-surface-alt);
|
|
371
|
+
}
|
|
372
|
+
.choices {
|
|
373
|
+
display: flex;
|
|
374
|
+
flex-wrap: wrap;
|
|
375
|
+
gap: var(--uui-size-space-2);
|
|
376
|
+
margin-top: var(--uui-size-space-3);
|
|
377
|
+
}
|
|
159
378
|
`
|
|
160
379
|
}
|
|
161
380
|
|
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
"$schema": "../../../backoffice-dist/dist/umbraco-package-schema.json",
|
|
3
3
|
"name": "Crombolo Search & sharing",
|
|
4
4
|
"id": "Crombolo.Seo",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.58.0",
|
|
6
6
|
"allowPublicAccess": false,
|
|
7
7
|
"extensions": [
|
|
8
8
|
{
|
|
9
9
|
"type": "dashboard",
|
|
10
10
|
"alias": "Crombolo.Dashboard.Seo",
|
|
11
|
-
"name": "Crombolo Search
|
|
12
|
-
"element": "/crombolo-plugin/
|
|
11
|
+
"name": "Crombolo Search Dashboard",
|
|
12
|
+
"element": "/crombolo-plugin/search-tool.js",
|
|
13
|
+
"overwrites": ["Umb.Dashboard.ExamineManagement"],
|
|
13
14
|
"weight": 10,
|
|
14
15
|
"meta": {
|
|
15
|
-
"label": "Search
|
|
16
|
+
"label": "Search",
|
|
16
17
|
"pathname": "search-and-sharing"
|
|
17
18
|
},
|
|
18
19
|
"conditions": [
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A search and sharing value's box (story 317): fixed text, `{alias}` for a
|
|
3
|
+
* property of the page, suggested after `{`, and `{#key}` for a dictionary item,
|
|
4
|
+
* suggested after `{#`. It sends `change`, with `value`, as `uui-input` does.
|
|
5
|
+
*/
|
|
6
|
+
import { css, html, LitElement, nothing } from '@umbraco-cms/backoffice/external/lit'
|
|
7
|
+
import '../form-word-input.js'
|
|
8
|
+
import { insertProperty, propertySuggestions } from './value-model.js'
|
|
9
|
+
|
|
10
|
+
export default class CromboloSeoValueInputElement extends LitElement {
|
|
11
|
+
static properties = {
|
|
12
|
+
label: { type: String },
|
|
13
|
+
value: { type: String },
|
|
14
|
+
/** The page type's properties: `{ alias, name }`. */
|
|
15
|
+
properties: { attribute: false },
|
|
16
|
+
_typing: { state: true },
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
constructor() {
|
|
20
|
+
super()
|
|
21
|
+
this.value = ''
|
|
22
|
+
this.properties = []
|
|
23
|
+
this._typing = ''
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#choose(alias) {
|
|
27
|
+
this.value = insertProperty(this.value, alias)
|
|
28
|
+
this._typing = ''
|
|
29
|
+
this.dispatchEvent(new Event('change', { bubbles: true }))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
render() {
|
|
33
|
+
const offered = propertySuggestions(this.properties ?? [], this._typing)
|
|
34
|
+
return html`
|
|
35
|
+
<crombolo-form-word-input
|
|
36
|
+
label=${this.label}
|
|
37
|
+
.value=${this.value ?? ''}
|
|
38
|
+
@input=${(event) => {
|
|
39
|
+
event.stopPropagation()
|
|
40
|
+
this._typing = event.target.value ?? ''
|
|
41
|
+
}}
|
|
42
|
+
@change=${(event) => {
|
|
43
|
+
event.stopPropagation()
|
|
44
|
+
this.value = event.target.value ?? ''
|
|
45
|
+
this._typing = ''
|
|
46
|
+
this.dispatchEvent(new Event('change', { bubbles: true }))
|
|
47
|
+
}}
|
|
48
|
+
></crombolo-form-word-input>
|
|
49
|
+
${
|
|
50
|
+
offered.length > 0
|
|
51
|
+
? html`<ul role="listbox" aria-label="Properties of this page">
|
|
52
|
+
${offered.map(
|
|
53
|
+
(property) => html`<li
|
|
54
|
+
role="option"
|
|
55
|
+
@mousedown=${(event) => {
|
|
56
|
+
event.preventDefault()
|
|
57
|
+
this.value = this._typing
|
|
58
|
+
this.#choose(property.alias)
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<strong>${property.name}</strong> <code>{${property.alias}}</code>
|
|
62
|
+
</li>`,
|
|
63
|
+
)}
|
|
64
|
+
</ul>`
|
|
65
|
+
: nothing
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static styles = css`
|
|
71
|
+
:host {
|
|
72
|
+
display: block;
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
ul {
|
|
76
|
+
position: absolute;
|
|
77
|
+
z-index: 10;
|
|
78
|
+
left: 0;
|
|
79
|
+
right: 0;
|
|
80
|
+
margin: 2px 0 0;
|
|
81
|
+
padding: var(--uui-size-space-1) 0;
|
|
82
|
+
list-style: none;
|
|
83
|
+
background: var(--uui-color-surface);
|
|
84
|
+
border: 1px solid var(--uui-color-border);
|
|
85
|
+
border-radius: var(--uui-border-radius);
|
|
86
|
+
box-shadow: var(--uui-shadow-depth-2);
|
|
87
|
+
}
|
|
88
|
+
li {
|
|
89
|
+
padding: var(--uui-size-space-2) var(--uui-size-space-4);
|
|
90
|
+
cursor: pointer;
|
|
91
|
+
}
|
|
92
|
+
li:hover {
|
|
93
|
+
background: var(--uui-color-surface-emphasis);
|
|
94
|
+
}
|
|
95
|
+
code {
|
|
96
|
+
color: var(--uui-color-text-alt);
|
|
97
|
+
}
|
|
98
|
+
`
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
customElements.define('crombolo-seo-value-input', CromboloSeoValueInputElement)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a search and sharing value's box suggests (story 317): typing `{` offers
|
|
3
|
+
* the page type's properties, chosen as `{alias}`; `{#` is the dictionary's, which
|
|
4
|
+
* `crombolo-form-word-input` offers. Pure, so it is tested on its own.
|
|
5
|
+
*/
|
|
6
|
+
const ROWS = 8
|
|
7
|
+
/** A property's alias being typed at the end of the text: after a `{` that is not `{{` or `{#`. */
|
|
8
|
+
const TYPING = /(?<!\{)\{(?!#)([^{}\s]*)$/
|
|
9
|
+
|
|
10
|
+
/** What has been typed of a property's alias at the end of the text, and where its `{` is. */
|
|
11
|
+
export function typedProperty(value) {
|
|
12
|
+
const match = TYPING.exec(value ?? '')
|
|
13
|
+
return match ? { typed: match[1] ?? '', start: match.index } : undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The properties to offer for what has been typed: aliases or names starting with it first. */
|
|
17
|
+
export function propertySuggestions(properties, value) {
|
|
18
|
+
const at = typedProperty(value)
|
|
19
|
+
if (!at) return []
|
|
20
|
+
const typed = at.typed.toLowerCase()
|
|
21
|
+
const starts = (p) =>
|
|
22
|
+
p.alias.toLowerCase().startsWith(typed) || p.name.toLowerCase().startsWith(typed)
|
|
23
|
+
const contains = (p) =>
|
|
24
|
+
p.alias.toLowerCase().includes(typed) || p.name.toLowerCase().includes(typed)
|
|
25
|
+
return [
|
|
26
|
+
...properties.filter(starts),
|
|
27
|
+
...properties.filter((p) => !starts(p) && contains(p)),
|
|
28
|
+
].slice(0, ROWS)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The text with the alias being typed at its end made `{alias}`. */
|
|
32
|
+
export function insertProperty(value, alias) {
|
|
33
|
+
const at = typedProperty(value)
|
|
34
|
+
const start = at ? at.start : (value ?? '').length
|
|
35
|
+
return `${(value ?? '').slice(0, start)}{${alias}}`
|
|
36
|
+
}
|
package/plugin/settings-cards.js
CHANGED
|
@@ -19,9 +19,9 @@ export const GROUPS = ['Site', 'Health', 'History', 'Developers', 'Extensions',
|
|
|
19
19
|
export const CARDS = {
|
|
20
20
|
'Crombolo.Dashboard.Seo': {
|
|
21
21
|
group: 'Site',
|
|
22
|
-
title: 'Search
|
|
22
|
+
title: 'Search',
|
|
23
23
|
description:
|
|
24
|
-
'What
|
|
24
|
+
'What pages say in search results and when shared, the robots file, and the search indexes.',
|
|
25
25
|
},
|
|
26
26
|
'Crombolo.Dashboard.Addresses': {
|
|
27
27
|
group: 'Site',
|
|
@@ -31,7 +31,7 @@ export const CARDS = {
|
|
|
31
31
|
'Umb.Dashboard.RedirectManagement': {
|
|
32
32
|
group: 'Site',
|
|
33
33
|
title: 'Redirects',
|
|
34
|
-
description: "
|
|
34
|
+
description: "Configure the site's redirect rules.",
|
|
35
35
|
},
|
|
36
36
|
'Umb.MenuItem.Webhook': {
|
|
37
37
|
group: 'Site',
|
|
@@ -43,16 +43,16 @@ export const CARDS = {
|
|
|
43
43
|
title: 'Logs',
|
|
44
44
|
description: 'Search and read what the server has logged.',
|
|
45
45
|
},
|
|
46
|
-
'Umb.Dashboard.ExamineManagement': {
|
|
47
|
-
group: 'Site',
|
|
48
|
-
title: 'Search indexes',
|
|
49
|
-
description: "The back office's search indexes: their health, and rebuilding them.",
|
|
50
|
-
},
|
|
51
46
|
'Crombolo.Dashboard.BackgroundJobs': {
|
|
52
47
|
group: 'Site',
|
|
53
48
|
title: 'Background jobs',
|
|
54
49
|
description: 'Scheduled and queued work, how far each got, and running a failed one again.',
|
|
55
50
|
},
|
|
51
|
+
'Umb.MenuItem.Relations': {
|
|
52
|
+
group: 'Site',
|
|
53
|
+
title: 'Relations',
|
|
54
|
+
description: 'How items point at each other, such as a copy and its original.',
|
|
55
|
+
},
|
|
56
56
|
'Umb.Dashboard.HealthCheck': {
|
|
57
57
|
group: 'Health',
|
|
58
58
|
title: 'Health check',
|
|
@@ -63,11 +63,6 @@ export const CARDS = {
|
|
|
63
63
|
title: 'Published status',
|
|
64
64
|
description: 'The published cache visitors are served from, and rebuilding it.',
|
|
65
65
|
},
|
|
66
|
-
'Umb.MenuItem.Relations': {
|
|
67
|
-
group: 'Health',
|
|
68
|
-
title: 'Relations',
|
|
69
|
-
description: 'How items point at each other, such as a copy and its original.',
|
|
70
|
-
},
|
|
71
66
|
'Crombolo.Dashboard.Changes': {
|
|
72
67
|
group: 'History',
|
|
73
68
|
title: 'Changes',
|
|
@@ -82,13 +77,19 @@ export const CARDS = {
|
|
|
82
77
|
'Umb.MenuItem.Extensions': {
|
|
83
78
|
group: 'Developers',
|
|
84
79
|
title: 'Extension insights',
|
|
85
|
-
description: 'What the back office has loaded, and from which
|
|
80
|
+
description: 'What the back office has loaded, and from which extension.',
|
|
86
81
|
},
|
|
87
82
|
'Crombolo.Dashboard.CiAccess': {
|
|
88
83
|
group: 'Developers',
|
|
89
84
|
title: 'CI access',
|
|
90
85
|
description: 'The CI jobs that may pull and push here without a person, and what each may do.',
|
|
91
86
|
},
|
|
87
|
+
'Crombolo.Dashboard.TrustedSigners': {
|
|
88
|
+
group: 'Developers',
|
|
89
|
+
title: 'Trusted signers',
|
|
90
|
+
description:
|
|
91
|
+
'The keys and builds whose site bundles this site applies: yours, other sites, and CI.',
|
|
92
|
+
},
|
|
92
93
|
'Umb.Dashboard.ModelsBuilder': {
|
|
93
94
|
group: 'Developers',
|
|
94
95
|
title: 'Types for code',
|
|
@@ -96,8 +97,8 @@ export const CARDS = {
|
|
|
96
97
|
},
|
|
97
98
|
'Crombolo.Dashboard.Bundles': {
|
|
98
99
|
group: 'Extensions',
|
|
99
|
-
title: '
|
|
100
|
-
description: 'Find, install and build
|
|
100
|
+
title: 'Extensions',
|
|
101
|
+
description: 'Find, install and build extensions: what they add, and turning them off.',
|
|
101
102
|
},
|
|
102
103
|
}
|
|
103
104
|
|
|
@@ -170,7 +171,7 @@ export function settingsCards({ dashboards = [], advanced = [] }) {
|
|
|
170
171
|
|
|
171
172
|
/** Where the Bundles section shows an installed bundle, relative to the back office. */
|
|
172
173
|
export const bundlePath = (packageName) =>
|
|
173
|
-
`section/settings/dashboard/
|
|
174
|
+
`section/settings/dashboard/extensions/installed?extension=${encodeURIComponent(packageName)}`
|
|
174
175
|
|
|
175
176
|
const rank = (order, alias) => {
|
|
176
177
|
const at = order.indexOf(alias)
|