Merge branch 'main' into chore/fix-tests

This commit is contained in:
Mads Rasmussen
2024-07-04 14:03:08 +02:00
committed by GitHub
86 changed files with 371 additions and 195 deletions

View File

@@ -21,7 +21,8 @@
"./src/packages/webhook",
"./src/packages/health-check",
"./src/packages/tags",
"./src/packages/templating"
"./src/packages/templating",
"./src/packages/property-editors"
],
"dependencies": {
"@types/diff": "^5.2.1",
@@ -7664,6 +7665,10 @@
"resolved": "src/packages/language",
"link": true
},
"node_modules/@umbraco-backoffice/property-editors": {
"resolved": "src/packages/property-editors",
"link": true
},
"node_modules/@umbraco-backoffice/tag": {
"resolved": "src/packages/tags",
"link": true
@@ -22280,6 +22285,9 @@
"src/packages/language": {
"name": "@umbraco-backoffice/language"
},
"src/packages/property-editors": {
"name": "@umbraco-backoffice/property-editors"
},
"src/packages/tags": {
"name": "@umbraco-backoffice/tag"
},

View File

@@ -139,7 +139,8 @@
"./src/packages/webhook",
"./src/packages/health-check",
"./src/packages/tags",
"./src/packages/templating"
"./src/packages/templating",
"./src/packages/property-editors"
],
"scripts": {
"backoffice:test:e2e": "npx playwright test",
@@ -178,7 +179,7 @@
"test:dev": "web-test-runner --config ./web-test-runner.dev.config.mjs",
"test:dev-watch": "web-test-runner --watch --config ./web-test-runner.dev.config.mjs",
"test:watch": "web-test-runner --watch",
"test": "web-test-runner --coverage",
"test": "web-test-runner",
"wc-analyze:vscode": "wca **/*.element.ts --format vscode --outFile dist-cms/vscode-html-custom-data.json",
"wc-analyze": "wca **/*.element.ts --outFile dist-cms/custom-elements.json",
"generate:tsconfig": "node ./devops/tsconfig/index.js",

View File

@@ -12,7 +12,8 @@ import '../block-grid-entries/index.js';
@customElement('umb-block-grid-areas-container')
export class UmbBlockGridAreasContainerElement extends UmbLitElement {
//
#styleElement?: HTMLLinkElement;
@state()
_styleElement?: HTMLLinkElement;
@state()
_areas?: Array<UmbBlockGridTypeAreaType> = [];
@@ -44,9 +45,11 @@ export class UmbBlockGridAreasContainerElement extends UmbLitElement {
this.observe(
manager.layoutStylesheet,
(stylesheet) => {
this.#styleElement = document.createElement('link');
this.#styleElement.setAttribute('rel', 'stylesheet');
this.#styleElement.setAttribute('href', stylesheet);
// Do not re-render stylesheet if its the same href.
if (!stylesheet || this._styleElement?.href === stylesheet) return;
this._styleElement = document.createElement('link');
this._styleElement.rel = 'stylesheet';
this._styleElement.href = stylesheet;
},
'observeStylesheet',
);
@@ -55,7 +58,7 @@ export class UmbBlockGridAreasContainerElement extends UmbLitElement {
override render() {
return this._areas && this._areas.length > 0
? html` ${this.#styleElement}
? html` ${this._styleElement}
<div
class="umb-block-grid__area-container"
style="--umb-block-grid--area-grid-columns: ${this._areaGridColumns}">

View File

@@ -1,12 +1,9 @@
import { UmbBlockGridEntriesContext } from '../../context/block-grid-entries.context.js';
import type { UmbBlockGridEntryElement } from '../block-grid-entry/index.js';
import {
getAccumulatedValueOfIndex,
getInterpolatedIndexOfPositionInWeightMap,
isWithinRect,
} from '@umbraco-cms/backoffice/utils';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import type { UmbBlockGridLayoutModel } from '@umbraco-cms/backoffice/block-grid';
import { html, customElement, state, repeat, css, property, nothing } from '@umbraco-cms/backoffice/external/lit';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import '../block-grid-entry/index.js';
@@ -17,6 +14,9 @@ import {
type UmbFormControlValidatorConfig,
} from '@umbraco-cms/backoffice/validation';
import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models';
import { UmbBlockGridEntriesContext } from '../../context/block-grid-entries.context.js';
import type { UmbBlockGridEntryElement } from '../block-grid-entry/index.js';
import type { UmbBlockGridLayoutModel } from '@umbraco-cms/backoffice/block-grid';
/**
* Notice this utility method is not really shareable with others as it also takes areas into account. [NL]
@@ -209,10 +209,10 @@ export class UmbBlockGridEntriesElement extends UmbFormControlMixin(UmbLitElemen
this.observe(
manager.layoutStylesheet,
(stylesheet) => {
if (this._styleElement && this._styleElement.href === stylesheet) return;
if (!stylesheet || this._styleElement?.href === stylesheet) return;
this._styleElement = document.createElement('link');
this._styleElement.setAttribute('rel', 'stylesheet');
this._styleElement.setAttribute('href', stylesheet);
this._styleElement.rel = 'stylesheet';
this._styleElement.href = stylesheet;
},
'observeStylesheet',
);

View File

@@ -1,6 +1,10 @@
import type { UmbBlockGridLayoutModel, UmbBlockGridTypeModel } from '../types.js';
import type { UmbBlockGridWorkspaceData } from '../index.js';
import { UmbArrayState, appendToFrozenArray, pushAtToUniqueArray } from '@umbraco-cms/backoffice/observable-api';
import { removeInitialSlashFromPath, transformServerPathToClientPath } from '@umbraco-cms/backoffice/utils';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_APP_CONTEXT } from '@umbraco-cms/backoffice/app';
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
import { type UmbBlockDataType, UmbBlockManagerContext } from '@umbraco-cms/backoffice/block';
import type { UmbBlockTypeGroup } from '@umbraco-cms/backoffice/block-type';
@@ -13,17 +17,34 @@ export class UmbBlockGridManagerContext<
BlockLayoutType extends UmbBlockGridLayoutModel = UmbBlockGridLayoutModel,
> extends UmbBlockManagerContext<UmbBlockGridTypeModel, UmbBlockGridLayoutModel> {
//
#initAppUrl: Promise<void>;
#appUrl?: string;
#blockGroups = new UmbArrayState(<Array<UmbBlockTypeGroup>>[], (x) => x.key);
public readonly blockGroups = this.#blockGroups.asObservable();
layoutStylesheet = this._editorConfiguration.asObservablePart(
(x) => (x?.getValueByAlias('layoutStylesheet') as string) ?? UMB_BLOCK_GRID_DEFAULT_LAYOUT_STYLESHEET,
);
layoutStylesheet = this._editorConfiguration.asObservablePart((x) => {
if (!x) return undefined;
const layoutStylesheet = x.getValueByAlias<string>('layoutStylesheet');
if (!layoutStylesheet) return UMB_BLOCK_GRID_DEFAULT_LAYOUT_STYLESHEET;
if (layoutStylesheet) {
// Cause we await initAppUrl in setting the _editorConfiguration, we can trust the appUrl begin here.
return this.#appUrl! + removeInitialSlashFromPath(transformServerPathToClientPath(layoutStylesheet));
}
return undefined;
});
gridColumns = this._editorConfiguration.asObservablePart((x) => {
const value = x?.getValueByAlias('gridColumns') as string | undefined;
return parseInt(value && value !== '' ? value : '12');
});
override setEditorConfiguration(configs: UmbPropertyEditorConfigCollection) {
this.#initAppUrl.then(() => {
// we await initAppUrl, So the appUrl begin here is available when retrieving the layoutStylesheet.
this._editorConfiguration.setValue(configs);
});
}
setBlockGroups(blockGroups: Array<UmbBlockTypeGroup>) {
this.#blockGroups.setValue(blockGroups);
}
@@ -31,6 +52,14 @@ export class UmbBlockGridManagerContext<
return this.#blockGroups.value;
}
constructor(host: UmbControllerHost) {
super(host);
this.#initAppUrl = this.getContext(UMB_APP_CONTEXT).then((appContext) => {
this.#appUrl = appContext.getServerUrl() + appContext.getBackofficePath();
});
}
create(
contentElementTypeKey: string,
partialLayoutEntry?: Omit<BlockLayoutType, 'contentUdi'>,

View File

@@ -55,6 +55,12 @@ export const manifests: Array<ManifestTypes> = [
label: 'Layout Stylesheet',
description: 'Override default stylesheet for backoffice layout.',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.BlockGridLayoutStylesheet',
config: [
{
alias: 'singleItemMode',
value: true,
},
],
},
],
},

View File

@@ -1,16 +1,16 @@
import { UmbBlockGridManagerContext } from '../../context/block-grid-manager.context.js';
import { UMB_BLOCK_GRID_PROPERTY_EDITOR_ALIAS } from './manifests.js';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { html, customElement, property, state, css, type PropertyValueMap } from '@umbraco-cms/backoffice/external/lit';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
import type { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor';
import type { UmbBlockTypeGroup } from '@umbraco-cms/backoffice/block-type';
import type { UmbBlockGridTypeModel, UmbBlockGridValueModel } from '@umbraco-cms/backoffice/block-grid';
import '../../components/block-grid-entries/index.js';
import { observeMultiple } from '@umbraco-cms/backoffice/observable-api';
import { UMB_PROPERTY_CONTEXT } from '@umbraco-cms/backoffice/property';
import { UmbFormControlMixin } from '@umbraco-cms/backoffice/validation';
import { UmbBlockGridManagerContext } from '../../context/block-grid-manager.context.js';
import { UMB_BLOCK_GRID_PROPERTY_EDITOR_ALIAS } from './manifests.js';
import type { UmbBlockTypeGroup } from '@umbraco-cms/backoffice/block-type';
import type { UmbBlockGridTypeModel, UmbBlockGridValueModel } from '@umbraco-cms/backoffice/block-grid';
/**
* @element umb-property-editor-ui-block-grid

View File

@@ -3,7 +3,7 @@
import type { UmbInputStaticFileElement } from '@umbraco-cms/backoffice/static-file';
import '@umbraco-cms/backoffice/static-file';
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit';
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import {
@@ -11,29 +11,61 @@ import {
type UmbPropertyEditorConfigCollection,
} from '@umbraco-cms/backoffice/property-editor';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import { UmbServerFilePathUniqueSerializer } from '@umbraco-cms/backoffice/server-file-system';
import type { UmbNumberRangeValueType } from '@umbraco-cms/backoffice/models';
@customElement('umb-property-editor-ui-block-grid-layout-stylesheet')
export class UmbPropertyEditorUIBlockGridLayoutStylesheetElement
extends UmbLitElement
implements UmbPropertyEditorUiElement
{
private _value: Array<string> = [];
#pickableFilter = (item: any) => item.unique.endsWith('css');
#singleItemMode = false;
// TODO: get rid of UmbServerFilePathUniqueSerializer in v.15 [NL]
#serverFilePathUniqueSerializer = new UmbServerFilePathUniqueSerializer();
@property({ type: Array })
public set value(value: Array<string>) {
this._value = value || [];
}
public get value(): Array<string> {
return this._value;
}
private _pickableFilter = (item: any) => item.unique.endsWith('css');
@state()
private _value?: string | Array<string>;
@property({ attribute: false })
public config?: UmbPropertyEditorConfigCollection;
public set value(value: string | Array<string> | undefined) {
if (Array.isArray(value)) {
this._value = value.map((unique) => this.#serverFilePathUniqueSerializer.toUnique(unique));
} else if (value) {
this._value = this.#serverFilePathUniqueSerializer.toUnique(value);
} else {
this._value = undefined;
}
}
public get value(): string | Array<string> | undefined {
if (Array.isArray(this._value)) {
return this._value.map((unique) => this.#serverFilePathUniqueSerializer.toServerPath(unique) ?? '');
} else if (this._value) {
return this.#serverFilePathUniqueSerializer.toServerPath(this._value) ?? '';
} else {
return undefined;
}
}
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
this.#singleItemMode = config?.getValueByAlias<boolean>('singleItemMode') ?? false;
const validationLimit = config?.getValueByAlias<UmbNumberRangeValueType>('validationLimit');
this._limitMin = validationLimit?.min ?? 0;
this._limitMax = this.#singleItemMode ? 1 : validationLimit?.max ?? Infinity;
}
@state()
private _limitMin: number = 0;
@state()
private _limitMax: number = Infinity;
private _onChange(event: CustomEvent) {
this.value = (event.target as UmbInputStaticFileElement).selection;
if (this.#singleItemMode) {
this._value = (event.target as UmbInputStaticFileElement).selection[0];
} else {
this._value = (event.target as UmbInputStaticFileElement).selection;
}
this.dispatchEvent(new UmbPropertyValueChangeEvent());
}
@@ -42,10 +74,10 @@ export class UmbPropertyEditorUIBlockGridLayoutStylesheetElement
return html`
<umb-input-static-file
@change=${this._onChange}
.pickableFilter=${this._pickableFilter}
.selection=${this._value}
.min=${0}
.max=${1}></umb-input-static-file>
.pickableFilter=${this.#pickableFilter}
.selection=${this._value ? (Array.isArray(this._value) ? this._value : [this._value]) : []}
.min=${this._limitMin}
.max=${this._limitMax}></umb-input-static-file>
<br />
<a href="/umbraco/backoffice/assets/css/umbraco-blockgridlayout.css">Link to default layout stylesheet</a>
`;

View File

@@ -8,14 +8,6 @@ export class UmbBlockGridTypeWorkspaceViewAdvancedElement extends UmbLitElement
override render() {
return html`
<uui-box headline="Advanced">
<umb-property
label="Custom view"
alias="view"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
<umb-property
label="Custom stylesheet"
alias="stylesheet"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
<umb-property
label="Overlay size"
alias="editorSize"
@@ -41,7 +33,13 @@ export class UmbBlockGridTypeWorkspaceViewAdvancedElement extends UmbLitElement
<umb-property
label="Thumbnail"
alias="thumbnail"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"
.config=${[
{
alias: 'singleItemMode',
value: true,
},
]}></umb-property>
</uui-box>
`;
}

View File

@@ -12,14 +12,6 @@ export class UmbBlockListTypeWorkspaceViewSettingsElement extends UmbLitElement
label="Label"
alias="label"
property-editor-ui-alias="Umb.PropertyEditorUi.TextBox"></umb-property>
<!--<umb-property
label="Custom view"
alias="view"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
<umb-property
label="Custom stylesheet"
alias="stylesheet"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>-->
<umb-property
label="Overlay size"
alias="editorSize"
@@ -67,9 +59,15 @@ export class UmbBlockListTypeWorkspaceViewSettingsElement extends UmbLitElement
alias="iconColor"
property-editor-ui-alias="Umb.PropertyEditorUi.TextBox"></umb-property>
<umb-property
label="Custom stylesheet"
alias="stylesheet"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
label="Thumbnail"
alias="thumbnail"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"
.config=${[
{
alias: 'singleItemMode',
value: true,
},
]}></umb-property>
</uui-box>
<uui-box headline="Advanced">
<umb-property

View File

@@ -63,9 +63,15 @@ export class UmbBlockRteTypeWorkspaceViewSettingsElement extends UmbLitElement i
alias="iconColor"
property-editor-ui-alias="Umb.PropertyEditorUi.TextBox"></umb-property>
<umb-property
label="Custom stylesheet"
alias="stylesheet"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"></umb-property>
label="Thumbnail"
alias="thumbnail"
property-editor-ui-alias="Umb.PropertyEditorUi.StaticFilePicker"
.config=${[
{
alias: 'singleItemMode',
value: true,
},
]}></umb-property>
</uui-box>
`;
}

View File

@@ -5,10 +5,15 @@ import {
import { html, customElement, property, state, ifDefined } from '@umbraco-cms/backoffice/external/lit';
import { UmbRepositoryItemsManager } from '@umbraco-cms/backoffice/repository';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UMB_APP_CONTEXT } from '@umbraco-cms/backoffice/app';
import { removeInitialSlashFromPath, transformServerPathToClientPath } from '@umbraco-cms/backoffice/utils';
@customElement('umb-block-type-card')
export class UmbBlockTypeCardElement extends UmbLitElement {
//
#init: Promise<void>;
#appUrl?: string;
#itemManager = new UmbRepositoryItemsManager<UmbDocumentTypeItemModel>(
this,
UMB_DOCUMENT_TYPE_ITEM_REPOSITORY_ALIAS,
@@ -19,7 +24,22 @@ export class UmbBlockTypeCardElement extends UmbLitElement {
href?: string;
@property({ type: String, attribute: false })
iconFile?: string;
public set iconFile(value: string) {
value = transformServerPathToClientPath(value);
if (value) {
this.#init.then(() => {
this._iconFile = this.#appUrl + removeInitialSlashFromPath(value);
});
} else {
this._iconFile = undefined;
}
}
public get iconFile(): string | undefined {
return this._iconFile;
}
@state()
private _iconFile?: string | undefined;
@property({ type: String, attribute: false })
iconColor?: string;
@@ -55,6 +75,10 @@ export class UmbBlockTypeCardElement extends UmbLitElement {
constructor() {
super();
this.#init = this.getContext(UMB_APP_CONTEXT).then((appContext) => {
this.#appUrl = appContext.getServerUrl() + appContext.getBackofficePath();
});
this.observe(this.#itemManager.items, (items) => {
const item = items[0];
if (item) {
@@ -73,8 +97,8 @@ export class UmbBlockTypeCardElement extends UmbLitElement {
.name=${this._name ?? 'Unknown'}
.description=${this._description}
.background=${this.backgroundColor}>
${this.iconFile
? html`<img src=${this.iconFile} alt="" />`
${this._iconFile
? html`<img src=${this._iconFile} alt="" />`
: html`<umb-icon name=${this._fallbackIcon ?? ''} style="color:${this.iconColor}"></umb-icon>`}
<slot name="actions" slot="actions"> </slot>
</uui-card-block-type>

View File

@@ -145,8 +145,6 @@ export class UmbInputBlockTypeElement<
#renderItem = (block: BlockType) => {
return html`
<umb-block-type-card
.data-umb-content-element-key=${block.contentElementTypeKey}
.name=${block.label}
.iconFile=${block.thumbnail}
.iconColor=${block.iconColor}
.backgroundColor=${block.backgroundColor}

View File

@@ -124,6 +124,7 @@ export class UmbBlockCatalogueModalElement extends UmbModalBaseElement<
(block) => block.contentElementTypeKey,
(block) => html`
<umb-block-type-card
.iconFile=${block.thumbnail}
.iconColor=${block.iconColor}
.backgroundColor=${block.backgroundColor}
.contentElementTypeKey=${block.contentElementTypeKey}

View File

@@ -1,6 +1,5 @@
import type { ManifestApi } from '../../../../libs/extension-api/types/index.js';
import type { UmbApi } from '../../../../libs/extension-api/models/api.interface.js';
import { createExtensionApiByAlias } from './create-extension-api-by-alias.function.js';
import type { ManifestApi, UmbApi } from '@umbraco-cms/backoffice/extension-api';
import { expect, fixture } from '@open-wc/testing';
import { customElement, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbControllerHostElementMixin } from '@umbraco-cms/backoffice/controller-api';
@@ -54,15 +53,16 @@ describe('Create Extension Api By Alias Method', () => {
};
umbExtensionsRegistry.register(manifest);
createExtensionApiByAlias<UmbExtensionApiBoolTestClass>(hostElement, manifest.alias, []).then(() => {
umbExtensionsRegistry.unregister(manifest.alias);
done(new Error('Should not resolve'));
});
setTimeout(() => {
umbExtensionsRegistry.unregister(manifest.alias);
done();
}, 10);
createExtensionApiByAlias<UmbExtensionApiBoolTestClass>(hostElement, manifest.alias, []).then(
() => {
umbExtensionsRegistry.unregister(manifest.alias);
done(new Error('Should not resolve'));
},
() => {
umbExtensionsRegistry.unregister(manifest.alias);
done();
},
);
});
it('Handles when `api` property contains a class constructor', async () => {

View File

@@ -3,14 +3,14 @@ import { UMB_TREE_CONTEXT, type UmbDefaultTreeContext } from '../../default/inde
import type { UmbTreeItemModel, UmbTreeRootModel } from '../../types.js';
import { UmbRequestReloadTreeItemChildrenEvent } from '../../entity-actions/reload-tree-item-children/index.js';
import { map } from '@umbraco-cms/backoffice/external/rxjs';
import { UMB_SECTION_CONTEXT, UMB_SECTION_SIDEBAR_CONTEXT } from '@umbraco-cms/backoffice/section';
import type { UmbSectionContext, UmbSectionSidebarContext } from '@umbraco-cms/backoffice/section';
import type { ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UmbArrayState, UmbBooleanState, UmbObjectState, UmbStringState } from '@umbraco-cms/backoffice/observable-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbContextBase } from '@umbraco-cms/backoffice/class-api';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import { UMB_SECTION_CONTEXT, UMB_SECTION_SIDEBAR_CONTEXT } from '@umbraco-cms/backoffice/section';
import type { UmbSectionContext, UmbSectionSidebarContext } from '@umbraco-cms/backoffice/section';
import type { ManifestTreeItem } from '@umbraco-cms/backoffice/extension-registry';
import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_ACTION_EVENT_CONTEXT, type UmbActionEventContext } from '@umbraco-cms/backoffice/action';
import {
UmbRequestReloadChildrenOfEntityEvent,
@@ -407,6 +407,7 @@ export abstract class UmbTreeItemContextBase<
// TODO: use router context
constructPath(pathname: string, entityType: string, unique: string | null) {
// TODO: Encode uniques [NL]
return `section/${pathname}/workspace/${entityType}/edit/${unique}`;
}

View File

@@ -11,7 +11,9 @@ export * from './path/has-own-opener.function.js';
export * from './path/path-decode.function.js';
export * from './path/path-encode.function.js';
export * from './path/path-folder-name.function.js';
export * from './path/remove-initial-slash-from-path.function.js';
export * from './path/stored-path.function.js';
export * from './path/transform-server-path-to-client-path.function.js';
export * from './path/umbraco-path.function.js';
export * from './path/url-pattern-to-string.function.js';
export * from './selection-manager/selection.manager.js';

View File

@@ -1 +1,2 @@
export const decodeFilePath = (unique: string) => decodeURIComponent(unique.replace('-', '.'));
// Notice, no need to handle . or : specifically as decodeURIComponent does handle these. [NL]
export const decodeFilePath = (path: string) => decodeURIComponent(path);

View File

@@ -1,3 +1,3 @@
export const encodeFilePath = (path: string) => encodeURIComponent(path).replaceAll('.', '-');
export const encodeFilePath = (path: string) => encodeURIComponent(path).replaceAll('.', '%2E').replaceAll(':', '%3A');
export const aliasToPath = (path: string) => encodeFilePath(path);

View File

@@ -0,0 +1,3 @@
export function removeInitialSlashFromPath(path: string) {
return path.startsWith('/') ? path.slice(1) : path;
}

View File

@@ -0,0 +1,11 @@
type StringMaybeUndefined = string | undefined;
export function transformServerPathToClientPath<T extends StringMaybeUndefined>(path: T): T {
if (path?.indexOf('~/') === 0) {
path = path.slice(1) as T;
}
if (path?.indexOf('/wwwroot/') === 0) {
path = path.slice(8) as T;
}
return path;
}

View File

@@ -1,9 +1,9 @@
import { UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE } from '../../entity.js';
import { UMB_DOCUMENT_BLUEPRINT_OPTIONS_CREATE_MODAL } from './modal/index.js';
import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UMB_DOCUMENT_BLUEPRINT_ENTITY_TYPE } from '../../entity.js';
import { UMB_DOCUMENT_BLUEPRINT_OPTIONS_CREATE_MODAL } from './modal/index.js';
export class UmbCreateDocumentBlueprintEntityAction extends UmbEntityActionBase<never> {
constructor(host: UmbControllerHost, args: UmbEntityActionArgs<never>) {

View File

@@ -1,3 +1,4 @@
/*
import { UmbDashboardRedirectManagementElement } from './dashboard-redirect-management.element.js';
import { expect, fixture, html } from '@open-wc/testing';
@@ -20,3 +21,4 @@ describe('UmbDashboardRedirectManagement', () => {
});
}
});
*/

View File

@@ -1 +0,0 @@
export * from './checkbox-list/components/index.js';

View File

@@ -0,0 +1,8 @@
{
"name": "@umbraco-backoffice/property-editors",
"private": true,
"type": "module",
"scripts": {
"build": "vite build"
}
}

View File

@@ -0,0 +1,19 @@
import { defineConfig } from 'vite';
import { rmSync } from 'fs';
import { getDefaultConfig } from '../../vite-config-base';
const dist = '../../../dist-cms/packages/property-editors';
// delete the unbundled dist folder
rmSync(dist, { recursive: true, force: true });
export default defineConfig({
...getDefaultConfig({
dist,
entry: {
'entry-point': 'entry-point.ts',
'umbraco-package': 'umbraco-package.ts',
manifests: 'manifests.ts',
},
}),
});

View File

@@ -141,7 +141,7 @@ export class UmbInputStaticFileElement extends UmbFormControlMixin<string | unde
if (!item.unique) return;
return html`
<uui-ref-node name=${item.name} .detail=${this.#serializer.toServerPath(item.unique) || ''}>
<!-- TODO: implement is trashed <uui-tag size="s" slot="tag" color="danger">Trashed</uui-tag> -->
<!-- TODO: implement is trashed, if we cant retrieve the item on the server (but only ask the server if we need to anyway...). <uui-tag size="s" slot="tag" color="danger">Trashed</uui-tag> -->
<uui-action-bar slot="actions">
<uui-button
label=${this.localize.term('general_remove')}

View File

@@ -8,33 +8,56 @@ import {
type UmbPropertyEditorConfigCollection,
} from '@umbraco-cms/backoffice/property-editor';
import '../../components/input-static-file/index.js';
import { UmbServerFilePathUniqueSerializer } from '@umbraco-cms/backoffice/server-file-system';
@customElement('umb-property-editor-ui-static-file-picker')
export class UmbPropertyEditorUIStaticFilePickerElement extends UmbLitElement implements UmbPropertyEditorUiElement {
private _value: Array<string> = [];
#singleItemMode = false;
// TODO: get rid of UmbServerFilePathUniqueSerializer in v.15 [NL]
#serverFilePathUniqueSerializer = new UmbServerFilePathUniqueSerializer();
@property({ type: Array })
public set value(value: Array<string>) {
this._value = value || [];
@state()
private _value?: string | Array<string>;
@property({ attribute: false })
public set value(value: string | Array<string> | undefined) {
if (Array.isArray(value)) {
this._value = value.map((unique) => this.#serverFilePathUniqueSerializer.toUnique(unique));
} else if (value) {
this._value = this.#serverFilePathUniqueSerializer.toUnique(value);
} else {
this._value = undefined;
}
}
public get value(): Array<string> {
return this._value;
public get value(): string | Array<string> | undefined {
if (Array.isArray(this._value)) {
return this._value.map((unique) => this.#serverFilePathUniqueSerializer.toServerPath(unique) ?? '');
} else if (this._value) {
return this.#serverFilePathUniqueSerializer.toServerPath(this._value) ?? '';
} else {
return undefined;
}
}
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
this.#singleItemMode = config?.getValueByAlias<boolean>('singleItemMode') ?? false;
const validationLimit = config?.getValueByAlias<UmbNumberRangeValueType>('validationLimit');
this._limitMin = validationLimit?.min;
this._limitMax = validationLimit?.max;
this._limitMin = validationLimit?.min ?? 0;
this._limitMax = this.#singleItemMode ? 1 : validationLimit?.max ?? Infinity;
}
@state()
private _limitMin?: number;
private _limitMin: number = 0;
@state()
private _limitMax?: number;
private _limitMax: number = Infinity;
private _onChange(event: CustomEvent) {
this.value = (event.target as UmbInputStaticFileElement).selection;
if (this.#singleItemMode) {
this._value = (event.target as UmbInputStaticFileElement).selection[0];
} else {
this._value = (event.target as UmbInputStaticFileElement).selection;
}
this.dispatchEvent(new UmbPropertyValueChangeEvent());
}
@@ -42,10 +65,10 @@ export class UmbPropertyEditorUIStaticFilePickerElement extends UmbLitElement im
override render() {
return html`
<umb-input-static-file
@change=${this._onChange}
.selection=${this._value}
.selection=${this._value ? (Array.isArray(this._value) ? this._value : [this._value]) : []}
.min=${this._limitMin ?? 0}
.max=${this._limitMax ?? Infinity}></umb-input-static-file>
.max=${this._limitMax ?? Infinity}
@change=${this._onChange}></umb-input-static-file>
`;
}
}

View File

@@ -1,9 +1,3 @@
import { UmbDictionaryDetailRepository, UMB_DICTIONARY_PICKER_MODAL } from '@umbraco-cms/backoffice/dictionary';
import { customElement, property, css, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { getInsertDictionarySnippet, getInsertPartialSnippet } from '../../utils/index.js';
import {
UMB_TEMPLATING_ITEM_PICKER_MODAL,
@@ -11,6 +5,12 @@ import {
} from '../../modals/templating-item-picker/templating-item-picker-modal.token.js';
import { CodeSnippetType } from '../../types.js';
import { UMB_TEMPLATING_PAGE_FIELD_BUILDER_MODAL } from '../../modals/templating-page-field-builder/templating-page-field-builder-modal.token.js';
import { UmbDictionaryDetailRepository, UMB_DICTIONARY_PICKER_MODAL } from '@umbraco-cms/backoffice/dictionary';
import { customElement, property, css, html } from '@umbraco-cms/backoffice/external/lit';
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UMB_PARTIAL_VIEW_PICKER_MODAL } from '@umbraco-cms/backoffice/partial-view';
@customElement('umb-templating-insert-menu')

View File

@@ -1,10 +1,10 @@
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { manifests as menuManifests } from './menu/manifests.js';
import { manifests as templateManifests } from './templates/manifests.js';
import { manifests as stylesheetManifests } from './stylesheets/manifests.js';
import { manifests as partialManifests } from './partial-views/manifests.js';
import { manifests as scriptManifest } from './scripts/manifests.js';
import { manifests as modalManifests } from './modals/manifests.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestTypes> = [
...menuManifests,

View File

@@ -1,8 +1,8 @@
import { UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UMB_PARTIAL_VIEW_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
export class UmbPartialViewCreateOptionsEntityAction extends UmbEntityActionBase<never> {
constructor(host: UmbControllerHost, args: UmbEntityActionArgs<never>) {

View File

@@ -1,5 +1,5 @@
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_PARTIAL_VIEW_FOLDER_ENTITY_TYPE, UMB_PARTIAL_VIEW_ROOT_ENTITY_TYPE } from '../../entity.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestTypes> = [
{

View File

@@ -1,9 +1,9 @@
import { UmbPickerInputContext } from '@umbraco-cms/backoffice/picker-input';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_PARTIAL_VIEW_ITEM_REPOSITORY_ALIAS } from '../../repository/item/index.js';
import { UMB_PARTIAL_VIEW_PICKER_MODAL } from '../../partial-view-picker/index.js';
import type { UmbPartialViewItemModel } from '../../types.js';
import type { UmbPartialViewTreeItemModel } from '../../tree/types.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbPickerInputContext } from '@umbraco-cms/backoffice/picker-input';
export class UmbPartialViewPickerContext extends UmbPickerInputContext<
UmbPartialViewItemModel,

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbPartialViewItemModel } from '../../types.js';
import { UmbPartialViewItemServerDataSource } from './partial-view-item.server.data-source.js';
import { UMB_PARTIAL_VIEW_ITEM_STORE_CONTEXT } from './partial-view-item.store.context-token.js';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbPartialViewItemRepository extends UmbItemRepositoryBase<UmbPartialViewItemModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,5 +1,5 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbPartialViewItemStore } from './partial-view-item.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_PARTIAL_VIEW_ITEM_STORE_CONTEXT = new UmbContextToken<UmbPartialViewItemStore>(
'UmbPartialViewItemStore',

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbPartialViewItemModel } from '../../types.js';
import { UMB_PARTIAL_VIEW_ITEM_STORE_CONTEXT } from './partial-view-item.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbPartialViewDetailModel } from '../types.js';
import { UmbPartialViewDetailServerDataSource } from './partial-view-detail.server.data-source.js';
import { UMB_PARTIAL_VIEW_DETAIL_STORE_CONTEXT } from './partial-view-detail.store.context-token.js';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbPartialViewDetailRepository extends UmbDetailRepositoryBase<UmbPartialViewDetailModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,5 +1,5 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbPartialViewDetailStore } from './partial-view-detail.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_PARTIAL_VIEW_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbPartialViewDetailStore>(
'UmbPartialViewDetailStore',

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbPartialViewDetailModel } from '../types.js';
import { UMB_PARTIAL_VIEW_DETAIL_STORE_CONTEXT } from './partial-view-detail.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,5 +1,5 @@
import type { ManifestRepository, ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_PARTIAL_VIEW_FOLDER_ENTITY_TYPE } from '../../entity.js';
import type { ManifestRepository, ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const UMB_PARTIAL_VIEW_FOLDER_REPOSITORY_ALIAS = 'Umb.Repository.PartialView.Folder';

View File

@@ -1,6 +1,6 @@
import { UmbPartialViewFolderServerDataSource } from './partial-view-folder.server.data-source.js';
import { UmbFolderRepositoryBase } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbPartialViewFolderServerDataSource } from './partial-view-folder.server.data-source.js';
export class UmbPartialViewFolderRepository extends UmbFolderRepositoryBase {
constructor(host: UmbControllerHost) {

View File

@@ -1,10 +1,10 @@
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import { UMB_PARTIAL_VIEW_ROOT_ENTITY_TYPE } from '../entity.js';
import { UmbPartialViewTreeServerDataSource } from './partial-view-tree.server.data-source.js';
import type { UmbPartialViewTreeItemModel, UmbPartialViewTreeRootModel } from './types.js';
import { UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT } from './partial-view-tree.store.context-token.js';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
export class UmbPartialViewTreeRepository
extends UmbTreeRepositoryBase<UmbPartialViewTreeItemModel, UmbPartialViewTreeRootModel>

View File

@@ -1,5 +1,5 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbPartialViewTreeStore } from './partial-view-tree.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT = new UmbContextToken<UmbPartialViewTreeStore>(
'UmbPartialViewTreeStore',

View File

@@ -1,6 +1,6 @@
import { UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT } from './partial-view-tree.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbUniqueTreeStore } from '@umbraco-cms/backoffice/tree';
import { UMB_PARTIAL_VIEW_TREE_STORE_CONTEXT } from './partial-view-tree.store.context-token.js';
/**
* @export

View File

@@ -1,10 +1,10 @@
import type { UmbTemplatingInsertMenuElement } from '../../local-components/insert-menu/index.js';
import { getQuerySnippet } from '../../utils/index.js';
import { UMB_PARTIAL_VIEW_WORKSPACE_CONTEXT } from './partial-view-workspace.context-token.js';
import type { UUIInputElement } from '@umbraco-cms/backoffice/external/uui';
import { css, html, customElement, query, state, nothing } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement, umbFocus } from '@umbraco-cms/backoffice/lit-element';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import type { UmbTemplatingInsertMenuElement } from '../../local-components/insert-menu/index.js';
import { getQuerySnippet } from '../../utils/index.js';
import { UMB_PARTIAL_VIEW_WORKSPACE_CONTEXT } from './partial-view-workspace.context-token.js';
import { UMB_TEMPLATE_QUERY_BUILDER_MODAL } from '@umbraco-cms/backoffice/template';
import type { UmbCodeEditorElement } from '@umbraco-cms/backoffice/code-editor';

View File

@@ -1,7 +1,7 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
import { UMB_PARTIAL_VIEW_ENTITY_TYPE } from '../entity.js';
import type { UmbPartialViewWorkspaceContext } from './partial-view-workspace.context.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
export const UMB_PARTIAL_VIEW_WORKSPACE_CONTEXT = new UmbContextToken<
UmbSubmittableWorkspaceContext,

View File

@@ -1,8 +1,8 @@
import { UMB_SCRIPT_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbEntityActionArgs } from '@umbraco-cms/backoffice/entity-action';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UMB_SCRIPT_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
export class UmbScriptCreateOptionsEntityAction extends UmbEntityActionBase<never> {
constructor(host: UmbControllerHost, args: UmbEntityActionArgs<never>) {

View File

@@ -1,5 +1,5 @@
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_SCRIPT_FOLDER_ENTITY_TYPE, UMB_SCRIPT_ROOT_ENTITY_TYPE } from '../../entity.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestTypes> = [
{

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbScriptItemModel } from '../../types.js';
import { UmbScriptItemServerDataSource } from './script-item.server.data-source.js';
import { UMB_SCRIPT_ITEM_STORE_CONTEXT } from './script-item.store.context-token.js';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbScriptItemRepository extends UmbItemRepositoryBase<UmbScriptItemModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbScriptItemStore } from './script-item.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_SCRIPT_ITEM_STORE_CONTEXT = new UmbContextToken<UmbScriptItemStore>('UmbScriptItemStore');

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbScriptItemModel } from '../../types.js';
import { UMB_SCRIPT_ITEM_STORE_CONTEXT } from './script-item.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,8 +1,8 @@
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbScriptDetailModel } from '../types.js';
import { UMB_SCRIPT_DETAIL_STORE_CONTEXT } from './script-detail.store.context-token.js';
import { UmbScriptDetailServerDataSource } from './script-detail.server.data-source.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
export class UmbScriptDetailRepository extends UmbDetailRepositoryBase<UmbScriptDetailModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbScriptDetailStore } from './script-detail.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_SCRIPT_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbScriptDetailStore>('UmbScriptDetailStore');

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbScriptDetailModel } from '../types.js';
import { UMB_SCRIPT_DETAIL_STORE_CONTEXT } from './script-detail.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,9 +1,9 @@
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_SCRIPT_ROOT_ENTITY_TYPE } from '../entity.js';
import { UmbScriptTreeServerDataSource } from './script-tree.server.data-source.js';
import type { UmbScriptTreeItemModel, UmbScriptTreeRootModel } from './types.js';
import { UMB_SCRIPT_TREE_STORE_CONTEXT } from './script-tree.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
// TODO: TREE STORE TYPE PROBLEM:
export class UmbScriptTreeRepository extends UmbTreeRepositoryBase<UmbScriptTreeItemModel, UmbScriptTreeRootModel> {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbScriptTreeStore } from './script-tree.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_SCRIPT_TREE_STORE_CONTEXT = new UmbContextToken<UmbScriptTreeStore>('UmbScriptTreeStore');

View File

@@ -1,6 +1,6 @@
import { UMB_SCRIPT_TREE_STORE_CONTEXT } from './script-tree.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbUniqueTreeStore } from '@umbraco-cms/backoffice/tree';
import { UMB_SCRIPT_TREE_STORE_CONTEXT } from './script-tree.store.context-token.js';
/**
* @export

View File

@@ -1,6 +1,6 @@
import type { UmbScriptWorkspaceContext } from './script-workspace.context.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
import type { UmbScriptWorkspaceContext } from './script-workspace.context.js';
export const UMB_SCRIPT_WORKSPACE_CONTEXT = new UmbContextToken<UmbWorkspaceContext, UmbScriptWorkspaceContext>(
'UmbWorkspaceContext',

View File

@@ -1,6 +1,6 @@
import { UMB_STYLESHEET_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UMB_STYLESHEET_CREATE_OPTIONS_MODAL } from './options-modal/index.js';
export class UmbStylesheetCreateOptionsEntityAction extends UmbEntityActionBase<never> {
override async execute() {

View File

@@ -1,5 +1,5 @@
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_STYLESHEET_FOLDER_ENTITY_TYPE, UMB_STYLESHEET_ROOT_ENTITY_TYPE } from '../../entity.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
export const manifests: Array<ManifestTypes> = [
{

View File

@@ -1,11 +1,11 @@
import type { UmbStylesheetRule } from '../../types.js';
import { UMB_STYLESHEET_RULE_SETTINGS_MODAL } from './stylesheet-rule-settings-modal.token.js';
import { css, html, customElement, repeat, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbChangeEvent } from '@umbraco-cms/backoffice/event';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbSorterController } from '@umbraco-cms/backoffice/sorter';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UUIFormControlMixin } from '@umbraco-cms/backoffice/external/uui';
import type { UmbStylesheetRule } from '../../types.js';
import { UMB_STYLESHEET_RULE_SETTINGS_MODAL } from './stylesheet-rule-settings-modal.token.js';
@customElement('umb-stylesheet-rule-input')
export class UmbStylesheetRuleInputElement extends UUIFormControlMixin(UmbLitElement, '') {

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbStylesheetItemModel } from '../../types.js';
import { UmbStylesheetItemServerDataSource } from './stylesheet-item.server.data-source.js';
import { UMB_STYLESHEET_ITEM_STORE_CONTEXT } from './stylesheet-item.store.context-token.js';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbStylesheetItemRepository extends UmbItemRepositoryBase<UmbStylesheetItemModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbStylesheetItemStore } from './stylesheet-item.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_STYLESHEET_ITEM_STORE_CONTEXT = new UmbContextToken<UmbStylesheetItemStore>('UmbStylesheetItemStore');

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbStylesheetItemModel } from '../../types.js';
import { UMB_STYLESHEET_ITEM_STORE_CONTEXT } from './stylesheet-item.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbStylesheetDetailModel } from '../types.js';
import { UmbStylesheetDetailServerDataSource } from './stylesheet-detail.server.data-source.js';
import { UMB_STYLESHEET_DETAIL_STORE_CONTEXT } from './stylesheet-detail.store.context-token.js';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbStylesheetDetailRepository extends UmbDetailRepositoryBase<UmbStylesheetDetailModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,5 +1,5 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbStylesheetDetailStore } from './stylesheet-detail.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_STYLESHEET_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbStylesheetDetailStore>(
'UmbStylesheetDetailStore',

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbStylesheetDetailModel } from '../types.js';
import { UMB_STYLESHEET_DETAIL_STORE_CONTEXT } from './stylesheet-detail.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,9 +1,9 @@
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_STYLESHEET_ROOT_ENTITY_TYPE } from '../entity.js';
import { UmbStylesheetTreeServerDataSource } from './stylesheet-tree.server.data-source.js';
import { UMB_STYLESHEET_TREE_STORE_CONTEXT } from './stylesheet-tree.store.context-token.js';
import type { UmbStylesheetTreeItemModel, UmbStylesheetTreeRootModel } from './types.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
export class UmbStylesheetTreeRepository extends UmbTreeRepositoryBase<
UmbStylesheetTreeItemModel,

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbStylesheetTreeStore } from './stylesheet-tree.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_STYLESHEET_TREE_STORE_CONTEXT = new UmbContextToken<UmbStylesheetTreeStore>('UmbStylesheetTreeStore');

View File

@@ -1,6 +1,6 @@
import { UMB_STYLESHEET_TREE_STORE_CONTEXT } from './stylesheet-tree.store.context-token.js';
import { UmbUniqueTreeStore } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UMB_STYLESHEET_TREE_STORE_CONTEXT } from './stylesheet-tree.store.context-token.js';
/**
* @export

View File

@@ -1,7 +1,7 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
import { UMB_STYLESHEET_ENTITY_TYPE } from '../entity.js';
import type { UmbStylesheetWorkspaceContext } from './stylesheet-workspace.context.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
export const UMB_STYLESHEET_WORKSPACE_CONTEXT = new UmbContextToken<
UmbSubmittableWorkspaceContext,

View File

@@ -63,6 +63,7 @@ export class UmbStylesheetWorkspaceContext
path: 'edit/:unique',
component: UmbStylesheetWorkspaceEditorElement,
setup: (component: PageComponent, info: IRoutingInfo) => {
// TODO: Decode uniques [NL]
const unique = info.match.params.unique;
this.load(unique);
},

View File

@@ -1,6 +1,6 @@
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
import { UMB_TEMPLATE_DETAIL_REPOSITORY_ALIAS, UMB_TEMPLATE_ITEM_REPOSITORY_ALIAS } from '../repository/index.js';
import { UMB_TEMPLATE_ENTITY_TYPE, UMB_TEMPLATE_ROOT_ENTITY_TYPE } from '../entity.js';
import type { ManifestTypes } from '@umbraco-cms/backoffice/extension-registry';
const entityActions: Array<ManifestTypes> = [
{

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbTemplateDetailModel } from '../../types.js';
import { UmbTemplateServerDataSource } from './template-detail.server.data-source.js';
import { UMB_TEMPLATE_DETAIL_STORE_CONTEXT } from './template-detail.store.context-token.js';
import { UmbDetailRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbTemplateDetailRepository extends UmbDetailRepositoryBase<UmbTemplateDetailModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbTemplateDetailStore } from './template-detail.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_TEMPLATE_DETAIL_STORE_CONTEXT = new UmbContextToken<UmbTemplateDetailStore>('UmbTemplateDetailStore');

View File

@@ -1,7 +1,7 @@
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbTemplateDetailModel } from '../../types.js';
import { UMB_TEMPLATE_DETAIL_STORE_CONTEXT } from './template-detail.store.context-token.js';
import { UmbDetailStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
/**
* @export

View File

@@ -1,8 +1,8 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import { UmbTemplateItemServerDataSource } from './template-item.server.data-source.js';
import { UMB_TEMPLATE_ITEM_STORE_CONTEXT } from './template-item.store.context-token.js';
import type { UmbTemplateItemModel } from './types.js';
import { UmbItemRepositoryBase } from '@umbraco-cms/backoffice/repository';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class UmbTemplateItemRepository extends UmbItemRepositoryBase<UmbTemplateItemModel> {
constructor(host: UmbControllerHost) {

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbTemplateItemStore } from './template-item.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_TEMPLATE_ITEM_STORE_CONTEXT = new UmbContextToken<UmbTemplateItemStore>('UmbTemplateItemStore');

View File

@@ -1,7 +1,7 @@
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
import type { UmbTemplateItemModel } from './types.js';
import { UMB_TEMPLATE_ITEM_STORE_CONTEXT } from './template-item.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbItemStoreBase } from '@umbraco-cms/backoffice/store';
/**
* @export

View File

@@ -1,10 +1,10 @@
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import { UMB_TEMPLATE_ROOT_ENTITY_TYPE } from '../entity.js';
import { UmbTemplateTreeServerDataSource } from './template-tree.server.data-source.js';
import type { UmbTemplateTreeItemModel, UmbTemplateTreeRootModel } from './types.js';
import { UMB_TEMPLATE_TREE_STORE_CONTEXT } from './template-tree.store.context-token.js';
import type { UmbApi } from '@umbraco-cms/backoffice/extension-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbTreeRepositoryBase } from '@umbraco-cms/backoffice/tree';
export class UmbTemplateTreeRepository
extends UmbTreeRepositoryBase<UmbTemplateTreeItemModel, UmbTemplateTreeRootModel>

View File

@@ -1,4 +1,4 @@
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbTemplateTreeStore } from './template-tree.store.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
export const UMB_TEMPLATE_TREE_STORE_CONTEXT = new UmbContextToken<UmbTemplateTreeStore>('UmbTemplateTreeStore');

View File

@@ -1,6 +1,6 @@
import { UMB_TEMPLATE_TREE_STORE_CONTEXT } from './template-tree.store.context-token.js';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { UmbUniqueTreeStore } from '@umbraco-cms/backoffice/tree';
import { UMB_TEMPLATE_TREE_STORE_CONTEXT } from './template-tree.store.context-token.js';
/**
* @export

View File

@@ -1,3 +1,8 @@
import { UMB_TEMPLATING_SECTION_PICKER_MODAL } from '../../modals/templating-section-picker/templating-section-picker-modal.token.js';
import type { UmbTemplatingInsertMenuElement } from '../../local-components/insert-menu/insert-menu.element.js';
import { UMB_TEMPLATE_QUERY_BUILDER_MODAL } from '../modals/query-builder/index.js';
import { getQuerySnippet } from '../../utils/index.js';
import { UMB_TEMPLATE_WORKSPACE_CONTEXT } from './template-workspace.context-token.js';
import { toCamelCase } from '@umbraco-cms/backoffice/utils';
import type { UUIInputElement } from '@umbraco-cms/backoffice/external/uui';
import { css, html, customElement, query, state, nothing, ifDefined } from '@umbraco-cms/backoffice/external/lit';
@@ -5,11 +10,6 @@ import type { UmbModalManagerContext } from '@umbraco-cms/backoffice/modal';
import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';
import { UmbLitElement, umbFocus } from '@umbraco-cms/backoffice/lit-element';
import { Subject, debounceTime } from '@umbraco-cms/backoffice/external/rxjs';
import { UMB_TEMPLATING_SECTION_PICKER_MODAL } from '../../modals/templating-section-picker/templating-section-picker-modal.token.js';
import type { UmbTemplatingInsertMenuElement } from '../../local-components/insert-menu/insert-menu.element.js';
import { UMB_TEMPLATE_QUERY_BUILDER_MODAL } from '../modals/query-builder/index.js';
import { getQuerySnippet } from '../../utils/index.js';
import { UMB_TEMPLATE_WORKSPACE_CONTEXT } from './template-workspace.context-token.js';
import type { UmbCodeEditorElement } from '@umbraco-cms/backoffice/code-editor';
import { UMB_TEMPLATE_PICKER_MODAL } from '@umbraco-cms/backoffice/template';

View File

@@ -1,6 +1,6 @@
import type { UmbTemplateWorkspaceContext } from './template-workspace.context.js';
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
import type { UmbSubmittableWorkspaceContext } from '@umbraco-cms/backoffice/workspace';
import type { UmbTemplateWorkspaceContext } from './template-workspace.context.js';
export const UMB_TEMPLATE_WORKSPACE_CONTEXT = new UmbContextToken<
UmbSubmittableWorkspaceContext,

View File

@@ -14,6 +14,8 @@ export class UmbPropertyEditorUITinyMceStylesheetsConfigurationElement
extends UmbLitElement
implements UmbPropertyEditorUiElement
{
#serverFilePathUniqueSerializer = new UmbServerFilePathUniqueSerializer();
@property({ type: Array })
public set value(value: Array<string>) {
if (!value) return;
@@ -28,8 +30,6 @@ export class UmbPropertyEditorUITinyMceStylesheetsConfigurationElement
@property({ type: Object, attribute: false })
public config?: UmbPropertyEditorConfigCollection;
#serverFilePathUniqueSerializer = new UmbServerFilePathUniqueSerializer();
#onChange(event: CustomEvent) {
const target = event.target as UmbStylesheetInputElement;
this.#value = target.selection ?? [];

View File

@@ -20,9 +20,11 @@ export default {
files: ['./src/**/*.test.ts'],
nodeResolve: { exportConditions: mode === 'dev' ? ['development'] : [], preferBuiltins: false, browser: false },
browsers: [playwrightLauncher({ product: 'chromium' }), playwrightLauncher({ product: 'webkit' })],
/* TODO: fix coverage report
coverageConfig: {
reporters: ['lcovonly', 'text-summary'],
},
*/
plugins: [
importMapsPlugin({
inject: {