Skip to content

Commit b827d97

Browse files
committed
run prettier
1 parent b1f0d6d commit b827d97

File tree

14 files changed

+384
-205
lines changed

14 files changed

+384
-205
lines changed

src/external/router-slot/router-slot.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
4848
/**
4949
* Method to cancel navigation if changed.
5050
*/
51-
private _cancelNavigation ?:() => void;
51+
private _cancelNavigation?: () => void;
5252

5353
/**
5454
* Listeners on the router.
@@ -208,7 +208,7 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
208208
if (this.isConnected) {
209209
const newMatch = this.getRouteMatch();
210210
// Check if this match matches the current match (aka. If the path has changed), if so we should navigate. [NL]
211-
if(newMatch) {
211+
if (newMatch) {
212212
navigate = shouldNavigate(this.match, newMatch);
213213
}
214214
}
@@ -318,7 +318,6 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
318318
* Returns true if a navigation was made to a new page.
319319
*/
320320
protected async renderPath(path: string | PathFragment): Promise<boolean> {
321-
322321
// Notice: Since this is never called from any other place than one higher in this file(when writing this...), we could just retrieve the path and find a match by using this.getRouteMatch() [NL]
323322
// Find the corresponding route.
324323
const match = matchRoutes(this._routes, path);
@@ -336,7 +335,6 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
336335
// Only change route if its a new route.
337336
const navigate = shouldNavigate(this.match, match);
338337
if (navigate) {
339-
340338
// If another navigation is still begin resolved in this very moment, then we need to cancel that so it does not end up overriding this new navigation.[NL]
341339
this._cancelNavigation?.();
342340
// Listen for another push state event. If another push state event happens
@@ -412,7 +410,7 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
412410
// We have some routes that share the same component instance, those should not be removed and re-appended [NL]
413411
const isTheSameComponent = this.firstChild === page;
414412

415-
if(!isTheSameComponent) {
413+
if (!isTheSameComponent) {
416414
// Remove the old page by clearing the slot
417415
this.clearChildren();
418416
}
@@ -421,7 +419,7 @@ export class RouterSlot<D = any, P = any> extends HTMLElement implements IRouter
421419
// We do this to ensure that we can find the match in the connectedCallback of the page.
422420
this._routeMatch = match;
423421

424-
if(!isTheSameComponent) {
422+
if (!isTheSameComponent) {
425423
if (page) {
426424
// Append the new page
427425
this.appendChild(page);

src/libs/extension-api/controller/base-extensions-initializer.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export abstract class UmbBaseExtensionsInitializer<
9191
}
9292

9393
// If we get no manifests and we have not exposed any extensions yet, then we should notify to let the listener know that we have our first response. [NL]
94-
if(manifests.length === 0 && this.#exposedPermittedExts === undefined) {
94+
if (manifests.length === 0 && this.#exposedPermittedExts === undefined) {
9595
this.#exposedPermittedExts = [];
9696
this.#onChange?.(this.#exposedPermittedExts);
9797
}

src/packages/block/block-grid/components/block-grid-entry/block-grid-entry.element.ts

Lines changed: 144 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
22
import { html, css, customElement, property, state, nothing } from '@umbraco-cms/backoffice/external/lit';
33
import type { PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
4-
import type { ManifestBlockEditorCustomView, UmbBlockEditorCustomViewProperties, UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
4+
import type {
5+
ManifestBlockEditorCustomView,
6+
UmbBlockEditorCustomViewProperties,
7+
UmbPropertyEditorUiElement,
8+
} from '@umbraco-cms/backoffice/extension-registry';
59
import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils';
610
import { UmbBlockGridEntryContext } from '../../context/block-grid-entry.context.js';
711
import { UMB_BLOCK_GRID, type UmbBlockGridLayoutModel } from '@umbraco-cms/backoffice/block-grid';
@@ -41,7 +45,7 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
4145
#renderTimeout: number | undefined;
4246

4347
@state()
44-
_contentTypeAlias?:string;
48+
_contentTypeAlias?: string;
4549

4650
@state()
4751
_columnSpan?: number;
@@ -86,7 +90,10 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
8690
_inlineCreateAboveWidth?: string;
8791

8892
@state()
89-
_blockViewProps: UmbBlockEditorCustomViewProperties<UmbBlockGridLayoutModel> = { contentUdi: undefined!, config: { showContentEdit: false, showSettingsEdit: false} }; // Set to undefined cause it will be set before we render.
93+
_blockViewProps: UmbBlockEditorCustomViewProperties<UmbBlockGridLayoutModel> = {
94+
contentUdi: undefined!,
95+
config: { showContentEdit: false, showSettingsEdit: false },
96+
}; // Set to undefined cause it will be set before we render.
9097

9198
#updateBlockViewProps(incoming: Partial<UmbBlockEditorCustomViewProperties<UmbBlockGridLayoutModel>>) {
9299
this._blockViewProps = { ...this._blockViewProps, ...incoming };
@@ -97,63 +104,119 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
97104
super();
98105

99106
// Misc:
100-
this.observe(this.#context.showContentEdit, (showContentEdit) => {
101-
this._showContentEdit = showContentEdit;
102-
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, showContentEdit } });
103-
}, null);
104-
this.observe(this.#context.settingsElementTypeKey, (key) => {
105-
this._hasSettings = !!key;
106-
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, showSettingsEdit: !!key } });
107-
}, null);
108-
this.observe(this.#context.canScale, (canScale) => {
109-
this._canScale = canScale;
110-
}, null);
111-
this.observe(this.#context.blockType, (blockType) => {
112-
this.#updateBlockViewProps({ blockType });
113-
}, null);
107+
this.observe(
108+
this.#context.showContentEdit,
109+
(showContentEdit) => {
110+
this._showContentEdit = showContentEdit;
111+
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, showContentEdit } });
112+
},
113+
null,
114+
);
115+
this.observe(
116+
this.#context.settingsElementTypeKey,
117+
(key) => {
118+
this._hasSettings = !!key;
119+
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, showSettingsEdit: !!key } });
120+
},
121+
null,
122+
);
123+
this.observe(
124+
this.#context.canScale,
125+
(canScale) => {
126+
this._canScale = canScale;
127+
},
128+
null,
129+
);
130+
this.observe(
131+
this.#context.blockType,
132+
(blockType) => {
133+
this.#updateBlockViewProps({ blockType });
134+
},
135+
null,
136+
);
114137
// TODO: Implement index.
115-
this.observe(this.#context.label, (label) => {
116-
this.#updateBlockViewProps({ label });
117-
this._label = label;
118-
}, null);
119-
this.observe(this.#context.contentElementTypeIcon, (icon) => {
120-
this.#updateBlockViewProps({ icon });
121-
this._icon = icon;
122-
}, null);
123-
this.observe(this.#context.inlineEditingMode, (mode) => {
124-
this._inlineEditingMode = mode;
125-
}, null);
138+
this.observe(
139+
this.#context.label,
140+
(label) => {
141+
this.#updateBlockViewProps({ label });
142+
this._label = label;
143+
},
144+
null,
145+
);
146+
this.observe(
147+
this.#context.contentElementTypeIcon,
148+
(icon) => {
149+
this.#updateBlockViewProps({ icon });
150+
this._icon = icon;
151+
},
152+
null,
153+
);
154+
this.observe(
155+
this.#context.inlineEditingMode,
156+
(mode) => {
157+
this._inlineEditingMode = mode;
158+
},
159+
null,
160+
);
126161

