@file-viewer/renderer-eda 2.2.3 → 2.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/eda.js CHANGED
@@ -61,6 +61,11 @@ const EDA_UI_TEXT = {
61
61
  'meta.library': '库',
62
62
  'meta.userUnit': '用户单位',
63
63
  'meta.dbUnit': '数据库单位',
64
+ 'layout.summary': '{structures} 个结构 · {elements} 个元素',
65
+ 'layout.webglSummary': 'WebGL · {elements} 个元素',
66
+ 'layout.aria': '{layout} 版图预览',
67
+ 'header.cfbViewer': 'CFB 结构预览器',
68
+ 'header.binaryViewer': '二进制结构预览器',
64
69
  },
65
70
  'en-US': {
66
71
  'role.root': 'Root',
@@ -121,10 +126,80 @@ const EDA_UI_TEXT = {
121
126
  'meta.library': 'Library',
122
127
  'meta.userUnit': 'User unit',
123
128
  'meta.dbUnit': 'DB unit',
129
+ 'layout.summary': '{structures} structures · {elements} elements',
130
+ 'layout.webglSummary': 'WebGL · {elements} elements',
131
+ 'layout.aria': '{layout} layout preview',
132
+ 'header.cfbViewer': 'CFB structure viewer',
133
+ 'header.binaryViewer': 'Binary structure viewer',
134
+ },
135
+ 'ja-JP': {
136
+ 'role.root': 'ルート',
137
+ 'role.library': 'ライブラリ',
138
+ 'role.symbol': 'シンボル',
139
+ 'role.footprint': 'フットプリント',
140
+ 'role.padstack': 'Padstack',
141
+ 'role.drawing': '図面',
142
+ 'role.metadata': 'メタデータ',
143
+ 'role.property': 'プロパティ',
144
+ 'role.geometry': '幾何',
145
+ 'role.net': 'ネット',
146
+ 'role.unknown': '不明',
147
+ 'confidence.high': '高',
148
+ 'confidence.medium': '中',
149
+ 'confidence.low': '低',
150
+ 'kind.storage': 'ディレクトリ',
151
+ 'kind.text': 'テキスト',
152
+ 'kind.binary': 'バイナリ',
153
+ 'panel.layout': 'レイアウトプレビュー',
154
+ 'empty.noGeometry.title': '描画可能な幾何要素がありません',
155
+ 'empty.noGeometry.description': '{layout} のヘッダーと構造情報を読み込みましたが、boundary、path、text、reference 要素は見つかりませんでした。',
156
+ 'stats.textStreams': 'テキストストリーム',
157
+ 'stats.binaryStreams': 'バイナリストリーム',
158
+ 'stats.storageEntries': 'ディレクトリ',
159
+ 'stats.properties': 'プロパティ',
160
+ 'stats.symbols': 'シンボル',
161
+ 'stats.footprints': 'フットプリント',
162
+ 'stats.confidence': '信頼度',
163
+ 'group.symbol': 'コンポーネントシンボル',
164
+ 'group.footprint': 'フットプリント図形',
165
+ 'group.drawing': '図面情報',
166
+ 'state.loading': '{type} を解析しています...',
167
+ 'state.errorTitle': 'EDA プレビューのお知らせ',
168
+ 'header.format': '形式',
169
+ 'header.size': 'サイズ',
170
+ 'header.entries': '項目',
171
+ 'summary.layoutReady': '{layout} は IC レイアウトの工学ファイルです。認識可能な幾何要素をブラウザー内で解析し、小規模図面は SVG、大規模図面は WebGL canvas で表示します。構造、文字列、診断索引も保持します。',
172
+ 'summary.layoutSafe': 'GDSII / OASIS は IC レイアウトの工学ファイルです。構造、プロパティ、可読文字列、バイナリ構造の手掛かりを優先的に索引化し、フロントエンド内で安全にフォールバックします。',
173
+ 'summary.orcadSafe': 'OLB / DRA は OrCAD / Allegro 系の独自設計データです。CFB 構造、オブジェクト候補、プロパティ、可読テキストを優先的に解析し、フロントエンド内で安全にフォールバックします。',
174
+ 'search.placeholder': 'パス、役割、プロパティ、テキストを絞り込み',
175
+ 'selection.title': '現在の項目',
176
+ 'selection.none': '未選択',
177
+ 'selection.storageTitle': 'ディレクトリ項目',
178
+ 'selection.storageDescription': 'このノードは下位ストリームを整理するためのもので、直接表示できるテキストや 16 進断片はありません。',
179
+ 'selection.localStrings': '現在の項目の文字列',
180
+ 'panel.overview': '解析概要',
181
+ 'panel.tree': '構造ツリー',
182
+ 'panel.objects': 'EDA オブジェクト',
183
+ 'panel.strings': '可読文字列',
184
+ 'panel.diagnostics': '診断',
185
+ 'panel.nodeCount': '{count} ノード',
186
+ 'panel.itemCount': '{count} 件',
187
+ 'panel.entryCount': '{count} 項目',
188
+ 'empty.noObjects.title': '明確なオブジェクト候補がありません',
189
+ 'empty.noObjects.description': '構造ツリー、プロパティ、文字列索引から可読内容を確認できます。',
190
+ 'meta.renderer': 'レンダラー',
191
+ 'meta.library': 'ライブラリ',
192
+ 'meta.userUnit': 'ユーザー単位',
193
+ 'meta.dbUnit': 'データベース単位',
194
+ 'layout.summary': '構造 {structures} 件 · 要素 {elements} 件',
195
+ 'layout.webglSummary': 'WebGL · 要素 {elements} 件',
196
+ 'layout.aria': '{layout} レイアウトプレビュー',
197
+ 'header.cfbViewer': 'CFB 構造ビューアー',
198
+ 'header.binaryViewer': 'バイナリ構造ビューアー',
124
199
  },
125
200
  };
