Add yet-another-react-lightbox package and update .gitignore to exclude node_modules
This commit is contained in:
70
frontend/node_modules/dnd-core/src/reducers/dirtyHandlerIds.ts
generated
vendored
70
frontend/node_modules/dnd-core/src/reducers/dirtyHandlerIds.ts
generated
vendored
@@ -1,70 +0,0 @@
|
||||
import {
|
||||
BEGIN_DRAG,
|
||||
DROP,
|
||||
END_DRAG,
|
||||
HOVER,
|
||||
PUBLISH_DRAG_SOURCE,
|
||||
} from '../actions/dragDrop/index.js'
|
||||
import {
|
||||
ADD_SOURCE,
|
||||
ADD_TARGET,
|
||||
REMOVE_SOURCE,
|
||||
REMOVE_TARGET,
|
||||
} from '../actions/registry.js'
|
||||
import type { Action } from '../interfaces.js'
|
||||
import { ALL, NONE } from '../utils/dirtiness.js'
|
||||
import { areArraysEqual } from '../utils/equality.js'
|
||||
import { xor } from '../utils/js_utils.js'
|
||||
|
||||
export type State = string[]
|
||||
|
||||
export interface DirtyHandlerIdPayload {
|
||||
targetIds: string[]
|
||||
prevTargetIds: string[]
|
||||
}
|
||||
|
||||
export function reduce(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
_state: State = NONE,
|
||||
action: Action<DirtyHandlerIdPayload>,
|
||||
): State {
|
||||
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
|
||||
}
|
||||
53
frontend/node_modules/dnd-core/src/reducers/dragOffset.ts
generated
vendored
53
frontend/node_modules/dnd-core/src/reducers/dragOffset.ts
generated
vendored
@@ -1,53 +0,0 @@
|
||||
import {
|
||||
BEGIN_DRAG,
|
||||
DROP,
|
||||
END_DRAG,
|
||||
HOVER,
|
||||
INIT_COORDS,
|
||||
} from '../actions/dragDrop/index.js'
|
||||
import type { Action, XYCoord } from '../interfaces.js'
|
||||
import { areCoordsEqual } from '../utils/equality.js'
|
||||
|
||||
export interface State {
|
||||
initialSourceClientOffset: XYCoord | null
|
||||
initialClientOffset: XYCoord | null
|
||||
clientOffset: XYCoord | null
|
||||
}
|
||||
|
||||
const initialState: State = {
|
||||
initialSourceClientOffset: null,
|
||||
initialClientOffset: null,
|
||||
clientOffset: null,
|
||||
}
|
||||
|
||||
export function reduce(
|
||||
state: State = initialState,
|
||||
action: Action<{
|
||||
sourceClientOffset: XYCoord
|
||||
clientOffset: XYCoord
|
||||
}>,
|
||||
): State {
|
||||
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
|
||||
}
|
||||
}
|
||||
95
frontend/node_modules/dnd-core/src/reducers/dragOperation.ts
generated
vendored
95
frontend/node_modules/dnd-core/src/reducers/dragOperation.ts
generated
vendored
@@ -1,95 +0,0 @@
|
||||
import {
|
||||
BEGIN_DRAG,
|
||||
DROP,
|
||||
END_DRAG,
|
||||
HOVER,
|
||||
PUBLISH_DRAG_SOURCE,
|
||||
} from '../actions/dragDrop/index.js'
|
||||
import { REMOVE_TARGET } from '../actions/registry.js'
|
||||
import type { Action, Identifier } from '../interfaces.js'
|
||||
import { without } from '../utils/js_utils.js'
|
||||
|
||||
export interface State {
|
||||
itemType: Identifier | Identifier[] | null
|
||||
item: any
|
||||
sourceId: string | null
|
||||
targetIds: string[]
|
||||
dropResult: any
|
||||
didDrop: boolean
|
||||
isSourcePublic: boolean | null
|
||||
}
|
||||
|
||||
const initialState: State = {
|
||||
itemType: null,
|
||||
item: null,
|
||||
sourceId: null,
|
||||
targetIds: [],
|
||||
dropResult: null,
|
||||
didDrop: false,
|
||||
isSourcePublic: null,
|
||||
}
|
||||
|
||||
export function reduce(
|
||||
state: State = initialState,
|
||||
action: Action<{
|
||||
itemType: Identifier | Identifier[]
|
||||
item: any
|
||||
sourceId: string
|
||||
targetId: string
|
||||
targetIds: string[]
|
||||
isSourcePublic: boolean
|
||||
dropResult: any
|
||||
}>,
|
||||
): State {
|
||||
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
|
||||
}
|
||||
}
|
||||
36
frontend/node_modules/dnd-core/src/reducers/index.ts
generated
vendored
36
frontend/node_modules/dnd-core/src/reducers/index.ts
generated
vendored
@@ -1,36 +0,0 @@
|
||||
import type { Action } from '../interfaces.js'
|
||||
import { get } from '../utils/js_utils.js'
|
||||
import type { State as DirtyHandlerIdsState } from './dirtyHandlerIds.js'
|
||||
import { reduce as dirtyHandlerIds } from './dirtyHandlerIds.js'
|
||||
import type { State as DragOffsetState } from './dragOffset.js'
|
||||
import { reduce as dragOffset } from './dragOffset.js'
|
||||
import type { State as DragOperationState } from './dragOperation.js'
|
||||
import { reduce as dragOperation } from './dragOperation.js'
|
||||
import type { State as RefCountState } from './refCount.js'
|
||||
import { reduce as refCount } from './refCount.js'
|
||||
import type { State as StateIdState } from './stateId.js'
|
||||
import { reduce as stateId } from './stateId.js'
|
||||
|
||||
export interface State {
|
||||
dirtyHandlerIds: DirtyHandlerIdsState
|
||||
dragOffset: DragOffsetState
|
||||
refCount: RefCountState
|
||||
dragOperation: DragOperationState
|
||||
stateId: StateIdState
|
||||
}
|
||||
|
||||
export function reduce(state: State = {} as State, action: Action<any>): State {
|
||||
return {
|
||||
dirtyHandlerIds: dirtyHandlerIds(state.dirtyHandlerIds, {
|
||||
type: action.type,
|
||||
payload: {
|
||||
...action.payload,
|
||||
prevTargetIds: get<string[]>(state, 'dragOperation.targetIds', []),
|
||||
},
|
||||
}),
|
||||
dragOffset: dragOffset(state.dragOffset, action),
|
||||
refCount: refCount(state.refCount, action),
|
||||
dragOperation: dragOperation(state.dragOperation, action),
|
||||
stateId: stateId(state.stateId),
|
||||
}
|
||||
}
|
||||
22
frontend/node_modules/dnd-core/src/reducers/refCount.ts
generated
vendored
22
frontend/node_modules/dnd-core/src/reducers/refCount.ts
generated
vendored
@@ -1,22 +0,0 @@
|
||||
import {
|
||||
ADD_SOURCE,
|
||||
ADD_TARGET,
|
||||
REMOVE_SOURCE,
|
||||
REMOVE_TARGET,
|
||||
} from '../actions/registry.js'
|
||||
import type { Action } from '../interfaces.js'
|
||||
|
||||
export type State = number
|
||||
|
||||
export function reduce(state: State = 0, action: Action<any>): State {
|
||||
switch (action.type) {
|
||||
case ADD_SOURCE:
|
||||
case ADD_TARGET:
|
||||
return state + 1
|
||||
case REMOVE_SOURCE:
|
||||
case REMOVE_TARGET:
|
||||
return state - 1
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
5
frontend/node_modules/dnd-core/src/reducers/stateId.ts
generated
vendored
5
frontend/node_modules/dnd-core/src/reducers/stateId.ts
generated
vendored
@@ -1,5 +0,0 @@
|
||||
export type State = number
|
||||
|
||||
export function reduce(state: State = 0): State {
|
||||
return state + 1
|
||||
}
|
||||
Reference in New Issue
Block a user