New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@textbus/core

Package Overview
Dependencies
Maintainers
1
Versions
344
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@textbus/core - npm Package Compare versions

Comparing version 2.0.0-alpha.15 to 2.0.0-alpha.16

README.md

4

bundles/bootstrap.js
import { Injector } from '@tanbo/di';
import { Commander, COMPONENT_LIST, ComponentList, FORMATTER_LIST, FormatterList, History, Keyboard, LifeCycle, OutputRenderer, Query, Renderer, RootComponentRef, TBSelection, Translator } from './foundation/_api';
import { Commander, COMPONENT_LIST, ComponentList, FORMATTER_LIST, FormatterList, History, Keyboard, LifeCycle, OutputRenderer, Query, Renderer, RootComponentRef, Selection, Translator } from './foundation/_api';
import { Starter } from './starter';

@@ -25,3 +25,3 @@ export function bootstrap(config) {

Renderer,
TBSelection,
Selection,
Translator,

@@ -28,0 +28,0 @@ ...staticProviders,

@@ -32,3 +32,3 @@ import { Draft } from 'immer';

export declare function useDynamicShortcut(config: Shortcut): void;
export declare class TBEvent<T, S extends Slot = Slot> {
export declare class Event<T, S extends Slot = Slot> {
target: S;

@@ -62,9 +62,9 @@ data: T;

export interface EventTypes {
onPaste: (event: TBEvent<PasteEventData>) => void;
onInserted: (event: TBEvent<InsertEventData>) => void;
onInsert: (event: TBEvent<InsertEventData>) => void;
onEnter: (event: TBEvent<EnterEventData>) => void;
onDelete: (event: TBEvent<DeleteEventData>) => void;
onSlotRemove: (event: TBEvent<null>) => void;
onContextMenu: (event: TBEvent<null>) => ContextMenuItem[];
onPaste: (event: Event<PasteEventData>) => void;
onInserted: (event: Event<InsertEventData>) => void;
onInsert: (event: Event<InsertEventData>) => void;
onEnter: (event: Event<EnterEventData>) => void;
onDelete: (event: Event<DeleteEventData>) => void;
onSlotRemove: (event: Event<null>) => void;
onContextMenu: (event: Event<null>) => ContextMenuItem[];
onViewChecked: () => void;

@@ -76,9 +76,9 @@ onViewInit: () => void;

export declare function invokeListener(target: ComponentInstance, eventType: 'onViewChecked'): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onDelete', data: TBEvent<DeleteEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onSlotRemove', data: TBEvent<null>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onEnter', data: TBEvent<EnterEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onInsert', data: TBEvent<InsertEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onInserted', data: TBEvent<InsertEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onContextMenu', data: TBEvent<null>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onPaste', data: TBEvent<PasteEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onDelete', data: Event<DeleteEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onSlotRemove', data: Event<null>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onEnter', data: Event<EnterEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onInsert', data: Event<InsertEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onInserted', data: Event<InsertEventData>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onContextMenu', data: Event<null>): void;
export declare function invokeListener(target: ComponentInstance, eventType: 'onPaste', data: Event<PasteEventData>): void;
export declare function onPaste(listener: EventTypes['onPaste']): void;

@@ -85,0 +85,0 @@ export declare function onContextMenu(listener: EventTypes['onContextMenu']): void;

@@ -19,22 +19,3 @@ import { produce } from 'immer';

update(fn) {
let changes;
let inverseChanges;
const newState = produce(state, fn, (p, ip) => {
changes = p;
inverseChanges = ip;
});
state = newState;
stateChangeSubject.next(newState);
marker.markAsDirtied({
path: [],
apply: [{
type: 'apply',
patches: changes
}],
unApply: [{
type: 'apply',
patches: inverseChanges
}]
});
return newState;
return componentInstance.updateState(fn);
},

@@ -72,2 +53,3 @@ onChange: stateChangeSubject.asObservable()

});
return newState;
},

@@ -158,3 +140,3 @@ toJSON() {

let isPreventDefault = false;
export class TBEvent {
export class Event {
constructor(target, data, eventHandle) {

@@ -161,0 +143,0 @@ this.target = target;

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

import { TBRange, TBSelection } from './selection';
import { Range, Selection } from './selection';
import { ComponentInstance, ContentType, Formatter, FormatValue, Slot } from '../model/_api';

@@ -10,7 +10,7 @@ import { NativeRenderer } from './_injection-tokens';

private nativeRenderer;
constructor(selection: TBSelection, nativeRenderer: NativeRenderer);
constructor(selection: Selection, nativeRenderer: NativeRenderer);
extractContentBySchema(source: Slot, schema: ContentType[], startIndex?: number, endIndex?: number): Slot[];
extractSlots(schema: ContentType[], greedy?: boolean): {
slots: Slot<any>[];
range: Nullable<TBRange>;
range: Nullable<Range>;
};

@@ -17,0 +17,0 @@ insert(content: string | ComponentInstance): boolean;

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

import { Injectable } from '@tanbo/di';
import { TBSelection } from './selection';
import { Selection } from './selection';
import { ContentType, FormatType, placeholder, Slot } from '../model/_api';
import { NativeRenderer } from './_injection-tokens';
import { invokeListener, TBEvent } from '../define-component';
import { invokeListener, Event } from '../define-component';
let Commander = class Commander {

@@ -26,3 +26,3 @@ constructor(selection, nativeRenderer) {

let isPreventDefault = true;
const event = new TBEvent(source, {
const event = new Event(source, {
count: endIndex - startIndex,

@@ -148,3 +148,3 @@ index: endIndex

selection.setLocation(result, result.index);
invokeListener(result.parent, 'onInserted', new TBEvent(result, {
invokeListener(result.parent, 'onInserted', new Event(result, {
index: result.index,

@@ -172,3 +172,3 @@ content

let isPreventDefault = true;
const event = new TBEvent(startSlot, {
const event = new Event(startSlot, {
index: this.selection.startOffset

@@ -223,3 +223,3 @@ }, () => {

let isPreventDefault = true;
const event = new TBEvent(slot, {
const event = new Event(slot, {
count: selection.endOffset - selection.startOffset,

@@ -244,3 +244,3 @@ index: selection.endOffset,

if (!endSlot.isEmpty) {
const event = new TBEvent(endSlot, {
const event = new Event(endSlot, {
index: endSlot.length,

@@ -269,3 +269,3 @@ count: endSlot.length - selection.endOffset

let isPreventDefault = true;
const event = new TBEvent(slot, {
const event = new Event(slot, {
count: scope.endIndex - scope.startIndex,

@@ -309,3 +309,3 @@ index: scope.endIndex,

let isPreventDefault = true;
const event = new TBEvent(slot, null, () => {
const event = new Event(slot, null, () => {
isPreventDefault = false;

@@ -349,3 +349,3 @@ });

let isPreventDefault = true;
invokeListener(component, 'onPaste', new TBEvent(slot, {
invokeListener(component, 'onPaste', new Event(slot, {
index: this.selection.startOffset,

@@ -524,3 +524,3 @@ data: pasteSlot,

let isPreventDefault = true;
const event = new TBEvent(target, {
const event = new Event(target, {
index: this.selection.startOffset,

@@ -558,3 +558,3 @@ content

let isPreventDefault = true;
const event = new TBEvent(parentSlot, {
const event = new Event(parentSlot, {
count: 1,

@@ -580,3 +580,3 @@ index: index + 1,

let isPreventDefault = true;
const event = new TBEvent(parentSlot, null, () => {
const event = new Event(parentSlot, null, () => {
isPreventDefault = false;

@@ -616,3 +616,3 @@ });

Injectable(),
__metadata("design:paramtypes", [TBSelection,
__metadata("design:paramtypes", [Selection,
NativeRenderer])

@@ -619,0 +619,0 @@ ], Commander);

@@ -5,3 +5,3 @@ import { Observable } from '@tanbo/stream';

import { Renderer } from './renderer';
import { SelectionPaths, TBSelection } from './selection';
import { SelectionPaths, Selection } from './selection';
import { FormatterList } from './formatter-list';

@@ -27,3 +27,3 @@ import { RootComponentRef } from './_injection-tokens';

private subscription;
constructor(root: RootComponentRef, selection: TBSelection, translator: Translator, renderer: Renderer, formatMap: FormatterList);
constructor(root: RootComponentRef, selection: Selection, translator: Translator, renderer: Renderer, formatMap: FormatterList);
listen(): void;

@@ -30,0 +30,0 @@ forward(): void;

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

import { Renderer } from './renderer';
import { TBSelection } from './selection';
import { Selection } from './selection';
import { FormatterList } from './formatter-list';

@@ -188,3 +188,3 @@ import { RootComponentRef } from './_injection-tokens';

__metadata("design:paramtypes", [RootComponentRef,
TBSelection,
Selection,
Translator,

@@ -191,0 +191,0 @@ Renderer,

import { Shortcut } from '../model/_api';
import { Commander } from './commander';
import { TBSelection } from './selection';
import { Selection } from './selection';
export interface KeymapState {

@@ -14,3 +14,3 @@ ctrlKey: boolean;

private shortcutList;
constructor(commander: Commander, selection: TBSelection);
constructor(commander: Commander, selection: Selection);
execShortcut(keymapState: KeymapState): boolean;

@@ -17,0 +17,0 @@ addShortcut(shortcut: Shortcut): void;

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

import { Commander } from './commander';
import { TBSelection } from './selection';
import { Selection } from './selection';
let Keyboard = class Keyboard {

@@ -54,5 +54,5 @@ constructor(commander, selection) {

__metadata("design:paramtypes", [Commander,
TBSelection])
Selection])
], Keyboard);
export { Keyboard };
//# sourceMappingURL=keyboard.js.map

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

import { TBSelection } from './selection';
import { Selection } from './selection';
import { ComponentInstance, ComponentMethods, Formatter, FormatValue } from '../model/_api';

@@ -15,3 +15,3 @@ import { Component } from '../define-component';

private selection;
constructor(selection: TBSelection);
constructor(selection: Selection);
queryFormat(formatter: Formatter): QueryState<FormatValue>;

@@ -18,0 +18,0 @@ queryComponent<Instance extends ComponentMethods>(comp: Component<ComponentInstance<Instance>>, filter?: (instance: ComponentInstance<Instance>) => boolean): QueryState<ComponentInstance<Instance>>;

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

import { Injectable } from '@tanbo/di';
import { TBSelection } from './selection';
import { Selection } from './selection';
export var QueryStateType;

@@ -149,5 +149,5 @@ (function (QueryStateType) {

Injectable(),
__metadata("design:paramtypes", [TBSelection])
__metadata("design:paramtypes", [Selection])
], Query);
export { Query };
//# sourceMappingURL=query.js.map

@@ -5,3 +5,3 @@ import { Observable } from '@tanbo/stream';

import { RootComponentRef } from './_injection-tokens';
export interface TBRange {
export interface Range {
startSlot: Slot;

@@ -23,3 +23,3 @@ endSlot: Slot;

export interface NativeSelectionConnector {
setSelection(range: TBRange | null): void;
setSelection(range: Range | null): void;
}

@@ -40,3 +40,3 @@ export interface SelectionLocation {

}
export interface TBRangePosition {
export interface RangePosition {
left: number;

@@ -47,4 +47,4 @@ top: number;

abstract connect(connector: NativeSelectionConnector): void;
abstract restore(range: TBRange | null): void;
abstract getRect(location: SelectionLocation): TBRangePosition | null;
abstract restore(range: Range | null): void;
abstract getRect(location: SelectionLocation): RangePosition | null;
}

@@ -55,10 +55,10 @@ export interface SelectionPaths {

}
export interface TBSelectionMiddleware {
export interface SelectionMiddleware {
getSelectedScopes(currentSelectedScope: SelectedScope[]): SelectedScope[];
}
export declare class TBSelection {
export declare class Selection {
private bridge;
private root;
private renderer;
onChange: Observable<TBRange | null>;
onChange: Observable<Range | null>;
get isSelected(): boolean;

@@ -96,3 +96,3 @@ get isCollapsed(): boolean;

selectAll(): void;
addMiddleware(middleware: TBSelectionMiddleware): void;
addMiddleware(middleware: SelectionMiddleware): void;
/**

@@ -99,0 +99,0 @@ * 获取下一个选区位置。

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

};
var TBSelection_1;
var Selection_1;
import { Injectable } from '@tanbo/di';

@@ -19,3 +19,3 @@ import { distinctUntilChanged, Subject } from '@tanbo/stream';

}
let TBSelection = TBSelection_1 = class TBSelection {
let Selection = Selection_1 = class Selection {
constructor(bridge, root, renderer) {

@@ -296,5 +296,5 @@ this.bridge = bridge;

}
const start = TBSelection_1.getPathsBySlot(this.startSlot);
const start = Selection_1.getPathsBySlot(this.startSlot);
start.push(this.startOffset);
const end = TBSelection_1.getPathsBySlot(this.endSlot);
const end = Selection_1.getPathsBySlot(this.endSlot);
end.push(this.endOffset);

@@ -349,3 +349,3 @@ return {

findSlotByPaths(paths) {
const result = TBSelection_1.findTreeNode(paths, this.root.component);
const result = Selection_1.findTreeNode(paths, this.root.component);
if (result instanceof Slot) {

@@ -357,3 +357,3 @@ return result;

findComponentByPath(paths) {
const result = TBSelection_1.findTreeNode(paths, this.root.component);
const result = Selection_1.findTreeNode(paths, this.root.component);
if (result instanceof Slot) {

@@ -455,3 +455,3 @@ return null;

}
return this.getScopes(this.startSlot, this.endSlot, TBSelection_1.findExpandedStartIndex(this.startSlot, this.startOffset), TBSelection_1.findExpandedEndIndex(this.endSlot, this.endOffset));
return this.getScopes(this.startSlot, this.endSlot, Selection_1.findExpandedStartIndex(this.startSlot, this.startOffset), Selection_1.findExpandedEndIndex(this.endSlot, this.endOffset));
}

@@ -868,3 +868,3 @@ findFirstLocation(slot) {

}
return TBSelection_1.findTreeNode(paths, component);
return Selection_1.findTreeNode(paths, component);
}

@@ -914,3 +914,3 @@ static getPathsBySlot(slot) {

};
TBSelection = TBSelection_1 = __decorate([
Selection = Selection_1 = __decorate([
Injectable(),

@@ -920,4 +920,4 @@ __metadata("design:paramtypes", [NativeSelectionBridge,

Renderer])
], TBSelection);
export { TBSelection };
], Selection);
export { Selection };
//# sourceMappingURL=selection.js.map

@@ -42,4 +42,4 @@ import { Draft } from 'immer';

shortcutList: Shortcut[];
updateState(fn: (draft: Draft<State>) => void): void;
updateState(fn: (draft: Draft<State>) => void): State;
toJSON(): ComponentLiteral<State>;
}
{
"name": "@textbus/core",
"version": "2.0.0-alpha.15",
"version": "2.0.0-alpha.16",
"description": "TextBus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",

@@ -43,3 +43,3 @@ "main": "./bundles/public-api.js",

},
"gitHead": "4ddca932fa414c3a04d7cf232295fd4f69c5fef2"
"gitHead": "017224d3cf123a0e5508fdd05e16d4d32025f0d1"
}

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