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

@blocksuite/affine-shared

Package Overview
Dependencies
Maintainers
2
Versions
244
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/affine-shared - npm Package Compare versions

Comparing version 0.0.0-canary-20241211001530 to 0.0.0-canary-20241212001527

dist/adapters/types/adapter.d.ts

12

CHANGELOG.md
# @blocksuite/affine-shared
## 0.0.0-canary-20241211001530
## 0.0.0-canary-20241212001527

@@ -9,7 +9,7 @@ ### Patch Changes

- Updated dependencies
- @blocksuite/affine-model@0.0.0-canary-20241211001530
- @blocksuite/block-std@0.0.0-canary-20241211001530
- @blocksuite/global@0.0.0-canary-20241211001530
- @blocksuite/inline@0.0.0-canary-20241211001530
- @blocksuite/store@0.0.0-canary-20241211001530
- @blocksuite/affine-model@0.0.0-canary-20241212001527
- @blocksuite/block-std@0.0.0-canary-20241212001527
- @blocksuite/global@0.0.0-canary-20241212001527
- @blocksuite/inline@0.0.0-canary-20241212001527
- @blocksuite/store@0.0.0-canary-20241212001527

@@ -16,0 +16,0 @@ ## 0.18.5

import type { ExtensionType } from '@blocksuite/block-std';
import { type ServiceIdentifier } from '@blocksuite/global/di';
import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';
import type { HtmlAST } from '../types/hast.js';
import type { HtmlDeltaConverter } from './delta-converter.js';
import type { HtmlAST } from './type.js';
export type BlockHtmlAdapterMatcher = BlockAdapterMatcher<HtmlAST, HtmlDeltaConverter>;

@@ -7,0 +7,0 @@ export declare const BlockHtmlAdapterMatcherIdentifier: ServiceIdentifier<BlockHtmlAdapterMatcher> & ((variant: import("@blocksuite/global/di").ServiceVariant) => ServiceIdentifier<BlockHtmlAdapterMatcher>);

@@ -5,4 +5,4 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { AffineTextAttributes } from '../../types/index.js';
import type { HtmlAST, InlineHtmlAST } from './type.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type DeltaASTConverterOptions, type InlineDeltaMatcher } from '../type.js';
import type { HtmlAST, InlineHtmlAST } from '../types/hast.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type DeltaASTConverterOptions, type InlineDeltaMatcher } from '../types/adapter.js';
export type InlineDeltaToHtmlAdapterMatcher = InlineDeltaMatcher<InlineHtmlAST>;

@@ -9,0 +9,0 @@ export declare const InlineDeltaToHtmlAdapterMatcherIdentifier: ServiceIdentifier<InlineDeltaToHtmlAdapterMatcher> & ((variant: import("@blocksuite/global/di").ServiceVariant) => ServiceIdentifier<InlineDeltaToHtmlAdapterMatcher>);

import { createIdentifier, } from '@blocksuite/global/di';
import { DeltaASTConverter, } from '../type.js';
import { mergeDeltas } from '../utils.js';
import { DeltaASTConverter, } from '../types/adapter.js';
import { TextUtils } from '../utils/text.js';
export const InlineDeltaToHtmlAdapterMatcherIdentifier = createIdentifier('InlineDeltaToHtmlAdapterMatcher');

@@ -34,5 +34,3 @@ export function InlineDeltaToHtmlAdapterExtension(matcher) {

type: 'text',
value: delta.attributes?.underline
? `<u>${delta.insert}</u>`
: delta.insert,
value: delta.insert,
};

@@ -68,3 +66,3 @@ const context = {

return this._spreadAstToDelta(ast, options).reduce((acc, cur) => {
return mergeDeltas(acc, cur);
return TextUtils.mergeDeltas(acc, cur);
}, []);

@@ -71,0 +69,0 @@ }

@@ -1,6 +0,2 @@

