UNPKG

react-aria

Version:
1 lines 3.47 kB
{"mappings":"AAAA;;;;;;;;;;CAUC,GAaM,IAAA,AAAK,mEAAA;;;;;;;WAAA;;AAgBL,MAAM,4CAA+C;IAC1D,GAAG,yCAAc;IACjB,UAAU;IACV,UAAU;IACV,UAAU;IACV,GAAG;IACH,aAAa;AACf;AAaO,MAAM,4CAAgC,6BAC3C;AAEF,yCAAc,GAAoB,GAAG,OAAO,0CAA0C;AAI/E,MAAM,4CAAoE;IAC/E,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;AACR;AAEO,MAAM,4CAAoE,6BAC/E;AAGF,SAAS,6BACP,MAAoB;IAEpB,IAAI,MAAoB,CAAC;IACzB,IAAK,IAAI,OAAO,OACd,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG;IAGrB,OAAO;AACT;AAEO,MAAM,4CAAiC,IAAI,IAAI;IAAC;IAAc;IAAiB;CAAY;AAC3F,MAAM,4CAAmB;AACzB,MAAM,4CAAe","sources":["packages/react-aria/src/dnd/constants.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {DropOperation} from '@react-types/shared';\n\nexport interface IDropOperation {\n readonly none: 0;\n readonly cancel: 0;\n readonly move: number;\n readonly copy: number;\n readonly link: number;\n readonly all: number;\n}\n\nexport enum DROP_OPERATION {\n none = 0,\n cancel = 0,\n move = 1 << 0,\n copy = 1 << 1,\n link = 1 << 2,\n all = move | copy | link\n}\ninterface DropOperationAllowed extends IDropOperation {\n readonly copyMove: number;\n readonly copyLink: number;\n readonly linkMove: number;\n readonly all: number;\n readonly uninitialized: number;\n}\n// See https://developer.mozilla.org/en-US/docs/Web/API/DataTransfer/effectAllowed\nexport const DROP_OPERATION_ALLOWED: DropOperationAllowed = {\n ...DROP_OPERATION,\n copyMove: DROP_OPERATION.copy | DROP_OPERATION.move,\n copyLink: DROP_OPERATION.copy | DROP_OPERATION.link,\n linkMove: DROP_OPERATION.link | DROP_OPERATION.move,\n all: DROP_OPERATION.all,\n uninitialized: DROP_OPERATION.all\n};\n\ninterface EffectAllowed {\n 0: 'none' | 'cancel';\n 1: 'move';\n 2: 'copy';\n 3: 'copyMove';\n 4: 'link';\n 5: 'linkMove';\n 6: 'copyLink';\n 7: 'all';\n}\n\nexport const EFFECT_ALLOWED: EffectAllowed = invert(\n DROP_OPERATION_ALLOWED\n) as unknown as EffectAllowed;\nEFFECT_ALLOWED[DROP_OPERATION.all] = 'all'; // ensure we don't map to 'uninitialized'.\n\ntype DropEffect = 'none' | 'link' | 'copy' | 'move';\n\nexport const DROP_EFFECT_TO_DROP_OPERATION: {[K in DropEffect]: DropOperation} = {\n none: 'cancel',\n link: 'link',\n copy: 'copy',\n move: 'move'\n};\n\nexport const DROP_OPERATION_TO_DROP_EFFECT: {[K in DropOperation]: DropEffect} = invert(\n DROP_EFFECT_TO_DROP_OPERATION\n);\n\nfunction invert<T extends string | number, C extends string | number>(\n object: Record<T, C>\n): Record<C, T> {\n let res: Record<C, T> = {} as Record<C, T>;\n for (let key in object) {\n res[object[key]] = key as T;\n }\n\n return res;\n}\n\nexport const NATIVE_DRAG_TYPES: Set<string> = new Set(['text/plain', 'text/uri-list', 'text/html']);\nexport const CUSTOM_DRAG_TYPE = 'application/vnd.react-aria.items+json';\nexport const GENERIC_TYPE = 'application/octet-stream';\n"],"names":[],"version":3,"file":"constants.mjs.map"}