mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
refactor: move frame manager and panel to separate packages (#10324)
### TL;DR Moved frame management functionality from `blocksuite/blocks` to `@blocksuite/affine-block-frame` package. ### What changed? - Relocated `frame-manager.ts` from `blocksuite/blocks` to `@blocksuite/affine-block-frame` - Added new dependencies to block-frame package: `@blocksuite/affine-block-surface` and `yjs` - Updated imports across multiple components to reference frame manager from its new location - Moved utility functions `areSetsEqual` and `isFrameBlock` into frame-manager file - Replaced direct EdgelessRootService references with GfxController in frame panel components ### How to test? 1. Verify frame functionality works in edgeless mode 2. Test frame creation, selection, and manipulation 3. Confirm frame navigation and presentation modes operate correctly 4. Check that frame panel and toolbar interactions remain functional ### Why make this change? This refactoring improves code organization by consolidating frame-related functionality into a dedicated package, making the codebase more modular and easier to maintain. It also reduces dependencies between packages and provides clearer boundaries for frame-related features.
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
"author": "toeverything",
|
"author": "toeverything",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@blocksuite/affine-block-surface": "workspace:*",
|
||||||
"@blocksuite/affine-components": "workspace:*",
|
"@blocksuite/affine-components": "workspace:*",
|
||||||
"@blocksuite/affine-model": "workspace:*",
|
"@blocksuite/affine-model": "workspace:*",
|
||||||
"@blocksuite/affine-shared": "workspace:*",
|
"@blocksuite/affine-shared": "workspace:*",
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
"@types/mdast": "^4.0.4",
|
"@types/mdast": "^4.0.4",
|
||||||
"lit": "^3.2.0",
|
"lit": "^3.2.0",
|
||||||
"minimatch": "^10.0.1",
|
"minimatch": "^10.0.1",
|
||||||
|
"yjs": "^13.6.21",
|
||||||
"zod": "^3.23.8"
|
"zod": "^3.23.8"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -21,14 +21,13 @@ import {
|
|||||||
type IVec,
|
type IVec,
|
||||||
type SerializedXYWH,
|
type SerializedXYWH,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/utils';
|
||||||
import { Text } from '@blocksuite/store';
|
import { type BlockModel, Text } from '@blocksuite/store';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import { areSetsEqual } from './utils/misc.js';
|
|
||||||
import { isFrameBlock } from './utils/query.js';
|
|
||||||
|
|
||||||
const FRAME_PADDING = 40;
|
const FRAME_PADDING = 40;
|
||||||
|
|
||||||
|
export type NavigatorMode = 'fill' | 'fit';
|
||||||
|
|
||||||
export class FrameOverlay extends Overlay {
|
export class FrameOverlay extends Overlay {
|
||||||
static override overlayName: string = 'frame';
|
static override overlayName: string = 'frame';
|
||||||
|
|
||||||
@@ -461,3 +460,13 @@ export class EdgelessFrameManager extends GfxExtension {
|
|||||||
this._disposable.dispose();
|
this._disposable.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function areSetsEqual<T>(setA: Set<T>, setB: Set<T>) {
|
||||||
|
if (setA.size !== setB.size) return false;
|
||||||
|
for (const a of setA) if (!setB.has(a)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isFrameBlock(element: unknown): element is FrameBlockModel {
|
||||||
|
return !!element && (element as BlockModel).flavour === 'affine:frame';
|
||||||
|
}
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from './frame-block.js';
|
export * from './frame-block.js';
|
||||||
|
export * from './frame-manager.js';
|
||||||
export * from './frame-spec.js';
|
export * from './frame-spec.js';
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
},
|
},
|
||||||
"include": ["./src"],
|
"include": ["./src"],
|
||||||
"references": [
|
"references": [
|
||||||
|
{ "path": "../block-surface" },
|
||||||
{ "path": "../components" },
|
{ "path": "../components" },
|
||||||
{ "path": "../model" },
|
{ "path": "../model" },
|
||||||
{ "path": "../shared" },
|
{ "path": "../shared" },
|
||||||
|
|||||||
45
blocksuite/affine/fragment-frame-panel/package.json
Normal file
45
blocksuite/affine/fragment-frame-panel/package.json
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
"name": "@blocksuite/affine-fragment-frame-panel",
|
||||||
|
"description": "Frame panel fragment for BlockSuite.",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"build": "tsc",
|
||||||
|
"test:unit": "nx vite:test --run --passWithNoTests",
|
||||||
|
"test:unit:coverage": "nx vite:test --run --coverage",
|
||||||
|
"test:e2e": "playwright test"
|
||||||
|
},
|
||||||
|
"sideEffects": false,
|
||||||
|
"keywords": [],
|
||||||
|
"author": "toeverything",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@blocksuite/affine-block-frame": "workspace:*",
|
||||||
|
"@blocksuite/affine-block-surface": "workspace:*",
|
||||||
|
"@blocksuite/affine-components": "workspace:*",
|
||||||
|
"@blocksuite/affine-model": "workspace:*",
|
||||||
|
"@blocksuite/affine-shared": "workspace:*",
|
||||||
|
"@blocksuite/block-std": "workspace:*",
|
||||||
|
"@blocksuite/global": "workspace:*",
|
||||||
|
"@blocksuite/icons": "^2.2.1",
|
||||||
|
"@blocksuite/inline": "workspace:*",
|
||||||
|
"@blocksuite/store": "workspace:*",
|
||||||
|
"@floating-ui/dom": "^1.6.10",
|
||||||
|
"@lit/context": "^1.1.2",
|
||||||
|
"@preact/signals-core": "^1.8.0",
|
||||||
|
"@toeverything/theme": "^1.1.11",
|
||||||
|
"lit": "^3.2.0",
|
||||||
|
"minimatch": "^10.0.1",
|
||||||
|
"zod": "^3.23.8"
|
||||||
|
},
|
||||||
|
"exports": {
|
||||||
|
".": "./src/index.ts",
|
||||||
|
"./effects": "./src/effects.ts"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"src",
|
||||||
|
"dist",
|
||||||
|
"!src/__tests__",
|
||||||
|
"!dist/__tests__"
|
||||||
|
],
|
||||||
|
"version": "0.19.0"
|
||||||
|
}
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';
|
import { EdgelessFrameManager } from '@blocksuite/affine-block-frame';
|
||||||
import { generateKeyBetweenV2 } from '@blocksuite/block-std/gfx';
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import {
|
import {
|
||||||
DocModeProvider,
|
DocModeProvider,
|
||||||
EdgelessFrameManager,
|
|
||||||
EdgelessRootService,
|
|
||||||
EditPropsStore,
|
EditPropsStore,
|
||||||
type FrameBlockModel,
|
} from '@blocksuite/affine-shared/services';
|
||||||
} from '@blocksuite/blocks';
|
import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';
|
||||||
|
import {
|
||||||
|
generateKeyBetweenV2,
|
||||||
|
GfxControllerIdentifier,
|
||||||
|
} from '@blocksuite/block-std/gfx';
|
||||||
import {
|
import {
|
||||||
Bound,
|
Bound,
|
||||||
DisposableGroup,
|
DisposableGroup,
|
||||||
@@ -110,7 +112,7 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._selected = [];
|
this._selected = [];
|
||||||
this._edgelessRootService?.selection.set({
|
this._gfx.selection.set({
|
||||||
elements: this._selected,
|
elements: this._selected,
|
||||||
editing: false,
|
editing: false,
|
||||||
});
|
});
|
||||||
@@ -126,6 +128,10 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
|
|
||||||
private _lastEdgelessRootId = '';
|
private _lastEdgelessRootId = '';
|
||||||
|
|
||||||
|
private get _gfx() {
|
||||||
|
return this.editorHost.std.get(GfxControllerIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly _selectFrame = (e: SelectEvent) => {
|
private readonly _selectFrame = (e: SelectEvent) => {
|
||||||
const { selected, id, multiselect } = e.detail;
|
const { selected, id, multiselect } = e.detail;
|
||||||
|
|
||||||
@@ -138,7 +144,7 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
this._selected = [id];
|
this._selected = [id];
|
||||||
}
|
}
|
||||||
|
|
||||||
this._edgelessRootService?.selection.set({
|
this._gfx.selection.set({
|
||||||
elements: this._selected,
|
elements: this._selected,
|
||||||
editing: false,
|
editing: false,
|
||||||
});
|
});
|
||||||
@@ -152,10 +158,6 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
get _edgelessRootService() {
|
|
||||||
return this.editorHost.std.getOptional(EdgelessRootService);
|
|
||||||
}
|
|
||||||
|
|
||||||
get frames() {
|
get frames() {
|
||||||
const frames = this.editorHost.doc
|
const frames = this.editorHost.doc
|
||||||
.getBlocksByFlavour('affine:frame')
|
.getBlocksByFlavour('affine:frame')
|
||||||
@@ -229,8 +231,9 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
private _fitToElement(e: FitViewEvent) {
|
private _fitToElement(e: FitViewEvent) {
|
||||||
const { block } = e.detail;
|
const { block } = e.detail;
|
||||||
const bound = Bound.deserialize(block.xywh);
|
const bound = Bound.deserialize(block.xywh);
|
||||||
|
const docModeProvider = this.editorHost.std.get(DocModeProvider);
|
||||||
|
|
||||||
if (!this._edgelessRootService) {
|
if (docModeProvider.getEditorMode() !== 'edgeless') {
|
||||||
// When click frame card in page mode
|
// When click frame card in page mode
|
||||||
// Should switch to edgeless mode and set viewport to the frame
|
// Should switch to edgeless mode and set viewport to the frame
|
||||||
const viewport = {
|
const viewport = {
|
||||||
@@ -242,11 +245,7 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
this.editorHost.std.get(EditPropsStore).setStorage('viewport', viewport);
|
this.editorHost.std.get(EditPropsStore).setStorage('viewport', viewport);
|
||||||
this.editorHost.std.get(DocModeProvider).setEditorMode('edgeless');
|
this.editorHost.std.get(DocModeProvider).setEditorMode('edgeless');
|
||||||
} else {
|
} else {
|
||||||
this._edgelessRootService.viewport.setViewportByBound(
|
this._gfx.viewport.setViewportByBound(bound, this.viewportPadding, true);
|
||||||
bound,
|
|
||||||
this.viewportPadding,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,7 +397,7 @@ export class FramePanelBody extends SignalWatcher(
|
|||||||
this._setDocDisposables(this.editorHost.doc);
|
this._setDocDisposables(this.editorHost.doc);
|
||||||
// after switch to edgeless mode, should update the selection
|
// after switch to edgeless mode, should update the selection
|
||||||
if (this.editorHost.doc.id === this._lastEdgelessRootId) {
|
if (this.editorHost.doc.id === this._lastEdgelessRootId) {
|
||||||
this._edgelessRootService?.selection.set({
|
this._gfx.selection.set({
|
||||||
elements: this._selected,
|
elements: this._selected,
|
||||||
editing: false,
|
editing: false,
|
||||||
});
|
});
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import type { RichText } from '@blocksuite/affine-components/rich-text';
|
||||||
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import type { FrameBlockModel, RichText } from '@blocksuite/blocks';
|
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import type { FrameBlockModel } from '@blocksuite/blocks';
|
|
||||||
import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';
|
import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { css, html, type PropertyValues } from 'lit';
|
import { css, html, type PropertyValues } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
|
import { on, once } from '@blocksuite/affine-shared/utils';
|
||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import { type FrameBlockModel, on, once } from '@blocksuite/blocks';
|
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
32
blocksuite/affine/fragment-frame-panel/src/effects.ts
Normal file
32
blocksuite/affine/fragment-frame-panel/src/effects.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import {
|
||||||
|
AFFINE_FRAME_PANEL_BODY,
|
||||||
|
FramePanelBody,
|
||||||
|
} from './body/frame-panel-body';
|
||||||
|
import { AFFINE_FRAME_CARD, FrameCard } from './card/frame-card';
|
||||||
|
import {
|
||||||
|
AFFINE_FRAME_CARD_TITLE,
|
||||||
|
FrameCardTitle,
|
||||||
|
} from './card/frame-card-title';
|
||||||
|
import {
|
||||||
|
AFFINE_FRAME_TITLE_EDITOR,
|
||||||
|
FrameCardTitleEditor,
|
||||||
|
} from './card/frame-card-title-editor';
|
||||||
|
import { AFFINE_FRAME_PANEL, FramePanel } from './frame-panel';
|
||||||
|
import {
|
||||||
|
AFFINE_FRAME_PANEL_HEADER,
|
||||||
|
FramePanelHeader,
|
||||||
|
} from './header/frame-panel-header';
|
||||||
|
import {
|
||||||
|
AFFINE_FRAMES_SETTING_MENU,
|
||||||
|
FramesSettingMenu,
|
||||||
|
} from './header/frames-setting-menu';
|
||||||
|
|
||||||
|
export function effects() {
|
||||||
|
customElements.define(AFFINE_FRAME_PANEL, FramePanel);
|
||||||
|
customElements.define(AFFINE_FRAME_TITLE_EDITOR, FrameCardTitleEditor);
|
||||||
|
customElements.define(AFFINE_FRAME_CARD, FrameCard);
|
||||||
|
customElements.define(AFFINE_FRAME_CARD_TITLE, FrameCardTitle);
|
||||||
|
customElements.define(AFFINE_FRAME_PANEL_BODY, FramePanelBody);
|
||||||
|
customElements.define(AFFINE_FRAME_PANEL_HEADER, FramePanelHeader);
|
||||||
|
customElements.define(AFFINE_FRAMES_SETTING_MENU, FramesSettingMenu);
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
import type { EditorHost } from '@blocksuite/block-std';
|
import type { NavigatorMode } from '@blocksuite/affine-block-frame';
|
||||||
|
import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
|
||||||
import {
|
import {
|
||||||
createButtonPopper,
|
|
||||||
DocModeProvider,
|
DocModeProvider,
|
||||||
EdgelessLegacySlotIdentifier,
|
|
||||||
EdgelessRootService,
|
|
||||||
EditPropsStore,
|
EditPropsStore,
|
||||||
type NavigatorMode,
|
} from '@blocksuite/affine-shared/services';
|
||||||
} from '@blocksuite/blocks';
|
import { createButtonPopper } from '@blocksuite/affine-shared/utils';
|
||||||
|
import type { EditorHost } from '@blocksuite/block-std';
|
||||||
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';
|
import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { PresentationIcon, SettingsIcon } from '@blocksuite/icons/lit';
|
import { PresentationIcon, SettingsIcon } from '@blocksuite/icons/lit';
|
||||||
import { css, html, LitElement, type PropertyValues } from 'lit';
|
import { css, html, LitElement, type PropertyValues } from 'lit';
|
||||||
@@ -112,13 +112,18 @@ export class FramePanelHeader extends WithDisposable(LitElement) {
|
|||||||
|
|
||||||
private _edgelessDisposables: DisposableGroup | null = null;
|
private _edgelessDisposables: DisposableGroup | null = null;
|
||||||
|
|
||||||
|
private get _gfx() {
|
||||||
|
return this.editorHost.std.get(GfxControllerIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
private readonly _enterPresentationMode = () => {
|
private readonly _enterPresentationMode = () => {
|
||||||
if (!this._edgelessRootService) {
|
const docModeProvider = this.editorHost.std.get(DocModeProvider);
|
||||||
|
if (docModeProvider.getEditorMode() !== 'edgeless') {
|
||||||
this.editorHost.std.get(DocModeProvider).setEditorMode('edgeless');
|
this.editorHost.std.get(DocModeProvider).setEditorMode('edgeless');
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this._edgelessRootService?.gfx.tool.setTool({
|
this._gfx.tool.setTool({
|
||||||
type: 'frameNavigator',
|
type: 'frameNavigator',
|
||||||
mode: this._navigatorMode,
|
mode: this._navigatorMode,
|
||||||
});
|
});
|
||||||
@@ -132,8 +137,6 @@ export class FramePanelHeader extends WithDisposable(LitElement) {
|
|||||||
private _navigatorMode: NavigatorMode = 'fit';
|
private _navigatorMode: NavigatorMode = 'fit';
|
||||||
|
|
||||||
private readonly _setEdgelessDisposables = () => {
|
private readonly _setEdgelessDisposables = () => {
|
||||||
if (!this._edgelessRootService) return;
|
|
||||||
|
|
||||||
const slots = this.editorHost.std.get(EdgelessLegacySlotIdentifier);
|
const slots = this.editorHost.std.get(EdgelessLegacySlotIdentifier);
|
||||||
|
|
||||||
this._clearEdgelessDisposables();
|
this._clearEdgelessDisposables();
|
||||||
@@ -145,10 +148,6 @@ export class FramePanelHeader extends WithDisposable(LitElement) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
private get _edgelessRootService() {
|
|
||||||
return this.editorHost.std.getOptional(EdgelessRootService);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _tryLoadNavigatorStateLocalRecord() {
|
private _tryLoadNavigatorStateLocalRecord() {
|
||||||
this._navigatorMode = this.editorHost.std
|
this._navigatorMode = this.editorHost.std
|
||||||
.get(EditPropsStore)
|
.get(EditPropsStore)
|
||||||
@@ -219,7 +218,8 @@ export class FramePanelHeader extends WithDisposable(LitElement) {
|
|||||||
|
|
||||||
override updated(_changedProperties: PropertyValues) {
|
override updated(_changedProperties: PropertyValues) {
|
||||||
if (_changedProperties.has('editorHost')) {
|
if (_changedProperties.has('editorHost')) {
|
||||||
if (this._edgelessRootService) {
|
const docModeProvider = this.editorHost.std.get(DocModeProvider);
|
||||||
|
if (docModeProvider.getEditorMode() === 'edgeless') {
|
||||||
this._setEdgelessDisposables();
|
this._setEdgelessDisposables();
|
||||||
} else {
|
} else {
|
||||||
this._clearEdgelessDisposables();
|
this._clearEdgelessDisposables();
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { EditorHost } from '@blocksuite/block-std';
|
import { EdgelessLegacySlotIdentifier } from '@blocksuite/affine-block-surface';
|
||||||
import {
|
import {
|
||||||
EdgelessLegacySlotIdentifier,
|
DocModeProvider,
|
||||||
EdgelessRootService,
|
|
||||||
EditPropsStore,
|
EditPropsStore,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/affine-shared/services';
|
||||||
|
import type { EditorHost } from '@blocksuite/block-std';
|
||||||
import { WithDisposable } from '@blocksuite/global/utils';
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { css, html, LitElement, type PropertyValues } from 'lit';
|
import { css, html, LitElement, type PropertyValues } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, state } from 'lit/decorators.js';
|
||||||
@@ -103,10 +103,6 @@ export class FramesSettingMenu extends WithDisposable(LitElement) {
|
|||||||
this._editPropsStore.setStorage('presentHideToolbar', this.hideToolbar);
|
this._editPropsStore.setStorage('presentHideToolbar', this.hideToolbar);
|
||||||
};
|
};
|
||||||
|
|
||||||
private get _edgelessRootService() {
|
|
||||||
return this.editorHost.std.getOptional(EdgelessRootService);
|
|
||||||
}
|
|
||||||
|
|
||||||
private get _editPropsStore() {
|
private get _editPropsStore() {
|
||||||
return this.editorHost.std.get(EditPropsStore);
|
return this.editorHost.std.get(EditPropsStore);
|
||||||
}
|
}
|
||||||
@@ -176,7 +172,8 @@ export class FramesSettingMenu extends WithDisposable(LitElement) {
|
|||||||
|
|
||||||
override updated(_changedProperties: PropertyValues) {
|
override updated(_changedProperties: PropertyValues) {
|
||||||
if (_changedProperties.has('editorHost')) {
|
if (_changedProperties.has('editorHost')) {
|
||||||
if (this._edgelessRootService) {
|
const docModeProvider = this.editorHost.std.get(DocModeProvider);
|
||||||
|
if (docModeProvider.getEditorMode() === 'edgeless') {
|
||||||
this.disposables.add(
|
this.disposables.add(
|
||||||
this.slots.navigatorSettingUpdated.on(
|
this.slots.navigatorSettingUpdated.on(
|
||||||
({ blackBackground, hideToolbar }) => {
|
({ blackBackground, hideToolbar }) => {
|
||||||
2
blocksuite/affine/fragment-frame-panel/src/index.ts
Normal file
2
blocksuite/affine/fragment-frame-panel/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './frame-panel';
|
||||||
|
export * from './tool';
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
|
import type { NavigatorMode } from '@blocksuite/affine-block-frame';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
|
|
||||||
import type { NavigatorMode } from '../../../_common/edgeless/frame/consts.js';
|
|
||||||
|
|
||||||
type PresentToolOption = {
|
type PresentToolOption = {
|
||||||
mode?: NavigatorMode;
|
mode?: NavigatorMode;
|
||||||
};
|
};
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import { type FrameBlockModel, on, once } from '@blocksuite/blocks';
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
|
import { on, once } from '@blocksuite/affine-shared/utils';
|
||||||
|
|
||||||
import type { FramePanelBody } from '../body/frame-panel-body.js';
|
import type { FramePanelBody } from '../body/frame-panel-body.js';
|
||||||
import { FrameCard } from '../card/frame-card.js';
|
import { FrameCard } from '../card/frame-card.js';
|
||||||
20
blocksuite/affine/fragment-frame-panel/tsconfig.json
Normal file
20
blocksuite/affine/fragment-frame-panel/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "./src",
|
||||||
|
"outDir": "./dist",
|
||||||
|
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
|
||||||
|
},
|
||||||
|
"include": ["./src"],
|
||||||
|
"references": [
|
||||||
|
{ "path": "../block-frame" },
|
||||||
|
{ "path": "../block-surface" },
|
||||||
|
{ "path": "../components" },
|
||||||
|
{ "path": "../model" },
|
||||||
|
{ "path": "../shared" },
|
||||||
|
{ "path": "../../framework/block-std" },
|
||||||
|
{ "path": "../../framework/global" },
|
||||||
|
{ "path": "../../framework/inline" },
|
||||||
|
{ "path": "../../framework/store" }
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -32,6 +32,7 @@
|
|||||||
"@blocksuite/affine-block-surface-ref": "workspace:*",
|
"@blocksuite/affine-block-surface-ref": "workspace:*",
|
||||||
"@blocksuite/affine-block-table": "workspace:*",
|
"@blocksuite/affine-block-table": "workspace:*",
|
||||||
"@blocksuite/affine-components": "workspace:*",
|
"@blocksuite/affine-components": "workspace:*",
|
||||||
|
"@blocksuite/affine-fragment-frame-panel": "workspace:*",
|
||||||
"@blocksuite/affine-model": "workspace:*",
|
"@blocksuite/affine-model": "workspace:*",
|
||||||
"@blocksuite/affine-shared": "workspace:*",
|
"@blocksuite/affine-shared": "workspace:*",
|
||||||
"@blocksuite/affine-widget-drag-handle": "workspace:*",
|
"@blocksuite/affine-widget-drag-handle": "workspace:*",
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export type NavigatorMode = 'fill' | 'fit';
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
import { ConnectionOverlay } from '@blocksuite/affine-block-surface';
|
|
||||||
import type { ExtensionType } from '@blocksuite/store';
|
|
||||||
|
|
||||||
import { EdgelessRootBlockSpec } from '../../root-block/edgeless/edgeless-root-spec.js';
|
|
||||||
import {
|
import {
|
||||||
EdgelessFrameManager,
|
EdgelessFrameManager,
|
||||||
FrameOverlay,
|
FrameOverlay,
|
||||||
} from '../../root-block/edgeless/frame-manager.js';
|
} from '@blocksuite/affine-block-frame';
|
||||||
|
import { ConnectionOverlay } from '@blocksuite/affine-block-surface';
|
||||||
|
import { PresentTool } from '@blocksuite/affine-fragment-frame-panel';
|
||||||
|
import type { ExtensionType } from '@blocksuite/store';
|
||||||
|
|
||||||
|
import { EdgelessRootBlockSpec } from '../../root-block/edgeless/edgeless-root-spec.js';
|
||||||
import { BrushTool } from '../../root-block/edgeless/gfx-tool/brush-tool.js';
|
import { BrushTool } from '../../root-block/edgeless/gfx-tool/brush-tool.js';
|
||||||
import { ConnectorTool } from '../../root-block/edgeless/gfx-tool/connector-tool.js';
|
import { ConnectorTool } from '../../root-block/edgeless/gfx-tool/connector-tool.js';
|
||||||
import { CopilotTool } from '../../root-block/edgeless/gfx-tool/copilot-tool.js';
|
import { CopilotTool } from '../../root-block/edgeless/gfx-tool/copilot-tool.js';
|
||||||
@@ -13,7 +14,6 @@ import { DefaultTool } from '../../root-block/edgeless/gfx-tool/default-tool.js'
|
|||||||
import { MindMapIndicatorOverlay } from '../../root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.js';
|
import { MindMapIndicatorOverlay } from '../../root-block/edgeless/gfx-tool/default-tool-ext/mind-map-ext/indicator-overlay.js';
|
||||||
import { EmptyTool } from '../../root-block/edgeless/gfx-tool/empty-tool.js';
|
import { EmptyTool } from '../../root-block/edgeless/gfx-tool/empty-tool.js';
|
||||||
import { EraserTool } from '../../root-block/edgeless/gfx-tool/eraser-tool.js';
|
import { EraserTool } from '../../root-block/edgeless/gfx-tool/eraser-tool.js';
|
||||||
import { PresentTool } from '../../root-block/edgeless/gfx-tool/frame-navigator-tool.js';
|
|
||||||
import { FrameTool } from '../../root-block/edgeless/gfx-tool/frame-tool.js';
|
import { FrameTool } from '../../root-block/edgeless/gfx-tool/frame-tool.js';
|
||||||
import { LassoTool } from '../../root-block/edgeless/gfx-tool/lasso-tool.js';
|
import { LassoTool } from '../../root-block/edgeless/gfx-tool/lasso-tool.js';
|
||||||
import { NoteTool } from '../../root-block/edgeless/gfx-tool/note-tool.js';
|
import { NoteTool } from '../../root-block/edgeless/gfx-tool/note-tool.js';
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { SmoothCorner } from '@blocksuite/affine-components/smooth-corner';
|
|||||||
import { effects as componentToggleButtonEffects } from '@blocksuite/affine-components/toggle-button';
|
import { effects as componentToggleButtonEffects } from '@blocksuite/affine-components/toggle-button';
|
||||||
import { ToggleSwitch } from '@blocksuite/affine-components/toggle-switch';
|
import { ToggleSwitch } from '@blocksuite/affine-components/toggle-switch';
|
||||||
import { effects as componentToolbarEffects } from '@blocksuite/affine-components/toolbar';
|
import { effects as componentToolbarEffects } from '@blocksuite/affine-components/toolbar';
|
||||||
|
import { effects as fragmentFramePanelEffects } from '@blocksuite/affine-fragment-frame-panel/effects';
|
||||||
import { effects as widgetDragHandleEffects } from '@blocksuite/affine-widget-drag-handle/effects';
|
import { effects as widgetDragHandleEffects } from '@blocksuite/affine-widget-drag-handle/effects';
|
||||||
import { effects as widgetEdgelessAutoConnectEffects } from '@blocksuite/affine-widget-edgeless-auto-connect/effects';
|
import { effects as widgetEdgelessAutoConnectEffects } from '@blocksuite/affine-widget-edgeless-auto-connect/effects';
|
||||||
import { effects as widgetFrameTitleEffects } from '@blocksuite/affine-widget-frame-title/effects';
|
import { effects as widgetFrameTitleEffects } from '@blocksuite/affine-widget-frame-title/effects';
|
||||||
@@ -185,6 +186,8 @@ export function effects() {
|
|||||||
stdEffects();
|
stdEffects();
|
||||||
inlineEffects();
|
inlineEffects();
|
||||||
|
|
||||||
|
dataViewEffects();
|
||||||
|
|
||||||
blockNoteEffects();
|
blockNoteEffects();
|
||||||
blockAttachmentEffects();
|
blockAttachmentEffects();
|
||||||
blockBookmarkEffects();
|
blockBookmarkEffects();
|
||||||
@@ -224,7 +227,8 @@ export function effects() {
|
|||||||
widgetRemoteSelectionEffects();
|
widgetRemoteSelectionEffects();
|
||||||
widgetDragHandleEffects();
|
widgetDragHandleEffects();
|
||||||
widgetEdgelessAutoConnectEffects();
|
widgetEdgelessAutoConnectEffects();
|
||||||
dataViewEffects();
|
|
||||||
|
fragmentFramePanelEffects();
|
||||||
|
|
||||||
customElements.define('affine-page-root', PageRootBlockComponent);
|
customElements.define('affine-page-root', PageRootBlockComponent);
|
||||||
customElements.define('affine-preview-root', PreviewRootBlockComponent);
|
customElements.define('affine-preview-root', PreviewRootBlockComponent);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { splitElements } from './root-block/edgeless/utils/clipboard-utils.js';
|
|||||||
import { isCanvasElement } from './root-block/edgeless/utils/query.js';
|
import { isCanvasElement } from './root-block/edgeless/utils/query.js';
|
||||||
|
|
||||||
export * from './_common/adapters/index.js';
|
export * from './_common/adapters/index.js';
|
||||||
export { type NavigatorMode } from './_common/edgeless/frame/consts.js';
|
|
||||||
export * from './_common/transformers/index.js';
|
export * from './_common/transformers/index.js';
|
||||||
export * from './_specs/index.js';
|
export * from './_specs/index.js';
|
||||||
export { EdgelessTemplatePanel } from './root-block/edgeless/components/toolbar/template/template-panel.js';
|
export { EdgelessTemplatePanel } from './root-block/edgeless/components/toolbar/template/template-panel.js';
|
||||||
@@ -16,10 +15,6 @@ export type {
|
|||||||
TemplateCategory,
|
TemplateCategory,
|
||||||
TemplateManager,
|
TemplateManager,
|
||||||
} from './root-block/edgeless/components/toolbar/template/template-type.js';
|
} from './root-block/edgeless/components/toolbar/template/template-type.js';
|
||||||
export {
|
|
||||||
EdgelessFrameManager,
|
|
||||||
FrameOverlay,
|
|
||||||
} from './root-block/edgeless/frame-manager.js';
|
|
||||||
export { CopilotTool } from './root-block/edgeless/gfx-tool/copilot-tool.js';
|
export { CopilotTool } from './root-block/edgeless/gfx-tool/copilot-tool.js';
|
||||||
export * from './root-block/edgeless/gfx-tool/index.js';
|
export * from './root-block/edgeless/gfx-tool/index.js';
|
||||||
export { EditPropsMiddlewareBuilder } from './root-block/edgeless/middlewares/base.js';
|
export { EditPropsMiddlewareBuilder } from './root-block/edgeless/middlewares/base.js';
|
||||||
@@ -95,6 +90,7 @@ export {
|
|||||||
ToolbarMoreMenuConfigExtension,
|
ToolbarMoreMenuConfigExtension,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from '@blocksuite/affine-components/toolbar';
|
} from '@blocksuite/affine-components/toolbar';
|
||||||
|
export * from '@blocksuite/affine-fragment-frame-panel';
|
||||||
export * from '@blocksuite/affine-model';
|
export * from '@blocksuite/affine-model';
|
||||||
export {
|
export {
|
||||||
AttachmentAdapter,
|
AttachmentAdapter,
|
||||||
|
|||||||
@@ -6,6 +6,11 @@ import {
|
|||||||
SYNCED_MIN_HEIGHT,
|
SYNCED_MIN_HEIGHT,
|
||||||
SYNCED_MIN_WIDTH,
|
SYNCED_MIN_WIDTH,
|
||||||
} from '@blocksuite/affine-block-embed';
|
} from '@blocksuite/affine-block-embed';
|
||||||
|
import {
|
||||||
|
type EdgelessFrameManager,
|
||||||
|
type FrameOverlay,
|
||||||
|
isFrameBlock,
|
||||||
|
} from '@blocksuite/affine-block-frame';
|
||||||
import {
|
import {
|
||||||
CanvasElementType,
|
CanvasElementType,
|
||||||
isNoteBlock,
|
isNoteBlock,
|
||||||
@@ -65,10 +70,6 @@ import { ifDefined } from 'lit/directives/if-defined.js';
|
|||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
||||||
import type {
|
|
||||||
EdgelessFrameManager,
|
|
||||||
FrameOverlay,
|
|
||||||
} from '../../frame-manager.js';
|
|
||||||
import {
|
import {
|
||||||
AI_CHAT_BLOCK_MAX_HEIGHT,
|
AI_CHAT_BLOCK_MAX_HEIGHT,
|
||||||
AI_CHAT_BLOCK_MAX_WIDTH,
|
AI_CHAT_BLOCK_MAX_WIDTH,
|
||||||
@@ -90,7 +91,6 @@ import {
|
|||||||
isEmbedLoomBlock,
|
isEmbedLoomBlock,
|
||||||
isEmbedSyncedDocBlock,
|
isEmbedSyncedDocBlock,
|
||||||
isEmbedYoutubeBlock,
|
isEmbedYoutubeBlock,
|
||||||
isFrameBlock,
|
|
||||||
isImageBlock,
|
isImageBlock,
|
||||||
isMindmapNode,
|
isMindmapNode,
|
||||||
} from '../../utils/query.js';
|
} from '../../utils/query.js';
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
isFrameBlock,
|
||||||
|
type NavigatorMode,
|
||||||
|
} from '@blocksuite/affine-block-frame';
|
||||||
import { toast } from '@blocksuite/affine-components/toast';
|
import { toast } from '@blocksuite/affine-components/toast';
|
||||||
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
||||||
@@ -15,9 +19,7 @@ import { cssVar } from '@toeverything/theme';
|
|||||||
import { css, html, LitElement, nothing, type PropertyValues } from 'lit';
|
import { css, html, LitElement, nothing, type PropertyValues } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, state } from 'lit/decorators.js';
|
||||||
|
|
||||||
import type { NavigatorMode } from '../../../../_common/edgeless/frame/consts.js';
|
|
||||||
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
||||||
import { isFrameBlock } from '../../utils/query.js';
|
|
||||||
import { launchIntoFullscreen } from '../utils.js';
|
import { launchIntoFullscreen } from '../utils.js';
|
||||||
import { EdgelessToolbarToolMixin } from './mixins/tool.mixin.js';
|
import { EdgelessToolbarToolMixin } from './mixins/tool.mixin.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { EdgelessFrameManager } from '@blocksuite/affine-block-frame';
|
||||||
import {
|
import {
|
||||||
EdgelessCRUDIdentifier,
|
EdgelessCRUDIdentifier,
|
||||||
EdgelessLegacySlotIdentifier,
|
EdgelessLegacySlotIdentifier,
|
||||||
@@ -36,7 +37,6 @@ import { Bound, getCommonBound } from '@blocksuite/global/utils';
|
|||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
import { RootService } from '../root-service.js';
|
import { RootService } from '../root-service.js';
|
||||||
import type { EdgelessFrameManager } from './frame-manager.js';
|
|
||||||
import { TemplateJob } from './services/template.js';
|
import { TemplateJob } from './services/template.js';
|
||||||
import {
|
import {
|
||||||
createInsertPlaceMiddleware,
|
createInsertPlaceMiddleware,
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
import { insertEdgelessTextCommand } from '@blocksuite/affine-block-edgeless-text';
|
import { insertEdgelessTextCommand } from '@blocksuite/affine-block-edgeless-text';
|
||||||
|
import {
|
||||||
|
type EdgelessFrameManager,
|
||||||
|
type FrameOverlay,
|
||||||
|
isFrameBlock,
|
||||||
|
} from '@blocksuite/affine-block-frame';
|
||||||
import {
|
import {
|
||||||
ConnectorUtils,
|
ConnectorUtils,
|
||||||
isNoteBlock,
|
isNoteBlock,
|
||||||
@@ -50,14 +55,9 @@ import { effect } from '@preact/signals-core';
|
|||||||
|
|
||||||
import { isSingleMindMapNode } from '../../../_common/edgeless/mindmap/index.js';
|
import { isSingleMindMapNode } from '../../../_common/edgeless/mindmap/index.js';
|
||||||
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
||||||
import type { EdgelessFrameManager, FrameOverlay } from '../frame-manager.js';
|
|
||||||
import { prepareCloneData } from '../utils/clone-utils.js';
|
import { prepareCloneData } from '../utils/clone-utils.js';
|
||||||
import { calPanDelta } from '../utils/panning-utils.js';
|
import { calPanDelta } from '../utils/panning-utils.js';
|
||||||
import {
|
import { isCanvasElement, isEdgelessTextBlock } from '../utils/query.js';
|
||||||
isCanvasElement,
|
|
||||||
isEdgelessTextBlock,
|
|
||||||
isFrameBlock,
|
|
||||||
} from '../utils/query.js';
|
|
||||||
import type { EdgelessSnapManager } from '../utils/snap-manager.js';
|
import type { EdgelessSnapManager } from '../utils/snap-manager.js';
|
||||||
import {
|
import {
|
||||||
addText,
|
addText,
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import type {
|
||||||
|
EdgelessFrameManager,
|
||||||
|
FrameOverlay,
|
||||||
|
} from '@blocksuite/affine-block-frame';
|
||||||
import { OverlayIdentifier } from '@blocksuite/affine-block-surface';
|
import { OverlayIdentifier } from '@blocksuite/affine-block-surface';
|
||||||
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
import type { FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import {
|
import {
|
||||||
@@ -15,8 +19,6 @@ import { Bound, Vec } from '@blocksuite/global/utils';
|
|||||||
import { Text } from '@blocksuite/store';
|
import { Text } from '@blocksuite/store';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import type { EdgelessFrameManager, FrameOverlay } from '../frame-manager.js';
|
|
||||||
|
|
||||||
export class FrameTool extends BaseTool {
|
export class FrameTool extends BaseTool {
|
||||||
static override toolName = 'frame';
|
static override toolName = 'frame';
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ export { CopilotTool } from './copilot-tool.js';
|
|||||||
export { DefaultTool } from './default-tool.js';
|
export { DefaultTool } from './default-tool.js';
|
||||||
export { EmptyTool } from './empty-tool.js';
|
export { EmptyTool } from './empty-tool.js';
|
||||||
export { EraserTool } from './eraser-tool.js';
|
export { EraserTool } from './eraser-tool.js';
|
||||||
export { PresentTool } from './frame-navigator-tool.js';
|
|
||||||
export { FrameTool } from './frame-tool.js';
|
export { FrameTool } from './frame-tool.js';
|
||||||
export { LassoTool, type LassoToolOption } from './lasso-tool.js';
|
export { LassoTool, type LassoToolOption } from './lasso-tool.js';
|
||||||
export { NoteTool, type NoteToolOption } from './note-tool.js';
|
export { NoteTool, type NoteToolOption } from './note-tool.js';
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
import {
|
||||||
|
EdgelessFrameManager,
|
||||||
|
isFrameBlock,
|
||||||
|
} from '@blocksuite/affine-block-frame';
|
||||||
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
||||||
import type {
|
import type {
|
||||||
EdgelessTextBlockModel,
|
EdgelessTextBlockModel,
|
||||||
@@ -18,12 +22,10 @@ import { getCommonBoundWithRotation, groupBy } from '@blocksuite/global/utils';
|
|||||||
import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';
|
import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
||||||
import { EdgelessFrameManager } from '../frame-manager.js';
|
|
||||||
import { getSortedCloneElements, prepareCloneData } from './clone-utils.js';
|
import { getSortedCloneElements, prepareCloneData } from './clone-utils.js';
|
||||||
import {
|
import {
|
||||||
isEdgelessTextBlock,
|
isEdgelessTextBlock,
|
||||||
isEmbedSyncedDocBlock,
|
isEmbedSyncedDocBlock,
|
||||||
isFrameBlock,
|
|
||||||
isImageBlock,
|
isImageBlock,
|
||||||
} from './query.js';
|
} from './query.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export function areSetsEqual<T>(setA: Set<T>, setB: Set<T>) {
|
|
||||||
if (setA.size !== setB.size) return false;
|
|
||||||
for (const a of setA) if (!setB.has(a)) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,6 @@ import {
|
|||||||
type EmbedLoomModel,
|
type EmbedLoomModel,
|
||||||
type EmbedSyncedDocModel,
|
type EmbedSyncedDocModel,
|
||||||
type EmbedYoutubeModel,
|
type EmbedYoutubeModel,
|
||||||
type FrameBlockModel,
|
|
||||||
type ImageBlockModel,
|
type ImageBlockModel,
|
||||||
MindmapElementModel,
|
MindmapElementModel,
|
||||||
ShapeElementModel,
|
ShapeElementModel,
|
||||||
@@ -49,10 +48,6 @@ export function isEdgelessTextBlock(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isFrameBlock(element: unknown): element is FrameBlockModel {
|
|
||||||
return !!element && (element as BlockModel).flavour === 'affine:frame';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isImageBlock(
|
export function isImageBlock(
|
||||||
element: BlockModel | GfxModel | null
|
element: BlockModel | GfxModel | null
|
||||||
): element is ImageBlockModel {
|
): element is ImageBlockModel {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { EdgelessFrameManager } from '@blocksuite/affine-block-frame';
|
||||||
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
|
import { EdgelessCRUDIdentifier } from '@blocksuite/affine-block-surface';
|
||||||
import type {
|
import type {
|
||||||
EdgelessColorPickerButton,
|
EdgelessColorPickerButton,
|
||||||
@@ -36,7 +37,6 @@ import { join } from 'lit/directives/join.js';
|
|||||||
import { when } from 'lit/directives/when.js';
|
import { when } from 'lit/directives/when.js';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../../edgeless/edgeless-root-block.js';
|
||||||
import type { EdgelessFrameManager } from '../../edgeless/frame-manager.js';
|
|
||||||
import { mountFrameTitleEditor } from '../../edgeless/utils/text.js';
|
import { mountFrameTitleEditor } from '../../edgeless/utils/text.js';
|
||||||
|
|
||||||
function getMostCommonColor(
|
function getMostCommonColor(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { isFrameBlock } from '@blocksuite/affine-block-frame';
|
||||||
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
import { isNoteBlock } from '@blocksuite/affine-block-surface';
|
||||||
import {
|
import {
|
||||||
cloneGroups,
|
cloneGroups,
|
||||||
@@ -47,7 +48,6 @@ import {
|
|||||||
isBookmarkBlock,
|
isBookmarkBlock,
|
||||||
isEdgelessTextBlock,
|
isEdgelessTextBlock,
|
||||||
isEmbeddedBlock,
|
isEmbeddedBlock,
|
||||||
isFrameBlock,
|
|
||||||
isImageBlock,
|
isImageBlock,
|
||||||
} from '../../edgeless/utils/query.js';
|
} from '../../edgeless/utils/query.js';
|
||||||
import { renderAddFrameButton } from './add-frame-button.js';
|
import { renderAddFrameButton } from './add-frame-button.js';
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { isFrameBlock } from '@blocksuite/affine-block-frame';
|
||||||
import {
|
import {
|
||||||
isNoteBlock,
|
isNoteBlock,
|
||||||
type SurfaceBlockComponent,
|
type SurfaceBlockComponent,
|
||||||
@@ -18,7 +19,6 @@ import {
|
|||||||
isEmbeddedLinkBlock,
|
isEmbeddedLinkBlock,
|
||||||
isEmbedLinkedDocBlock,
|
isEmbedLinkedDocBlock,
|
||||||
isEmbedSyncedDocBlock,
|
isEmbedSyncedDocBlock,
|
||||||
isFrameBlock,
|
|
||||||
isImageBlock,
|
isImageBlock,
|
||||||
} from '../../../edgeless/utils/query.js';
|
} from '../../../edgeless/utils/query.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { isFrameBlock } from '@blocksuite/affine-block-frame';
|
||||||
import { getSurfaceBlock, isNoteBlock } from '@blocksuite/affine-block-surface';
|
import { getSurfaceBlock, isNoteBlock } from '@blocksuite/affine-block-surface';
|
||||||
import type { FrameBlockModel, NoteBlockModel } from '@blocksuite/affine-model';
|
import type { FrameBlockModel, NoteBlockModel } from '@blocksuite/affine-model';
|
||||||
import { NoteDisplayMode } from '@blocksuite/affine-model';
|
import { NoteDisplayMode } from '@blocksuite/affine-model';
|
||||||
@@ -12,7 +13,6 @@ import {
|
|||||||
mapFrameIds,
|
mapFrameIds,
|
||||||
sortEdgelessElements,
|
sortEdgelessElements,
|
||||||
} from '../../../edgeless/utils/clone-utils.js';
|
} from '../../../edgeless/utils/clone-utils.js';
|
||||||
import { isFrameBlock } from '../../../edgeless/utils/query.js';
|
|
||||||
|
|
||||||
function addBlocksToDoc(targetDoc: Store, model: BlockModel, parentId: string) {
|
function addBlocksToDoc(targetDoc: Store, model: BlockModel, parentId: string) {
|
||||||
// Add current block to linked doc
|
// Add current block to linked doc
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
{ "path": "../affine/block-surface-ref" },
|
{ "path": "../affine/block-surface-ref" },
|
||||||
{ "path": "../affine/block-table" },
|
{ "path": "../affine/block-table" },
|
||||||
{ "path": "../affine/components" },
|
{ "path": "../affine/components" },
|
||||||
|
{ "path": "../affine/fragment-frame-panel" },
|
||||||
{ "path": "../affine/model" },
|
{ "path": "../affine/model" },
|
||||||
{ "path": "../affine/shared" },
|
{ "path": "../affine/shared" },
|
||||||
{ "path": "../affine/widget-drag-handle" },
|
{ "path": "../affine/widget-drag-handle" },
|
||||||
|
|||||||
@@ -8,36 +8,10 @@ import {
|
|||||||
} from './editors/index.js';
|
} from './editors/index.js';
|
||||||
import { CommentInput } from './fragments/comment/comment-input.js';
|
import { CommentInput } from './fragments/comment/comment-input.js';
|
||||||
import {
|
import {
|
||||||
AFFINE_FRAME_PANEL_BODY,
|
|
||||||
FramePanelBody,
|
|
||||||
} from './fragments/frame-panel/body/frame-panel-body.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAME_CARD,
|
|
||||||
FrameCard,
|
|
||||||
} from './fragments/frame-panel/card/frame-card.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAME_CARD_TITLE,
|
|
||||||
FrameCardTitle,
|
|
||||||
} from './fragments/frame-panel/card/frame-card-title.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAME_TITLE_EDITOR,
|
|
||||||
FrameCardTitleEditor,
|
|
||||||
} from './fragments/frame-panel/card/frame-card-title-editor.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAME_PANEL_HEADER,
|
|
||||||
FramePanelHeader,
|
|
||||||
} from './fragments/frame-panel/header/frame-panel-header.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAMES_SETTING_MENU,
|
|
||||||
FramesSettingMenu,
|
|
||||||
} from './fragments/frame-panel/header/frames-setting-menu.js';
|
|
||||||
import {
|
|
||||||
AFFINE_FRAME_PANEL,
|
|
||||||
AFFINE_MOBILE_OUTLINE_MENU,
|
AFFINE_MOBILE_OUTLINE_MENU,
|
||||||
AFFINE_OUTLINE_PANEL,
|
AFFINE_OUTLINE_PANEL,
|
||||||
AFFINE_OUTLINE_VIEWER,
|
AFFINE_OUTLINE_VIEWER,
|
||||||
CommentPanel,
|
CommentPanel,
|
||||||
FramePanel,
|
|
||||||
MobileOutlineMenu,
|
MobileOutlineMenu,
|
||||||
OutlinePanel,
|
OutlinePanel,
|
||||||
OutlineViewer,
|
OutlineViewer,
|
||||||
@@ -74,22 +48,15 @@ export function effects() {
|
|||||||
AFFINE_OUTLINE_NOTE_PREVIEW_SETTING_MENU,
|
AFFINE_OUTLINE_NOTE_PREVIEW_SETTING_MENU,
|
||||||
OutlineNotePreviewSettingMenu
|
OutlineNotePreviewSettingMenu
|
||||||
);
|
);
|
||||||
customElements.define(AFFINE_FRAME_PANEL, FramePanel);
|
|
||||||
customElements.define(AFFINE_OUTLINE_NOTICE, OutlineNotice);
|
customElements.define(AFFINE_OUTLINE_NOTICE, OutlineNotice);
|
||||||
customElements.define('comment-panel', CommentPanel);
|
customElements.define('comment-panel', CommentPanel);
|
||||||
customElements.define(AFFINE_OUTLINE_PANEL, OutlinePanel);
|
customElements.define(AFFINE_OUTLINE_PANEL, OutlinePanel);
|
||||||
customElements.define(AFFINE_OUTLINE_PANEL_HEADER, OutlinePanelHeader);
|
customElements.define(AFFINE_OUTLINE_PANEL_HEADER, OutlinePanelHeader);
|
||||||
customElements.define('affine-editor-container', AffineEditorContainer);
|
customElements.define('affine-editor-container', AffineEditorContainer);
|
||||||
customElements.define(AFFINE_OUTLINE_NOTE_CARD, OutlineNoteCard);
|
customElements.define(AFFINE_OUTLINE_NOTE_CARD, OutlineNoteCard);
|
||||||
customElements.define(AFFINE_FRAME_TITLE_EDITOR, FrameCardTitleEditor);
|
|
||||||
customElements.define('edgeless-editor', EdgelessEditor);
|
customElements.define('edgeless-editor', EdgelessEditor);
|
||||||
customElements.define(AFFINE_FRAME_CARD, FrameCard);
|
|
||||||
customElements.define(AFFINE_OUTLINE_VIEWER, OutlineViewer);
|
customElements.define(AFFINE_OUTLINE_VIEWER, OutlineViewer);
|
||||||
customElements.define(AFFINE_MOBILE_OUTLINE_MENU, MobileOutlineMenu);
|
customElements.define(AFFINE_MOBILE_OUTLINE_MENU, MobileOutlineMenu);
|
||||||
customElements.define(AFFINE_FRAME_CARD_TITLE, FrameCardTitle);
|
|
||||||
customElements.define(AFFINE_OUTLINE_BLOCK_PREVIEW, OutlineBlockPreview);
|
customElements.define(AFFINE_OUTLINE_BLOCK_PREVIEW, OutlineBlockPreview);
|
||||||
customElements.define(AFFINE_FRAME_PANEL_BODY, FramePanelBody);
|
|
||||||
customElements.define(AFFINE_FRAME_PANEL_HEADER, FramePanelHeader);
|
|
||||||
customElements.define(AFFINE_OUTLINE_PANEL_BODY, OutlinePanelBody);
|
customElements.define(AFFINE_OUTLINE_PANEL_BODY, OutlinePanelBody);
|
||||||
customElements.define(AFFINE_FRAMES_SETTING_MENU, FramesSettingMenu);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
export * from './frame-panel.js';
|
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
export * from './comment/index.js';
|
export * from './comment/index.js';
|
||||||
export * from './frame-panel/index.js';
|
|
||||||
export * from './outline/index.js';
|
export * from './outline/index.js';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
import { FramePanel } from '@blocksuite/affine/blocks';
|
||||||
import type { AffineEditorContainer } from '@blocksuite/affine/presets';
|
import type { AffineEditorContainer } from '@blocksuite/affine/presets';
|
||||||
import { FramePanel } from '@blocksuite/affine/presets';
|
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
|
|
||||||
import * as styles from './frame.css';
|
import * as styles from './frame.css';
|
||||||
|
|||||||
@@ -131,6 +131,7 @@ export const PackageList = [
|
|||||||
location: 'blocksuite/affine/block-frame',
|
location: 'blocksuite/affine/block-frame',
|
||||||
name: '@blocksuite/affine-block-frame',
|
name: '@blocksuite/affine-block-frame',
|
||||||
workspaceDependencies: [
|
workspaceDependencies: [
|
||||||
|
'blocksuite/affine/block-surface',
|
||||||
'blocksuite/affine/components',
|
'blocksuite/affine/components',
|
||||||
'blocksuite/affine/model',
|
'blocksuite/affine/model',
|
||||||
'blocksuite/affine/shared',
|
'blocksuite/affine/shared',
|
||||||
@@ -273,6 +274,21 @@ export const PackageList = [
|
|||||||
'blocksuite/framework/store',
|
'blocksuite/framework/store',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
location: 'blocksuite/affine/fragment-frame-panel',
|
||||||
|
name: '@blocksuite/affine-fragment-frame-panel',
|
||||||
|
workspaceDependencies: [
|
||||||
|
'blocksuite/affine/block-frame',
|
||||||
|
'blocksuite/affine/block-surface',
|
||||||
|
'blocksuite/affine/components',
|
||||||
|
'blocksuite/affine/model',
|
||||||
|
'blocksuite/affine/shared',
|
||||||
|
'blocksuite/framework/block-std',
|
||||||
|
'blocksuite/framework/global',
|
||||||
|
'blocksuite/framework/inline',
|
||||||
|
'blocksuite/framework/store',
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
location: 'blocksuite/affine/model',
|
location: 'blocksuite/affine/model',
|
||||||
name: '@blocksuite/affine-model',
|
name: '@blocksuite/affine-model',
|
||||||
@@ -379,6 +395,7 @@ export const PackageList = [
|
|||||||
'blocksuite/affine/block-surface-ref',
|
'blocksuite/affine/block-surface-ref',
|
||||||
'blocksuite/affine/block-table',
|
'blocksuite/affine/block-table',
|
||||||
'blocksuite/affine/components',
|
'blocksuite/affine/components',
|
||||||
|
'blocksuite/affine/fragment-frame-panel',
|
||||||
'blocksuite/affine/model',
|
'blocksuite/affine/model',
|
||||||
'blocksuite/affine/shared',
|
'blocksuite/affine/shared',
|
||||||
'blocksuite/affine/widget-drag-handle',
|
'blocksuite/affine/widget-drag-handle',
|
||||||
@@ -762,6 +779,7 @@ export type PackageName =
|
|||||||
| '@blocksuite/affine-block-table'
|
| '@blocksuite/affine-block-table'
|
||||||
| '@blocksuite/affine-components'
|
| '@blocksuite/affine-components'
|
||||||
| '@blocksuite/data-view'
|
| '@blocksuite/data-view'
|
||||||
|
| '@blocksuite/affine-fragment-frame-panel'
|
||||||
| '@blocksuite/affine-model'
|
| '@blocksuite/affine-model'
|
||||||
| '@blocksuite/affine-shared'
|
| '@blocksuite/affine-shared'
|
||||||
| '@blocksuite/affine-widget-drag-handle'
|
| '@blocksuite/affine-widget-drag-handle'
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
{ "path": "./blocksuite/affine/block-table" },
|
{ "path": "./blocksuite/affine/block-table" },
|
||||||
{ "path": "./blocksuite/affine/components" },
|
{ "path": "./blocksuite/affine/components" },
|
||||||
{ "path": "./blocksuite/affine/data-view" },
|
{ "path": "./blocksuite/affine/data-view" },
|
||||||
|
{ "path": "./blocksuite/affine/fragment-frame-panel" },
|
||||||
{ "path": "./blocksuite/affine/model" },
|
{ "path": "./blocksuite/affine/model" },
|
||||||
{ "path": "./blocksuite/affine/shared" },
|
{ "path": "./blocksuite/affine/shared" },
|
||||||
{ "path": "./blocksuite/affine/widget-drag-handle" },
|
{ "path": "./blocksuite/affine/widget-drag-handle" },
|
||||||
|
|||||||
27
yarn.lock
27
yarn.lock
@@ -3471,6 +3471,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@blocksuite/affine-block-frame@workspace:blocksuite/affine/block-frame"
|
resolution: "@blocksuite/affine-block-frame@workspace:blocksuite/affine/block-frame"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
"@blocksuite/affine-block-surface": "workspace:*"
|
||||||
"@blocksuite/affine-components": "workspace:*"
|
"@blocksuite/affine-components": "workspace:*"
|
||||||
"@blocksuite/affine-model": "workspace:*"
|
"@blocksuite/affine-model": "workspace:*"
|
||||||
"@blocksuite/affine-shared": "workspace:*"
|
"@blocksuite/affine-shared": "workspace:*"
|
||||||
@@ -3485,6 +3486,7 @@ __metadata:
|
|||||||
"@types/mdast": "npm:^4.0.4"
|
"@types/mdast": "npm:^4.0.4"
|
||||||
lit: "npm:^3.2.0"
|
lit: "npm:^3.2.0"
|
||||||
minimatch: "npm:^10.0.1"
|
minimatch: "npm:^10.0.1"
|
||||||
|
yjs: "npm:^13.6.21"
|
||||||
zod: "npm:^3.23.8"
|
zod: "npm:^3.23.8"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
@@ -3718,6 +3720,30 @@ __metadata:
|
|||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"@blocksuite/affine-fragment-frame-panel@workspace:*, @blocksuite/affine-fragment-frame-panel@workspace:blocksuite/affine/fragment-frame-panel":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "@blocksuite/affine-fragment-frame-panel@workspace:blocksuite/affine/fragment-frame-panel"
|
||||||
|
dependencies:
|
||||||
|
"@blocksuite/affine-block-frame": "workspace:*"
|
||||||
|
"@blocksuite/affine-block-surface": "workspace:*"
|
||||||
|
"@blocksuite/affine-components": "workspace:*"
|
||||||
|
"@blocksuite/affine-model": "workspace:*"
|
||||||
|
"@blocksuite/affine-shared": "workspace:*"
|
||||||
|
"@blocksuite/block-std": "workspace:*"
|
||||||
|
"@blocksuite/global": "workspace:*"
|
||||||
|
"@blocksuite/icons": "npm:^2.2.1"
|
||||||
|
"@blocksuite/inline": "workspace:*"
|
||||||
|
"@blocksuite/store": "workspace:*"
|
||||||
|
"@floating-ui/dom": "npm:^1.6.10"
|
||||||
|
"@lit/context": "npm:^1.1.2"
|
||||||
|
"@preact/signals-core": "npm:^1.8.0"
|
||||||
|
"@toeverything/theme": "npm:^1.1.11"
|
||||||
|
lit: "npm:^3.2.0"
|
||||||
|
minimatch: "npm:^10.0.1"
|
||||||
|
zod: "npm:^3.23.8"
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"@blocksuite/affine-model@workspace:*, @blocksuite/affine-model@workspace:blocksuite/affine/model":
|
"@blocksuite/affine-model@workspace:*, @blocksuite/affine-model@workspace:blocksuite/affine/model":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@blocksuite/affine-model@workspace:blocksuite/affine/model"
|
resolution: "@blocksuite/affine-model@workspace:blocksuite/affine/model"
|
||||||
@@ -3935,6 +3961,7 @@ __metadata:
|
|||||||
"@blocksuite/affine-block-surface-ref": "workspace:*"
|
"@blocksuite/affine-block-surface-ref": "workspace:*"
|
||||||
"@blocksuite/affine-block-table": "workspace:*"
|
"@blocksuite/affine-block-table": "workspace:*"
|
||||||
"@blocksuite/affine-components": "workspace:*"
|
"@blocksuite/affine-components": "workspace:*"
|
||||||
|
"@blocksuite/affine-fragment-frame-panel": "workspace:*"
|
||||||
"@blocksuite/affine-model": "workspace:*"
|
"@blocksuite/affine-model": "workspace:*"
|
||||||
"@blocksuite/affine-shared": "workspace:*"
|
"@blocksuite/affine-shared": "workspace:*"
|
||||||
"@blocksuite/affine-widget-drag-handle": "workspace:*"
|
"@blocksuite/affine-widget-drag-handle": "workspace:*"
|
||||||
|
|||||||
Reference in New Issue
Block a user