@l1yp/file-viewer 0.1.4 → 0.1.6
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 +57 -6
- package/dist/assets/step.worker-CfDTYOf_.js.map +1 -0
- package/dist/components/AnsiText.d.ts +47 -0
- package/dist/components/AnsiText.js +41 -0
- package/dist/components/AnsiText.js.map +1 -0
- package/dist/components/CertViewer.js +1 -1
- package/dist/components/CertViewer.js.map +1 -1
- package/dist/components/CertViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/CodeView.js +1 -1
- package/dist/components/CodeView.js.map +1 -1
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js +80 -71
- package/dist/components/CodeView.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DocxEmbeddedFiles.js +9 -0
- package/dist/components/DocxEmbeddedFiles.js.map +1 -0
- package/dist/components/DocxEmbeddedFiles.vue.d.ts +15 -0
- package/dist/components/DocxEmbeddedFiles.vue_vue_type_script_setup_true_lang.js +69 -0
- package/dist/components/DocxEmbeddedFiles.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/DocxNavigationPane.js +1 -1
- package/dist/components/DocxNavigationPane.js.map +1 -1
- package/dist/components/DocxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/DocxViewer.js +1 -1
- package/dist/components/DocxViewer.js.map +1 -1
- package/dist/components/DocxViewer.vue.d.ts +1 -1
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js +182 -50
- package/dist/components/DocxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/EplViewer.js +1 -1
- package/dist/components/EplViewer.js.map +1 -1
- package/dist/components/EplViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/FileViewerBody.js +1 -1
- package/dist/components/FileViewerBody.js.map +1 -1
- package/dist/components/FileViewerBody.vue.d.ts +1 -0
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js +292 -281
- package/dist/components/FileViewerBody.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/FileViewerPanel.js +1 -1
- package/dist/components/FileViewerPanel.js.map +1 -1
- package/dist/components/FileViewerPanel.vue.d.ts +6 -1
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js +53 -51
- package/dist/components/FileViewerPanel.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/HarViewer.js +1 -1
- package/dist/components/HarViewer.js.map +1 -1
- package/dist/components/HarViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/JksViewer.js +1 -1
- package/dist/components/JksViewer.js.map +1 -1
- package/dist/components/JksViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/LogViewer.js +1 -1
- package/dist/components/LogViewer.js.map +1 -1
- package/dist/components/LogViewer.vue.d.ts +3 -1
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js +284 -280
- package/dist/components/LogViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ModelViewModes.js +9 -0
- package/dist/components/ModelViewModes.js.map +1 -0
- package/dist/components/ModelViewModes.vue.d.ts +11 -0
- package/dist/components/ModelViewModes.vue_vue_type_script_setup_true_lang.js +49 -0
- package/dist/components/ModelViewModes.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/ModelViewer.js +1 -1
- package/dist/components/ModelViewer.js.map +1 -1
- package/dist/components/ModelViewer.vue.d.ts +2 -1
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js +183 -96
- package/dist/components/ModelViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PdfNavigationPane.js +1 -1
- package/dist/components/PdfNavigationPane.js.map +1 -1
- package/dist/components/PdfNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PdfViewer.js +1 -1
- package/dist/components/PdfViewer.js.map +1 -1
- package/dist/components/PdfViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PptxNavigationPane.js +1 -1
- package/dist/components/PptxNavigationPane.js.map +1 -1
- package/dist/components/PptxNavigationPane.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/PsdViewer.js +1 -1
- package/dist/components/PsdViewer.js.map +1 -1
- package/dist/components/PsdViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/SqliteViewer.js +1 -1
- package/dist/components/SqliteViewer.js.map +1 -1
- package/dist/components/SqliteViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/ViewerLoadError.js +9 -0
- package/dist/components/ViewerLoadError.js.map +1 -0
- package/dist/components/ViewerLoadError.vue.d.ts +17 -0
- package/dist/components/ViewerLoadError.vue_vue_type_script_setup_true_lang.js +58 -0
- package/dist/components/ViewerLoadError.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxChart.js +1 -1
- package/dist/components/XlsxChart.js.map +1 -1
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js +9 -9
- package/dist/components/XlsxChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/XlsxImageLayer.js +9 -0
- package/dist/components/XlsxImageLayer.js.map +1 -0
- package/dist/components/XlsxImageLayer.vue.d.ts +9 -0
- package/dist/components/XlsxImageLayer.vue_vue_type_script_setup_true_lang.js +46 -0
- package/dist/components/XlsxImageLayer.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/XlsxViewer.js +1 -1
- package/dist/components/XlsxViewer.js.map +1 -1
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js +230 -216
- package/dist/components/XlsxViewer.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/epl/EplResource.js +1 -1
- package/dist/components/epl/EplResource.js.map +1 -1
- package/dist/components/epl/EplResource.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/optionalViewer.d.ts +3 -2
- package/dist/components/optionalViewer.js +6 -3
- package/dist/components/optionalViewer.js.map +1 -1
- package/dist/composables/useFileViewer.d.ts +11 -3
- package/dist/composables/useFileViewer.js.map +1 -1
- package/dist/composables/useTeleportTheme.d.ts +7 -0
- package/dist/composables/useTeleportTheme.js +42 -0
- package/dist/composables/useTeleportTheme.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -28
- package/dist/lib/ansi.d.ts +44 -0
- package/dist/lib/ansi.js +224 -0
- package/dist/lib/ansi.js.map +1 -0
- package/dist/lib/cfb.d.ts +37 -0
- package/dist/lib/cfb.js +112 -0
- package/dist/lib/cfb.js.map +1 -0
- package/dist/lib/docxEmbeddedDom.d.ts +22 -0
- package/dist/lib/docxEmbeddedDom.js +128 -0
- package/dist/lib/docxEmbeddedDom.js.map +1 -0
- package/dist/lib/docxEmbeddings.d.ts +41 -0
- package/dist/lib/docxEmbeddings.js +226 -0
- package/dist/lib/docxEmbeddings.js.map +1 -0
- package/dist/lib/docxTheme.d.ts +6 -0
- package/dist/lib/docxTheme.js +64 -0
- package/dist/lib/docxTheme.js.map +1 -0
- package/dist/lib/epl/code/structures.js +82 -0
- package/dist/lib/epl/code/structures.js.map +1 -0
- package/dist/lib/epl/code/variable.js +16 -0
- package/dist/lib/epl/code/variable.js.map +1 -0
- package/dist/lib/epl/eplDocument.js +28 -22
- package/dist/lib/epl/eplDocument.js.map +1 -1
- package/dist/lib/epl/index.d.ts +2 -1
- package/dist/lib/epl/index.js.map +1 -1
- package/dist/lib/epl/sections/code.js +37 -0
- package/dist/lib/epl/sections/code.js.map +1 -0
- package/dist/lib/epl/sections/esystemInfo.js +29 -0
- package/dist/lib/epl/sections/esystemInfo.js.map +1 -0
- package/dist/lib/epl/sections/losable.js +33 -0
- package/dist/lib/epl/sections/losable.js.map +1 -0
- package/dist/lib/epl/sections/projectConfig.js +39 -0
- package/dist/lib/epl/sections/projectConfig.js.map +1 -0
- package/dist/lib/epl/sections/resource.js +84 -0
- package/dist/lib/epl/sections/resource.js.map +1 -0
- package/dist/lib/fileType.d.ts +3 -1
- package/dist/lib/fileType.js +150 -137
- package/dist/lib/fileType.js.map +1 -1
- package/dist/lib/modelAppearance.d.ts +7 -0
- package/dist/lib/modelAppearance.js +41 -0
- package/dist/lib/modelAppearance.js.map +1 -0
- package/dist/lib/msi.js +62 -154
- package/dist/lib/msi.js.map +1 -1
- package/dist/lib/olePackage.d.ts +8 -0
- package/dist/lib/olePackage.js +37 -0
- package/dist/lib/olePackage.js.map +1 -0
- package/dist/lib/pptxFirstSlide.d.ts +11 -0
- package/dist/lib/pptxFirstSlide.js +34 -0
- package/dist/lib/pptxFirstSlide.js.map +1 -0
- package/dist/lib/step.d.ts +10 -0
- package/dist/lib/step.js +35 -0
- package/dist/lib/step.js.map +1 -0
- package/dist/lib/step.worker.d.ts +1 -0
- package/dist/lib/step.worker.js +18 -0
- package/dist/lib/step.worker.js.map +1 -0
- package/dist/lib/stepObject.d.ts +4 -0
- package/dist/lib/stepObject.js +52 -0
- package/dist/lib/stepObject.js.map +1 -0
- package/dist/lib/stepTypes.d.ts +60 -0
- package/dist/lib/viewerKind.js +10 -5
- package/dist/lib/viewerKind.js.map +1 -1
- package/dist/lib/xlsx.d.ts +1 -1
- package/dist/lib/xlsx.js +106 -89
- package/dist/lib/xlsx.js.map +1 -1
- package/dist/lib/xlsxCharts.js +71 -119
- package/dist/lib/xlsxCharts.js.map +1 -1
- package/dist/lib/xlsxImages.d.ts +43 -0
- package/dist/lib/xlsxImages.js +114 -0
- package/dist/lib/xlsxImages.js.map +1 -0
- package/dist/lib/xlsxParts.d.ts +17 -0
- package/dist/lib/xlsxParts.js +86 -0
- package/dist/lib/xlsxParts.js.map +1 -0
- package/dist/style.css +1 -1
- package/package.json +8 -3
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/lib/step.worker.ts?worker&inline
|
|
2
|
+
var e = "(function(){function e(e,t=[]){self.postMessage(e,t)}self.onmessage=async({data:t})=>{try{e({type:`phase`,phase:`engine`}),self.importScripts(t.scriptUrl);let n=await self.occtimportjs({locateFile:()=>t.wasmUrl,print:()=>{},printErr:()=>{}});e({type:`phase`,phase:`parse`});let r=n.ReadStepFile(new Uint8Array(t.buffer),{linearUnit:`millimeter`,linearDeflectionType:`bounding_box_ratio`,linearDeflection:.001,angularDeflection:.5});if(!r.success)throw Error(`无法解析 STEP 文件,文件可能已损坏或格式不受支持。`);if(!r.meshes?.some(e=>e.index.array.length>0))throw Error(`STEP 文件中没有可预览的曲面或实体。`);let i=[];e({type:`result`,model:{root:r.root,meshes:r.meshes.map(e=>{let t=new Float32Array(e.attributes.position.array),n=e.attributes.normal?new Float32Array(e.attributes.normal.array):void 0,r=new Uint32Array(e.index.array);return i.push(t.buffer,r.buffer),n&&i.push(n.buffer),{name:e.name,color:e.color,faces:e.brep_faces??[],positions:t,normals:n,indices:r}})}},i)}catch(t){e({type:`error`,message:t instanceof Error?t.message:String(t)})}}})();\n//# sourceMappingURL=step.worker-CfDTYOf_.js.map", t = typeof self < "u" && self.Blob && new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);", e], { type: "text/javascript;charset=utf-8" });
|
|
3
|
+
function n(n) {
|
|
4
|
+
let r;
|
|
5
|
+
try {
|
|
6
|
+
if (r = t && (self.URL || self.webkitURL).createObjectURL(t), !r) throw "";
|
|
7
|
+
let e = new Worker(r, { name: n?.name });
|
|
8
|
+
return e.addEventListener("error", () => {
|
|
9
|
+
(self.URL || self.webkitURL).revokeObjectURL(r);
|
|
10
|
+
}), e;
|
|
11
|
+
} catch {
|
|
12
|
+
return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(e), { name: n?.name });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { n as default };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=step.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.worker.js","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as e from "three";
|
|
2
|
+
//#region src/lib/stepObject.ts
|
|
3
|
+
function t(t) {
|
|
4
|
+
return new e.MeshStandardMaterial({
|
|
5
|
+
color: t ? new e.Color(...t) : 10135476,
|
|
6
|
+
metalness: .1,
|
|
7
|
+
roughness: .7,
|
|
8
|
+
side: e.DoubleSide
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function n(n) {
|
|
12
|
+
let r = new e.BufferGeometry();
|
|
13
|
+
r.setAttribute("position", new e.BufferAttribute(n.positions, 3)), r.setIndex(new e.BufferAttribute(n.indices, 1)), n.normals ? r.setAttribute("normal", new e.BufferAttribute(n.normals, 3)) : r.computeVertexNormals();
|
|
14
|
+
let i = [t(n.color)], a = /* @__PURE__ */ new Map();
|
|
15
|
+
if (n.faces.some((e) => e.color)) {
|
|
16
|
+
let e = 0;
|
|
17
|
+
for (let o of n.faces.toSorted((e, t) => e.first - t.first)) {
|
|
18
|
+
let s = Math.max(e, o.first * 3), c = Math.min(n.indices.length, (o.last + 1) * 3);
|
|
19
|
+
if (c <= s) continue;
|
|
20
|
+
s > e && r.addGroup(e, s - e, 0);
|
|
21
|
+
let l = 0;
|
|
22
|
+
if (o.color) {
|
|
23
|
+
let e = o.color.join(",");
|
|
24
|
+
l = a.get(e) ?? i.length, a.has(e) || (a.set(e, l), i.push(t(o.color)));
|
|
25
|
+
}
|
|
26
|
+
r.addGroup(s, c - s, l), e = c;
|
|
27
|
+
}
|
|
28
|
+
e < n.indices.length && r.addGroup(e, n.indices.length - e, 0);
|
|
29
|
+
}
|
|
30
|
+
let o = new e.Mesh(r, i.length > 1 ? i : i[0]);
|
|
31
|
+
return o.name = n.name, o;
|
|
32
|
+
}
|
|
33
|
+
function r(t) {
|
|
34
|
+
let r = /* @__PURE__ */ new Map();
|
|
35
|
+
function i(a) {
|
|
36
|
+
let o = new e.Group();
|
|
37
|
+
o.name = a.name;
|
|
38
|
+
for (let e of a.meshes) {
|
|
39
|
+
let i = t.meshes[e];
|
|
40
|
+
if (!i?.indices.length) continue;
|
|
41
|
+
let a = r.get(e);
|
|
42
|
+
a || (a = n(i), r.set(e, a)), o.add(a.clone());
|
|
43
|
+
}
|
|
44
|
+
for (let e of a.children) o.add(i(e));
|
|
45
|
+
return o;
|
|
46
|
+
}
|
|
47
|
+
return i(t.root);
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { r as buildStepObject };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=stepObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stepObject.js","names":[],"sources":["../../src/lib/stepObject.ts"],"sourcesContent":["import * as THREE from 'three'\nimport type { StepColor, StepMesh, StepModel, StepNode } from './stepTypes'\n\nfunction material(color?: StepColor | null): THREE.MeshStandardMaterial {\n return new THREE.MeshStandardMaterial({\n // OCCT has already converted STEP's sRGB values to linear RGB; three.js uses the same working space.\n color: color ? new THREE.Color(...color) : 0x9aa7b4,\n metalness: 0.1,\n roughness: 0.7,\n side: THREE.DoubleSide,\n })\n}\n\nfunction buildMesh(mesh: StepMesh): THREE.Mesh {\n const geometry = new THREE.BufferGeometry()\n geometry.setAttribute('position', new THREE.BufferAttribute(mesh.positions, 3))\n geometry.setIndex(new THREE.BufferAttribute(mesh.indices, 1))\n if (mesh.normals) geometry.setAttribute('normal', new THREE.BufferAttribute(mesh.normals, 3))\n else geometry.computeVertexNormals()\n\n const materials = [material(mesh.color)]\n const palette = new Map<string, number>()\n // Face ranges are TRIANGLE indices (inclusive), while three.js groups address individual index entries.\n if (mesh.faces.some((face) => face.color)) {\n let cursor = 0\n for (const face of mesh.faces.toSorted((a, b) => a.first - b.first)) {\n const start = Math.max(cursor, face.first * 3)\n const end = Math.min(mesh.indices.length, (face.last + 1) * 3)\n if (end <= start) continue\n if (start > cursor) geometry.addGroup(cursor, start - cursor, 0)\n let index = 0\n if (face.color) {\n const key = face.color.join(',')\n index = palette.get(key) ?? materials.length\n if (!palette.has(key)) {\n palette.set(key, index)\n materials.push(material(face.color))\n }\n }\n geometry.addGroup(start, end - start, index)\n cursor = end\n }\n if (cursor < mesh.indices.length) geometry.addGroup(cursor, mesh.indices.length - cursor, 0)\n }\n const object = new THREE.Mesh(geometry, materials.length > 1 ? materials : materials[0])\n object.name = mesh.name\n return object\n}\n\n/** OCCT has already applied assembly placements to positions; keep its hierarchy and names as groups. */\nexport function buildStepObject(model: StepModel): THREE.Group {\n const meshes = new Map<number, THREE.Mesh>()\n function nodeObject(node: StepNode): THREE.Group {\n const group = new THREE.Group()\n group.name = node.name\n for (const index of node.meshes) {\n const data = model.meshes[index]\n if (!data?.indices.length) continue\n let mesh = meshes.get(index)\n if (!mesh) {\n mesh = buildMesh(data)\n meshes.set(index, mesh)\n }\n group.add(mesh.clone())\n }\n for (const child of node.children) group.add(nodeObject(child))\n return group\n }\n return nodeObject(model.root)\n}\n"],"mappings":";;AAGA,SAAS,EAAS,GAAsD;CACtE,OAAO,IAAI,EAAM,qBAAqB;EAEpC,OAAO,IAAQ,IAAI,EAAM,MAAM,GAAG,CAAK,IAAI;EAC3C,WAAW;EACX,WAAW;EACX,MAAM,EAAM;CACd,CAAC;AACH;AAEA,SAAS,EAAU,GAA4B;CAC7C,IAAM,IAAW,IAAI,EAAM,eAAe;CAG1C,AAFA,EAAS,aAAa,YAAY,IAAI,EAAM,gBAAgB,EAAK,WAAW,CAAC,CAAC,GAC9E,EAAS,SAAS,IAAI,EAAM,gBAAgB,EAAK,SAAS,CAAC,CAAC,GACxD,EAAK,UAAS,EAAS,aAAa,UAAU,IAAI,EAAM,gBAAgB,EAAK,SAAS,CAAC,CAAC,IACvF,EAAS,qBAAqB;CAEnC,IAAM,IAAY,CAAC,EAAS,EAAK,KAAK,CAAC,GACjC,oBAAU,IAAI,IAAoB;CAExC,IAAI,EAAK,MAAM,MAAM,MAAS,EAAK,KAAK,GAAG;EACzC,IAAI,IAAS;EACb,KAAK,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M,KAAS,EAAK,UAAU,EAAM,IAAI,EAAW,CAAK,CAAC;EAC9D,OAAO;CACT;CACA,OAAO,EAAW,EAAM,IAAI;AAC9B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/** The subset of occt-import-js's result used for a read-only, millimetre-based preview. */
|
|
2
|
+
export type StepColor = [number, number, number];
|
|
3
|
+
export interface StepNode {
|
|
4
|
+
name: string;
|
|
5
|
+
meshes: number[];
|
|
6
|
+
children: StepNode[];
|
|
7
|
+
}
|
|
8
|
+
export interface StepFace {
|
|
9
|
+
first: number;
|
|
10
|
+
last: number;
|
|
11
|
+
color?: StepColor | null;
|
|
12
|
+
}
|
|
13
|
+
export interface StepMesh {
|
|
14
|
+
name: string;
|
|
15
|
+
color?: StepColor;
|
|
16
|
+
faces: StepFace[];
|
|
17
|
+
positions: Float32Array;
|
|
18
|
+
normals?: Float32Array;
|
|
19
|
+
indices: Uint32Array;
|
|
20
|
+
}
|
|
21
|
+
export interface StepModel {
|
|
22
|
+
root: StepNode;
|
|
23
|
+
meshes: StepMesh[];
|
|
24
|
+
}
|
|
25
|
+
export interface OcctResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
root: StepNode;
|
|
28
|
+
meshes: {
|
|
29
|
+
name: string;
|
|
30
|
+
color?: StepColor;
|
|
31
|
+
brep_faces?: StepFace[];
|
|
32
|
+
attributes: {
|
|
33
|
+
position: {
|
|
34
|
+
array: number[];
|
|
35
|
+
};
|
|
36
|
+
normal?: {
|
|
37
|
+
array: number[];
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
index: {
|
|
41
|
+
array: number[];
|
|
42
|
+
};
|
|
43
|
+
}[];
|
|
44
|
+
}
|
|
45
|
+
export interface StepRequest {
|
|
46
|
+
buffer: ArrayBuffer;
|
|
47
|
+
scriptUrl: string;
|
|
48
|
+
wasmUrl: string;
|
|
49
|
+
}
|
|
50
|
+
export type StepPhase = 'engine' | 'parse';
|
|
51
|
+
export type StepReply = {
|
|
52
|
+
type: 'phase';
|
|
53
|
+
phase: StepPhase;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'result';
|
|
56
|
+
model: StepModel;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'error';
|
|
59
|
+
message: string;
|
|
60
|
+
};
|
package/dist/lib/viewerKind.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ebookKind as e, fileExt as t, hljsLang as n, isAppxFile as r, isAudioFile as i, isBinaryObjFile as a, isCertFile as o, isCsvFile as s, isDicomFile as c, isDocxFile as l, isDxfFile as u, isEmlFile as d, isEplFile as f, isFontFile as p, isGeoFile as m, isHarFile as h, isHprofFile as g, isHtmlFile as _, isImageFile as v, isJavaClassFile as y, isJksFile as b, isJsonlFile as x, isLogFile as S, isLrcFile as C, isMhtFile as w, isMindMapFile as T, isModelFile as E, isMsiFile as D, isNotebookFile as O, isPdfFile as k, isPptxFile as A, isQmcAudioFile as j, isRarFile as
|
|
1
|
+
import { ebookKind as e, fileExt as t, hljsLang as n, isAppxFile as r, isAudioFile as i, isBinaryObjFile as a, isCertFile as o, isCsvFile as s, isDicomFile as c, isDocxFile as l, isDxfFile as u, isEmlFile as d, isEplFile as f, isFontFile as p, isGeoFile as m, isHarFile as h, isHprofFile as g, isHtmlFile as _, isImageFile as v, isJavaClassFile as y, isJksFile as b, isJsonlFile as x, isLogFile as S, isLrcFile as C, isMhtFile as w, isMindMapFile as T, isModelFile as E, isMsiFile as D, isNotebookFile as O, isPdfFile as k, isPptxFile as A, isQmcAudioFile as j, isRarFile as ee, isRtfFile as M, isSevenZipFile as N, isSqliteFile as P, isStepFile as F, isSubtitleFile as I, isSvgFile as L, isTarballFile as R, isTextFile as z, isVideoFile as B, isXlsxFile as V, isXmindFile as H, isZipFile as U, rasterImageKind as W } from "./fileType.js";
|
|
2
2
|
import { isDiagramFile as G } from "./diagram.js";
|
|
3
3
|
import { looksLikeMindMap as K } from "./mindmap.js";
|
|
4
4
|
//#region src/lib/viewerKind.ts
|
|
@@ -48,7 +48,7 @@ function q(t) {
|
|
|
48
48
|
...X,
|
|
49
49
|
lang: "",
|
|
50
50
|
zip: !0
|
|
51
|
-
} :
|
|
51
|
+
} : N(q, J) ? {
|
|
52
52
|
...X,
|
|
53
53
|
lang: "",
|
|
54
54
|
sevenZip: !0
|
|
@@ -56,7 +56,7 @@ function q(t) {
|
|
|
56
56
|
...X,
|
|
57
57
|
lang: "",
|
|
58
58
|
archive: "tar"
|
|
59
|
-
} :
|
|
59
|
+
} : ee(q, J) ? {
|
|
60
60
|
...X,
|
|
61
61
|
lang: "",
|
|
62
62
|
archive: "rar"
|
|
@@ -92,7 +92,7 @@ function q(t) {
|
|
|
92
92
|
...X,
|
|
93
93
|
lang: "",
|
|
94
94
|
pptx: !0
|
|
95
|
-
} :
|
|
95
|
+
} : M(q, J) ? {
|
|
96
96
|
...X,
|
|
97
97
|
lang: "",
|
|
98
98
|
rtf: !0
|
|
@@ -108,6 +108,11 @@ function q(t) {
|
|
|
108
108
|
...X,
|
|
109
109
|
lang: "",
|
|
110
110
|
dxf: !0
|
|
111
|
+
} : F(q, J) ? {
|
|
112
|
+
...X,
|
|
113
|
+
lang: "",
|
|
114
|
+
model: !0,
|
|
115
|
+
modelFormat: "step"
|
|
111
116
|
} : w(q, J) ? {
|
|
112
117
|
...X,
|
|
113
118
|
lang: "",
|
|
@@ -120,7 +125,7 @@ function q(t) {
|
|
|
120
125
|
...X,
|
|
121
126
|
lang: "",
|
|
122
127
|
har: !0
|
|
123
|
-
} :
|
|
128
|
+
} : P(q, J) ? {
|
|
124
129
|
...X,
|
|
125
130
|
lang: "",
|
|
126
131
|
sqlite: !0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"viewerKind.js","names":[],"sources":["../../src/lib/viewerKind.ts"],"sourcesContent":["/**\n * Maps a file (name / mime / size / URL) to a {@link ViewerFile} — the single source of truth for \"which\n * in-browser viewer renders this\", shared by:\n * - {@link FileChip} (the chip in a conversation): routes images/videos to the lightbox itself, then\n * delegates everything else here.\n * - the archive browsers (Zip / 7z / tar / rar): an entry, once extracted to a blob URL, is classified the\n * same way and handed to {@link FileViewerBody} — so a file INSIDE an archive previews with the very same\n * viewers as a top-level file (the previous archive detail view only handled text/image/office/dicom).\n *\n * Detection order mirrors FileChip's historical priority exactly (raster/ebook beat the image lightbox; the\n * textual specializations — har/subtitle/geo/csv/notebook/cert — beat the generic source route). The only\n * additions for the archive context are `image` / `video` (rendered inline in the body instead of the lightbox)\n * and a `binary` fall-through (an entry that matches no viewer and isn't text → a download card).\n */\nimport {\n ebookKind,\n fileExt,\n hljsLang,\n isAppxFile,\n isAudioFile,\n isBinaryObjFile,\n isCertFile,\n isCsvFile,\n isDicomFile,\n isDocxFile,\n isDxfFile,\n isEmlFile,\n isEplFile,\n isFontFile,\n isGeoFile,\n isHarFile,\n isHprofFile,\n isHtmlFile,\n isImageFile,\n isJavaClassFile,\n isJksFile,\n isJsonlFile,\n isLogFile,\n isMhtFile,\n isMindMapFile,\n isModelFile,\n isLrcFile,\n isMsiFile,\n isNotebookFile,\n isPdfFile,\n isQmcAudioFile,\n isPptxFile,\n isRarFile,\n isRtfFile,\n isSevenZipFile,\n isSqliteFile,\n isSubtitleFile,\n isSvgFile,\n isTarballFile,\n isTextFile,\n isVideoFile,\n isXlsxFile,\n isXmindFile,\n isZipFile,\n rasterImageKind,\n} from '@/lib/fileType'\nimport { isDiagramFile } from '@/lib/diagram'\nimport { looksLikeMindMap } from '@/lib/mindmap'\nimport type { ViewerFile } from '@/composables/useFileViewer'\n\nexport interface ClassifyOpts {\n /** Display name (becomes {@link ViewerFile.name}). */\n name: string\n /** Fetch / download URL — the real endpoint, or a `blob:` URL for an extracted archive entry. */\n url: string\n /** Provider mime when known; null for archive entries (extension-driven detection). */\n mime?: string | null\n /** Byte size when known (drives the large-file / log routing). */\n size?: number\n /** Name used for TYPE detection when it differs from the display name (e.g. a chip captioned \"16×16 PNG\"). */\n detectName?: string\n /** Fall-back hint when nothing matches and the extension is ambiguous (archive NUL-sniff says \"looks textual\"). */\n textHint?: boolean\n}\n\n/**\n * Classify a file into the {@link ViewerFile} the side viewer should render. Pure — no lightbox / fetching\n * side effects (FileChip handles the lightbox before calling this). Never returns image/video for the main\n * chip flow (FileChip routes those itself); archive callers DO get image/video/binary.\n */\nexport function classifyViewerFile(o: ClassifyOpts): ViewerFile {\n const name = o.name\n const dn = o.detectName ?? o.name\n const mime = o.mime ?? null\n const size = o.size\n const base = { name, url: o.url, size }\n\n // Decoding images (TIFF/PSD/HEIC/RAW) and e-books carry image/* mimes, so they must beat the image route.\n const raster = rasterImageKind(dn, mime)\n if (raster) return { ...base, lang: '', raster }\n const eb = ebookKind(dn, mime)\n if (eb) return { ...base, lang: '', ebook: eb }\n // Diagrams (.drawio/.excalidraw) are XML/JSON under the hood — render as SVG, with the raw text on the source\n // toggle (lang feeds that highlight: xml for drawio, json for excalidraw).\n const diagram = isDiagramFile(dn, mime)\n if (diagram) return { ...base, lang: diagram === 'excalidraw' ? 'json' : 'xml', diagram }\n // image / video render inline in the body (archive context); the main FileChip flow never reaches here for\n // those (it opens the lightbox first), so this only fires for archive entries.\n if (isImageFile(dn, mime)) return { ...base, lang: '', image: true }\n if (isVideoFile(dn, mime)) return { ...base, lang: '', video: true }\n // APPX/MSIX are zip containers, so they MUST be claimed before the generic zip route; MSI is an OLE\n // compound file (not a zip), grouped here with the other Windows installer/package formats.\n if (isAppxFile(dn, mime)) return { ...base, lang: '', appx: true }\n if (isMsiFile(dn, mime)) return { ...base, lang: '', msi: true }\n // XMind is a zip container → claim it before the generic zip route (renders as a mind map, not an archive).\n if (isXmindFile(dn, mime)) return { ...base, lang: '', xmind: true }\n if (isZipFile(dn, mime)) return { ...base, lang: '', zip: true }\n if (isSevenZipFile(dn, mime)) return { ...base, lang: '', sevenZip: true }\n if (isTarballFile(dn, mime)) return { ...base, lang: '', archive: 'tar' }\n if (isRarFile(dn, mime)) return { ...base, lang: '', archive: 'rar' }\n if (isDicomFile(dn, mime)) return { ...base, lang: '', dicom: true }\n if (isBinaryObjFile(dn, mime)) return { ...base, lang: '', binobj: true }\n if (isEplFile(dn, mime)) return { ...base, lang: '', epl: true }\n if (isJavaClassFile(dn, mime)) return { ...base, lang: '', javaClass: true }\n if (isHprofFile(dn, mime)) return { ...base, lang: '', hprof: true }\n if (isDocxFile(dn, mime)) return { ...base, lang: '', docx: true }\n if (isXlsxFile(dn, mime)) return { ...base, lang: '', xlsx: true }\n if (isPptxFile(dn, mime)) return { ...base, lang: '', pptx: true }\n if (isRtfFile(dn, mime)) return { ...base, lang: '', rtf: true }\n if (isPdfFile(dn, mime)) return { ...base, lang: '', pdf: true }\n if (isMindMapFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), mindmap: true }\n // DXF is textual (ASCII CAD) → claim it before the generic text route so it renders as a drawing.\n if (isDxfFile(dn, mime)) return { ...base, lang: '', dxf: true }\n if (isMhtFile(dn, mime)) return { ...base, lang: '', mht: true }\n if (isEmlFile(dn, mime)) return { ...base, lang: '', eml: true }\n if (isHarFile(dn, mime)) return { ...base, lang: '', har: true }\n if (isSqliteFile(dn, mime)) return { ...base, lang: '', sqlite: true }\n if (isSubtitleFile(dn, mime)) return { ...base, lang: '', subtitle: true }\n if (isGeoFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), geo: true }\n // QQ Music encrypted audio (.mflac/.mgg/…) → decrypt + play; LRC lyrics (.lrc) → synced lyric list. LRC must\n // beat the generic text route (its viewer self-fetches so it can sniff the usual GBK encoding).\n if (isQmcAudioFile(dn, mime)) return { ...base, lang: '', qmc: true }\n if (isLrcFile(dn, mime)) return { ...base, lang: '', lrc: true }\n if (isAudioFile(dn, mime)) return { ...base, lang: '', audio: true }\n // Logs / large text before the generic text + csv routes (a huge CSV streams through the log viewer).\n if (isLogFile(dn, mime, size)) return { ...base, lang: '', log: true }\n if (isCsvFile(dn, mime)) return { ...base, lang: '', csv: true }\n if (isJsonlFile(dn, mime)) return { ...base, lang: 'json', jsonl: true }\n if (isModelFile(dn, mime)) return { ...base, lang: '', model: true }\n if (isFontFile(dn, mime)) return { ...base, lang: '', font: true }\n if (isNotebookFile(dn, mime)) return { ...base, lang: '', ipynb: true }\n // Keystores (JKS/JCEKS + PKCS#12) before the cert route — the viewer sniffs the bytes to pick the parser.\n if (isJksFile(dn, mime)) return { ...base, lang: '', jks: true }\n if (isCertFile(dn, mime)) return { ...base, lang: '', cert: true }\n // SVG / HTML get a render/source toggle; plain text/code falls to the source view.\n if (isSvgFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), svg: true }\n if (isHtmlFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), html: true }\n if (isTextFile(dn, mime) || o.textHint) return { ...base, lang: hljsLang(dn, mime) }\n // Nothing matched and it isn't text → an unpreviewable binary (archive entries only; FileChip never opens these).\n return { ...base, lang: '', binary: true }\n}\n\n// Common image/video/audio MIME by extension — used when an archive browser wraps extracted entry bytes in a\n// Blob URL, so an <img>/<video>/<audio> reliably decodes it (an untyped blob makes the browser guess). Returns\n// '' for non-media (text/office/etc. sub-viewers fetch the bytes themselves, where the blob type is irrelevant).\nconst MEDIA_MIME: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n jfif: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n bmp: 'image/bmp',\n ico: 'image/x-icon',\n avif: 'image/avif',\n apng: 'image/apng',\n svg: 'image/svg+xml',\n mp4: 'video/mp4',\n m4v: 'video/mp4',\n webm: 'video/webm',\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n mkv: 'video/x-matroska',\n mp3: 'audio/mpeg',\n wav: 'audio/wav',\n flac: 'audio/flac',\n ogg: 'audio/ogg',\n oga: 'audio/ogg',\n m4a: 'audio/mp4',\n aac: 'audio/aac',\n opus: 'audio/opus',\n}\n\n/** Best-effort media MIME for an extracted archive entry's Blob (see {@link MEDIA_MIME}); '' when not media. */\nexport function mediaMimeForName(name: string): string {\n return MEDIA_MIME[fileExt(name)] ?? ''\n}\n\n/**\n * Does this file render WITHOUT the panel-loaded text — i.e. a self-fetching sub-viewer (it pulls its own\n * bytes), or an image/video/binary (rendered straight from the URL)? When true the panel skips the text\n * fetch and hides the copy/refresh actions; when false the content is built from fetched text (markdown /\n * html / svg / subtitle / geo / csv / mind-map / source) or inline `content`.\n */\nexport function skipsTextLoad(file: ViewerFile | null): boolean {\n if (!file) return false\n return !!(\n file.zip ||\n file.sevenZip ||\n file.xmind ||\n file.dxf ||\n file.archive ||\n file.binobj ||\n file.epl ||\n file.javaClass ||\n file.hprof ||\n file.msi ||\n file.appx ||\n file.dicom ||\n file.docx ||\n file.xlsx ||\n file.pptx ||\n file.rtf ||\n file.pdf ||\n file.eml ||\n file.mht ||\n file.har ||\n file.sqlite ||\n file.cert ||\n file.jks ||\n file.font ||\n file.ipynb ||\n file.audio ||\n file.qmc ||\n file.lrc ||\n file.log ||\n file.model ||\n file.raster ||\n file.ebook ||\n file.image ||\n file.video ||\n file.binary ||\n file.hex\n )\n}\n\n/**\n * Can this file be shown both rendered and as source (so the header offers an eye/code toggle)? True for\n * markdown / html / svg / subtitle / geo / csv, and for a mind map only once the loaded text actually looks\n * like one (a non-mind-map `.mm` reads as plain source, no toggle).\n */\nexport function canToggleView(file: ViewerFile | null, text: string): boolean {\n if (!file) return false\n if (\n file.lang === 'markdown' ||\n file.html === true ||\n file.svg === true ||\n file.subtitle === true ||\n file.geo === true ||\n file.csv === true ||\n file.jsonl === true ||\n file.diagram != null\n ) {\n return true\n }\n if (file.mindmap === true) return looksLikeMindMap(text, fileExt(file.name))\n return false\n}\n"],"mappings":";;;;AAqFA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,IAAO,EAAE,MACT,IAAK,EAAE,cAAc,EAAE,MACvB,IAAO,EAAE,QAAQ,MACjB,IAAO,EAAE,MACT,IAAO;EAAE;EAAM,KAAK,EAAE;EAAK;CAAK,GAGhC,IAAS,EAAgB,GAAI,CAAI;CACv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L,KAAK;CACL,KAAK;CACL,MAAM;AACR;AAGA,SAAgB,EAAiB,GAAsB;CACrD,OAAO,EAAW,EAAQ,CAAI,MAAM;AACtC;AAQA,SAAgB,EAAc,GAAkC;CAE9D,OADK,IACE,CAAC,EACN,EAAK,OACL,EAAK,YACL,EAAK,SACL,EAAK,OACL,EAAK,WACL,EAAK,UACL,EAAK,OACL,EAAK,aACL,EAAK,SACL,EAAK,OACL,EAAK,QACL,EAAK,SACL,EAAK,QACL,EAAK,QACL,EAAK,QACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,UACL,EAAK,QACL,EAAK,OACL,EAAK,QACL,EAAK,SACL,EAAK,SACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,SACL,EAAK,UACL,EAAK,SACL,EAAK,SACL,EAAK,SACL,EAAK,UACL,EAAK,OArCW;AAuCpB;AAOA,SAAgB,EAAc,GAAyB,GAAuB;CAe5E,OAdK,IAEH,EAAK,SAAS,cACd,EAAK,SAAS,MACd,EAAK,QAAQ,MACb,EAAK,aAAa,MAClB,EAAK,QAAQ,MACb,EAAK,QAAQ,MACb,EAAK,UAAU,MACf,EAAK,WAAW,OAET,KAEL,EAAK,YAAY,KAAa,EAAiB,GAAM,EAAQ,EAAK,IAAI,CAAC,IACpE,KAdW;AAepB"}
|
|
1
|
+
{"version":3,"file":"viewerKind.js","names":[],"sources":["../../src/lib/viewerKind.ts"],"sourcesContent":["/**\n * Maps a file (name / mime / size / URL) to a {@link ViewerFile} — the single source of truth for \"which\n * in-browser viewer renders this\", shared by:\n * - {@link FileChip} (the chip in a conversation): routes images/videos to the lightbox itself, then\n * delegates everything else here.\n * - the archive browsers (Zip / 7z / tar / rar): an entry, once extracted to a blob URL, is classified the\n * same way and handed to {@link FileViewerBody} — so a file INSIDE an archive previews with the very same\n * viewers as a top-level file (the previous archive detail view only handled text/image/office/dicom).\n *\n * Detection order mirrors FileChip's historical priority exactly (raster/ebook beat the image lightbox; the\n * textual specializations — har/subtitle/geo/csv/notebook/cert — beat the generic source route). The only\n * additions for the archive context are `image` / `video` (rendered inline in the body instead of the lightbox)\n * and a `binary` fall-through (an entry that matches no viewer and isn't text → a download card).\n */\nimport {\n ebookKind,\n fileExt,\n hljsLang,\n isAppxFile,\n isAudioFile,\n isBinaryObjFile,\n isCertFile,\n isCsvFile,\n isDicomFile,\n isDocxFile,\n isDxfFile,\n isEmlFile,\n isEplFile,\n isFontFile,\n isGeoFile,\n isHarFile,\n isHprofFile,\n isHtmlFile,\n isImageFile,\n isJavaClassFile,\n isJksFile,\n isJsonlFile,\n isLogFile,\n isMhtFile,\n isMindMapFile,\n isModelFile,\n isLrcFile,\n isMsiFile,\n isNotebookFile,\n isPdfFile,\n isQmcAudioFile,\n isPptxFile,\n isRarFile,\n isRtfFile,\n isSevenZipFile,\n isSqliteFile,\n isSubtitleFile,\n isSvgFile,\n isTarballFile,\n isTextFile,\n isStepFile,\n isVideoFile,\n isXlsxFile,\n isXmindFile,\n isZipFile,\n rasterImageKind,\n} from '@/lib/fileType'\nimport { isDiagramFile } from '@/lib/diagram'\nimport { looksLikeMindMap } from '@/lib/mindmap'\nimport type { ViewerFile } from '@/composables/useFileViewer'\n\nexport interface ClassifyOpts {\n /** Display name (becomes {@link ViewerFile.name}). */\n name: string\n /** Fetch / download URL — the real endpoint, or a `blob:` URL for an extracted archive entry. */\n url: string\n /** Provider mime when known; null for archive entries (extension-driven detection). */\n mime?: string | null\n /** Byte size when known (drives the large-file / log routing). */\n size?: number\n /** Name used for TYPE detection when it differs from the display name (e.g. a chip captioned \"16×16 PNG\"). */\n detectName?: string\n /** Fall-back hint when nothing matches and the extension is ambiguous (archive NUL-sniff says \"looks textual\"). */\n textHint?: boolean\n}\n\n/**\n * Classify a file into the {@link ViewerFile} the side viewer should render. Pure — no lightbox / fetching\n * side effects (FileChip handles the lightbox before calling this). Never returns image/video for the main\n * chip flow (FileChip routes those itself); archive callers DO get image/video/binary.\n */\nexport function classifyViewerFile(o: ClassifyOpts): ViewerFile {\n const name = o.name\n const dn = o.detectName ?? o.name\n const mime = o.mime ?? null\n const size = o.size\n const base = { name, url: o.url, size }\n\n // Decoding images (TIFF/PSD/HEIC/RAW) and e-books carry image/* mimes, so they must beat the image route.\n const raster = rasterImageKind(dn, mime)\n if (raster) return { ...base, lang: '', raster }\n const eb = ebookKind(dn, mime)\n if (eb) return { ...base, lang: '', ebook: eb }\n // Diagrams (.drawio/.excalidraw) are XML/JSON under the hood — render as SVG, with the raw text on the source\n // toggle (lang feeds that highlight: xml for drawio, json for excalidraw).\n const diagram = isDiagramFile(dn, mime)\n if (diagram) return { ...base, lang: diagram === 'excalidraw' ? 'json' : 'xml', diagram }\n // image / video render inline in the body (archive context); the main FileChip flow never reaches here for\n // those (it opens the lightbox first), so this only fires for archive entries.\n if (isImageFile(dn, mime)) return { ...base, lang: '', image: true }\n if (isVideoFile(dn, mime)) return { ...base, lang: '', video: true }\n // APPX/MSIX are zip containers, so they MUST be claimed before the generic zip route; MSI is an OLE\n // compound file (not a zip), grouped here with the other Windows installer/package formats.\n if (isAppxFile(dn, mime)) return { ...base, lang: '', appx: true }\n if (isMsiFile(dn, mime)) return { ...base, lang: '', msi: true }\n // XMind is a zip container → claim it before the generic zip route (renders as a mind map, not an archive).\n if (isXmindFile(dn, mime)) return { ...base, lang: '', xmind: true }\n if (isZipFile(dn, mime)) return { ...base, lang: '', zip: true }\n if (isSevenZipFile(dn, mime)) return { ...base, lang: '', sevenZip: true }\n if (isTarballFile(dn, mime)) return { ...base, lang: '', archive: 'tar' }\n if (isRarFile(dn, mime)) return { ...base, lang: '', archive: 'rar' }\n if (isDicomFile(dn, mime)) return { ...base, lang: '', dicom: true }\n if (isBinaryObjFile(dn, mime)) return { ...base, lang: '', binobj: true }\n if (isEplFile(dn, mime)) return { ...base, lang: '', epl: true }\n if (isJavaClassFile(dn, mime)) return { ...base, lang: '', javaClass: true }\n if (isHprofFile(dn, mime)) return { ...base, lang: '', hprof: true }\n if (isDocxFile(dn, mime)) return { ...base, lang: '', docx: true }\n if (isXlsxFile(dn, mime)) return { ...base, lang: '', xlsx: true }\n if (isPptxFile(dn, mime)) return { ...base, lang: '', pptx: true }\n if (isRtfFile(dn, mime)) return { ...base, lang: '', rtf: true }\n if (isPdfFile(dn, mime)) return { ...base, lang: '', pdf: true }\n if (isMindMapFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), mindmap: true }\n // DXF is textual (ASCII CAD) → claim it before the generic text route so it renders as a drawing.\n if (isDxfFile(dn, mime)) return { ...base, lang: '', dxf: true }\n // STEP can carry text/plain, including large files; preserve its format even for a caption-only name.\n if (isStepFile(dn, mime)) return { ...base, lang: '', model: true, modelFormat: 'step' }\n if (isMhtFile(dn, mime)) return { ...base, lang: '', mht: true }\n if (isEmlFile(dn, mime)) return { ...base, lang: '', eml: true }\n if (isHarFile(dn, mime)) return { ...base, lang: '', har: true }\n if (isSqliteFile(dn, mime)) return { ...base, lang: '', sqlite: true }\n if (isSubtitleFile(dn, mime)) return { ...base, lang: '', subtitle: true }\n if (isGeoFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), geo: true }\n // QQ Music encrypted audio (.mflac/.mgg/…) → decrypt + play; LRC lyrics (.lrc) → synced lyric list. LRC must\n // beat the generic text route (its viewer self-fetches so it can sniff the usual GBK encoding).\n if (isQmcAudioFile(dn, mime)) return { ...base, lang: '', qmc: true }\n if (isLrcFile(dn, mime)) return { ...base, lang: '', lrc: true }\n if (isAudioFile(dn, mime)) return { ...base, lang: '', audio: true }\n // Logs / large text before the generic text + csv routes (a huge CSV streams through the log viewer).\n if (isLogFile(dn, mime, size)) return { ...base, lang: '', log: true }\n if (isCsvFile(dn, mime)) return { ...base, lang: '', csv: true }\n if (isJsonlFile(dn, mime)) return { ...base, lang: 'json', jsonl: true }\n if (isModelFile(dn, mime)) return { ...base, lang: '', model: true }\n if (isFontFile(dn, mime)) return { ...base, lang: '', font: true }\n if (isNotebookFile(dn, mime)) return { ...base, lang: '', ipynb: true }\n // Keystores (JKS/JCEKS + PKCS#12) before the cert route — the viewer sniffs the bytes to pick the parser.\n if (isJksFile(dn, mime)) return { ...base, lang: '', jks: true }\n if (isCertFile(dn, mime)) return { ...base, lang: '', cert: true }\n // SVG / HTML get a render/source toggle; plain text/code falls to the source view.\n if (isSvgFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), svg: true }\n if (isHtmlFile(dn, mime)) return { ...base, lang: hljsLang(dn, mime), html: true }\n if (isTextFile(dn, mime) || o.textHint) return { ...base, lang: hljsLang(dn, mime) }\n // Nothing matched and it isn't text → an unpreviewable binary (archive entries only; FileChip never opens these).\n return { ...base, lang: '', binary: true }\n}\n\n// Common image/video/audio MIME by extension — used when an archive browser wraps extracted entry bytes in a\n// Blob URL, so an <img>/<video>/<audio> reliably decodes it (an untyped blob makes the browser guess). Returns\n// '' for non-media (text/office/etc. sub-viewers fetch the bytes themselves, where the blob type is irrelevant).\nconst MEDIA_MIME: Record<string, string> = {\n png: 'image/png',\n jpg: 'image/jpeg',\n jpeg: 'image/jpeg',\n jfif: 'image/jpeg',\n gif: 'image/gif',\n webp: 'image/webp',\n bmp: 'image/bmp',\n ico: 'image/x-icon',\n avif: 'image/avif',\n apng: 'image/apng',\n svg: 'image/svg+xml',\n mp4: 'video/mp4',\n m4v: 'video/mp4',\n webm: 'video/webm',\n ogv: 'video/ogg',\n mov: 'video/quicktime',\n mkv: 'video/x-matroska',\n mp3: 'audio/mpeg',\n wav: 'audio/wav',\n flac: 'audio/flac',\n ogg: 'audio/ogg',\n oga: 'audio/ogg',\n m4a: 'audio/mp4',\n aac: 'audio/aac',\n opus: 'audio/opus',\n}\n\n/** Best-effort media MIME for an extracted archive entry's Blob (see {@link MEDIA_MIME}); '' when not media. */\nexport function mediaMimeForName(name: string): string {\n return MEDIA_MIME[fileExt(name)] ?? ''\n}\n\n/**\n * Does this file render WITHOUT the panel-loaded text — i.e. a self-fetching sub-viewer (it pulls its own\n * bytes), or an image/video/binary (rendered straight from the URL)? When true the panel skips the text\n * fetch and hides the copy/refresh actions; when false the content is built from fetched text (markdown /\n * html / svg / subtitle / geo / csv / mind-map / source) or inline `content`.\n */\nexport function skipsTextLoad(file: ViewerFile | null): boolean {\n if (!file) return false\n return !!(\n file.zip ||\n file.sevenZip ||\n file.xmind ||\n file.dxf ||\n file.archive ||\n file.binobj ||\n file.epl ||\n file.javaClass ||\n file.hprof ||\n file.msi ||\n file.appx ||\n file.dicom ||\n file.docx ||\n file.xlsx ||\n file.pptx ||\n file.rtf ||\n file.pdf ||\n file.eml ||\n file.mht ||\n file.har ||\n file.sqlite ||\n file.cert ||\n file.jks ||\n file.font ||\n file.ipynb ||\n file.audio ||\n file.qmc ||\n file.lrc ||\n file.log ||\n file.model ||\n file.raster ||\n file.ebook ||\n file.image ||\n file.video ||\n file.binary ||\n file.hex\n )\n}\n\n/**\n * Can this file be shown both rendered and as source (so the header offers an eye/code toggle)? True for\n * markdown / html / svg / subtitle / geo / csv, and for a mind map only once the loaded text actually looks\n * like one (a non-mind-map `.mm` reads as plain source, no toggle).\n */\nexport function canToggleView(file: ViewerFile | null, text: string): boolean {\n if (!file) return false\n if (\n file.lang === 'markdown' ||\n file.html === true ||\n file.svg === true ||\n file.subtitle === true ||\n file.geo === true ||\n file.csv === true ||\n file.jsonl === true ||\n file.diagram != null\n ) {\n return true\n }\n if (file.mindmap === true) return looksLikeMindMap(text, fileExt(file.name))\n return false\n}\n"],"mappings":";;;;AAsFA,SAAgB,EAAmB,GAA6B;CAC9D,IAAM,IAAO,EAAE,MACT,IAAK,EAAE,cAAc,EAAE,MACvB,IAAO,EAAE,QAAQ,MACjB,IAAO,EAAE,MACT,IAAO;EAAE;EAAM,KAAK,EAAE;EAAK;CAAK,GAGhC,IAAS,EAAgB,GAAI,CAAI;CACvC,IAAI,GAAQ,OAAO;EAAE,GAAG;EAAM,MAAM;EAAI;CAAO;CAC/C,IAAM,IAAK,EAAU,GAAI,CAAI;CAC7B,IAAI,GA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AM;AACR;AAGA,SAAgB,EAAiB,GAAsB;CACrD,OAAO,EAAW,EAAQ,CAAI,MAAM;AACtC;AAQA,SAAgB,EAAc,GAAkC;CAE9D,OADK,IACE,CAAC,EACN,EAAK,OACL,EAAK,YACL,EAAK,SACL,EAAK,OACL,EAAK,WACL,EAAK,UACL,EAAK,OACL,EAAK,aACL,EAAK,SACL,EAAK,OACL,EAAK,QACL,EAAK,SACL,EAAK,QACL,EAAK,QACL,EAAK,QACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,UACL,EAAK,QACL,EAAK,OACL,EAAK,QACL,EAAK,SACL,EAAK,SACL,EAAK,OACL,EAAK,OACL,EAAK,OACL,EAAK,SACL,EAAK,UACL,EAAK,SACL,EAAK,SACL,EAAK,SACL,EAAK,UACL,EAAK,OArCW;AAuCpB;AAOA,SAAgB,EAAc,GAAyB,GAAuB;CAe5E,OAdK,IAEH,EAAK,SAAS,cACd,EAAK,SAAS,MACd,EAAK,QAAQ,MACb,EAAK,aAAa,MAClB,EAAK,QAAQ,MACb,EAAK,QAAQ,MACb,EAAK,UAAU,MACf,EAAK,WAAW,OAET,KAEL,EAAK,YAAY,KAAa,EAAiB,GAAM,EAAQ,EAAK,IAAI,CAAC,IACpE,KAdW;AAepB"}
|
package/dist/lib/xlsx.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface XlsxCell {
|
|
|
13
13
|
fontSize?: number;
|
|
14
14
|
/** The cell's formula expression WITHOUT a leading `=` (e.g. `数据基表!B10`, `#REF!`), for the source view. */
|
|
15
15
|
formula?: string;
|
|
16
|
-
/**
|
|
16
|
+
/** Authored text/fill colors; automatic and untinted Office text1 use the viewer's default text. */
|
|
17
17
|
color?: string;
|
|
18
18
|
bg?: string;
|
|
19
19
|
align?: 'left' | 'center' | 'right';
|