PHP 7.4.33
Preview: index.ts Size: 957 B
/var/www/uibuilder.cmshelp.dk/httpdocs/node_modules/react-dnd-html5-backend/src/NativeDragSources/index.ts
import { NativeDragSource } from './NativeDragSource.js'
import { nativeTypesConfig } from './nativeTypesConfig.js'

export function createNativeDragSource(
	type: string,
	dataTransfer?: DataTransfer,
): NativeDragSource {
	const config = nativeTypesConfig[type]
	if (!config) {
		throw new Error(`native type ${type} has no configuration`)
	}
	const result = new NativeDragSource(config)
	result.loadDataTransfer(dataTransfer)
	return result
}

export function matchNativeItemType(
	dataTransfer: DataTransfer | null,
): string | null {
	if (!dataTransfer) {
		return null
	}

	const dataTransferTypes = Array.prototype.slice.call(dataTransfer.types || [])
	return (
		Object.keys(nativeTypesConfig).filter((nativeItemType) => {
			const typeConfig = nativeTypesConfig[nativeItemType]
			if (!typeConfig?.matchesTypes) {
				return false
			}
			return typeConfig.matchesTypes.some(
				(t) => dataTransferTypes.indexOf(t) > -1,
			)
		})[0] || null
	)
}

Directory Contents

Dirs: 0 × Files: 4
Name Size Perms Modified Actions
300 B lrw-r--r-- 2025-03-28 11:04:37
Edit Download
957 B lrw-r--r-- 2025-03-28 11:04:37
Edit Download
1.54 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
1.69 KB lrw-r--r-- 2025-03-28 11:04:37
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).