/** * Helper functions related to path manipulation. * * @namespace PathUtils */ export declare class PathUtils { /** * Returns if the code executes in the browser context or not by checking for the * existance of the window object * * @returns {Boolean} the result of the check of the existance of the window object */ static isBrowser(): boolean; /** * Returns the context path of the given location. * If no location is provided, it fallbacks to the current location. * @param {String} [location] - Location to be used to detect the context path from. * @returns {String} */ static getContextPath(location?: string | null): string; /** * Adapts the provided path to a valid model path. * Returns an empty string if the given path is equal to the root model path. * This function is a utility tool that converts a provided root model path into an internal specific empty path * * @param {string} [path] - raw model path * @return {string} the valid model path * * @private */ static adaptPagePath(path: string, rootPath?: string): string; /** * Returns the given URL externalized by adding the optional context path * * @param {string} url - URL to externalize * @returns {string} */ static externalize(url: string): string; /** * Returns the given URL internalized by removing the optional context path * * @param {string|null} url - URL to internalize * @returns {string} */ static internalize(url: string | null): string; /** * Returns the value of the meta property with the given key * * @param {string} propertyName - name of the meta property * @return {string|null} */ static getMetaPropertyValue(propertyName: string): string | null; /** * Returns a model path for the given URL * * @param {string} url - Raw URL for which to get a model URL * @return {string|undefined} */ static convertToModelUrl(url: string): string | undefined; /** * Returns the model URL as contained in the current page URL * * @return {string|null} */ static getCurrentPageModelUrl(): string | null; /** * Returns the URL of the page model to initialize the page model manager with. * It is either derived from a meta tag property called 'cq:pagemodel_root_url' or from the given location. * If no location is provided, it derives it from the current location. * * @param {String} [url] - path or URL to be used to derive the page model URL from * @returns {String} */ static getModelUrl(url?: string): string | null | undefined; /** * Returns the given path after sanitizing it. * This function should be called on page paths before storing them in the page model, * to make sure only properly formatted paths (e.g., "/content/mypage") are stored. * @param {string} path - Path of the page to be sanitized. * @return {string} */ static sanitize(path: string | null): string | null | undefined; /** * Returns the given path extended with the given extension. * @param {String} path - Path to be extended. * @param {String} extension - Extension to be added. * @returns {String} */ static addExtension(path: string, extension: string): string; /** * Returns the given path extended with the given selector. * @param {String} path - Path to be extended. * @param {String} selector - Selector to be added. * @returns {String} */ static addSelector(path: string, selector: string): string; /** * Returns the current location as a string. * @returns {String} */ static getCurrentPathname(): string | null; /** * Dispatches a custom event on the window object, when in the browser context. * * @param {String} eventName - the name of the custom event * @param {Object} options - the custom event options */ static dispatchGlobalCustomEvent(eventName: string, options: any): void; /** * Joins given path segments into a string using slash. * * @param paths * @returns {string} */ static join(paths?: string[]): string; /** * Normalizes given path by replacing repeated slash with a single one. * * @param {string} path * @returns {string} */ static normalize(path?: string): string; /** * Returns path that starts with slash. * * @param {string} path * @returns {string} */ static makeAbsolute(path?: string): string; /** * Returns path without the leading slash. * * @param path * @returns {string} */ static makeRelative(path?: string): string; /** * Returns path to the direct parent * * @param path * @returns {string|null} */ static getParentNodePath(path: string | null): string | null; /** * Checks if given path is an JCR path * * @param path * @returns {boolean} */ static isItem(path: string): boolean; /** * Returns the name of the last node of the given path * @param {string} path * @returns {string|null} */ static getNodeName(path: string): string | null; /** * Returns the subpath of the targetPath relative to the rootPath, * or the targetPath if the rootPath is not a root of the targetPath. * * @param targetPath * @param rootPath * @returns {*} */ static subpath(targetPath?: string, rootPath?: string): string; /** * Returns an array of segments of the path, split by the custom set of delimitators passed as an array. * * @param {string} path * @param {array} delimitators * @returns {*} */ static splitByDelimitators(path: string, delimitators: string[]): string[]; /** * Returns an JCR path based on pagePath and dataPath * * @param pagePath path to the page * @param dataPath path to the item on the page * @returns {string} */ static _getJCRPath(pagePath: string, dataPath: string): string; /** * Returns object containing pagePath (path to a page) and, if exists, itemPath (path to the item on that page) * from the passed path * * @param {string} path * @returns {{pagePath}} */ static splitPageContentPaths(path: string): { itemPath?: string; pagePath: string; } | undefined; /** * Returns path that is no longer prefixed nor suffixed by the set of strings passed as an array * * @param path * @param {array} strings * @returns {*} */ static trimStrings(path: string, strings: string[]): string; static _getStartStrings(path: string, strings: string[]): string; } //# sourceMappingURL=PathUtils.d.ts.map