@webskill/polyfill 0.0.3 → 0.0.4
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/dist/polyfill.js +54 -1
- package/package.json +2 -2
package/dist/polyfill.js
CHANGED
|
@@ -300,6 +300,54 @@ var WebSkillPolyfill = (function(exports) {
|
|
|
300
300
|
return url;
|
|
301
301
|
}
|
|
302
302
|
//#endregion
|
|
303
|
+
//#region ../core/src/attachment/kind.ts
|
|
304
|
+
/** 可作为图片分片外发的 MIME 类型 @experimental */
|
|
305
|
+
const IMAGE_MIME_TYPES = [
|
|
306
|
+
"image/png",
|
|
307
|
+
"image/jpeg",
|
|
308
|
+
"image/webp",
|
|
309
|
+
"image/gif"
|
|
310
|
+
];
|
|
311
|
+
/**
|
|
312
|
+
* 可按文本读取的扩展名。accept 白名单与判定白名单共用这一份——
|
|
313
|
+
* 0.5.x 两处不一致,`log`/`yaml`/`yml` 能通过判定却在文件选择器里选不到。
|
|
314
|
+
*/
|
|
315
|
+
const TEXT_EXTENSIONS = [
|
|
316
|
+
"txt",
|
|
317
|
+
"md",
|
|
318
|
+
"csv",
|
|
319
|
+
"json",
|
|
320
|
+
"log",
|
|
321
|
+
"yaml",
|
|
322
|
+
"yml"
|
|
323
|
+
];
|
|
324
|
+
/** 非文本非图片但仍可整体外发的类型(provider 的 file 分片) @experimental */
|
|
325
|
+
const FILE_MIME_TYPES = ["application/pdf"];
|
|
326
|
+
const XLS_MIME = "application/vnd.ms-excel";
|
|
327
|
+
/**
|
|
328
|
+
* DWG 图纸的 MIME。没有官方注册值,各家各发一套,浏览器上传时更常见的是空串。
|
|
329
|
+
* @experimental
|
|
330
|
+
*/
|
|
331
|
+
const DWG_MIME_TYPES = [
|
|
332
|
+
"image/vnd.dwg",
|
|
333
|
+
"application/acad",
|
|
334
|
+
"application/x-acad",
|
|
335
|
+
"application/dwg",
|
|
336
|
+
"application/x-dwg",
|
|
337
|
+
"drawing/dwg"
|
|
338
|
+
];
|
|
339
|
+
/**
|
|
340
|
+
* 只存字节、不进上下文的扩展名。仍然是**白名单制**:
|
|
341
|
+
* 新增 `binary` 类别不等于任意二进制放行(AC-19.18)。
|
|
342
|
+
* @experimental
|
|
343
|
+
*/
|
|
344
|
+
const BINARY_EXTENSIONS = ["dwg"];
|
|
345
|
+
new Set(TEXT_EXTENSIONS);
|
|
346
|
+
new Set(IMAGE_MIME_TYPES);
|
|
347
|
+
new Set(FILE_MIME_TYPES);
|
|
348
|
+
new Set(DWG_MIME_TYPES);
|
|
349
|
+
new Set(BINARY_EXTENSIONS);
|
|
350
|
+
//#endregion
|
|
303
351
|
//#region ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/browser/dist/nodes/identity.js
|
|
304
352
|
const ALIAS = Symbol.for("yaml.alias");
|
|
305
353
|
const DOC = Symbol.for("yaml.document");
|
|
@@ -13687,7 +13735,7 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
13687
13735
|
return ((url.split(/[?#]/)[0] ?? "").split(".").pop() ?? "").toLowerCase() === "dwg";
|
|
13688
13736
|
}
|
|
13689
13737
|
/** 引擎侧固定流程(§2.3)用到的错误文案,集中一处便于判据引用 */
|
|
13690
|
-
const UNSUPPORTED_DOCUMENT_MESSAGE = `Only PDF (${SUPPORTED_DOCUMENT_MIME.pdf}), Word (${SUPPORTED_DOCUMENT_MIME.docx}), Excel (${SUPPORTED_DOCUMENT_MIME.xlsx}), PowerPoint (${SUPPORTED_DOCUMENT_MIME.pptx}) and plain text documents can be read.`;
|
|
13738
|
+
const UNSUPPORTED_DOCUMENT_MESSAGE = `Only PDF (${SUPPORTED_DOCUMENT_MIME.pdf}), Word (${SUPPORTED_DOCUMENT_MIME.docx}), Excel (${SUPPORTED_DOCUMENT_MIME.xlsx} or ${XLS_MIME}), PowerPoint (${SUPPORTED_DOCUMENT_MIME.pptx}) and plain text documents can be read.`;
|
|
13691
13739
|
/**
|
|
13692
13740
|
* 内建工具:读页面链接指向的文档。
|
|
13693
13741
|
*
|
|
@@ -15552,6 +15600,11 @@ Never claim to have created, saved, or installed a skill unless a skill tool cal
|
|
|
15552
15600
|
label: "Excel workbooks",
|
|
15553
15601
|
...this.#deps.xlsxExtractor ? { extractor: this.#deps.xlsxExtractor } : {}
|
|
15554
15602
|
},
|
|
15603
|
+
[XLS_MIME]: {
|
|
15604
|
+
kind: "xls",
|
|
15605
|
+
label: "Legacy Excel workbooks",
|
|
15606
|
+
...this.#deps.xlsxExtractor ? { extractor: this.#deps.xlsxExtractor } : {}
|
|
15607
|
+
},
|
|
15555
15608
|
[SUPPORTED_DOCUMENT_MIME.pptx]: {
|
|
15556
15609
|
kind: "pptx",
|
|
15557
15610
|
label: "PowerPoint presentations",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webskill/polyfill",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Browser polyfill for the WebSkill navigator API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"typecheck": "tsc --noEmit"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@webskill/sdk": "^0.
|
|
34
|
+
"@webskill/sdk": "^0.29.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@webskill/sdk": "workspace:^",
|