| Current Path : /home/emeraadmin/public_html/4d695/ |
| Current File : /home/emeraadmin/public_html/4d695/decorators.zip |
PK )U�\�Q#�� �
utils.d.tsnu �[��� /// <reference types="react" />
export declare function getDecoratedComponent(instanceRef: React.RefObject<any>): any;
export declare function isClassComponent(Component: unknown): boolean;
export declare function isRefForwardingComponent(C: unknown): boolean;
export declare function isRefable(C: unknown): boolean;
export declare function checkDecoratorArguments(functionName: string, signature: string, ...args: any[]): void;
PK )U�\�M�D D DragLayer.d.tsnu �[��� import { DndOptions } from '../interfaces';
import { DragLayerCollector, DndComponentEnhancer } from './interfaces';
export declare function DragLayer<RequiredProps, CollectedProps = any>(collect: DragLayerCollector<RequiredProps, CollectedProps>, options?: DndOptions<RequiredProps>): DndComponentEnhancer<CollectedProps>;
PK )U�\/,�� � DropTarget.d.tsnu �[��� import { TargetType } from 'dnd-core';
import { DndOptions } from '../interfaces';
import { DropTargetSpec, DropTargetCollector, DndComponentEnhancer } from './interfaces';
export declare function DropTarget<RequiredProps, CollectedProps = any>(type: TargetType | ((props: RequiredProps) => TargetType), spec: DropTargetSpec<RequiredProps>, collect: DropTargetCollector<CollectedProps, RequiredProps>, options?: DndOptions<RequiredProps>): DndComponentEnhancer<CollectedProps>;
PK )U�\B�Bi� � utils.jsnu �[��� export function getDecoratedComponent(instanceRef) {
const currentRef = instanceRef.current;
if (currentRef == null) {
return null;
}
else if (currentRef.decoratedRef) {
// go through the private field in decorateHandler to avoid the invariant hit
return currentRef.decoratedRef.current;
}
else {
return currentRef;
}
}
export function isClassComponent(Component) {
return (Component &&
Component.prototype &&
typeof Component.prototype.render === 'function');
}
export function isRefForwardingComponent(C) {
const item = C;
return item?.$$typeof?.toString() === 'Symbol(react.forward_ref)';
}
export function isRefable(C) {
return isClassComponent(C) || isRefForwardingComponent(C);
}
export function checkDecoratorArguments(functionName, signature, ...args) {
if (process.env.NODE_ENV !== 'production') {
for (let i = 0; i < args.length; i++) {
const arg = args[i];
if (arg && arg.prototype && arg.prototype.render) {
// eslint-disable-next-line no-console
console.error('You seem to be applying the arguments in the wrong order. ' +
`It should be ${functionName}(${signature})(Component), not the other way around. ` +
'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#you-seem-to-be-applying-the-arguments-in-the-wrong-order');
return;
}
}
}
}
PK )U�\��˜ DragLayer.jsnu �[��� import * as React from 'react';
import { shallowEqual } from '@react-dnd/shallowequal';
import hoistStatics from 'hoist-non-react-statics';
import { invariant } from '@react-dnd/invariant';
import { DndContext } from '../common/DndContext';
import { isPlainObject } from '../utils/js_utils';
import { isRefable, checkDecoratorArguments } from './utils';
export function DragLayer(collect, options = {}) {
checkDecoratorArguments('DragLayer', 'collect[, options]', collect, options);
invariant(typeof collect === 'function', 'Expected "collect" provided as the first argument to DragLayer to be a function that collects props to inject into the component. ', 'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', collect);
invariant(isPlainObject(options), 'Expected "options" provided as the second argument to DragLayer to be a plain object when specified. ' +
'Instead, received %s. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-layer', options);
return function decorateLayer(DecoratedComponent) {
const Decorated = DecoratedComponent;
const { arePropsEqual = shallowEqual } = options;
const displayName = Decorated.displayName || Decorated.name || 'Component';
let DragLayerContainer = /** @class */ (() => {
class DragLayerContainer extends React.Component {
constructor() {
super(...arguments);
this.isCurrentlyMounted = false;
this.ref = React.createRef();
this.handleChange = () => {
if (!this.isCurrentlyMounted) {
return;
}
const nextState = this.getCurrentState();
if (!shallowEqual(nextState, this.state)) {
this.setState(nextState);
}
};
}
getDecoratedComponentInstance() {
invariant(this.ref.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.ref.current;
}
shouldComponentUpdate(nextProps, nextState) {
return (!arePropsEqual(nextProps, this.props) ||
!shallowEqual(nextState, this.state));
}
componentDidMount() {
this.isCurrentlyMounted = true;
this.handleChange();
}
componentWillUnmount() {
this.isCurrentlyMounted = false;
if (this.unsubscribeFromOffsetChange) {
this.unsubscribeFromOffsetChange();
this.unsubscribeFromOffsetChange = undefined;
}
if (this.unsubscribeFromStateChange) {
this.unsubscribeFromStateChange();
this.unsubscribeFromStateChange = undefined;
}
}
render() {
return (React.createElement(DndContext.Consumer, null, ({ dragDropManager }) => {
if (dragDropManager === undefined) {
return null;
}
this.receiveDragDropManager(dragDropManager);
// Let componentDidMount fire to initialize the collected state
if (!this.isCurrentlyMounted) {
return null;
}
return (React.createElement(Decorated, Object.assign({}, this.props, this.state, { ref: isRefable(Decorated) ? this.ref : null })));
}));
}
receiveDragDropManager(dragDropManager) {
if (this.manager !== undefined) {
return;
}
this.manager = dragDropManager;
invariant(typeof dragDropManager === 'object', 'Could not find the drag and drop manager in the context of %s. ' +
'Make sure to render a DndProvider component in your top-level component. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
const monitor = this.manager.getMonitor();
this.unsubscribeFromOffsetChange = monitor.subscribeToOffsetChange(this.handleChange);
this.unsubscribeFromStateChange = monitor.subscribeToStateChange(this.handleChange);
}
getCurrentState() {
if (!this.manager) {
return {};
}
const monitor = this.manager.getMonitor();
return collect(monitor, this.props);
}
}
DragLayerContainer.displayName = `DragLayer(${displayName})`;
DragLayerContainer.DecoratedComponent = DecoratedComponent;
return DragLayerContainer;
})();
return hoistStatics(DragLayerContainer, DecoratedComponent);
};
}
PK )U�\��n��
�
disposables.d.tsnu �[��� import { noop } from '../utils/js_utils';
/**
* Provides a set of static methods for creating Disposables.
* @param {Function} action Action to run during the first call to dispose.
* The action is guaranteed to be run at most once.
*/
export declare class Disposable {
/**
* Gets the disposable that does nothing when disposed.
*/
static empty: {
dispose: typeof noop;
};
/**
* Validates whether the given object is a disposable
* @param {Object} Object to test whether it has a dispose method
* @returns {Boolean} true if a disposable object, else false.
*/
static isDisposable(d: any): boolean;
static _fixup(result: any): any;
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose.
* The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
static create(action: any): Disposable;
private isDisposed;
private action;
constructor(action: any);
/** Performs the task of cleaning up resources. */
dispose(): void;
}
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
export declare class CompositeDisposable {
private isDisposed;
private disposables;
constructor(...disposables: Disposable[]);
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Any} item Disposable to add.
*/
add(item: Disposable): void;
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Any} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
remove(item: Disposable): boolean;
/**
* Disposes all disposables in the group and removes them from the group but
* does not dispose the CompositeDisposable.
*/
clear(): void;
/**
* Disposes all disposables in the group and removes them from the group.
*/
dispose(): void;
}
/**
* Represents a disposable resource whose underlying disposable resource can
* be replaced by another disposable resource, causing automatic disposal of
* the previous underlying disposable resource.
*/
export declare class SerialDisposable {
private isDisposed;
private current;
/**
* Gets the underlying disposable.
* @returns {Any} the underlying disposable.
*/
getDisposable(): Disposable | undefined;
setDisposable(value: Disposable): void;
/** Performs the task of cleaning up resources. */
dispose(): void;
}
PK )U�\�[�$� � DragSource.d.tsnu �[��� import { SourceType } from 'dnd-core';
import { DndOptions } from '../interfaces';
import { DndComponentEnhancer, DragSourceSpec, DragSourceCollector } from './interfaces';
/**
* Decorates a component as a dragsource
* @param type The dragsource type
* @param spec The drag source specification
* @param collect The props collector function
* @param options DnD options
*/
export declare function DragSource<RequiredProps, CollectedProps = any, DragObject = any>(type: SourceType | ((props: RequiredProps) => SourceType), spec: DragSourceSpec<RequiredProps, DragObject>, collect: DragSourceCollector<CollectedProps, RequiredProps>, options?: DndOptions<RequiredProps>): DndComponentEnhancer<CollectedProps>;
PK )U�\"�� �
DropTarget.jsnu �[��� import { invariant } from '@react-dnd/invariant';
import { isPlainObject } from '../utils/js_utils';
import { registerTarget } from '../common/registration';
import { isValidType } from '../utils/isValidType';
import { TargetConnector } from '../common/TargetConnector';
import { DropTargetMonitorImpl } from '../common/DropTargetMonitorImpl';
import { checkDecoratorArguments } from './utils';
import { decorateHandler } from './decorateHandler';
import { createTargetFactory } from './createTargetFactory';
export function DropTarget(type, spec, collect, options = {}) {
checkDecoratorArguments('DropTarget', 'type, spec, collect[, options]', type, spec, collect, options);
let getType = type;
if (typeof type !== 'function') {
invariant(isValidType(type, true), 'Expected "type" provided as the first argument to DropTarget to be ' +
'a string, an array of strings, or a function that returns either given ' +
'the current props. Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', type);
getType = () => type;
}
invariant(isPlainObject(spec), 'Expected "spec" provided as the second argument to DropTarget to be ' +
'a plain object. Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', spec);
const createTarget = createTargetFactory(spec);
invariant(typeof collect === 'function', 'Expected "collect" provided as the third argument to DropTarget to be ' +
'a function that returns a plain object of props to inject. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
invariant(isPlainObject(options), 'Expected "options" provided as the fourth argument to DropTarget to be ' +
'a plain object when specified. ' +
'Instead, received %s. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target', collect);
return function decorateTarget(DecoratedComponent) {
return decorateHandler({
containerDisplayName: 'DropTarget',
createHandler: createTarget,
registerHandler: registerTarget,
createMonitor: (manager) => new DropTargetMonitorImpl(manager),
createConnector: (backend) => new TargetConnector(backend),
DecoratedComponent,
getType,
collect,
options,
});
};
}
PK )U�\�<�.� � decorateHandler.d.tsnu �[��� import * as React from 'react';
import { DragDropManager, Identifier } from 'dnd-core';
import { DndComponent } from './interfaces';
export interface DecorateHandlerArgs<Props, ItemIdType> {
DecoratedComponent: any;
createMonitor: (manager: DragDropManager) => HandlerReceiver;
createHandler: (monitor: HandlerReceiver, ref: React.RefObject<any>) => Handler<Props>;
createConnector: any;
registerHandler: any;
containerDisplayName: string;
getType: (props: Props) => ItemIdType;
collect: any;
options: any;
}
interface HandlerReceiver {
receiveHandlerId: (handlerId: Identifier | null) => void;
}
interface Handler<Props> {
ref: React.RefObject<any>;
receiveProps(props: Props): void;
}
export declare function decorateHandler<Props, CollectedProps, ItemIdType>({ DecoratedComponent, createHandler, createMonitor, createConnector, registerHandler, containerDisplayName, getType, collect, options, }: DecorateHandlerArgs<Props, ItemIdType>): DndComponent<Props>;
export {};
PK )U�\��@ d d decorateHandler.jsnu �[��� import * as React from 'react';
import { shallowEqual } from '@react-dnd/shallowequal';
import { invariant } from '@react-dnd/invariant';
import hoistStatics from 'hoist-non-react-statics';
import { DndContext } from '../common/DndContext';
import { isPlainObject } from '../utils/js_utils';
import { Disposable, CompositeDisposable, SerialDisposable, } from './disposables';
import { isRefable } from './utils';
export function decorateHandler({ DecoratedComponent, createHandler, createMonitor, createConnector, registerHandler, containerDisplayName, getType, collect, options, }) {
const { arePropsEqual = shallowEqual } = options;
const Decorated = DecoratedComponent;
const displayName = DecoratedComponent.displayName || DecoratedComponent.name || 'Component';
let DragDropContainer = /** @class */ (() => {
class DragDropContainer extends React.Component {
constructor(props) {
super(props);
this.decoratedRef = React.createRef();
this.handleChange = () => {
const nextState = this.getCurrentState();
if (!shallowEqual(nextState, this.state)) {
this.setState(nextState);
}
};
this.disposable = new SerialDisposable();
this.receiveProps(props);
this.dispose();
}
getHandlerId() {
return this.handlerId;
}
getDecoratedComponentInstance() {
invariant(this.decoratedRef.current, 'In order to access an instance of the decorated component, it must either be a class component or use React.forwardRef()');
return this.decoratedRef.current;
}
shouldComponentUpdate(nextProps, nextState) {
return (!arePropsEqual(nextProps, this.props) ||
!shallowEqual(nextState, this.state));
}
componentDidMount() {
this.disposable = new SerialDisposable();
this.currentType = undefined;
this.receiveProps(this.props);
this.handleChange();
}
componentDidUpdate(prevProps) {
if (!arePropsEqual(this.props, prevProps)) {
this.receiveProps(this.props);
this.handleChange();
}
}
componentWillUnmount() {
this.dispose();
}
receiveProps(props) {
if (!this.handler) {
return;
}
this.handler.receiveProps(props);
this.receiveType(getType(props));
}
receiveType(type) {
if (!this.handlerMonitor || !this.manager || !this.handlerConnector) {
return;
}
if (type === this.currentType) {
return;
}
this.currentType = type;
const [handlerId, unregister] = registerHandler(type, this.handler, this.manager);
this.handlerId = handlerId;
this.handlerMonitor.receiveHandlerId(handlerId);
this.handlerConnector.receiveHandlerId(handlerId);
const globalMonitor = this.manager.getMonitor();
const unsubscribe = globalMonitor.subscribeToStateChange(this.handleChange, { handlerIds: [handlerId] });
this.disposable.setDisposable(new CompositeDisposable(new Disposable(unsubscribe), new Disposable(unregister)));
}
dispose() {
this.disposable.dispose();
if (this.handlerConnector) {
this.handlerConnector.receiveHandlerId(null);
}
}
getCurrentState() {
if (!this.handlerConnector) {
return {};
}
const nextState = collect(this.handlerConnector.hooks, this.handlerMonitor, this.props);
if (process.env.NODE_ENV !== 'production') {
invariant(isPlainObject(nextState), 'Expected `collect` specified as the second argument to ' +
'%s for %s to return a plain object of props to inject. ' +
'Instead, received %s.', containerDisplayName, displayName, nextState);
}
return nextState;
}
render() {
return (React.createElement(DndContext.Consumer, null, ({ dragDropManager }) => {
this.receiveDragDropManager(dragDropManager);
if (typeof requestAnimationFrame !== 'undefined') {
requestAnimationFrame(() => this.handlerConnector?.reconnect());
}
return (React.createElement(Decorated, Object.assign({}, this.props, this.getCurrentState(), {
// NOTE: if Decorated is a Function Component, decoratedRef will not be populated unless it's a refforwarding component.
ref: isRefable(Decorated) ? this.decoratedRef : null })));
}));
}
receiveDragDropManager(dragDropManager) {
if (this.manager !== undefined) {
return;
}
invariant(dragDropManager !== undefined, 'Could not find the drag and drop manager in the context of %s. ' +
'Make sure to render a DndProvider component in your top-level component. ' +
'Read more: http://react-dnd.github.io/react-dnd/docs/troubleshooting#could-not-find-the-drag-and-drop-manager-in-the-context', displayName, displayName);
if (dragDropManager === undefined) {
return;
}
this.manager = dragDropManager;
this.handlerMonitor = createMonitor(dragDropManager);
this.handlerConnector = createConnector(dragDropManager.getBackend());
this.handler = createHandler(this.handlerMonitor, this.decoratedRef);
}
}
DragDropContainer.DecoratedComponent = DecoratedComponent;
DragDropContainer.displayName = `${containerDisplayName}(${displayName})`;
return DragDropContainer;
})();
return hoistStatics(DragDropContainer, DecoratedComponent);
}
PK )U�\낮 � createSourceFactory.d.tsnu �[��� import * as React from 'react';
import { DragSource } from 'dnd-core';
import { DragSourceMonitor } from '../interfaces';
import { DragSourceSpec } from './interfaces';
export interface Source extends DragSource {
receiveProps(props: any): void;
}
export declare function createSourceFactory<Props, DragObject = any>(spec: DragSourceSpec<Props, DragObject>): (monitor: DragSourceMonitor, ref: React.RefObject<any>) => Source;
PK )U�\|E��w w index.jsnu �[��� export * from './DragSource';
export * from './DropTarget';
export * from './DragLayer';
export * from './interfaces';
PK )U�\K��'