mirror of
https://github.com/zen-browser/plugin.git
synced 2025-07-08 01:10:10 +02:00
Merge 62defc15ee
into 2561cfb10d
This commit is contained in:
commit
c6fde6dfff
6 changed files with 36 additions and 19 deletions
2
.github/FUNDING.yml
vendored
Normal file
2
.github/FUNDING.yml
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
patreon: zen_browser
|
||||
ko_fi: zen_browser
|
6
.github/dependabot.yml
vendored
Normal file
6
.github/dependabot.yml
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "npm"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "daily"
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2024 Zen Browser
|
||||
Copyright (c) 2025 Zen Browser
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
# plugin
|
||||
📦 A plugin library interface for typescript projects
|
||||
# Plugin Library Interface
|
||||
|
||||
📦 A plugin library interface for TypeScript projects.
|
||||
|
|
38
lib/main.d.ts
vendored
38
lib/main.d.ts
vendored
|
@ -1,4 +1,3 @@
|
|||
|
||||
export interface IZenPlugin {
|
||||
name: string;
|
||||
version: string;
|
||||
|
@ -37,23 +36,31 @@ export interface ISandboxedTab {
|
|||
readonly isSelected: boolean;
|
||||
}
|
||||
|
||||
export type IPluginEventKey = "onInit" | "onUnload" | "onTabChange" | "onTabClose"
|
||||
| "onTabOpen" | "onWorkspaceChange" | "onWorkspaceClose"
|
||||
| "onWorkspaceOpen" | "onPreferencesChange";
|
||||
export type IPluginEventKey =
|
||||
| "onInit"
|
||||
| "onUnload"
|
||||
| "onTabChange"
|
||||
| "onTabClose"
|
||||
| "onTabOpen"
|
||||
| "onWorkspaceChange"
|
||||
| "onWorkspaceClose"
|
||||
| "onWorkspaceOpen"
|
||||
| "onPreferencesChange";
|
||||
|
||||
export type IPluginEventProps<T extends IPluginEventKey> =
|
||||
T extends "onInit" ? { }
|
||||
: T extends "onUnload" ? { }
|
||||
: T extends "onTabChange" ? { tabId: string }
|
||||
: T extends "onTabClose" ? { tabId: string }
|
||||
: T extends "onTabOpen" ? { tabId: string }
|
||||
: T extends "onWorkspaceChange" ? { workspace: IWorkspace }
|
||||
: T extends "onWorkspaceClose" ? { workspace: IWorkspace }
|
||||
: T extends "onWorkspaceOpen" ? { workspace: IWorkspace }
|
||||
: T extends "onPreferencesChange" ? { settings: IPluginSettings }
|
||||
: never;
|
||||
export type IPluginEventProps<T extends IPluginEventKey> =
|
||||
T extends "onInit" ? {} :
|
||||
T extends "onUnload" ? {} :
|
||||
T extends "onTabChange" ? { tabId: string } :
|
||||
T extends "onTabClose" ? { tabId: string } :
|
||||
T extends "onTabOpen" ? { tabId: string } :
|
||||
T extends "onWorkspaceChange" ? { workspace: IWorkspace } :
|
||||
T extends "onWorkspaceClose" ? { workspace: IWorkspace } :
|
||||
T extends "onWorkspaceOpen" ? { workspace: IWorkspace } :
|
||||
T extends "onPreferencesChange" ? { settings: IPluginSettings } :
|
||||
never;
|
||||
|
||||
export type IPluginEvent<T extends IPluginEventKey> = (props: IPluginEventProps<T>) => void;
|
||||
|
||||
export type IPluginEvents = {
|
||||
[K in IPluginEventKey]?: IPluginEvent<K>;
|
||||
};
|
||||
|
@ -69,6 +76,7 @@ export type IPluginContextMenu = {
|
|||
};
|
||||
|
||||
export type IPluginSettings = IPluginSetting[];
|
||||
|
||||
export default IZenPlugin;
|
||||
|
||||
// API
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "plugin",
|
||||
"version": "1.0.0",
|
||||
"description": "📦 A plugin library interface for typescript projects",
|
||||
"description": "📦 A plugin library interface for TypeScript projects",
|
||||
"types": "./lib/main.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue