refactor(editor): add gfx entry in bs global package (#10612)
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
"./global/exceptions": "./src/global/exceptions.ts",
|
"./global/exceptions": "./src/global/exceptions.ts",
|
||||||
"./global/di": "./src/global/di.ts",
|
"./global/di": "./src/global/di.ts",
|
||||||
"./global/types": "./src/global/types.ts",
|
"./global/types": "./src/global/types.ts",
|
||||||
|
"./global/gfx": "./src/global/gfx.ts",
|
||||||
"./store": "./src/store/index.ts",
|
"./store": "./src/store/index.ts",
|
||||||
"./store/test": "./src/store/test.ts",
|
"./store/test": "./src/store/test.ts",
|
||||||
"./inline": "./src/inline/index.ts",
|
"./inline": "./src/inline/index.ts",
|
||||||
@@ -69,6 +70,9 @@
|
|||||||
"global/types": [
|
"global/types": [
|
||||||
"dist/global/types.d.ts"
|
"dist/global/types.d.ts"
|
||||||
],
|
],
|
||||||
|
"global/gfx": [
|
||||||
|
"dist/global/gfx.d.ts"
|
||||||
|
],
|
||||||
"store": [
|
"store": [
|
||||||
"dist/store/index.d.ts"
|
"dist/store/index.d.ts"
|
||||||
],
|
],
|
||||||
|
|||||||
1
blocksuite/affine/all/src/global/gfx.ts
Normal file
1
blocksuite/affine/all/src/global/gfx.ts
Normal file
@@ -0,0 +1 @@
|
|||||||
|
export * from '@blocksuite/global/gfx';
|
||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
EMBED_CARD_HEIGHT,
|
EMBED_CARD_HEIGHT,
|
||||||
EMBED_CARD_WIDTH,
|
EMBED_CARD_WIDTH,
|
||||||
} from '@blocksuite/affine-shared/consts';
|
} from '@blocksuite/affine-shared/consts';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { ArrowDownSmallIcon, MoreVerticalIcon } from '@blocksuite/icons/lit';
|
import { ArrowDownSmallIcon, MoreVerticalIcon } from '@blocksuite/icons/lit';
|
||||||
import { flip, offset } from '@floating-ui/dom';
|
import { flip, offset } from '@floating-ui/dom';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
|
import { type BlockStdScope, StdIdentifier } from '@blocksuite/block-std';
|
||||||
import type { Container } from '@blocksuite/global/di';
|
import type { Container } from '@blocksuite/global/di';
|
||||||
import { createIdentifier } from '@blocksuite/global/di';
|
import { createIdentifier } from '@blocksuite/global/di';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import type { ExtensionType } from '@blocksuite/store';
|
import type { ExtensionType } from '@blocksuite/store';
|
||||||
import { Extension } from '@blocksuite/store';
|
import { Extension } from '@blocksuite/store';
|
||||||
import type { TemplateResult } from 'lit';
|
import type { TemplateResult } from 'lit';
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
import { humanFileSize } from '@blocksuite/affine-shared/utils';
|
import { humanFileSize } from '@blocksuite/affine-shared/utils';
|
||||||
import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';
|
import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, type IVec, Point, Vec } from '@blocksuite/global/utils';
|
import { Bound, type IVec, Point, Vec } from '@blocksuite/global/gfx';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
|
|
||||||
import type { AttachmentBlockComponent } from './attachment-block.js';
|
import type { AttachmentBlockComponent } from './attachment-block.js';
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import {
|
|||||||
uniMap,
|
uniMap,
|
||||||
} from '@blocksuite/data-view';
|
} from '@blocksuite/data-view';
|
||||||
import { widgetPresets } from '@blocksuite/data-view/widget-presets';
|
import { widgetPresets } from '@blocksuite/data-view/widget-presets';
|
||||||
import { Rect } from '@blocksuite/global/utils';
|
import { Rect } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
CopyIcon,
|
CopyIcon,
|
||||||
DeleteIcon,
|
DeleteIcon,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
} from '@blocksuite/data-view';
|
} from '@blocksuite/data-view';
|
||||||
import { presetPropertyConverts } from '@blocksuite/data-view/property-presets';
|
import { presetPropertyConverts } from '@blocksuite/data-view/property-presets';
|
||||||
import { propertyModelPresets } from '@blocksuite/data-view/property-pure-presets';
|
import { propertyModelPresets } from '@blocksuite/data-view/property-pure-presets';
|
||||||
import { clamp } from '@blocksuite/global/utils';
|
import { clamp } from '@blocksuite/global/gfx';
|
||||||
import { nanoid, Text } from '@blocksuite/store';
|
import { nanoid, Text } from '@blocksuite/store';
|
||||||
|
|
||||||
import { richTextPropertyModelConfig } from './rich-text/define.js';
|
import { richTextPropertyModelConfig } from './rich-text/define.js';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
|
import { focusTextModel } from '@blocksuite/affine-components/rich-text';
|
||||||
import type { Command } from '@blocksuite/block-std';
|
import type { Command } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
EDGELESS_TEXT_BLOCK_MIN_HEIGHT,
|
EDGELESS_TEXT_BLOCK_MIN_HEIGHT,
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
GfxBlockComponent,
|
GfxBlockComponent,
|
||||||
TextSelection,
|
TextSelection,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { query, state } from 'lit/decorators.js';
|
import { query, state } from 'lit/decorators.js';
|
||||||
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
|
import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
TextSelection,
|
TextSelection,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, Vec } from '@blocksuite/global/utils';
|
import { Bound, Vec } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
interface EmbedCardProperties {
|
interface EmbedCardProperties {
|
||||||
flavour: string;
|
flavour: string;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import type {
|
|||||||
GfxBlockElementModel,
|
GfxBlockElementModel,
|
||||||
GfxCompatibleProps,
|
GfxCompatibleProps,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import type { StyleInfo } from 'lit/directives/style-map.js';
|
import type { StyleInfo } from 'lit/directives/style-map.js';
|
||||||
|
|
||||||
import type { EmbedBlockComponent } from './embed-block-element.js';
|
import type { EmbedBlockComponent } from './embed-block-element.js';
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
isNewTabTrigger,
|
isNewTabTrigger,
|
||||||
isNewViewTrigger,
|
isNewViewTrigger,
|
||||||
} from '@blocksuite/affine-shared/utils';
|
} from '@blocksuite/affine-shared/utils';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import { toEdgelessEmbedBlock } from '../common/to-edgeless-embed-block.js';
|
import { toEdgelessEmbedBlock } from '../common/to-edgeless-embed-block.js';
|
||||||
import { EmbedLinkedDocBlockComponent } from './embed-linked-doc-block.js';
|
import { EmbedLinkedDocBlockComponent } from './embed-linked-doc-block.js';
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ import {
|
|||||||
referenceToNode,
|
referenceToNode,
|
||||||
} from '@blocksuite/affine-shared/utils';
|
} from '@blocksuite/affine-shared/utils';
|
||||||
import { BlockSelection } from '@blocksuite/block-std';
|
import { BlockSelection } from '@blocksuite/block-std';
|
||||||
import { Bound, throttle } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { throttle } from '@blocksuite/global/utils';
|
||||||
import { Text } from '@blocksuite/store';
|
import { Text } from '@blocksuite/store';
|
||||||
import { computed } from '@preact/signals-core';
|
import { computed } from '@preact/signals-core';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import { BlockStdScope } from '@blocksuite/block-std';
|
import { BlockStdScope } from '@blocksuite/block-std';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
import { choose } from 'lit/directives/choose.js';
|
import { choose } from 'lit/directives/choose.js';
|
||||||
import { classMap } from 'lit/directives/class-map.js';
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ import {
|
|||||||
GfxControllerIdentifier,
|
GfxControllerIdentifier,
|
||||||
GfxExtension,
|
GfxExtension,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { assertExists, Bound, getCommonBound } from '@blocksuite/global/utils';
|
import { Bound, getCommonBound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { type GetBlocksOptions, type Query, Text } from '@blocksuite/store';
|
import { type GetBlocksOptions, type Query, Text } from '@blocksuite/store';
|
||||||
import { computed, signal } from '@preact/signals-core';
|
import { computed, signal } from '@preact/signals-core';
|
||||||
import { html, nothing, type PropertyValues } from 'lit';
|
import { html, nothing, type PropertyValues } from 'lit';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { DefaultTheme, type FrameBlockModel } from '@blocksuite/affine-model';
|
import { DefaultTheme, type FrameBlockModel } from '@blocksuite/affine-model';
|
||||||
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
||||||
import { GfxBlockComponent } from '@blocksuite/block-std';
|
import { GfxBlockComponent } from '@blocksuite/block-std';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { cssVarV2 } from '@toeverything/theme/v2';
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
import { html } from 'lit';
|
import { html } from 'lit';
|
||||||
import { state } from 'lit/decorators.js';
|
import { state } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
|||||||
import {
|
import {
|
||||||
Bound,
|
Bound,
|
||||||
deserializeXYWH,
|
deserializeXYWH,
|
||||||
DisposableGroup,
|
|
||||||
type IVec,
|
type IVec,
|
||||||
type SerializedXYWH,
|
type SerializedXYWH,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||||
import { type BlockModel, Text } from '@blocksuite/store';
|
import { type BlockModel, Text } from '@blocksuite/store';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
} from '@blocksuite/affine-shared/utils';
|
} from '@blocksuite/affine-shared/utils';
|
||||||
import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';
|
import type { BlockStdScope, EditorHost } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, type IVec, Point, Vec } from '@blocksuite/global/utils';
|
import { Bound, type IVec, Point, Vec } from '@blocksuite/global/gfx';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -22,12 +22,8 @@ import {
|
|||||||
TextSelection,
|
TextSelection,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import {
|
import { clamp, Point } from '@blocksuite/global/gfx';
|
||||||
clamp,
|
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||||
Point,
|
|
||||||
SignalWatcher,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
import { consume } from '@lit/context';
|
import { consume } from '@lit/context';
|
||||||
import { computed } from '@preact/signals-core';
|
import { computed } from '@preact/signals-core';
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import type { NoteBlockModel } from '@blocksuite/affine-model';
|
import type { NoteBlockModel } from '@blocksuite/affine-model';
|
||||||
import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';
|
import { type EditorHost, ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import {
|
import { almostEqual, Bound } from '@blocksuite/global/gfx';
|
||||||
almostEqual,
|
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||||
Bound,
|
|
||||||
SignalWatcher,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { html } from 'lit';
|
import { html } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { EDGELESS_BLOCK_CHILD_PADDING } from '@blocksuite/affine-shared/consts';
|
|||||||
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||||
import { stopPropagation } from '@blocksuite/affine-shared/utils';
|
import { stopPropagation } from '@blocksuite/affine-shared/utils';
|
||||||
import { toGfxBlockComponent } from '@blocksuite/block-std';
|
import { toGfxBlockComponent } from '@blocksuite/block-std';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { html, nothing, type PropertyValues } from 'lit';
|
import { html, nothing, type PropertyValues } from 'lit';
|
||||||
import { query, state } from 'lit/decorators.js';
|
import { query, state } from 'lit/decorators.js';
|
||||||
import { classMap } from 'lit/directives/class-map.js';
|
import { classMap } from 'lit/directives/class-map.js';
|
||||||
|
|||||||
@@ -49,15 +49,19 @@ import {
|
|||||||
SortOrder,
|
SortOrder,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { IBound, IVec, SerializedXYWH } from '@blocksuite/global/utils';
|
import {
|
||||||
|
Bound,
|
||||||
|
getCommonBound,
|
||||||
|
type IBound,
|
||||||
|
type IVec,
|
||||||
|
type SerializedXYWH,
|
||||||
|
Vec,
|
||||||
|
} from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
assertExists,
|
assertExists,
|
||||||
assertType,
|
assertType,
|
||||||
Bound,
|
|
||||||
DisposableGroup,
|
DisposableGroup,
|
||||||
getCommonBound,
|
|
||||||
nToLast,
|
nToLast,
|
||||||
Vec,
|
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
type BlockSnapshot,
|
type BlockSnapshot,
|
||||||
|
|||||||
@@ -29,17 +29,16 @@ import {
|
|||||||
import { captureEventTarget } from '@blocksuite/affine-shared/utils';
|
import { captureEventTarget } from '@blocksuite/affine-shared/utils';
|
||||||
import { type BlockStdScope, stdContext } from '@blocksuite/block-std';
|
import { type BlockStdScope, stdContext } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import type { XYWH } from '@blocksuite/global/utils';
|
import type { XYWH } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
assertInstanceOf,
|
|
||||||
Bound,
|
Bound,
|
||||||
clamp,
|
clamp,
|
||||||
normalizeDegAngle,
|
normalizeDegAngle,
|
||||||
serializeXYWH,
|
serializeXYWH,
|
||||||
toDegree,
|
toDegree,
|
||||||
Vec,
|
Vec,
|
||||||
WithDisposable,
|
} from '@blocksuite/global/gfx';
|
||||||
} from '@blocksuite/global/utils';
|
import { assertInstanceOf, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { FrameIcon, PageIcon } from '@blocksuite/icons/lit';
|
import { FrameIcon, PageIcon } from '@blocksuite/icons/lit';
|
||||||
import { consume } from '@lit/context';
|
import { consume } from '@lit/context';
|
||||||
import { baseTheme } from '@toeverything/theme';
|
import { baseTheme } from '@toeverything/theme';
|
||||||
|
|||||||
@@ -25,11 +25,11 @@ import {
|
|||||||
import { handleNativeRangeAtPoint } from '@blocksuite/affine-shared/utils';
|
import { handleNativeRangeAtPoint } from '@blocksuite/affine-shared/utils';
|
||||||
import { type BlockStdScope, stdContext } from '@blocksuite/block-std';
|
import { type BlockStdScope, stdContext } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import type { Bound, IVec } from '@blocksuite/global/utils';
|
import type { Bound, IVec } from '@blocksuite/global/gfx';
|
||||||
|
import { Vec } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
assertExists,
|
assertExists,
|
||||||
DisposableGroup,
|
DisposableGroup,
|
||||||
Vec,
|
|
||||||
WithDisposable,
|
WithDisposable,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import {
|
|||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import type { GfxController, GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxController, GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { XYWH } from '@blocksuite/global/utils';
|
import { Bound, normalizeDegAngle, type XYWH } from '@blocksuite/global/gfx';
|
||||||
import { assertType, Bound, normalizeDegAngle } from '@blocksuite/global/utils';
|
import { assertType } from '@blocksuite/global/utils';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../../edgeless-root-block.js';
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
stdContext,
|
stdContext,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { DisposableGroup, Vec, WithDisposable } from '@blocksuite/global/utils';
|
import { Vec } from '@blocksuite/global/gfx';
|
||||||
|
import { DisposableGroup, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { Store } from '@blocksuite/store';
|
import type { Store } from '@blocksuite/store';
|
||||||
import { consume } from '@lit/context';
|
import { consume } from '@lit/context';
|
||||||
import { css, html, LitElement } from 'lit';
|
import { css, html, LitElement } from 'lit';
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import {
|
|||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
|
import { Bound, deserializeXYWH } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
Bound,
|
|
||||||
debounce,
|
debounce,
|
||||||
deserializeXYWH,
|
|
||||||
DisposableGroup,
|
DisposableGroup,
|
||||||
WithDisposable,
|
WithDisposable,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/utils';
|
||||||
|
|||||||
@@ -10,12 +10,8 @@ import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
|||||||
import { getRectByBlockComponent } from '@blocksuite/affine-shared/utils';
|
import { getRectByBlockComponent } from '@blocksuite/affine-shared/utils';
|
||||||
import { WidgetComponent } from '@blocksuite/block-std';
|
import { WidgetComponent } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import {
|
import { deserializeXYWH, Point, serializeXYWH } from '@blocksuite/global/gfx';
|
||||||
deserializeXYWH,
|
import { DisposableGroup } from '@blocksuite/global/utils';
|
||||||
DisposableGroup,
|
|
||||||
Point,
|
|
||||||
serializeXYWH,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { ScissorsIcon } from '@blocksuite/icons/lit';
|
import { ScissorsIcon } from '@blocksuite/icons/lit';
|
||||||
import { css, html, nothing, type PropertyValues } from 'lit';
|
import { css, html, nothing, type PropertyValues } from 'lit';
|
||||||
import { state } from 'lit/decorators.js';
|
import { state } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { FrameBlockModel, RootBlockModel } from '@blocksuite/affine-model';
|
|||||||
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
import { EditPropsStore } from '@blocksuite/affine-shared/services';
|
||||||
import { WidgetComponent } from '@blocksuite/block-std';
|
import { WidgetComponent } from '@blocksuite/block-std';
|
||||||
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { state } from 'lit/decorators.js';
|
import { state } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -49,20 +49,14 @@ import {
|
|||||||
type GfxModel,
|
type GfxModel,
|
||||||
type GfxPrimitiveElementModel,
|
type GfxPrimitiveElementModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type {
|
import type { IPoint, IVec, PointLocation } from '@blocksuite/global/gfx';
|
||||||
Disposable,
|
|
||||||
IPoint,
|
|
||||||
IVec,
|
|
||||||
PointLocation,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import {
|
import {
|
||||||
assertType,
|
|
||||||
Bound,
|
Bound,
|
||||||
deserializeXYWH,
|
deserializeXYWH,
|
||||||
normalizeDegAngle,
|
normalizeDegAngle,
|
||||||
pickValues,
|
} from '@blocksuite/global/gfx';
|
||||||
Slot,
|
import type { Disposable } from '@blocksuite/global/utils';
|
||||||
} from '@blocksuite/global/utils';
|
import { assertType, pickValues, Slot } from '@blocksuite/global/utils';
|
||||||
import { css, html, nothing } from 'lit';
|
import { css, html, nothing } from 'lit';
|
||||||
import { state } from 'lit/decorators.js';
|
import { state } from 'lit/decorators.js';
|
||||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
|
|
||||||
export enum HandleDirection {
|
export enum HandleDirection {
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { NOTE_MIN_WIDTH } from '@blocksuite/affine-model';
|
import { NOTE_MIN_WIDTH } from '@blocksuite/affine-model';
|
||||||
import {
|
import {
|
||||||
assertExists,
|
|
||||||
Bound,
|
Bound,
|
||||||
getQuadBoundWithRotation,
|
getQuadBoundWithRotation,
|
||||||
type IPoint,
|
type IPoint,
|
||||||
type IVec,
|
type IVec,
|
||||||
type PointLocation,
|
type PointLocation,
|
||||||
rotatePoints,
|
rotatePoints,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
import type { SelectableProps } from '../../utils/query.js';
|
import type { SelectableProps } from '../../utils/query.js';
|
||||||
import { HandleDirection, type ResizeMode } from './resize-handles.js';
|
import { HandleDirection, type ResizeMode } from './resize-handles.js';
|
||||||
|
|||||||
@@ -10,12 +10,8 @@ import {
|
|||||||
RANGE_SYNC_EXCLUDE_ATTR,
|
RANGE_SYNC_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import {
|
import { Bound, Vec } from '@blocksuite/global/gfx';
|
||||||
assertExists,
|
import { assertExists, WithDisposable } from '@blocksuite/global/utils';
|
||||||
Bound,
|
|
||||||
Vec,
|
|
||||||
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';
|
||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
RANGE_SYNC_EXCLUDE_ATTR,
|
RANGE_SYNC_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { assertExists, Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { cssVarV2 } from '@toeverything/theme/v2';
|
import { cssVarV2 } from '@toeverything/theme/v2';
|
||||||
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';
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import {
|
|||||||
RANGE_SYNC_EXCLUDE_ATTR,
|
RANGE_SYNC_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { assertExists, Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -11,13 +11,8 @@ import {
|
|||||||
RANGE_SYNC_EXCLUDE_ATTR,
|
RANGE_SYNC_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import {
|
import { Bound, toRadian, Vec } from '@blocksuite/global/gfx';
|
||||||
assertExists,
|
import { assertExists, WithDisposable } from '@blocksuite/global/utils';
|
||||||
Bound,
|
|
||||||
toRadian,
|
|
||||||
Vec,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { html, nothing } from 'lit';
|
import { html, nothing } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -10,13 +10,8 @@ import {
|
|||||||
RANGE_SYNC_EXCLUDE_ATTR,
|
RANGE_SYNC_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import {
|
import { Bound, toRadian, Vec } from '@blocksuite/global/gfx';
|
||||||
assertExists,
|
import { assertExists, WithDisposable } from '@blocksuite/global/utils';
|
||||||
Bound,
|
|
||||||
toRadian,
|
|
||||||
Vec,
|
|
||||||
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';
|
||||||
import { styleMap } from 'lit/directives/style-map.js';
|
import { styleMap } from 'lit/directives/style-map.js';
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import {
|
|||||||
EditPropsStore,
|
EditPropsStore,
|
||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import { assertExists, Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
type ReactiveController,
|
type ReactiveController,
|
||||||
type ReactiveControllerHost,
|
type ReactiveControllerHost,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { Bound, DisposableClass } from '@blocksuite/global/utils';
|
import type { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import type { DisposableClass } from '@blocksuite/global/utils';
|
||||||
import type { TemplateResult } from 'lit';
|
import type { TemplateResult } from 'lit';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../../../../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../../../../edgeless-root-block.js';
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ import {
|
|||||||
TelemetryProvider,
|
TelemetryProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import { openFileOrFiles } from '@blocksuite/affine-shared/utils';
|
import { openFileOrFiles } from '@blocksuite/affine-shared/utils';
|
||||||
import { assertInstanceOf, Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertInstanceOf } from '@blocksuite/global/utils';
|
||||||
import type { TemplateResult } from 'lit';
|
import type { TemplateResult } from 'lit';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
import type { BlockStdScope } from '@blocksuite/block-std';
|
import type { BlockStdScope } from '@blocksuite/block-std';
|
||||||
import { modelContext, stdContext } from '@blocksuite/block-std';
|
import { modelContext, stdContext } from '@blocksuite/block-std';
|
||||||
import { ErrorCode } from '@blocksuite/global/exceptions';
|
import { ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { Bound } from '@blocksuite/global/utils';
|
import type { Bound } from '@blocksuite/global/gfx';
|
||||||
import { SignalWatcher } from '@blocksuite/global/utils';
|
import { SignalWatcher } from '@blocksuite/global/utils';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
import { consume } from '@lit/context';
|
import { consume } from '@lit/context';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';
|
import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';
|
||||||
import type { Bound } from '@blocksuite/global/utils';
|
import type { Bound } from '@blocksuite/global/gfx';
|
||||||
import { SignalWatcher } from '@blocksuite/global/utils';
|
import { SignalWatcher } from '@blocksuite/global/utils';
|
||||||
import { computed } from '@preact/signals-core';
|
import { computed } from '@preact/signals-core';
|
||||||
import { css, html, LitElement, nothing } from 'lit';
|
import { css, html, LitElement, nothing } from 'lit';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { openFileOrFiles } from '@blocksuite/affine-shared/utils';
|
import { openFileOrFiles } from '@blocksuite/affine-shared/utils';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { Bound } from '@blocksuite/global/utils';
|
import type { Bound } from '@blocksuite/global/gfx';
|
||||||
import c from 'simple-xml-to-json';
|
import c from 'simple-xml-to-json';
|
||||||
|
|
||||||
type MindMapNode = {
|
type MindMapNode = {
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ 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';
|
||||||
import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';
|
import type { GfxToolsFullOptionValue } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, clamp, SignalWatcher } from '@blocksuite/global/utils';
|
import { Bound, clamp } from '@blocksuite/global/gfx';
|
||||||
|
import { SignalWatcher } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
EndPointArrowIcon,
|
EndPointArrowIcon,
|
||||||
ExpandCloseIcon,
|
ExpandCloseIcon,
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import {
|
|||||||
type ShapeName,
|
type ShapeName,
|
||||||
type ShapeStyle,
|
type ShapeStyle,
|
||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { Bound, sleep, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { sleep, WithDisposable } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
css,
|
css,
|
||||||
html,
|
html,
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import {
|
|||||||
requestConnectedFrame,
|
requestConnectedFrame,
|
||||||
stopPropagation,
|
stopPropagation,
|
||||||
} from '@blocksuite/affine-shared/utils';
|
} from '@blocksuite/affine-shared/utils';
|
||||||
import { type Bound, WithDisposable } from '@blocksuite/global/utils';
|
import type { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { baseTheme } from '@toeverything/theme';
|
import { baseTheme } from '@toeverything/theme';
|
||||||
import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, state } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import type { CursorType, StandardCursor } from '@blocksuite/block-std/gfx';
|
import type { CursorType, StandardCursor } from '@blocksuite/block-std/gfx';
|
||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
import { assertExists, normalizeDegAngle, Vec } from '@blocksuite/global/utils';
|
import { normalizeDegAngle, Vec } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
|
|
||||||
// "<svg width='32' height='32' viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'><g><path fill='white' d='M13.7,18.5h3.9l0-1.5c0-1.4-1.2-2.6-2.6-2.6h-1.5v3.9l-5.8-5.8l5.8-5.8v3.9h2.3c3.1,0,5.6,2.5,5.6,5.6v2.3h3.9l-5.8,5.8L13.7,18.5z'/><path d='M20.4,19.4v-3.2c0-2.6-2.1-4.7-4.7-4.7h-3.2l0,0V9L9,12.6l3.6,3.6v-2.6l0,0H15c1.9,0,3.5,1.6,3.5,3.5v2.4l0,0h-2.6l3.6,3.6l3.6-3.6L20.4,19.4L20.4,19.4z'/></g></svg>";
|
|
||||||
export function generateCursorUrl(
|
export function generateCursorUrl(
|
||||||
angle = 0,
|
angle = 0,
|
||||||
fallback: StandardCursor = 'default'
|
fallback: StandardCursor = 'default'
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
isGfxGroupCompatibleModel,
|
isGfxGroupCompatibleModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { IS_MAC } from '@blocksuite/global/env';
|
import { IS_MAC } from '@blocksuite/global/env';
|
||||||
import { Bound, getCommonBound } from '@blocksuite/global/utils';
|
import { Bound, getCommonBound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import { PageKeyboardManager } from '../keyboard/keyboard-manager.js';
|
import { PageKeyboardManager } from '../keyboard/keyboard-manager.js';
|
||||||
import type { EdgelessRootBlockComponent } from './edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from './edgeless-root-block.js';
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ import {
|
|||||||
type GfxViewportElement,
|
type GfxViewportElement,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { IS_WINDOWS } from '@blocksuite/global/env';
|
import { IS_WINDOWS } from '@blocksuite/global/env';
|
||||||
import { assertExists, Bound, Point, Vec } from '@blocksuite/global/utils';
|
import { Bound, Point, Vec } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { query } from 'lit/decorators.js';
|
import { query } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import {
|
|||||||
ZOOM_STEP,
|
ZOOM_STEP,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import { Bound, getCommonBound } from '@blocksuite/global/utils';
|
import { Bound, getCommonBound } from '@blocksuite/global/gfx';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import clamp from 'lodash-es/clamp';
|
import clamp from 'lodash-es/clamp';
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import type { BrushElementModel } from '@blocksuite/affine-model';
|
|||||||
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
export class BrushTool extends BaseTool {
|
export class BrushTool extends BaseTool {
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ import {
|
|||||||
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool, type GfxModel } from '@blocksuite/block-std/gfx';
|
import { BaseTool, type GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound, IVec } from '@blocksuite/global/utils';
|
import type { IBound, IVec } from '@blocksuite/global/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
enum ConnectorToolMode {
|
enum ConnectorToolMode {
|
||||||
// Dragging connect
|
// Dragging connect
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import type { GfxElementModelView } from '@blocksuite/block-std/gfx';
|
import type { GfxElementModelView } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, last } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { last } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
import { DefaultModeDragType, DefaultToolExt } from './ext.js';
|
import { DefaultModeDragType, DefaultToolExt } from './ext.js';
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ import {
|
|||||||
type MindmapNode,
|
type MindmapNode,
|
||||||
type MindmapRoot,
|
type MindmapRoot,
|
||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { Bound, last } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { last } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
const isOnEdge = (node: MindmapNode, direction: 'tail' | 'head') => {
|
const isOnEdge = (node: MindmapNode, direction: 'tail' | 'head') => {
|
||||||
let current = node;
|
let current = node;
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ import {
|
|||||||
type Bound,
|
type Bound,
|
||||||
isVecZero,
|
isVecZero,
|
||||||
type IVec,
|
type IVec,
|
||||||
last,
|
|
||||||
PointLocation,
|
PointLocation,
|
||||||
toRadian,
|
toRadian,
|
||||||
Vec,
|
Vec,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
import { last } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
export class MindMapIndicatorOverlay extends Overlay {
|
export class MindMapIndicatorOverlay extends Overlay {
|
||||||
static INDICATOR_SIZE = [48, 22];
|
static INDICATOR_SIZE = [48, 22];
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import {
|
|||||||
type GfxPrimitiveElementModel,
|
type GfxPrimitiveElementModel,
|
||||||
isGfxGroupCompatibleModel,
|
isGfxGroupCompatibleModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { Bound, IVec } from '@blocksuite/global/utils';
|
import type { Bound, IVec } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import { isSingleMindMapNode } from '../../../utils/mindmap.js';
|
import { isSingleMindMapNode } from '../../../utils/mindmap.js';
|
||||||
import { isMindmapNode } from '../../../utils/query.js';
|
import { isMindmapNode } from '../../../utils/query.js';
|
||||||
|
|||||||
@@ -41,15 +41,9 @@ import {
|
|||||||
isGfxGroupCompatibleModel,
|
isGfxGroupCompatibleModel,
|
||||||
type PointTestOptions,
|
type PointTestOptions,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
import {
|
import { Bound, getCommonBoundWithRotation, Vec } from '@blocksuite/global/gfx';
|
||||||
Bound,
|
import { DisposableGroup, last, noop } from '@blocksuite/global/utils';
|
||||||
DisposableGroup,
|
|
||||||
getCommonBoundWithRotation,
|
|
||||||
last,
|
|
||||||
noop,
|
|
||||||
Vec,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
import clamp from 'lodash-es/clamp';
|
import clamp from 'lodash-es/clamp';
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
getSvgPathFromStroke,
|
getSvgPathFromStroke,
|
||||||
type IVec,
|
type IVec,
|
||||||
linePolygonIntersects,
|
linePolygonIntersects,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
class EraserOverlay extends Overlay {
|
class EraserOverlay extends Overlay {
|
||||||
d = '';
|
d = '';
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ import {
|
|||||||
getTopElements,
|
getTopElements,
|
||||||
GfxExtensionIdentifier,
|
GfxExtensionIdentifier,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { IPoint, IVec } from '@blocksuite/global/utils';
|
import type { IPoint, IVec } from '@blocksuite/global/gfx';
|
||||||
import { Bound, Vec } from '@blocksuite/global/utils';
|
import { Bound, Vec } from '@blocksuite/global/gfx';
|
||||||
import { Text } from '@blocksuite/store';
|
import { Text } from '@blocksuite/store';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
|||||||
import { LassoMode } from '@blocksuite/affine-shared/types';
|
import { LassoMode } from '@blocksuite/affine-shared/types';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import type { IPoint, IVec } from '@blocksuite/global/utils';
|
import type { IPoint, IVec } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
Bound,
|
Bound,
|
||||||
getBoundFromPoints,
|
getBoundFromPoints,
|
||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
pointInPolygon,
|
pointInPolygon,
|
||||||
rotatePoints,
|
rotatePoints,
|
||||||
Vec,
|
Vec,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
class LassoOverlay extends Overlay {
|
class LassoOverlay extends Overlay {
|
||||||
d = '';
|
d = '';
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import type { NoteChildrenFlavour } from '@blocksuite/affine-shared/types';
|
|||||||
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import { Point } from '@blocksuite/global/utils';
|
import { Point } from '@blocksuite/global/gfx';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
import { EXCLUDING_MOUSE_OUT_CLASS_LIST } from '../utils/consts.js';
|
import { EXCLUDING_MOUSE_OUT_CLASS_LIST } from '../utils/consts.js';
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import {
|
|||||||
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
import { hasClassNameInList } from '@blocksuite/affine-shared/utils';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool } from '@blocksuite/block-std/gfx';
|
import { BaseTool } from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound } from '@blocksuite/global/utils';
|
import type { IBound } from '@blocksuite/global/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BaseTool, type GfxController } from '@blocksuite/block-std/gfx';
|
import { BaseTool, type GfxController } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
import type { EdgelessRootBlockComponent } from '../edgeless-root-block.js';
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { generateElementId, sortIndex } from '@blocksuite/affine-block-surface';
|
import { generateElementId, sortIndex } from '@blocksuite/affine-block-surface';
|
||||||
import type { ConnectorElementModel } from '@blocksuite/affine-model';
|
import type { ConnectorElementModel } from '@blocksuite/affine-model';
|
||||||
import { assertExists, assertType, Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists, assertType } from '@blocksuite/global/utils';
|
||||||
import type { BlockSnapshot, SnapshotNode } from '@blocksuite/store';
|
import type { BlockSnapshot, SnapshotNode } from '@blocksuite/store';
|
||||||
|
|
||||||
import type { SlotBlockPayload, TemplateJob } from './template.js';
|
import type { SlotBlockPayload, TemplateJob } from './template.js';
|
||||||
|
|||||||
@@ -3,13 +3,8 @@ import type {
|
|||||||
SurfaceBlockTransformer,
|
SurfaceBlockTransformer,
|
||||||
} from '@blocksuite/affine-block-surface';
|
} from '@blocksuite/affine-block-surface';
|
||||||
import type { ConnectorElementModel } from '@blocksuite/affine-model';
|
import type { ConnectorElementModel } from '@blocksuite/affine-model';
|
||||||
import {
|
import { Bound, getCommonBound } from '@blocksuite/global/gfx';
|
||||||
assertExists,
|
import { assertExists, assertType, Slot } from '@blocksuite/global/utils';
|
||||||
assertType,
|
|
||||||
Bound,
|
|
||||||
getCommonBound,
|
|
||||||
Slot,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import {
|
import {
|
||||||
type BlockModel,
|
type BlockModel,
|
||||||
type BlockSnapshot,
|
type BlockSnapshot,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { SerializedElement } from '@blocksuite/block-std/gfx';
|
import type { SerializedElement } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, getBoundWithRotation } from '@blocksuite/global/utils';
|
import { Bound, getBoundWithRotation } from '@blocksuite/global/gfx';
|
||||||
import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';
|
import { type BlockSnapshot, BlockSnapshotSchema } from '@blocksuite/store';
|
||||||
|
|
||||||
export function getBoundFromSerializedElement(element: SerializedElement) {
|
export function getBoundFromSerializedElement(element: SerializedElement) {
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import {
|
|||||||
type GfxModel,
|
type GfxModel,
|
||||||
type SerializedElement,
|
type SerializedElement,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { getCommonBoundWithRotation, groupBy } from '@blocksuite/global/utils';
|
import { getCommonBoundWithRotation } from '@blocksuite/global/gfx';
|
||||||
|
import { 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';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import type { Viewport } from '@blocksuite/block-std/gfx';
|
import type { Viewport } from '@blocksuite/block-std/gfx';
|
||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
const PANNING_DISTANCE = 30;
|
const PANNING_DISTANCE = 30;
|
||||||
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ import type {
|
|||||||
GfxToolsFullOptionValue,
|
GfxToolsFullOptionValue,
|
||||||
Viewport,
|
Viewport,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { PointLocation } from '@blocksuite/global/utils';
|
import type { PointLocation } from '@blocksuite/global/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
|
|
||||||
export function isMindmapNode(element: GfxBlockElementModel | GfxModel | null) {
|
export function isMindmapNode(element: GfxBlockElementModel | GfxModel | null) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Overlay } from '@blocksuite/affine-block-surface';
|
import { Overlay } from '@blocksuite/affine-block-surface';
|
||||||
import { ConnectorElementModel } from '@blocksuite/affine-model';
|
import { ConnectorElementModel } from '@blocksuite/affine-model';
|
||||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import { almostEqual, Bound, Point } from '@blocksuite/global/utils';
|
import { almostEqual, Bound, Point } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
interface Distance {
|
interface Distance {
|
||||||
horiz?: {
|
horiz?: {
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ import type {
|
|||||||
import { ShapeElementModel, TextElementModel } from '@blocksuite/affine-model';
|
import { ShapeElementModel, TextElementModel } from '@blocksuite/affine-model';
|
||||||
import type { PointerEventState } from '@blocksuite/block-std';
|
import type { PointerEventState } from '@blocksuite/block-std';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { IVec } from '@blocksuite/global/utils';
|
import type { IVec } from '@blocksuite/global/gfx';
|
||||||
import { assertInstanceOf, Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertInstanceOf } from '@blocksuite/global/utils';
|
||||||
import * as Y from 'yjs';
|
import * as Y from 'yjs';
|
||||||
|
|
||||||
import { EdgelessConnectorLabelEditor } from '../components/text/edgeless-connector-label-editor.js';
|
import { EdgelessConnectorLabelEditor } from '../components/text/edgeless-connector-label-editor.js';
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import {
|
|||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
||||||
import type { GfxController, GfxToolsMap } from '@blocksuite/block-std/gfx';
|
import type { GfxController, GfxToolsMap } from '@blocksuite/block-std/gfx';
|
||||||
import type { XYWH } from '@blocksuite/global/utils';
|
import type { XYWH } from '@blocksuite/global/gfx';
|
||||||
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
assertType,
|
assertType,
|
||||||
Bound,
|
|
||||||
DisposableGroup,
|
DisposableGroup,
|
||||||
noop,
|
noop,
|
||||||
Slot,
|
Slot,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import {
|
|||||||
BlockSelection,
|
BlockSelection,
|
||||||
TextSelection,
|
TextSelection,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { Point } from '@blocksuite/global/utils';
|
import { Point } from '@blocksuite/global/gfx';
|
||||||
import type { BlockModel, Text } from '@blocksuite/store';
|
import type { BlockModel, Text } from '@blocksuite/store';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { query } from 'lit/decorators.js';
|
import { query } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { MindmapElementModel } from '@blocksuite/affine-model';
|
import { MindmapElementModel } from '@blocksuite/affine-model';
|
||||||
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
import { TelemetryProvider } from '@blocksuite/affine-shared/services';
|
||||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { FrameIcon } from '@blocksuite/icons/lit';
|
import { FrameIcon } from '@blocksuite/icons/lit';
|
||||||
import { css, html, LitElement, nothing } from 'lit';
|
import { css, html, LitElement, nothing } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import {
|
|||||||
} from '@blocksuite/affine-block-surface';
|
} from '@blocksuite/affine-block-surface';
|
||||||
import { MindmapElementModel } from '@blocksuite/affine-model';
|
import { MindmapElementModel } from '@blocksuite/affine-model';
|
||||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import { Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import {
|
import {
|
||||||
AlignBottomIcon,
|
AlignBottomIcon,
|
||||||
AlignHorizontalCenterIcon,
|
AlignHorizontalCenterIcon,
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ import {
|
|||||||
EMBED_CARD_WIDTH,
|
EMBED_CARD_WIDTH,
|
||||||
} from '@blocksuite/affine-shared/consts';
|
} from '@blocksuite/affine-shared/consts';
|
||||||
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
||||||
import { Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { TemplateResult } from 'lit';
|
import type { TemplateResult } from 'lit';
|
||||||
import { html, LitElement, nothing } from 'lit';
|
import { html, LitElement, nothing } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ import {
|
|||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import { getHostName, referenceToNode } from '@blocksuite/affine-shared/utils';
|
import { getHostName, referenceToNode } from '@blocksuite/affine-shared/utils';
|
||||||
import type { BlockStdScope } from '@blocksuite/block-std';
|
import type { BlockStdScope } from '@blocksuite/block-std';
|
||||||
import { Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
|
import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, state } from 'lit/decorators.js';
|
||||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||||
|
|||||||
@@ -22,13 +22,8 @@ import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
|||||||
import type { ColorEvent } from '@blocksuite/affine-shared/utils';
|
import type { ColorEvent } from '@blocksuite/affine-shared/utils';
|
||||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||||
import { GfxExtensionIdentifier } from '@blocksuite/block-std/gfx';
|
import { GfxExtensionIdentifier } from '@blocksuite/block-std/gfx';
|
||||||
import {
|
import { deserializeXYWH, serializeXYWH } from '@blocksuite/global/gfx';
|
||||||
countBy,
|
import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';
|
||||||
deserializeXYWH,
|
|
||||||
maxBy,
|
|
||||||
serializeXYWH,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';
|
import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';
|
||||||
import { html, LitElement, nothing } from 'lit';
|
import { html, LitElement, nothing } from 'lit';
|
||||||
import { property, query } from 'lit/decorators.js';
|
import { property, query } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -7,11 +7,8 @@ import {
|
|||||||
NoteDisplayMode,
|
NoteDisplayMode,
|
||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||||
import {
|
import { deserializeXYWH, serializeXYWH } from '@blocksuite/global/gfx';
|
||||||
deserializeXYWH,
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
serializeXYWH,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';
|
import { EditIcon, PageIcon, UngroupIcon } from '@blocksuite/icons/lit';
|
||||||
import { html, LitElement, nothing } from 'lit';
|
import { html, LitElement, nothing } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -30,12 +30,8 @@ import {
|
|||||||
TelemetryProvider,
|
TelemetryProvider,
|
||||||
ThemeProvider,
|
ThemeProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import {
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
Bound,
|
import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';
|
||||||
countBy,
|
|
||||||
maxBy,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import {
|
import {
|
||||||
AutoHeightIcon,
|
AutoHeightIcon,
|
||||||
CornerIcon,
|
CornerIcon,
|
||||||
|
|||||||
@@ -31,12 +31,8 @@ import {
|
|||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
import { FeatureFlagService } from '@blocksuite/affine-shared/services';
|
||||||
import type { ColorEvent } from '@blocksuite/affine-shared/utils';
|
import type { ColorEvent } from '@blocksuite/affine-shared/utils';
|
||||||
import {
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
Bound,
|
import { countBy, maxBy, WithDisposable } from '@blocksuite/global/utils';
|
||||||
countBy,
|
|
||||||
maxBy,
|
|
||||||
WithDisposable,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import {
|
import {
|
||||||
TextAlignCenterIcon,
|
TextAlignCenterIcon,
|
||||||
TextAlignLeftIcon,
|
TextAlignLeftIcon,
|
||||||
|
|||||||
@@ -30,13 +30,8 @@ import { ThemeProvider } from '@blocksuite/affine-shared/services';
|
|||||||
import { requestConnectedFrame } from '@blocksuite/affine-shared/utils';
|
import { requestConnectedFrame } from '@blocksuite/affine-shared/utils';
|
||||||
import { WidgetComponent } from '@blocksuite/block-std';
|
import { WidgetComponent } from '@blocksuite/block-std';
|
||||||
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
import type { GfxModel } from '@blocksuite/block-std/gfx';
|
||||||
import {
|
import { clamp, getCommonBoundWithRotation } from '@blocksuite/global/gfx';
|
||||||
atLeastNMatches,
|
import { atLeastNMatches, groupBy, pickValues } from '@blocksuite/global/utils';
|
||||||
clamp,
|
|
||||||
getCommonBoundWithRotation,
|
|
||||||
groupBy,
|
|
||||||
pickValues,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
import { ConnectorCIcon } from '@blocksuite/icons/lit';
|
import { ConnectorCIcon } from '@blocksuite/icons/lit';
|
||||||
import { css, html, nothing, type TemplateResult, unsafeCSS } from 'lit';
|
import { css, html, nothing, type TemplateResult, unsafeCSS } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, state } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import {
|
|||||||
OpenDocExtensionIdentifier,
|
OpenDocExtensionIdentifier,
|
||||||
TelemetryProvider,
|
TelemetryProvider,
|
||||||
} from '@blocksuite/affine-shared/services';
|
} from '@blocksuite/affine-shared/services';
|
||||||
import { Bound, getCommonBoundWithRotation } from '@blocksuite/global/utils';
|
import { Bound, getCommonBoundWithRotation } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
ArrowDownBigBottomIcon,
|
ArrowDownBigBottomIcon,
|
||||||
ArrowDownBigIcon,
|
ArrowDownBigIcon,
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import {
|
|||||||
GfxControllerIdentifier,
|
GfxControllerIdentifier,
|
||||||
type GfxModel,
|
type GfxModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { assertExists, Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
|
|
||||||
export const edgelessToBlob = async (
|
export const edgelessToBlob = async (
|
||||||
host: EditorHost,
|
host: EditorHost,
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ import type {
|
|||||||
ImageBlockModel,
|
ImageBlockModel,
|
||||||
} from '@blocksuite/affine-model';
|
} from '@blocksuite/affine-model';
|
||||||
import { ShadowlessElement } from '@blocksuite/block-std';
|
import { ShadowlessElement } from '@blocksuite/block-std';
|
||||||
import { Bound, WithDisposable } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import type { BlockModel } from '@blocksuite/store';
|
import type { BlockModel } from '@blocksuite/store';
|
||||||
import { css, type TemplateResult } from 'lit';
|
import { css, type TemplateResult } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ import {
|
|||||||
RANGE_QUERY_EXCLUDE_ATTR,
|
RANGE_QUERY_EXCLUDE_ATTR,
|
||||||
ShadowlessElement,
|
ShadowlessElement,
|
||||||
} from '@blocksuite/block-std';
|
} from '@blocksuite/block-std';
|
||||||
import { deserializeXYWH, WithDisposable } from '@blocksuite/global/utils';
|
import { deserializeXYWH } from '@blocksuite/global/gfx';
|
||||||
|
import { WithDisposable } from '@blocksuite/global/utils';
|
||||||
import { type BlockModel, type Query } from '@blocksuite/store';
|
import { type BlockModel, type Query } from '@blocksuite/store';
|
||||||
import { css, nothing } from 'lit';
|
import { css, nothing } from 'lit';
|
||||||
import { property } from 'lit/decorators.js';
|
import { property } from 'lit/decorators.js';
|
||||||
|
|||||||
@@ -37,12 +37,11 @@ import {
|
|||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import {
|
import {
|
||||||
assertExists,
|
|
||||||
Bound,
|
Bound,
|
||||||
deserializeXYWH,
|
deserializeXYWH,
|
||||||
DisposableGroup,
|
|
||||||
type SerializedXYWH,
|
type SerializedXYWH,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists, DisposableGroup } from '@blocksuite/global/utils';
|
||||||
import { DeleteIcon, EdgelessIcon, FrameIcon } from '@blocksuite/icons/lit';
|
import { DeleteIcon, EdgelessIcon, FrameIcon } from '@blocksuite/icons/lit';
|
||||||
import type { BaseSelection, Store } from '@blocksuite/store';
|
import type { BaseSelection, Store } from '@blocksuite/store';
|
||||||
import { css, html, nothing, type TemplateResult } from 'lit';
|
import { css, html, nothing, type TemplateResult } from 'lit';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { IVec, IVec3 } from '@blocksuite/global/utils';
|
import type { IVec, IVec3 } from '@blocksuite/global/gfx';
|
||||||
import { almostEqual } from '@blocksuite/global/utils';
|
import { almostEqual } from '@blocksuite/global/gfx';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
import { AStarRunner } from '../utils/a-star.js';
|
import { AStarRunner } from '../utils/a-star.js';
|
||||||
@@ -55,7 +55,7 @@ describe('a* algorithm', () => {
|
|||||||
let path: IVec[] | IVec3[] = aStar.path;
|
let path: IVec[] | IVec3[] = aStar.path;
|
||||||
path.pop();
|
path.pop();
|
||||||
path.shift();
|
path.shift();
|
||||||
path = mergePath(path);
|
path = mergePath(path as IVec3[]);
|
||||||
const expected = [
|
const expected = [
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[100, 0],
|
[100, 0],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
getCommonBound,
|
getCommonBound,
|
||||||
inflateBound,
|
inflateBound,
|
||||||
transformPointsToNewBound,
|
transformPointsToNewBound,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
describe('bound utils', () => {
|
describe('bound utils', () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
import { Graph } from '../utils/graph.js';
|
import { Graph } from '../utils/graph.js';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
almostEqual,
|
almostEqual,
|
||||||
assertExists,
|
|
||||||
isPointOnLineSegment,
|
isPointOnLineSegment,
|
||||||
type IVec,
|
type IVec,
|
||||||
lineEllipseIntersects,
|
lineEllipseIntersects,
|
||||||
@@ -12,7 +11,8 @@ import {
|
|||||||
rotatePoints,
|
rotatePoints,
|
||||||
toDegree,
|
toDegree,
|
||||||
toRadian,
|
toRadian,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
|
|
||||||
describe('Line', () => {
|
describe('Line', () => {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
GfxControllerIdentifier,
|
GfxControllerIdentifier,
|
||||||
type GfxModel,
|
type GfxModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
import chunk from 'lodash.chunk';
|
import chunk from 'lodash.chunk';
|
||||||
|
|
||||||
const ALIGN_HEIGHT = 200;
|
const ALIGN_HEIGHT = 200;
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import {
|
|||||||
type GfxPrimitiveElementModel,
|
type GfxPrimitiveElementModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
|
||||||
import type { IBound } from '@blocksuite/global/utils';
|
import type { IBound } from '@blocksuite/global/gfx';
|
||||||
import { Bound, deserializeXYWH } from '@blocksuite/global/utils';
|
import { Bound, deserializeXYWH } from '@blocksuite/global/gfx';
|
||||||
import type { ExtensionType, Store } from '@blocksuite/store';
|
import type { ExtensionType, Store } from '@blocksuite/store';
|
||||||
|
|
||||||
import { SurfaceElementModel } from '../../element-model/base.js';
|
import { SurfaceElementModel } from '../../element-model/base.js';
|
||||||
|
|||||||
@@ -12,12 +12,9 @@ import type {
|
|||||||
GfxLocalElementModel,
|
GfxLocalElementModel,
|
||||||
GfxModel,
|
GfxModel,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound, IVec, IVec3 } from '@blocksuite/global/utils';
|
import type { IBound, IVec, IVec3 } from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
almostEqual,
|
almostEqual,
|
||||||
assertEquals,
|
|
||||||
assertExists,
|
|
||||||
assertType,
|
|
||||||
Bound,
|
Bound,
|
||||||
clamp,
|
clamp,
|
||||||
getBezierCurveBoundingBox,
|
getBezierCurveBoundingBox,
|
||||||
@@ -27,13 +24,18 @@ import {
|
|||||||
getPointFromBoundsWithRotation,
|
getPointFromBoundsWithRotation,
|
||||||
isOverlap,
|
isOverlap,
|
||||||
isVecZero,
|
isVecZero,
|
||||||
last,
|
|
||||||
lineIntersects,
|
lineIntersects,
|
||||||
PI2,
|
PI2,
|
||||||
PointLocation,
|
PointLocation,
|
||||||
sign,
|
sign,
|
||||||
toRadian,
|
toRadian,
|
||||||
Vec,
|
Vec,
|
||||||
|
} from '@blocksuite/global/gfx';
|
||||||
|
import {
|
||||||
|
assertEquals,
|
||||||
|
assertExists,
|
||||||
|
assertType,
|
||||||
|
last,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/utils';
|
||||||
import { effect } from '@preact/signals-core';
|
import { effect } from '@preact/signals-core';
|
||||||
|
|
||||||
|
|||||||
@@ -6,14 +6,9 @@ import type {
|
|||||||
SurfaceBlockModel,
|
SurfaceBlockModel,
|
||||||
Viewport,
|
Viewport,
|
||||||
} from '@blocksuite/block-std/gfx';
|
} from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound } from '@blocksuite/global/utils';
|
import type { IBound } from '@blocksuite/global/gfx';
|
||||||
import {
|
import { getBoundWithRotation, intersects } from '@blocksuite/global/gfx';
|
||||||
DisposableGroup,
|
import { DisposableGroup, last, Slot } from '@blocksuite/global/utils';
|
||||||
getBoundWithRotation,
|
|
||||||
intersects,
|
|
||||||
last,
|
|
||||||
Slot,
|
|
||||||
} from '@blocksuite/global/utils';
|
|
||||||
|
|
||||||
import type { SurfaceElementModel } from '../element-model/base.js';
|
import type { SurfaceElementModel } from '../element-model/base.js';
|
||||||
import { RoughCanvas } from '../utils/rough/canvas.js';
|
import { RoughCanvas } from '../utils/rough/canvas.js';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
getBezierParameters,
|
getBezierParameters,
|
||||||
type PointLocation,
|
type PointLocation,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
import { deltaInsertsToChunks } from '@blocksuite/inline';
|
import { deltaInsertsToChunks } from '@blocksuite/inline';
|
||||||
|
|
||||||
import { isConnectorWithLabel } from '../../../managers/connector-manager.js';
|
import { isConnectorWithLabel } from '../../../managers/connector-manager.js';
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import type {
|
|||||||
BezierCurveParameters,
|
BezierCurveParameters,
|
||||||
IVec,
|
IVec,
|
||||||
PointLocation,
|
PointLocation,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
import {
|
import {
|
||||||
getBezierParameters,
|
getBezierParameters,
|
||||||
getBezierTangent,
|
getBezierTangent,
|
||||||
Vec,
|
Vec,
|
||||||
} from '@blocksuite/global/utils';
|
} from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import type { RoughCanvas } from '../../../utils/rough/canvas.js';
|
import type { RoughCanvas } from '../../../utils/rough/canvas.js';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { GroupElementModel } from '@blocksuite/affine-model';
|
import type { GroupElementModel } from '@blocksuite/affine-model';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import type { CanvasRenderer } from '../../canvas-renderer.js';
|
import type { CanvasRenderer } from '../../canvas-renderer.js';
|
||||||
import { titleRenderParams } from './utils.js';
|
import { titleRenderParams } from './utils.js';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { GroupElementModel } from '@blocksuite/affine-model';
|
import type { GroupElementModel } from '@blocksuite/affine-model';
|
||||||
import { FontWeight } from '@blocksuite/affine-model';
|
import { FontWeight } from '@blocksuite/affine-model';
|
||||||
import { Bound } from '@blocksuite/global/utils';
|
import { Bound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getFontString,
|
getFontString,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import type { GfxPrimitiveElementModel } from '@blocksuite/block-std/gfx';
|
import type { GfxPrimitiveElementModel } from '@blocksuite/block-std/gfx';
|
||||||
import type { IBound } from '@blocksuite/global/utils';
|
import type { IBound } from '@blocksuite/global/gfx';
|
||||||
|
|
||||||
import type { RoughCanvas } from '../../index.js';
|
import type { RoughCanvas } from '../../index.js';
|
||||||
import type { CanvasRenderer } from '../canvas-renderer.js';
|
import type { CanvasRenderer } from '../canvas-renderer.js';
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user