@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,64 @@
|
|
|
1
|
+
//#region src/lib/docxTheme.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
let t = /^rgb\((\d+), (\d+), (\d+)\)$/.exec(e);
|
|
4
|
+
if (!(!t || t[1] !== t[2] || t[2] !== t[3])) return Number(t[1]);
|
|
5
|
+
}
|
|
6
|
+
var t = "rgba(0, 0, 0, 0)", n = [
|
|
7
|
+
"top",
|
|
8
|
+
"right",
|
|
9
|
+
"bottom",
|
|
10
|
+
"left"
|
|
11
|
+
];
|
|
12
|
+
function r(r) {
|
|
13
|
+
let i = r.ownerDocument.defaultView;
|
|
14
|
+
if (i) for (let a of r.querySelectorAll(".docx-wrapper > section.docx")) {
|
|
15
|
+
if (a.querySelector("svg, canvas, iframe, object, embed, video, math")) continue;
|
|
16
|
+
let r = [], o = !0;
|
|
17
|
+
for (let s of [a, ...a.querySelectorAll("*")]) {
|
|
18
|
+
if (s.tagName === "STYLE" || s.tagName === "SCRIPT") continue;
|
|
19
|
+
let c = i.getComputedStyle(s), l = e(c.color), u = e(c.backgroundColor);
|
|
20
|
+
if (l === void 0 && c.color !== t || l !== void 0 && l > 128 || u !== 255 && c.backgroundColor !== t || c.backgroundImage !== "none" || c.boxShadow !== "none" && s !== a) {
|
|
21
|
+
o = !1;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
let d = {};
|
|
25
|
+
if (l !== void 0 && (d.color = l === 0 ? "var(--text)" : "var(--muted)"), u === 255 && (d["background-color"] = "var(--surface)"), s.tagName === "IMG" && (d["background-color"] = "#fff"), ["::before", "::after"].some((e) => {
|
|
26
|
+
let t = i.getComputedStyle(s, e).content;
|
|
27
|
+
return t !== "none" && t !== "normal";
|
|
28
|
+
})) {
|
|
29
|
+
o = !1;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (c.textDecorationLine !== "none") {
|
|
33
|
+
if (e(c.textDecorationColor) === void 0) {
|
|
34
|
+
o = !1;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
d["text-decoration-color"] = "currentColor";
|
|
38
|
+
}
|
|
39
|
+
for (let r of n) {
|
|
40
|
+
let n = c.getPropertyValue(`border-${r}-color`);
|
|
41
|
+
if (!(c.getPropertyValue(`border-${r}-style`) === "none" || n === t)) {
|
|
42
|
+
if (e(n) === void 0) {
|
|
43
|
+
o = !1;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
d[`border-${r}-color`] = "var(--border-2)";
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!o) break;
|
|
50
|
+
r.push({
|
|
51
|
+
element: s,
|
|
52
|
+
values: d
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
if (o) {
|
|
56
|
+
for (let { element: e, values: t } of r) for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
57
|
+
a.dataset.fvReadingTheme = "adaptive";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { r as applyDocxReadingTheme };
|
|
63
|
+
|
|
64
|
+
//# sourceMappingURL=docxTheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docxTheme.js","names":[],"sources":["../../src/lib/docxTheme.ts"],"sourcesContent":["/** Restrict recoloring to opaque sRGB grays; unknown color spaces retain their authored appearance. */\nfunction grayChannel(color: string): number | undefined {\n const match = /^rgb\\((\\d+), (\\d+), (\\d+)\\)$/.exec(color)\n if (!match || match[1] !== match[2] || match[2] !== match[3]) return undefined\n return Number(match[1])\n}\n\nconst TRANSPARENT = 'rgba(0, 0, 0, 0)'\nconst SIDES = ['top', 'right', 'bottom', 'left'] as const\n\n/**\n * Adapt simple black-on-white Word pages once after rendering. CSS variables handle subsequent theme\n * changes without re-parsing or replacing the document. Pages with authored colors, shading or complex\n * drawings stay intact: a partial override could make their foreground/background combinations unreadable.\n */\nexport function applyDocxReadingTheme(root: HTMLElement): void {\n const view = root.ownerDocument.defaultView\n if (!view) return\n\n for (const page of root.querySelectorAll<HTMLElement>('.docx-wrapper > section.docx')) {\n if (page.querySelector('svg, canvas, iframe, object, embed, video, math')) continue\n const changes: Array<{ element: HTMLElement; values: Record<string, string> }> = []\n let compatible = true\n for (const element of [page, ...page.querySelectorAll<HTMLElement>('*')]) {\n if (element.tagName === 'STYLE' || element.tagName === 'SCRIPT') continue\n const style = view.getComputedStyle(element)\n const foreground = grayChannel(style.color)\n const background = grayChannel(style.backgroundColor)\n if (\n (foreground === undefined && style.color !== TRANSPARENT) ||\n (foreground !== undefined && foreground > 128) ||\n (background !== 255 && style.backgroundColor !== TRANSPARENT) ||\n style.backgroundImage !== 'none' ||\n (style.boxShadow !== 'none' && element !== page)\n ) {\n compatible = false\n break\n }\n\n const values: Record<string, string> = {}\n if (foreground !== undefined) values.color = foreground === 0 ? 'var(--text)' : 'var(--muted)'\n if (background === 255) values['background-color'] = 'var(--surface)'\n // Transparent image pixels originally sat on white paper; preserve that composite in dark mode.\n if (element.tagName === 'IMG') values['background-color'] = '#fff'\n // Generated bullets/fields may have their own CSS colors, outside the ordinary DOM style tree.\n if (\n ['::before', '::after'].some((pseudo) => {\n const content = view.getComputedStyle(element, pseudo).content\n return content !== 'none' && content !== 'normal'\n })\n ) {\n compatible = false\n break\n }\n if (style.textDecorationLine !== 'none') {\n if (grayChannel(style.textDecorationColor) === undefined) {\n compatible = false\n break\n }\n values['text-decoration-color'] = 'currentColor'\n }\n for (const side of SIDES) {\n const color = style.getPropertyValue(`border-${side}-color`)\n if (style.getPropertyValue(`border-${side}-style`) === 'none' || color === TRANSPARENT)\n continue\n if (grayChannel(color) === undefined) {\n compatible = false\n break\n }\n values[`border-${side}-color`] = 'var(--border-2)'\n }\n if (!compatible) break\n changes.push({ element, values })\n }\n if (!compatible) continue\n // Apply only after the entire page passes, avoiding mixed original/themed foregrounds on one page.\n for (const { element, values } of changes) {\n for (const [property, value] of Object.entries(values))\n element.style.setProperty(property, value)\n }\n page.dataset.fvReadingTheme = 'adaptive'\n }\n}\n"],"mappings":";AACA,SAAS,EAAY,GAAmC;CACtD,IAAM,IAAQ,+BAA+B,KAAK,CAAK;CACnD,OAAC,KAAS,EAAM,OAAO,EAAM,MAAM,EAAM,OAAO,EAAM,KAC1D,OAAO,OAAO,EAAM,EAAE;AACxB;AAEA,IAAM,IAAc,oBACd,IAAQ;CAAC;CAAO;CAAS;CAAU;AAAM;AAO/C,SAAgB,EAAsB,GAAyB;CAC7D,IAAM,IAAO,EAAK,cAAc;CAC3B,OAEL,KAAK,IAAM,KAAQ,EAAK,iBAA8B,8BAA8B,GAAG;EACrF,IAAI,EAAK,cAAc,iDAAiD,GAAG;EAC3E,IAAM,IAA2E,CAAC,GAC9E,IAAa;EACjB,KAAK,IAAM,KAAW,CAAC,GAAM,GAAG,EAAK,iBAA8B,GAAG,CAAC,GAAG;GACxE,IAAI,EAAQ,YAAY,WAAW,EAAQ,YAAY,UAAU;GACjE,IAAM,IAAQ,EAAK,iBAAiB,CAAO,GACrC,IAAa,EAAY,EAAM,KAAK,GACpC,IAAa,EAAY,EAAM,eAAe;GACpD,IACG,MAAe,KAAA,KAAa,EAAM,UAAU,KAC5C,MAAe,KAAA,KAAa,IAAa,OACzC,MAAe,OAAO,EAAM,oBAAoB,KACjD,EAAM,oBAAoB,UACzB,EAAM,cAAc,UAAU,MAAY,GAC3C;IACA,IAAa;IACb;GACF;GAEA,IAAM,IAAiC,CAAC;GAMxC,IALI,MAAe,KAAA,MAAW,EAAO,QAAQ,MAAe,IAAI,gBAAgB,iBAC5E,MAAe,QAAK,EAAO,sBAAsB,mBAEjD,EAAQ,YAAY,UAAO,EAAO,sBAAsB,SAG1D,CAAC,YAAY,SAAS,CAAC,CAAC,MAAM,MAAW;IACvC,IAAM,IAAU,EAAK,iBAAiB,GAAS,CAAM,CAAC,CAAC;IACvD,OAAO,MAAY,UAAU,MAAY;GAC3C,CAAC,GACD;IACA,IAAa;IACb;GACF;GACA,IAAI,EAAM,uBAAuB,QAAQ;IACvC,IAAI,EAAY,EAAM,mBAAmB,MAAM,KAAA,GAAW;KACxD,IAAa;KACb;IACF;IACA,EAAO,2BAA2B;GACpC;GACA,KAAK,IAAM,KAAQ,GAAO;IACxB,IAAM,IAAQ,EAAM,iBAAiB,UAAU,EAAK,OAAO;IACvD,QAAM,iBAAiB,UAAU,EAAK,OAAO,MAAM,UAAU,MAAU,IAE3E;SAAI,EAAY,CAAK,MAAM,KAAA,GAAW;MACpC,IAAa;MACb;KACF;KACA,EAAO,UAAU,EAAK,WAAW;IADjC;GAEF;GACA,IAAI,CAAC,GAAY;GACjB,EAAQ,KAAK;IAAE;IAAS;GAAO,CAAC;EAClC;EACK,OAEL;QAAK,IAAM,EAAE,YAAS,eAAY,GAChC,KAAK,IAAM,CAAC,GAAU,MAAU,OAAO,QAAQ,CAAM,GACnD,EAAQ,MAAM,YAAY,GAAU,CAAK;GAE7C,EAAK,QAAQ,iBAAiB;EAFe;CAG/C;AACF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { readVariables as e } from "./variable.js";
|
|
2
|
+
//#region src/lib/epl/code/structures.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.readStringsWithMfcStyleCountPrefix().map((e) => {
|
|
5
|
+
let t = e.split("\r");
|
|
6
|
+
return {
|
|
7
|
+
fileName: t[0] ?? "",
|
|
8
|
+
guidString: t[1] ?? "",
|
|
9
|
+
version: [parseInt(t[2] ?? "0", 10) || 0, parseInt(t[3] ?? "0", 10) || 0],
|
|
10
|
+
name: t[4] ?? "",
|
|
11
|
+
minRequiredCmd: 0,
|
|
12
|
+
minRequiredDataType: 0,
|
|
13
|
+
minRequiredConstant: 0
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function n(e, t, n, r) {
|
|
18
|
+
for (let i = 0; i < e.length; i++) e[i].minRequiredCmd = t && i < t.length ? t[i] : 0, e[i].minRequiredDataType = n && i < n.length ? n[i] : 0, e[i].minRequiredConstant = r && i < r.length ? r[i] : 0;
|
|
19
|
+
}
|
|
20
|
+
function r(t) {
|
|
21
|
+
return t.readBlocksWithIdAndMemoryAddress((t, n, r) => ({
|
|
22
|
+
id: n,
|
|
23
|
+
memoryAddress: r,
|
|
24
|
+
form: t.readInt32(),
|
|
25
|
+
baseClass: t.readInt32(),
|
|
26
|
+
name: t.readStringWithLengthPrefix(),
|
|
27
|
+
comment: t.readStringWithLengthPrefix(),
|
|
28
|
+
methods: t.readInt32sWithByteSizePrefix(),
|
|
29
|
+
variables: e(t, "classMember")
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
function i(t) {
|
|
33
|
+
return t.readBlocksWithIdAndMemoryAddress((t, n, r) => ({
|
|
34
|
+
id: n,
|
|
35
|
+
memoryAddress: r,
|
|
36
|
+
classId: t.readInt32(),
|
|
37
|
+
flags: t.readInt32(),
|
|
38
|
+
returnDataType: t.readInt32(),
|
|
39
|
+
name: t.readStringWithLengthPrefix(),
|
|
40
|
+
comment: t.readStringWithLengthPrefix(),
|
|
41
|
+
variables: e(t, "local"),
|
|
42
|
+
parameters: e(t, "methodParameter"),
|
|
43
|
+
codeData: {
|
|
44
|
+
lineOffset: t.readBytesWithLengthPrefix(),
|
|
45
|
+
blockOffset: t.readBytesWithLengthPrefix(),
|
|
46
|
+
methodReference: t.readBytesWithLengthPrefix(),
|
|
47
|
+
variableReference: t.readBytesWithLengthPrefix(),
|
|
48
|
+
constantReference: t.readBytesWithLengthPrefix(),
|
|
49
|
+
expressionData: t.readBytesWithLengthPrefix()
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function a(t) {
|
|
54
|
+
return t.readBlocksWithIdAndMemoryAddress((t, n, r) => ({
|
|
55
|
+
id: n,
|
|
56
|
+
memoryAddress: r,
|
|
57
|
+
flags: t.readInt32(),
|
|
58
|
+
name: t.readStringWithLengthPrefix(),
|
|
59
|
+
comment: t.readStringWithLengthPrefix(),
|
|
60
|
+
members: e(t, "structMember")
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
function o(t) {
|
|
64
|
+
return t.readBlocksWithIdAndMemoryAddress((t, n, r) => {
|
|
65
|
+
let i = t.readInt32(), a = t.readInt32(), o = t.readStringWithLengthPrefix(), s = t.readStringWithLengthPrefix(), c = t.readStringWithLengthPrefix();
|
|
66
|
+
return {
|
|
67
|
+
id: n,
|
|
68
|
+
memoryAddress: r,
|
|
69
|
+
flags: i,
|
|
70
|
+
returnDataType: a,
|
|
71
|
+
name: o,
|
|
72
|
+
comment: s,
|
|
73
|
+
entryPoint: t.readStringWithLengthPrefix(),
|
|
74
|
+
libraryName: c,
|
|
75
|
+
parameters: e(t, "dllParameter")
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { n as applyCompatibilityInfo, r as readClasses, o as readDllDeclares, t as readLibraries, i as readMethods, a as readStructs };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=structures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structures.js","names":[],"sources":["../../../../src/lib/epl/code/structures.ts"],"sourcesContent":["/**\n * Code-section structures — ports of `ClassInfo.cs`, `MethodInfo.cs` (+ `MethodCodeData`), `StructInfo.cs`,\n * `DllDeclareInfo.cs`, `LibraryRefInfo.cs`.\n *\n * Classes / methods / structs / DLL declares are read via the id+memory-address block table (no per-block\n * length); their variable lists reuse {@link readVariables}. The reads run in C# source order — kept here as\n * explicit statement sequences (not object literals) so the cursor advances identically.\n */\nimport type { BinaryReader } from '../io/binaryReader'\nimport { type EplVariable, readVariables } from './variable'\n\n// ── library references ──────────────────────────────────────────────────────────────────────────\nexport interface LibraryRefInfo {\n fileName: string\n /** Raw GUID string, kept verbatim for faithful round-trip. */\n guidString: string\n version: [number, number]\n name: string\n /** Min command count for the支持库版本检查 (filled by {@link applyCompatibilityInfo}). */\n minRequiredCmd: number\n minRequiredDataType: number\n minRequiredConstant: number\n}\n\n/** Read the library list: MFC-count-prefixed strings, each `fileName\\rguid\\rmajor\\rminor\\rname`. */\nexport function readLibraries(r: BinaryReader): LibraryRefInfo[] {\n return r.readStringsWithMfcStyleCountPrefix().map((x) => {\n const a = x.split('\\r')\n return {\n fileName: a[0] ?? '',\n guidString: a[1] ?? '',\n version: [parseInt(a[2] ?? '0', 10) || 0, parseInt(a[3] ?? '0', 10) || 0],\n name: a[4] ?? '',\n minRequiredCmd: 0,\n minRequiredDataType: 0,\n minRequiredConstant: 0,\n }\n })\n}\n\n/** Attach the per-library min-required counts read separately in the code-section header. */\nexport function applyCompatibilityInfo(\n infos: LibraryRefInfo[],\n minRequiredCmds: number[] | null,\n minRequiredDataTypes: number[] | null,\n minRequiredConstants: number[] | null,\n): void {\n for (let i = 0; i < infos.length; i++) {\n infos[i].minRequiredCmd = minRequiredCmds && i < minRequiredCmds.length ? minRequiredCmds[i] : 0\n infos[i].minRequiredDataType =\n minRequiredDataTypes && i < minRequiredDataTypes.length ? minRequiredDataTypes[i] : 0\n infos[i].minRequiredConstant =\n minRequiredConstants && i < minRequiredConstants.length ? minRequiredConstants[i] : 0\n }\n}\n\n// ── classes (程序集) ────────────────────────────────────────────────────────────────────────────\nexport interface ClassInfo {\n id: number\n memoryAddress: number\n /** Associated form Id for a window class; 0 otherwise. */\n form: number\n baseClass: number\n name: string\n comment: string\n /** Ids of the methods that belong to this class. */\n methods: number[]\n /** Class member variables. */\n variables: EplVariable[]\n}\n\nexport function readClasses(r: BinaryReader): ClassInfo[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n const form = reader.readInt32()\n const baseClass = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const methods = reader.readInt32sWithByteSizePrefix() // C#: ReadInt32s(ReadInt32() / 4)\n const variables = readVariables(reader, 'classMember')\n return { id, memoryAddress, form, baseClass, name, comment, methods, variables }\n })\n}\n\n// ── methods (子程序) ────────────────────────────────────────────────────────────────────────────\n/** The six raw byte-blobs holding a method's compiled code (parsed by the code-data parser later). */\nexport interface MethodCodeData {\n lineOffset: Uint8Array\n blockOffset: Uint8Array\n methodReference: Uint8Array\n variableReference: Uint8Array\n constantReference: Uint8Array\n /** The bytecode-like expression stream — decompiled to statements by CodeDataParser. */\n expressionData: Uint8Array\n}\n\nexport interface MethodInfo {\n id: number\n memoryAddress: number\n /** Owning class Id. */\n classId: number\n flags: number\n returnDataType: number\n name: string\n comment: string\n /** Local variables. */\n variables: EplVariable[]\n /** Parameters. */\n parameters: EplVariable[]\n codeData: MethodCodeData\n}\n\nexport function readMethods(r: BinaryReader): MethodInfo[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n const classId = reader.readInt32()\n const flags = reader.readInt32()\n const returnDataType = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const variables = readVariables(reader, 'local')\n const parameters = readVariables(reader, 'methodParameter')\n const codeData: MethodCodeData = {\n lineOffset: reader.readBytesWithLengthPrefix(),\n blockOffset: reader.readBytesWithLengthPrefix(),\n methodReference: reader.readBytesWithLengthPrefix(),\n variableReference: reader.readBytesWithLengthPrefix(),\n constantReference: reader.readBytesWithLengthPrefix(),\n expressionData: reader.readBytesWithLengthPrefix(),\n }\n return {\n id,\n memoryAddress,\n classId,\n flags,\n returnDataType,\n name,\n comment,\n variables,\n parameters,\n codeData,\n }\n })\n}\n\n// ── structs (数据类型) ──────────────────────────────────────────────────────────────────────────\nexport interface StructInfo {\n id: number\n memoryAddress: number\n flags: number\n name: string\n comment: string\n members: EplVariable[]\n}\n\nexport function readStructs(r: BinaryReader): StructInfo[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n const flags = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const members = readVariables(reader, 'structMember')\n return { id, memoryAddress, flags, name, comment, members }\n })\n}\n\n// ── DLL declares (DLL命令) ──────────────────────────────────────────────────────────────────────\nexport interface DllDeclareInfo {\n id: number\n memoryAddress: number\n flags: number\n returnDataType: number\n name: string\n comment: string\n entryPoint: string\n libraryName: string\n parameters: EplVariable[]\n}\n\nexport function readDllDeclares(r: BinaryReader): DllDeclareInfo[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n const flags = reader.readInt32()\n const returnDataType = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const libraryName = reader.readStringWithLengthPrefix()\n const entryPoint = reader.readStringWithLengthPrefix()\n const parameters = readVariables(reader, 'dllParameter')\n return {\n id,\n memoryAddress,\n flags,\n returnDataType,\n name,\n comment,\n entryPoint,\n libraryName,\n parameters,\n }\n })\n}\n"],"mappings":";;AAyBA,SAAgB,EAAc,GAAmC;CAC/D,OAAO,EAAE,mCAAmC,CAAC,CAAC,KAAK,MAAM;EACvD,IAAM,IAAI,EAAE,MAAM,IAAI;EACtB,OAAO;GACL,UAAU,EAAE,MAAM;GAClB,YAAY,EAAE,MAAM;GACpB,SAAS,CAAC,SAAS,EAAE,MAAM,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,MAAM,KAAK,EAAE,KAAK,CAAC;GACxE,MAAM,EAAE,MAAM;GACd,gBAAgB;GAChB,qBAAqB;GACrB,qBAAqB;EACvB;CACF,CAAC;AACH;AAGA,SAAgB,EACd,GACA,GACA,GACA,GACM;CACN,KAAK,IAAI,IAAI,GAAG,IAAI,EAAM,QAAQ,KAIhC,AAHA,EAAM,EAAE,CAAC,iBAAiB,KAAmB,IAAI,EAAgB,SAAS,EAAgB,KAAK,GAC/F,EAAM,EAAE,CAAC,sBACP,KAAwB,IAAI,EAAqB,SAAS,EAAqB,KAAK,GACtF,EAAM,EAAE,CAAC,sBACP,KAAwB,IAAI,EAAqB,SAAS,EAAqB,KAAK;AAE1F;AAiBA,SAAgB,EAAY,GAA8B;CACxD,OAAO,EAAE,kCAAkC,GAAQ,GAAI,OAO9C;EAAE;EAAI;EAAe,MANf,EAAO,UAMQ;EAAM,WALhB,EAAO,UAKS;EAAW,MAJhC,EAAO,2BAIyB;EAAM,SAHnC,EAAO,2BAG4B;EAAS,SAF5C,EAAO,6BAEqC;EAAS,WADnD,EAAc,GAAQ,aAC6B;CAAU,EAChF;AACH;AA8BA,SAAgB,EAAY,GAA+B;CACzD,OAAO,EAAE,kCAAkC,GAAQ,GAAI,OAgB9C;EACL;EACA;EACA,SAlBc,EAAO,UAkBrB;EACA,OAlBY,EAAO,UAkBnB;EACA,gBAlBqB,EAAO,UAkB5B;EACA,MAlBW,EAAO,2BAkBlB;EACA,SAlBc,EAAO,2BAkBrB;EACA,WAlBgB,EAAc,GAAQ,OAkBtC;EACA,YAlBiB,EAAc,GAAQ,iBAkBvC;EACA,UAAA;GAjBA,YAAY,EAAO,0BAA0B;GAC7C,aAAa,EAAO,0BAA0B;GAC9C,iBAAiB,EAAO,0BAA0B;GAClD,mBAAmB,EAAO,0BAA0B;GACpD,mBAAmB,EAAO,0BAA0B;GACpD,gBAAgB,EAAO,0BAA0B;EAYjD;CACF,EACD;AACH;AAYA,SAAgB,EAAY,GAA+B;CACzD,OAAO,EAAE,kCAAkC,GAAQ,GAAI,OAK9C;EAAE;EAAI;EAAe,OAJd,EAAO,UAIO;EAAO,MAHtB,EAAO,2BAGe;EAAM,SAFzB,EAAO,2BAEkB;EAAS,SADlC,EAAc,GAAQ,cACY;CAAQ,EAC3D;AACH;AAeA,SAAgB,EAAgB,GAAmC;CACjE,OAAO,EAAE,kCAAkC,GAAQ,GAAI,MAAkB;EACvE,IAAM,IAAQ,EAAO,UAAU,GACzB,IAAiB,EAAO,UAAU,GAClC,IAAO,EAAO,2BAA2B,GACzC,IAAU,EAAO,2BAA2B,GAC5C,IAAc,EAAO,2BAA2B;EAGtD,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA,YATiB,EAAO,2BASxB;GACA;GACA,YAViB,EAAc,GAAQ,cAUvC;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/lib/epl/code/variable.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
return e.readBlocksWithIdAndOffest((e, n) => ({
|
|
4
|
+
kind: t,
|
|
5
|
+
id: n,
|
|
6
|
+
dataType: e.readInt32(),
|
|
7
|
+
flags: e.readInt16(),
|
|
8
|
+
uBound: e.readInt32sWithFixedLength(e.readByte()),
|
|
9
|
+
name: e.readCStyleString(),
|
|
10
|
+
comment: e.readCStyleString()
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as readVariables };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=variable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variable.js","names":[],"sources":["../../../../src/lib/epl/code/variable.ts"],"sourcesContent":["/**\n * Variable info — port of `VariableInfo/AbstractVariableInfo.cs` (+ its subtypes Global/Local/Class/\n * StructMember/MethodParameter/DllParameter).\n *\n * All variable kinds share ONE binary layout (read via the id+offset block table): dataType(int32),\n * flags(int16), uBound(int32[readByte]), name(CString), comment(CString). The subtypes differ only in how\n * their `flags` bits are interpreted and which keyword they emit as text — captured here by {@link EplVarKind}\n * and resolved in the name/text layer, so the structural read stays uniform.\n */\nimport type { BinaryReader } from '../io/binaryReader'\n\n/** Which variable list a row came from — drives the text keyword + flag-bit meaning later. */\nexport type EplVarKind =\n | 'global'\n | 'local'\n | 'classMember'\n | 'structMember'\n | 'methodParameter'\n | 'dllParameter'\n\nexport interface EplVariable {\n kind: EplVarKind\n id: number\n /** Data-type Id (a system DATATYPE_*, a struct/class Id, or a library data type). */\n dataType: number\n flags: number\n /** Array dimensions (UBound): length 0 ⇒ scalar; `[0]` ⇒ dynamic array; otherwise fixed bounds. */\n uBound: number[]\n name: string\n comment: string\n}\n\n/** Read a variable block table (C# AbstractVariableInfo.ReadVariables) tagging each row with `kind`. */\nexport function readVariables(r: BinaryReader, kind: EplVarKind): EplVariable[] {\n return r.readBlocksWithIdAndOffest((reader, id) => {\n const dataType = reader.readInt32()\n const flags = reader.readInt16()\n const uBound = reader.readInt32sWithFixedLength(reader.readByte())\n const name = reader.readCStyleString()\n const comment = reader.readCStyleString()\n return { kind, id, dataType, flags, uBound, name, comment }\n })\n}\n"],"mappings":";AAiCA,SAAgB,EAAc,GAAiB,GAAiC;CAC9E,OAAO,EAAE,2BAA2B,GAAQ,OAMnC;EAAE;EAAM;EAAI,UALF,EAAO,UAKL;EAAU,OAJf,EAAO,UAIQ;EAAO,QAHrB,EAAO,0BAA0B,EAAO,SAAS,CAG5B;EAAQ,MAF/B,EAAO,iBAEwB;EAAM,SADlC,EAAO,iBAC2B;CAAQ,EAC3D;AACH"}
|
|
@@ -1,38 +1,44 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { decoderForLanguage as e, gbk as t } from "./io/encoding.js";
|
|
2
|
+
import { ProjectFileReader as n } from "./projectFileReader.js";
|
|
3
|
+
import { CodeSectionKey as r } from "./sections/code.js";
|
|
4
|
+
import { ESystemInfoKey as i } from "./sections/esystemInfo.js";
|
|
5
|
+
import { ProjectConfigKey as a } from "./sections/projectConfig.js";
|
|
6
|
+
import { LosableSectionKey as o } from "./sections/losable.js";
|
|
7
|
+
import { ResourceSectionKey as s } from "./sections/resource.js";
|
|
2
8
|
//#region src/lib/epl/eplDocument.ts
|
|
3
|
-
var
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
+
var c = 117469977, l = new Map([
|
|
10
|
+
[i.key, i],
|
|
11
|
+
[a.key, a],
|
|
12
|
+
[r.key, r],
|
|
13
|
+
[s.key, s],
|
|
14
|
+
[o.key, o]
|
|
9
15
|
]);
|
|
10
|
-
function
|
|
11
|
-
let i = new
|
|
16
|
+
function u(r) {
|
|
17
|
+
let i = new n(r), a = t(), o = [];
|
|
12
18
|
for (; !i.isFinish;) {
|
|
13
|
-
let
|
|
14
|
-
if (
|
|
15
|
-
let
|
|
16
|
-
if (
|
|
17
|
-
let
|
|
19
|
+
let t = i.readSection();
|
|
20
|
+
if (t.key === c) break;
|
|
21
|
+
let n = l.get(t.key), r;
|
|
22
|
+
if (n) {
|
|
23
|
+
let e = {
|
|
18
24
|
dec: a,
|
|
19
25
|
cryptEC: i.cryptEC
|
|
20
26
|
};
|
|
21
|
-
|
|
22
|
-
} else
|
|
27
|
+
r = n.parse(t.data, e);
|
|
28
|
+
} else r = {
|
|
23
29
|
kind: "general",
|
|
24
|
-
sectionKey:
|
|
25
|
-
sectionName:
|
|
26
|
-
isOptional:
|
|
27
|
-
data:
|
|
30
|
+
sectionKey: t.key,
|
|
31
|
+
sectionName: t.name,
|
|
32
|
+
isOptional: t.isOptional,
|
|
33
|
+
data: t.data
|
|
28
34
|
};
|
|
29
|
-
|
|
35
|
+
r.kind === "systemInfo" && (a = e(r.language)), o.push(r);
|
|
30
36
|
}
|
|
31
37
|
let s = { sections: o };
|
|
32
38
|
for (let e of o) e.kind === "systemInfo" ? s.systemInfo = e : e.kind === "projectConfig" ? s.projectConfig = e : e.kind === "code" ? s.code = e : e.kind === "resource" ? s.resource = e : e.kind === "losable" && (s.losable = e);
|
|
33
39
|
return s;
|
|
34
40
|
}
|
|
35
41
|
//#endregion
|
|
36
|
-
export {
|
|
42
|
+
export { u as loadEpl };
|
|
37
43
|
|
|
38
44
|
//# sourceMappingURL=eplDocument.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eplDocument.js","names":[],"sources":["../../../src/lib/epl/eplDocument.ts"],"sourcesContent":["/**\n * Top-level loader — port of `EplDocument.Load`.\n *\n * Drives {@link ProjectFileReader} section-by-section: a registered {@link SectionType} parses known keys,\n * everything else becomes a {@link GeneralSection}. When the system-info section is seen, its codepage takes\n * over for the rest of the document. The end-of-file section is consumed but not added to the list.\n *\n * `EplSection` is the discriminated union the UI consumes (narrow on `kind`). The registry grows as more\n * section milestones land.\n */\nimport { decoderForLanguage, gbk } from './io/encoding'\nimport type { GeneralSection, ParserContext, SectionType } from './model/section'\nimport { EplEncryptedError, NotEplFileError, ProjectFileReader } from './projectFileReader'\nimport { CodeSectionKey, type CodeSection } from './sections/code'\nimport { ESystemInfoKey, type ESystemInfoSection } from './sections/esystemInfo'\nimport { ProjectConfigKey, type ProjectConfigSection } from './sections/projectConfig'\nimport { LosableSectionKey, type LosableSection } from './sections/losable'\nimport { ResourceSectionKey, type ResourceSection } from './sections/resource'\n\nexport type EplSection =\n | ESystemInfoSection\n | ProjectConfigSection\n | CodeSection\n | ResourceSection\n | LosableSection\n | GeneralSection\n\nconst KEY_END = 0x07007319\n\n/** key → parser registry (mirrors C# PredefinedSections.Keys). Grows as more section milestones land. */\nconst PREDEFINED = new Map<number, SectionType>([\n [ESystemInfoKey.key, ESystemInfoKey],\n [ProjectConfigKey.key, ProjectConfigKey],\n [CodeSectionKey.key, CodeSectionKey],\n [ResourceSectionKey.key, ResourceSectionKey],\n [LosableSectionKey.key, LosableSectionKey],\n])\n\nexport interface EplDocument {\n /** All parsed sections in file order (end-of-file section excluded). */\n sections: EplSection[]\n /** Convenience handles for the common sections (filled after parsing). */\n systemInfo?: ESystemInfoSection\n projectConfig?: ProjectConfigSection\n code?: CodeSection\n resource?: ResourceSection\n losable?: LosableSection\n}\n\n/** Parse a `.e`/`.ec` byte buffer into its sections. Throws {@link EplEncryptedError} / {@link NotEplFileError}. */\nexport function loadEpl(bytes: Uint8Array): EplDocument {\n const reader = new ProjectFileReader(bytes)\n let dec = gbk()\n const sections: EplSection[] = []\n while (!reader.isFinish) {\n const raw = reader.readSection()\n if (raw.key === KEY_END) break // end-of-file section: consumed, not listed\n const type = PREDEFINED.get(raw.key)\n let section: EplSection\n if (type) {\n const ctx: ParserContext = { dec, cryptEC: reader.cryptEC }\n section = type.parse(raw.data, ctx) as EplSection\n } else {\n section = {\n kind: 'general',\n sectionKey: raw.key,\n sectionName: raw.name,\n isOptional: raw.isOptional,\n data: raw.data,\n }\n }\n // The system-info section dictates the codepage for everything that follows it.\n if (section.kind === 'systemInfo') dec = decoderForLanguage(section.language)\n sections.push(section)\n }\n\n const doc: EplDocument = { sections }\n for (const s of sections) {\n if (s.kind === 'systemInfo') doc.systemInfo = s\n else if (s.kind === 'projectConfig') doc.projectConfig = s\n else if (s.kind === 'code') doc.code = s\n else if (s.kind === 'resource') doc.resource = s\n else if (s.kind === 'losable') doc.losable = s\n }\n return doc\n}\n\nexport { EplEncryptedError, NotEplFileError }\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"eplDocument.js","names":[],"sources":["../../../src/lib/epl/eplDocument.ts"],"sourcesContent":["/**\n * Top-level loader — port of `EplDocument.Load`.\n *\n * Drives {@link ProjectFileReader} section-by-section: a registered {@link SectionType} parses known keys,\n * everything else becomes a {@link GeneralSection}. When the system-info section is seen, its codepage takes\n * over for the rest of the document. The end-of-file section is consumed but not added to the list.\n *\n * `EplSection` is the discriminated union the UI consumes (narrow on `kind`). The registry grows as more\n * section milestones land.\n */\nimport { decoderForLanguage, gbk } from './io/encoding'\nimport type { GeneralSection, ParserContext, SectionType } from './model/section'\nimport { EplEncryptedError, NotEplFileError, ProjectFileReader } from './projectFileReader'\nimport { CodeSectionKey, type CodeSection } from './sections/code'\nimport { ESystemInfoKey, type ESystemInfoSection } from './sections/esystemInfo'\nimport { ProjectConfigKey, type ProjectConfigSection } from './sections/projectConfig'\nimport { LosableSectionKey, type LosableSection } from './sections/losable'\nimport { ResourceSectionKey, type ResourceSection } from './sections/resource'\n\nexport type EplSection =\n | ESystemInfoSection\n | ProjectConfigSection\n | CodeSection\n | ResourceSection\n | LosableSection\n | GeneralSection\n\nconst KEY_END = 0x07007319\n\n/** key → parser registry (mirrors C# PredefinedSections.Keys). Grows as more section milestones land. */\nconst PREDEFINED = new Map<number, SectionType>([\n [ESystemInfoKey.key, ESystemInfoKey],\n [ProjectConfigKey.key, ProjectConfigKey],\n [CodeSectionKey.key, CodeSectionKey],\n [ResourceSectionKey.key, ResourceSectionKey],\n [LosableSectionKey.key, LosableSectionKey],\n])\n\nexport interface EplDocument {\n /** All parsed sections in file order (end-of-file section excluded). */\n sections: EplSection[]\n /** Convenience handles for the common sections (filled after parsing). */\n systemInfo?: ESystemInfoSection\n projectConfig?: ProjectConfigSection\n code?: CodeSection\n resource?: ResourceSection\n losable?: LosableSection\n}\n\n/** Parse a `.e`/`.ec` byte buffer into its sections. Throws {@link EplEncryptedError} / {@link NotEplFileError}. */\nexport function loadEpl(bytes: Uint8Array): EplDocument {\n const reader = new ProjectFileReader(bytes)\n let dec = gbk()\n const sections: EplSection[] = []\n while (!reader.isFinish) {\n const raw = reader.readSection()\n if (raw.key === KEY_END) break // end-of-file section: consumed, not listed\n const type = PREDEFINED.get(raw.key)\n let section: EplSection\n if (type) {\n const ctx: ParserContext = { dec, cryptEC: reader.cryptEC }\n section = type.parse(raw.data, ctx) as EplSection\n } else {\n section = {\n kind: 'general',\n sectionKey: raw.key,\n sectionName: raw.name,\n isOptional: raw.isOptional,\n data: raw.data,\n }\n }\n // The system-info section dictates the codepage for everything that follows it.\n if (section.kind === 'systemInfo') dec = decoderForLanguage(section.language)\n sections.push(section)\n }\n\n const doc: EplDocument = { sections }\n for (const s of sections) {\n if (s.kind === 'systemInfo') doc.systemInfo = s\n else if (s.kind === 'projectConfig') doc.projectConfig = s\n else if (s.kind === 'code') doc.code = s\n else if (s.kind === 'resource') doc.resource = s\n else if (s.kind === 'losable') doc.losable = s\n }\n return doc\n}\n\nexport { EplEncryptedError, NotEplFileError }\n"],"mappings":";;;;;;;;AA2BA,IAAM,IAAU,WAGV,IAAa,IAAI,IAAyB;CAC9C,CAAC,EAAe,KAAK,CAAc;CACnC,CAAC,EAAiB,KAAK,CAAgB;CACvC,CAAC,EAAe,KAAK,CAAc;CACnC,CAAC,EAAmB,KAAK,CAAkB;CAC3C,CAAC,EAAkB,KAAK,CAAiB;AAC3C,CAAC;AAcD,SAAgB,EAAQ,GAAgC;CACtD,IAAM,IAAS,IAAI,EAAkB,CAAK,GACtC,IAAM,EAAI,GACR,IAAyB,CAAC;CAChC,OAAO,CAAC,EAAO,WAAU;EACvB,IAAM,IAAM,EAAO,YAAY;EAC/B,IAAI,EAAI,QAAQ,GAAS;EACzB,IAAM,IAAO,EAAW,IAAI,EAAI,GAAG,GAC/B;EACJ,IAAI,GAAM;GACR,IAAM,IAAqB;IAAE;IAAK,SAAS,EAAO;GAAQ;GAC1D,IAAU,EAAK,MAAM,EAAI,MAAM,CAAG;EACpC,OACE,IAAU;GACR,MAAM;GACN,YAAY,EAAI;GAChB,aAAa,EAAI;GACjB,YAAY,EAAI;GAChB,MAAM,EAAI;EACZ;EAIF,AADI,EAAQ,SAAS,iBAAc,IAAM,EAAmB,EAAQ,QAAQ,IAC5E,EAAS,KAAK,CAAO;CACvB;CAEA,IAAM,IAAmB,EAAE,YAAS;CACpC,KAAK,IAAM,KAAK,GACd,AAAI,EAAE,SAAS,eAAc,EAAI,aAAa,IACrC,EAAE,SAAS,kBAAiB,EAAI,gBAAgB,IAChD,EAAE,SAAS,SAAQ,EAAI,OAAO,IAC9B,EAAE,SAAS,aAAY,EAAI,WAAW,IACtC,EAAE,SAAS,cAAW,EAAI,UAAU;CAE/C,OAAO;AACT"}
|
package/dist/lib/epl/index.d.ts
CHANGED
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* {@link EplEncryptedError} for encrypted files and {@link NotEplFileError} when the bytes aren't a project
|
|
8
8
|
* file — the viewer turns those into friendly messages.
|
|
9
9
|
*/
|
|
10
|
-
import { loadEpl, type EplDocument
|
|
10
|
+
import { loadEpl, type EplDocument } from './eplDocument';
|
|
11
|
+
import { EplEncryptedError, NotEplFileError } from './projectFileReader';
|
|
11
12
|
import { type EplProgram } from './program';
|
|
12
13
|
export interface EplLibrary {
|
|
13
14
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/lib/epl/index.ts"],"sourcesContent":["/**\n * Public entry for the e-language (易语言) `.e`/`.ec` reader — the only module the UI imports.\n *\n * {@link decompileEpl} turns the raw bytes into a preview: project metadata + a structured {@link EplProgram}\n * (classes / methods / variables / structs / DLL declares / constants / forms / libraries, with method bodies\n * reconstructed by the code-data decompiler) that the IDE-style viewer renders directly. Throws\n * {@link EplEncryptedError} for encrypted files and {@link NotEplFileError} when the bytes aren't a project\n * file — the viewer turns those into friendly messages.\n */\nimport { loadEpl, type EplDocument
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/lib/epl/index.ts"],"sourcesContent":["/**\n * Public entry for the e-language (易语言) `.e`/`.ec` reader — the only module the UI imports.\n *\n * {@link decompileEpl} turns the raw bytes into a preview: project metadata + a structured {@link EplProgram}\n * (classes / methods / variables / structs / DLL declares / constants / forms / libraries, with method bodies\n * reconstructed by the code-data decompiler) that the IDE-style viewer renders directly. Throws\n * {@link EplEncryptedError} for encrypted files and {@link NotEplFileError} when the bytes aren't a project\n * file — the viewer turns those into friendly messages.\n */\nimport { loadEpl, type EplDocument } from './eplDocument'\n// Import errors from their definition: routing them through eplDocument makes the current Rolldown\n// preserveModules build drop that loader's parser/encoding imports while keeping their references.\nimport { EplEncryptedError, NotEplFileError } from './projectFileReader'\nimport { buildProgram, type EplProgram } from './program'\n\nexport interface EplLibrary {\n name: string\n fileName: string\n version: string\n}\n\nexport interface EplProjectInfo {\n name: string\n description: string\n author: string\n version: string\n copyright: string\n email: string\n homepage: string\n}\n\nexport interface EplMeta {\n /** 1=源码(.e), 3=模块(.ec). */\n fileType: 'source' | 'module' | 'unknown'\n /** The e-language IDE version that wrote the file, e.g. `5.71`. */\n systemVersion: string\n project: EplProjectInfo | null\n libraries: EplLibrary[]\n counts: {\n classes: number\n methods: number\n globalVariables: number\n structs: number\n dllDeclares: number\n }\n}\n\nexport interface EplPreview {\n meta: EplMeta\n /** Structured program model (classes / tables) rendered by the IDE-style viewer. */\n program: EplProgram\n}\n\nfunction ver(parts: number[]): string {\n return parts.join('.')\n}\n\nfunction buildMeta(doc: EplDocument): EplMeta {\n const si = doc.systemInfo\n const pc = doc.projectConfig\n const cs = doc.code\n const fileType = si?.fileType === 1 ? 'source' : si?.fileType === 3 ? 'module' : 'unknown'\n return {\n fileType,\n systemVersion: si ? ver(si.esystemVersion) : '',\n project: pc\n ? {\n name: pc.name,\n description: pc.description,\n author: pc.author,\n version: ver(pc.version),\n copyright: pc.copyright,\n email: pc.email,\n homepage: pc.homepage,\n }\n : null,\n libraries: (cs?.libraries ?? []).map((l) => ({\n name: l.name,\n fileName: l.fileName,\n version: ver(l.version),\n })),\n counts: {\n classes: cs?.classes.length ?? 0,\n methods: cs?.methods.length ?? 0,\n globalVariables: cs?.globalVariables.length ?? 0,\n structs: cs?.structs.length ?? 0,\n dllDeclares: cs?.dllDeclares.length ?? 0,\n },\n }\n}\n\n/** Parse + decompile a `.e`/`.ec` byte buffer into a preview (metadata + structured program model). */\nexport function decompileEpl(bytes: Uint8Array): EplPreview {\n const doc = loadEpl(bytes)\n return { meta: buildMeta(doc), program: buildProgram(doc) }\n}\n\nexport { loadEpl, EplEncryptedError, NotEplFileError }\nexport type { EplDocument, EplProgram }\nexport type {\n EplClassView,\n EplClassKind,\n EplMethodView,\n EplVarRow,\n EplStructView,\n EplDllView,\n EplConstantRow,\n EplResourceRow,\n EplFormView,\n EplLibraryView,\n} from './program'\nexport type { CodeLine, GuideSeg } from './code/codeLines'\nexport { parseEplImageList } from './imageList'\nexport type { EplImageList, EplImageFrame } from './imageList'\n"],"mappings":";;;;;AAqDA,SAAS,EAAI,GAAyB;CACpC,OAAO,EAAM,KAAK,GAAG;AACvB;AAEA,SAAS,EAAU,GAA2B;CAC5C,IAAM,IAAK,EAAI,YACT,IAAK,EAAI,eACT,IAAK,EAAI;CAEf,OAAO;EACL,UAFe,GAAI,aAAa,IAAI,WAAW,GAAI,aAAa,IAAI,WAAW;EAG/E,eAAe,IAAK,EAAI,EAAG,cAAc,IAAI;EAC7C,SAAS,IACL;GACE,MAAM,EAAG;GACT,aAAa,EAAG;GAChB,QAAQ,EAAG;GACX,SAAS,EAAI,EAAG,OAAO;GACvB,WAAW,EAAG;GACd,OAAO,EAAG;GACV,UAAU,EAAG;EACf,IACA;EACJ,YAAY,GAAI,aAAa,CAAC,EAAA,CAAG,KAAK,OAAO;GAC3C,MAAM,EAAE;GACR,UAAU,EAAE;GACZ,SAAS,EAAI,EAAE,OAAO;EACxB,EAAE;EACF,QAAQ;GACN,SAAS,GAAI,QAAQ,UAAU;GAC/B,SAAS,GAAI,QAAQ,UAAU;GAC/B,iBAAiB,GAAI,gBAAgB,UAAU;GAC/C,SAAS,GAAI,QAAQ,UAAU;GAC/B,aAAa,GAAI,YAAY,UAAU;EACzC;CACF;AACF;AAGA,SAAgB,EAAa,GAA+B;CAC1D,IAAM,IAAM,EAAQ,CAAK;CACzB,OAAO;EAAE,MAAM,EAAU,CAAG;EAAG,SAAS,EAAa,CAAG;CAAE;AAC5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
import { readVariables as t } from "../code/variable.js";
|
|
3
|
+
import { applyCompatibilityInfo as n, readClasses as r, readDllDeclares as i, readLibraries as a, readMethods as o, readStructs as s } from "../code/structures.js";
|
|
4
|
+
//#region src/lib/epl/sections/code.ts
|
|
5
|
+
var c = 50361113, l = "程序段", u = {
|
|
6
|
+
key: c,
|
|
7
|
+
name: l,
|
|
8
|
+
isOptional: !1,
|
|
9
|
+
parse(u, d) {
|
|
10
|
+
let f = new e(u, d.dec), p = f.readInt32();
|
|
11
|
+
f.readInt32();
|
|
12
|
+
let m = f.readInt32sWithByteSizePrefix(), h, g = 0, _ = 0, v, y;
|
|
13
|
+
d.cryptEC ? (f.readInt32(), f.readInt32(), v = f.readInt16sWithByteSizePrefix(), g = f.readInt32(), _ = f.readInt32(), h = a(f), y = f.readInt16sWithByteSizePrefix()) : (v = f.readInt16sWithByteSizePrefix(), y = f.readInt16sWithByteSizePrefix(), h = a(f), g = f.readInt32(), _ = f.readInt32()), n(h, m, v, y), g & 1 && f.readBytes(16);
|
|
14
|
+
let b = f.readBytesWithLengthPrefix(), x = f.readStringWithLengthPrefix(), S, C, w, T, E;
|
|
15
|
+
return d.cryptEC ? (f.readBytes(12), C = o(f), E = i(f), w = t(f, "global"), S = r(f), T = s(f)) : (S = r(f), C = o(f), w = t(f, "global"), T = s(f), E = i(f)), {
|
|
16
|
+
kind: "code",
|
|
17
|
+
sectionKey: c,
|
|
18
|
+
sectionName: l,
|
|
19
|
+
isOptional: !1,
|
|
20
|
+
allocatedIdNum: p,
|
|
21
|
+
libraries: h,
|
|
22
|
+
flag: g,
|
|
23
|
+
mainMethod: _,
|
|
24
|
+
iconData: b,
|
|
25
|
+
debugCommandParameters: x,
|
|
26
|
+
classes: S,
|
|
27
|
+
methods: C,
|
|
28
|
+
globalVariables: w,
|
|
29
|
+
structs: T,
|
|
30
|
+
dllDeclares: E
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { u as CodeSectionKey };
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code.js","names":[],"sources":["../../../../src/lib/epl/sections/code.ts"],"sourcesContent":["/**\n * Code section (程序段, key 0x03007319) — port of `Sections/CodeSection.cs` (read path).\n *\n * The core structural section: the project's libraries, classes, methods, global variables, structs and DLL\n * declares. The EC-encrypted layout reorders several fields and the structure blocks (handled by the\n * `ctx.cryptEC` branches, mirroring the C#). Read order within each branch is preserved exactly.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\nimport { type EplVariable, readVariables } from '../code/variable'\nimport {\n applyCompatibilityInfo,\n type ClassInfo,\n type DllDeclareInfo,\n type LibraryRefInfo,\n type MethodInfo,\n readClasses,\n readDllDeclares,\n readLibraries,\n readMethods,\n readStructs,\n type StructInfo,\n} from '../code/structures'\n\nconst KEY = 0x03007319\nconst NAME = '程序段'\n\nexport interface CodeSection extends SectionBase {\n kind: 'code'\n /** Max allocated Id number (new Ids are this + 1); defaults to 0xFFFF. */\n allocatedIdNum: number\n libraries: LibraryRefInfo[]\n flag: number\n /** \"_启动子程序\" Id (EC files without editor info). */\n mainMethod: number\n iconData: Uint8Array\n debugCommandParameters: string\n classes: ClassInfo[]\n methods: MethodInfo[]\n globalVariables: EplVariable[]\n structs: StructInfo[]\n dllDeclares: DllDeclareInfo[]\n}\n\nexport const CodeSectionKey: SectionType<CodeSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): CodeSection {\n const r = new BinaryReader(data, ctx.dec)\n const allocatedIdNum = r.readInt32()\n r.readInt32() // confirmed on V5.71\n const minRequiredCmds = r.readInt32sWithByteSizePrefix()\n\n let libraries: LibraryRefInfo[]\n let flag = 0\n let mainMethod = 0\n let minRequiredDataTypes: number[]\n let minRequiredConstants: number[]\n if (ctx.cryptEC) {\n r.readInt32()\n r.readInt32()\n minRequiredDataTypes = r.readInt16sWithByteSizePrefix()\n flag = r.readInt32()\n mainMethod = r.readInt32()\n libraries = readLibraries(r)\n minRequiredConstants = r.readInt16sWithByteSizePrefix()\n } else {\n minRequiredDataTypes = r.readInt16sWithByteSizePrefix()\n minRequiredConstants = r.readInt16sWithByteSizePrefix()\n libraries = readLibraries(r)\n flag = r.readInt32()\n mainMethod = r.readInt32()\n }\n applyCompatibilityInfo(libraries, minRequiredCmds, minRequiredDataTypes, minRequiredConstants)\n\n if ((flag & 1) !== 0) {\n r.readBytes(16) // UnknownBeforeIconData\n }\n const iconData = r.readBytesWithLengthPrefix()\n const debugCommandParameters = r.readStringWithLengthPrefix()\n\n let classes: ClassInfo[]\n let methods: MethodInfo[]\n let globalVariables: EplVariable[]\n let structs: StructInfo[]\n let dllDeclares: DllDeclareInfo[]\n if (ctx.cryptEC) {\n r.readBytes(12) // Unknown (12 zeros)\n methods = readMethods(r)\n dllDeclares = readDllDeclares(r)\n globalVariables = readVariables(r, 'global')\n classes = readClasses(r)\n structs = readStructs(r)\n } else {\n classes = readClasses(r)\n methods = readMethods(r)\n globalVariables = readVariables(r, 'global')\n structs = readStructs(r)\n dllDeclares = readDllDeclares(r)\n }\n\n return {\n kind: 'code',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n allocatedIdNum,\n libraries,\n flag,\n mainMethod,\n iconData,\n debugCommandParameters,\n classes,\n methods,\n globalVariables,\n structs,\n dllDeclares,\n }\n },\n}\n"],"mappings":";;;;AAwBA,IAAM,IAAM,UACN,IAAO,OAmBA,IAA2C;CACtD,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAiC;EACvD,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAiB,EAAE,UAAU;EACnC,EAAE,UAAU;EACZ,IAAM,IAAkB,EAAE,6BAA6B,GAEnD,GACA,IAAO,GACP,IAAa,GACb,GACA;EAkBJ,AAjBI,EAAI,WACN,EAAE,UAAU,GACZ,EAAE,UAAU,GACZ,IAAuB,EAAE,6BAA6B,GACtD,IAAO,EAAE,UAAU,GACnB,IAAa,EAAE,UAAU,GACzB,IAAY,EAAc,CAAC,GAC3B,IAAuB,EAAE,6BAA6B,MAEtD,IAAuB,EAAE,6BAA6B,GACtD,IAAuB,EAAE,6BAA6B,GACtD,IAAY,EAAc,CAAC,GAC3B,IAAO,EAAE,UAAU,GACnB,IAAa,EAAE,UAAU,IAE3B,EAAuB,GAAW,GAAiB,GAAsB,CAAoB,GAExF,IAAO,KACV,EAAE,UAAU,EAAE;EAEhB,IAAM,IAAW,EAAE,0BAA0B,GACvC,IAAyB,EAAE,2BAA2B,GAExD,GACA,GACA,GACA,GACA;EAgBJ,OAfI,EAAI,WACN,EAAE,UAAU,EAAE,GACd,IAAU,EAAY,CAAC,GACvB,IAAc,EAAgB,CAAC,GAC/B,IAAkB,EAAc,GAAG,QAAQ,GAC3C,IAAU,EAAY,CAAC,GACvB,IAAU,EAAY,CAAC,MAEvB,IAAU,EAAY,CAAC,GACvB,IAAU,EAAY,CAAC,GACvB,IAAkB,EAAc,GAAG,QAAQ,GAC3C,IAAU,EAAY,CAAC,GACvB,IAAc,EAAgB,CAAC,IAG1B;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/esystemInfo.ts
|
|
3
|
+
var t = 33583897, n = "系统信息段", r = {
|
|
4
|
+
key: t,
|
|
5
|
+
name: n,
|
|
6
|
+
isOptional: !1,
|
|
7
|
+
parse(r, i) {
|
|
8
|
+
let a = new e(r, i.dec), o = a.readInt16(), s = a.readInt16();
|
|
9
|
+
a.readInt32();
|
|
10
|
+
let c = a.readInt32(), l = a.readInt16(), u = a.readInt16(), d = a.readInt32();
|
|
11
|
+
a.readInt32();
|
|
12
|
+
let f = a.readInt32();
|
|
13
|
+
return {
|
|
14
|
+
kind: "systemInfo",
|
|
15
|
+
sectionKey: t,
|
|
16
|
+
sectionName: n,
|
|
17
|
+
isOptional: !1,
|
|
18
|
+
esystemVersion: [o, s],
|
|
19
|
+
language: c,
|
|
20
|
+
eprojectFormatVersion: [l, u],
|
|
21
|
+
fileType: d,
|
|
22
|
+
projectType: f
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as ESystemInfoKey };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=esystemInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esystemInfo.js","names":[],"sources":["../../../../src/lib/epl/sections/esystemInfo.ts"],"sourcesContent":["/**\n * System-info section (系统信息段, key 0x02007319) — port of `Sections/ESystemInfoSection.cs`.\n *\n * Critical: its `Language` field decides the codepage the REST of the document is decoded with (see\n * {@link decoderForLanguage}), and `FileType` distinguishes 源码(1) from 模块(3). Layout is a fixed run of\n * int16/int32 (no strings), so the decoder is irrelevant here.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x02007319\nconst NAME = '系统信息段'\n\nexport interface ESystemInfoSection extends SectionBase {\n kind: 'systemInfo'\n /** [major, minor] of the e-language system that wrote the file. */\n esystemVersion: [number, number]\n /** 1=中文(GBK), 2=英语(ASCII), 3=中文(BIG5), 4=日文(SJIS). Drives {@link decoderForLanguage}. */\n language: number\n /** [major, minor] of the .e project format. */\n eprojectFormatVersion: [number, number]\n /** 1=源码(.e), 3=模块(.ec). */\n fileType: number\n projectType: number\n}\n\nexport const ESystemInfoKey: SectionType<ESystemInfoSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ESystemInfoSection {\n const r = new BinaryReader(data, ctx.dec)\n const sysMajor = r.readInt16()\n const sysMinor = r.readInt16()\n r.readInt32() // skip Unknown\n const language = r.readInt32()\n const fmtMajor = r.readInt16()\n const fmtMinor = r.readInt16()\n const fileType = r.readInt32()\n r.readInt32() // skip Unknown\n const projectType = r.readInt32()\n return {\n kind: 'systemInfo',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n esystemVersion: [sysMajor, sysMinor],\n language,\n eprojectFormatVersion: [fmtMajor, fmtMinor],\n fileType,\n projectType,\n }\n },\n}\n"],"mappings":";;AAUA,IAAM,IAAM,UACN,IAAO,SAeA,IAAkD;CAC7D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAwC;EAC9D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU;EAC7B,EAAE,UAAU;EACZ,IAAM,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU,GACvB,IAAW,EAAE,UAAU;EAC7B,EAAE,UAAU;EACZ,IAAM,IAAc,EAAE,UAAU;EAChC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,gBAAgB,CAAC,GAAU,CAAQ;GACnC;GACA,uBAAuB,CAAC,GAAU,CAAQ;GAC1C;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/losable.ts
|
|
3
|
+
var t = 83915545, n = "可丢失程序段";
|
|
4
|
+
function r(e) {
|
|
5
|
+
let t = e.readInt32(), n = e.readInt32(), r = e.pos + n, i = e.readInt32sWithFixedLength(t);
|
|
6
|
+
e.readInt32sWithFixedLength(t);
|
|
7
|
+
let a = e.readInt32sWithFixedLength(t), o = e.pos, s = [];
|
|
8
|
+
for (let n = 0; n < t; n++) e.pos = o + a[n], s.push({
|
|
9
|
+
id: i[n],
|
|
10
|
+
name: e.readCStyleString()
|
|
11
|
+
});
|
|
12
|
+
return e.pos = r, s;
|
|
13
|
+
}
|
|
14
|
+
var i = {
|
|
15
|
+
key: t,
|
|
16
|
+
name: n,
|
|
17
|
+
isOptional: !0,
|
|
18
|
+
parse(i, a) {
|
|
19
|
+
let o = new e(i, a.dec);
|
|
20
|
+
return {
|
|
21
|
+
kind: "losable",
|
|
22
|
+
sectionKey: t,
|
|
23
|
+
sectionName: n,
|
|
24
|
+
isOptional: !0,
|
|
25
|
+
outFile: o.readStringWithLengthPrefix(),
|
|
26
|
+
removedItems: r(o)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { i as LosableSectionKey };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=losable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"losable.js","names":[],"sources":["../../../../src/lib/epl/sections/losable.ts"],"sourcesContent":["/**\n * Losable section (可丢失程序段, key 0x05007319) — port of `Sections/LosableSection.cs` (read path).\n *\n * Records id→name for items removed via delete/undo. The IDE keeps these so a still-referenced id can recover\n * its old name; IdToNameMap folds them in as a FALLBACK (only when the id isn't already named by the code /\n * resource sections), which is why some local/sub names in source files come from here.\n *\n * `RemovedDefinedItems` is an id+offset block table with an extra per-item name-code column (a checksum we\n * don't need to verify for read-only). After it, trailing bytes are ignored.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x05007319\nconst NAME = '可丢失程序段'\n\nexport interface RemovedItem {\n id: number\n name: string\n}\n\nexport interface LosableSection extends SectionBase {\n kind: 'losable'\n outFile: string\n removedItems: RemovedItem[]\n}\n\n// count, size, int32[count] ids, int32[count] nameCodes (skipped), int32[count] offsets, then each name at\n// (start + offset) as a CString. (Like the generic block table but with the extra nameCode column.)\nfunction readRemovedItems(r: BinaryReader): RemovedItem[] {\n const count = r.readInt32()\n const size = r.readInt32()\n const endPos = r.pos + size\n const ids = r.readInt32sWithFixedLength(count)\n r.readInt32sWithFixedLength(count) // nameCode checksums — not needed for read-only\n const offsets = r.readInt32sWithFixedLength(count)\n const startPos = r.pos\n const result: RemovedItem[] = []\n for (let i = 0; i < count; i++) {\n r.pos = startPos + offsets[i]\n result.push({ id: ids[i], name: r.readCStyleString() })\n }\n r.pos = endPos\n return result\n}\n\nexport const LosableSectionKey: SectionType<LosableSection> = {\n key: KEY,\n name: NAME,\n isOptional: true,\n parse(data: Uint8Array, ctx: ParserContext): LosableSection {\n const r = new BinaryReader(data, ctx.dec)\n const outFile = r.readStringWithLengthPrefix()\n const removedItems = readRemovedItems(r)\n return {\n kind: 'losable',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: true,\n outFile,\n removedItems,\n }\n },\n}\n"],"mappings":";;AAaA,IAAM,IAAM,UACN,IAAO;AAeb,SAAS,EAAiB,GAAgC;CACxD,IAAM,IAAQ,EAAE,UAAU,GACpB,IAAO,EAAE,UAAU,GACnB,IAAS,EAAE,MAAM,GACjB,IAAM,EAAE,0BAA0B,CAAK;CAC7C,EAAE,0BAA0B,CAAK;CACjC,IAAM,IAAU,EAAE,0BAA0B,CAAK,GAC3C,IAAW,EAAE,KACb,IAAwB,CAAC;CAC/B,KAAK,IAAI,IAAI,GAAG,IAAI,GAAO,KAEzB,AADA,EAAE,MAAM,IAAW,EAAQ,IAC3B,EAAO,KAAK;EAAE,IAAI,EAAI;EAAI,MAAM,EAAE,iBAAiB;CAAE,CAAC;CAGxD,OADA,EAAE,MAAM,GACD;AACT;AAEA,IAAa,IAAiD;CAC5D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAoC;EAC1D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG;EAGxC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,SAPc,EAAE,2BAOhB;GACA,cAPmB,EAAiB,CAOpC;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/projectConfig.ts
|
|
3
|
+
var t = 16806681, n = "用户信息段", r = {
|
|
4
|
+
key: t,
|
|
5
|
+
name: n,
|
|
6
|
+
isOptional: !1,
|
|
7
|
+
parse(r, i) {
|
|
8
|
+
let a = new e(r, i.dec), o = a.readStringWithLengthPrefix(), s = a.readStringWithLengthPrefix(), c = a.readStringWithLengthPrefix(), l = a.readStringWithLengthPrefix(), u = a.readStringWithLengthPrefix(), d = a.readStringWithLengthPrefix(), f = a.readStringWithLengthPrefix(), p = a.readStringWithLengthPrefix(), m = a.readStringWithLengthPrefix(), h = a.readStringWithLengthPrefix(), g = [
|
|
9
|
+
a.readInt32(),
|
|
10
|
+
a.readInt32(),
|
|
11
|
+
a.readInt32(),
|
|
12
|
+
a.readInt32()
|
|
13
|
+
], _ = a.readInt32() === 0, v = a.readStringWithFixedLength(20), y = a.readInt32() !== 0;
|
|
14
|
+
return a.readInt32(), {
|
|
15
|
+
kind: "projectConfig",
|
|
16
|
+
sectionKey: t,
|
|
17
|
+
sectionName: n,
|
|
18
|
+
isOptional: !1,
|
|
19
|
+
name: o,
|
|
20
|
+
description: s,
|
|
21
|
+
author: c,
|
|
22
|
+
zipCode: l,
|
|
23
|
+
address: u,
|
|
24
|
+
telephoneNumber: d,
|
|
25
|
+
faxNumber: f,
|
|
26
|
+
email: p,
|
|
27
|
+
homepage: m,
|
|
28
|
+
copyright: h,
|
|
29
|
+
version: g,
|
|
30
|
+
writeVersion: _,
|
|
31
|
+
compilePlugins: v,
|
|
32
|
+
exportPublicClassMethod: y
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { r as ProjectConfigKey };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=projectConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectConfig.js","names":[],"sources":["../../../../src/lib/epl/sections/projectConfig.ts"],"sourcesContent":["/**\n * User-info / project-config section (用户信息段, key 0x01007319) — port of `Sections/ProjectConfigSection.cs`.\n *\n * Holds the project's metadata: name, description, author + contact fields, copyright, a 4-part version, and a\n * couple of flags. All strings are length-prefixed and decoded with the document codepage.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x01007319\nconst NAME = '用户信息段'\n\nexport interface ProjectConfigSection extends SectionBase {\n kind: 'projectConfig'\n /** Project name (NOT the section name). */\n name: string\n description: string\n author: string\n zipCode: string\n address: string\n telephoneNumber: string\n faxNumber: string\n email: string\n homepage: string\n copyright: string\n /** [major, minor, build, revision]. */\n version: [number, number, number, number]\n /** Whether the compiled output writes the version resource (C#: stored as `ReadInt32() == 0`). */\n writeVersion: boolean\n /** Compile-plugins field (fixed 20-byte string). */\n compilePlugins: string\n exportPublicClassMethod: boolean\n}\n\nexport const ProjectConfigKey: SectionType<ProjectConfigSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ProjectConfigSection {\n const r = new BinaryReader(data, ctx.dec)\n const name = r.readStringWithLengthPrefix()\n const description = r.readStringWithLengthPrefix()\n const author = r.readStringWithLengthPrefix()\n const zipCode = r.readStringWithLengthPrefix()\n const address = r.readStringWithLengthPrefix()\n const telephoneNumber = r.readStringWithLengthPrefix()\n const faxNumber = r.readStringWithLengthPrefix()\n const email = r.readStringWithLengthPrefix()\n const homepage = r.readStringWithLengthPrefix()\n const copyright = r.readStringWithLengthPrefix()\n const version: [number, number, number, number] = [\n r.readInt32(),\n r.readInt32(),\n r.readInt32(),\n r.readInt32(),\n ]\n const writeVersion = r.readInt32() === 0\n const compilePlugins = r.readStringWithFixedLength(20)\n const exportPublicClassMethod = r.readInt32() !== 0\n r.readInt32() // skip Unknown\n return {\n kind: 'projectConfig',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n name,\n description,\n author,\n zipCode,\n address,\n telephoneNumber,\n faxNumber,\n email,\n homepage,\n copyright,\n version,\n writeVersion,\n compilePlugins,\n exportPublicClassMethod,\n }\n },\n}\n"],"mappings":";;AASA,IAAM,IAAM,UACN,IAAO,SAwBA,IAAsD;CACjE,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAA0C;EAChE,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG,GAClC,IAAO,EAAE,2BAA2B,GACpC,IAAc,EAAE,2BAA2B,GAC3C,IAAS,EAAE,2BAA2B,GACtC,IAAU,EAAE,2BAA2B,GACvC,IAAU,EAAE,2BAA2B,GACvC,IAAkB,EAAE,2BAA2B,GAC/C,IAAY,EAAE,2BAA2B,GACzC,IAAQ,EAAE,2BAA2B,GACrC,IAAW,EAAE,2BAA2B,GACxC,IAAY,EAAE,2BAA2B,GACzC,IAA4C;GAChD,EAAE,UAAU;GACZ,EAAE,UAAU;GACZ,EAAE,UAAU;GACZ,EAAE,UAAU;EACd,GACM,IAAe,EAAE,UAAU,MAAM,GACjC,IAAiB,EAAE,0BAA0B,EAAE,GAC/C,IAA0B,EAAE,UAAU,MAAM;EAElD,OADA,EAAE,UAAU,GACL;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;CACF;AACF"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { BinaryReader as e } from "../io/binaryReader.js";
|
|
2
|
+
//#region src/lib/epl/sections/resource.ts
|
|
3
|
+
var t = 67138329, n = "程序资源段";
|
|
4
|
+
function r(e) {
|
|
5
|
+
return e.readBlocksWithIdAndOffest((e, t) => {
|
|
6
|
+
let n = e.readInt32();
|
|
7
|
+
return e.skip(20), {
|
|
8
|
+
id: t,
|
|
9
|
+
dataType: n,
|
|
10
|
+
name: e.readCStyleString()
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return e.readBlocksWithIdAndMemoryAddress((e, t, n) => (e.readInt32(), {
|
|
16
|
+
id: t,
|
|
17
|
+
memoryAddress: n,
|
|
18
|
+
classId: e.readInt32(),
|
|
19
|
+
name: e.readStringWithLengthPrefix(),
|
|
20
|
+
comment: e.readStringWithLengthPrefix(),
|
|
21
|
+
elements: r(e)
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
function a(e, t) {
|
|
25
|
+
switch (t >>> 28) {
|
|
26
|
+
case 1: switch (e.readByte()) {
|
|
27
|
+
case 23: return {
|
|
28
|
+
kind: "double",
|
|
29
|
+
value: e.readFloat64()
|
|
30
|
+
};
|
|
31
|
+
case 24: return {
|
|
32
|
+
kind: "bool",
|
|
33
|
+
value: e.readInt32() !== 0
|
|
34
|
+
};
|
|
35
|
+
case 25: return {
|
|
36
|
+
kind: "datetime",
|
|
37
|
+
oa: e.readFloat64()
|
|
38
|
+
};
|
|
39
|
+
case 26: return {
|
|
40
|
+
kind: "string",
|
|
41
|
+
value: e.readBStr() ?? ""
|
|
42
|
+
};
|
|
43
|
+
default: return { kind: "null" };
|
|
44
|
+
}
|
|
45
|
+
case 2: return {
|
|
46
|
+
kind: "image",
|
|
47
|
+
bytes: e.readBytesWithLengthPrefix()
|
|
48
|
+
};
|
|
49
|
+
case 3: return {
|
|
50
|
+
kind: "sound",
|
|
51
|
+
bytes: e.readBytesWithLengthPrefix()
|
|
52
|
+
};
|
|
53
|
+
default: return { kind: "null" };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function o(e) {
|
|
57
|
+
return e.readBlocksWithIdAndOffest((e, t) => ({
|
|
58
|
+
id: t,
|
|
59
|
+
flags: e.readInt16(),
|
|
60
|
+
name: e.readCStyleString(),
|
|
61
|
+
comment: e.readCStyleString(),
|
|
62
|
+
value: a(e, t)
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
var s = {
|
|
66
|
+
key: t,
|
|
67
|
+
name: n,
|
|
68
|
+
isOptional: !1,
|
|
69
|
+
parse(r, a) {
|
|
70
|
+
let s = new e(r, a.dec);
|
|
71
|
+
return {
|
|
72
|
+
kind: "resource",
|
|
73
|
+
sectionKey: t,
|
|
74
|
+
sectionName: n,
|
|
75
|
+
isOptional: !1,
|
|
76
|
+
forms: i(s),
|
|
77
|
+
constants: o(s)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { s as ResourceSectionKey };
|
|
83
|
+
|
|
84
|
+
//# sourceMappingURL=resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource.js","names":[],"sources":["../../../../src/lib/epl/sections/resource.ts"],"sourcesContent":["/**\n * Resource section (程序资源段, key 0x04007319) — port of `Sections/ResourceSection.cs` (read path).\n *\n * Holds the windows (FormInfo + its controls/menus) and the project constants (ConstantInfo). We parse the\n * NAMES (the main thing the decompiler needs: a code reference like `#常量` / `窗口.控件` resolves through the\n * name map) plus enough geometry-free shape to walk the bytes. Form elements and constants use the id+offset\n * block table (each block is offset-addressed), so we read just the leading fields (id / dataType / name —\n * value, geometry and extension data are skipped via the per-block offsets), which keeps this robust.\n */\nimport { BinaryReader } from '../io/binaryReader'\nimport type { ParserContext, SectionBase, SectionType } from '../model/section'\n\nconst KEY = 0x04007319\nconst NAME = '程序资源段'\n\n/**\n * A constant's typed value. The high nibble of the constant `id` picks the family: 1 ⇒ 普通常量 (a type-tagged\n * scalar — null / double / bool / DateTime / text), 2 ⇒ 图片资源, 3 ⇒ 声音资源 (both raw resource bytes).\n */\nexport type EplConstantValue =\n | { kind: 'null' }\n | { kind: 'double'; value: number }\n | { kind: 'bool'; value: boolean }\n /** OLE Automation date (days since 1899-12-30), rendered to `yyyy年MM月dd日…` for display. */\n | { kind: 'datetime'; oa: number }\n | { kind: 'string'; value: string }\n | { kind: 'image'; bytes: Uint8Array }\n | { kind: 'sound'; bytes: Uint8Array }\n\n/** A project constant / image / sound resource (the high nibble of `id` distinguishes them). */\nexport interface EplConstant {\n id: number\n flags: number\n name: string\n comment: string\n value: EplConstantValue\n}\n\n/** A control or menu on a form (only id/dataType/name kept — enough for name resolution). */\nexport interface EplFormElement {\n id: number\n dataType: number\n name: string\n}\n\nexport interface EplForm {\n id: number\n memoryAddress: number\n /** The associated window class id. */\n classId: number\n name: string\n comment: string\n elements: EplFormElement[]\n}\n\nexport interface ResourceSection extends SectionBase {\n kind: 'resource'\n forms: EplForm[]\n constants: EplConstant[]\n}\n\n// Each element block starts [dataType:int32][UnknownBeforeName:20][Name:CString]… — identical for controls and\n// menus, so we read the name uniformly and let the block offsets skip the rest.\nfunction readFormElements(r: BinaryReader): EplFormElement[] {\n return r.readBlocksWithIdAndOffest((reader, id) => {\n const dataType = reader.readInt32()\n reader.skip(20) // UnknownBeforeName\n const name = reader.readCStyleString()\n return { id, dataType, name }\n })\n}\n\nfunction readForms(r: BinaryReader): EplForm[] {\n return r.readBlocksWithIdAndMemoryAddress((reader, id, memoryAddress) => {\n reader.readInt32() // UnknownBeforeClass\n const classId = reader.readInt32()\n const name = reader.readStringWithLengthPrefix()\n const comment = reader.readStringWithLengthPrefix()\n const elements = readFormElements(reader)\n return { id, memoryAddress, classId, name, comment, elements }\n })\n}\n\n// Constant blocks: int16 flags, CString name, CString comment, then a value whose layout depends on the\n// id's high nibble (port of ConstantInfo's per-block read; see EProjectFile ConstantInfo.cs):\n// nibble 1 (常量): a type byte then 22⇒null · 23⇒double · 24⇒bool(int32≠0) · 25⇒DateTime(OADate double) ·\n// 26⇒text(BStr); nibble 2/3 (图片/声音): length-prefixed raw bytes (no type byte).\n// Any trailing extension bytes are skipped via the block offset (each block is offset-addressed, so a misread\n// value can never desync the following blocks).\nfunction readConstantValue(r: BinaryReader, id: number): EplConstantValue {\n switch (id >>> 28) {\n case 1: {\n const type = r.readByte()\n switch (type) {\n case 23:\n return { kind: 'double', value: r.readFloat64() }\n case 24:\n return { kind: 'bool', value: r.readInt32() !== 0 }\n case 25:\n return { kind: 'datetime', oa: r.readFloat64() }\n case 26:\n return { kind: 'string', value: r.readBStr() ?? '' }\n default: // 22 (null) or any unknown tag\n return { kind: 'null' }\n }\n }\n case 2:\n return { kind: 'image', bytes: r.readBytesWithLengthPrefix() }\n case 3:\n return { kind: 'sound', bytes: r.readBytesWithLengthPrefix() }\n default:\n return { kind: 'null' }\n }\n}\n\nfunction readConstants(r: BinaryReader): EplConstant[] {\n return r.readBlocksWithIdAndOffest((reader, id) => {\n const flags = reader.readInt16()\n const name = reader.readCStyleString()\n const comment = reader.readCStyleString()\n const value = readConstantValue(reader, id)\n return { id, flags, name, comment, value }\n })\n}\n\nexport const ResourceSectionKey: SectionType<ResourceSection> = {\n key: KEY,\n name: NAME,\n isOptional: false,\n parse(data: Uint8Array, ctx: ParserContext): ResourceSection {\n const r = new BinaryReader(data, ctx.dec)\n const forms = readForms(r)\n const constants = readConstants(r)\n return {\n kind: 'resource',\n sectionKey: KEY,\n sectionName: NAME,\n isOptional: false,\n forms,\n constants,\n }\n },\n}\n"],"mappings":";;AAYA,IAAM,IAAM,UACN,IAAO;AAkDb,SAAS,EAAiB,GAAmC;CAC3D,OAAO,EAAE,2BAA2B,GAAQ,MAAO;EACjD,IAAM,IAAW,EAAO,UAAU;EAGlC,OAFA,EAAO,KAAK,EAAE,GAEP;GAAE;GAAI;GAAU,MADV,EAAO,iBACG;EAAK;CAC9B,CAAC;AACH;AAEA,SAAS,EAAU,GAA4B;CAC7C,OAAO,EAAE,kCAAkC,GAAQ,GAAI,OACrD,EAAO,UAAU,GAKV;EAAE;EAAI;EAAe,SAJZ,EAAO,UAIK;EAAS,MAHxB,EAAO,2BAGiB;EAAM,SAF3B,EAAO,2BAEoB;EAAS,UADnC,EAAiB,CACkB;CAAS,EAC9D;AACH;AAQA,SAAS,EAAkB,GAAiB,GAA8B;CACxE,QAAQ,MAAO,IAAf;EACE,KAAK,GAEH,QADa,EAAE,SACP,GAAR;GACE,KAAK,IACH,OAAO;IAAE,MAAM;IAAU,OAAO,EAAE,YAAY;GAAE;GAClD,KAAK,IACH,OAAO;IAAE,MAAM;IAAQ,OAAO,EAAE,UAAU,MAAM;GAAE;GACpD,KAAK,IACH,OAAO;IAAE,MAAM;IAAY,IAAI,EAAE,YAAY;GAAE;GACjD,KAAK,IACH,OAAO;IAAE,MAAM;IAAU,OAAO,EAAE,SAAS,KAAK;GAAG;GACrD,SACE,OAAO,EAAE,MAAM,OAAO;EAC1B;EAEF,KAAK,GACH,OAAO;GAAE,MAAM;GAAS,OAAO,EAAE,0BAA0B;EAAE;EAC/D,KAAK,GACH,OAAO;GAAE,MAAM;GAAS,OAAO,EAAE,0BAA0B;EAAE;EAC/D,SACE,OAAO,EAAE,MAAM,OAAO;CAC1B;AACF;AAEA,SAAS,EAAc,GAAgC;CACrD,OAAO,EAAE,2BAA2B,GAAQ,OAKnC;EAAE;EAAI,OAJC,EAAO,UAIR;EAAO,MAHP,EAAO,iBAGA;EAAM,SAFV,EAAO,iBAEG;EAAS,OADrB,EAAkB,GAAQ,CACL;CAAM,EAC1C;AACH;AAEA,IAAa,IAAmD;CAC9D,KAAK;CACL,MAAM;CACN,YAAY;CACZ,MAAM,GAAkB,GAAqC;EAC3D,IAAM,IAAI,IAAI,EAAa,GAAM,EAAI,GAAG;EAGxC,OAAO;GACL,MAAM;GACN,YAAY;GACZ,aAAa;GACb,YAAY;GACZ,OAPY,EAAU,CAOtB;GACA,WAPgB,EAAc,CAO9B;EACF;CACF;AACF"}
|
package/dist/lib/fileType.d.ts
CHANGED
|
@@ -268,8 +268,10 @@ export declare function isGeoFile(name: string, mime?: string | null): boolean;
|
|
|
268
268
|
* a concrete non-subtitle media mime rules it out, blank/octet-stream/text defers to the extension.
|
|
269
269
|
*/
|
|
270
270
|
export declare function isSubtitleFile(name: string, mime?: string | null): boolean;
|
|
271
|
+
/** STEP is textual CAD data; a text/plain MIME must not send it to the source/log viewer. */
|
|
272
|
+
export declare function isStepFile(name: string, mime?: string | null): boolean;
|
|
271
273
|
/**
|
|
272
|
-
* Is this a 3D model (`.stl`/`.obj`/`.ply`/`.glb`/`.gltf`)?
|
|
274
|
+
* Is this a 3D model (`.stl`/`.obj`/`.ply`/`.glb`/`.gltf`/`.stp`/`.step`)? Opens the model viewer,
|
|
273
275
|
* which renders them with three.js in-browser (see ModelViewer.vue) — auto-framed, lit, with orbit controls.
|
|
274
276
|
* Prefer `mime` (`model/*`), fall back to the extension; a concrete text/image/audio/video mime rules it out.
|
|
275
277
|
*/
|