Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/block-std

Package Overview
Dependencies
Maintainers
0
Versions
877
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/block-std - npm Package Compare versions

Comparing version 0.0.0-canary-20241113001418 to 0.0.0-canary-20241114001404

43

CHANGELOG.md
# @blocksuite/block-std
## 0.0.0-canary-20241113001418
## 0.0.0-canary-20241114001404

@@ -9,6 +9,41 @@ ### Patch Changes

- Updated dependencies
- @blocksuite/global@0.0.0-canary-20241113001418
- @blocksuite/inline@0.0.0-canary-20241113001418
- @blocksuite/store@0.0.0-canary-20241113001418
- @blocksuite/global@0.0.0-canary-20241114001404
- @blocksuite/inline@0.0.0-canary-20241114001404
- @blocksuite/store@0.0.0-canary-20241114001404
## 0.17.32
### Patch Changes
- 7bc83ab: ## Fix
- fix: mind map text layout (#8737)
- Updated dependencies [7bc83ab]
- @blocksuite/global@0.17.32
- @blocksuite/inline@0.17.32
- @blocksuite/store@0.17.32
## 0.17.31
### Patch Changes
- 8ab2800: patch more fix
## Fix
- fix(database): lock the group while editing (#8741)
- fix(inline): double click in empty line (#8740)
- fix(inline): triple click in v-line (#8739)
- fix(database): root block might not exist in AFFiNE (#8738)
## Refactor
- refactor: mind map drag (#8716)
- Updated dependencies [8ab2800]
- @blocksuite/global@0.17.31
- @blocksuite/inline@0.17.31
- @blocksuite/store@0.17.31
## 0.17.30

@@ -15,0 +50,0 @@

8

dist/gfx/controller.js

@@ -85,6 +85,6 @@ import { assertType, Bound, DisposableGroup, getCommonBoundWithRotation, last, } from '@blocksuite/global/utils';

const hitTestBound = {
x: x - responsePadding[1],
y: y - responsePadding[0],
w: responsePadding[1] * 2,
h: responsePadding[0] * 2,
x: x - responsePadding[0],
y: y - responsePadding[1],
w: responsePadding[0] * 2,
h: responsePadding[1] * 2,
};

@@ -91,0 +91,0 @@ const candidates = this.grid.search(hitTestBound);

@@ -19,3 +19,3 @@ import { DisposableGroup } from '@blocksuite/global/utils';

const state = evt.get('keyboardState');
this.shiftKey$.value = !state.raw.shiftKey && state.raw.key === 'Shift';
this.shiftKey$.value = state.raw.shiftKey && state.raw.key === 'Shift';
if (state.raw.code === 'Space') {

@@ -22,0 +22,0 @@ this.spaceKey$.value = false;

@@ -30,2 +30,3 @@ import type { IBound, IVec, SerializedXYWH, XYWH } from '@blocksuite/global/utils';

* The padding of the response area for each element when do the hit testing. The unit is pixel.
* The first value is the padding for the x-axis, and the second value is the padding for the y-axis.
*/

@@ -116,3 +117,2 @@ responsePadding?: [number, number];

export declare abstract class GfxGroupLikeElementModel<Props extends BaseElementProps = BaseElementProps> extends GfxPrimitiveElementModel<Props> implements GfxContainerElement {
private _childBoundCacheKey;
private _childIds;

@@ -131,3 +131,3 @@ private _mutex;

set xywh(_: `[${number},${number},${number},${number}]`);
private _updateXYWH;
protected _getXYWH(): Bound;
abstract addChild(element: GfxModel): void;

@@ -134,0 +134,0 @@ /**

@@ -36,3 +36,3 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {

var _a;
import { Bound, deserializeXYWH, DisposableGroup, getBoundWithRotation, getPointsFromBoundWithRotation, linePolygonIntersects, PointLocation, polygonGetPointTangent, polygonNearestPoint, randomSeed, rotatePoints, } from '@blocksuite/global/utils';
import { Bound, deserializeXYWH, DisposableGroup, getBoundWithRotation, getPointsFromBoundWithRotation, isEqual, linePolygonIntersects, PointLocation, polygonGetPointTangent, polygonNearestPoint, randomSeed, rotatePoints, } from '@blocksuite/global/utils';
import { DocCollection } from '@blocksuite/store';

@@ -194,5 +194,7 @@ import { createMutex } from 'lib0/mutex';

if (getFieldPropsSet(this).has(prop)) {
this.surface.doc.transact(() => {
this.yMap.set(prop, value);
});
if (!isEqual(value, this.yMap.get(prop))) {
this.surface.doc.transact(() => {
this.yMap.set(prop, value);
});
}
}

@@ -260,3 +262,2 @@ else {

super(...arguments);
this._childBoundCacheKey = '';
this._childIds = [];

@@ -287,17 +288,26 @@ this._mutex = createMutex();

get xywh() {
if (!this._local.has('xywh') ||
this.childElements.reduce((pre, model) => pre + (model.xywh ?? ''), '') !== this._childBoundCacheKey) {
this._mutex(() => {
this._updateXYWH();
});
}
this._mutex(() => {
const curXYWH = this._local.get('xywh') ?? '[0,0,0,0]';
const newXYWH = this._getXYWH().serialize();
if (curXYWH !== newXYWH || !this._local.has('xywh')) {
this._local.set('xywh', newXYWH);
if (curXYWH !== newXYWH) {
this._onChange({
props: {
xywh: newXYWH,
},
oldValues: {
xywh: curXYWH,
},
local: true,
});
}
}
});
return this._local.get('xywh') ?? '[0,0,0,0]';
}
set xywh(_) { }
_updateXYWH() {
_getXYWH() {
let bound;
let cacheKey = '';
const oldValue = this._local.get('xywh') ?? '[0,0,0,0]';
this.childElements.forEach(child => {
cacheKey += child.xywh ?? '';
bound = bound ? bound.unite(child.elementBound) : child.elementBound;

@@ -307,17 +317,7 @@ });

this._local.set('xywh', bound.serialize());
this._childBoundCacheKey = cacheKey;
}
else {
this._local.delete('xywh');
this._childBoundCacheKey = '';
}
this._onChange({
props: {
xywh: bound?.serialize(),
},
oldValues: {
xywh: oldValue,
},
local: true,
});
return bound ?? new Bound(0, 0, 0, 0);
}

@@ -324,0 +324,0 @@ /**

{
"name": "@blocksuite/block-std",
"version": "0.0.0-canary-20241113001418",
"version": "0.0.0-canary-20241114001404",
"description": "Std for blocksuite blocks",

@@ -23,5 +23,5 @@ "type": "module",

"dependencies": {
"@blocksuite/global": "0.0.0-canary-20241113001418",
"@blocksuite/inline": "0.0.0-canary-20241113001418",
"@blocksuite/store": "0.0.0-canary-20241113001418",
"@blocksuite/global": "0.0.0-canary-20241114001404",
"@blocksuite/inline": "0.0.0-canary-20241114001404",
"@blocksuite/store": "0.0.0-canary-20241114001404",
"@lit/context": "^1.1.2",

@@ -28,0 +28,0 @@ "@preact/signals-core": "^1.8.0",

@@ -159,6 +159,6 @@ import type { BlockModel } from '@blocksuite/store';

const hitTestBound = {
x: x - responsePadding[1],
y: y - responsePadding[0],
w: responsePadding[1] * 2,
h: responsePadding[0] * 2,
x: x - responsePadding[0],
y: y - responsePadding[1],
w: responsePadding[0] * 2,
h: responsePadding[1] * 2,
};

@@ -165,0 +165,0 @@

@@ -31,3 +31,3 @@ import { DisposableGroup } from '@blocksuite/global/utils';

this.shiftKey$.value = !state.raw.shiftKey && state.raw.key === 'Shift';
this.shiftKey$.value = state.raw.shiftKey && state.raw.key === 'Shift';

@@ -34,0 +34,0 @@ if (state.raw.code === 'Space') {

@@ -14,2 +14,3 @@ import type {

getPointsFromBoundWithRotation,
isEqual,
linePolygonIntersects,

@@ -73,2 +74,3 @@ PointLocation,

* The padding of the response area for each element when do the hit testing. The unit is pixel.
* The first value is the padding for the x-axis, and the second value is the padding for the y-axis.
*/

@@ -295,5 +297,7 @@ responsePadding?: [number, number];

if (getFieldPropsSet(this).has(prop as string)) {
this.surface.doc.transact(() => {
this.yMap.set(prop as string, value);
});
if (!isEqual(value, this.yMap.get(prop as string))) {
this.surface.doc.transact(() => {
this.yMap.set(prop as string, value);
});
}
} else {

@@ -387,4 +391,2 @@ console.warn('pop a prop that is not field or local:', prop);

{
private _childBoundCacheKey: string = '';
private _childIds: string[] = [];

@@ -426,14 +428,24 @@

get xywh() {
if (
!this._local.has('xywh') ||
this.childElements.reduce(
(pre, model) => pre + (model.xywh ?? ''),
''
) !== this._childBoundCacheKey
) {
this._mutex(() => {
this._updateXYWH();
});
}
this._mutex(() => {
const curXYWH =
(this._local.get('xywh') as SerializedXYWH) ?? '[0,0,0,0]';
const newXYWH = this._getXYWH().serialize();
if (curXYWH !== newXYWH || !this._local.has('xywh')) {
this._local.set('xywh', newXYWH);
if (curXYWH !== newXYWH) {
this._onChange({
props: {
xywh: newXYWH,
},
oldValues: {
xywh: curXYWH,
},
local: true,
});
}
}
});
return (this._local.get('xywh') as SerializedXYWH) ?? '[0,0,0,0]';

@@ -444,9 +456,6 @@ }

private _updateXYWH() {
protected _getXYWH(): Bound {
let bound: Bound | undefined;
let cacheKey = '';
const oldValue = (this._local.get('xywh') as SerializedXYWH) ?? '[0,0,0,0]';
this.childElements.forEach(child => {
cacheKey += child.xywh ?? '';
bound = bound ? bound.unite(child.elementBound) : child.elementBound;

@@ -457,17 +466,7 @@ });

this._local.set('xywh', bound.serialize());
this._childBoundCacheKey = cacheKey;
} else {
this._local.delete('xywh');
this._childBoundCacheKey = '';
}
this._onChange({
props: {
xywh: bound?.serialize(),
},
oldValues: {
xywh: oldValue,
},
local: true,
});
return bound ?? new Bound(0, 0, 0, 0);
}

@@ -474,0 +473,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc