/** * Copyright 2026 - present Nazmul Hassan * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { T as Nullable, d as Deserializer, j as Serializer, ni as GenericObject } from "../index-Dx3yeNwR.cjs"; import { a as updateQueryParam, i as parseQueryStringLiteral, n as getQueryParams, r as parseQueryString, t as generateQueryParams } from "../query-IIeOYASv.cjs"; import { a as OriginFileObj, i as FormDataConfigs, o as ParsedFormData, r as FileUpload, s as SerializedForm, t as CustomFile } from "../form-B3njsSDG.cjs"; //#region src/dom/storage.d.ts /** * * Get item from local storage. * * @param key - Key to get item from local storage. * @param deserialize - Optional deserializer function to convert the stored value back to type `T`. Defaults to `JSON.parse`. * @returns Returns saved item from local storage if it exists with that key. */ declare function getFromLocalStorage(key: string, deserialize?: Deserializer): Nullable; /** * * Save item in local storage. * * @param key - Key to save an item. * @param value - The item/value to save. * @param serialize - Optional serializer function to convert the value of type `T` to a string. Defaults to `JSON.stringify`. */ declare function saveToLocalStorage(key: string, value: T, serialize?: Serializer): void; /** * * Remove item from local storage. * * @param key - Key to delete item from local storage. */ declare function removeFromLocalStorage(key: string): void; /** * * Get item from session storage. * * @param key - Key to get item from session storage. * @param deserialize - Optional deserializer function to convert the stored value back to type `T`. Defaults to `JSON.parse`. * @returns Returns saved item from session storage if it exists with that key. */ declare function getFromSessionStorage(key: string, deserialize?: Deserializer): Nullable; /** * * Save item in session storage. * * @param key - Key to save an item. * @param value - The item/value to save. * @param serialize - Optional serializer function to convert the value of type `T` to a string. Defaults to `JSON.stringify`. */ declare function saveToSessionStorage(key: string, value: T, serialize?: Serializer): void; /** * * Remove item from session storage. * * @param key - Key to delete item from session storage. */ declare function removeFromSessionStorage(key: string): void; //#endregion //#region src/dom/utils.d.ts /** * * Scrolls smoothly to the given element with an optional vertical offset. * @param element The target element to scroll to. * @param offset Additional vertical offset in pixels (positive moves down, negative moves up). */ declare function smoothScrollTo(element: HTMLElement, offset?: number): void; /** * * Toggles full-screen mode for a given element (or the `document` by default). * @param element The element to toggle fullscreen mode for (default: document root). */ declare function toggleFullScreen(element?: HTMLElement): void; /** * * Copies text to the clipboard, falling back to legacy methods if needed. * @param text - The text to copy. * @returns A promise that resolves when the text is copied. */ declare function copyToClipboard(text: string): Promise; //#endregion //#region src/form/convert.d.ts /** * * Utility to convert object into FormData in a controlled way. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * * @param data - The source object to control and convert to FormData. * @param configs - Configuration options to control the formData. * @returns `FormData` instance containing the sanitized and transformed data. */ declare const createFormData: (data: T, configs?: FormDataConfigs) => FormData; //#endregion //#region src/form/guards.d.ts /** * * Checks if a given value is a valid {@link FormData} & it's not empty. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * @param value - The value to check. * @returns `true` if the value is a valid {@link FormData} and not empty, otherwise `false`. */ declare function isValidFormData(value: unknown): value is FormData; /** * * Checks if a given value is an {@link OriginFileObj}. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * @param value - The value to check. * @returns `true` if the value is a valid {@link OriginFileObj}, otherwise `false`. */ declare function isOriginFileObj(value: unknown): value is OriginFileObj; /** * * Checks if a given value is a {@link CustomFile}. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * @param value - The value to check. * @returns `true` if the value is a valid {@link CustomFile}, otherwise `false`. */ declare function isCustomFile(value: unknown): value is CustomFile; /** * * Checks if a given value is an array of {@link CustomFile} objects. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * @param value - The value to check. * @returns `true` if the value is a valid `CustomFile[]`, otherwise `false`. */ declare function isCustomFileArray(value: unknown): value is CustomFile[]; /** * * Checks if a given value is an array of `File/Blob` objects. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * @param value - The value to check. * @returns `true` if the value is a valid `File[]` or `Blob[]`, otherwise `false`. */ declare function isFileArray(value: unknown): value is File[] | Blob[]; /** * * Checks if a given value is an instance of {@link FileList}. * @param value - The value to check. * @returns `true` if the value is a valid {@link FileList}, otherwise `false`. */ declare function isFileList(value: unknown): value is FileList; /** * * Checks if a given value is an instance of {@link File} or {@link Blob}. * @param value - The value to check. * @returns `true` if the value is an instance of {@link File} or {@link Blob}, otherwise `false`. */ declare function isFileOrBlob(value: unknown): value is File | Blob; /** * * Checks if a given value is a {@link FileUpload} object. * @param value - The value to check. * @returns `true` if the value is a valid {@link FileUpload}, otherwise `false`. */ declare function isFileUpload(value: unknown): value is FileUpload; //#endregion //#region src/form/transform.d.ts /** * * Serialize form data into an object or a query string. * - **N.B.** Be cautious when using this in SSR (Server-Side Rendering) environments (such as `Next.js` Server Components), as it may not work as expected. * * @param form - The form element to serialize. * @param toQueryString - Whether to return the result as a query string. If false, returns an object. * @returns The serialized form data as an object or query string. */ declare function serializeForm(form: HTMLFormElement, toQueryString?: T): SerializedForm; /** * * Parse form data from a `FormData` object or query string into a structured object format. * * @param data - The `FormData` object or query string to parse. * @param parsePrimitives - Whether to parse string values into primitive types (e.g., boolean, number, array, object). Defaults to `true`. * @returns The parsed form data as an object. */ declare function parseFormData(data: D, parsePrimitives?: P): ParsedFormData; //#endregion export { createFormData as convertToFormData, createFormData, copyToClipboard, generateQueryParams as createQueryParams, generateQueryParams as formatQueryParams, generateQueryParams, getFromLocalStorage, getFromSessionStorage, getQueryParams, parseQueryString as getQueryStringAsObject, parseQueryString, parseQueryString as queryStringToObject, isCustomFile, isCustomFileArray, isFileArray, isFileList, isFileOrBlob, isFileUpload, isOriginFileObj, isValidFormData, parseQueryStringLiteral as literalQueryStringToObject, parseQueryStringLiteral, parseFormData, removeFromLocalStorage, removeFromSessionStorage, saveToLocalStorage, saveToSessionStorage, serializeForm, smoothScrollTo, toggleFullScreen, updateQueryParam };