amis-rpc-design/node_modules/react-router-dom/dist/react-router-dom.development.js.map

1 line
88 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"file":"react-router-dom.development.js","sources":["../dom.ts","../index.tsx"],"sourcesContent":["import type {\n FormEncType,\n HTMLFormMethod,\n RelativeRoutingType,\n} from \"@remix-run/router\";\nimport { stripBasename, UNSAFE_warning as warning } from \"@remix-run/router\";\n\nexport const defaultMethod: HTMLFormMethod = \"get\";\nconst defaultEncType: FormEncType = \"application/x-www-form-urlencoded\";\n\nexport function isHtmlElement(object: any): object is HTMLElement {\n return object != null && typeof object.tagName === \"string\";\n}\n\nexport function isButtonElement(object: any): object is HTMLButtonElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"button\";\n}\n\nexport function isFormElement(object: any): object is HTMLFormElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"form\";\n}\n\nexport function isInputElement(object: any): object is HTMLInputElement {\n return isHtmlElement(object) && object.tagName.toLowerCase() === \"input\";\n}\n\ntype LimitedMouseEvent = Pick<\n MouseEvent,\n \"button\" | \"metaKey\" | \"altKey\" | \"ctrlKey\" | \"shiftKey\"\n>;\n\nfunction isModifiedEvent(event: LimitedMouseEvent) {\n return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);\n}\n\nexport function shouldProcessLinkClick(\n event: LimitedMouseEvent,\n target?: string\n) {\n return (\n event.button === 0 && // Ignore everything but left clicks\n (!target || target === \"_self\") && // Let browser handle \"target=_blank\" etc.\n !isModifiedEvent(event) // Ignore clicks with modifier keys\n );\n}\n\nexport type ParamKeyValuePair = [string, string];\n\nexport type URLSearchParamsInit =\n | string\n | ParamKeyValuePair[]\n | Record<string, string | string[]>\n | URLSearchParams;\n\n/**\n * Creates a URLSearchParams object using the given initializer.\n *\n * This is identical to `new URLSearchParams(init)` except it also\n * supports arrays as values in the object form of the initializer\n * instead of just strings. This is convenient when you need multiple\n * values for a given key, but don't want to use an array initializer.\n *\n * For example, instead of:\n *\n * let searchParams = new URLSearchParams([\n * ['sort', 'name'],\n * ['sort', 'price']\n * ]);\n *\n * you can do:\n *\n * let searchParams = createSearchParams({\n * sort: ['name', 'price']\n * });\n */\nexport function createSearchParams(\n init: URLSearchParamsInit = \"\"\n): URLSearchParams {\n return new URLSearchParams(\n typeof init === \"string\" ||\n Array.isArray(init) ||\n init instanceof URLSearchParams\n ? init\n : Object.keys(init).reduce((memo, key) => {\n let value = init[key];\n return memo.concat(\n Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]\n );\n }, [] as ParamKeyValuePair[])\n );\n}\n\nexport function getSearchParamsForLocation(\n locationSearch: string,\n defaultSearchParams: URLSearchParams | null\n) {\n let searchParams = createSearchParams(locationSearch);\n\n if (defaultSearchParams) {\n // Use `defaultSearchParams.forEach(...)` here instead of iterating of\n // `defaultSearchParams.keys()` to work-around a bug in Firefox related to\n // web extensions. Relevant Bugzilla tickets:\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1414602\n // https://bugzilla.mozilla.org/show_bug.cgi?id=1023984\n defaultSearchParams.forEach((_, key) => {\n if (!searchParams.has(key)) {\n defaultSearchParams.getAll(key).forEach((value) => {\n searchParams.append(key, value);\n });\n }\n });\n }\n\n return searchParams;\n}\n\n// Thanks https://github.com/sindresorhus/type-fest!\ntype JsonObject = { [Key in string]: JsonValue } & {\n [Key in string]?: JsonValue | undefined;\n};\ntype JsonArray = JsonValue[] | readonly JsonValue[];\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonObject | JsonArray;\n\nexport type SubmitT