Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Do not depend on vue or vue-router for the public interface of OC.Files.Router #255

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 51 additions & 39 deletions lib/v27/OC.d.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,58 @@
import type { Route } from 'vue-router'

declare global {
namespace Nextcloud.v27 {
interface FilesRouter {
/**
* Trigger a route change on the files app
*
* @param path the url path, eg: '/trashbin?dir=/Deleted'
* @param replace replace the current history (default false)
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goTo(path: string, replace?: boolean): Promise<Route>;

/**
* Trigger a route change on the files App
*
* @param name the route name
* @param params the route parameters
* @param query the url query parameters
* @param replace replace the current history
* @see https://router.vuejs.org/guide/essentials/navigation.html#navigate-to-a-different-location
*/
goToRoute(
name?: string,
params?: Record<string, string>,
query?: Record<string, string | (string | null)[] | null | undefined>,
replace?: boolean,
): Promise<Route>;
}
declare namespace Nextcloud.v27 {
type Dictionary<T> = { [index: string]: T }

interface OC extends Nextcloud.v26.OC {
interface Vue2RouteMeta extends Record<string | number | symbol, any> {}

}
interface Vue2Route {
path: string
name?: string | null
hash: string
query: Dictionary<string | (string | null)[]>
params: Dictionary<string>
fullPath: string
matched: any[]
redirectedFrom?: string
meta?: Vue2RouteMeta
}

interface OCP extends Omit<Nextcloud.v26.OCP, 'Files'> {
Files: {
Router: FilesRouter
}
}
interface FilesRouter {
/**
* Trigger a route change on the files app
*
* @param path the url path, eg: '/trashbin?dir=/Deleted'
* @param replace replace the current history (default false)
* @see https://v3.router.vuejs.org/guide/essentials/navigation.html
*/
goTo(path: string, replace?: boolean): Promise<Vue2Route>;

/**
* Trigger a route change on the files App
*
* @param name the route name
* @param params the route parameters
* @param query the url query parameters
* @param replace replace the current history
* @see https://v3.router.vuejs.org/guide/essentials/navigation.html
*/
goToRoute(
name?: string,
params?: Record<string, string>,
query?: Record<string, string | (string | null)[] | null | undefined>,
replace?: boolean,
): Promise<Vue2Route>;
}

interface WindowWithGlobals extends Nextcloud.Common.DayMonthConstants, Window {
interface OC extends Nextcloud.v26.OC {

}

interface OCP extends Omit<Nextcloud.v26.OCP, 'Files'> {
Files: {
Router: FilesRouter
}
}
}

interface WindowWithGlobals extends Nextcloud.Common.DayMonthConstants, Window {

}
}
92 changes: 3 additions & 89 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"url": "https://github.com/nextcloud/nextcloud-typings"
},
"dependencies": {
"@types/jquery": "3.5.16",
"vue": "^2.7.15",
"vue-router": "<4"
"@types/jquery": "3.5.16"
},
"devDependencies": {
"babel-jest": "^29.5.0",