diff --git a/package-lock.json b/package-lock.json index 57acf6314a..df927ee676 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7807,6 +7807,10 @@ "resolved": "src/packages/documents", "link": true }, + "node_modules/@umbraco-backoffice/embedded-media": { + "resolved": "src/packages/embedded-media", + "link": true + }, "node_modules/@umbraco-backoffice/extension-insights": { "resolved": "src/packages/extension-insights", "link": true @@ -23083,6 +23087,7 @@ "src/packages/documents": { "name": "@umbraco-backoffice/document" }, + "src/packages/embedded-media": {}, "src/packages/extension-insights": { "name": "@umbraco-backoffice/extension-insights" }, diff --git a/package.json b/package.json index a282308ce3..46c2ecf12d 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "./context-api": "./dist-cms/libs/context-api/index.js", "./controller-api": "./dist-cms/libs/controller-api/index.js", "./element-api": "./dist-cms/libs/element-api/index.js", + "./embedded-media": "./dist-cms/packages/embedded-media/index.js", "./extension-api": "./dist-cms/libs/extension-api/index.js", "./formatting-api": "./dist-cms/libs/formatting-api/index.js", "./localization-api": "./dist-cms/libs/localization-api/index.js", diff --git a/src/apps/backoffice/backoffice.element.ts b/src/apps/backoffice/backoffice.element.ts index efb18e9fa6..be9cc04a29 100644 --- a/src/apps/backoffice/backoffice.element.ts +++ b/src/apps/backoffice/backoffice.element.ts @@ -17,6 +17,7 @@ const CORE_PACKAGES = [ import('../../packages/data-type/umbraco-package.js'), import('../../packages/dictionary/umbraco-package.js'), import('../../packages/documents/umbraco-package.js'), + import('../../packages/embedded-media/umbraco-package.js'), import('../../packages/extension-insights/umbraco-package.js'), import('../../packages/health-check/umbraco-package.js'), import('../../packages/help/umbraco-package.js'), diff --git a/src/packages/core/modal/common/embedded-media/manifests.ts b/src/packages/core/modal/common/embedded-media/manifests.ts deleted file mode 100644 index 9cf9968724..0000000000 --- a/src/packages/core/modal/common/embedded-media/manifests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { manifests as repositories } from './repository/manifests.js'; -import type { ManifestModal } from '@umbraco-cms/backoffice/extension-registry'; - -const modals: Array = [ - { - type: 'modal', - alias: 'Umb.Modal.EmbeddedMedia', - name: 'Embedded Media Modal', - element: () => import('./embedded-media-modal.element.js'), - }, -]; - -export const manifests = [...modals, ...repositories]; diff --git a/src/packages/core/modal/common/embedded-media/repository/index.ts b/src/packages/core/modal/common/embedded-media/repository/index.ts deleted file mode 100644 index 1a6e303708..0000000000 --- a/src/packages/core/modal/common/embedded-media/repository/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { UmbOEmbedRepository } from './oembed.repository.js'; -export { UMB_OEMBED_REPOSITORY_ALIAS } from './manifests.js'; diff --git a/src/packages/core/modal/common/index.ts b/src/packages/core/modal/common/index.ts index ae13aa6d70..3dcf1b5110 100644 --- a/src/packages/core/modal/common/index.ts +++ b/src/packages/core/modal/common/index.ts @@ -1,3 +1,2 @@ -export * from './embedded-media/index.js'; export * from './confirm/index.js'; export * from './item-picker/index.js'; diff --git a/src/packages/core/modal/common/manifests.ts b/src/packages/core/modal/common/manifests.ts index dc3b1235ed..c09e5a2f38 100644 --- a/src/packages/core/modal/common/manifests.ts +++ b/src/packages/core/modal/common/manifests.ts @@ -1,13 +1,4 @@ import { manifests as confirmManifests } from './confirm/manifests.js'; import { manifests as itemPickerManifests } from './item-picker/manifests.js'; -export const manifests: Array = [ - { - type: 'modal', - alias: 'Umb.Modal.EmbeddedMedia', - name: 'Embedded Media Modal', - element: () => import('./embedded-media/embedded-media-modal.element.js'), - }, - ...confirmManifests, - ...itemPickerManifests, -]; +export const manifests: Array = [...confirmManifests, ...itemPickerManifests]; diff --git a/src/packages/core/modal/token/index.ts b/src/packages/core/modal/token/index.ts index dcddaf3a9a..6dd5fd266d 100644 --- a/src/packages/core/modal/token/index.ts +++ b/src/packages/core/modal/token/index.ts @@ -1,3 +1,2 @@ export * from './change-password-modal.token.js'; -export * from './embedded-media-modal.token.js'; export * from './modal-token.js'; diff --git a/src/packages/core/modal/common/embedded-media/index.ts b/src/packages/embedded-media/index.ts similarity index 53% rename from src/packages/core/modal/common/embedded-media/index.ts rename to src/packages/embedded-media/index.ts index 3d76f338dd..e130217e61 100644 --- a/src/packages/core/modal/common/embedded-media/index.ts +++ b/src/packages/embedded-media/index.ts @@ -1 +1,2 @@ +export * from './modal/index.js'; export * from './repository/index.js'; diff --git a/src/packages/embedded-media/manifests.ts b/src/packages/embedded-media/manifests.ts new file mode 100644 index 0000000000..6b7cf27f51 --- /dev/null +++ b/src/packages/embedded-media/manifests.ts @@ -0,0 +1,4 @@ +import { manifests as modalManifests } from './modal/manifests.js'; +import { manifests as repositoryManifests } from './repository/manifests.js'; + +export const manifests: Array = [...modalManifests, ...repositoryManifests]; diff --git a/src/packages/core/modal/common/embedded-media/embedded-media-modal.element.ts b/src/packages/embedded-media/modal/embedded-media-modal.element.ts similarity index 97% rename from src/packages/core/modal/common/embedded-media/embedded-media-modal.element.ts rename to src/packages/embedded-media/modal/embedded-media-modal.element.ts index 9125e64aaf..fcf5ff01a6 100644 --- a/src/packages/core/modal/common/embedded-media/embedded-media-modal.element.ts +++ b/src/packages/embedded-media/modal/embedded-media-modal.element.ts @@ -1,7 +1,7 @@ -import { UmbOEmbedRepository } from './repository/oembed.repository.js'; +import { UmbOEmbedRepository } from '../repository/oembed.repository.js'; +import type { UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalValue } from './embedded-media-modal.token.js'; import { css, html, unsafeHTML, when, customElement, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; -import type { UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalValue } from '@umbraco-cms/backoffice/modal'; import { UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; import type { UUIButtonState, UUIInputEvent } from '@umbraco-cms/backoffice/external/uui'; diff --git a/src/packages/core/modal/common/embedded-media/embedded-media-modal.stories.ts b/src/packages/embedded-media/modal/embedded-media-modal.stories.ts similarity index 90% rename from src/packages/core/modal/common/embedded-media/embedded-media-modal.stories.ts rename to src/packages/embedded-media/modal/embedded-media-modal.stories.ts index ee850fdeb1..c0e8636587 100644 --- a/src/packages/core/modal/common/embedded-media/embedded-media-modal.stories.ts +++ b/src/packages/embedded-media/modal/embedded-media-modal.stories.ts @@ -1,9 +1,9 @@ import '../../../components/body-layout/body-layout.element.js'; import './embedded-media-modal.element.js'; +import type { UmbEmbeddedMediaModalData } from './embedded-media-modal.token.js'; import type { Meta } from '@storybook/web-components'; import { html } from '@umbraco-cms/backoffice/external/lit'; -import type { UmbEmbeddedMediaModalData } from '@umbraco-cms/backoffice/modal'; export default { title: 'API/Modals/Layouts/Embedded Media', diff --git a/src/packages/core/modal/token/embedded-media-modal.token.ts b/src/packages/embedded-media/modal/embedded-media-modal.token.ts similarity index 89% rename from src/packages/core/modal/token/embedded-media-modal.token.ts rename to src/packages/embedded-media/modal/embedded-media-modal.token.ts index 0fb7df92ca..25737bbcbf 100644 --- a/src/packages/core/modal/token/embedded-media-modal.token.ts +++ b/src/packages/embedded-media/modal/embedded-media-modal.token.ts @@ -1,4 +1,4 @@ -import { UmbModalToken } from './modal-token.js'; +import { UmbModalToken } from '@umbraco-cms/backoffice/modal'; export interface UmbEmbeddedMediaModalData extends Partial { url?: string; diff --git a/src/packages/embedded-media/modal/index.ts b/src/packages/embedded-media/modal/index.ts new file mode 100644 index 0000000000..363deb1226 --- /dev/null +++ b/src/packages/embedded-media/modal/index.ts @@ -0,0 +1 @@ +export * from './embedded-media-modal.token.js'; diff --git a/src/packages/embedded-media/modal/manifests.ts b/src/packages/embedded-media/modal/manifests.ts new file mode 100644 index 0000000000..aef2dbd580 --- /dev/null +++ b/src/packages/embedded-media/modal/manifests.ts @@ -0,0 +1,8 @@ +export const manifests: Array = [ + { + type: 'modal', + alias: 'Umb.Modal.EmbeddedMedia', + name: 'Embedded Media Modal', + element: () => import('./embedded-media-modal.element.js'), + }, +]; diff --git a/src/packages/embedded-media/package.json b/src/packages/embedded-media/package.json new file mode 100644 index 0000000000..6c7a488f0f --- /dev/null +++ b/src/packages/embedded-media/package.json @@ -0,0 +1,8 @@ +{ + "name": "@umbraco-backoffice/embedded-media", + "private": true, + "type": "module", + "scripts": { + "build": "vite build" + } +} \ No newline at end of file diff --git a/src/packages/embedded-media/repository/constants.ts b/src/packages/embedded-media/repository/constants.ts new file mode 100644 index 0000000000..a28213cbcd --- /dev/null +++ b/src/packages/embedded-media/repository/constants.ts @@ -0,0 +1 @@ +export const UMB_OEMBED_REPOSITORY_ALIAS = 'Umb.Repository.OEmbed'; diff --git a/src/packages/embedded-media/repository/index.ts b/src/packages/embedded-media/repository/index.ts new file mode 100644 index 0000000000..7b45174122 --- /dev/null +++ b/src/packages/embedded-media/repository/index.ts @@ -0,0 +1,2 @@ +export * from './oembed.repository.js'; +export * from './constants.js'; diff --git a/src/packages/core/modal/common/embedded-media/repository/manifests.ts b/src/packages/embedded-media/repository/manifests.ts similarity index 74% rename from src/packages/core/modal/common/embedded-media/repository/manifests.ts rename to src/packages/embedded-media/repository/manifests.ts index 39720a3494..364aeb3893 100644 --- a/src/packages/core/modal/common/embedded-media/repository/manifests.ts +++ b/src/packages/embedded-media/repository/manifests.ts @@ -1,4 +1,4 @@ -export const UMB_OEMBED_REPOSITORY_ALIAS = 'Umb.Repository.OEmbed'; +import { UMB_OEMBED_REPOSITORY_ALIAS } from './constants.js'; export const manifests: Array = [ { diff --git a/src/packages/core/modal/common/embedded-media/repository/oembed.repository.ts b/src/packages/embedded-media/repository/oembed.repository.ts similarity index 100% rename from src/packages/core/modal/common/embedded-media/repository/oembed.repository.ts rename to src/packages/embedded-media/repository/oembed.repository.ts diff --git a/src/packages/core/modal/common/embedded-media/repository/oembed.server.data.ts b/src/packages/embedded-media/repository/oembed.server.data.ts similarity index 100% rename from src/packages/core/modal/common/embedded-media/repository/oembed.server.data.ts rename to src/packages/embedded-media/repository/oembed.server.data.ts diff --git a/src/packages/embedded-media/umbraco-package.ts b/src/packages/embedded-media/umbraco-package.ts new file mode 100644 index 0000000000..ca74b9b9ab --- /dev/null +++ b/src/packages/embedded-media/umbraco-package.ts @@ -0,0 +1,9 @@ +export const name = 'Umbraco.Core.EmbeddedMedia'; +export const extensions = [ + { + name: 'Embedded Media Bundle', + alias: 'Umb.Bundle.EmbeddedMedia', + type: 'bundle', + js: () => import('./manifests.js'), + }, +]; diff --git a/src/packages/embedded-media/vite.config.ts b/src/packages/embedded-media/vite.config.ts new file mode 100644 index 0000000000..365fefd614 --- /dev/null +++ b/src/packages/embedded-media/vite.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'vite'; +import { rmSync } from 'fs'; +import { getDefaultConfig } from '../../vite-config-base'; + +const dist = '../../../dist-cms/packages/embedded-media'; + +// delete the unbundled dist folder +rmSync(dist, { recursive: true, force: true }); + +export default defineConfig({ + ...getDefaultConfig({ dist }), +}); diff --git a/src/packages/tiny-mce/plugins/tiny-mce-embeddedmedia.plugin.ts b/src/packages/tiny-mce/plugins/tiny-mce-embeddedmedia.plugin.ts index 8995fc66b9..e451c9d6d7 100644 --- a/src/packages/tiny-mce/plugins/tiny-mce-embeddedmedia.plugin.ts +++ b/src/packages/tiny-mce/plugins/tiny-mce-embeddedmedia.plugin.ts @@ -1,7 +1,8 @@ import { type TinyMcePluginArguments, UmbTinyMcePluginBase } from '../components/input-tiny-mce/tiny-mce-plugin.js'; import { UmbLocalizationController } from '@umbraco-cms/backoffice/localization-api'; -import type { UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalValue } from '@umbraco-cms/backoffice/modal'; -import { UMB_EMBEDDED_MEDIA_MODAL, UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; +import type { UmbEmbeddedMediaModalData, UmbEmbeddedMediaModalValue } from '@umbraco-cms/backoffice/embedded-media'; +import { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal'; +import { UMB_EMBEDDED_MEDIA_MODAL } from '@umbraco-cms/backoffice/embedded-media'; export default class UmbTinyMceEmbeddedMediaPlugin extends UmbTinyMcePluginBase { constructor(args: TinyMcePluginArguments) { diff --git a/tsconfig.json b/tsconfig.json index d6914be56f..bdb2097f8f 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,6 +38,7 @@ DON'T EDIT THIS FILE DIRECTLY. It is generated by /devops/tsconfig/index.js "@umbraco-cms/backoffice/context-api": ["./src/libs/context-api/index.ts"], "@umbraco-cms/backoffice/controller-api": ["./src/libs/controller-api/index.ts"], "@umbraco-cms/backoffice/element-api": ["./src/libs/element-api/index.ts"], + "@umbraco-cms/backoffice/embedded-media": ["./src/packages/embedded-media/index.ts"], "@umbraco-cms/backoffice/extension-api": ["./src/libs/extension-api/index.ts"], "@umbraco-cms/backoffice/formatting-api": ["./src/libs/formatting-api/index.ts"], "@umbraco-cms/backoffice/localization-api": ["./src/libs/localization-api/index.ts"],