Skip to content

Commit f343fc7

Browse files
committed
add stylesheet folder workspace
1 parent 4add154 commit f343fc7

12 files changed

+134
-4
lines changed

src/packages/templating/scripts/tree/folder/workspace/manifests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const manifests: Array<UmbExtensionManifest> = [
77
kind: 'routable',
88
alias: UMB_SCRIPT_FOLDER_WORKSPACE_ALIAS,
99
name: 'Script Folder Workspace',
10-
api: () => import('./script-type-folder-workspace.context.js'),
10+
api: () => import('./script-folder-workspace.context.js'),
1111
meta: {
1212
entityType: UMB_SCRIPT_FOLDER_ENTITY_TYPE,
1313
},

src/packages/templating/scripts/tree/folder/workspace/script-type-folder-editor.element.ts renamed to src/packages/templating/scripts/tree/folder/workspace/script-folder-workspace-editor.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UMB_SCRIPT_FOLDER_WORKSPACE_ALIAS } from './constants.js';
2-
import { UMB_SCRIPT_FOLDER_WORKSPACE_CONTEXT } from './script-type-folder.workspace.context-token.js';
2+
import { UMB_SCRIPT_FOLDER_WORKSPACE_CONTEXT } from './script-folder-workspace.context-token.js';
33
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
44
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
55
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { UMB_SCRIPT_FOLDER_ENTITY_TYPE } from '../../../entity.js';
2-
import type { UmbScriptFolderWorkspaceContext } from './script-type-folder-workspace.context.js';
2+
import type { UmbScriptFolderWorkspaceContext } from './script-folder-workspace.context.js';
33
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
44
import type { UmbWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
55

src/packages/templating/scripts/tree/folder/workspace/script-type-folder-workspace.context.ts renamed to src/packages/templating/scripts/tree/folder/workspace/script-folder-workspace.context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { UMB_SCRIPT_FOLDER_REPOSITORY_ALIAS, type UmbScriptFolderRepository } from '../repository/index.js';
22
import { UMB_SCRIPT_FOLDER_ENTITY_TYPE } from '../../../entity.js';
33
import { UMB_SCRIPT_FOLDER_WORKSPACE_ALIAS } from './constants.js';
4-
import { UmbScriptFolderWorkspaceEditorElement } from './script-type-folder-editor.element.js';
4+
import { UmbScriptFolderWorkspaceEditorElement } from './script-folder-workspace-editor.element.js';
55
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
66
import {
77
UmbEntityDetailWorkspaceContextBase,
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from './repository/index.js';
2+
export * from './workspace/index.js';

src/packages/templating/stylesheets/tree/folder/manifests.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { UMB_STYLESHEET_FOLDER_ENTITY_TYPE } from '../../entity.js';
22
import { UMB_STYLESHEET_FOLDER_REPOSITORY_ALIAS } from './repository/index.js';
33
import { manifests as repositoryManifests } from './repository/manifests.js';
4+
import { manifests as workspaceManifests } from './workspace/manifests.js';
45

56
export const UMB_DELETE_STYLESHEET_FOLDER_ENTITY_ACTION_ALIAS = 'Umb.EntityAction.Stylesheet.Folder.Delete';
67

@@ -16,4 +17,5 @@ export const manifests: Array<UmbExtensionManifest> = [
1617
},
1718
},
1819
...repositoryManifests,
20+
...workspaceManifests,
1921
];
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const UMB_STYLESHEET_FOLDER_WORKSPACE_ALIAS = 'Umb.Workspace.Stylesheet.Folder';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './constants.js';
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { UMB_STYLESHEET_FOLDER_ENTITY_TYPE } from '../../../entity.js';
2+
import { UMB_STYLESHEET_FOLDER_WORKSPACE_ALIAS } from './constants.js';
3+
4+
export const manifests: Array<UmbExtensionManifest> = [
5+
{
6+
type: 'workspace',
7+
kind: 'routable',
8+
alias: UMB_STYLESHEET_FOLDER_WORKSPACE_ALIAS,
9+
name: 'Stylesheet Folder Workspace',
10+
api: () => import('./stylesheet-folder-workspace.context.js'),
11+
meta: {
12+
entityType: UMB_STYLESHEET_FOLDER_ENTITY_TYPE,
13+
},
14+
},
15+
];
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { UMB_STYLESHEET_FOLDER_WORKSPACE_ALIAS } from './constants.js';
2+
import { UMB_STYLESHEET_FOLDER_WORKSPACE_CONTEXT } from './stylesheet-folder-workspace.context-token.js';
3+
import { css, html, customElement, state } from '@umbraco-cms/backoffice/external/lit';
4+
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
5+
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
6+
7+
const elementName = 'umb-stylesheet-folder-workspace-editor';
8+
@customElement(elementName)
9+
export class UmbStylesheetFolderWorkspaceEditorElement extends UmbLitElement {
10+
@state()
11+
private _name = '';
12+
13+
#workspaceContext?: typeof UMB_STYLESHEET_FOLDER_WORKSPACE_CONTEXT.TYPE;
14+
15+
constructor() {
16+
super();
17+
18+
this.consumeContext(UMB_STYLESHEET_FOLDER_WORKSPACE_CONTEXT, (workspaceContext) => {
19+
this.#workspaceContext = workspaceContext;
20+
this.#observeName();
21+
});
22+
}
23+
24+
#observeName() {
25+
if (!this.#workspaceContext) return;
26+
this.observe(this.#workspaceContext.name, (name) => {
27+
if (name !== this._name) {
28+
this._name = name ?? '';
29+
}
30+
});
31+
}
32+
33+
override render() {
34+
return html`<umb-workspace-editor headline=${this._name} alias=${UMB_STYLESHEET_FOLDER_WORKSPACE_ALIAS}>
35+
</umb-workspace-editor>`;
36+
}
37+
38+
static override styles = [UmbTextStyles, css``];
39+
}
40+
41+
export { UmbStylesheetFolderWorkspaceEditorElement as element };
42+
43+
declare global {
44+
interface HTMLElementTagNameMap {
45+
[elementName]: UmbStylesheetFolderWorkspaceEditorElement;
46+
}
47+
}

0 commit comments

Comments
 (0)