126
201
  const formatEdaUiText = (locale, key, params = {}) => {
127
- const template = EDA_UI_TEXT[locale][key] || EDA_UI_TEXT['zh-CN'][key] || key;
202
+ const template = EDA_UI_TEXT[locale]?.[key] || EDA_UI_TEXT['en-US'][key] || key;
128
203
  return Object.entries(params).reduce((message, [name, value]) => message.replace(new RegExp(`\\{${name}\\}`, 'g'), String(value)), template);
129
204
  };
130
205
  const edaStyle = `
@@ -449,7 +524,7 @@ const createWebglLayoutPreview = (layout, width, height) => {
449
524
  const createLayoutPreview = (layout, locale) => {
450
525
  const panel = createElement('section', 'eda-panel eda-layout-panel');
451
526
  const layoutLabel = layout.format === 'oasis' ? 'OASIS' : 'GDSII';
452
- appendPanelHead(panel, formatEdaUiText(locale, 'panel.layout'), `${layoutLabel} · ${layout.structureCount || layout.structures.length} structures · ${layout.elements.length} elements`);
527
+ appendPanelHead(panel, formatEdaUiText(locale, 'panel.layout'), `${layoutLabel} · ${formatEdaUiText(locale, 'layout.summary', { structures: layout.structureCount || layout.structures.length, elements: layout.elements.length })}`);
453
528
  const meta = createElement('div', 'eda-layout-meta');
454
529
  [
455
530
  `${formatEdaUiText(locale, 'meta.library')}: ${layout.libraryName || '-'}`,
@@ -485,7 +560,7 @@ const createLayoutPreview = (layout, locale) => {
485
560
  ? createWebglLayoutPreview(layout, svgWidth, svgHeight)
486
561
  : null;
487
562
  if (webglPreview) {
488
- meta.append(createElement('span', undefined, `${formatEdaUiText(locale, 'meta.renderer')}: WebGL · ${webglPreview.batch.elementCount} elements`));
563
+ meta.append(createElement('span', undefined, `${formatEdaUiText(locale, 'meta.renderer')}: ${formatEdaUiText(locale, 'layout.webglSummary', { elements: webglPreview.batch.elementCount })}`));
489
564
  webglPreview.batch.warnings.forEach(item => {
490
565
  const warning = createElement('div', 'eda-warning');
491
566
  warning.append(createElement('p', undefined, item));
@@ -502,7 +577,7 @@ const createLayoutPreview = (layout, locale) => {
502
577
  height: svgHeight,
503
578
  viewBox: `0 0 ${svgWidth} ${svgHeight}`,
504
579
  role: 'img',
505
- 'aria-label': `${layoutLabel} layout preview`,
580
+ 'aria-label': formatEdaUiText(locale, 'layout.aria', { layout: layoutLabel }),
506
581
  });
507
582
  svg.append(createSvgElement('rect', {
508
583
  x: 0,
@@ -598,7 +673,7 @@ const createEmpty = (title, description) => {
598
673
  };
599
674
  export default async function renderEda(buffer, target, type = 'olb', context) {
600
675
  const normalizedType = ['dra', 'gds', 'oas', 'oasis'].includes(type) ? type : 'olb';
601
- const locale = resolveFileViewerLocale(context?.options) === 'en-US' ? 'en-US' : 'zh-CN';
676
+ const locale = resolveFileViewerLocale(context?.options);
602
677
  const filename = context?.filename || `preview.${normalizedType}`;
603
678
  const root = createElement('section', 'eda-viewer');
604
679
  const style = createStyle();
@@ -631,7 +706,7 @@ export default async function renderEda(buffer, target, type = 'olb', context) {
631
706
  root.replaceChildren();
632
707
  const header = createElement('header', 'eda-header');
633
708
  const headerTitle = document.createElement('div');
634
- headerTitle.append(createElement('span', undefined, parsed.parser === 'cfb' ? 'CFB STRUCTURE VIEWER' : 'BINARY STRUCTURE VIEWER'), createElement('h2', undefined, filename));
709
+ headerTitle.append(createElement('span', undefined, parsed.parser === 'cfb' ? formatEdaUiText(locale, 'header.cfbViewer') : formatEdaUiText(locale, 'header.binaryViewer')), createElement('h2', undefined, filename));
635
710
  const headerStats = document.createElement('dl');
636
711
  appendDefinition(headerStats, formatEdaUiText(locale, 'header.format'), parsed.type.toUpperCase());
637
712
  appendDefinition(headerStats, formatEdaUiText(locale, 'header.size'), formatBytes(parsed.byteLength));
@@ -1,5 +1,5 @@
1
1
  import { type EdaLayoutPreview } from '@file-viewer/eda-layout';
2
- export type EdaParserLocale = 'zh-CN' | 'en-US';
2
+ export type EdaParserLocale = 'zh-CN' | 'en-US' | 'ja-JP';
3
3
  export type { EdaLayoutElement, EdaLayoutPreview, } from '@file-viewer/eda-layout';
4
4
  export type EdaFileType = 'olb' | 'dra' | 'gds' | 'oas' | 'oasis';
5
5
  export type EdaParserMode = 'cfb' | 'binary';
package/dist/edaParser.js CHANGED
@@ -11,6 +11,13 @@ const EDA_PARSER_TEXT = {
11
11
  binaryIndex: '未识别为 CFB 容器,已使用二进制字符串索引模式展示可读信息。',
12
12
  coverage: '已索引 {streams} 个条目、{strings} 个可读字符串、{entities} 个 EDA 结构候选。',
13
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} 版图结构',
14
21
  noSymbol: '未发现明确的元件符号候选,文件可能使用了私有二进制编码或需要专业工具导出 ASCII/XML 后再检查。',
15
22
  noFootprint: '未发现明确的封装、图形或 padstack 候选,文件可能使用了私有二进制数据库编码。',
16
23
  noGds: '未发现明确的 GDSII 版图结构候选。文件可能不是标准 GDSII 二进制或使用了专有封装。',
@@ -25,6 +32,13 @@ const EDA_PARSER_TEXT = {
25
32
  binaryIndex: 'This file is not recognized as a CFB container, so readable information is shown through a safe binary string index.',
26
33
  coverage: 'Indexed {streams} entries, {strings} readable strings, and {entities} EDA structure candidates.',
27
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',
28
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.',
29
43
  noFootprint: 'No clear footprint, drawing, or padstack candidates were found. The file may use private binary database encoding.',
30
44
  noGds: 'No clear GDSII layout structure candidates were found. The file may not be standard GDSII binary or may use a proprietary wrapper.',
@@ -32,9 +46,30 @@ const EDA_PARSER_TEXT = {
32
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.',
33
47
  binaryFallback: 'This file is not a standard CFB container, so it falls back to a safe binary string index preview.',
34
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
+ },
35
70
  };
36
71
  const getEdaParserText = (locale, key, params = {}) => {
37
- const template = EDA_PARSER_TEXT[locale]?.[key] || EDA_PARSER_TEXT['zh-CN'][key] || key;
72
+ const template = EDA_PARSER_TEXT[locale]?.[key] || EDA_PARSER_TEXT['en-US'][key] || key;
38
73
  return Object.entries(params).reduce((message, [name, value]) => message.replace(new RegExp(`\\{${name}\\}`, 'g'), String(value)), template);
39
74
  };
40
75
  const toBytes = (buffer) => new Uint8Array(buffer);
@@ -417,7 +452,7 @@ const buildDiagnostics = (type, parser, streams, entities, strings, warnings, la
417
452
  level: 'info',
418
453
  code: `${layout.format}-layout`,
419
454
  message: getEdaParserText(locale, 'layout', {
420
- layout: layout.format === 'oasis' ? 'OASIS fixture' : 'GDSII layout',
455
+ layout: getEdaParserText(locale, layout.format === 'oasis' ? 'layoutOasisName' : 'layoutGdsName'),
421
456
  structures: layout.structureCount,
422
457
  elements: layout.elements.length,
423
458
  })
@@ -450,10 +485,10 @@ const assembleResult = (buffer, type, parser, streamCount, streams, strings, war
450
485
  type,
451
486
  parser,
452
487
  title: type === 'olb'
453
- ? (parser === 'cfb' ? 'OrCAD Capture Symbol Library' : 'OLB Binary Library')
488
+ ? getEdaParserText(locale, parser === 'cfb' ? 'titleOrcadSymbolLibrary' : 'titleOlbBinaryLibrary')
454
489
  : type === 'dra'
455
- ? (parser === 'cfb' ? 'OrCAD / Allegro Drawing Library' : 'DRA Binary Drawing')
456
- : `${type.toUpperCase()} Layout Structure`,
490
+ ? getEdaParserText(locale, parser === 'cfb' ? 'titleOrcadDrawingLibrary' : 'titleDraBinaryDrawing')
491
+ : getEdaParserText(locale, 'titleLayoutStructure', { type: type.toUpperCase() }),
457
492
  byteLength: buffer.byteLength,
458
493
  streamCount,
459
494
  totalStreamBytes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-eda",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
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.",
@@ -57,9 +57,9 @@
57
57
  "LICENSE"
58
58
  ],
59
59
  "dependencies": {
60
- "@file-viewer/core": "2.2.3",
61
- "@file-viewer/eda-layout": "2.2.3",
62
- "@file-viewer/eda-orcad": "2.2.3",
60
+ "@file-viewer/core": "2.2.4",
61
+ "@file-viewer/eda-layout": "2.2.4",
62
+ "@file-viewer/eda-orcad": "2.2.4",
63
63
  "cfb": "^1.2.2"
64
64
  },
65
65
  "devDependencies": {