@tinywork/glass 0.0.20 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.d.ts +9 -0
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -7,6 +7,13 @@ import querystring from 'node:querystring';
7
7
  import axios from 'axios';
8
8
  import { BrowserWindow, type MenuItemConstructorOptions, type Session } from 'electron';
9
9
  type ResourceType = 'Fetch/XHR' | 'JS' | 'CSS' | 'Img' | 'Media' | 'Font' | 'Doc' | 'WS' | 'Wasm' | 'Other';
10
+ type Operation = {
11
+ key: string | number;
12
+ type: 'button';
13
+ text: string;
14
+ onClick: () => Promise<void>;
15
+ };
16
+ declare function registerPageHooks(name: 'doc-edit', cb: (params: Partial<DocSchema>) => Operation[]): void;
10
17
  export type DocSchema = {
11
18
  apiId: string;
12
19
  groupId: string;
@@ -84,6 +91,7 @@ export interface IGlassContext {
84
91
  }) => Promise<void>;
85
92
  showProgress: () => IProgress;
86
93
  postMessage: (message: Partial<NetLog>) => Promise<void>;
94
+ registerPageHooks: typeof registerPageHooks;
87
95
  }
88
96
  export interface IGlassExtension {
89
97
  install?(context: IGlassContext): Promise<void>;
@@ -93,6 +101,7 @@ export interface IGlassExtension {
93
101
  url: URL;
94
102
  req: http.IncomingMessage;
95
103
  res: http.ServerResponse;
104
+ isLocal?: boolean;
96
105
  }): Promise<void>;
97
106
  /** 在postMessage到页面之前 */
98
107
  onMessagePost?(context: IGlassContext, message: Partial<NetLog>): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinywork/glass",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [