diff --git a/blocksuite/affine/block-frame/package.json b/blocksuite/affine/block-frame/package.json new file mode 100644 index 0000000000..5bdbf383af --- /dev/null +++ b/blocksuite/affine/block-frame/package.json @@ -0,0 +1,42 @@ +{ + "name": "@blocksuite/affine-block-frame", + "description": "Frame block 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-components": "workspace:*", + "@blocksuite/affine-model": "workspace:*", + "@blocksuite/affine-shared": "workspace:*", + "@blocksuite/block-std": "workspace:*", + "@blocksuite/global": "workspace:*", + "@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.1", + "@types/mdast": "^4.0.4", + "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__" + ] +} diff --git a/blocksuite/affine/block-frame/src/effects.ts b/blocksuite/affine/block-frame/src/effects.ts new file mode 100644 index 0000000000..557ff8b6a3 --- /dev/null +++ b/blocksuite/affine/block-frame/src/effects.ts @@ -0,0 +1,5 @@ +import { FrameBlockComponent } from './frame-block'; + +export function effects() { + customElements.define('affine-frame', FrameBlockComponent); +} diff --git a/blocksuite/blocks/src/frame-block/frame-block.ts b/blocksuite/affine/block-frame/src/frame-block.ts similarity index 89% rename from blocksuite/blocks/src/frame-block/frame-block.ts rename to blocksuite/affine/block-frame/src/frame-block.ts index 1250575cf2..61f583b842 100644 --- a/blocksuite/blocks/src/frame-block/frame-block.ts +++ b/blocksuite/affine/block-frame/src/frame-block.ts @@ -7,13 +7,7 @@ import { html } from 'lit'; import { state } from 'lit/decorators.js'; import { styleMap } from 'lit/directives/style-map.js'; -import type { EdgelessRootService } from '../root-block/index.js'; - export class FrameBlockComponent extends GfxBlockComponent { - get rootService() { - return this.std.getService('affine:page') as EdgelessRootService; - } - override connectedCallback() { super.connectedCallback(); @@ -59,13 +53,13 @@ export class FrameBlockComponent extends GfxBlockComponent { } override renderGfxBlock() { - const { model, showBorder, rootService, std } = this; + const { model, showBorder, std } = this; const backgroundColor = std .get(ThemeProvider) .generateColorProperty(model.background, '--affine-platte-transparent'); const _isNavigator = this.gfx.tool.currentToolName$.value === 'frameNavigator'; - const frameIndex = rootService.layer.getZIndex(model); + const frameIndex = this.gfx.layer.getZIndex(model); return html`