@nsnanocat/preference-panes 0.9.16 → 1.0.0
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.
- package/README.md +21 -15
- package/dist/api.js +1454 -967
- package/dist/module/app.mjs +296 -412
- package/dist/module/index.html +1 -1
- package/dist/module/navigation.mjs +7 -6
- package/dist/preference-panes.mjs +259 -374
- package/dist/web.js +1202 -0
- package/package.json +1 -1
- package/src/api.mjs +191 -0
- package/src/browser/ModuleStatus.mjs +7 -6
- package/src/browser/Navigation.d.mts +8 -6
- package/src/browser/app.mjs +5 -7
- package/src/{lib → browser}/boxjs.mjs +72 -16
- package/src/browser/client.d.mts +44 -129
- package/src/browser/client.mjs +61 -179
- package/src/browser/index.d.ts +7 -11
- package/src/browser/index.mjs +15 -7
- package/src/browser/panel.mjs +31 -22
- package/src/build.mjs +2 -3
- package/src/index.d.ts +16 -2
- package/src/web.mjs +52 -0
- package/src/BoxJS.mjs +0 -72
- package/src/Store.mjs +0 -114
- package/src/lib/response.mjs +0 -16
- package/src/proxy/handler.mjs +0 -39
- package/src/proxy/response.mjs +0 -16
package/dist/module/index.html
CHANGED
|
@@ -275,24 +275,25 @@ class ModuleFrame extends EventTarget {
|
|
|
275
275
|
* @typedef {object} ModuleProbeOptions
|
|
276
276
|
* @property {typeof globalThis.fetch} [fetch] 可注入的 fetch / Injectable fetch.
|
|
277
277
|
* @property {AbortSignal} [signal] 外部取消信号 / External cancellation signal.
|
|
278
|
+
* @property {string} [json] BoxJS JSON 来源,将随探测请求头传递 / BoxJS JSON source sent in the probe header.
|
|
278
279
|
* @property {number} [timeout] 超时毫秒数,默认 3500 / Timeout in milliseconds, defaults to 3500.
|
|
279
280
|
*/
|
|
280
281
|
|
|
281
282
|
/**
|
|
282
|
-
* 通过模块
|
|
283
|
-
* Probe installation and business version from the
|
|
284
|
-
* @param {string | URL} url
|
|
283
|
+
* 通过模块 API 的 HEAD 响应检测安装状态和业务版本。
|
|
284
|
+
* Probe installation and business version from the module API HEAD response.
|
|
285
|
+
* @param {string | URL} url 模块 API 地址 / Module API URL.
|
|
285
286
|
* @param {ModuleProbeOptions} [options] 请求选项 / Request options.
|
|
286
287
|
* @returns {Promise<Response>} 原始 HTTP 响应,可直接读取 status 和响应头 / Native HTTP response; read status and headers directly.
|
|
287
288
|
*/
|
|
288
|
-
async function probeModule(url, { fetch: request = globalThis.fetch, signal, timeout = 3500 } = {}) {
|
|
289
|
+
async function probeModule(url, { fetch: request = globalThis.fetch, json, signal, timeout = 3500 } = {}) {
|
|
289
290
|
const controller = new AbortController();
|
|
290
291
|
const abort = () => controller.abort();
|
|
291
292
|
if (signal?.aborted) abort();
|
|
292
293
|
signal?.addEventListener("abort", abort, { once: true });
|
|
293
294
|
const timer = setTimeout(() => controller.abort(), timeout);
|
|
294
295
|
try {
|
|
295
|
-
return await request(url, { method: "HEAD", cache: "no-store", credentials: "omit", signal: controller.signal });
|
|
296
|
+
return await request(url, { method: "HEAD", cache: "no-store", credentials: "omit", signal: controller.signal, headers: json ? { "X-PreferencePanes-JSON": json } : undefined });
|
|
296
297
|
} finally {
|
|
297
298
|
clearTimeout(timer);
|
|
298
299
|
signal?.removeEventListener("abort", abort);
|
|
@@ -330,7 +331,7 @@ class ModuleStatus extends EventTarget {
|
|
|
330
331
|
/**
|
|
331
332
|
* 每次进入重新探测,取消旧请求并忽略其迟到结果。
|
|
332
333
|
* Reprobe on entry, cancelling old requests and ignoring late results.
|
|
333
|
-
* @param {string | URL} url
|
|
334
|
+
* @param {string | URL} url 模块 API 地址 / Module API URL.
|
|
334
335
|
* @param {ModuleProbeOptions} [options] 请求选项 / Request options.
|
|
335
336
|
* @returns {Promise<Response | undefined>} 原始响应;被取消时无返回值 / Native response; undefined when cancelled.
|
|
336
337
|
*/
|