@blocksuite/affine-model
Advanced tools
Comparing version 0.0.0-canary-20241216011454 to 0.0.0-canary-20241216023618
142
CHANGELOG.md
# @blocksuite/affine-model | ||
## 0.0.0-canary-20241216011454 | ||
## 0.0.0-canary-20241216023618 | ||
@@ -9,139 +9,7 @@ ### Patch Changes | ||
- Updated dependencies | ||
- @blocksuite/block-std@0.0.0-canary-20241216011454 | ||
- @blocksuite/global@0.0.0-canary-20241216011454 | ||
- @blocksuite/inline@0.0.0-canary-20241216011454 | ||
- @blocksuite/store@0.0.0-canary-20241216011454 | ||
- @blocksuite/block-std@0.0.0-canary-20241216023618 | ||
- @blocksuite/global@0.0.0-canary-20241216023618 | ||
- @blocksuite/inline@0.0.0-canary-20241216023618 | ||
- @blocksuite/store@0.0.0-canary-20241216023618 | ||
## 0.19.0 | ||
### Minor Changes | ||
- d7ec057: Blocksuite minor release. | ||
## Feat | ||
- feat: enable new dnd by default (#8970) | ||
- feat: should insert bookmark when drop frame and group (#8969) | ||
- feat(blocks): add block adapters for note block (#8963) | ||
## Fix | ||
- fix: note dnd preview (#8968) | ||
- fix: attachment, bookmark and embed blocks should be draggable (#8967) | ||
- fix: should copy embed doc when dnd (#8966) | ||
- fix(std): undefined editor during rect polling on mobile (#8965) | ||
- fix(blocks): fix incorrect font family in mobile widgets (#8961) | ||
- fix(blocks): at menu styles (#8962) | ||
## Refactor | ||
- refactor: optimize code of new drag event watcher (#8971) | ||
- refactor(playground): remove `mockPeekViewExtension` (#8964) | ||
### Patch Changes | ||
- Updated dependencies [d7ec057] | ||
- @blocksuite/block-std@0.19.0 | ||
- @blocksuite/global@0.19.0 | ||
- @blocksuite/inline@0.19.0 | ||
- @blocksuite/store@0.19.0 | ||
## 0.18.7 | ||
### Patch Changes | ||
- 1057773: Blocksuite patch release. | ||
## Feat | ||
- feat(edgeless): rewrite mind map drag indicator (#8805) | ||
- feat: remove data transfer from dnd api (#8955) | ||
## Fix | ||
- fix: dnd from entity api (#8958) | ||
- fix(std): edge case on pointer controller (#8954) | ||
- fix: indent behavior (#8941) | ||
- fix(edgeless): add index reorder buttong for frame block (#8951) | ||
## Chore | ||
- chore: run headless vitest locally by default (#8957) | ||
- chore(blocks): disable image peekview on mobile (#8952) | ||
## Refactor | ||
- refactor(database): refactor addRow functionality in kanban and table views (#8956) | ||
- refactor: notion html adapter (#8947) | ||
- Updated dependencies [1057773] | ||
- @blocksuite/block-std@0.18.7 | ||
- @blocksuite/global@0.18.7 | ||
- @blocksuite/inline@0.18.7 | ||
- @blocksuite/store@0.18.7 | ||
## 0.18.6 | ||
### Patch Changes | ||
- d925364: Blocksuite patch release. | ||
## Feat | ||
- feat: add from entity api for dnd (#8946) | ||
- feat: make block to snapshot a sync method (#8943) | ||
- feat(database): enhance filter functionality with default values (#8932) | ||
- feat: bring back the ability to drag blocks from note to edgeless (#8914) | ||
- feat(blocks): responsive ui for embed doc (#8900) | ||
- feat(edgeless): unlock and unlock button (#8826) | ||
- feat(edgeless): impl lock interface for edgeless element and block (#8825) | ||
- feat(edgeless): add lock property to edgeless block and element (#8824) | ||
- feat(blocks): support embed linked doc and synced doc html block adapter (#8907) | ||
- feat(blocks): support database html block adapter (#8898) | ||
## Fix | ||
- fix(blocks): inconsistent language list behavior on hover in Firefox (#8944) | ||
- fix(database): adjust detail panel layout for better responsiveness (#8945) | ||
- fix(database): move cursor in kanban card title by arrow keys (#8893) | ||
- fix(blocks): show keyboard toolbar when focus on title and hide on scrolling (#8939) | ||
- fix(blocks): missing aliases when duplicating linked doc block on edgeless (#8930) | ||
- fix: remove vitest extension from recommendation list (#8936) | ||
- fix(blocks): should prevent default if drop event is handled (#8929) | ||
- fix(blocks): missing aliases when converting from embed to card (#8928) | ||
- fix(blocks): should show original doc title when hovering title button (#8925) | ||
- fix(blocks): hide the thumb for bookmark if its width is less than 375 (#8922) | ||
- fix(blocks): button styling when disabled on embed card edit popup (#8924) | ||
- fix(edgeless): undefined telemetry service (#8918) | ||
- fix(database): add group call frequency is incorrect (#8916) | ||
- fix(database): adjust padding for mobile menu to accommodate safe area insets (#8915) | ||
## Chore | ||
- chore(edgeless): telemetry for edgeless lock feature (#8933) | ||
- chore(blocks): use rest params in parsed result (#8908) | ||
- chore: lock file maintenance (#8919) | ||
- chore: lock file maintenance (#8894) | ||
## Refactor | ||
- refactor: adapter types and utils (#8934) | ||
- refactor: make notion text adapter as an extension (#8926) | ||
## Perf | ||
- perf(std): cache dom rect for pointer controller (#8940) | ||
## Test | ||
- test(database): add sorting functionality tests for multiple rules (#8917) | ||
- test(edgeless): fix lock flaky test by adding waitNextFrame (#8937) | ||
- test(edgeless): edgeless element lock feature tests (#8867) | ||
- Updated dependencies [d925364] | ||
- @blocksuite/block-std@0.18.6 | ||
- @blocksuite/global@0.18.6 | ||
- @blocksuite/inline@0.18.6 | ||
- @blocksuite/store@0.18.6 | ||
## 0.18.5 | ||
@@ -148,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
import type { FromSnapshotPayload, SnapshotNode } from '@blocksuite/store'; | ||
import type { FromSnapshotPayload, SnapshotNode, ToSnapshotPayload } from '@blocksuite/store'; | ||
import { BaseBlockTransformer } from '@blocksuite/store'; | ||
@@ -6,3 +6,9 @@ import type { AttachmentBlockProps } from './attachment-model.js'; | ||
fromSnapshot(payload: FromSnapshotPayload): Promise<SnapshotNode<AttachmentBlockProps>>; | ||
toSnapshot(payload: ToSnapshotPayload<AttachmentBlockProps>): Promise<{ | ||
version?: number | undefined; | ||
flavour: string; | ||
id: string; | ||
props: Record<string, unknown>; | ||
}>; | ||
} | ||
//# sourceMappingURL=attachment-transformer.d.ts.map |
@@ -10,3 +10,10 @@ import { BaseBlockTransformer } from '@blocksuite/store'; | ||
} | ||
async toSnapshot(payload) { | ||
const snapshot = super.toSnapshot(payload); | ||
const sourceId = payload.model.sourceId; | ||
if (sourceId) | ||
await payload.assets.readFromBlob(sourceId); | ||
return snapshot; | ||
} | ||
} | ||
//# sourceMappingURL=attachment-transformer.js.map |
@@ -14,4 +14,4 @@ import type { ReferenceInfo } from '../../../consts/doc.js'; | ||
pageId: string; | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
params?: { | ||
@@ -18,0 +18,0 @@ mode?: "edgeless" | "page" | undefined; |
@@ -16,4 +16,4 @@ import type { ReferenceInfo } from '../../../consts/doc.js'; | ||
pageId: string; | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
params?: { | ||
@@ -20,0 +20,0 @@ mode?: "edgeless" | "page" | undefined; |
@@ -1,2 +0,2 @@ | ||
import type { FromSnapshotPayload, SnapshotNode } from '@blocksuite/store'; | ||
import type { FromSnapshotPayload, SnapshotNode, ToSnapshotPayload } from '@blocksuite/store'; | ||
import { BaseBlockTransformer } from '@blocksuite/store'; | ||
@@ -6,3 +6,9 @@ import type { ImageBlockProps } from './image-model.js'; | ||
fromSnapshot(payload: FromSnapshotPayload): Promise<SnapshotNode<ImageBlockProps>>; | ||
toSnapshot(payload: ToSnapshotPayload<ImageBlockProps>): Promise<{ | ||
version?: number | undefined; | ||
flavour: string; | ||
id: string; | ||
props: Record<string, unknown>; | ||
}>; | ||
} | ||
//# sourceMappingURL=image-transformer.d.ts.map |
@@ -10,3 +10,10 @@ import { BaseBlockTransformer } from '@blocksuite/store'; | ||
} | ||
async toSnapshot(payload) { | ||
const snapshot = await super.toSnapshot(payload); | ||
const sourceId = payload.model.sourceId; | ||
if (sourceId) | ||
await payload.assets.readFromBlob(sourceId); | ||
return snapshot; | ||
} | ||
} | ||
//# sourceMappingURL=image-transformer.js.map |
@@ -14,10 +14,10 @@ import { z } from 'zod'; | ||
export declare const AliasInfoSchema: z.ZodObject<{ | ||
title: z.ZodOptional<z.ZodString>; | ||
description: z.ZodOptional<z.ZodString>; | ||
title: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
description: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
}, "strip", z.ZodTypeAny, { | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
}, { | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
}>; | ||
@@ -67,8 +67,8 @@ export type AliasInfo = z.infer<typeof AliasInfoSchema>; | ||
}, { | ||
title: z.ZodOptional<z.ZodString>; | ||
description: z.ZodOptional<z.ZodString>; | ||
title: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
description: z.ZodOptional<z.ZodNullable<z.ZodString>>; | ||
}>, "strip", z.ZodTypeAny, { | ||
pageId: string; | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
params?: { | ||
@@ -83,4 +83,4 @@ mode?: "edgeless" | "page" | undefined; | ||
pageId: string; | ||
description?: string | undefined; | ||
title?: string | undefined; | ||
description?: string | null | undefined; | ||
title?: string | null | undefined; | ||
params?: { | ||
@@ -87,0 +87,0 @@ mode?: "edgeless" | "page" | undefined; |
@@ -14,4 +14,4 @@ import { z } from 'zod'; | ||
.object({ | ||
title: z.string(), | ||
description: z.string(), | ||
title: z.string().nullable(), | ||
description: z.string().nullable(), | ||
}) | ||
@@ -18,0 +18,0 @@ .partial(); |
@@ -21,11 +21,12 @@ import type { BaseElementProps, GfxModel, PointTestOptions, SerializedElement } from '@blocksuite/block-std/gfx'; | ||
children: MindmapNode[]; | ||
parent: MindmapNode | null; | ||
/** | ||
* This area is used to determine where to place the dragged node. | ||
* | ||
* When dragging another node into this area, it will become a sibling of the this node. | ||
* But if it is dragged into the small area located right after the this node, it will become a child of the this node. | ||
* When dragging another node into this area, it will become a sibling of the target node. | ||
* However, if it is dragged into the small area located right after the target node, it will become a child node of the target node. | ||
*/ | ||
responseArea?: Bound; | ||
/** | ||
* The bound of the entire subtree | ||
*/ | ||
treeBound?: Bound; | ||
/** | ||
* This property override the preferredDir or default layout direction. | ||
@@ -64,3 +65,3 @@ * It is used during dragging that would temporary change the layout direction | ||
private _queueBuildTree; | ||
private _queuedLayout; | ||
private _queued; | ||
private _stashedNode; | ||
@@ -67,0 +68,0 @@ private _tree; |
@@ -43,3 +43,2 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { | ||
import { mindmapStyleGetters } from './style.js'; | ||
import { findInfiniteLoop } from './utils.js'; | ||
const baseNodeSchema = z.object({ | ||
@@ -333,5 +332,7 @@ text: z.string(), | ||
nodesMap.forEach((val, id) => { | ||
if (!mindmapNodeMap.has(id)) { | ||
mindmapNodeMap.set(id, { | ||
const node = mindmapNodeMap.has(id) | ||
? mindmapNodeMap.get(id) | ||
: { | ||
id, | ||
parent: val.parent, | ||
index: val.index, | ||
@@ -341,11 +342,9 @@ detail: val, | ||
children: [], | ||
parent: null, | ||
}); | ||
} | ||
const node = mindmapNodeMap.get(id); | ||
// some node may be already created during | ||
// iterating its children | ||
}; | ||
if (!node.detail) { | ||
node.detail = val; | ||
} | ||
if (!mindmapNodeMap.has(id)) { | ||
mindmapNodeMap.set(id, node); | ||
} | ||
if (!val.parent) { | ||
@@ -356,15 +355,13 @@ rootNode = node; | ||
} | ||
else if (mindmapNodeMap.has(val.parent)) { | ||
const parentNode = mindmapNodeMap.get(val.parent); | ||
parentNode.children = parentNode.children ?? []; | ||
parentNode.children.push(node); | ||
} | ||
else { | ||
if (!mindmapNodeMap.has(val.parent)) { | ||
mindmapNodeMap.set(val.parent, { | ||
id: val.parent, | ||
detail: nodesMap.get(val.parent), | ||
parent: null, | ||
children: [], | ||
element: this.surface.getElementById(val.parent), | ||
}); | ||
} | ||
const parent = mindmapNodeMap.get(val.parent); | ||
parent.children.push(node); | ||
node.parent = parent; | ||
mindmapNodeMap.set(val.parent, { | ||
id: val.parent, | ||
children: [node], | ||
element: this.surface.getElementById(val.parent), | ||
}); | ||
} | ||
@@ -382,23 +379,2 @@ }); | ||
} | ||
const loops = findInfiniteLoop(rootNode, mindmapNodeMap); | ||
if (loops.length) { | ||
this.surface.doc.withoutTransact(() => { | ||
loops.forEach(loop => { | ||
if (loop.detached) { | ||
loop.chain.forEach(node => { | ||
this.children.delete(node.id); | ||
}); | ||
} | ||
else { | ||
const child = last(loop.chain); | ||
if (child) { | ||
this.children.set(child.id, { | ||
index: child.detail.index, | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
return; | ||
} | ||
this._nodeMap = mindmapNodeMap; | ||
@@ -583,7 +559,7 @@ this._tree = rootNode; | ||
requestLayout() { | ||
if (!this._queuedLayout) { | ||
this._queuedLayout = true; | ||
if (!this._queued) { | ||
this._queued = true; | ||
queueMicrotask(() => { | ||
this.layout(); | ||
this._queuedLayout = false; | ||
this._queued = false; | ||
}); | ||
@@ -646,3 +622,3 @@ } | ||
this._queueBuildTree = false; | ||
this._queuedLayout = false; | ||
this._queued = false; | ||
this._stashedNode = new Set(); | ||
@@ -649,0 +625,0 @@ this.connectors = new Map(); |
{ | ||
"name": "@blocksuite/affine-model", | ||
"version": "0.0.0-canary-20241216011454", | ||
"version": "0.0.0-canary-20241216023618", | ||
"description": "Models for BlockSuite in Affine.", | ||
@@ -22,6 +22,6 @@ "type": "module", | ||
"dependencies": { | ||
"@blocksuite/block-std": "0.0.0-canary-20241216011454", | ||
"@blocksuite/global": "0.0.0-canary-20241216011454", | ||
"@blocksuite/inline": "0.0.0-canary-20241216011454", | ||
"@blocksuite/store": "0.0.0-canary-20241216011454", | ||
"@blocksuite/block-std": "0.0.0-canary-20241216023618", | ||
"@blocksuite/global": "0.0.0-canary-20241216023618", | ||
"@blocksuite/inline": "0.0.0-canary-20241216023618", | ||
"@blocksuite/store": "0.0.0-canary-20241216023618", | ||
"fractional-indexing": "^3.2.0", | ||
@@ -28,0 +28,0 @@ "zod": "^3.23.8" |
@@ -1,2 +0,6 @@ | ||
import type { FromSnapshotPayload, SnapshotNode } from '@blocksuite/store'; | ||
import type { | ||
FromSnapshotPayload, | ||
SnapshotNode, | ||
ToSnapshotPayload, | ||
} from '@blocksuite/store'; | ||
@@ -18,2 +22,10 @@ import { BaseBlockTransformer } from '@blocksuite/store'; | ||
} | ||
override async toSnapshot(payload: ToSnapshotPayload<AttachmentBlockProps>) { | ||
const snapshot = super.toSnapshot(payload); | ||
const sourceId = payload.model.sourceId; | ||
if (sourceId) await payload.assets.readFromBlob(sourceId); | ||
return snapshot; | ||
} | ||
} |
@@ -1,2 +0,6 @@ | ||
import type { FromSnapshotPayload, SnapshotNode } from '@blocksuite/store'; | ||
import type { | ||
FromSnapshotPayload, | ||
SnapshotNode, | ||
ToSnapshotPayload, | ||
} from '@blocksuite/store'; | ||
@@ -18,2 +22,10 @@ import { BaseBlockTransformer } from '@blocksuite/store'; | ||
} | ||
override async toSnapshot(payload: ToSnapshotPayload<ImageBlockProps>) { | ||
const snapshot = await super.toSnapshot(payload); | ||
const sourceId = payload.model.sourceId; | ||
if (sourceId) await payload.assets.readFromBlob(sourceId); | ||
return snapshot; | ||
} | ||
} |
@@ -18,4 +18,4 @@ import { z } from 'zod'; | ||
.object({ | ||
title: z.string(), | ||
description: z.string(), | ||
title: z.string().nullable(), | ||
description: z.string().nullable(), | ||
}) | ||
@@ -22,0 +22,0 @@ .partial(); |
@@ -33,3 +33,2 @@ import type { | ||
import { mindmapStyleGetters } from './style.js'; | ||
import { findInfiniteLoop } from './utils.js'; | ||
@@ -51,9 +50,5 @@ export type NodeDetail = { | ||
parent: MindmapNode | null; | ||
/** | ||
* This area is used to determine where to place the dragged node. | ||
* | ||
* When dragging another node into this area, it will become a sibling of the this node. | ||
* But if it is dragged into the small area located right after the this node, it will become a child of the this node. | ||
* When dragging another node into this area, it will become a sibling of the target node. | ||
* However, if it is dragged into the small area located right after the target node, it will become a child node of the target node. | ||
*/ | ||
@@ -63,2 +58,7 @@ responseArea?: Bound; | ||
/** | ||
* The bound of the entire subtree | ||
*/ | ||
treeBound?: Bound; | ||
/** | ||
* This property override the preferredDir or default layout direction. | ||
@@ -153,3 +153,3 @@ * It is used during dragging that would temporary change the layout direction | ||
private _queuedLayout = false; | ||
private _queued = false; | ||
@@ -434,17 +434,13 @@ private _stashedNode = new Set<string>(); | ||
nodesMap.forEach((val, id) => { | ||
if (!mindmapNodeMap.has(id)) { | ||
mindmapNodeMap.set(id, { | ||
id, | ||
index: val.index, | ||
detail: val, | ||
element: this.surface.getElementById(id)!, | ||
children: [], | ||
parent: null, | ||
} as MindmapNode); | ||
} | ||
const node = mindmapNodeMap.has(id) | ||
? mindmapNodeMap.get(id)! | ||
: ({ | ||
id, | ||
parent: val.parent, | ||
index: val.index, | ||
detail: val, | ||
element: this.surface.getElementById(id)!, | ||
children: [], | ||
} as MindmapNode); | ||
const node = mindmapNodeMap.get(id)!; | ||
// some node may be already created during | ||
// iterating its children | ||
if (!node.detail) { | ||
@@ -454,2 +450,6 @@ node.detail = val; | ||
if (!mindmapNodeMap.has(id)) { | ||
mindmapNodeMap.set(id, node); | ||
} | ||
if (!val.parent) { | ||
@@ -459,16 +459,12 @@ rootNode = node as MindmapRoot; | ||
rootNode.right = []; | ||
} else if (mindmapNodeMap.has(val.parent)) { | ||
const parentNode = mindmapNodeMap.get(val.parent)!; | ||
parentNode.children = parentNode.children ?? []; | ||
parentNode.children.push(node); | ||
} else { | ||
if (!mindmapNodeMap.has(val.parent)) { | ||
mindmapNodeMap.set(val.parent, { | ||
id: val.parent, | ||
detail: nodesMap.get(val.parent)!, | ||
parent: null, | ||
children: [], | ||
element: this.surface.getElementById(val.parent)!, | ||
} as MindmapNode); | ||
} | ||
const parent = mindmapNodeMap.get(val.parent)!; | ||
parent.children.push(node); | ||
node.parent = parent; | ||
mindmapNodeMap.set(val.parent, { | ||
id: val.parent, | ||
children: [node], | ||
element: this.surface.getElementById(val.parent)!, | ||
} as MindmapNode); | ||
} | ||
@@ -491,25 +487,2 @@ }); | ||
const loops = findInfiniteLoop(rootNode, mindmapNodeMap); | ||
if (loops.length) { | ||
this.surface.doc.withoutTransact(() => { | ||
loops.forEach(loop => { | ||
if (loop.detached) { | ||
loop.chain.forEach(node => { | ||
this.children.delete(node.id); | ||
}); | ||
} else { | ||
const child = last(loop.chain); | ||
if (child) { | ||
this.children.set(child.id, { | ||
index: child.detail.index, | ||
}); | ||
} | ||
} | ||
}); | ||
}); | ||
return; | ||
} | ||
this._nodeMap = mindmapNodeMap; | ||
@@ -763,8 +736,8 @@ this._tree = rootNode; | ||
requestLayout() { | ||
if (!this._queuedLayout) { | ||
this._queuedLayout = true; | ||
if (!this._queued) { | ||
this._queued = true; | ||
queueMicrotask(() => { | ||
this.layout(); | ||
this._queuedLayout = false; | ||
this._queued = false; | ||
}); | ||
@@ -771,0 +744,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
726580
452
10164
+ Added@blocksuite/block-std@0.0.0-canary-20241216023618(transitive)
+ Added@blocksuite/global@0.0.0-canary-20241216023618(transitive)
+ Added@blocksuite/inline@0.0.0-canary-20241216023618(transitive)
+ Added@blocksuite/store@0.0.0-canary-20241216023618(transitive)
+ Added@blocksuite/sync@0.0.0-canary-20241216023618(transitive)
- Removed@blocksuite/block-std@0.0.0-canary-20241216011454(transitive)
- Removed@blocksuite/global@0.0.0-canary-20241216011454(transitive)
- Removed@blocksuite/inline@0.0.0-canary-20241216011454(transitive)
- Removed@blocksuite/store@0.0.0-canary-20241216011454(transitive)
- Removed@blocksuite/sync@0.0.0-canary-20241216011454(transitive)