127162
// Data:
128-
this.observe(this.#context.layout, (layout) => {
129-
this.#updateBlockViewProps({ layout });
130-
}, null);
131-
this.observe(this.#context.content, (content) => {
132-
this.#updateBlockViewProps({ content });
133-
}, null);
134-
this.observe(this.#context.settings, (settings) => {
135-
this.#updateBlockViewProps({ settings });
136-
}, null);
163+
this.observe(
164+
this.#context.layout,
165+
(layout) => {
166+
this.#updateBlockViewProps({ layout });
167+
},
168+
null,
169+
);
170+
this.observe(
171+
this.#context.content,
172+
(content) => {
173+
this.#updateBlockViewProps({ content });
174+
},
175+
null,
176+
);
177+
this.observe(
178+
this.#context.settings,
179+
(settings) => {
180+
this.#updateBlockViewProps({ settings });
181+
},
182+
null,
183+
);
137184

138185
// Paths:
139-
this.observe(this.#context.createBeforePath, (createPath) => {
140-
//const oldValue = this._createBeforePath;
141-
this._createBeforePath = createPath;
142-
//this.requestUpdate('_createPath', oldValue);
143-
}, null);
144-
this.observe(this.#context.createAfterPath, (createPath) => {
145-
//const oldValue = this._createAfterPath;
146-
this._createAfterPath = createPath;
147-
//this.requestUpdate('_createPath', oldValue);
148-
}, null);
149-
this.observe(this.#context.workspaceEditContentPath, (path) => {
150-
this._workspaceEditContentPath = path;
151-
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, editContentPath: path } });
152-
}, null);
153-
this.observe(this.#context.workspaceEditSettingsPath, (path) => {
154-
this._workspaceEditSettingsPath = path;
155-
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, editSettingsPath: path } });
156-
}, null);
186+
this.observe(
187+
this.#context.createBeforePath,
188+
(createPath) => {
189+
//const oldValue = this._createBeforePath;
190+
this._createBeforePath = createPath;
191+
//this.requestUpdate('_createPath', oldValue);
192+
},
193+
null,
194+
);
195+
this.observe(
196+
this.#context.createAfterPath,
197+
(createPath) => {
198+
//const oldValue = this._createAfterPath;
199+
this._createAfterPath = createPath;
200+
//this.requestUpdate('_createPath', oldValue);
201+
},
202+
null,
203+
);
204+
this.observe(
205+
this.#context.workspaceEditContentPath,
206+
(path) => {
207+
this._workspaceEditContentPath = path;
208+
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, editContentPath: path } });
209+
},
210+
null,
211+
);
212+
this.observe(
213+
this.#context.workspaceEditSettingsPath,
214+
(path) => {
215+
this._workspaceEditSettingsPath = path;
216+
this.#updateBlockViewProps({ config: { ...this._blockViewProps.config, editSettingsPath: path } });
217+
},
218+
null,
219+
);
157220
}
158221

