This commit is contained in:
blu3 2025-02-07 13:03:05 +03:00 committed by GitHub
commit c6fde6dfff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 36 additions and 19 deletions

2
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,2 @@
patreon: zen_browser
ko_fi: zen_browser

6
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

View file

@ -1,6 +1,6 @@
MIT License 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View file

@ -1,2 +1,3 @@
# plugin # Plugin Library Interface
📦 A plugin library interface for typescript projects
📦 A plugin library interface for TypeScript projects.

38
lib/main.d.ts vendored
View file

@ -1,4 +1,3 @@
export interface IZenPlugin { export interface IZenPlugin {
name: string; name: string;
version: string; version: string;
@ -37,23 +36,31 @@ export interface ISandboxedTab {
readonly isSelected: boolean; readonly isSelected: boolean;
} }
export type IPluginEventKey = "onInit" | "onUnload" | "onTabChange" | "onTabClose" export type IPluginEventKey =
| "onTabOpen" | "onWorkspaceChange" | "onWorkspaceClose" | "onInit"
| "onWorkspaceOpen" | "onPreferencesChange"; | "onUnload"
| "onTabChange"
| "onTabClose"
| "onTabOpen"
| "onWorkspaceChange"
| "onWorkspaceClose"
| "onWorkspaceOpen"
| "onPreferencesChange";
export type IPluginEventProps<T extends IPluginEventKey> = export type IPluginEventProps<T extends IPluginEventKey> =
T extends "onInit" ? { } T extends "onInit" ? {} :
: T extends "onUnload" ? { } T extends "onUnload" ? {} :
: T extends "onTabChange" ? { tabId: string } T extends "onTabChange" ? { tabId: string } :
: T extends "onTabClose" ? { tabId: string } T extends "onTabClose" ? { tabId: string } :
: T extends "onTabOpen" ? { tabId: string } T extends "onTabOpen" ? { tabId: string } :
: T extends "onWorkspaceChange" ? { workspace: IWorkspace } T extends "onWorkspaceChange" ? { workspace: IWorkspace } :
: T extends "onWorkspaceClose" ? { workspace: IWorkspace } T extends "onWorkspaceClose" ? { workspace: IWorkspace } :
: T extends "onWorkspaceOpen" ? { workspace: IWorkspace } T extends "onWorkspaceOpen" ? { workspace: IWorkspace } :
: T extends "onPreferencesChange" ? { settings: IPluginSettings } T extends "onPreferencesChange" ? { settings: IPluginSettings } :
: never; never;
export type IPluginEvent<T extends IPluginEventKey> = (props: IPluginEventProps<T>) => void; export type IPluginEvent<T extends IPluginEventKey> = (props: IPluginEventProps<T>) => void;
export type IPluginEvents = { export type IPluginEvents = {
[K in IPluginEventKey]?: IPluginEvent<K>; [K in IPluginEventKey]?: IPluginEvent<K>;
}; };
@ -69,6 +76,7 @@ export type IPluginContextMenu = {
}; };
export type IPluginSettings = IPluginSetting[]; export type IPluginSettings = IPluginSetting[];
export default IZenPlugin; export default IZenPlugin;
// API // API

View file

@ -1,7 +1,7 @@
{ {
"name": "plugin", "name": "plugin",
"version": "1.0.0", "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", "types": "./lib/main.d.ts",
"repository": { "repository": {
"type": "git", "type": "git",