@ng-dnd/core
Version:
Drag and Drop for Angular
1 lines • 64.8 kB
Source Map (JSON)
{"version":3,"file":"ng-dnd-core.mjs","sources":["../../src/internal/invariant.ts","../../src/dnd-directives.ts","../../src/tokens.ts","../../src/dnd-module.ts","../../src/utils/shallowEqual.ts","../../src/utils/areOptionsEqual.ts","../../src/internal/Reconnector.ts","../../src/internal/createTargetConnector.ts","../../src/internal/register-target.ts","../../src/internal/createSourceConnector.ts","../../src/internal/register-source.ts","../../src/utils/areCollectsEqual.ts","../../src/internal/connection-factory.ts","../../src/internal/drag-layer-connection.ts","../../src/internal/createSourceFactory.ts","../../src/internal/createSourceMonitor.ts","../../src/internal/createTargetFactory.ts","../../src/internal/createTargetMonitor.ts","../../src/connector.ts","../../public-api.ts","../../ng-dnd-core.ts"],"sourcesContent":["export function invariant(assertion: boolean, msg: string) {\n if (!assertion) {\n throw new Error(msg);\n }\n}\n","import { Directive, ElementRef, inject, Input, NgZone, OnChanges, OnDestroy } from '@angular/core';\nimport { Identifier } from 'dnd-core';\n\nimport { invariant } from './internal/invariant';\n\nimport { Subscription } from 'rxjs';\nimport { DragSource, DropTarget } from './connection-types';\nimport { DragPreviewOptions, DragSourceOptions } from './connectors';\nimport { TypeOrTypeArray } from './type-ish';\n\n/** @ignore */\nconst explanation =\n 'You can only pass exactly one connection object to [dropTarget]. ' +\n 'There is only one of each source/target/preview allowed per DOM element.';\n\n/** @ignore */\n@Directive()\nexport class AbstractDndDirective implements OnChanges, OnDestroy {\n protected connection: any;\n private deferredRequest = new Subscription();\n protected elRef = inject(ElementRef);\n private ngZone = inject(NgZone);\n\n ngOnChanges() {\n invariant(typeof this.connection === 'object' && !Array.isArray(this.connection), explanation);\n this.ngZone.runOutsideAngular(() => {\n // discard an unresolved connection request\n // in the case where the previous one succeeded, deferredRequest is\n // already closed.\n this.deferredRequest.unsubscribe();\n // replace it with a new one\n if (this.connection) {\n this.deferredRequest = this.callHooks(this.connection);\n }\n });\n }\n\n ngOnDestroy() {\n this.deferredRequest.unsubscribe();\n }\n\n protected callHooks(_conn: any) {\n return new Subscription();\n }\n}\n\n/**\n * Allows you to connect a {@link DropTarget} to an element in a component template.\n */\n@Directive({\n selector: '[dropTarget]',\n})\nexport class DropTargetDirective extends AbstractDndDirective implements OnChanges {\n protected connection: DropTarget | undefined;\n\n /** Which target to connect the DOM to */\n @Input('dropTarget') dropTarget!: DropTarget;\n /**\n * Shortcut for setting a type on the connection.\n * Lets you use Angular binding to do it. Runs {@link DropTarget#setTypes}.\n */\n @Input('dropTargetTypes') dropTargetTypes?: TypeOrTypeArray;\n /** Reduce typo confusion by allowing non-plural version of dropTargetTypes */\n @Input('dropTargetType') set dropTargetType(t: TypeOrTypeArray) {\n this.dropTargetTypes = t;\n }\n\n ngOnChanges() {\n this.connection = this.dropTarget;\n if (this.connection && this.dropTargetTypes != null) {\n this.connection.setTypes(this.dropTargetTypes);\n }\n super.ngOnChanges();\n }\n\n protected callHooks(conn: DropTarget) {\n return conn.connectDropTarget(this.elRef.nativeElement);\n }\n}\n\n/** Allows you to connect a {@link DragSource} to an element in a component template. */\n@Directive({\n selector: '[dragSource]',\n})\nexport class DragSourceDirective extends AbstractDndDirective implements OnChanges {\n protected connection: DragSource<any> | undefined;\n\n /** Which source to connect the DOM to */\n @Input('dragSource') dragSource!: DragSource<any>;\n /**\n * Shortcut for setting a type on the connection.\n * Lets you use Angular binding to do it. Runs {@link DragSource#setType}.\n */\n @Input('dragSourceType') dragSourceType?: Identifier;\n /** Pass an options object as you would to {@link DragSource#connectDragSource}. */\n @Input('dragSourceOptions') dragSourceOptions?: DragSourceOptions;\n /**\n * Do not render an HTML5 preview. Only applies when using the HTML5 backend.\n * It does not use { captureDraggingState: true } for IE11 support; that is broken.\n */\n @Input('noHTML5Preview') noHTML5Preview = false;\n\n ngOnChanges() {\n this.connection = this.dragSource;\n if (this.connection && this.dragSourceType != null) {\n this.connection.setType(this.dragSourceType);\n }\n super.ngOnChanges();\n }\n\n protected callHooks(conn: DragSource<any>) {\n const sub = new Subscription();\n sub.add(conn.connectDragSource(this.elRef.nativeElement, this.dragSourceOptions));\n if (this.noHTML5Preview) {\n sub.add(conn.connectDragPreview(getEmptyImage()));\n }\n return sub;\n }\n}\n\n/**\n * Allows you to specify which element a {@link DragSource} should screenshot\n * as an HTML5 drag preview.\n *\n * Only relevant when using the HTML5 backend.\n */\n@Directive({\n selector: '[dragPreview]',\n})\nexport class DragPreviewDirective extends AbstractDndDirective implements OnChanges {\n protected connection: DragSource<any> | undefined;\n /** The drag source for which this element will be the preview. */\n @Input('dragPreview') dragPreview!: DragSource<any>;\n /** Pass an options object as you would to {@link DragSource#connectDragPreview}. */\n @Input('dragPreviewOptions') dragPreviewOptions?: DragPreviewOptions;\n\n ngOnChanges() {\n this.connection = this.dragPreview;\n super.ngOnChanges();\n }\n\n protected callHooks(conn: DragSource<any>) {\n return conn.connectDragPreview(this.elRef.nativeElement, this.dragPreviewOptions);\n }\n}\n\n// import { getEmptyImage } from 'react-dnd-html5-backend';\n// we don't want to depend on the backend, so here that is, copied\n/** @ignore */\nlet emptyImage: HTMLImageElement;\n/**\n * Returns a 0x0 empty GIF for use as a drag preview.\n * @ignore\n */\nfunction getEmptyImage() {\n if (!emptyImage) {\n emptyImage = new Image();\n emptyImage.src = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';\n }\n return emptyImage;\n}\n","/**\n * @module Misc\n */\n\nimport { InjectionToken } from '@angular/core';\nimport { Backend, BackendFactory, DragDropManager } from 'dnd-core';\n\n/** The injection token for the dnd-core compatible backend currently in use. */\nexport const DRAG_DROP_BACKEND = new InjectionToken<Backend>('dnd-core compatible backend');\n\n/** The injection token for the dnd-core BackendFactory used to instantiate dnd-core. */\nexport const DRAG_DROP_BACKEND_FACTORY = new InjectionToken<BackendFactory>(\n 'dnd-core compatible backend'\n);\n\n/** The injection token for the dnd-core compatible backend's options. */\nexport const DRAG_DROP_BACKEND_OPTIONS = new InjectionToken<any>(\n 'options for dnd-core compatible backend'\n);\n\n/** The injection token for the dnd-core compatible backend currently in use. */\nexport const DRAG_DROP_BACKEND_DEBUG_MODE = new InjectionToken<any>(\n 'should dnd-core run in debug mode?'\n);\n\n/** The injection token for the dnd-core DragDropManager */\nexport const DRAG_DROP_MANAGER = new InjectionToken<DragDropManager>('dnd-core DragDropManager');\n\n/** The injection token for the dnd-core compatible backend currently in use. */\nexport const DRAG_DROP_GLOBAL_CONTEXT = new InjectionToken<any>('dnd-core context');\n\n/**\n * The type a source or target is given as a marker for 'you supplied null as a type',\n * so that library consumers can be reminded to use setType/setTypes manually.\n * See {@link DragSource#setType}, {@link DropTarget#setTypes}.\n */\nexport const TYPE_DYNAMIC: symbol = Symbol(\n 'no type specified, you must provide one with setType/setTypes'\n);\n","import { ModuleWithProviders, NgModule, NgZone, Provider } from '@angular/core';\n\nimport { DragPreviewDirective, DragSourceDirective, DropTargetDirective } from './dnd-directives';\n\nimport {\n DRAG_DROP_BACKEND,\n DRAG_DROP_BACKEND_DEBUG_MODE,\n DRAG_DROP_BACKEND_FACTORY,\n DRAG_DROP_BACKEND_OPTIONS,\n DRAG_DROP_GLOBAL_CONTEXT,\n DRAG_DROP_MANAGER,\n} from './tokens';\n\nimport { BackendFactory, DragDropManager, createDragDropManager } from 'dnd-core';\n\nimport { invariant } from './internal/invariant';\n\n/** @ignore */\nexport function unpackBackendForEs5Users(backendOrModule: any) {\n // Auto-detect ES6 default export for people still using ES5\n let backend = backendOrModule;\n if (typeof backend === 'object' && typeof backend.default === 'function') {\n backend = backend.default;\n }\n invariant(\n typeof backend === 'function',\n 'Expected the backend to be a function or an ES6 module exporting a default function. ' +\n 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-drop-context.html'\n );\n return backend;\n}\n\n// TODO: allow injecting window\n/** @ignore */\n// @dynamic\nexport function managerFactory(\n backendFactory: BackendFactory,\n ngZone: NgZone,\n context: unknown,\n backendOptions?: unknown,\n debugMode?: boolean\n): DragDropManager {\n backendFactory = unpackBackendForEs5Users(backendFactory);\n return ngZone.runOutsideAngular(() =>\n createDragDropManager(backendFactory, context, backendOptions, debugMode)\n );\n}\n\n/** @ignore */\n// @dynamic\nexport function getBackend(manager: DragDropManager) {\n return manager.getBackend();\n}\n\n/** @ignore */\ndeclare const global: any;\n/** @ignore */\nexport function getGlobalContext() {\n return typeof global !== 'undefined' ? global : (window as any);\n}\n\n/*\n * Hold on, this gets a little confusing.\n *\n * A dnd-core Backend has lots of useful methods for registering elements and firing events.\n * However, backends are not distributed this way.\n * The HTML5Backend and the TestBackend, when imported { default as HTML5Backend }, are not Backends, they are\n * functions: (manager: DragDropManager, ...) => Backend.\n * This is now known as a BackendFactory under dnd-core 4+ typescript annotations.\n *\n * However, Angular has its own conception of what a factory is for AOT. This is the 'factory'\n * to which BackendFactoryInput refers below.\n * Sometimes, users will want to preconfigure a backend (like TouchBackend, or MultiBackend).\n * For this, they need to export a function that returns a configured BackendFactory\n * and pass it in as { backendFactory: exportedFunction }.\n */\n\n/**\n * Used for providing backends to {@link DndModule#forRoot}.\n * You can configure your backend with `options`.\n */\nexport interface BackendInput {\n /** A plain backend, for example the HTML5Backend. */\n backend: BackendFactory;\n /**\n * Any configuration your backend accepts. Use this with the TouchBackend or the MultiBackend,\n * for example.\n */\n options?: any;\n /**\n * Whether dnd-core should enable debugging, which lets you see dnd-core actions\n * in the Redux extension for Chrome.\n */\n debug?: boolean;\n}\n\n/** @ignore */\nconst EXPORTS = [DragSourceDirective, DropTargetDirective, DragPreviewDirective];\n\n// @dynamic\n@NgModule({\n imports: EXPORTS,\n exports: EXPORTS,\n})\nexport class DndModule {\n static forRoot(backendInput: BackendInput): ModuleWithProviders<DndModule> {\n return {\n ngModule: DndModule,\n providers: [provideDnd(backendInput)],\n };\n }\n}\n\nexport function provideDnd(backendInput: BackendInput): Provider[] {\n return [\n {\n provide: DRAG_DROP_BACKEND_FACTORY,\n useValue: backendInput.backend,\n },\n {\n provide: DRAG_DROP_BACKEND_OPTIONS,\n useValue: backendInput.options,\n },\n {\n provide: DRAG_DROP_BACKEND_DEBUG_MODE,\n useValue: backendInput.debug,\n },\n {\n provide: DRAG_DROP_GLOBAL_CONTEXT,\n useFactory: getGlobalContext,\n },\n {\n provide: DRAG_DROP_MANAGER,\n useFactory: managerFactory,\n deps: [\n DRAG_DROP_BACKEND_FACTORY,\n NgZone,\n DRAG_DROP_GLOBAL_CONTEXT,\n DRAG_DROP_BACKEND_OPTIONS,\n DRAG_DROP_BACKEND_DEBUG_MODE,\n ],\n },\n {\n provide: DRAG_DROP_BACKEND,\n deps: [DRAG_DROP_MANAGER],\n useFactory: getBackend,\n },\n ];\n}\n","export function shallowEqual(objA: any, objB: any) {\n if (objA === objB) {\n return true;\n }\n\n const keysA = Object.keys(objA);\n const keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n // Test for A's keys different from B.\n const hasOwn = Object.prototype.hasOwnProperty;\n for (const key of keysA) {\n if (!hasOwn.call(objB, key) || objA[key] !== objB[key]) {\n return false;\n }\n }\n\n return true;\n}\n","import { shallowEqual } from './shallowEqual';\n\nexport default function areOptionsEqual(nextOptions: any, currentOptions: any) {\n if (currentOptions === nextOptions) {\n return true;\n }\n\n return (\n currentOptions !== null && nextOptions !== null && shallowEqual(currentOptions, nextOptions)\n );\n}\n","import { Unsubscribe, Identifier } from 'dnd-core';\nimport areOptionsEqual from '../utils/areOptionsEqual';\n\nexport class Reconnector<O = any> {\n handlerId: Identifier | null = null;\n node?: Node;\n options?: O;\n disconnect?: Unsubscribe | null;\n constructor(\n private backendConnector: (handlerId: Identifier, node: Node, options?: O) => Unsubscribe\n ) {}\n reconnect = (parentHandlerId: Identifier | null) => {\n if (this.disconnect) {\n this.disconnect();\n this.disconnect = null;\n }\n this.handlerId = parentHandlerId;\n if (this.handlerId && this.node) {\n this.disconnect = this.backendConnector(this.handlerId, this.node, this.options);\n }\n };\n hook = (nativeElement: Node, options?: O) => {\n if (nativeElement === this.node && areOptionsEqual(options, this.options)) {\n return;\n }\n\n this.node = nativeElement;\n this.options = options;\n\n this.reconnect(this.handlerId);\n };\n}\n","import { Backend, Identifier } from 'dnd-core';\nimport { DropTargetConnector } from '../connectors';\nimport { Connector } from './createSourceConnector';\nimport { Reconnector } from './Reconnector';\n\nexport class TargetConnector implements Connector<DropTargetConnector> {\n private currentHandlerId: Identifier | null = null;\n\n private dropTarget = new Reconnector<void>((handlerId, node, options) => {\n return this.backend.connectDropTarget(handlerId, node, options);\n });\n\n constructor(private backend: Backend) {}\n\n public receiveHandlerId(handlerId: Identifier | null) {\n if (handlerId === this.currentHandlerId) {\n return;\n }\n this.currentHandlerId = handlerId;\n this.dropTarget.reconnect(handlerId);\n }\n\n public hooks: DropTargetConnector = {\n dropTarget: this.dropTarget.hook,\n };\n\n public reconnect() {\n this.dropTarget.reconnect(this.currentHandlerId);\n }\n}\n\nexport default function createTargetConnector(backend: Backend) {\n return new TargetConnector(backend);\n}\n","import { DragDropManager, DropTarget, TargetType } from 'dnd-core';\n\nexport default function registerTarget(\n type: TargetType,\n target: DropTarget,\n manager: DragDropManager\n) {\n const registry = manager.getRegistry();\n const targetId = registry.addTarget(type, target);\n\n function unregisterTarget() {\n registry.removeTarget(targetId);\n }\n\n return {\n handlerId: targetId,\n unregister: unregisterTarget,\n };\n}\n","import { Backend, Identifier } from 'dnd-core';\nimport { DragSourceConnector } from '../connectors';\nimport { Reconnector } from './Reconnector';\nimport { DragPreviewOptions, DragSourceOptions } from '../connectors';\n\nexport interface Connector<TConnector> {\n hooks: TConnector;\n receiveHandlerId(handlerId: Identifier | null): void;\n reconnect(): void;\n}\n\nexport class SourceConnector implements Connector<DragSourceConnector> {\n private currentHandlerId: Identifier | null = null;\n\n private dragSource = new Reconnector<DragSourceOptions>((handlerId, node, options) => {\n return this.backend.connectDragSource(handlerId, node, options);\n });\n private dragPreview = new Reconnector<DragPreviewOptions>((handlerId, node, options) => {\n return this.backend.connectDragPreview(handlerId, node, options);\n });\n\n constructor(private backend: Backend) {}\n\n public receiveHandlerId(handlerId: Identifier | null) {\n if (handlerId === this.currentHandlerId) {\n return;\n }\n this.currentHandlerId = handlerId;\n this.dragSource.reconnect(handlerId);\n this.dragPreview.reconnect(handlerId);\n }\n\n public hooks: DragSourceConnector = {\n dragSource: this.dragSource.hook,\n dragPreview: this.dragPreview.hook,\n };\n\n public reconnect() {\n this.dragSource.reconnect(this.currentHandlerId);\n this.dragPreview.reconnect(this.currentHandlerId);\n }\n}\n\nexport default function createSourceConnector(backend: Backend) {\n return new SourceConnector(backend);\n}\n","import { DragDropManager, DragSource, SourceType } from 'dnd-core';\n\nexport default function registerSource(\n type: SourceType,\n source: DragSource,\n manager: DragDropManager\n) {\n const registry = manager.getRegistry();\n const sourceId = registry.addSource(type, source);\n\n function unregisterSource() {\n registry.removeSource(sourceId);\n }\n\n return {\n handlerId: sourceId,\n unregister: unregisterSource,\n };\n}\n","import { shallowEqual } from './shallowEqual';\n\nexport function areCollectsEqual(a: any, b: any) {\n if (a == null || b == null) {\n return false;\n }\n if (typeof a !== 'object' || typeof b !== 'object') {\n return a === b;\n }\n\n return shallowEqual(a, b);\n}\n","import { NgZone } from '@angular/core';\nimport { Backend, DragDropManager, Identifier } from 'dnd-core';\nimport { BehaviorSubject, Observable, ReplaySubject, Subscription, TeardownLogic } from 'rxjs';\nimport { distinctUntilChanged, map, switchMap, take, tap } from 'rxjs/operators';\nimport { TYPE_DYNAMIC } from '../tokens';\nimport { TypeOrTypeArray } from '../type-ish';\nimport { invariant } from './invariant';\n\nimport { areCollectsEqual } from '../utils/areCollectsEqual';\n\nimport { DragSource, DropTarget } from '../connection-types';\nimport {\n DragPreviewOptions,\n DragSourceConnector,\n DragSourceOptions,\n DropTargetConnector,\n} from '../connectors';\nimport { DragSourceMonitor } from '../source-monitor';\nimport { DropTargetMonitor } from '../target-monitor';\nimport { Connector } from './createSourceConnector';\n\nexport interface FactoryArgs<TMonitor, TConnector> {\n createHandler: (handlerMonitor: any) => any;\n createMonitor: (manager: DragDropManager) => TMonitor;\n createConnector: (backend: Backend) => Connector<TConnector>;\n registerHandler: (\n type: any,\n handler: any,\n manager: DragDropManager\n ) => {\n handlerId: Identifier;\n unregister: Subscription | ((...args: any[]) => void);\n };\n}\n\nexport class Connection<TMonitor extends DragSourceMonitor | DropTargetMonitor, TConnector> {\n // immutable after instantiation\n private readonly handlerMonitor: any;\n private readonly handlerConnector: Connector<TConnector>;\n private readonly handler: Identifier;\n\n /** The stream of all change events from the internal subscription's handleChange */\n private readonly collector$: BehaviorSubject<TMonitor>;\n /** A subject basically used to kick off any observables waiting for a type to be set via setType/setTypes */\n private readonly resolvedType$ = new ReplaySubject<any>(1);\n\n // mutable state\n private currentType?: TypeOrTypeArray;\n private handlerId!: Identifier;\n\n /**\n * This one is created and destroyed once per type or list of types.\n * Because each time we change the type, we unsubscribe from the global state storage and\n * re-subscribe with the new type.\n */\n private subscriptionTypeLifetime?: Subscription;\n\n /**\n * This one lives exactly as long as the connection.\n * It is responsible for disposing of the handlerConnector, and any internal listen() subscriptions.\n */\n private subscriptionConnectionLifetime = new Subscription();\n\n constructor(\n private factoryArgs: FactoryArgs<TMonitor, TConnector>,\n private manager: DragDropManager,\n private ngZone: NgZone,\n initialType: TypeOrTypeArray | undefined\n ) {\n invariant(\n typeof manager === 'object',\n // TODO: update this mini-documentation\n 'Could not find the drag and drop manager in the context of %s. ' +\n 'Make sure to wrap the top-level component of your app with DragDropContext. '\n // 'Read more: ',\n );\n NgZone.assertNotInAngularZone();\n\n this.handlerMonitor = this.factoryArgs.createMonitor(this.manager);\n this.collector$ = new BehaviorSubject(this.handlerMonitor);\n this.handler = this.factoryArgs.createHandler(this.handlerMonitor);\n this.handlerConnector = this.factoryArgs.createConnector(this.manager.getBackend());\n // handlerConnector lives longer than any per-type subscription\n this.subscriptionConnectionLifetime.add(() => this.handlerConnector.receiveHandlerId(null));\n\n if (initialType && initialType !== TYPE_DYNAMIC) {\n this.setTypes(initialType);\n }\n }\n\n listen<P>(mapFn: (monitor: TMonitor) => P): Observable<P> {\n // Listeners are generally around as long as the connection.\n // This isn't 100% true, but there is no way of knowing (even if you ref-count it)\n // when a component no longer needs it.\n return this.resolvedType$.pipe(\n // this ensures we don't start emitting values until there is a type resolved\n take(1),\n // switch our attention to the incoming firehose of 'something changed' events\n switchMap(() => this.collector$),\n // turn them into 'interesting state' via the monitor and a user-provided function\n map(mapFn),\n // don't emit EVERY time the firehose says something changed, only when the interesting state changes\n distinctUntilChanged(areCollectsEqual),\n // TODO: how to reduce the frequency of change detection?\n tap(this.onUpdate)\n );\n }\n\n private onUpdate = () => {\n this.handlerConnector.reconnect();\n };\n\n connect(fn: (connector: TConnector) => void) {\n const subscription = this.resolvedType$.pipe(take(1)).subscribe(() => {\n // must run inside ngZone otherwise the zone app may have small issue\n this.ngZone.run(() => {\n fn(this.handlerConnector.hooks);\n });\n });\n // now chain this onto the connection's unsubscribe call.\n // just in case you destroy your component before setting a type on anything\n // i.e.:\n // conn without a type\n // source = this.dnd.dragSource(null, { ... })\n // manually connect to the DOM, which won't handle the returned subscription like the directive does\n // ngAfterViewInit() { this.source.connectDragSource(this.myDiv.nativeElement); }\n // never set a type\n // then destroy your component, the source, but not the connection request.\n // ngOnDestroy() { this.source.unsubscribe(); }\n //\n // without this, you would have a hanging resolvedType$.pipe(take(1)) subscription\n // with this, it dies with the source's unsubscribe call.\n //\n // doesn't need this.subscriptionTypeLifetime, because pipe(take(1)) already does that\n this.subscriptionConnectionLifetime.add(subscription);\n return subscription;\n }\n\n connectDropTarget(node: Node) {\n return this.connect(c => (c as DropTargetConnector).dropTarget(node));\n }\n\n connectDragSource(node: Node, options: DragSourceOptions) {\n return this.connect(c => (c as DragSourceConnector).dragSource(node, options));\n }\n\n connectDragPreview(node: Node, options: DragPreviewOptions) {\n return this.connect(c => (c as DragSourceConnector).dragPreview(node, options));\n }\n\n setTypes(type: TypeOrTypeArray) {\n // must run outside ngZone\n this.ngZone.runOutsideAngular(() => {\n this.receiveType(type);\n this.resolvedType$.next(1);\n });\n }\n\n setType(type: Identifier) {\n this.setTypes(type);\n }\n\n getHandlerId() {\n return this.handlerId;\n }\n\n receiveType(type: TypeOrTypeArray) {\n if (type === this.currentType) {\n return;\n }\n\n NgZone.assertNotInAngularZone();\n\n this.currentType = type;\n\n if (this.subscriptionTypeLifetime) {\n this.subscriptionTypeLifetime.unsubscribe();\n }\n // console.debug('subscribed to ' + type.toString());\n this.subscriptionTypeLifetime = new Subscription();\n\n const { handlerId, unregister } = this.factoryArgs.registerHandler(\n type,\n this.handler,\n this.manager\n );\n\n this.handlerId = handlerId;\n this.handlerMonitor.receiveHandlerId(handlerId);\n this.handlerConnector.receiveHandlerId(handlerId);\n\n const globalMonitor = this.manager.getMonitor();\n const unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, {\n handlerIds: [handlerId],\n });\n\n this.subscriptionTypeLifetime.add(unsubscribe);\n this.subscriptionTypeLifetime.add(unregister);\n // this.subscriptionTypeLifetime.add(() => console.debug(\"unsubscribed from \" + type.toString()));\n }\n\n private handleChange = () => {\n this.collector$.next(this.handlerMonitor);\n };\n\n unsubscribe() {\n if (this.subscriptionTypeLifetime) {\n this.subscriptionTypeLifetime.unsubscribe();\n }\n this.subscriptionConnectionLifetime.unsubscribe();\n }\n\n add(teardown: TeardownLogic) {\n return this.subscriptionConnectionLifetime.add(teardown);\n }\n\n get closed() {\n return this.subscriptionConnectionLifetime && this.subscriptionConnectionLifetime.closed;\n }\n}\n\nexport type SourceConstructor<Item = unknown, DropResult = unknown> = new (\n factoryArgs: FactoryArgs<DragSourceMonitor, DragSourceConnector>,\n manager: DragDropManager,\n ngZone: NgZone,\n initialType: Identifier | undefined\n) => DragSource<Item, DropResult>;\nexport type TargetConstructor = new (\n factoryArgs: FactoryArgs<DropTargetMonitor, DropTargetConnector>,\n manager: DragDropManager,\n ngZone: NgZone,\n initialType: TypeOrTypeArray | undefined\n) => DropTarget;\n\nexport const SourceConnection = Connection as SourceConstructor;\nexport const TargetConnection = Connection as TargetConstructor;\n","import { DragDropManager, Unsubscribe } from 'dnd-core';\nimport { BehaviorSubject, Observable, Subscription, TeardownLogic } from 'rxjs';\nimport { distinctUntilChanged, map } from 'rxjs/operators';\nimport { DragLayer } from '../connection-types';\nimport { DragLayerMonitor } from '../layer-monitor';\nimport { areCollectsEqual } from '../utils/areCollectsEqual';\n\nexport class DragLayerConnectionClass implements DragLayer {\n unsubscribeFromOffsetChange: Unsubscribe;\n unsubscribeFromStateChange: Unsubscribe;\n private readonly collector$: BehaviorSubject<DragLayerMonitor>;\n private subscription = new Subscription();\n\n constructor(private manager: DragDropManager) {\n const monitor = this.manager.getMonitor();\n this.collector$ = new BehaviorSubject<DragLayerMonitor>(monitor);\n this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleOffsetChange);\n this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleStateChange);\n\n this.subscription.add(() => {\n this.unsubscribeFromOffsetChange();\n this.unsubscribeFromStateChange();\n });\n\n this.handleStateChange();\n }\n\n isTicking = false;\n\n private handleStateChange = () => {\n const monitor = this.manager.getMonitor() as DragLayerMonitor;\n this.collector$.next(monitor);\n };\n private handleOffsetChange = () => {\n const monitor = this.manager.getMonitor() as DragLayerMonitor;\n this.collector$.next(monitor);\n };\n\n listen<P>(mapFn: (monitor: DragLayerMonitor) => P): Observable<P> {\n return this.collector$.pipe(map(mapFn), distinctUntilChanged(areCollectsEqual));\n }\n\n unsubscribe() {\n this.collector$.complete();\n this.subscription.unsubscribe();\n }\n\n add(teardown: TeardownLogic) {\n return this.subscription.add(teardown);\n }\n\n get closed() {\n return this.subscription.closed;\n }\n}\n","import { DragSource } from 'dnd-core';\nimport { DragSourceSpec } from '../drag-source-specification';\nimport { DragSourceMonitor } from '../source-monitor';\n\nexport class Source implements DragSource {\n constructor(\n private spec: DragSourceSpec<any>,\n private monitor: DragSourceMonitor<any, any>\n ) {}\n\n withChangeDetection<T>(fn: () => T): T {\n const x = fn();\n return x;\n }\n\n canDrag() {\n if (!this.spec.canDrag) {\n return true;\n }\n\n return this.withChangeDetection(() => {\n return this.spec.canDrag?.(this.monitor) || false;\n });\n }\n\n isDragging(globalMonitor: any, sourceId: any) {\n if (!this.spec.isDragging) {\n return sourceId === globalMonitor.getSourceId();\n }\n\n return this.spec.isDragging(this.monitor);\n }\n\n beginDrag() {\n return this.withChangeDetection(() => {\n return this.spec.beginDrag(this.monitor);\n });\n }\n\n endDrag() {\n if (!this.spec.endDrag) {\n return;\n }\n\n return this.withChangeDetection(() => {\n this.spec.endDrag?.(this.monitor);\n });\n }\n}\n\nexport function createSourceFactory(spec: DragSourceSpec<any>) {\n return function createSource(monitor: DragSourceMonitor): DragSource {\n return new Source(spec, monitor);\n };\n}\n","import { DragDropManager, DragDropMonitor, Identifier } from 'dnd-core';\nimport { DragSourceMonitor } from '../source-monitor';\nimport { invariant } from './invariant';\n\nlet isCallingCanDrag = false;\nlet isCallingIsDragging = false;\n\nclass DragSourceMonitorClass implements DragSourceMonitor {\n internalMonitor: DragDropMonitor;\n sourceId: Identifier | undefined;\n\n constructor(manager: DragDropManager) {\n this.internalMonitor = manager.getMonitor();\n }\n\n receiveHandlerId(sourceId: Identifier | undefined) {\n this.sourceId = sourceId;\n }\n\n canDrag() {\n invariant(\n !isCallingCanDrag,\n 'You may not call monitor.canDrag() inside your canDrag() implementation. ' +\n 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html'\n );\n\n try {\n isCallingCanDrag = true;\n return this.internalMonitor.canDragSource(this.sourceId);\n } finally {\n isCallingCanDrag = false;\n }\n }\n\n isDragging() {\n invariant(\n !isCallingIsDragging,\n 'You may not call monitor.isDragging() inside your isDragging() implementation. ' +\n 'Read more: http://react-dnd.github.io/react-dnd/docs-drag-source-monitor.html'\n );\n\n try {\n isCallingIsDragging = true;\n return this.internalMonitor.isDraggingSource(this.sourceId);\n } finally {\n isCallingIsDragging = false;\n }\n }\n\n getItemType() {\n return this.internalMonitor.getItemType();\n }\n\n getItem() {\n return this.internalMonitor.getItem();\n }\n\n getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n\n didDrop() {\n return this.internalMonitor.didDrop();\n }\n\n getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n\n getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n\n getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n\n getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n\n getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n}\n\nexport function createSourceMonitor(manager: DragDropManager): DragSourceMonitor {\n return new DragSourceMonitorClass(manager);\n}\n","import { DropTarget } from 'dnd-core';\nimport { DropTargetSpec } from '../drop-target-specification';\nimport { DropTargetMonitor } from '../target-monitor';\n\nexport class Target implements DropTarget {\n constructor(\n private spec: DropTargetSpec,\n private monitor: DropTargetMonitor\n ) {\n this.monitor = monitor;\n }\n\n withChangeDetection<T>(fn: () => T): T {\n const x = fn();\n return x;\n }\n\n receiveMonitor(monitor: DropTargetMonitor) {\n this.monitor = monitor;\n }\n\n canDrop() {\n if (!this.spec.canDrop) {\n return true;\n }\n\n // Don't run isDragging in the zone. Should be a pure function of `this`.\n return this.spec.canDrop(this.monitor);\n }\n\n hover() {\n if (!this.spec.hover) {\n return;\n }\n this.withChangeDetection(() => {\n this.spec.hover?.(this.monitor);\n });\n }\n\n drop() {\n if (!this.spec.drop) {\n return undefined;\n }\n\n return this.withChangeDetection(() => {\n return this.spec.drop?.(this.monitor);\n });\n }\n}\n\nexport function createTargetFactory(spec: DropTargetSpec) {\n return function createTarget(monitor: DropTargetMonitor): DropTarget {\n return new Target(spec, monitor);\n };\n}\n","import { DragDropManager, DragDropMonitor, Identifier } from 'dnd-core';\nimport { DropTargetMonitor } from '../target-monitor';\nimport { invariant } from './invariant';\n\nlet isCallingCanDrop = false;\n\nclass DropTargetMonitorClass implements DropTargetMonitor {\n internalMonitor: DragDropMonitor;\n targetId: Identifier | undefined;\n\n constructor(manager: DragDropManager) {\n this.internalMonitor = manager.getMonitor();\n }\n\n receiveHandlerId(targetId: Identifier | undefined) {\n this.targetId = targetId;\n }\n\n canDrop() {\n invariant(\n !isCallingCanDrop,\n 'You may not call monitor.canDrop() inside your canDrop() implementation. ' +\n 'Read more: http://react-dnd.github.io/react-dnd/docs-drop-target-monitor.html'\n );\n\n try {\n isCallingCanDrop = true;\n return this.internalMonitor.canDropOnTarget(this.targetId);\n } finally {\n isCallingCanDrop = false;\n }\n }\n\n isOver(options = { shallow: false }) {\n return this.internalMonitor.isOverTarget(this.targetId, options);\n }\n\n getItemType() {\n return this.internalMonitor.getItemType();\n }\n\n getItem() {\n return this.internalMonitor.getItem();\n }\n\n getDropResult() {\n return this.internalMonitor.getDropResult();\n }\n\n didDrop() {\n return this.internalMonitor.didDrop();\n }\n\n getInitialClientOffset() {\n return this.internalMonitor.getInitialClientOffset();\n }\n\n getInitialSourceClientOffset() {\n return this.internalMonitor.getInitialSourceClientOffset();\n }\n\n getSourceClientOffset() {\n return this.internalMonitor.getSourceClientOffset();\n }\n\n getClientOffset() {\n return this.internalMonitor.getClientOffset();\n }\n\n getDifferenceFromInitialOffset() {\n return this.internalMonitor.getDifferenceFromInitialOffset();\n }\n}\n\nexport function createTargetMonitor(manager: DragDropManager): DropTargetMonitor {\n return new DropTargetMonitorClass(manager);\n}\n","/**\n * @module 1-Top-Level\n */\n/** a second comment */\n\nimport { inject, Injectable, NgZone } from '@angular/core';\nimport { Identifier } from 'dnd-core';\nimport { DRAG_DROP_MANAGER, TYPE_DYNAMIC } from './tokens';\n\nimport { DropTargetSpec } from './drop-target-specification';\nimport createTargetConnector from './internal/createTargetConnector';\nimport registerTarget from './internal/register-target';\n\nimport { DragSourceSpec } from './drag-source-specification';\nimport createSourceConnector from './internal/createSourceConnector';\nimport registerSource from './internal/register-source';\n\nimport { SubscriptionLike, TeardownLogic } from 'rxjs';\nimport { SourceConnection, TargetConnection } from './internal/connection-factory';\nimport { DragLayerConnectionClass } from './internal/drag-layer-connection';\nimport { TypeOrTypeArray } from './type-ish';\n\nimport { DragLayer, DragSource, DropTarget } from './connection-types';\nimport { createSourceFactory } from './internal/createSourceFactory';\nimport { createSourceMonitor } from './internal/createSourceMonitor';\nimport { createTargetFactory } from './internal/createTargetFactory';\nimport { createTargetMonitor } from './internal/createTargetMonitor';\n\n/**\n * Represents an RxJS Subscription, with multi-version compatibility.\n * The standard SubscriptionLike does not contain an add() method.\n */\nexport interface AddSubscription extends SubscriptionLike {\n /** Same as RxJS `Subscription#add` */\n add(teardownLogic: TeardownLogic): void;\n}\n\n/**\n * For a simple component, unsubscribing is as easy as `connection.unsubscribe()` in `ngOnDestroy()`\n * If your components have lots of subscriptions, it can get tedious having to\n * unsubscribe from all of them, and you might forget. A common pattern is to create an RxJS Subscription\n * (maybe called `destroy`), to use `this.destroy.add(xxx.subscribe(...))`\n * and to call `destroy.unsubscribe()` once to clean up all of them. @ng-dnd/core\n * supports this pattern with by using the `subscription` parameter on the\n * constructors. Simply:\n *\n * ```typescript\n * import { Subscription } from 'rxjs';\n * // ...\n * destroy = new Subscription();\n * target = this.dnd.dropTarget({\n * // ...\n * }, this.destroy);\n * ngOnDestroy() { this.destroy.unsubscribe(); }\n * ```\n *\n * It is a good habit for avoiding leaked subscriptions, because .\n */\n@Injectable({ providedIn: 'root' })\nexport class DndService {\n private manager = inject(DRAG_DROP_MANAGER);\n private ngZone = inject(NgZone);\n\n /**\n * This drop target will only react to the items produced by the drag sources\n * of the specified type or types.\n *\n * If you want a dynamic type, pass `null` as the type; and call\n * {@link DropTarget#setTypes} in a lifecycle hook.\n */\n public dropTarget<Item = unknown, DropResult = unknown>(\n types: TypeOrTypeArray | null,\n spec: DropTargetSpec<Item, DropResult>,\n subscription?: AddSubscription\n ): DropTarget<Item, DropResult> {\n return this.ngZone.runOutsideAngular(() => {\n const createTarget = createTargetFactory(spec);\n\n const conn = new TargetConnection(\n {\n createHandler: createTarget,\n registerHandler: registerTarget,\n createMonitor: createTargetMonitor,\n createConnector: createTargetConnector,\n },\n this.manager,\n this.ngZone,\n types || TYPE_DYNAMIC\n ) as DropTarget<Item, DropResult>;\n\n if (subscription) {\n subscription.add(conn);\n }\n return conn;\n });\n }\n\n /**\n * This method creates a {@link DragSource} object. It represents a drag\n * source and its behaviour, and can be connected to a DOM element by\n * assigning it to the `[dragSource]` directive on that element in your\n * template.\n *\n * It is the corollary of [`react-dnd`'s\n * `DragSource`](http://react-dnd.github.io/react-dnd/docs-drag-source.html).\n *\n * The `spec` argument ({@link DragSourceSpec}) is a set of _queries_ and\n * _callbacks_ that are called at appropriate times by the internals. The\n * queries are for asking your component whether to drag/listen and what\n * item data to hoist up; the callback (just 1) is for notifying you when\n * the drag ends.\n *\n * Only the drop targets registered for the same type will\n * react to the items produced by this drag source. If you want a dynamic\n * type, pass `null` as the type; and call {@link DragSource#setType} in\n * a lifecycle hook.\n *\n * @param subscription An RxJS Subscription to tie the lifetime of the\n * connection to.\n */\n public dragSource<Item, DropResult = unknown>(\n type: Identifier | null,\n spec: DragSourceSpec<Item, DropResult>,\n subscription?: AddSubscription\n ): DragSource<Item, DropResult> {\n return this.ngZone.runOutsideAngular(() => {\n const createSource = createSourceFactory(spec);\n\n const conn = new SourceConnection(\n {\n createHandler: createSource,\n registerHandler: registerSource,\n createMonitor: createSourceMonitor,\n createConnector: createSourceConnector,\n },\n this.manager,\n this.ngZone,\n type || TYPE_DYNAMIC\n ) as DragSource<Item, DropResult>;\n\n if (subscription) {\n subscription.add(conn);\n }\n return conn;\n });\n }\n\n /**\n * This method creates a {@link DragLayer} object\n */\n public dragLayer<Item = any>(subscription?: AddSubscription): DragLayer<Item> {\n return this.ngZone.runOutsideAngular(() => {\n const conn = new DragLayerConnectionClass(this.manager);\n\n if (subscription) {\n subscription.add(conn);\n }\n return conn;\n });\n }\n}\n","// import no symbols to get typings but not execute the monkey-patching module loader\n\nexport * from './src/dnd-module';\n\nexport * from './src/layer-monitor';\nexport * from './src/source-monitor';\nexport * from './src/target-monitor';\n\n// the source, target and preview types\nexport { DragLayer, DragSource, DropTarget } from './src/connection-types';\nexport { DragPreviewOptions, DragSourceOptions } from './src/connectors';\nexport { DRAG_DROP_BACKEND, DRAG_DROP_MANAGER } from './src/tokens';\n\n// direct API\nexport * from './src/connector';\nexport * from './src/dnd-directives';\nexport * from './src/drag-source-specification';\nexport * from './src/drop-target-specification';\n\nexport { Offset } from './src/type-ish';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAAM,SAAU,SAAS,CAAC,SAAkB,EAAE,GAAW,EAAA;IACvD,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC;IACtB;AACF;;ACMA;AACA,MAAM,WAAW,GACf,mEAAmE;AACnE,IAAA,0EAA0E;AAE5E;MAEa,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;AAGU,QAAA,IAAA,CAAA,eAAe,GAAG,IAAI,YAAY,EAAE;AAClC,QAAA,IAAA,CAAA,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;AAC5B,QAAA,IAAA,CAAA,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;AAuBhC,IAAA;IArBC,WAAW,GAAA;QACT,SAAS,CAAC,OAAO,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,WAAW,CAAC;AAC9F,QAAA,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAK;;;;AAIjC,YAAA,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE;;AAElC,YAAA,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC;YACxD;AACF,QAAA,CAAC,CAAC;IACJ;IAEA,WA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