planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
import { Action } from '../interfaces';
export declare type State = string[];
export interface DirtyHandlerIdPayload {
targetIds: string[];
prevTargetIds: string[];
}
export declare function reduce(_state: State | undefined, action: Action<DirtyHandlerIdPayload>): State;

43
node_modules/dnd-core/lib/reducers/dirtyHandlerIds.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP, } from '../actions/dragDrop';
import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET, } from '../actions/registry';
import { areArraysEqual } from '../utils/equality';
import { NONE, ALL } from '../utils/dirtiness';
import { xor } from '../utils/js_utils';
export function reduce(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_state = NONE, action) {
switch (action.type) {
case HOVER:
break;
case ADD_SOURCE:
case ADD_TARGET:
case REMOVE_TARGET:
case REMOVE_SOURCE:
return NONE;
case BEGIN_DRAG:
case PUBLISH_DRAG_SOURCE:
case END_DRAG:
case DROP:
default:
return ALL;
}
const { targetIds = [], prevTargetIds = [] } = action.payload;
const result = xor(targetIds, prevTargetIds);
const didChange = result.length > 0 || !areArraysEqual(targetIds, prevTargetIds);
if (!didChange) {
return NONE;
}
// Check the target ids at the innermost position. If they are valid, add them
// to the result
const prevInnermostTargetId = prevTargetIds[prevTargetIds.length - 1];
const innermostTargetId = targetIds[targetIds.length - 1];
if (prevInnermostTargetId !== innermostTargetId) {
if (prevInnermostTargetId) {
result.push(prevInnermostTargetId);
}
if (innermostTargetId) {
result.push(innermostTargetId);
}
}
return result;
}

10
node_modules/dnd-core/lib/reducers/dragOffset.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { XYCoord, Action } from '../interfaces';
export interface State {
initialSourceClientOffset: XYCoord | null;
initialClientOffset: XYCoord | null;
clientOffset: XYCoord | null;
}
export declare function reduce(state: State | undefined, action: Action<{
sourceClientOffset: XYCoord;
clientOffset: XYCoord;
}>): State;

32
node_modules/dnd-core/lib/reducers/dragOffset.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
import { INIT_COORDS, BEGIN_DRAG, HOVER, END_DRAG, DROP, } from '../actions/dragDrop';
import { areCoordsEqual } from '../utils/equality';
const initialState = {
initialSourceClientOffset: null,
initialClientOffset: null,
clientOffset: null,
};
export function reduce(state = initialState, action) {
const { payload } = action;
switch (action.type) {
case INIT_COORDS:
case BEGIN_DRAG:
return {
initialSourceClientOffset: payload.sourceClientOffset,
initialClientOffset: payload.clientOffset,
clientOffset: payload.clientOffset,
};
case HOVER:
if (areCoordsEqual(state.clientOffset, payload.clientOffset)) {
return state;
}
return {
...state,
clientOffset: payload.clientOffset,
};
case END_DRAG:
case DROP:
return initialState;
default:
return state;
}
}

19
node_modules/dnd-core/lib/reducers/dragOperation.d.ts generated vendored Normal file
View File

@@ -0,0 +1,19 @@
import { Identifier, Action } from '../interfaces';
export interface State {
itemType: Identifier | Identifier[] | null;
item: any;
sourceId: string | null;
targetIds: string[];
dropResult: any;
didDrop: boolean;
isSourcePublic: boolean | null;
}
export declare function reduce(state: State | undefined, action: Action<{
itemType: Identifier | Identifier[];
item: any;
sourceId: string;
targetId: string;
targetIds: string[];
isSourcePublic: boolean;
dropResult: any;
}>): State;

65
node_modules/dnd-core/lib/reducers/dragOperation.js generated vendored Normal file
View File

@@ -0,0 +1,65 @@
import { BEGIN_DRAG, PUBLISH_DRAG_SOURCE, HOVER, END_DRAG, DROP, } from '../actions/dragDrop';
import { REMOVE_TARGET } from '../actions/registry';
import { without } from '../utils/js_utils';
const initialState = {
itemType: null,
item: null,
sourceId: null,
targetIds: [],
dropResult: null,
didDrop: false,
isSourcePublic: null,
};
export function reduce(state = initialState, action) {
const { payload } = action;
switch (action.type) {
case BEGIN_DRAG:
return {
...state,
itemType: payload.itemType,
item: payload.item,
sourceId: payload.sourceId,
isSourcePublic: payload.isSourcePublic,
dropResult: null,
didDrop: false,
};
case PUBLISH_DRAG_SOURCE:
return {
...state,
isSourcePublic: true,
};
case HOVER:
return {
...state,
targetIds: payload.targetIds,
};
case REMOVE_TARGET:
if (state.targetIds.indexOf(payload.targetId) === -1) {
return state;
}
return {
...state,
targetIds: without(state.targetIds, payload.targetId),
};
case DROP:
return {
...state,
dropResult: payload.dropResult,
didDrop: true,
targetIds: [],
};
case END_DRAG:
return {
...state,
itemType: null,
item: null,
sourceId: null,
dropResult: null,
didDrop: false,
isSourcePublic: null,
targetIds: [],
};
default:
return state;
}
}

14
node_modules/dnd-core/lib/reducers/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import { State as DragOffsetState } from './dragOffset';
import { State as DragOperationState } from './dragOperation';
import { State as RefCountState } from './refCount';
import { State as DirtyHandlerIdsState } from './dirtyHandlerIds';
import { State as StateIdState } from './stateId';
import { Action } from '../interfaces';
export interface State {
dirtyHandlerIds: DirtyHandlerIdsState;
dragOffset: DragOffsetState;
refCount: RefCountState;
dragOperation: DragOperationState;
stateId: StateIdState;
}
export declare function reduce(state: State | undefined, action: Action<any>): State;

21
node_modules/dnd-core/lib/reducers/index.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import { reduce as dragOffset } from './dragOffset';
import { reduce as dragOperation, } from './dragOperation';
import { reduce as refCount } from './refCount';
import { reduce as dirtyHandlerIds, } from './dirtyHandlerIds';
import { reduce as stateId } from './stateId';
import { get } from '../utils/js_utils';
export function reduce(state = {}, action) {
return {
dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {
type: action.type,
payload: {
...action.payload,
prevTargetIds: get(state, 'dragOperation.targetIds', []),
},
}),
dragOffset: dragOffset(state.dragOffset, action),
refCount: refCount(state.refCount, action),
dragOperation: dragOperation(state.dragOperation, action),
stateId: stateId(state.stateId),
};
}

3
node_modules/dnd-core/lib/reducers/refCount.d.ts generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import { Action } from '../interfaces';
export declare type State = number;
export declare function reduce(state: number | undefined, action: Action<any>): State;

13
node_modules/dnd-core/lib/reducers/refCount.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { ADD_SOURCE, ADD_TARGET, REMOVE_SOURCE, REMOVE_TARGET, } from '../actions/registry';
export function reduce(state = 0, action) {
switch (action.type) {
case ADD_SOURCE:
case ADD_TARGET:
return state + 1;
case REMOVE_SOURCE:
case REMOVE_TARGET:
return state - 1;
default:
return state;
}
}

2
node_modules/dnd-core/lib/reducers/stateId.d.ts generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export declare type State = number;
export declare function reduce(state?: State): State;

3
node_modules/dnd-core/lib/reducers/stateId.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
export function reduce(state = 0) {
return state + 1;
}