@umbraco-cms/backoffice 14.0.0--preview004-ec083258 → 14.0.0--preview004-81abec6d

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.
@@ -0,0 +1,47 @@
1
+ :root {
2
+ --uui-color-selected: #316dca;
3
+ --uui-color-selected-emphasis: #3e79d0;
4
+ --uui-color-selected-standalone: #5b8dd7;
5
+ --uui-color-selected-contrast: #eeeeef;
6
+ --uui-color-current: #316dca;
7
+ --uui-color-current-emphasis: #3e79d0;
8
+ --uui-color-current-standalone: #5b8dd7;
9
+ --uui-color-current-contrast: #f000;
10
+ --uui-color-disabled: #434c56;
11
+ --uui-color-disabled-standalone: #545d68;
12
+ --uui-color-disabled-contrast: #fcfcfc4d;
13
+ --uui-color-header-surface: #21262e;
14
+ --uui-color-header-contrast: #eeeeef;
15
+ --uui-color-header-contrast-emphasis: #eeeeef;
16
+ --uui-color-focus: #316dca;
17
+ --uui-color-surface: #2d333b;
18
+ --uui-color-surface-alt: #373e47;
19
+ --uui-color-surface-emphasis: #434c56;
20
+ --uui-color-background: #21262e;
21
+ --uui-color-text: #eeeeef;
22
+ --uui-color-text-alt: #eeeeef;
23
+ --uui-color-interactive: #eeeeef;
24
+ --uui-color-interactive-emphasis: #eeeeef;
25
+ --uui-color-border: #434c56;
26
+ --uui-color-border-standalone: #545d68;
27
+ --uui-color-border-emphasis: #626e7b;
28
+ --uui-color-divider: #373e47;
29
+ --uui-color-divider-standalone: #434c56;
30
+ --uui-color-divider-emphasis: #545d68;
31
+ --uui-color-default: #316dca;
32
+ --uui-color-default-emphasis: #316dca;
33
+ --uui-color-default-standalone: #316dca;
34
+ --uui-color-default-contrast: #eeeeef;
35
+ --uui-color-warning: #af7c12;
36
+ --uui-color-warning-emphasis: #af7c12;
37
+ --uui-color-warning-standalone: #af7c12;
38
+ --uui-color-warning-contrast: #eeeeef;
39
+ --uui-color-danger: #ca3b37;
40
+ --uui-color-danger-emphasis: #ca3b37;
41
+ --uui-color-danger-standalone: #ca3b37;
42
+ --uui-color-danger-contrast: #eeeeef;
43
+ --uui-color-positive: #347d39;
44
+ --uui-color-positive-emphasis: #347d39;
45
+ --uui-color-positive-standalone: #347d39;
46
+ --uui-color-positive-contrast: #eeeeef;
47
+ }
@@ -0,0 +1,53 @@
1
+ :root {
2
+ --uui-color-selected: var(--uui-palette-violet-blue, #3544b1);
3
+ --uui-color-selected-emphasis: var(--uui-palette-violet-blue-light, rgb(70, 86, 200));
4
+ --uui-color-selected-standalone: var(--uui-palette-violet-blue-dark, rgb(54, 65, 156));
5
+ --uui-color-selected-contrast: #fff;
6
+ --uui-color-current: var(--uui-palette-spanish-pink, #f5c1bc);
7
+ --uui-color-current-emphasis: var(--uui-palette-spanish-pink-light, rgb(248, 214, 211));
8
+ --uui-color-current-standalone: var(--uui-palette-spanish-pink-dark, rgb(232, 192, 189));
9
+ --uui-color-current-contrast: var(--uui-palette-space-cadet, #1b264f);
10
+ --uui-color-disabled: var(--uui-palette-sand, #f3f3f5);
11
+ --uui-color-disabled-standalone: var(--uui-palette-sand-dark, rgb(226, 226, 226));
12
+ --uui-color-disabled-contrast: var(--uui-palette-grey, #c4c4c4);
13
+ --uui-color-header-surface: var(--uui-palette-space-cadet, #1b264f);
14
+ --uui-color-header-contrast: #fff;
15
+ --uui-color-header-contrast-emphasis: #fff;
16
+ --uui-color-focus: var(--uui-palette-malibu, #3879ff);
17
+ --uui-color-surface: #fff;
18
+ --uui-color-surface-alt: #fff;
19
+ --uui-color-surface-emphasis: #dadada;
20
+ --uui-color-background: #fff;
21
+ --uui-color-text: var(--uui-palette-black, #060606);
22
+ --uui-color-text-alt: var(--uui-palette-dune-black, #2e2b29);
23
+ --uui-color-interactive: var(--uui-palette-space-cadet, #1b264f);
24
+ --uui-color-interactive-emphasis: var(--uui-palette-violet-blue, #3544b1);
25
+ --uui-color-border: #000000;
26
+ --uui-color-border-standalone: #000000;
27
+ --uui-color-border-emphasis: #000000;
28
+ --uui-color-divider: #000000;
29
+ --uui-color-divider-standalone: #000000;
30
+ --uui-color-divider-emphasis: #000000;
31
+ --uui-color-default: var(--uui-palette-space-cadet, #1b264f);
32
+ --uui-color-default-emphasis: var(--uui-palette-violet-blue, #3544b1);
33
+ --uui-color-default-standalone: var(--uui-palette-space-cadet-dark, rgb(28, 35, 59));
34
+ --uui-color-default-contrast: #fff;
35
+ --uui-color-warning: #ffd621;
36
+ --uui-color-warning-emphasis: #ffdc41;
37
+ --uui-color-warning-standalone: #ffdd43;
38
+ --uui-color-warning-contrast: #000;
39
+ --uui-color-danger: #c60239;
40
+ --uui-color-danger-emphasis: #da114a;
41
+ --uui-color-danger-standalone: #d0003b;
42
+ --uui-color-danger-contrast: white;
43
+ --uui-color-positive: #0d8844;
44
+ --uui-color-positive-emphasis: #159c52;
45
+ --uui-color-positive-standalone: #1cae5e;
46
+ --uui-color-positive-contrast: #fff;
47
+
48
+ --uui-shadow-depth-1: 0 0 0px 1px black;
49
+ --uui-shadow-depth-2: 0 0 0px 1px black;
50
+ --uui-shadow-depth-3: 0 0 0px 1px black;
51
+ --uui-shadow-depth-4: 0 0 0px 1px black;
52
+ --uui-shadow-depth-5: 0 0 0px 1px black;
53
+ }
@@ -1,3 +1,3 @@
1
- import type { UmbApi } from "../models/api.interface.js";
2
- import type { ApiLoaderProperty, ClassConstructor, ElementAndApiLoaderProperty } from "../types/utils.js";
1
+ import type { UmbApi } from '../models/api.interface.js';
2
+ import type { ApiLoaderProperty, ClassConstructor, ElementAndApiLoaderProperty } from '../types/utils.js';
3
3
  export declare function loadManifestApi<ApiType extends UmbApi>(property: ApiLoaderProperty<ApiType> | ElementAndApiLoaderProperty<any, ApiType>): Promise<ClassConstructor<ApiType> | undefined>;
@@ -9,7 +9,8 @@ export async function loadManifestApi(property) {
9
9
  // Promise function
10
10
  const result = await property();
11
11
  if (typeof result === 'object' && result != null) {
12
- const exportValue = 'api' in result ? result.api : undefined || 'default' in result ? result.default : undefined;
12
+ const exportValue = ('api' in result ? result.api : undefined) ||
13
+ ('default' in result ? result.default : undefined);
13
14
  if (exportValue && typeof exportValue === 'function') {
14
15
  return exportValue;
15
16
  }
@@ -19,8 +20,8 @@ export async function loadManifestApi(property) {
19
20
  else if (propType === 'string') {
20
21
  // Import string
21
22
  const result = await import(/* @vite-ignore */ property);
22
- if (typeof result === 'object' && result != null) {
23
- const exportValue = 'api' in result ? result.api : undefined || 'default' in result ? result.default : undefined;
23
+ if (result && typeof result === 'object') {
24
+ const exportValue = ('api' in result ? result.api : undefined) || ('default' in result ? result.default : undefined);
24
25
  if (exportValue && typeof exportValue === 'function') {
25
26
  return exportValue;
26
27
  }
@@ -1,2 +1,2 @@
1
- import type { ClassConstructor, ElementAndApiLoaderProperty, ElementLoaderProperty } from "../types/utils.js";
1
+ import type { ClassConstructor, ElementAndApiLoaderProperty, ElementLoaderProperty } from '../types/utils.js';
2
2
  export declare function loadManifestElement<ElementType extends HTMLElement>(property: ElementLoaderProperty<ElementType> | ElementAndApiLoaderProperty<ElementType>): Promise<ClassConstructor<ElementType> | undefined>;
@@ -9,7 +9,8 @@ export async function loadManifestElement(property) {
9
9
  // Promise function
10
10
  const result = await property();
11
11
  if (typeof result === 'object' && result !== null) {
12
- const exportValue = 'element' in result ? result.element : undefined || 'default' in result ? result.default : undefined;
12
+ const exportValue = ('element' in result ? result.element : undefined) ||
13
+ ('default' in result ? result.default : undefined);
13
14
  if (exportValue && typeof exportValue === 'function') {
14
15
  return exportValue;
15
16
  }
@@ -18,9 +19,10 @@ export async function loadManifestElement(property) {
18
19
  }
19
20
  else if (propType === 'string') {
20
21
  // Import string
21
- const result = await import(/* @vite-ignore */ property);
22
- if (typeof result === 'object' && result != null) {
23
- const exportValue = 'element' in result ? result.element : undefined || 'default' in result ? result.default : undefined;
22
+ const result = await import(
23
+ /* @vite-ignore */ property);
24
+ if (result && typeof result === 'object') {
25
+ const exportValue = ('element' in result ? result.element : undefined) || ('default' in result ? result.default : undefined);
24
26
  if (exportValue && typeof exportValue === 'function') {
25
27
  return exportValue;
26
28
  }
@@ -1,2 +1,2 @@
1
- import type { JsLoaderProperty } from "../types/utils.js";
2
- export declare function loadManifestPlainCss<CssType = string>(property: JsLoaderProperty<CssType>): Promise<CssType | undefined>;
1
+ import type { CssLoaderProperty } from '../types/utils.js';
2
+ export declare function loadManifestPlainCss<CssType extends string>(property: CssLoaderProperty<CssType>): Promise<CssType | undefined>;
@@ -1,16 +1,23 @@
1
1
  export async function loadManifestPlainCss(property) {
2
2
  const propType = typeof property;
3
3
  if (propType === 'function') {
4
+ // Promise function
4
5
  const result = await property();
5
- if (result != null) {
6
- return result;
6
+ if (typeof result === 'object' && result != null) {
7
+ const exportValue = ('css' in result ? result.css : undefined) || ('default' in result ? result.default : undefined);
8
+ if (exportValue && typeof exportValue === 'string') {
9
+ return exportValue;
10
+ }
7
11
  }
8
12
  }
9
13
  else if (propType === 'string') {
10
14
  // Import string
11
15
  const result = await import(/* @vite-ignore */ property);
12
- if (result != null) {
13
- return result;
16
+ if (typeof result === 'object' && result != null) {
17
+ const exportValue = ('css' in result ? result.css : undefined) || ('default' in result ? result.default : undefined);
18
+ if (exportValue && typeof exportValue === 'string') {
19
+ return exportValue;
20
+ }
14
21
  }
15
22
  }
16
23
  return undefined;
@@ -1,2 +1,2 @@
1
- import type { JsLoaderProperty } from "../types/utils.js";
1
+ import type { JsLoaderProperty } from '../types/utils.js';
2
2
  export declare function loadManifestPlainJs<JsType extends object>(property: JsLoaderProperty<JsType>): Promise<JsType | undefined>;
@@ -1,6 +1,7 @@
1
1
  export async function loadManifestPlainJs(property) {
2
2
  const propType = typeof property;
3
3
  if (propType === 'function') {
4
+ // Promise function
4
5
  const result = await property();
5
6
  if (typeof result === 'object' && result != null) {
6
7
  return result;
@@ -16,12 +16,12 @@ export interface ManifestElementWithElementName extends ManifestElement {
16
16
  */
17
17
  elementName: string;
18
18
  }
19
- export interface ManifestPlainCss<CssType = unknown> extends ManifestBase {
19
+ export interface ManifestPlainCss extends ManifestBase {
20
20
  /**
21
21
  * The file location of the stylesheet file to load
22
22
  * @TJS-type string
23
23
  */
24
- css?: CssLoaderProperty<CssType>;
24
+ css?: CssLoaderProperty;
25
25
  }
26
26
  export interface ManifestPlainJs<JsType> extends ManifestBase {
27
27
  /**
@@ -1,31 +1,36 @@
1
- import type { UmbApi } from "../models/index.js";
1
+ import type { UmbApi } from '../models/index.js';
2
2
  export type HTMLElementConstructor<T = HTMLElement> = new (...args: any[]) => T;
3
3
  export type ClassConstructor<T = object> = new (...args: any[]) => T;
4
- export type ElementLoaderExports<ElementType extends HTMLElement = HTMLElement> = ({
4
+ export type CssLoaderExports<CssType extends string = string> = {
5
+ default: CssType;
6
+ } | {
7
+ css: CssType;
8
+ };
9
+ export type ElementLoaderExports<ElementType extends HTMLElement = HTMLElement> = {
5
10
  default: ClassConstructor<ElementType>;
6
11
  } | {
7
12
  element: ClassConstructor<ElementType>;
8
- });
9
- export type ApiLoaderExports<ApiType extends UmbApi = UmbApi> = ({
13
+ };
14
+ export type ApiLoaderExports<ApiType extends UmbApi = UmbApi> = {
10
15
  default: ClassConstructor<ApiType>;
11
16
  } | {
12
17
  api: ClassConstructor<ApiType>;
13
- });
14
- export type ElementAndApiLoaderExports<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = ({
18
+ };
19
+ export type ElementAndApiLoaderExports<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = {
15
20
  api: ClassConstructor<ApiType>;
16
21
  } | {
17
22
  element: ClassConstructor<ElementType>;
18
23
  } | {
19
24
  api: ClassConstructor<ApiType>;
20
25
  element: ClassConstructor<ElementType>;
21
- });
22
- export type CssLoaderPromise<CssType = unknown> = (() => Promise<CssType>);
23
- export type JsLoaderPromise<JsType> = (() => Promise<JsType>);
24
- export type ElementLoaderPromise<ElementType extends HTMLElement = HTMLElement> = (() => Promise<ElementLoaderExports<ElementType>>);
25
- export type ApiLoaderPromise<ApiType extends UmbApi = UmbApi> = (() => Promise<ApiLoaderExports<ApiType>>);
26
- export type ElementAndApiLoaderPromise<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = (() => Promise<ElementAndApiLoaderExports<ElementType, ApiType>>);
27
- export type CssLoaderProperty<CssType = string> = (string | CssLoaderPromise<CssType>);
28
- export type JsLoaderProperty<JsType> = (string | JsLoaderPromise<JsType>);
29
- export type ElementLoaderProperty<ElementType extends HTMLElement = HTMLElement> = (string | ElementLoaderPromise<ElementType> | ClassConstructor<ElementType>);
30
- export type ApiLoaderProperty<ApiType extends UmbApi = UmbApi> = (string | ApiLoaderPromise<ApiType> | ClassConstructor<ApiType>);
31
- export type ElementAndApiLoaderProperty<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = (string | ElementAndApiLoaderPromise<ElementType, ApiType> | ElementLoaderPromise<ElementType> | ApiLoaderPromise<ApiType>);
26
+ };
27
+ export type CssLoaderPromise<CssType extends string = string> = () => Promise<CssLoaderExports<CssType>>;
28
+ export type JsLoaderPromise<JsExportType> = () => Promise<JsExportType>;
29
+ export type ElementLoaderPromise<ElementType extends HTMLElement = HTMLElement> = () => Promise<ElementLoaderExports<ElementType>>;
30
+ export type ApiLoaderPromise<ApiType extends UmbApi = UmbApi> = () => Promise<ApiLoaderExports<ApiType>>;
31
+ export type ElementAndApiLoaderPromise<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = () => Promise<ElementAndApiLoaderExports<ElementType, ApiType>>;
32
+ export type CssLoaderProperty<CssType extends string = string> = string | CssLoaderPromise<CssType>;
33
+ export type JsLoaderProperty<JsExportType> = string | JsLoaderPromise<JsExportType>;
34
+ export type ElementLoaderProperty<ElementType extends HTMLElement = HTMLElement> = string | ElementLoaderPromise<ElementType> | ClassConstructor<ElementType>;
35
+ export type ApiLoaderProperty<ApiType extends UmbApi = UmbApi> = string | ApiLoaderPromise<ApiType> | ClassConstructor<ApiType>;
36
+ export type ElementAndApiLoaderProperty<ElementType extends HTMLElement = HTMLElement, ApiType extends UmbApi = UmbApi> = string | ElementAndApiLoaderPromise<ElementType, ApiType> | ElementLoaderPromise<ElementType> | ApiLoaderPromise<ApiType>;
@@ -2,6 +2,6 @@ import type { ManifestPlainCss } from '../../../../libs/extension-api/index.js';
2
2
  /**
3
3
  * Theme manifest for styling the backoffice of Umbraco such as dark, high contrast etc
4
4
  */
5
- export interface ManifestTheme extends ManifestPlainCss<string> {
5
+ export interface ManifestTheme extends ManifestPlainCss {
6
6
  type: 'theme';
7
7
  }
@@ -75,7 +75,8 @@ export let UmbSectionMainViewElement = class UmbSectionMainViewElement extends U
75
75
  : html `${nothing}`;
76
76
  }
77
77
  #renderDashboards() {
78
- return this._dashboards.length > 0
78
+ // Only show dashboards if there are more than one dashboard or if there are both dashboards and views
79
+ return (this._dashboards.length > 0 && this._views.length > 0) || this._dashboards.length > 1
79
80
  ? html `
80
81
  <uui-tab-group slot="header" id="dashboards">
81
82
  ${this._dashboards.map((dashboard) => {
@@ -93,7 +94,8 @@ export let UmbSectionMainViewElement = class UmbSectionMainViewElement extends U
93
94
  : '';
94
95
  }
95
96
  #renderViews() {
96
- return this._views.length > 0
97
+ // Only show views if there are more than one view or if there are both dashboards and views
98
+ return (this._views.length > 0 && this._dashboards.length > 0) || this._views.length > 1
97
99
  ? html `
98
100
  <uui-tab-group slot="navigation" id="views">
99
101
  ${this._views.map((view) => {
@@ -15,14 +15,14 @@ export const themes = [
15
15
  type: 'theme',
16
16
  alias: 'umb-dark-theme',
17
17
  name: 'Dark',
18
- css: 'src/packages/settings/themes/themes/dark.theme.css',
18
+ css: '/umbraco/backoffice/css/dark.theme.css',
19
19
  weight: 200,
20
20
  },
21
21
  {
22
22
  type: 'theme',
23
23
  alias: 'umb-high-contrast-theme',
24
24
  name: 'High contrast',
25
- css: 'src/packages/settings/themes/themes/high-contrast.theme.css',
25
+ css: '/umbraco/backoffice/css/high-contrast.theme.css',
26
26
  weight: 100,
27
27
  },
28
28
  ];
@@ -32,13 +32,15 @@ export class UmbThemeContext extends UmbBaseController {
32
32
  if (themes.length > 0 && themes[0].css) {
33
33
  const activeTheme = themes[0];
34
34
  if (typeof activeTheme.css === 'function') {
35
- const styleEl = (this.#styleElement = document.createElement('style'));
36
- styleEl.setAttribute('type', 'text/css');
37
- document.head.appendChild(styleEl);
35
+ this.#styleElement = document.createElement('style');
36
+ // We store the current style element so we can check if it has been replaced by another theme in between.
37
+ const currentStyleEl = this.#styleElement;
38
+ currentStyleEl.setAttribute('type', 'text/css');
38
39
  const result = await loadManifestPlainCss(activeTheme.css);
39
40
  // Checking that this is still our styleElement, it has not been replaced with another theme in between.
40
- if (result && styleEl === this.#styleElement) {
41
- styleEl.appendChild(document.createTextNode(result));
41
+ if (result && currentStyleEl === this.#styleElement) {
42
+ currentStyleEl.appendChild(document.createTextNode(result));
43
+ document.head.appendChild(currentStyleEl);
42
44
  }
43
45
  }
44
46
  else if (typeof activeTheme.css === 'string') {
@@ -49,16 +51,22 @@ export class UmbThemeContext extends UmbBaseController {
49
51
  }
50
52
  }
51
53
  else {
54
+ console.log('remove style element', this.#styleElement);
55
+ // We could not load a theme for this alias, so we remove the theme.
52
56
  localStorage.removeItem(LOCAL_STORAGE_KEY);
53
57
  this.#styleElement?.childNodes.forEach((node) => node.remove());
54
58
  this.#styleElement?.setAttribute('href', '');
59
+ this.#styleElement = null;
55
60
  }
56
61
  });
57
62
  }
58
63
  else {
64
+ // Super clean, we got a falsy value, so we remove the theme.
59
65
  localStorage.removeItem(LOCAL_STORAGE_KEY);
66
+ this.#styleElement?.remove();
60
67
  this.#styleElement?.childNodes.forEach((node) => node.remove());
61
68
  this.#styleElement?.setAttribute('href', '');
69
+ this.#styleElement = null;
62
70
  }
63
71
  }
64
72
  }