@file-viewer/renderer-eda 3.3.3 → 3.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eda.js +361 -629
- package/dist/edaParser.d.ts +3 -1
- package/dist/edaParser.js +20 -88
- package/package.json +4 -4
package/dist/edaParser.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { type FileViewerResolvedLocale } from '@file-viewer/core';
|
|
1
2
|
import { type EdaLayoutPreview } from '@file-viewer/eda-layout';
|
|
2
|
-
export type EdaParserLocale =
|
|
3
|
+
export type EdaParserLocale = FileViewerResolvedLocale;
|
|
3
4
|
export type { EdaLayoutElement, EdaLayoutPreview, } from '@file-viewer/eda-layout';
|
|
4
5
|
export type EdaFileType = 'olb' | 'dra' | 'gds' | 'oas' | 'oasis';
|
|
5
6
|
export type EdaParserMode = 'cfb' | 'binary';
|
|
@@ -78,6 +79,7 @@ export interface EdaParseResult {
|
|
|
78
79
|
stats: EdaStats;
|
|
79
80
|
layout?: EdaLayoutPreview;
|
|
80
81
|
}
|
|
82
|
+
export declare const localizeEdaParseResult: (parsed: EdaParseResult, locale: EdaParserLocale) => EdaParseResult;
|
|
81
83
|
export declare const parseEdaFile: (buffer: ArrayBuffer, type?: string, options?: {
|
|
82
84
|
locale?: EdaParserLocale;
|
|
83
85
|
}) => Promise<EdaParseResult>;
|
package/dist/edaParser.js
CHANGED
|
@@ -1,97 +1,11 @@
|
|
|
1
|
+
import { translateFileViewerMessage } from '@file-viewer/core';
|
|
1
2
|
import { inspectOasisLayout, parseGdsLayout, parseOasisTextLayout, } from '@file-viewer/eda-layout';
|
|
2
3
|
import { cleanupOrcadText as cleanupText, collectOrcadStrings as collectStrings, createOrcadHexPreview as hexPreview, decodeOrcadSample as decodeSample, isOrcadCompoundFile, looksLikeOrcadText as looksLikeText, } from '@file-viewer/eda-orcad';
|
|
3
4
|
const MAX_STREAMS = 200;
|
|
4
5
|
const MAX_STREAM_STRINGS = 24;
|
|
5
6
|
const MAX_PROPERTIES = 420;
|
|
6
|
-
const EDA_PARSER_TEXT = {
|
|
7
|
-
'zh-CN': {
|
|
8
|
-
oasisFixture: '已识别为 OASIS 文本结构夹具,并在浏览器端解析几何预览和结构索引;真实 SEMI 二进制 OASIS 仍走安全索引与后续独立内核路线。',
|
|
9
|
-
gdsLayout: '已识别为标准 GDSII 二进制版图记录,并在浏览器端解析几何预览和结构索引。',
|
|
10
|
-
cfbContainer: '已识别为 Microsoft Compound File / OLE2 复合文档容器,并在浏览器端解析目录与流。',
|
|
11
|
-
binaryIndex: '未识别为 CFB 容器,已使用二进制字符串索引模式展示可读信息。',
|
|
12
|
-
coverage: '已索引 {streams} 个条目、{strings} 个可读字符串、{entities} 个 EDA 结构候选。',
|
|
13
|
-
layout: '已解析 {layout}: {structures} 个 structure、{elements} 个几何/引用/文本元素,可在版图预览面板中拖动查看。',
|
|
14
|
-
layoutOasisName: 'OASIS 文本结构',
|
|
15
|
-
layoutGdsName: 'GDSII 版图',
|
|
16
|
-
titleOrcadSymbolLibrary: 'OrCAD Capture 元件符号库',
|
|
17
|
-
titleOlbBinaryLibrary: 'OLB 二进制库',
|
|
18
|
-
titleOrcadDrawingLibrary: 'OrCAD / Allegro 图纸库',
|
|
19
|
-
titleDraBinaryDrawing: 'DRA 二进制图纸',
|
|
20
|
-
titleLayoutStructure: '{type} 版图结构',
|
|
21
|
-
noSymbol: '未发现明确的元件符号候选,文件可能使用了私有二进制编码或需要专业工具导出 ASCII/XML 后再检查。',
|
|
22
|
-
noFootprint: '未发现明确的封装、图形或 padstack 候选,文件可能使用了私有二进制数据库编码。',
|
|
23
|
-
noGds: '未发现明确的 GDSII 版图结构候选。文件可能不是标准 GDSII 二进制或使用了专有封装。',
|
|
24
|
-
noOasis: '未发现明确的 OASIS 版图结构候选。OASIS 完整几何浏览通常需要专业版图库或独立 WASM/TS 内核,当前前端包会安全展示头部、字符串、属性和二进制结构线索。',
|
|
25
|
-
maxStreams: '仅展示前 {count} 个 CFB 项,完整文件仍可下载后在专业 EDA 工具中打开。',
|
|
26
|
-
binaryFallback: '该文件不是标准 CFB 容器,已退化为安全的二进制字符串索引预览。',
|
|
27
|
-
},
|
|
28
|
-
'en-US': {
|
|
29
|
-
oasisFixture: 'Detected an OASIS text fixture and parsed geometry preview plus structure indexes in the browser. Full SEMI binary OASIS still follows the safe index and dedicated-kernel path.',
|
|
30
|
-
gdsLayout: 'Detected standard GDSII binary layout records and parsed geometry preview plus structure indexes in the browser.',
|
|
31
|
-
cfbContainer: 'Detected a Microsoft Compound File / OLE2 container and parsed its directory and streams in the browser.',
|
|
32
|
-
binaryIndex: 'This file is not recognized as a CFB container, so readable information is shown through a safe binary string index.',
|
|
33
|
-
coverage: 'Indexed {streams} entries, {strings} readable strings, and {entities} EDA structure candidates.',
|
|
34
|
-
layout: 'Parsed {layout}: {structures} structures and {elements} geometry/reference/text elements. Drag the layout preview panel to inspect it.',
|
|
35
|
-
layoutOasisName: 'OASIS text fixture',
|
|
36
|
-
layoutGdsName: 'GDSII layout',
|
|
37
|
-
titleOrcadSymbolLibrary: 'OrCAD Capture Symbol Library',
|
|
38
|
-
titleOlbBinaryLibrary: 'OLB Binary Library',
|
|
39
|
-
titleOrcadDrawingLibrary: 'OrCAD / Allegro Drawing Library',
|
|
40
|
-
titleDraBinaryDrawing: 'DRA Binary Drawing',
|
|
41
|
-
titleLayoutStructure: '{type} Layout Structure',
|
|
42
|
-
noSymbol: 'No clear component-symbol candidates were found. The file may use private binary encoding or need ASCII/XML export from a professional tool.',
|
|
43
|
-
noFootprint: 'No clear footprint, drawing, or padstack candidates were found. The file may use private binary database encoding.',
|
|
44
|
-
noGds: 'No clear GDSII layout structure candidates were found. The file may not be standard GDSII binary or may use a proprietary wrapper.',
|
|
45
|
-
noOasis: 'No clear OASIS layout structure candidates were found. Full OASIS geometry browsing usually needs a professional layout library or dedicated WASM/TS kernel; this frontend package safely exposes headers, strings, properties, and binary clues.',
|
|
46
|
-
maxStreams: 'Only the first {count} CFB entries are shown. Download the full file and open it in a professional EDA tool for complete inspection.',
|
|
47
|
-
binaryFallback: 'This file is not a standard CFB container, so it falls back to a safe binary string index preview.',
|
|
48
|
-
},
|
|
49
|
-
'ja-JP': {
|
|
50
|
-
oasisFixture: 'OASIS テキスト fixture を認識し、ブラウザー内で幾何プレビューと構造索引を解析しました。完全な SEMI バイナリ OASIS は安全な索引と専用カーネルの経路を使用します。',
|
|
51
|
-
gdsLayout: '標準 GDSII バイナリレイアウトレコードを認識し、ブラウザー内で幾何プレビューと構造索引を解析しました。',
|
|
52
|
-
cfbContainer: 'Microsoft Compound File / OLE2 コンテナーを認識し、ブラウザー内でディレクトリとストリームを解析しました。',
|
|
53
|
-
binaryIndex: 'CFB コンテナーとして認識できなかったため、安全なバイナリ文字列索引で可読情報を表示します。',
|
|
54
|
-
coverage: '{streams} 件の項目、{strings} 件の可読文字列、{entities} 件の EDA 構造候補を索引化しました。',
|
|
55
|
-
layout: '{layout} を解析しました:構造 {structures} 件、幾何・参照・テキスト要素 {elements} 件。レイアウトプレビューパネルをドラッグして確認できます。',
|
|
56
|
-
layoutOasisName: 'OASIS テキスト構造',
|
|
57
|
-
layoutGdsName: 'GDSII レイアウト',
|
|
58
|
-
titleOrcadSymbolLibrary: 'OrCAD Capture シンボルライブラリ',
|
|
59
|
-
titleOlbBinaryLibrary: 'OLB バイナリライブラリ',
|
|
60
|
-
titleOrcadDrawingLibrary: 'OrCAD / Allegro 図面ライブラリ',
|
|
61
|
-
titleDraBinaryDrawing: 'DRA バイナリ図面',
|
|
62
|
-
titleLayoutStructure: '{type} レイアウト構造',
|
|
63
|
-
noSymbol: '明確なコンポーネントシンボル候補を検出できませんでした。独自バイナリエンコーディングの可能性があるため、専門ツールから ASCII/XML を書き出して確認してください。',
|
|
64
|
-
noFootprint: '明確なフットプリント、図形、Padstack 候補を検出できませんでした。独自バイナリデータベース形式の可能性があります。',
|
|
65
|
-
noGds: '明確な GDSII レイアウト構造候補を検出できませんでした。標準 GDSII バイナリではないか、独自ラッパーを使用している可能性があります。',
|
|
66
|
-
noOasis: '明確な OASIS レイアウト構造候補を検出できませんでした。完全な OASIS 幾何プレビューには専門ライブラリまたは専用 WASM/TS カーネルが必要です。このフロントエンドパッケージはヘッダー、文字列、プロパティ、バイナリ構造の手掛かりを安全に表示します。',
|
|
67
|
-
maxStreams: '安全上の理由から、先頭 {count} 件の CFB 項目だけを表示します。完全な確認にはファイルをダウンロードして専門 EDA ツールで開いてください。',
|
|
68
|
-
binaryFallback: '標準 CFB コンテナーではないため、安全なバイナリ文字列索引プレビューへ切り替えました。',
|
|
69
|
-
},
|
|
70
|
-
'de-DE': {
|
|
71
|
-
oasisFixture: 'Eine OASIS-Textstruktur wurde erkannt; Geometrievorschau und Strukturindex wurden im Browser verarbeitet. Vollständiges binäres SEMI OASIS verwendet weiterhin den sicheren Index- und den eigenen Kernel-Pfad.',
|
|
72
|
-
gdsLayout: 'Standardmäßige binäre GDSII-Layoutdatensätze wurden erkannt; Geometrievorschau und Strukturindex wurden im Browser verarbeitet.',
|
|
73
|
-
cfbContainer: 'Ein Microsoft-Compound-File-/OLE2-Container wurde erkannt; Verzeichnis und Datenströme wurden im Browser verarbeitet.',
|
|
74
|
-
binaryIndex: 'Die Datei wurde nicht als CFB-Container erkannt. Lesbare Informationen werden über einen sicheren Binärzeichenfolgenindex angezeigt.',
|
|
75
|
-
coverage: '{streams} Einträge, {strings} lesbare Zeichenfolgen und {entities} EDA-Strukturkandidaten wurden indiziert.',
|
|
76
|
-
layout: '{layout} verarbeitet: {structures} Strukturen und {elements} Geometrie-, Referenz- oder Textelemente. Ziehen Sie die Layoutvorschau, um sie zu prüfen.',
|
|
77
|
-
layoutOasisName: 'OASIS-Textstruktur',
|
|
78
|
-
layoutGdsName: 'GDSII-Layout',
|
|
79
|
-
titleOrcadSymbolLibrary: 'OrCAD-Capture-Symbolbibliothek',
|
|
80
|
-
titleOlbBinaryLibrary: 'Binäre OLB-Bibliothek',
|
|
81
|
-
titleOrcadDrawingLibrary: 'OrCAD-/Allegro-Zeichnungsbibliothek',
|
|
82
|
-
titleDraBinaryDrawing: 'Binäre DRA-Zeichnung',
|
|
83
|
-
titleLayoutStructure: '{type}-Layoutstruktur',
|
|
84
|
-
noSymbol: 'Es wurden keine eindeutigen Bauteilsymbole gefunden. Die Datei verwendet möglicherweise eine private Binärcodierung oder muss mit einem Fachwerkzeug als ASCII/XML exportiert werden.',
|
|
85
|
-
noFootprint: 'Es wurden keine eindeutigen Footprint-, Zeichnungs- oder Padstack-Kandidaten gefunden. Die Datei verwendet möglicherweise eine private binäre Datenbankcodierung.',
|
|
86
|
-
noGds: 'Es wurden keine eindeutigen GDSII-Layoutstrukturen gefunden. Die Datei ist möglicherweise kein standardmäßiges GDSII-Binärformat oder verwendet einen proprietären Container.',
|
|
87
|
-
noOasis: 'Es wurden keine eindeutigen OASIS-Layoutstrukturen gefunden. Für die vollständige OASIS-Geometrie ist üblicherweise eine Fachbibliothek oder ein eigener WASM/TS-Kernel erforderlich; dieses Frontend zeigt Header, Zeichenfolgen, Eigenschaften und binäre Hinweise sicher an.',
|
|
88
|
-
maxStreams: 'Nur die ersten {count} CFB-Einträge werden angezeigt. Laden Sie die vollständige Datei für die Prüfung in einem EDA-Fachwerkzeug herunter.',
|
|
89
|
-
binaryFallback: 'Die Datei ist kein standardmäßiger CFB-Container. Deshalb wird eine sichere Vorschau des Binärzeichenfolgenindex angezeigt.',
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
7
|
const getEdaParserText = (locale, key, params = {}) => {
|
|
93
|
-
|
|
94
|
-
return Object.entries(params).reduce((message, [name, value]) => message.replace(new RegExp(`\\{${name}\\}`, 'g'), String(value)), template);
|
|
8
|
+
return translateFileViewerMessage({ locale }, `eda.parser.${key}`, params);
|
|
95
9
|
};
|
|
96
10
|
const toBytes = (buffer) => new Uint8Array(buffer);
|
|
97
11
|
const normalizeBytes = (value) => {
|
|
@@ -561,6 +475,24 @@ const parseBinaryFallback = (buffer, type, locale) => {
|
|
|
561
475
|
: [getEdaParserText(locale, 'binaryFallback')];
|
|
562
476
|
return assembleResult(buffer, type, 'binary', 1, [stream], collectStrings([bytes]), warnings, layout, locale);
|
|
563
477
|
};
|
|
478
|
+
export const localizeEdaParseResult = (parsed, locale) => {
|
|
479
|
+
const warnings = parsed.parser === 'cfb'
|
|
480
|
+
? parsed.warnings.map(() => getEdaParserText(locale, 'maxStreams', { count: MAX_STREAMS }))
|
|
481
|
+
: parsed.layout ? parsed.warnings : parsed.warnings.map((message, index) => index === parsed.warnings.length - 1 ? getEdaParserText(locale, 'binaryFallback') : message);
|
|
482
|
+
const diagnostics = buildDiagnostics(parsed.type, parsed.parser, parsed.streams, parsed.entities, parsed.strings, warnings, parsed.layout, locale);
|
|
483
|
+
const translated = new Map(diagnostics.map(item => [item.code, item]));
|
|
484
|
+
const titleKey = parsed.type === 'olb'
|
|
485
|
+
? parsed.parser === 'cfb' ? 'titleOrcadSymbolLibrary' : 'titleOlbBinaryLibrary'
|
|
486
|
+
: parsed.type === 'dra'
|
|
487
|
+
? parsed.parser === 'cfb' ? 'titleOrcadDrawingLibrary' : 'titleDraBinaryDrawing'
|
|
488
|
+
: 'titleLayoutStructure';
|
|
489
|
+
return {
|
|
490
|
+
...parsed,
|
|
491
|
+
title: getEdaParserText(locale, titleKey, { type: parsed.type.toUpperCase() }),
|
|
492
|
+
warnings,
|
|
493
|
+
diagnostics: parsed.diagnostics.map(item => translated.get(item.code) || item),
|
|
494
|
+
};
|
|
495
|
+
};
|
|
564
496
|
export const parseEdaFile = async (buffer, type = 'olb', options = {}) => {
|
|
565
497
|
const locale = options.locale || 'zh-CN';
|
|
566
498
|
const normalizedType = type === 'dra'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-eda",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Standalone EDA renderer plugin for File Viewer with OLB, DRA, GDSII, and OASIS structure preview.",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"README.zh-CN.md"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@file-viewer/core": "3.3.
|
|
66
|
-
"@file-viewer/eda-layout": "3.3.
|
|
67
|
-
"@file-viewer/eda-orcad": "3.3.
|
|
65
|
+
"@file-viewer/core": "3.3.5",
|
|
66
|
+
"@file-viewer/eda-layout": "3.3.5",
|
|
67
|
+
"@file-viewer/eda-orcad": "3.3.5",
|
|
68
68
|
"cfb": "^1.2.2"
|
|
69
69
|
},
|
|
70
70
|
"license": "Apache-2.0",
|