@univerjs-pro/embed-ui 1.0.0-alpha.3
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.
- package/README.md +46 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/locale/ar-SA.js +1 -0
- package/lib/cjs/locale/ca-ES.js +1 -0
- package/lib/cjs/locale/de-DE.js +1 -0
- package/lib/cjs/locale/en-US.js +1 -0
- package/lib/cjs/locale/es-ES.js +1 -0
- package/lib/cjs/locale/fa-IR.js +1 -0
- package/lib/cjs/locale/fr-FR.js +1 -0
- package/lib/cjs/locale/id-ID.js +1 -0
- package/lib/cjs/locale/it-IT.js +1 -0
- package/lib/cjs/locale/ja-JP.js +1 -0
- package/lib/cjs/locale/ko-KR.js +1 -0
- package/lib/cjs/locale/pl-PL.js +1 -0
- package/lib/cjs/locale/pt-BR.js +1 -0
- package/lib/cjs/locale/ru-RU.js +1 -0
- package/lib/cjs/locale/sk-SK.js +1 -0
- package/lib/cjs/locale/vi-VN.js +1 -0
- package/lib/cjs/locale/zh-CN.js +1 -0
- package/lib/cjs/locale/zh-HK.js +1 -0
- package/lib/cjs/locale/zh-TW.js +1 -0
- package/lib/es/index.js +1 -0
- package/lib/es/locale/ar-SA.js +1 -0
- package/lib/es/locale/ca-ES.js +1 -0
- package/lib/es/locale/de-DE.js +1 -0
- package/lib/es/locale/en-US.js +1 -0
- package/lib/es/locale/es-ES.js +1 -0
- package/lib/es/locale/fa-IR.js +1 -0
- package/lib/es/locale/fr-FR.js +1 -0
- package/lib/es/locale/id-ID.js +1 -0
- package/lib/es/locale/it-IT.js +1 -0
- package/lib/es/locale/ja-JP.js +1 -0
- package/lib/es/locale/ko-KR.js +1 -0
- package/lib/es/locale/pl-PL.js +1 -0
- package/lib/es/locale/pt-BR.js +1 -0
- package/lib/es/locale/ru-RU.js +1 -0
- package/lib/es/locale/sk-SK.js +1 -0
- package/lib/es/locale/vi-VN.js +1 -0
- package/lib/es/locale/zh-CN.js +1 -0
- package/lib/es/locale/zh-HK.js +1 -0
- package/lib/es/locale/zh-TW.js +1 -0
- package/lib/index.css +1058 -0
- package/lib/index.js +1 -0
- package/lib/locale/ar-SA.js +1 -0
- package/lib/locale/ca-ES.js +1 -0
- package/lib/locale/de-DE.js +1 -0
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/es-ES.js +1 -0
- package/lib/locale/fa-IR.js +1 -0
- package/lib/locale/fr-FR.js +1 -0
- package/lib/locale/id-ID.js +1 -0
- package/lib/locale/it-IT.js +1 -0
- package/lib/locale/ja-JP.js +1 -0
- package/lib/locale/ko-KR.js +1 -0
- package/lib/locale/pl-PL.js +1 -0
- package/lib/locale/pt-BR.js +1 -0
- package/lib/locale/ru-RU.js +1 -0
- package/lib/locale/sk-SK.js +1 -0
- package/lib/locale/vi-VN.js +1 -0
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-HK.js +1 -0
- package/lib/locale/zh-TW.js +1 -0
- package/lib/types/common/const.d.ts +1 -0
- package/lib/types/common/embed-float-interaction-policy.d.ts +13 -0
- package/lib/types/common/embed-host-chrome-policy.d.ts +19 -0
- package/lib/types/common/embed-runtime-policy.d.ts +13 -0
- package/lib/types/common/embed-runtime-slots.d.ts +9 -0
- package/lib/types/common/tab-peer-workbench.d.ts +6 -0
- package/lib/types/components/EmbedFloatDomRenderer.d.ts +50 -0
- package/lib/types/components/EmbedFloatFullscreenButton.d.ts +16 -0
- package/lib/types/components/EmbedHostToolbarMenu.d.ts +37 -0
- package/lib/types/components/EmbedRuntimeProviders.d.ts +9 -0
- package/lib/types/config/config.d.ts +10 -0
- package/lib/types/controllers/docs-table-passive-wheel-bridge.controller.d.ts +7 -0
- package/lib/types/controllers/embed-host-anchor-cleanup.controller.d.ts +7 -0
- package/lib/types/controllers/embed-host-ribbon-override.controller.d.ts +14 -0
- package/lib/types/index.d.ts +11 -0
- package/lib/types/locale/ar-SA.d.ts +3 -0
- package/lib/types/locale/ca-ES.d.ts +3 -0
- package/lib/types/locale/de-DE.d.ts +3 -0
- package/lib/types/locale/en-US.d.ts +78 -0
- package/lib/types/locale/es-ES.d.ts +3 -0
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/locale/fr-FR.d.ts +3 -0
- package/lib/types/locale/id-ID.d.ts +3 -0
- package/lib/types/locale/it-IT.d.ts +3 -0
- package/lib/types/locale/ja-JP.d.ts +3 -0
- package/lib/types/locale/ko-KR.d.ts +3 -0
- package/lib/types/locale/pl-PL.d.ts +3 -0
- package/lib/types/locale/pt-BR.d.ts +3 -0
- package/lib/types/locale/ru-RU.d.ts +3 -0
- package/lib/types/locale/sk-SK.d.ts +3 -0
- package/lib/types/locale/types.d.ts +3 -0
- package/lib/types/locale/vi-VN.d.ts +3 -0
- package/lib/types/locale/zh-CN.d.ts +3 -0
- package/lib/types/locale/zh-HK.d.ts +3 -0
- package/lib/types/locale/zh-TW.d.ts +3 -0
- package/lib/types/plugin.d.ts +22 -0
- package/lib/types/product-menus/docs-product-menus.d.ts +2 -0
- package/lib/types/products/bases/EmbedChildView.d.ts +13 -0
- package/lib/types/products/bases/EmbedFloatingMenu.d.ts +36 -0
- package/lib/types/products/bases/embed-block.d.ts +2 -0
- package/lib/types/products/bases/embed-content-size.d.ts +9 -0
- package/lib/types/products/bases/embed-host-adapter.d.ts +6 -0
- package/lib/types/products/bases/embed-passive-viewport.d.ts +3 -0
- package/lib/types/products/bases/register.d.ts +13 -0
- package/lib/types/products/docs/EmbedDocsCustomBlockRenderer.d.ts +38 -0
- package/lib/types/products/docs/EmbedFloatingMenu.d.ts +7 -0
- package/lib/types/products/docs/embed-block.d.ts +3 -0
- package/lib/types/products/docs/embed-docs-custom-block-bleed.render-controller.d.ts +25 -0
- package/lib/types/products/docs/embed-host-adapter.d.ts +6 -0
- package/lib/types/products/docs/embed-passive-viewport.d.ts +3 -0
- package/lib/types/products/docs/register.d.ts +2 -0
- package/lib/types/products/product-ui-contributions.d.ts +2 -0
- package/lib/types/products/sheets/EmbedBlock.d.ts +8 -0
- package/lib/types/products/sheets/EmbedFloatingMenu.d.ts +57 -0
- package/lib/types/products/sheets/embed-content-size.d.ts +2 -0
- package/lib/types/products/sheets/embed-host-adapter.d.ts +3 -0
- package/lib/types/products/sheets/embed-passive-viewport.d.ts +3 -0
- package/lib/types/products/sheets/embed-product-menu.d.ts +2 -0
- package/lib/types/products/sheets/register.d.ts +28 -0
- package/lib/types/products/slides/EmbedChildView.d.ts +3 -0
- package/lib/types/products/slides/components/embed-floating-menu/SlideEmbedFloatingMenu.d.ts +28 -0
- package/lib/types/products/slides/components/embed-floating-preview/SlideEmbedFloatingPreview.d.ts +24 -0
- package/lib/types/products/slides/embed-block.d.ts +2 -0
- package/lib/types/products/slides/embed-floating-menu-stage.d.ts +8 -0
- package/lib/types/products/slides/embed-floating-menu.d.ts +3 -0
- package/lib/types/products/slides/embed-host-adapter.d.ts +7 -0
- package/lib/types/products/slides/embed-passive-viewport.d.ts +2 -0
- package/lib/types/products/slides/register.d.ts +25 -0
- package/lib/types/products/slides/services/EmbedSlideReadonlyPreviewProvider.d.ts +15 -0
- package/lib/types/products/slides/services/embed-slide-float-preview.provider.d.ts +34 -0
- package/lib/types/products/slides/services/embed-slide-presentation-preview.d.ts +27 -0
- package/lib/types/services/embed-activation.service.d.ts +44 -0
- package/lib/types/services/embed-block-contribution-factory.d.ts +17 -0
- package/lib/types/services/embed-block-registry.service.d.ts +8 -0
- package/lib/types/services/embed-child-product-plugin-lease.d.ts +15 -0
- package/lib/types/services/embed-child-product-plugin-registry.service.d.ts +35 -0
- package/lib/types/services/embed-child-runtime-scope.d.ts +7 -0
- package/lib/types/services/embed-child-unit-scoped-injector.d.ts +6 -0
- package/lib/types/services/embed-child-view-registry.service.d.ts +8 -0
- package/lib/types/services/embed-content-size-registry.service.d.ts +9 -0
- package/lib/types/services/embed-default-floating-menu.d.ts +4 -0
- package/lib/types/services/embed-docs-sticky-wheel.d.ts +2 -0
- package/lib/types/services/embed-dom-passive-viewport-provider.d.ts +8 -0
- package/lib/types/services/embed-float-preview.service.d.ts +29 -0
- package/lib/types/services/embed-floating-active.service.d.ts +11 -0
- package/lib/types/services/embed-floating-geometry.service.d.ts +22 -0
- package/lib/types/services/embed-floating-menu-registry.service.d.ts +11 -0
- package/lib/types/services/embed-floating-menu-root.d.ts +2 -0
- package/lib/types/services/embed-fullscreen.service.d.ts +12 -0
- package/lib/types/services/embed-host-container-registry.service.d.ts +11 -0
- package/lib/types/services/embed-host-menu-override.service.d.ts +14 -0
- package/lib/types/services/embed-host-restore.service.d.ts +18 -0
- package/lib/types/services/embed-interaction-boundary.service.d.ts +42 -0
- package/lib/types/services/embed-mount.service.d.ts +52 -0
- package/lib/types/services/embed-overlay-root.service.d.ts +22 -0
- package/lib/types/services/embed-passive-viewport-registry.service.d.ts +9 -0
- package/lib/types/services/embed-passive-wheel-handler-registry.service.d.ts +9 -0
- package/lib/types/services/embed-product-floating-menu-contributions.d.ts +2 -0
- package/lib/types/services/embed-product-menu-mounting.d.ts +18 -0
- package/lib/types/services/embed-product-menu-registry.service.d.ts +14 -0
- package/lib/types/services/embed-readonly-preview-registry.service.d.ts +8 -0
- package/lib/types/services/embed-render-canvas-preview-provider.d.ts +8 -0
- package/lib/types/services/embed-render-child-view-contribution.d.ts +52 -0
- package/lib/types/services/embed-runtime-focus-coordinator.service.d.ts +76 -0
- package/lib/types/services/embed-runtime-host-lease.service.d.ts +24 -0
- package/lib/types/services/embed-runtime-policy.service.d.ts +28 -0
- package/lib/types/services/embed-runtime-scope-dom.d.ts +15 -0
- package/lib/types/services/embed-scene-canvas-capture.service.d.ts +24 -0
- package/lib/types/services/embed-scene-passive-wheel.d.ts +21 -0
- package/lib/types/services/embed-ui-contribution-register.d.ts +5 -0
- package/lib/types/services/embed-undo-bridge.service.d.ts +14 -0
- package/lib/types/services/react-root-disposal.d.ts +6 -0
- package/lib/types/types/embed-ui.d.ts +292 -0
- package/lib/umd/index.js +1 -0
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IEmbedDescriptor } from '@univerjs-pro/embed';
|
|
2
|
+
import type { IDisposable } from '@univerjs/core';
|
|
3
|
+
import type { IEmbedMountSession } from '../types/embed-ui';
|
|
4
|
+
import { EmbedMountService } from './embed-mount.service';
|
|
5
|
+
export interface IEmbedRuntimeHostLease extends IDisposable {
|
|
6
|
+
readonly session: IEmbedMountSession;
|
|
7
|
+
readonly ownsSession: boolean;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Temporarily lends a single Embed runtime to another DOM host without creating
|
|
11
|
+
* a duplicate child session. This is a host-lifecycle bridge, not a global
|
|
12
|
+
* interaction policy; consumers remain responsible for their local input rules.
|
|
13
|
+
*
|
|
14
|
+
* If passive runtime hosting becomes common outside presentation, promote the
|
|
15
|
+
* capability into EmbedMountService instead of adding more DOM relocation paths.
|
|
16
|
+
*/
|
|
17
|
+
export declare class EmbedRuntimeHostLeaseService {
|
|
18
|
+
private readonly _mountService;
|
|
19
|
+
private readonly _leases;
|
|
20
|
+
constructor(_mountService: EmbedMountService);
|
|
21
|
+
acquire(descriptor: IEmbedDescriptor, targetHost: HTMLElement): IEmbedRuntimeHostLease;
|
|
22
|
+
private _relocateExistingSession;
|
|
23
|
+
private _mountOwnedSession;
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IEmbedDescriptor } from '@univerjs-pro/embed';
|
|
2
|
+
import type { IDisposable } from '@univerjs/core';
|
|
3
|
+
export interface IEmbedRuntimeAncestor {
|
|
4
|
+
hostUnitId: string;
|
|
5
|
+
embedId: string;
|
|
6
|
+
childUnitId: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IEmbedRuntimeMountDecision {
|
|
9
|
+
allowed: boolean;
|
|
10
|
+
reason?: 'max-depth' | 'cycle';
|
|
11
|
+
ancestry: readonly IEmbedRuntimeAncestor[];
|
|
12
|
+
}
|
|
13
|
+
export interface IEmbedRuntimePolicyConfig {
|
|
14
|
+
maxDepth?: number;
|
|
15
|
+
}
|
|
16
|
+
type EmbedRuntimeDescriptor = Pick<IEmbedDescriptor, 'hostUnitId' | 'embedId'> & {
|
|
17
|
+
childUnitId: string;
|
|
18
|
+
};
|
|
19
|
+
export declare class EmbedRuntimePolicyService {
|
|
20
|
+
private readonly _childUnitAncestry;
|
|
21
|
+
private readonly _maxDepth;
|
|
22
|
+
constructor(config?: IEmbedRuntimePolicyConfig);
|
|
23
|
+
canMount(descriptor: EmbedRuntimeDescriptor): IEmbedRuntimeMountDecision;
|
|
24
|
+
registerMountedRuntime(descriptor: EmbedRuntimeDescriptor): IDisposable;
|
|
25
|
+
getAncestryForHostUnit(hostUnitId: string): readonly IEmbedRuntimeAncestor[];
|
|
26
|
+
getParentEmbedId(hostUnitId: string): string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
export declare const EMBED_FLOAT_DOM_ATTRIBUTE = "data-embed-float-dom";
|
|
3
|
+
export declare const EMBED_ID_ATTRIBUTE = "data-embed-id";
|
|
4
|
+
export declare const EMBED_HOST_UNIT_ID_ATTRIBUTE = "data-embed-host-unit-id";
|
|
5
|
+
export declare const EMBED_CHILD_UNIT_ID_ATTRIBUTE = "data-embed-child-unit-id";
|
|
6
|
+
export declare const EMBED_CHILD_TYPE_ATTRIBUTE = "data-embed-child-type";
|
|
7
|
+
export interface IEmbedRuntimeDomScope {
|
|
8
|
+
embedId: string;
|
|
9
|
+
hostUnitId?: string;
|
|
10
|
+
childUnitId?: string;
|
|
11
|
+
childType?: UniverInstanceType;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveEmbedRuntimeDomScope(element: HTMLElement | null | undefined): IEmbedRuntimeDomScope | undefined;
|
|
14
|
+
export declare function resolveActiveEmbedRuntimeDomScope(ownerDocument?: Document): IEmbedRuntimeDomScope | undefined;
|
|
15
|
+
export declare function resolveEmbedFloatDomContainer(element: HTMLElement | null | undefined, embedId?: string): HTMLElement | undefined;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { IDisposable, UniverInstanceType } from '@univerjs/core';
|
|
2
|
+
import type { IEmbedChildContainerContext } from '../types/embed-ui';
|
|
3
|
+
export type EmbedSceneCanvasCaptureResult = string | HTMLCanvasElement | ImageBitmap;
|
|
4
|
+
export interface IEmbedSceneCanvasCaptureProvider {
|
|
5
|
+
childType: UniverInstanceType;
|
|
6
|
+
capture(context: IEmbedChildContainerContext): Promise<EmbedSceneCanvasCaptureResult | null | undefined> | EmbedSceneCanvasCaptureResult | null | undefined;
|
|
7
|
+
}
|
|
8
|
+
export declare class EmbedSceneCanvasCaptureService {
|
|
9
|
+
private readonly _providers;
|
|
10
|
+
private readonly _contextsByEmbedId;
|
|
11
|
+
private readonly _contextsByHostAnchorId;
|
|
12
|
+
private readonly _contextsByChildUnitId;
|
|
13
|
+
register(provider: IEmbedSceneCanvasCaptureProvider): IDisposable;
|
|
14
|
+
get(childType: UniverInstanceType): IEmbedSceneCanvasCaptureProvider | undefined;
|
|
15
|
+
registerContext(context: IEmbedChildContainerContext): IDisposable;
|
|
16
|
+
getContextByEmbedId(embedId: string): IEmbedChildContainerContext | undefined;
|
|
17
|
+
getContextByHostAnchorId(hostAnchorId: string): IEmbedChildContainerContext | undefined;
|
|
18
|
+
getContextByChildUnitId(childUnitId: string): IEmbedChildContainerContext | undefined;
|
|
19
|
+
capture(context: IEmbedChildContainerContext): Promise<EmbedSceneCanvasCaptureResult | null | undefined>;
|
|
20
|
+
captureByEmbedId(embedId: string): Promise<EmbedSceneCanvasCaptureResult | null | undefined>;
|
|
21
|
+
captureByHostAnchorId(hostAnchorId: string): Promise<EmbedSceneCanvasCaptureResult | null | undefined>;
|
|
22
|
+
captureByChildUnitId(childUnitId: string): Promise<EmbedSceneCanvasCaptureResult | null | undefined>;
|
|
23
|
+
}
|
|
24
|
+
export declare function captureEmbedContextSceneCanvas(context: IEmbedChildContainerContext): string | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IEmbedPassiveViewportWheelContext } from '../types/embed-ui';
|
|
2
|
+
export declare function normalizePassiveWheelDelta(event: WheelEvent, scaleX?: number, scaleY?: number): {
|
|
3
|
+
offsetX: number;
|
|
4
|
+
offsetY: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function scrollSceneViewportPassive(context: IEmbedPassiveViewportWheelContext, viewport: {
|
|
7
|
+
viewportScrollX?: number;
|
|
8
|
+
viewportScrollY?: number;
|
|
9
|
+
scrollToViewportPos?: (position: Partial<{
|
|
10
|
+
viewportScrollX: number;
|
|
11
|
+
viewportScrollY: number;
|
|
12
|
+
}>) => unknown;
|
|
13
|
+
scrollByViewportDeltaVal?: (delta: {
|
|
14
|
+
viewportScrollX: number;
|
|
15
|
+
viewportScrollY: number;
|
|
16
|
+
}) => unknown;
|
|
17
|
+
} | null | undefined, scene?: {
|
|
18
|
+
scaleX?: number;
|
|
19
|
+
scaleY?: number;
|
|
20
|
+
makeDirty?: (force?: boolean) => void;
|
|
21
|
+
}): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Injector } from '@univerjs/core';
|
|
2
|
+
type EmbedUIContributionRegister = (injector: Injector) => void;
|
|
3
|
+
export declare function registerEmbedUIContribution(injector: Injector, key: string, register: EmbedUIContributionRegister): void;
|
|
4
|
+
export declare function flushPendingEmbedUIContributions(injector: Injector): void;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IUndoRedoItem } from '@univerjs/core';
|
|
2
|
+
import { EmbedFocusOwnerService } from '@univerjs-pro/embed';
|
|
3
|
+
import { IUndoRedoService } from '@univerjs/core';
|
|
4
|
+
export interface IEmbedUndoBridgeResult {
|
|
5
|
+
stackUnitId: string;
|
|
6
|
+
routedToHost: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare class EmbedUndoBridgeService {
|
|
9
|
+
private readonly _focusOwnerService;
|
|
10
|
+
private readonly _undoRedoService;
|
|
11
|
+
constructor(_focusOwnerService: EmbedFocusOwnerService, _undoRedoService: IUndoRedoService);
|
|
12
|
+
pushUndoRedoForChild(item: IUndoRedoItem): IEmbedUndoBridgeResult;
|
|
13
|
+
resolveStackUnitId(childUnitId: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
export interface IEmbedReactRoot {
|
|
3
|
+
render: (node: ReactElement) => void;
|
|
4
|
+
}
|
|
5
|
+
export declare function createEmbedReactRoot(container: Element): IEmbedReactRoot;
|
|
6
|
+
export declare function disposeEmbedReactRoot(root: IEmbedReactRoot): void;
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type { EmbedHostEntry, EmbedLayout, EmbedMenuBehavior, IEmbedDescriptor, IEmbedLayoutPolicies } from '@univerjs-pro/embed';
|
|
2
|
+
import type { DependencyIdentifier, ICommandService, IDisposable, Injector, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';
|
|
3
|
+
import type { IMenuManagerService, IRibbonService } from '@univerjs/ui';
|
|
4
|
+
import type { Observable } from 'rxjs';
|
|
5
|
+
export interface IEmbedContainerContext {
|
|
6
|
+
descriptor: IEmbedDescriptor;
|
|
7
|
+
layout: EmbedLayout;
|
|
8
|
+
injector: Injector;
|
|
9
|
+
hostElement?: HTMLElement;
|
|
10
|
+
container?: HTMLElement;
|
|
11
|
+
hostUnitId: string;
|
|
12
|
+
embedId: string;
|
|
13
|
+
childUnitId: string;
|
|
14
|
+
childType: UniverInstanceType;
|
|
15
|
+
}
|
|
16
|
+
export interface IEmbedChildContainerContext extends IEmbedContainerContext {
|
|
17
|
+
hostElement: HTMLElement;
|
|
18
|
+
container: HTMLElement;
|
|
19
|
+
renderScope: IEmbedRenderScope;
|
|
20
|
+
runtimeScope: IEmbedChildRuntimeScope;
|
|
21
|
+
}
|
|
22
|
+
export interface IEmbedMenuOutlet {
|
|
23
|
+
container: HTMLElement;
|
|
24
|
+
}
|
|
25
|
+
export interface IEmbedRenderScope {
|
|
26
|
+
hostUnitId: string;
|
|
27
|
+
hostAnchorId: string;
|
|
28
|
+
embedId: string;
|
|
29
|
+
childUnitId: string;
|
|
30
|
+
childType: UniverInstanceType;
|
|
31
|
+
layout: EmbedLayout;
|
|
32
|
+
mode: 'tab' | 'float' | 'inline';
|
|
33
|
+
rootElement: HTMLElement;
|
|
34
|
+
contentRoot?: HTMLElement;
|
|
35
|
+
canvasRoot?: HTMLElement;
|
|
36
|
+
overlayRoot?: HTMLElement;
|
|
37
|
+
popupRoot?: HTMLElement;
|
|
38
|
+
menuOutlet?: IEmbedMenuOutlet;
|
|
39
|
+
active$: Observable<boolean>;
|
|
40
|
+
fullscreen?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface IEmbedChildRuntimeScope {
|
|
43
|
+
descriptor: IEmbedDescriptor;
|
|
44
|
+
host: {
|
|
45
|
+
unitId: string;
|
|
46
|
+
type: UniverInstanceType;
|
|
47
|
+
anchorId: string;
|
|
48
|
+
entry: EmbedHostEntry;
|
|
49
|
+
layout: 'doc-flow' | 'float' | 'tab-peer';
|
|
50
|
+
};
|
|
51
|
+
child: {
|
|
52
|
+
unitId: string;
|
|
53
|
+
type: UniverInstanceType;
|
|
54
|
+
};
|
|
55
|
+
injector: Injector;
|
|
56
|
+
instanceService?: IUniverInstanceService;
|
|
57
|
+
commandService?: ICommandService;
|
|
58
|
+
menuManagerService?: IMenuManagerService;
|
|
59
|
+
roots: {
|
|
60
|
+
root: HTMLElement;
|
|
61
|
+
content: HTMLElement;
|
|
62
|
+
canvas?: HTMLElement;
|
|
63
|
+
overlay: HTMLElement;
|
|
64
|
+
popup: HTMLElement;
|
|
65
|
+
menuSlot?: HTMLElement;
|
|
66
|
+
footerSlot?: HTMLElement;
|
|
67
|
+
};
|
|
68
|
+
activate: () => void;
|
|
69
|
+
deactivate: () => void;
|
|
70
|
+
dispose: () => void;
|
|
71
|
+
}
|
|
72
|
+
export interface IEmbedHostMountResult {
|
|
73
|
+
hostElement?: HTMLElement;
|
|
74
|
+
runtimeRoots?: {
|
|
75
|
+
content?: HTMLElement;
|
|
76
|
+
canvas?: HTMLElement;
|
|
77
|
+
overlay?: HTMLElement;
|
|
78
|
+
popup?: HTMLElement;
|
|
79
|
+
menuSlot?: HTMLElement;
|
|
80
|
+
footerSlot?: HTMLElement;
|
|
81
|
+
};
|
|
82
|
+
disposable?: IDisposable;
|
|
83
|
+
}
|
|
84
|
+
export interface IEmbedHostContainerContribution {
|
|
85
|
+
hostType: UniverInstanceType;
|
|
86
|
+
entry: EmbedHostEntry;
|
|
87
|
+
layout: EmbedLayout;
|
|
88
|
+
supportedLayouts?: EmbedLayout[];
|
|
89
|
+
menuBehavior: EmbedMenuBehavior;
|
|
90
|
+
mount?: (context: IEmbedContainerContext) => IEmbedHostMountResult | IDisposable | void;
|
|
91
|
+
}
|
|
92
|
+
export interface IEmbedChildViewContribution {
|
|
93
|
+
childType: UniverInstanceType;
|
|
94
|
+
supportedLayouts: EmbedLayout[];
|
|
95
|
+
beforeDeactivate?: (context: IEmbedChildContainerContext) => void;
|
|
96
|
+
mount?: (context: IEmbedChildContainerContext) => IDisposable | void;
|
|
97
|
+
}
|
|
98
|
+
export interface IEmbedProductMenuContribution {
|
|
99
|
+
childType: UniverInstanceType;
|
|
100
|
+
surface?: EmbedProductMenuSurface;
|
|
101
|
+
menuSchema?: unknown;
|
|
102
|
+
id?: string;
|
|
103
|
+
order?: number;
|
|
104
|
+
scopedActionServiceTokens?: readonly DependencyIdentifier<unknown>[];
|
|
105
|
+
mountMenu?: (context: IEmbedProductMenuMountContext) => IDisposable | void;
|
|
106
|
+
}
|
|
107
|
+
export type EmbedProductMenuSurface = 'ribbon' | 'product-toolbar' | 'context-menu' | 'float-toolbar' | 'footer' | 'side-panel' | 'floating-menu';
|
|
108
|
+
export interface IEmbedProductMenuMountContext {
|
|
109
|
+
container: HTMLElement;
|
|
110
|
+
portalContainer?: HTMLElement | null;
|
|
111
|
+
childType: UniverInstanceType;
|
|
112
|
+
surface?: EmbedProductMenuSurface;
|
|
113
|
+
childUnitId?: string;
|
|
114
|
+
embedId?: string;
|
|
115
|
+
injector: unknown;
|
|
116
|
+
menuSchema: unknown;
|
|
117
|
+
menuTitlePrefix?: string;
|
|
118
|
+
activeRibbonTab?: string;
|
|
119
|
+
headerMenu?: boolean;
|
|
120
|
+
toolbarOnly?: boolean;
|
|
121
|
+
ribbonHeaderClassName?: string;
|
|
122
|
+
scopedActionServiceTokens?: readonly DependencyIdentifier<unknown>[];
|
|
123
|
+
}
|
|
124
|
+
export interface IEmbedProductRibbonOverride {
|
|
125
|
+
mode?: EmbedHostChromeMode;
|
|
126
|
+
ribbonService: IRibbonService;
|
|
127
|
+
injector?: Pick<Injector, 'get' | 'has' | 'invoke'>;
|
|
128
|
+
portalContainer?: HTMLElement | null;
|
|
129
|
+
placeholderTitle?: string;
|
|
130
|
+
hideToolbar?: boolean;
|
|
131
|
+
disposable?: IDisposable;
|
|
132
|
+
}
|
|
133
|
+
export interface IEmbedProductRibbonOverrideContext {
|
|
134
|
+
childType: UniverInstanceType;
|
|
135
|
+
childUnitId?: string;
|
|
136
|
+
injector: unknown;
|
|
137
|
+
embedId: string;
|
|
138
|
+
hostUnitId: string;
|
|
139
|
+
entry: EmbedHostEntry;
|
|
140
|
+
}
|
|
141
|
+
export interface IEmbedBlockContribution {
|
|
142
|
+
childType: UniverInstanceType;
|
|
143
|
+
productName: string;
|
|
144
|
+
hostChromeMode?: EmbedHostChromeMode;
|
|
145
|
+
hostHeaderMode?: 'none' | 'placeholder';
|
|
146
|
+
layoutPolicy?: IEmbedLayoutPolicies;
|
|
147
|
+
createRibbonOverride?: (context: IEmbedProductRibbonOverrideContext) => IEmbedProductRibbonOverride | undefined;
|
|
148
|
+
}
|
|
149
|
+
export declare enum EmbedHostChromeMode {
|
|
150
|
+
RIBBON = "ribbon",
|
|
151
|
+
TITLE_ONLY = "title-only",
|
|
152
|
+
NONE = "none"
|
|
153
|
+
}
|
|
154
|
+
export type EmbedFloatingStage = 'inactive' | 'stage1' | 'stage2';
|
|
155
|
+
export type EmbedInteractionFlow = 'floating-stage' | 'doc-block';
|
|
156
|
+
export interface IEmbedFloatingActivation {
|
|
157
|
+
hostUnitId: string;
|
|
158
|
+
embedId: string;
|
|
159
|
+
childUnitId: string;
|
|
160
|
+
stage?: EmbedFloatingStage;
|
|
161
|
+
}
|
|
162
|
+
export interface IEmbedFloatingMenuMountContext extends IEmbedChildContainerContext {
|
|
163
|
+
active: IEmbedFloatingActivation | null;
|
|
164
|
+
}
|
|
165
|
+
export interface IEmbedFloatingMenuContribution {
|
|
166
|
+
hostType: UniverInstanceType;
|
|
167
|
+
entry: EmbedHostEntry;
|
|
168
|
+
childType?: UniverInstanceType;
|
|
169
|
+
mount: (context: IEmbedFloatingMenuMountContext) => IDisposable | void;
|
|
170
|
+
}
|
|
171
|
+
export interface IEmbedPassiveViewportWheelContext extends IEmbedChildContainerContext {
|
|
172
|
+
event: WheelEvent;
|
|
173
|
+
stage: EmbedFloatingStage;
|
|
174
|
+
source?: 'wheel' | 'host-scroll-sync';
|
|
175
|
+
viewportScrollX?: number;
|
|
176
|
+
viewportScrollY?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface IEmbedPassiveViewportProvider {
|
|
179
|
+
childType: UniverInstanceType;
|
|
180
|
+
supportedLayouts?: EmbedLayout[];
|
|
181
|
+
handleWheel: (context: IEmbedPassiveViewportWheelContext) => boolean | void;
|
|
182
|
+
}
|
|
183
|
+
export interface IEmbedPassiveWheelHandlerContribution {
|
|
184
|
+
childType: UniverInstanceType;
|
|
185
|
+
order?: number;
|
|
186
|
+
supportedLayouts?: EmbedLayout[];
|
|
187
|
+
handleWheel: (context: IEmbedPassiveViewportWheelContext) => boolean | void;
|
|
188
|
+
}
|
|
189
|
+
export interface IEmbedContentSize {
|
|
190
|
+
height?: number;
|
|
191
|
+
width?: number;
|
|
192
|
+
}
|
|
193
|
+
export interface IEmbedContentSizeMeasureContext {
|
|
194
|
+
childType: UniverInstanceType;
|
|
195
|
+
childUnit?: unknown;
|
|
196
|
+
childUnitId: string;
|
|
197
|
+
viewportWidth?: number;
|
|
198
|
+
}
|
|
199
|
+
export interface IEmbedContentSizeProvider {
|
|
200
|
+
childType: UniverInstanceType;
|
|
201
|
+
measureContentSize: (context: IEmbedContentSizeMeasureContext) => IEmbedContentSize | undefined;
|
|
202
|
+
}
|
|
203
|
+
export interface IEmbedFullscreenSession {
|
|
204
|
+
hostUnitId: string;
|
|
205
|
+
embedId: string;
|
|
206
|
+
childUnitId: string;
|
|
207
|
+
childType: UniverInstanceType;
|
|
208
|
+
entry: EmbedHostEntry;
|
|
209
|
+
layout: EmbedLayout;
|
|
210
|
+
}
|
|
211
|
+
export interface IEmbedHostMenuOverride {
|
|
212
|
+
hostUnitId: string;
|
|
213
|
+
embedId: string;
|
|
214
|
+
childUnitId: string;
|
|
215
|
+
childType: UniverInstanceType;
|
|
216
|
+
entry: EmbedHostEntry;
|
|
217
|
+
reason: 'tab-active';
|
|
218
|
+
portalContainer?: HTMLElement | null;
|
|
219
|
+
hideHostFxBar?: boolean;
|
|
220
|
+
lockHostRibbon?: boolean;
|
|
221
|
+
}
|
|
222
|
+
export interface IEmbedMountSession {
|
|
223
|
+
hostUnitId: string;
|
|
224
|
+
embedId: string;
|
|
225
|
+
childUnitId: string;
|
|
226
|
+
childType: UniverInstanceType;
|
|
227
|
+
entry: EmbedHostEntry;
|
|
228
|
+
layout: EmbedLayout;
|
|
229
|
+
hostElement?: HTMLElement;
|
|
230
|
+
context?: IEmbedChildContainerContext;
|
|
231
|
+
}
|
|
232
|
+
export type EmbedFloatPreviewStatus = 'pending' | 'ready' | 'error' | 'stale';
|
|
233
|
+
export type EmbedFloatPreviewReason = 'initial' | 'stage-exit' | 'resize' | 'content-change' | 'manual';
|
|
234
|
+
export type EmbedFloatPreviewInvalidationReason = 'model-change' | 'view-state-change' | 'resize' | 'theme-change' | 'locale-change' | 'dispose';
|
|
235
|
+
export type EmbedFloatPreviewRenderResult = string | HTMLCanvasElement | ImageBitmap;
|
|
236
|
+
export interface IEmbedFloatPreviewEntry<TViewState = unknown> {
|
|
237
|
+
embedId: string;
|
|
238
|
+
childUnitId: string;
|
|
239
|
+
childType: UniverInstanceType;
|
|
240
|
+
status: EmbedFloatPreviewStatus;
|
|
241
|
+
image?: EmbedFloatPreviewRenderResult;
|
|
242
|
+
width: number;
|
|
243
|
+
height: number;
|
|
244
|
+
dpr: number;
|
|
245
|
+
viewState?: TViewState;
|
|
246
|
+
revision: number;
|
|
247
|
+
updatedAt: number;
|
|
248
|
+
error?: unknown;
|
|
249
|
+
}
|
|
250
|
+
export interface IEmbedFloatPreviewRenderRequest<TViewState = unknown> {
|
|
251
|
+
descriptor: IEmbedDescriptor;
|
|
252
|
+
childUnitId: string;
|
|
253
|
+
childType: UniverInstanceType;
|
|
254
|
+
width: number;
|
|
255
|
+
height: number;
|
|
256
|
+
dpr: number;
|
|
257
|
+
viewState?: TViewState;
|
|
258
|
+
reason: EmbedFloatPreviewReason;
|
|
259
|
+
context?: IEmbedChildContainerContext;
|
|
260
|
+
}
|
|
261
|
+
export interface IEmbedFloatPreviewInvalidationContext {
|
|
262
|
+
descriptor: IEmbedDescriptor;
|
|
263
|
+
childUnitId: string;
|
|
264
|
+
childType: UniverInstanceType;
|
|
265
|
+
reason: EmbedFloatPreviewInvalidationReason;
|
|
266
|
+
}
|
|
267
|
+
export interface IEmbedFloatPreviewProvider<TViewState = unknown> {
|
|
268
|
+
childType: UniverInstanceType;
|
|
269
|
+
collectViewState: (context: IEmbedChildContainerContext) => TViewState | Promise<TViewState>;
|
|
270
|
+
restoreViewState: (context: IEmbedChildContainerContext, state: TViewState) => void | Promise<void>;
|
|
271
|
+
renderPreview: (request: IEmbedFloatPreviewRenderRequest<TViewState>) => EmbedFloatPreviewRenderResult | null | undefined | Promise<EmbedFloatPreviewRenderResult | null | undefined>;
|
|
272
|
+
invalidateKeys?: (context: IEmbedFloatPreviewInvalidationContext) => string[];
|
|
273
|
+
}
|
|
274
|
+
export interface IEmbedReadonlyPreviewRoots {
|
|
275
|
+
root: HTMLElement;
|
|
276
|
+
content: HTMLElement;
|
|
277
|
+
canvas?: HTMLElement;
|
|
278
|
+
}
|
|
279
|
+
export interface IEmbedReadonlyPreviewContext<TViewState = unknown> extends IEmbedContainerContext {
|
|
280
|
+
roots: IEmbedReadonlyPreviewRoots;
|
|
281
|
+
viewState?: TViewState;
|
|
282
|
+
updateViewState: (viewState: TViewState) => void;
|
|
283
|
+
}
|
|
284
|
+
export interface IEmbedReadonlyPreviewWheelContext<TViewState = unknown> extends IEmbedReadonlyPreviewContext<TViewState> {
|
|
285
|
+
event: WheelEvent;
|
|
286
|
+
}
|
|
287
|
+
export interface IEmbedReadonlyPreviewProvider<TViewState = unknown> {
|
|
288
|
+
childType: UniverInstanceType;
|
|
289
|
+
supportedLayouts?: EmbedLayout[];
|
|
290
|
+
mount?: (context: IEmbedReadonlyPreviewContext<TViewState>) => IDisposable | void;
|
|
291
|
+
handleWheel?: (context: IEmbedReadonlyPreviewWheelContext<TViewState>) => boolean | void | Promise<boolean | void>;
|
|
292
|
+
}
|