import type { Element, Root, RootContentMap, Text } from 'hast';
export type Html = string;
export type HastUnionType<K extends keyof RootContentMap, V extends RootContentMap[K]> = V;
export type HtmlAST = HastUnionType<keyof RootContentMap, RootContentMap[keyof RootContentMap]> | Root;
export type InlineHtmlAST = Element | Text;
//# sourceMappingURL=type.d.ts.map

@@ -1,8 +0,6 @@

export { BlockHtmlAdapterExtension, type BlockHtmlAdapterMatcher, BlockHtmlAdapterMatcherIdentifier, type Html, type HtmlAST, type HtmlASTToDeltaMatcher, HtmlASTToDeltaMatcherIdentifier, HtmlDeltaConverter, type InlineDeltaToHtmlAdapterMatcher, InlineDeltaToHtmlAdapterMatcherIdentifier, type InlineHtmlAST, } from './html-adapter/index.js';
export { MarkdownDeltaConverter } from './markdown/delta-converter.js';
export { BlockMarkdownAdapterExtension, type BlockMarkdownAdapterMatcher, BlockMarkdownAdapterMatcherIdentifier, type InlineDeltaToMarkdownAdapterMatcher, InlineDeltaToMarkdownAdapterMatcherIdentifier, isMarkdownAST, type Markdown, type MarkdownAST, type MarkdownASTToDeltaMatcher, MarkdownASTToDeltaMatcherIdentifier, } from './markdown/index.js';
export { BlockHtmlAdapterExtension, type BlockHtmlAdapterMatcher, BlockHtmlAdapterMatcherIdentifier, type Html, type HtmlASTToDeltaMatcher, HtmlASTToDeltaMatcherIdentifier, HtmlDeltaConverter, type InlineDeltaToHtmlAdapterMatcher, InlineDeltaToHtmlAdapterMatcherIdentifier, } from './html-adapter/index.js';
export { BlockMarkdownAdapterExtension, type BlockMarkdownAdapterMatcher, BlockMarkdownAdapterMatcherIdentifier, type InlineDeltaToMarkdownAdapterMatcher, InlineDeltaToMarkdownAdapterMatcherIdentifier, isMarkdownAST, type Markdown, type MarkdownAST, type MarkdownASTToDeltaMatcher, MarkdownASTToDeltaMatcherIdentifier, MarkdownDeltaConverter, } from './markdown/index.js';
export { BlockPlainTextAdapterExtension, type BlockPlainTextAdapterMatcher, BlockPlainTextAdapterMatcherIdentifier, type InlineDeltaToPlainTextAdapterMatcher, InlineDeltaToPlainTextAdapterMatcherIdentifier, type PlainText, PlainTextDeltaConverter, } from './plain-text/index.js';
export { type AdapterContext, type BlockAdapterMatcher, DeltaASTConverter, isBlockSnapshotNode, type TextBuffer, } from './type.js';
export { createText, fetchable, fetchImage, isNullish, isText, mergeDeltas, toURLSearchParams, } from './utils.js';
export { type AdapterContext, type BlockAdapterMatcher, DeltaASTConverter, type HtmlAST, type InlineHtmlAST, isBlockSnapshotNode, type TextBuffer, } from './types/index.js';
export * from './utils/index.js';
//# sourceMappingURL=index.d.ts.map
export { BlockHtmlAdapterExtension, BlockHtmlAdapterMatcherIdentifier, HtmlASTToDeltaMatcherIdentifier, HtmlDeltaConverter, InlineDeltaToHtmlAdapterMatcherIdentifier, } from './html-adapter/index.js';
export { MarkdownDeltaConverter } from './markdown/delta-converter.js';
export { BlockMarkdownAdapterExtension, BlockMarkdownAdapterMatcherIdentifier, InlineDeltaToMarkdownAdapterMatcherIdentifier, isMarkdownAST, MarkdownASTToDeltaMatcherIdentifier, } from './markdown/index.js';
export { BlockMarkdownAdapterExtension, BlockMarkdownAdapterMatcherIdentifier, InlineDeltaToMarkdownAdapterMatcherIdentifier, isMarkdownAST, MarkdownASTToDeltaMatcherIdentifier, MarkdownDeltaConverter, } from './markdown/index.js';
export { BlockPlainTextAdapterExtension, BlockPlainTextAdapterMatcherIdentifier, InlineDeltaToPlainTextAdapterMatcherIdentifier, PlainTextDeltaConverter, } from './plain-text/index.js';
export { DeltaASTConverter, isBlockSnapshotNode, } from './type.js';
export { createText, fetchable, fetchImage, isNullish, isText, mergeDeltas, toURLSearchParams, } from './utils.js';
export { DeltaASTConverter, isBlockSnapshotNode, } from './types/index.js';
export * from './utils/index.js';
//# sourceMappingURL=index.js.map
import type { ExtensionType } from '@blocksuite/block-std';
import { type ServiceIdentifier } from '@blocksuite/global/di';
import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';
import type { MarkdownDeltaConverter } from './delta-converter.js';

