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

@blocksuite/store

Package Overview
Dependencies
Maintainers
5
Versions
1266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/store - npm Package Compare versions

Comparing version 0.4.0-20230130171906-1b6338b to 0.4.0-20230131204452-60bc555

4

dist/workspace/page.d.ts

@@ -71,3 +71,3 @@ /// <reference types="@blocksuite/global" />

getTagSchema(id: TagSchema['id']): TagSchema | null;
setTagSchema(schema: TagSchema): unknown;
setTagSchema(schema: TagSchema): void;
getBlockById(id: string): BaseBlockModel<unknown> | null;

@@ -89,3 +89,3 @@ getBlockByFlavour(blockFlavour: string): BaseBlockModel<unknown>[];

updateBlock<T extends Partial<BlockProps>>(model: BaseBlockModel, props: T): void;
insertBlock(blockProps: Partial<BaseBlockModel>, targetModel: BaseBlockModel, top?: boolean): void;
addSiblingBlock(targetModel: BaseBlockModel, blockProps: Partial<BaseBlockModel>, direction?: 'left' | 'right'): string;
deleteBlockById(id: string): void;

@@ -92,0 +92,0 @@ deleteBlock(model: BaseBlockModel, options?: {

@@ -196,3 +196,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

setTagSchema(schema) {
return this.tagSchema.set(schema.id, schema);
this.transact(() => this.tagSchema.set(schema.id, schema));
}

@@ -378,19 +378,12 @@ getBlockById(id) {

}
insertBlock(blockProps, targetModel, top = true) {
const targetParentModel = this.getParent(targetModel);
if (targetParentModel === null) {
throw new Error('cannot find parent model');
}
this.transact(() => {
const yParent = this._yBlocks.get(targetParentModel.id);
const yChildren = yParent.get('sys:children');
const targetIdx = yChildren
.toArray()
.findIndex(id => id === targetModel.id);
assertExists(blockProps.flavour);
this.addBlockByFlavour(blockProps.flavour, {
type: blockProps.type,
}, targetParentModel.id, top ? targetIdx : targetIdx + 1);
// }
});
addSiblingBlock(targetModel, blockProps, direction = 'right') {
const parent = this.getParent(targetModel);
assertExists(blockProps.flavour);
assertExists(parent);
const targetIndex = parent?.children.findIndex(({ id }) => id === targetModel.id) ?? 0;
const insertIndex = direction === 'right' ? targetIndex : targetIndex + 1;
const id = this.addBlockByFlavour(blockProps.flavour, {
type: blockProps.type,
}, parent.id, insertIndex);
return id;
}

@@ -718,6 +711,3 @@ deleteBlockById(id) {

debug('CRUD')
], Page.prototype, "insertBlock", null);
__decorate([
debug('CRUD')
], Page.prototype, "deleteBlock", null);
//# sourceMappingURL=page.js.map
{
"name": "@blocksuite/store",
"version": "0.4.0-20230130171906-1b6338b",
"version": "0.4.0-20230131204452-60bc555",
"description": "BlockSuite data store built for general purpose state management.",

@@ -11,3 +11,3 @@ "main": "dist/index.js",

"dependencies": {
"@blocksuite/global": "0.4.0-20230130171906-1b6338b",
"@blocksuite/global": "0.4.0-20230131204452-60bc555",
"@types/flexsearch": "^0.7.3",

@@ -14,0 +14,0 @@ "buffer": "^6.0.3",

@@ -225,3 +225,3 @@ import * as Y from 'yjs';

setTagSchema(schema: TagSchema) {
return this.tagSchema.set(schema.id, schema);
this.transact(() => this.tagSchema.set(schema.id, schema));
}

@@ -471,29 +471,24 @@

@debug('CRUD')
insertBlock(
addSiblingBlock(
targetModel: BaseBlockModel,
blockProps: Partial<BaseBlockModel>,
targetModel: BaseBlockModel,
top = true
direction: 'left' | 'right' = 'right'
) {
const targetParentModel = this.getParent(targetModel);
if (targetParentModel === null) {
throw new Error('cannot find parent model');
}
this.transact(() => {
const yParent = this._yBlocks.get(targetParentModel.id) as YBlock;
const yChildren = yParent.get('sys:children') as Y.Array<string>;
const targetIdx = yChildren
.toArray()
.findIndex(id => id === targetModel.id);
assertExists(blockProps.flavour);
this.addBlockByFlavour(
blockProps.flavour,
{
type: blockProps.type,
},
targetParentModel.id,
top ? targetIdx : targetIdx + 1
);
// }
});
const parent = this.getParent(targetModel);
assertExists(blockProps.flavour);
assertExists(parent);
const targetIndex =
parent?.children.findIndex(({ id }) => id === targetModel.id) ?? 0;
const insertIndex = direction === 'right' ? targetIndex : targetIndex + 1;
const id = this.addBlockByFlavour(
blockProps.flavour,
{
type: blockProps.type,
},
parent.id,
insertIndex
);
return id;
}

@@ -500,0 +495,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

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