159222
override connectedCallback(): void {
@@ -177,17 +240,25 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
177240
},
178241
'rowSpan',
179242
);
180-
this.observe(this.#context.contentElementTypeKey, (contentElementTypeKey) => {
181-
if (contentElementTypeKey) {
182-
this.setAttribute('data-content-element-type-key', contentElementTypeKey);
183-
}
184-
}, 'contentElementTypeKey');
185-
this.observe(this.#context.contentElementTypeAlias, (contentElementTypeAlias) => {
186-
if (contentElementTypeAlias) {
187-
this._contentTypeAlias = contentElementTypeAlias;
188-
this.setAttribute('data-content-element-type-alias', contentElementTypeAlias);
189-
}
190-
}, 'contentElementTypeAlias');
243+
this.observe(
244+
this.#context.contentElementTypeKey,
245+
(contentElementTypeKey) => {
246+
if (contentElementTypeKey) {
247+
this.setAttribute('data-content-element-type-key', contentElementTypeKey);
248+
}
249+
},
250+
'contentElementTypeKey',
251+
);
252+
this.observe(
253+
this.#context.contentElementTypeAlias,
254+
(contentElementTypeAlias) => {
255+
if (contentElementTypeAlias) {
256+
this._contentTypeAlias = contentElementTypeAlias;
257+
this.setAttribute('data-content-element-type-alias', contentElementTypeAlias);
258+
}
259+
},
260+
'contentElementTypeAlias',
261+
);
191262

192263
this.#callUpdateInlineCreateButtons();
193264
}
@@ -234,15 +305,18 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
234305
}
235306
};
236307

237-
#extensionSlotFilterMethod = (manifest:ManifestBlockEditorCustomView) => {
238-
if(manifest.forContentTypeAlias && !stringOrStringArrayContains(manifest.forContentTypeAlias, this._contentTypeAlias!)) {
308+
#extensionSlotFilterMethod = (manifest: ManifestBlockEditorCustomView) => {
309+
if (
310+
manifest.forContentTypeAlias &&
311+
!stringOrStringArrayContains(manifest.forContentTypeAlias, this._contentTypeAlias!)
312+
) {
239313
return false;
240314
}
241-
if(manifest.forBlockEditor && !stringOrStringArrayContains(manifest.forBlockEditor, UMB_BLOCK_GRID)) {
315+
if (manifest.forBlockEditor && !stringOrStringArrayContains(manifest.forBlockEditor, UMB_BLOCK_GRID)) {
242316
return false;
243317
}
244318
return true;
245-
}
319+
};
246320

247321
#renderInlineEditBlock() {
248322
return html`<umb-block-grid-block-inline

0 commit comments

Comments
 (0)