@@ -5,0 +5,0 @@ import type { MarkdownAST } from './type.js';

@@ -7,3 +7,3 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { MarkdownAST } from './type.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type InlineDeltaMatcher } from '../type.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type InlineDeltaMatcher } from '../types/adapter.js';
export type InlineDeltaToMarkdownAdapterMatcher = InlineDeltaMatcher<PhrasingContent>;

@@ -10,0 +10,0 @@ export declare const InlineDeltaToMarkdownAdapterMatcherIdentifier: ServiceIdentifier<InlineDeltaToMarkdownAdapterMatcher> & ((variant: import("@blocksuite/global/di").ServiceVariant) => ServiceIdentifier<InlineDeltaToMarkdownAdapterMatcher>);

import { createIdentifier, } from '@blocksuite/global/di';
import { DeltaASTConverter, } from '../type.js';
import { DeltaASTConverter, } from '../types/adapter.js';
export const InlineDeltaToMarkdownAdapterMatcherIdentifier = createIdentifier('InlineDeltaToMarkdownAdapterMatcher');

@@ -4,0 +4,0 @@ export function InlineDeltaToMarkdownAdapterExtension(matcher) {

import type { ExtensionType } from '@blocksuite/block-std';
import { type ServiceIdentifier } from '@blocksuite/global/di';
import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';
export type BlockPlainTextAdapterMatcher = BlockAdapterMatcher;

@@ -5,0 +5,0 @@ export declare const BlockPlainTextAdapterMatcherIdentifier: ServiceIdentifier<BlockPlainTextAdapterMatcher> & ((variant: import("@blocksuite/global/di").ServiceVariant) => ServiceIdentifier<BlockPlainTextAdapterMatcher>);

import type { DeltaInsert } from '@blocksuite/inline';
import type { AffineTextAttributes } from '../../types/index.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type InlineDeltaMatcher, type TextBuffer } from '../type.js';
import { type ASTToDeltaMatcher, DeltaASTConverter, type InlineDeltaMatcher, type TextBuffer } from '../types/adapter.js';
export type InlineDeltaToPlainTextAdapterMatcher = InlineDeltaMatcher<TextBuffer>;

@@ -5,0 +5,0 @@ export declare const InlineDeltaToPlainTextAdapterMatcherIdentifier: import("@blocksuite/global/di").ServiceIdentifier<InlineDeltaToPlainTextAdapterMatcher> & ((variant: import("@blocksuite/global/di").ServiceVariant) => import("@blocksuite/global/di").ServiceIdentifier<InlineDeltaToPlainTextAdapterMatcher>);

import { createIdentifier } from '@blocksuite/global/di';
import { DeltaASTConverter, } from '../type.js';
import { DeltaASTConverter, } from '../types/adapter.js';
export const InlineDeltaToPlainTextAdapterMatcherIdentifier = createIdentifier('InlineDeltaToPlainTextAdapterMatcher');

@@ -4,0 +4,0 @@ export class PlainTextDeltaConverter extends DeltaASTConverter {

import type { Element, Text } from 'hast';
import type { HtmlAST } from '../html-adapter/type.js';
import type { HtmlAST } from '../types/hast.js';
export declare const HastUtils: {

@@ -4,0 +4,0 @@ isElement: (ast: HtmlAST) => ast is Element;

@@ -0,2 +1,4 @@

export * from './fetch.js';
export * from './hast.js';
export * from './text.js';
//# sourceMappingURL=index.d.ts.map

@@ -0,2 +1,4 @@

export * from './fetch.js';
export * from './hast.js';
export * from './text.js';
//# sourceMappingURL=index.js.map
import type { OutDatabaseAllEvents } from './database.js';
import type { LinkToolbarEvents } from './link.js';
import type { DocCreatedEvent, ElementCreationEvent, TelemetryEvent } from './types.js';
import type { DocCreatedEvent, ElementCreationEvent, ElementLockEvent, TelemetryEvent } from './types.js';
export type TelemetryEventMap = OutDatabaseAllEvents & LinkToolbarEvents & {

@@ -10,2 +10,3 @@ DocCreated: DocCreatedEvent;

CanvasElementAdded: ElementCreationEvent;
EdgelessElementLocked: ElementLockEvent;
};

@@ -12,0 +13,0 @@ export interface TelemetryService {

@@ -23,2 +23,8 @@ export type ElementCreationSource = 'shortcut' | 'toolbar:general' | 'toolbar:dnd' | 'canvas:drop' | 'canvas:draw' | 'canvas:dbclick' | 'canvas:paste' | 'context-menu' | 'ai' | 'internal' | 'conversation' | 'manually save';

}
export interface ElementLockEvent extends TelemetryEvent {
page: 'whiteboard editor';
segment: 'element toolbar';
module: 'element toolbar';
control: 'lock' | 'unlock' | 'group-lock';
}
//# sourceMappingURL=types.d.ts.map
{
"name": "@blocksuite/affine-shared",
"version": "0.0.0-canary-20241211001530",
"version": "0.0.0-canary-20241212001527",
"description": "Default BlockSuite editable blocks.",

@@ -22,7 +22,7 @@ "type": "module",

"dependencies": {
"@blocksuite/affine-model": "0.0.0-canary-20241211001530",
"@blocksuite/block-std": "0.0.0-canary-20241211001530",
"@blocksuite/global": "0.0.0-canary-20241211001530",
"@blocksuite/inline": "0.0.0-canary-20241211001530",
"@blocksuite/store": "0.0.0-canary-20241211001530",
"@blocksuite/affine-model": "0.0.0-canary-20241212001527",
"@blocksuite/block-std": "0.0.0-canary-20241212001527",
"@blocksuite/global": "0.0.0-canary-20241212001527",
"@blocksuite/inline": "0.0.0-canary-20241212001527",
"@blocksuite/store": "0.0.0-canary-20241212001527",
"@floating-ui/dom": "^1.6.10",

@@ -29,0 +29,0 @@ "@lit/context": "^1.1.2",

@@ -8,5 +8,5 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';
import type { HtmlAST } from '../types/hast.js';
import type { HtmlDeltaConverter } from './delta-converter.js';
import type { HtmlAST } from './type.js';

@@ -13,0 +13,0 @@ export type BlockHtmlAdapterMatcher = BlockAdapterMatcher<

@@ -10,3 +10,3 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { AffineTextAttributes } from '../../types/index.js';
import type { HtmlAST, InlineHtmlAST } from './type.js';
import type { HtmlAST, InlineHtmlAST } from '../types/hast.js';

@@ -18,4 +18,4 @@ import {

type InlineDeltaMatcher,
} from '../type.js';
import { mergeDeltas } from '../utils.js';
} from '../types/adapter.js';
import { TextUtils } from '../utils/text.js';

@@ -79,5 +79,3 @@ export type InlineDeltaToHtmlAdapterMatcher = InlineDeltaMatcher<InlineHtmlAST>;

type: 'text',
value: delta.attributes?.underline
? `<u>${delta.insert}</u>`
: delta.insert,
value: delta.insert,
};

@@ -127,3 +125,3 @@

return this._spreadAstToDelta(ast, options).reduce((acc, cur) => {
return mergeDeltas(acc, cur);
return TextUtils.mergeDeltas(acc, cur);
}, [] as DeltaInsert<AffineTextAttributes>[]);

@@ -130,0 +128,0 @@ }

@@ -1,14 +0,1 @@

import type { Element, Root, RootContentMap, Text } from 'hast';
export type Html = string;
export type HastUnionType<
K extends keyof RootContentMap,
V extends RootContentMap[K],
> = V;
export type HtmlAST =
| HastUnionType<keyof RootContentMap, RootContentMap[keyof RootContentMap]>
| Root;
export type InlineHtmlAST = Element | Text;

@@ -6,3 +6,2 @@ export {

type Html,
type HtmlAST,
type HtmlASTToDeltaMatcher,

@@ -13,5 +12,3 @@ HtmlASTToDeltaMatcherIdentifier,

InlineDeltaToHtmlAdapterMatcherIdentifier,
type InlineHtmlAST,
} from './html-adapter/index.js';
export { MarkdownDeltaConverter } from './markdown/delta-converter.js';
export {

@@ -28,2 +25,3 @@ BlockMarkdownAdapterExtension,

MarkdownASTToDeltaMatcherIdentifier,
MarkdownDeltaConverter,
} from './markdown/index.js';

@@ -43,14 +41,7 @@ export {

DeltaASTConverter,
type HtmlAST,
type InlineHtmlAST,
isBlockSnapshotNode,
type TextBuffer,
} from './type.js';
export {
createText,
fetchable,
fetchImage,
isNullish,
isText,
mergeDeltas,
toURLSearchParams,
} from './utils.js';
} from './types/index.js';
export * from './utils/index.js';

@@ -8,3 +8,3 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';
import type { MarkdownDeltaConverter } from './delta-converter.js';

@@ -11,0 +11,0 @@ import type { MarkdownAST } from './type.js';

@@ -17,3 +17,3 @@ import type { ExtensionType } from '@blocksuite/block-std';

type InlineDeltaMatcher,
} from '../type.js';
} from '../types/adapter.js';

