refactor(editor): rename block-std to std (#11250)

Closes: BS-2946
This commit is contained in:
Saul-Mirone
2025-03-28 07:20:34 +00:00
parent 4498676a96
commit 205cd7a86d
1029 changed files with 1580 additions and 1698 deletions
@@ -1,7 +1,7 @@
/**
* @vitest-environment happy-dom
*/
import { BlockSelection, TextSelection } from '@blocksuite/block-std';
import { BlockSelection, TextSelection } from '@blocksuite/std';
import { describe, expect, it, vi } from 'vitest';
import { isNothingSelectedCommand } from '../../../commands/selection/is-nothing-selected';
@@ -1,4 +1,4 @@
import { CommandManager, type EditorHost } from '@blocksuite/block-std';
import { CommandManager, type EditorHost } from '@blocksuite/std';
import type { Block, Store } from '@blocksuite/store';
import { Subject } from 'rxjs';
@@ -4,7 +4,7 @@ import {
type EditorHost,
type TextRangePoint,
TextSelection,
} from '@blocksuite/block-std';
} from '@blocksuite/std';
import type {
BlockSnapshot,
DraftModel,
@@ -6,6 +6,7 @@ import {
type ParagraphBlockModel,
type ReferenceInfo,
} from '@blocksuite/affine-model';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import {
BLOCK_ID_ATTR,
type BlockComponent,
@@ -13,8 +14,7 @@ import {
type EditorHost,
type TextRangePoint,
TextSelection,
} from '@blocksuite/block-std';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
} from '@blocksuite/std';
import {
type BlockModel,
type BlockSnapshot,
@@ -1,4 +1,4 @@
import type { BlockStdScope } from '@blocksuite/block-std';
import type { BlockStdScope } from '@blocksuite/std';
import type { TransformerMiddleware } from '@blocksuite/store';
export const surfaceRefToEmbed =
@@ -1,4 +1,4 @@
import type { BlockComponent, Command } from '@blocksuite/block-std';
import type { BlockComponent, Command } from '@blocksuite/std';
export const getBlockIndexCommand: Command<
{
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
type Role = 'content' | 'hub';
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
type Role = 'content' | 'hub';
@@ -1,8 +1,4 @@
import type {
BlockComponent,
BlockStdScope,
Command,
} from '@blocksuite/block-std';
import type { BlockComponent, BlockStdScope, Command } from '@blocksuite/std';
import { getNextContentBlock } from '../../utils/index.js';
@@ -1,8 +1,4 @@
import type {
BlockComponent,
BlockStdScope,
Command,
} from '@blocksuite/block-std';
import type { BlockComponent, BlockStdScope, Command } from '@blocksuite/std';
import { getPrevContentBlock } from '../../utils/index.js';
@@ -1,9 +1,5 @@
import type {
BlockSelection,
Command,
TextSelection,
} from '@blocksuite/block-std';
import { BlockComponent } from '@blocksuite/block-std';
import type { BlockSelection, Command, TextSelection } from '@blocksuite/std';
import { BlockComponent } from '@blocksuite/std';
import type { RoleType } from '@blocksuite/store';
import type { ImageSelection } from '../../selection/index.js';
@@ -1,4 +1,4 @@
import { type Command, TextSelection } from '@blocksuite/block-std';
import { type Command, TextSelection } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
export const clearAndSelectFirstModelCommand: Command<{
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import { type BlockModel, type DraftModel, Slice } from '@blocksuite/store';
export const copySelectedModelsCommand: Command<{
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
export const deleteSelectedModelsCommand: Command<{
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import {
type BlockModel,
type DraftModel,
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import { type BlockModel, type DraftModel, Slice } from '@blocksuite/store';
export const duplicateSelectedModelsCommand: Command<{
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
import { getSelectedBlocksCommand } from '../block-crud/get-selected-blocks';
@@ -1,4 +1,4 @@
import type { Command } from '@blocksuite/block-std';
import type { Command } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
export const retainFirstModelCommand: Command<{
@@ -2,7 +2,7 @@ import {
type BlockComponent,
type Command,
TextSelection,
} from '@blocksuite/block-std';
} from '@blocksuite/std';
/**
* Focus the end of the block
@@ -2,7 +2,7 @@ import {
type BlockComponent,
type Command,
TextSelection,
} from '@blocksuite/block-std';
} from '@blocksuite/std';
export const focusBlockStart: Command<{
focusBlock?: BlockComponent;
@@ -1,4 +1,4 @@
import { BlockSelection } from '@blocksuite/block-std';
import { BlockSelection } from '@blocksuite/std';
import type { GetSelectionCommand } from './types';
@@ -1,8 +1,4 @@
import type {
BlockSelection,
Command,
TextSelection,
} from '@blocksuite/block-std';
import type { BlockSelection, Command, TextSelection } from '@blocksuite/std';
import { getViewportElement } from '../../utils/index.js';
@@ -1,4 +1,4 @@
import { TextSelection } from '@blocksuite/block-std';
import { TextSelection } from '@blocksuite/std';
import type { GetSelectionCommand } from './types';
@@ -1,8 +1,4 @@
import {
BlockSelection,
type Command,
TextSelection,
} from '@blocksuite/block-std';
import { BlockSelection, type Command, TextSelection } from '@blocksuite/std';
import { ImageSelection } from '../../selection';
@@ -1,8 +1,4 @@
import type {
BlockSelection,
Command,
TextSelection,
} from '@blocksuite/block-std';
import type { BlockSelection, Command, TextSelection } from '@blocksuite/std';
import type { ImageSelection } from '../../selection/image';
@@ -1,5 +1,4 @@
import type { AliasInfo, ReferenceParams } from '@blocksuite/affine-model';
import { LifeCycleWatcher, StdIdentifier } from '@blocksuite/block-std';
import { type Container, createIdentifier } from '@blocksuite/global/di';
import {
type DisposableMember,
@@ -14,6 +13,7 @@ import {
LinkedPageIcon,
PageIcon,
} from '@blocksuite/icons/lit';
import { LifeCycleWatcher, StdIdentifier } from '@blocksuite/std';
import type { Store } from '@blocksuite/store';
import { computed, type Signal, signal } from '@preact/signals-core';
import type { TemplateResult } from 'lit';
@@ -1,5 +1,5 @@
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
import { type Container, createIdentifier } from '@blocksuite/global/di';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/std';
import { Extension, Slice, type SliceSnapshot } from '@blocksuite/store';
export const DndApiExtensionIdentifier = createIdentifier<DNDAPIExtension>(
@@ -1,8 +1,8 @@
import { ColorSchema } from '@blocksuite/affine-model';
import { type BlockStdScope, LifeCycleWatcher } from '@blocksuite/block-std';
import { DisposableGroup } from '@blocksuite/global/disposable';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { DeepPartial } from '@blocksuite/global/utils';
import { type BlockStdScope, LifeCycleWatcher } from '@blocksuite/std';
import { computed, type Signal, signal } from '@preact/signals-core';
import clonedeep from 'lodash-es/cloneDeep';
import mergeWith from 'lodash-es/mergeWith';
@@ -1,7 +1,7 @@
import type { EmbedCardStyle } from '@blocksuite/affine-model';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
import type { Container } from '@blocksuite/global/di';
import { createIdentifier } from '@blocksuite/global/di';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/std';
import { Extension, type ExtensionType } from '@blocksuite/store';
export type EmbedOptions = {
@@ -1,6 +1,6 @@
import { LifeCycleWatcher } from '@blocksuite/block-std';
import { createIdentifier } from '@blocksuite/global/di';
import { IS_FIREFOX } from '@blocksuite/global/env';
import { LifeCycleWatcher } from '@blocksuite/std';
import type { ExtensionType } from '@blocksuite/store';
import type { FontConfig } from './config.js';
@@ -4,8 +4,8 @@ import {
DefaultTheme,
resolveColor,
} from '@blocksuite/affine-model';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
import { type Container, createIdentifier } from '@blocksuite/global/di';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/std';
import { Extension, type ExtensionType } from '@blocksuite/store';
import { type Signal, signal } from '@preact/signals-core';
import {
@@ -1,15 +1,15 @@
import { nextTick } from '@blocksuite/global/utils';
import {
BlockComponent,
BlockSelection,
type BlockStdScope,
SurfaceSelection,
} from '@blocksuite/block-std';
} from '@blocksuite/std';
import {
GfxControllerIdentifier,
type GfxElementModelView,
type GfxModel,
} from '@blocksuite/block-std/gfx';
import { nextTick } from '@blocksuite/global/utils';
} from '@blocksuite/std/gfx';
import type {
BaseSelection,
BlockModel,
@@ -1,4 +1,4 @@
import type { BlockFlavourIdentifier } from '@blocksuite/block-std';
import type { BlockFlavourIdentifier } from '@blocksuite/std';
import type { ToolbarModuleConfig } from './config';
@@ -1,6 +1,6 @@
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
import type { GfxModel } from '@blocksuite/block-std/gfx';
import { type Container, createIdentifier } from '@blocksuite/global/di';
import { type BlockStdScope, StdIdentifier } from '@blocksuite/std';
import type { GfxModel } from '@blocksuite/std/gfx';
import { Extension, type ExtensionType } from '@blocksuite/store';
import { signal } from '@preact/signals-core';
+2 -2
View File
@@ -3,8 +3,8 @@ import type {
FootNote,
ReferenceInfo,
} from '@blocksuite/affine-model';
import type { BlockComponent } from '@blocksuite/block-std';
import type { InlineEditor } from '@blocksuite/block-std/inline';
import type { BlockComponent } from '@blocksuite/std';
import type { InlineEditor } from '@blocksuite/std/inline';
import type { BlockModel } from '@blocksuite/store';
export * from './uni-component';
export interface EditingState {
@@ -1,6 +1,6 @@
import { DatabaseBlockModel, ListBlockModel } from '@blocksuite/affine-model';
import type { BlockComponent } from '@blocksuite/block-std';
import { type Point, Rect } from '@blocksuite/global/gfx';
import type { BlockComponent } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
import { BLOCK_CHILDREN_CONTAINER_PADDING_LEFT } from '../../consts/index.js';
@@ -1,6 +1,6 @@
import { DatabaseBlockModel } from '@blocksuite/affine-model';
import { BLOCK_ID_ATTR } from '@blocksuite/block-std';
import type { Point } from '@blocksuite/global/gfx';
import { BLOCK_ID_ATTR } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
import { getRectByBlockComponent } from '../dom/index.js';
@@ -1,5 +1,5 @@
import type { BlockComponent } from '@blocksuite/block-std';
import type { Rect } from '@blocksuite/global/gfx';
import type { BlockComponent } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
export interface EditingState {
@@ -1,4 +1,4 @@
import type { EditorHost } from '@blocksuite/block-std';
import type { EditorHost } from '@blocksuite/std';
export function isInsidePageEditor(host: EditorHost) {
return Array.from(host.children).some(
@@ -1,7 +1,7 @@
import { NoteBlockModel, RootBlockModel } from '@blocksuite/affine-model';
import { BLOCK_ID_ATTR, type BlockComponent } from '@blocksuite/block-std';
import { SurfaceBlockModel } from '@blocksuite/block-std/gfx';
import { clamp, type Point, type Rect } from '@blocksuite/global/gfx';
import { BLOCK_ID_ATTR, type BlockComponent } from '@blocksuite/std';
import { SurfaceBlockModel } from '@blocksuite/std/gfx';
import type { BlockModel } from '@blocksuite/store';
import { BLOCK_CHILDREN_CONTAINER_PADDING_LEFT } from '../../consts/index.js';
@@ -1,5 +1,5 @@
import type { RootBlockModel } from '@blocksuite/affine-model';
import { BLOCK_ID_ATTR, type BlockComponent } from '@blocksuite/block-std';
import { BLOCK_ID_ATTR, type BlockComponent } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
const ATTR_SELECTOR = `[${BLOCK_ID_ATTR}]`;
@@ -1,4 +1,4 @@
import type { EditorHost } from '@blocksuite/block-std';
import type { EditorHost } from '@blocksuite/std';
/**
* Get editor viewport element.
@@ -1,9 +1,9 @@
import { FrameBlockModel, GroupElementModel } from '@blocksuite/affine-model';
import type { GfxBlockElementModel, GfxModel } from '@blocksuite/block-std/gfx';
import {
deserializeXYWH,
getQuadBoundWithRotation,
} from '@blocksuite/global/gfx';
import type { GfxBlockElementModel, GfxModel } from '@blocksuite/std/gfx';
import type { BlockModel } from '@blocksuite/store';
export function getSelectedRect(selected: GfxModel[]): DOMRect {
@@ -1,5 +1,5 @@
import { FrameBlockModel } from '@blocksuite/affine-model';
import type { EditorHost } from '@blocksuite/block-std';
import type { EditorHost } from '@blocksuite/std';
import type { BlockModel } from '@blocksuite/store';
import { DocModeProvider } from '../../services/doc-mode-service.js';
@@ -1,5 +1,5 @@
import { NoteBlockModel, NoteDisplayMode } from '@blocksuite/affine-model';
import type { BlockComponent, BlockStdScope } from '@blocksuite/block-std';
import type { BlockComponent, BlockStdScope } from '@blocksuite/std';
import type { BlockModel, Store } from '@blocksuite/store';
import { matchModels } from './checker.js';
@@ -1,5 +1,5 @@
import { ListBlockModel } from '@blocksuite/affine-model';
import type { BlockStdScope } from '@blocksuite/block-std';
import type { BlockStdScope } from '@blocksuite/std';
import type { BlockModel, Store } from '@blocksuite/store';
import { matchModels } from './checker.js';
+2 -2
View File
@@ -1,5 +1,5 @@
import type { EditorHost } from '@blocksuite/block-std';
import type { InlineEditor } from '@blocksuite/block-std/inline';
import type { EditorHost } from '@blocksuite/std';
import type { InlineEditor } from '@blocksuite/std/inline';
function getDocTitleByEditorHost(editorHost: EditorHost): HTMLElement | null {
const docViewport = editorHost.closest('.affine-page-viewport');
@@ -1,4 +1,4 @@
import type { BlockComponent } from '@blocksuite/block-std';
import type { BlockComponent } from '@blocksuite/std';
import { autoUpdate } from '@floating-ui/dom';
import { signal } from '@preact/signals-core';
import type { ReactiveController } from 'lit';