update to 1.1.0 #1
13
package.json
13
package.json
|
@ -13,20 +13,19 @@
|
|||
"type": "git",
|
||||
"url": "https://flaschengeist.dev/Flaschengeist/flaschengeist-typings"
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"typings": "types/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"valid": "tsc --noEmit",
|
||||
"pretty": "prettier --config ./package.json --write '{,!(node_modules)/**/}*.ts'"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^2.3.0",
|
||||
"typescript": "^4.2.4",
|
||||
"vue": "^3.0.11",
|
||||
"vue-router": "^4.0.8"
|
||||
"typescript": "^4.2.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"flaschengeist": "^2.0.0-alpha.1"
|
||||
"flaschengeist": "^2.0.0-alpha.1",
|
||||
"vue": "^3.0.11",
|
||||
"vue-router": "^4.0.8"
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true,
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/// <reference path="plugin.d.ts" />
|
||||
/// <reference path="flaschengeist.d.ts" />
|
|
@ -1 +0,0 @@
|
|||
/// <reference path="index.d.ts" />
|
|
@ -4,9 +4,8 @@
|
|||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"moduleResolution": "node"
|
||||
"moduleResolution": "Node"
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
/// <reference path="flaschengeist.d.ts" />
|
||||
|
||||
export * from "./plugin"
|
|
@ -1,18 +1,31 @@
|
|||
import { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
|
||||
import { Component } from 'vue';
|
||||
import type { RouteLocationRaw, RouteRecordRaw, RouteRecordName } from 'vue-router';
|
||||
import type { Component } from '@vue/runtime-core';
|
||||
|
||||
declare namespace FG_Plugin {
|
||||
type Join<T extends unknown[], D extends string> =
|
||||
T extends [] ? '' :
|
||||
T extends [string | number | boolean | bigint] ? `${T[0]}` :
|
||||
T extends [string | number | boolean | bigint, ...infer U] ? `${T[0]}${D}${Join<U, D>}` :
|
||||
string;
|
||||
type BVersion = Join<[number, number], '.'> | Join<[number, number, number], '.'>
|
||||
type Version = BVersion | Join<[BVersion, string], '-'>
|
||||
|
||||
export namespace FG_Plugin {
|
||||
/**
|
||||
* Interface defining a Flaschengeist plugin
|
||||
*/
|
||||
interface Plugin {
|
||||
export interface Plugin {
|
||||
/** Unique identifier for this plugin, we recommend using a FQN like com.example.my_plugin */
|
||||
id: string,
|
||||
/** Arbitrary name of the plugin used inside admin view etc */
|
||||
name: string;
|
||||
/** Version of this plugin, used for dependencies. MUST be semver parsable */
|
||||
version: string;
|
||||
/** Widgets provided by this plugin */
|
||||
widgets: Widget[];
|
||||
/** Pther frontend modules needed for this plugin to work correctly */
|
||||
requiredModules: string[];
|
||||
/** Other frontend modules needed for this plugin to work correctly */
|
||||
requiredModules: [string, Version?][];
|
||||
/** Backend modules needed for this plugin to work correctly */
|
||||
requiredBackendModules: string[];
|
||||
requiredBackendModules: [string, Version?][];
|
||||
/** Menu entries for authenticated users */
|
||||
innerRoutes?: MenuRoute[];
|
||||
/** Public menu entries (without authentification) */
|
||||
|
@ -26,7 +39,7 @@ declare namespace FG_Plugin {
|
|||
/**
|
||||
* Defines the loaded state of the Flaschengeist
|
||||
*/
|
||||
interface Flaschengeist {
|
||||
export interface Flaschengeist {
|
||||
/** All loaded plugins */
|
||||
plugins: LoadedPlugin[];
|
||||
/** All routes, combined from all plugins */
|
||||
|
@ -44,7 +57,7 @@ declare namespace FG_Plugin {
|
|||
/**
|
||||
* Interface for a frontend notification
|
||||
*/
|
||||
interface Notification extends FG.Notification {
|
||||
export interface Notification extends FG.Notification {
|
||||
/** If set a button for accepting will be shown, this function will get called before deleting the notification */
|
||||
accept?(): Promise<void>;
|
||||
/** If set this function is called before the notification gets deleted */
|
||||
|
@ -67,30 +80,30 @@ declare namespace FG_Plugin {
|
|||
/**
|
||||
* Defines a shortcut link
|
||||
*/
|
||||
interface Shortcut {
|
||||
export interface Shortcut {
|
||||
link: RouteRecordName;
|
||||
icon: string;
|
||||
permissions?: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a main menu entry along with the route
|
||||
* Used when defining a plugin
|
||||
*/
|
||||
interface MenuRoute extends MenuEntry {
|
||||
route: NamedRouteRecordRaw;
|
||||
shortcut?: boolean;
|
||||
children?: this[];
|
||||
}
|
||||
|
||||
type NamedRouteRecordRaw = RouteRecordRaw & {
|
||||
name: RouteRecordName;
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines a main menu entry along with the route
|
||||
* Used when defining a plugin
|
||||
*/
|
||||
export interface MenuRoute extends MenuEntry {
|
||||
route: NamedRouteRecordRaw;
|
||||
shortcut?: boolean;
|
||||
children?: this[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a menu entry in the main menu
|
||||
*/
|
||||
interface MenuLink extends MenuEntry {
|
||||
export interface MenuLink extends MenuEntry {
|
||||
/** Name of the target route */
|
||||
link: RouteRecordName;
|
||||
}
|
||||
|
@ -108,7 +121,7 @@ declare namespace FG_Plugin {
|
|||
/**
|
||||
* Widget object for the dashboard
|
||||
*/
|
||||
interface Widget {
|
||||
export interface Widget {
|
||||
name: string;
|
||||
priority: number;
|
||||
permissions: FG.Permission[];
|
Loading…
Reference in New Issue