@@ -20,0 +20,0 @@ export type InlineDeltaToMarkdownAdapterMatcher =

@@ -8,3 +8,3 @@ import type { ExtensionType } from '@blocksuite/block-std';

import type { BlockAdapterMatcher } from '../type.js';
import type { BlockAdapterMatcher } from '../types/adapter.js';

@@ -11,0 +11,0 @@ export type BlockPlainTextAdapterMatcher = BlockAdapterMatcher;

@@ -12,3 +12,3 @@ import type { DeltaInsert } from '@blocksuite/inline';

type TextBuffer,
} from '../type.js';
} from '../types/adapter.js';

@@ -15,0 +15,0 @@ export type InlineDeltaToPlainTextAdapterMatcher =

import type { Element, ElementContent, Text } from 'hast';
import type { HtmlAST } from '../html-adapter/type.js';
import type { HtmlAST } from '../types/hast.js';

@@ -5,0 +5,0 @@ const isElement = (ast: HtmlAST): ast is Element => {

@@ -0,1 +1,3 @@

export * from './fetch.js';
export * from './hast.js';
export * from './text.js';

@@ -8,2 +8,3 @@ import { createIdentifier } from '@blocksuite/global/di';

ElementCreationEvent,
ElementLockEvent,
TelemetryEvent,

@@ -19,2 +20,3 @@ } from './types.js';

CanvasElementAdded: ElementCreationEvent;
EdgelessElementLocked: ElementLockEvent;
};

@@ -21,0 +23,0 @@

@@ -42,1 +42,8 @@ export type ElementCreationSource =

}
export interface ElementLockEvent extends TelemetryEvent {
page: 'whiteboard editor';
segment: 'element toolbar';
module: 'element toolbar';
control: 'lock' | 'unlock' | 'group-lock';
}

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

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

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

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