@blocksuite/block-std
Advanced tools
Comparing version 0.0.0-canary-20241024001413 to 0.0.0-canary-20241025001424
# @blocksuite/block-std | ||
## 0.0.0-canary-20241024001413 | ||
## 0.0.0-canary-20241025001424 | ||
@@ -9,6 +9,54 @@ ### Patch Changes | ||
- Updated dependencies | ||
- @blocksuite/global@0.0.0-canary-20241024001413 | ||
- @blocksuite/inline@0.0.0-canary-20241024001413 | ||
- @blocksuite/store@0.0.0-canary-20241024001413 | ||
- @blocksuite/global@0.0.0-canary-20241025001424 | ||
- @blocksuite/inline@0.0.0-canary-20241025001424 | ||
- @blocksuite/store@0.0.0-canary-20241025001424 | ||
## 0.17.20 | ||
### Patch Changes | ||
- 99d69d5: ## Feat | ||
- feat(blocks): add more html transformer apis (#8573) | ||
- feat(blocks): support more markdown transformer api (#8564) | ||
- feat(blocks): add abort controller to peekviewservice (#8558) | ||
- feat: add docLinkMiddleware for linked doc export (#8553) | ||
## Fix | ||
- fix: mind map dragging issue (#8563) | ||
- fix(database): can't use horizontal scrollbar (#8576) | ||
- fix: note width is less than minimum width after resize and arrange (#8550) | ||
- fix: newly created note alignments cannot be stored persistently (#8551) | ||
- fix: inline range calculation not expected (#8552) | ||
- fix(database): avoid filter bar flickering (#8562) | ||
- fix(database): drag and drop block into database block (#8561) | ||
- fix(blocks): split paragraphs based on newlines (#8556) | ||
- fix(database): incorrect delete row logic (#8544) | ||
- fix: note height less than minimum height (#8542) | ||
## Chore | ||
- chore: add changelog generating script (#8582) | ||
- chore: optimize zip transformer api (#8580) | ||
- chore: adjust attachment click events, like image, to support opening in peek view (#8579) | ||
- chore: remove useless import (#8571) | ||
## Refactor | ||
- refactor: convert built-in component to widget (#8577) | ||
- refactor: migrating legacy tools (#8471) | ||
- refactor: edgeless tool manager (#8438) | ||
- refactor(playground): organize export and import menu items into submenus in the debug menu (#8557) | ||
- refactor: combine unsafeCSS and cssVar (#8545) | ||
## Perf | ||
- perf(edgeless): use css var to place collaboration cursors-n-selections on board zoom change (#8543) | ||
- Updated dependencies [99d69d5] | ||
- @blocksuite/global@0.17.20 | ||
- @blocksuite/inline@0.17.20 | ||
- @blocksuite/store@0.17.20 | ||
## 0.17.19 | ||
@@ -15,0 +63,0 @@ |
import type { UIEventDispatcher } from '../dispatcher.js'; | ||
export declare class PointerControl { | ||
private controllers; | ||
constructor(_dispatcher: UIEventDispatcher); | ||
constructor(dispatcher: UIEventDispatcher); | ||
listen(): void; | ||
} | ||
//# sourceMappingURL=pointer.d.ts.map |
import { IS_IPAD } from '@blocksuite/global/env'; | ||
import { UIEventState, UIEventStateContext } from '../base.js'; | ||
import { MultiPointerEventState, PointerEventState } from '../state/index.js'; | ||
import { DndEventState, MultiPointerEventState, PointerEventState, } from '../state/index.js'; | ||
import { EventScopeSourceType, EventSourceState } from '../state/source.js'; | ||
@@ -140,2 +140,4 @@ import { center, isFarEnough } from '../utils.js'; | ||
this._down = (event) => { | ||
if (this._nativeDragging) | ||
return; | ||
if (!event.isPrimary) { | ||
@@ -175,3 +177,5 @@ if (this._dragging && this._lastPointerState) { | ||
this._lastPointerState = state; | ||
if (!this._dragging && isFarEnough(event, this._startPointerState.raw)) { | ||
if (!this._nativeDragging && | ||
!this._dragging && | ||
isFarEnough(event, this._startPointerState.raw)) { | ||
this._dragging = true; | ||
@@ -184,2 +188,23 @@ this._dispatcher.run('dragStart', createContext(event, start)); | ||
}; | ||
this._nativeDragEnd = (event) => { | ||
this._nativeDragging = false; | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run('nativeDragEnd', this._createContext(event, dndEventState)); | ||
}; | ||
this._nativeDragging = false; | ||
this._nativeDragMove = (event) => { | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run('nativeDragMove', this._createContext(event, dndEventState)); | ||
}; | ||
this._nativeDragStart = (event) => { | ||
this._reset(); | ||
this._nativeDragging = true; | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run('nativeDragStart', this._createContext(event, dndEventState)); | ||
}; | ||
this._nativeDrop = (event) => { | ||
this._reset(); | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run('nativeDrop', this._createContext(event, dndEventState)); | ||
}; | ||
this._reset = () => { | ||
@@ -225,2 +250,8 @@ this._dragging = false; | ||
} | ||
_createContext(event, dndState) { | ||
return UIEventStateContext.from(new UIEventState(event), new EventSourceState({ | ||
event, | ||
sourceType: EventScopeSourceType.Target, | ||
}), dndState); | ||
} | ||
listen() { | ||
@@ -230,2 +261,6 @@ const { host, disposables } = this._dispatcher; | ||
this._applyScribblePatch(); | ||
disposables.addFromEvent(host, 'dragstart', this._nativeDragStart); | ||
disposables.addFromEvent(host, 'dragend', this._nativeDragEnd); | ||
disposables.addFromEvent(host, 'drag', this._nativeDragMove); | ||
disposables.addFromEvent(host, 'drop', this._nativeDrop); | ||
} | ||
@@ -363,9 +398,9 @@ } | ||
export class PointerControl { | ||
constructor(_dispatcher) { | ||
constructor(dispatcher) { | ||
this.controllers = [ | ||
new PointerEventForward(_dispatcher), | ||
new ClickController(_dispatcher), | ||
new DragController(_dispatcher), | ||
new PanController(_dispatcher), | ||
new PinchController(_dispatcher), | ||
new PointerEventForward(dispatcher), | ||
new ClickController(dispatcher), | ||
new DragController(dispatcher), | ||
new PanController(dispatcher), | ||
new PinchController(dispatcher), | ||
]; | ||
@@ -372,0 +407,0 @@ } |
@@ -111,8 +111,9 @@ import { UIEventState, UIEventStateContext } from '../base.js'; | ||
listen() { | ||
this._dispatcher.disposables.addFromEvent(document, 'selectionchange', this._selectionChange); | ||
this._dispatcher.disposables.addFromEvent(this._dispatcher.host, 'compositionstart', this._compositionStart); | ||
this._dispatcher.disposables.addFromEvent(this._dispatcher.host, 'compositionend', this._compositionEnd); | ||
this._dispatcher.disposables.addFromEvent(this._dispatcher.host, 'compositionupdate', this._compositionUpdate); | ||
const { host, disposables } = this._dispatcher; | ||
disposables.addFromEvent(document, 'selectionchange', this._selectionChange); | ||
disposables.addFromEvent(host, 'compositionstart', this._compositionStart); | ||
disposables.addFromEvent(host, 'compositionend', this._compositionEnd); | ||
disposables.addFromEvent(host, 'compositionupdate', this._compositionUpdate); | ||
} | ||
} | ||
//# sourceMappingURL=range.js.map |
@@ -5,3 +5,3 @@ import { DisposableGroup } from '@blocksuite/global/utils'; | ||
import { type UIEventHandler, UIEventStateContext } from './base.js'; | ||
declare const eventNames: readonly ["click", "doubleClick", "tripleClick", "pointerDown", "pointerMove", "pointerUp", "pointerOut", "dragStart", "dragMove", "dragEnd", "pinch", "pan", "keyDown", "keyUp", "selectionChange", "compositionStart", "compositionUpdate", "compositionEnd", "cut", "copy", "paste", "beforeInput", "blur", "focus", "drop", "contextMenu", "wheel"]; | ||
declare const eventNames: readonly ["click", "doubleClick", "tripleClick", "pointerDown", "pointerMove", "pointerUp", "pointerOut", "dragStart", "dragMove", "dragEnd", "pinch", "pan", "keyDown", "keyUp", "selectionChange", "compositionStart", "compositionUpdate", "compositionEnd", "cut", "copy", "paste", "nativeDragStart", "nativeDragMove", "nativeDragEnd", "nativeDrop", "beforeInput", "blur", "focus", "contextMenu", "wheel"]; | ||
export type EventName = (typeof eventNames)[number]; | ||
@@ -8,0 +8,0 @@ export type EventOptions = { |
@@ -17,3 +17,2 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; | ||
'focus', | ||
'drop', | ||
'contextMenu', | ||
@@ -44,2 +43,6 @@ 'wheel', | ||
'paste', | ||
'nativeDragStart', | ||
'nativeDragMove', | ||
'nativeDragEnd', | ||
'nativeDrop', | ||
...bypassEventNames, | ||
@@ -46,0 +49,0 @@ ]; |
export * from './clipboard.js'; | ||
export * from './dnd.js'; | ||
export * from './keyboard.js'; | ||
@@ -3,0 +4,0 @@ export * from './pointer.js'; |
export * from './clipboard.js'; | ||
export * from './dnd.js'; | ||
export * from './keyboard.js'; | ||
@@ -3,0 +4,0 @@ export * from './pointer.js'; |
@@ -15,2 +15,3 @@ import { LitElement } from 'lit'; | ||
private _pendingChildrenUpdates; | ||
accessor viewport: Viewport; | ||
private _refreshViewport; | ||
@@ -27,5 +28,4 @@ private _updatingChildrenFlag; | ||
accessor maxConcurrentRenders: number; | ||
accessor viewport: Viewport; | ||
} | ||
export {}; | ||
//# sourceMappingURL=viewport-element.d.ts.map |
@@ -66,2 +66,5 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { | ||
let _classSuper = WithDisposable(LitElement); | ||
let _viewport_decorators; | ||
let _viewport_initializers = []; | ||
let _viewport_extraInitializers = []; | ||
let _container_decorators; | ||
@@ -79,5 +82,2 @@ let _container_initializers = []; | ||
let _maxConcurrentRenders_extraInitializers = []; | ||
let _viewport_decorators; | ||
let _viewport_initializers = []; | ||
let _viewport_extraInitializers = []; | ||
var GfxViewportElement = class extends _classSuper { | ||
@@ -87,2 +87,3 @@ static { _classThis = this; } | ||
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; | ||
_viewport_decorators = [property({ attribute: false })]; | ||
_container_decorators = [query('.gfx-viewport')]; | ||
@@ -92,3 +93,3 @@ _getModelsInViewport_decorators = [property({ attribute: false })]; | ||
_maxConcurrentRenders_decorators = [property({ type: Number })]; | ||
_viewport_decorators = [property({ attribute: false })]; | ||
__esDecorate(this, null, _viewport_decorators, { kind: "accessor", name: "viewport", static: false, private: false, access: { has: obj => "viewport" in obj, get: obj => obj.viewport, set: (obj, value) => { obj.viewport = value; } }, metadata: _metadata }, _viewport_initializers, _viewport_extraInitializers); | ||
__esDecorate(this, null, _container_decorators, { kind: "accessor", name: "container", static: false, private: false, access: { has: obj => "container" in obj, get: obj => obj.container, set: (obj, value) => { obj.container = value; } }, metadata: _metadata }, _container_initializers, _container_extraInitializers); | ||
@@ -98,3 +99,2 @@ __esDecorate(this, null, _getModelsInViewport_decorators, { kind: "accessor", name: "getModelsInViewport", static: false, private: false, access: { has: obj => "getModelsInViewport" in obj, get: obj => obj.getModelsInViewport, set: (obj, value) => { obj.getModelsInViewport = value; } }, metadata: _metadata }, _getModelsInViewport_initializers, _getModelsInViewport_extraInitializers); | ||
__esDecorate(this, null, _maxConcurrentRenders_decorators, { kind: "accessor", name: "maxConcurrentRenders", static: false, private: false, access: { has: obj => "maxConcurrentRenders" in obj, get: obj => obj.maxConcurrentRenders, set: (obj, value) => { obj.maxConcurrentRenders = value; } }, metadata: _metadata }, _maxConcurrentRenders_initializers, _maxConcurrentRenders_extraInitializers); | ||
__esDecorate(this, null, _viewport_decorators, { kind: "accessor", name: "viewport", static: false, private: false, access: { has: obj => "viewport" in obj, get: obj => obj.viewport, set: (obj, value) => { obj.viewport = value; } }, metadata: _metadata }, _viewport_initializers, _viewport_extraInitializers); | ||
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers); | ||
@@ -113,2 +113,5 @@ GfxViewportElement = _classThis = _classDescriptor.value; | ||
`; } | ||
#viewport_accessor_storage; | ||
get viewport() { return this.#viewport_accessor_storage; } | ||
set viewport(value) { this.#viewport_accessor_storage = value; } | ||
_toCSSTransform(translateX, translateY, zoom) { | ||
@@ -169,5 +172,2 @@ return `translate3d(${translateX}px, ${translateY}px, 0) scale(${zoom})`; | ||
set maxConcurrentRenders(value) { this.#maxConcurrentRenders_accessor_storage = value; } | ||
#viewport_accessor_storage; | ||
get viewport() { return this.#viewport_accessor_storage; } | ||
set viewport(value) { this.#viewport_accessor_storage = value; } | ||
constructor() { | ||
@@ -198,3 +198,4 @@ super(...arguments); | ||
this._pendingChildrenUpdates = []; | ||
this._refreshViewport = requestThrottledConnectedFrame(() => { | ||
this.#viewport_accessor_storage = __runInitializers(this, _viewport_initializers, void 0); | ||
this._refreshViewport = (__runInitializers(this, _viewport_extraInitializers), requestThrottledConnectedFrame(() => { | ||
const { translateX, translateY, zoom } = this.viewport; | ||
@@ -204,3 +205,3 @@ if (this.container) { | ||
} | ||
}, this); | ||
}, this)); | ||
this._updatingChildrenFlag = false; | ||
@@ -212,4 +213,3 @@ this.renderingBlocks = new Set(); | ||
this.#maxConcurrentRenders_accessor_storage = (__runInitializers(this, _host_extraInitializers), __runInitializers(this, _maxConcurrentRenders_initializers, 2)); | ||
this.#viewport_accessor_storage = (__runInitializers(this, _maxConcurrentRenders_extraInitializers), __runInitializers(this, _viewport_initializers, void 0)); | ||
__runInitializers(this, _viewport_extraInitializers); | ||
__runInitializers(this, _maxConcurrentRenders_extraInitializers); | ||
} | ||
@@ -216,0 +216,0 @@ static { |
@@ -12,2 +12,3 @@ import { Doc } from '@blocksuite/store'; | ||
export declare class BlockComponent<Model extends BlockModel = BlockModel, Service extends BlockService = BlockService, WidgetName extends string = string> extends BlockComponent_base { | ||
accessor std: BlockStdScope; | ||
private _selected; | ||
@@ -56,3 +57,2 @@ [blockComponentSymbol]: boolean; | ||
accessor doc: Doc; | ||
accessor std: BlockStdScope; | ||
accessor viewType: BlockViewType; | ||
@@ -59,0 +59,0 @@ accessor widgets: Record<WidgetName, TemplateResult>; |
@@ -61,2 +61,5 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { | ||
let _classSuper = SignalWatcher(WithDisposable(ShadowlessElement)); | ||
let _std_decorators; | ||
let _std_initializers = []; | ||
let _std_extraInitializers = []; | ||
let __model_decorators; | ||
@@ -74,5 +77,2 @@ let __model_initializers = []; | ||
let _doc_extraInitializers = []; | ||
let _std_decorators; | ||
let _std_initializers = []; | ||
let _std_extraInitializers = []; | ||
let _viewType_decorators; | ||
@@ -86,3 +86,3 @@ let _viewType_initializers = []; | ||
static { _classThis = this; } | ||
static { _a = blockComponentSymbol; } | ||
static { _a = (_std_decorators = [consume({ context: stdContext })], blockComponentSymbol); } | ||
static { | ||
@@ -94,3 +94,2 @@ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0; | ||
_doc_decorators = [consume({ context: docContext })]; | ||
_std_decorators = [consume({ context: stdContext })]; | ||
_viewType_decorators = [property({ attribute: false })]; | ||
@@ -110,2 +109,3 @@ _widgets_decorators = [property({ | ||
})]; | ||
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers); | ||
__esDecorate(this, null, __model_decorators, { kind: "accessor", name: "_model", static: false, private: false, access: { has: obj => "_model" in obj, get: obj => obj._model, set: (obj, value) => { obj._model = value; } }, metadata: _metadata }, __model_initializers, __model_extraInitializers); | ||
@@ -115,3 +115,2 @@ __esDecorate(this, null, __renderers_decorators, { kind: "accessor", name: "_renderers", static: false, private: false, access: { has: obj => "_renderers" in obj, get: obj => obj._renderers, set: (obj, value) => { obj._renderers = value; } }, metadata: _metadata }, __renderers_initializers, __renderers_extraInitializers); | ||
__esDecorate(this, null, _doc_decorators, { kind: "accessor", name: "doc", static: false, private: false, access: { has: obj => "doc" in obj, get: obj => obj.doc, set: (obj, value) => { obj.doc = value; } }, metadata: _metadata }, _doc_initializers, _doc_extraInitializers); | ||
__esDecorate(this, null, _std_decorators, { kind: "accessor", name: "std", static: false, private: false, access: { has: obj => "std" in obj, get: obj => obj.std, set: (obj, value) => { obj.std = value; } }, metadata: _metadata }, _std_initializers, _std_extraInitializers); | ||
__esDecorate(this, null, _viewType_decorators, { kind: "accessor", name: "viewType", static: false, private: false, access: { has: obj => "viewType" in obj, get: obj => obj.viewType, set: (obj, value) => { obj.viewType = value; } }, metadata: _metadata }, _viewType_initializers, _viewType_extraInitializers); | ||
@@ -124,2 +123,5 @@ __esDecorate(this, null, _widgets_decorators, { kind: "accessor", name: "widgets", static: false, private: false, access: { has: obj => "widgets" in obj, get: obj => obj.widgets, set: (obj, value) => { obj.widgets = value; } }, metadata: _metadata }, _widgets_initializers, _widgets_extraInitializers); | ||
} | ||
#std_accessor_storage; | ||
get std() { return this.#std_accessor_storage; } | ||
set std(value) { this.#std_accessor_storage = value; } | ||
get blockId() { | ||
@@ -308,5 +310,2 @@ return this.dataset.blockId; | ||
set doc(value) { this.#doc_accessor_storage = value; } | ||
#std_accessor_storage; | ||
get std() { return this.#std_accessor_storage; } | ||
set std(value) { this.#std_accessor_storage = value; } | ||
#viewType_accessor_storage; | ||
@@ -320,3 +319,4 @@ get viewType() { return this.#viewType_accessor_storage; } | ||
super(...arguments); | ||
this._selected = computed(() => { | ||
this.#std_accessor_storage = __runInitializers(this, _std_initializers, void 0); | ||
this._selected = (__runInitializers(this, _std_extraInitializers), computed(() => { | ||
const selection = this.std.selection.value.find(selection => { | ||
@@ -329,3 +329,3 @@ return selection.blockId === this.model?.id; | ||
return selection; | ||
}); | ||
})); | ||
this[_a] = true; | ||
@@ -350,4 +350,3 @@ this.handleEvent = (name, handler, options) => { | ||
this.#doc_accessor_storage = (__runInitializers(this, __service_extraInitializers), __runInitializers(this, _doc_initializers, void 0)); | ||
this.#std_accessor_storage = (__runInitializers(this, _doc_extraInitializers), __runInitializers(this, _std_initializers, void 0)); | ||
this.#viewType_accessor_storage = (__runInitializers(this, _std_extraInitializers), __runInitializers(this, _viewType_initializers, BlockViewType.Display)); | ||
this.#viewType_accessor_storage = (__runInitializers(this, _doc_extraInitializers), __runInitializers(this, _viewType_initializers, BlockViewType.Display)); | ||
this.#widgets_accessor_storage = (__runInitializers(this, _viewType_extraInitializers), __runInitializers(this, _widgets_initializers, void 0)); | ||
@@ -354,0 +353,0 @@ __runInitializers(this, _widgets_extraInitializers); |
{ | ||
"name": "@blocksuite/block-std", | ||
"version": "0.0.0-canary-20241024001413", | ||
"version": "0.0.0-canary-20241025001424", | ||
"description": "Std for blocksuite blocks", | ||
@@ -23,5 +23,5 @@ "type": "module", | ||
"dependencies": { | ||
"@blocksuite/global": "0.0.0-canary-20241024001413", | ||
"@blocksuite/inline": "0.0.0-canary-20241024001413", | ||
"@blocksuite/store": "0.0.0-canary-20241024001413", | ||
"@blocksuite/global": "0.0.0-canary-20241025001424", | ||
"@blocksuite/inline": "0.0.0-canary-20241025001424", | ||
"@blocksuite/store": "0.0.0-canary-20241025001424", | ||
"@lit/context": "^1.1.2", | ||
@@ -28,0 +28,0 @@ "@preact/signals-core": "^1.8.0", |
@@ -6,3 +6,7 @@ import { IS_IPAD } from '@blocksuite/global/env'; | ||
import { UIEventState, UIEventStateContext } from '../base.js'; | ||
import { MultiPointerEventState, PointerEventState } from '../state/index.js'; | ||
import { | ||
DndEventState, | ||
MultiPointerEventState, | ||
PointerEventState, | ||
} from '../state/index.js'; | ||
import { EventScopeSourceType, EventSourceState } from '../state/source.js'; | ||
@@ -177,2 +181,4 @@ import { center, isFarEnough } from '../utils.js'; | ||
private _down = (event: PointerEvent) => { | ||
if (this._nativeDragging) return; | ||
if (!event.isPrimary) { | ||
@@ -227,3 +233,7 @@ if (this._dragging && this._lastPointerState) { | ||
if (!this._dragging && isFarEnough(event, this._startPointerState.raw)) { | ||
if ( | ||
!this._nativeDragging && | ||
!this._dragging && | ||
isFarEnough(event, this._startPointerState.raw) | ||
) { | ||
this._dragging = true; | ||
@@ -238,2 +248,40 @@ this._dispatcher.run('dragStart', createContext(event, start)); | ||
private _nativeDragEnd = (event: DragEvent) => { | ||
this._nativeDragging = false; | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run( | ||
'nativeDragEnd', | ||
this._createContext(event, dndEventState) | ||
); | ||
}; | ||
private _nativeDragging = false; | ||
private _nativeDragMove = (event: DragEvent) => { | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run( | ||
'nativeDragMove', | ||
this._createContext(event, dndEventState) | ||
); | ||
}; | ||
private _nativeDragStart = (event: DragEvent) => { | ||
this._reset(); | ||
this._nativeDragging = true; | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run( | ||
'nativeDragStart', | ||
this._createContext(event, dndEventState) | ||
); | ||
}; | ||
private _nativeDrop = (event: DragEvent) => { | ||
this._reset(); | ||
const dndEventState = new DndEventState({ event }); | ||
this._dispatcher.run( | ||
'nativeDrop', | ||
this._createContext(event, dndEventState) | ||
); | ||
}; | ||
private _reset = () => { | ||
@@ -291,2 +339,13 @@ this._dragging = false; | ||
private _createContext(event: Event, dndState: DndEventState) { | ||
return UIEventStateContext.from( | ||
new UIEventState(event), | ||
new EventSourceState({ | ||
event, | ||
sourceType: EventScopeSourceType.Target, | ||
}), | ||
dndState | ||
); | ||
} | ||
listen() { | ||
@@ -296,2 +355,7 @@ const { host, disposables } = this._dispatcher; | ||
this._applyScribblePatch(); | ||
disposables.addFromEvent(host, 'dragstart', this._nativeDragStart); | ||
disposables.addFromEvent(host, 'dragend', this._nativeDragEnd); | ||
disposables.addFromEvent(host, 'drag', this._nativeDragMove); | ||
disposables.addFromEvent(host, 'drop', this._nativeDrop); | ||
} | ||
@@ -475,9 +539,9 @@ } | ||
constructor(_dispatcher: UIEventDispatcher) { | ||
constructor(dispatcher: UIEventDispatcher) { | ||
this.controllers = [ | ||
new PointerEventForward(_dispatcher), | ||
new ClickController(_dispatcher), | ||
new DragController(_dispatcher), | ||
new PanController(_dispatcher), | ||
new PinchController(_dispatcher), | ||
new PointerEventForward(dispatcher), | ||
new ClickController(dispatcher), | ||
new DragController(dispatcher), | ||
new PanController(dispatcher), | ||
new PinchController(dispatcher), | ||
]; | ||
@@ -484,0 +548,0 @@ } |
@@ -142,3 +142,4 @@ import type { BlockComponent } from '../../view/index.js'; | ||
listen() { | ||
this._dispatcher.disposables.addFromEvent( | ||
const { host, disposables } = this._dispatcher; | ||
disposables.addFromEvent( | ||
document, | ||
@@ -148,14 +149,6 @@ 'selectionchange', | ||
); | ||
this._dispatcher.disposables.addFromEvent( | ||
this._dispatcher.host, | ||
'compositionstart', | ||
this._compositionStart | ||
); | ||
this._dispatcher.disposables.addFromEvent( | ||
this._dispatcher.host, | ||
'compositionend', | ||
this._compositionEnd | ||
); | ||
this._dispatcher.disposables.addFromEvent( | ||
this._dispatcher.host, | ||
disposables.addFromEvent(host, 'compositionstart', this._compositionStart); | ||
disposables.addFromEvent(host, 'compositionend', this._compositionEnd); | ||
disposables.addFromEvent( | ||
host, | ||
'compositionupdate', | ||
@@ -162,0 +155,0 @@ this._compositionUpdate |
@@ -24,3 +24,2 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; | ||
'focus', | ||
'drop', | ||
'contextMenu', | ||
@@ -59,2 +58,7 @@ 'wheel', | ||
'nativeDragStart', | ||
'nativeDragMove', | ||
'nativeDragEnd', | ||
'nativeDrop', | ||
...bypassEventNames, | ||
@@ -61,0 +65,0 @@ ] as const; |
export * from './clipboard.js'; | ||
export * from './dnd.js'; | ||
export * from './keyboard.js'; | ||
export * from './pointer.js'; | ||
export * from './source.js'; |
@@ -85,2 +85,5 @@ import { WithDisposable } from '@blocksuite/global/utils'; | ||
@property({ attribute: false }) | ||
accessor viewport!: Viewport; | ||
private _refreshViewport = requestThrottledConnectedFrame(() => { | ||
@@ -178,5 +181,2 @@ const { translateX, translateY, zoom } = this.viewport; | ||
accessor maxConcurrentRenders: number = 2; | ||
@property({ attribute: false }) | ||
accessor viewport!: Viewport; | ||
} |
@@ -37,2 +37,5 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions'; | ||
> extends SignalWatcher(WithDisposable(ShadowlessElement)) { | ||
@consume({ context: stdContext }) | ||
accessor std!: BlockStdScope; | ||
private _selected = computed(() => { | ||
@@ -312,5 +315,2 @@ const selection = this.std.selection.value.find(selection => { | ||
@consume({ context: stdContext }) | ||
accessor std!: BlockStdScope; | ||
@property({ attribute: false }) | ||
@@ -317,0 +317,0 @@ accessor viewType: BlockViewType = BlockViewType.Display; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1371819
482
19951
+ Added@blocksuite/global@0.0.0-canary-20241025001424(transitive)
+ Added@blocksuite/inline@0.0.0-canary-20241025001424(transitive)
+ Added@blocksuite/store@0.0.0-canary-20241025001424(transitive)
+ Added@blocksuite/sync@0.0.0-canary-20241025001424(transitive)
- Removed@blocksuite/global@0.0.0-canary-20241024001413(transitive)
- Removed@blocksuite/inline@0.0.0-canary-20241024001413(transitive)
- Removed@blocksuite/store@0.0.0-canary-20241024001413(transitive)
- Removed@blocksuite/sync@0.0.0-canary-20241024001413(transitive)