omni-viewer-core 0.1.0
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/LICENSE +21 -0
- package/README.md +80 -0
- package/THIRD_PARTY_NOTICES.md +49 -0
- package/dist/assets/audio-engine/audio_engine.mjs +2 -0
- package/dist/assets/audio-engine/audio_engine.wasm +0 -0
- package/dist/assets/pdfjs/pdf.worker.min.mjs +21 -0
- package/dist/host/index.d.ts +133 -0
- package/dist/host/index.js +10 -0
- package/dist/i18n/catalog.en.d.ts +1 -0
- package/dist/i18n/catalog.en.js +411 -0
- package/dist/i18n/catalog.ko.d.ts +1 -0
- package/dist/i18n/catalog.ko.js +68 -0
- package/dist/i18n/index.d.ts +18 -0
- package/dist/i18n/index.js +41 -0
- package/dist/licenses/emscripten.txt +101 -0
- package/dist/licenses/kissfft.txt +28 -0
- package/dist/licenses/pdfjs-dist.txt +177 -0
- package/dist/parsers/a2l/index.d.ts +1 -0
- package/dist/parsers/a2l/index.js +1 -0
- package/dist/parsers/archive/index.d.ts +22 -0
- package/dist/parsers/archive/index.js +46 -0
- package/dist/parsers/archive/model.d.ts +29 -0
- package/dist/parsers/archive/model.js +1 -0
- package/dist/parsers/archive/worker.d.ts +21 -0
- package/dist/parsers/archive/worker.js +1 -0
- package/dist/parsers/arxml/index.d.ts +1 -0
- package/dist/parsers/arxml/index.js +1 -0
- package/dist/parsers/asc/index.d.ts +1 -0
- package/dist/parsers/asc/index.js +1 -0
- package/dist/parsers/audio/index.d.ts +9 -0
- package/dist/parsers/audio/index.js +46 -0
- package/dist/parsers/automotive/index.d.ts +33 -0
- package/dist/parsers/automotive/index.js +973 -0
- package/dist/parsers/blf/index.d.ts +1 -0
- package/dist/parsers/blf/index.js +1 -0
- package/dist/parsers/csv/delimiter.d.ts +31 -0
- package/dist/parsers/csv/delimiter.js +151 -0
- package/dist/parsers/csv/index.d.ts +30 -0
- package/dist/parsers/csv/index.js +108 -0
- package/dist/parsers/csv/parseText.d.ts +20 -0
- package/dist/parsers/csv/parseText.js +108 -0
- package/dist/parsers/csv/sort.d.ts +26 -0
- package/dist/parsers/csv/sort.js +224 -0
- package/dist/parsers/csv/statistics.d.ts +49 -0
- package/dist/parsers/csv/statistics.js +150 -0
- package/dist/parsers/dbc/index.d.ts +56 -0
- package/dist/parsers/dbc/index.js +94 -0
- package/dist/parsers/doc-binary/index.d.ts +35 -0
- package/dist/parsers/doc-binary/index.js +267 -0
- package/dist/parsers/doc-binary/vscode-parser.d.ts +142 -0
- package/dist/parsers/doc-binary/vscode-parser.js +3747 -0
- package/dist/parsers/excel/index.d.ts +17 -0
- package/dist/parsers/excel/index.js +406 -0
- package/dist/parsers/excel/model.d.ts +80 -0
- package/dist/parsers/excel/model.js +48 -0
- package/dist/parsers/excel/serialize.d.ts +3 -0
- package/dist/parsers/excel/serialize.js +78 -0
- package/dist/parsers/hdf5/index.d.ts +75 -0
- package/dist/parsers/hdf5/index.js +658 -0
- package/dist/parsers/hdf5/node.d.ts +21 -0
- package/dist/parsers/hdf5/node.js +95 -0
- package/dist/parsers/json/index.d.ts +15 -0
- package/dist/parsers/json/index.js +102 -0
- package/dist/parsers/json/model.d.ts +42 -0
- package/dist/parsers/json/model.js +140 -0
- package/dist/parsers/json/parse.d.ts +22 -0
- package/dist/parsers/json/parse.js +279 -0
- package/dist/parsers/json/tokenizer.d.ts +17 -0
- package/dist/parsers/json/tokenizer.js +175 -0
- package/dist/parsers/jsonl/index.d.ts +14 -0
- package/dist/parsers/jsonl/index.js +18 -0
- package/dist/parsers/jsonl/model.d.ts +23 -0
- package/dist/parsers/jsonl/model.js +1 -0
- package/dist/parsers/jsonl/parse.d.ts +7 -0
- package/dist/parsers/jsonl/parse.js +34 -0
- package/dist/parsers/markdown/index.d.ts +37 -0
- package/dist/parsers/markdown/index.js +59 -0
- package/dist/parsers/mat/index.d.ts +31 -0
- package/dist/parsers/mat/index.js +426 -0
- package/dist/parsers/mermaid/index.d.ts +5 -0
- package/dist/parsers/mermaid/index.js +3 -0
- package/dist/parsers/mf4/index.d.ts +1 -0
- package/dist/parsers/mf4/index.js +1 -0
- package/dist/parsers/parquet/index.d.ts +21 -0
- package/dist/parsers/parquet/index.js +68 -0
- package/dist/parsers/pcap/index.d.ts +1 -0
- package/dist/parsers/pcap/index.js +1 -0
- package/dist/parsers/pcapng/index.d.ts +1 -0
- package/dist/parsers/pcapng/index.js +1 -0
- package/dist/parsers/plantuml/index.d.ts +5 -0
- package/dist/parsers/plantuml/index.js +4 -0
- package/dist/parsers/ppt-binary/index.d.ts +5 -0
- package/dist/parsers/ppt-binary/index.js +62 -0
- package/dist/parsers/ppt-binary/pptBinaryBuildContext.d.ts +12 -0
- package/dist/parsers/ppt-binary/pptBinaryBuildContext.js +40 -0
- package/dist/parsers/ppt-binary/pptBinaryContainer.d.ts +4 -0
- package/dist/parsers/ppt-binary/pptBinaryContainer.js +174 -0
- package/dist/parsers/ppt-binary/pptBinaryTypes.d.ts +125 -0
- package/dist/parsers/ppt-binary/pptBinaryTypes.js +1 -0
- package/dist/parsers/ppt-binary/pptSlideLayouts.d.ts +9 -0
- package/dist/parsers/ppt-binary/pptSlideLayouts.js +510 -0
- package/dist/parsers/ppt-binary/vscode-parser.d.ts +116 -0
- package/dist/parsers/ppt-binary/vscode-parser.js +2853 -0
- package/dist/parsers/ppt-binary/vscode.d.ts +4 -0
- package/dist/parsers/ppt-binary/vscode.js +12 -0
- package/dist/parsers/pptx/index.d.ts +15 -0
- package/dist/parsers/pptx/index.js +88 -0
- package/dist/parsers/pptx/vscode-parser.d.ts +167 -0
- package/dist/parsers/pptx/vscode-parser.js +1503 -0
- package/dist/parsers/pptx/vscode.d.ts +4 -0
- package/dist/parsers/pptx/vscode.js +18 -0
- package/dist/parsers/pptx/zip-reader.d.ts +3 -0
- package/dist/parsers/pptx/zip-reader.js +20 -0
- package/dist/parsers/proto/index.d.ts +90 -0
- package/dist/parsers/proto/index.js +197 -0
- package/dist/parsers/psd/index.d.ts +16 -0
- package/dist/parsers/psd/index.js +10 -0
- package/dist/parsers/shapefile/dbf.d.ts +23 -0
- package/dist/parsers/shapefile/dbf.js +112 -0
- package/dist/parsers/shapefile/index.d.ts +44 -0
- package/dist/parsers/shapefile/index.js +119 -0
- package/dist/parsers/shapefile/reproject.d.ts +10 -0
- package/dist/parsers/shapefile/reproject.js +41 -0
- package/dist/parsers/slide-model.d.ts +106 -0
- package/dist/parsers/slide-model.js +1 -0
- package/dist/parsers/toml/index.d.ts +15 -0
- package/dist/parsers/toml/index.js +18 -0
- package/dist/parsers/toml/model.d.ts +15 -0
- package/dist/parsers/toml/model.js +1 -0
- package/dist/parsers/toml/parse.d.ts +16 -0
- package/dist/parsers/toml/parse.js +266 -0
- package/dist/parsers/types.d.ts +103 -0
- package/dist/parsers/types.js +106 -0
- package/dist/parsers/video/index.d.ts +6 -0
- package/dist/parsers/video/index.js +2 -0
- package/dist/parsers/yaml/index.d.ts +16 -0
- package/dist/parsers/yaml/index.js +58 -0
- package/dist/parsers/yaml/model.d.ts +22 -0
- package/dist/parsers/yaml/model.js +1 -0
- package/dist/parsers/yaml/self-loading.d.ts +3 -0
- package/dist/parsers/yaml/self-loading.js +19 -0
- package/dist/parsers/zip-scan.d.ts +8 -0
- package/dist/parsers/zip-scan.js +80 -0
- package/dist/registry/container.d.ts +17 -0
- package/dist/registry/container.js +49 -0
- package/dist/registry/index.d.ts +133 -0
- package/dist/registry/index.js +348 -0
- package/dist/registry/probe.d.ts +3 -0
- package/dist/registry/probe.js +177 -0
- package/dist/registry/sniff.d.ts +17 -0
- package/dist/registry/sniff.js +57 -0
- package/dist/styles/archive.css +10 -0
- package/dist/styles/audio.css +66 -0
- package/dist/styles/automotive.css +1 -0
- package/dist/styles/csv.css +262 -0
- package/dist/styles/excel.css +212 -0
- package/dist/styles/fallback.css +48 -0
- package/dist/styles/hdf5.css +3 -0
- package/dist/styles/hwp.css +12 -0
- package/dist/styles/image.css +115 -0
- package/dist/styles/json.css +342 -0
- package/dist/styles/jsonl.css +1 -0
- package/dist/styles/markdown.css +10 -0
- package/dist/styles/mat.css +2 -0
- package/dist/styles/mermaid.css +1 -0
- package/dist/styles/parquet.css +2 -0
- package/dist/styles/pdf.css +551 -0
- package/dist/styles/plantuml.css +1 -0
- package/dist/styles/ppt.css +1 -0
- package/dist/styles/proto.css +2 -0
- package/dist/styles/psd.css +1 -0
- package/dist/styles/shapefile.css +25 -0
- package/dist/styles/toml.css +1 -0
- package/dist/styles/video.css +74 -0
- package/dist/styles/word.css +685 -0
- package/dist/styles/yaml.css +1 -0
- package/dist/viewers/a2l/index.d.ts +15 -0
- package/dist/viewers/a2l/index.js +5 -0
- package/dist/viewers/archive/archive-preview-decoder.d.ts +4 -0
- package/dist/viewers/archive/archive-preview-decoder.js +223 -0
- package/dist/viewers/archive/controller.d.ts +24 -0
- package/dist/viewers/archive/controller.js +18 -0
- package/dist/viewers/archive/index.d.ts +25 -0
- package/dist/viewers/archive/index.js +230 -0
- package/dist/viewers/archive/preview.d.ts +2 -0
- package/dist/viewers/archive/preview.js +2 -0
- package/dist/viewers/archive/styles.d.ts +1 -0
- package/dist/viewers/archive/styles.js +11 -0
- package/dist/viewers/arxml/index.d.ts +15 -0
- package/dist/viewers/arxml/index.js +5 -0
- package/dist/viewers/asc/index.d.ts +15 -0
- package/dist/viewers/asc/index.js +5 -0
- package/dist/viewers/audio/controller.d.ts +33 -0
- package/dist/viewers/audio/controller.js +49 -0
- package/dist/viewers/audio/engine.d.ts +44 -0
- package/dist/viewers/audio/engine.js +108 -0
- package/dist/viewers/audio/index.d.ts +92 -0
- package/dist/viewers/audio/index.js +448 -0
- package/dist/viewers/audio/self-loading.d.ts +7 -0
- package/dist/viewers/audio/self-loading.js +42 -0
- package/dist/viewers/audio/styles.d.ts +1 -0
- package/dist/viewers/audio/styles.js +73 -0
- package/dist/viewers/automotive/index.d.ts +8 -0
- package/dist/viewers/automotive/index.js +152 -0
- package/dist/viewers/automotive/styles.d.ts +1 -0
- package/dist/viewers/automotive/styles.js +1 -0
- package/dist/viewers/avro/index.d.ts +15 -0
- package/dist/viewers/avro/index.js +5 -0
- package/dist/viewers/bag/index.d.ts +15 -0
- package/dist/viewers/bag/index.js +5 -0
- package/dist/viewers/blf/index.d.ts +15 -0
- package/dist/viewers/blf/index.js +5 -0
- package/dist/viewers/csv/controller.d.ts +126 -0
- package/dist/viewers/csv/controller.js +598 -0
- package/dist/viewers/csv/index.d.ts +48 -0
- package/dist/viewers/csv/index.js +846 -0
- package/dist/viewers/csv/styles.d.ts +1 -0
- package/dist/viewers/csv/styles.js +267 -0
- package/dist/viewers/db3/index.d.ts +15 -0
- package/dist/viewers/db3/index.js +5 -0
- package/dist/viewers/dbc/index.d.ts +15 -0
- package/dist/viewers/dbc/index.js +5 -0
- package/dist/viewers/diagram.d.ts +14 -0
- package/dist/viewers/diagram.js +95 -0
- package/dist/viewers/excel/controller.d.ts +108 -0
- package/dist/viewers/excel/controller.js +548 -0
- package/dist/viewers/excel/grid.d.ts +28 -0
- package/dist/viewers/excel/grid.js +99 -0
- package/dist/viewers/excel/index.d.ts +37 -0
- package/dist/viewers/excel/index.js +620 -0
- package/dist/viewers/excel/self-loading.d.ts +6 -0
- package/dist/viewers/excel/self-loading.js +13 -0
- package/dist/viewers/excel/styles.d.ts +1 -0
- package/dist/viewers/excel/styles.js +216 -0
- package/dist/viewers/fallback/index.d.ts +17 -0
- package/dist/viewers/fallback/index.js +130 -0
- package/dist/viewers/fallback/styles.d.ts +1 -0
- package/dist/viewers/fallback/styles.js +49 -0
- package/dist/viewers/hdf5/index.d.ts +19 -0
- package/dist/viewers/hdf5/index.js +170 -0
- package/dist/viewers/hdf5/styles.d.ts +1 -0
- package/dist/viewers/hdf5/styles.js +4 -0
- package/dist/viewers/hwp/controller.d.ts +19 -0
- package/dist/viewers/hwp/controller.js +22 -0
- package/dist/viewers/hwp/index.d.ts +39 -0
- package/dist/viewers/hwp/index.js +271 -0
- package/dist/viewers/hwp/self-loading.d.ts +2 -0
- package/dist/viewers/hwp/self-loading.js +6 -0
- package/dist/viewers/hwp/styles.d.ts +1 -0
- package/dist/viewers/hwp/styles.js +13 -0
- package/dist/viewers/image/controller.d.ts +210 -0
- package/dist/viewers/image/controller.js +336 -0
- package/dist/viewers/image/decode.d.ts +54 -0
- package/dist/viewers/image/decode.js +150 -0
- package/dist/viewers/image/index.d.ts +38 -0
- package/dist/viewers/image/index.js +749 -0
- package/dist/viewers/image/limits.d.ts +18 -0
- package/dist/viewers/image/limits.js +20 -0
- package/dist/viewers/image/styles.d.ts +1 -0
- package/dist/viewers/image/styles.js +119 -0
- package/dist/viewers/json/controller.d.ts +89 -0
- package/dist/viewers/json/controller.js +411 -0
- package/dist/viewers/json/index.d.ts +25 -0
- package/dist/viewers/json/index.js +503 -0
- package/dist/viewers/json/styles.d.ts +1 -0
- package/dist/viewers/json/styles.js +346 -0
- package/dist/viewers/json/transforms.d.ts +27 -0
- package/dist/viewers/json/transforms.js +253 -0
- package/dist/viewers/jsonl/controller.d.ts +48 -0
- package/dist/viewers/jsonl/controller.js +136 -0
- package/dist/viewers/jsonl/index.d.ts +22 -0
- package/dist/viewers/jsonl/index.js +184 -0
- package/dist/viewers/jsonl/styles.d.ts +1 -0
- package/dist/viewers/jsonl/styles.js +1 -0
- package/dist/viewers/markdown/controller.d.ts +50 -0
- package/dist/viewers/markdown/controller.js +62 -0
- package/dist/viewers/markdown/index.d.ts +64 -0
- package/dist/viewers/markdown/index.js +425 -0
- package/dist/viewers/markdown/math.d.ts +21 -0
- package/dist/viewers/markdown/math.js +100 -0
- package/dist/viewers/markdown/self-loading.d.ts +5 -0
- package/dist/viewers/markdown/self-loading.js +48 -0
- package/dist/viewers/markdown/styles.d.ts +1 -0
- package/dist/viewers/markdown/styles.js +11 -0
- package/dist/viewers/mat/index.d.ts +19 -0
- package/dist/viewers/mat/index.js +113 -0
- package/dist/viewers/mat/styles.d.ts +1 -0
- package/dist/viewers/mat/styles.js +3 -0
- package/dist/viewers/media.d.ts +9 -0
- package/dist/viewers/media.js +77 -0
- package/dist/viewers/mermaid/index.d.ts +17 -0
- package/dist/viewers/mermaid/index.js +6 -0
- package/dist/viewers/mermaid/self-loading.d.ts +2 -0
- package/dist/viewers/mermaid/self-loading.js +2 -0
- package/dist/viewers/mf4/index.d.ts +15 -0
- package/dist/viewers/mf4/index.js +5 -0
- package/dist/viewers/parquet/controller.d.ts +37 -0
- package/dist/viewers/parquet/controller.js +26 -0
- package/dist/viewers/parquet/index.d.ts +23 -0
- package/dist/viewers/parquet/index.js +134 -0
- package/dist/viewers/parquet/styles.d.ts +1 -0
- package/dist/viewers/parquet/styles.js +3 -0
- package/dist/viewers/pcap/index.d.ts +15 -0
- package/dist/viewers/pcap/index.js +5 -0
- package/dist/viewers/pcapng/index.d.ts +15 -0
- package/dist/viewers/pcapng/index.js +5 -0
- package/dist/viewers/pdf/controller.d.ts +120 -0
- package/dist/viewers/pdf/controller.js +191 -0
- package/dist/viewers/pdf/editing.d.ts +26 -0
- package/dist/viewers/pdf/editing.js +265 -0
- package/dist/viewers/pdf/index.d.ts +88 -0
- package/dist/viewers/pdf/index.js +1400 -0
- package/dist/viewers/pdf/self-loading.d.ts +6 -0
- package/dist/viewers/pdf/self-loading.js +14 -0
- package/dist/viewers/pdf/styles.d.ts +1 -0
- package/dist/viewers/pdf/styles.js +555 -0
- package/dist/viewers/plantuml/index.d.ts +17 -0
- package/dist/viewers/plantuml/index.js +6 -0
- package/dist/viewers/plantuml/self-loading.d.ts +2 -0
- package/dist/viewers/plantuml/self-loading.js +2 -0
- package/dist/viewers/ppt/chart.d.ts +8 -0
- package/dist/viewers/ppt/chart.js +83 -0
- package/dist/viewers/ppt/controller.d.ts +34 -0
- package/dist/viewers/ppt/controller.js +27 -0
- package/dist/viewers/ppt/index.d.ts +33 -0
- package/dist/viewers/ppt/index.js +101 -0
- package/dist/viewers/ppt/render.d.ts +5 -0
- package/dist/viewers/ppt/render.js +144 -0
- package/dist/viewers/ppt/self-loading.d.ts +9 -0
- package/dist/viewers/ppt/self-loading.js +4 -0
- package/dist/viewers/ppt/styles.d.ts +1 -0
- package/dist/viewers/ppt/styles.js +1 -0
- package/dist/viewers/proto/index.d.ts +17 -0
- package/dist/viewers/proto/index.js +170 -0
- package/dist/viewers/proto/styles.d.ts +1 -0
- package/dist/viewers/proto/styles.js +2 -0
- package/dist/viewers/psd/index.d.ts +27 -0
- package/dist/viewers/psd/index.js +39 -0
- package/dist/viewers/psd/self-loading.d.ts +10 -0
- package/dist/viewers/psd/self-loading.js +20 -0
- package/dist/viewers/psd/styles.d.ts +1 -0
- package/dist/viewers/psd/styles.js +1 -0
- package/dist/viewers/reqif/index.d.ts +15 -0
- package/dist/viewers/reqif/index.js +5 -0
- package/dist/viewers/shapefile/index.d.ts +35 -0
- package/dist/viewers/shapefile/index.js +336 -0
- package/dist/viewers/shapefile/self-loading.d.ts +7 -0
- package/dist/viewers/shapefile/self-loading.js +32 -0
- package/dist/viewers/shapefile/styles.d.ts +1 -0
- package/dist/viewers/shapefile/styles.js +28 -0
- package/dist/viewers/stp/index.d.ts +15 -0
- package/dist/viewers/stp/index.js +5 -0
- package/dist/viewers/structured-styles.d.ts +1 -0
- package/dist/viewers/structured-styles.js +1 -0
- package/dist/viewers/structured.d.ts +36 -0
- package/dist/viewers/structured.js +138 -0
- package/dist/viewers/toml/controller.d.ts +38 -0
- package/dist/viewers/toml/controller.js +61 -0
- package/dist/viewers/toml/index.d.ts +18 -0
- package/dist/viewers/toml/index.js +34 -0
- package/dist/viewers/types.d.ts +36 -0
- package/dist/viewers/types.js +9 -0
- package/dist/viewers/video/controller.d.ts +29 -0
- package/dist/viewers/video/controller.js +54 -0
- package/dist/viewers/video/index.d.ts +18 -0
- package/dist/viewers/video/index.js +305 -0
- package/dist/viewers/video/styles.d.ts +1 -0
- package/dist/viewers/video/styles.js +79 -0
- package/dist/viewers/word/controller.d.ts +19 -0
- package/dist/viewers/word/controller.js +22 -0
- package/dist/viewers/word/docx-preprocess.d.ts +63 -0
- package/dist/viewers/word/docx-preprocess.js +136 -0
- package/dist/viewers/word/index.d.ts +32 -0
- package/dist/viewers/word/index.js +187 -0
- package/dist/viewers/word/normalize-docx.d.ts +2 -0
- package/dist/viewers/word/normalize-docx.js +50 -0
- package/dist/viewers/word/paginate.d.ts +1 -0
- package/dist/viewers/word/paginate.js +1035 -0
- package/dist/viewers/word/self-loading.d.ts +2 -0
- package/dist/viewers/word/self-loading.js +7 -0
- package/dist/viewers/word/styles.d.ts +1 -0
- package/dist/viewers/word/styles.js +686 -0
- package/dist/viewers/yaml/controller.d.ts +42 -0
- package/dist/viewers/yaml/controller.js +41 -0
- package/dist/viewers/yaml/index.d.ts +21 -0
- package/dist/viewers/yaml/index.js +20 -0
- package/package.json +375 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { parseAutomotive } from '../../parsers/automotive/index.js';
|
|
2
|
+
import { MountAbortedError, VIEWER_ROOT_CLASS } from '../types.js';
|
|
3
|
+
import { automotiveViewerCss } from './styles.js';
|
|
4
|
+
export { automotiveViewerCss } from './styles.js';
|
|
5
|
+
export async function mountAutomotiveViewer(format, input, container, ctx, options = {}) {
|
|
6
|
+
if (options.signal?.aborted)
|
|
7
|
+
throw new MountAbortedError();
|
|
8
|
+
const model = parseAutomotive(format, input.data);
|
|
9
|
+
if (options.signal?.aborted)
|
|
10
|
+
throw new MountAbortedError();
|
|
11
|
+
const disposers = [];
|
|
12
|
+
let root = container;
|
|
13
|
+
if ((options.styleIsolation ?? 'shadow') === 'shadow' && container.attachShadow) {
|
|
14
|
+
root = container.shadowRoot ?? container.attachShadow({ mode: 'open' });
|
|
15
|
+
const style = element('style');
|
|
16
|
+
style.textContent = automotiveViewerCss;
|
|
17
|
+
root.append(style);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
container.classList.add(VIEWER_ROOT_CLASS, 'omni-viewer--automotive');
|
|
21
|
+
}
|
|
22
|
+
const frame = element('div', 'omni-auto');
|
|
23
|
+
const header = element('header', 'omni-auto__header');
|
|
24
|
+
const heading = element('div');
|
|
25
|
+
heading.append(element('div', 'omni-auto__eyebrow', model.format), element('strong', 'omni-auto__title', input.fileName));
|
|
26
|
+
const subtitle = element('div', 'omni-auto__subtitle', `${model.title} · ${formatBytes(model.fileSizeBytes)}`);
|
|
27
|
+
heading.append(subtitle);
|
|
28
|
+
header.append(heading);
|
|
29
|
+
const summary = element('section', 'omni-auto__summary');
|
|
30
|
+
model.summary.forEach(item => {
|
|
31
|
+
const card = element('div', 'omni-auto__summary-item');
|
|
32
|
+
const value = element('div', 'omni-auto__summary-value', String(item.value));
|
|
33
|
+
value.title = String(item.value);
|
|
34
|
+
card.append(value, element('div', 'omni-auto__summary-label', item.label));
|
|
35
|
+
summary.append(card);
|
|
36
|
+
});
|
|
37
|
+
const toolbar = element('div', 'omni-auto__toolbar');
|
|
38
|
+
const search = element('input');
|
|
39
|
+
search.type = 'search';
|
|
40
|
+
search.placeholder = ctx.i18n.t('automotive.search');
|
|
41
|
+
search.setAttribute('aria-label', ctx.i18n.t('automotive.search'));
|
|
42
|
+
const tabs = element('div', 'omni-auto__tabs');
|
|
43
|
+
const copy = element('button', undefined, ctx.i18n.t('automotive.copyJson'));
|
|
44
|
+
copy.type = 'button';
|
|
45
|
+
if (!ctx.clipboard) {
|
|
46
|
+
copy.disabled = true;
|
|
47
|
+
copy.title = ctx.i18n.t('common.noClipboard');
|
|
48
|
+
}
|
|
49
|
+
toolbar.append(search, tabs, copy);
|
|
50
|
+
const warnings = element('section', 'omni-auto__warnings');
|
|
51
|
+
warnings.hidden = model.warnings.length === 0;
|
|
52
|
+
model.warnings.forEach(warning => warnings.append(element('div', undefined, warning)));
|
|
53
|
+
const content = element('main', 'omni-auto__content');
|
|
54
|
+
frame.append(header, summary, toolbar, warnings, content);
|
|
55
|
+
root.append(frame);
|
|
56
|
+
let active = 0;
|
|
57
|
+
let raw = false;
|
|
58
|
+
const on = (target, type, listener) => {
|
|
59
|
+
target.addEventListener(type, listener);
|
|
60
|
+
disposers.push(() => target.removeEventListener(type, listener));
|
|
61
|
+
};
|
|
62
|
+
const activate = (index, showRaw) => { active = index; raw = showRaw; renderTabs(); render(); };
|
|
63
|
+
const renderTabs = () => {
|
|
64
|
+
tabs.replaceChildren();
|
|
65
|
+
model.tables.forEach((table, index) => {
|
|
66
|
+
const button = element('button', undefined, table.title);
|
|
67
|
+
button.type = 'button';
|
|
68
|
+
button.setAttribute('aria-pressed', String(!raw && active === index));
|
|
69
|
+
button.onclick = () => activate(index, false);
|
|
70
|
+
tabs.append(button);
|
|
71
|
+
});
|
|
72
|
+
if (model.rawPreview !== undefined) {
|
|
73
|
+
const button = element('button', undefined, ctx.i18n.t('automotive.rawPreview'));
|
|
74
|
+
button.type = 'button';
|
|
75
|
+
button.setAttribute('aria-pressed', String(raw));
|
|
76
|
+
button.onclick = () => activate(active, true);
|
|
77
|
+
tabs.append(button);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const render = () => {
|
|
81
|
+
content.replaceChildren();
|
|
82
|
+
if (raw) {
|
|
83
|
+
content.append(element('pre', 'omni-auto__raw', model.rawPreview ?? ''));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const table = model.tables[active];
|
|
87
|
+
if (!table) {
|
|
88
|
+
content.append(element('div', 'omni-auto__empty', ctx.i18n.t('automotive.noData')));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
renderTable(content, table, search.value.trim().toLowerCase(), ctx.i18n.t.bind(ctx.i18n));
|
|
92
|
+
};
|
|
93
|
+
on(search, 'input', render);
|
|
94
|
+
on(copy, 'click', () => {
|
|
95
|
+
if (!ctx.clipboard)
|
|
96
|
+
return;
|
|
97
|
+
void ctx.clipboard.writeText(JSON.stringify(model, null, 2)).catch(error => ctx.logger.log('error', `automotive copy failed: ${String(error)}`));
|
|
98
|
+
});
|
|
99
|
+
renderTabs();
|
|
100
|
+
render();
|
|
101
|
+
return {
|
|
102
|
+
dispose() {
|
|
103
|
+
disposers.splice(0).forEach(dispose => dispose());
|
|
104
|
+
frame.remove();
|
|
105
|
+
if (root instanceof ShadowRoot)
|
|
106
|
+
root.replaceChildren();
|
|
107
|
+
else
|
|
108
|
+
container.classList.remove(VIEWER_ROOT_CLASS, 'omni-viewer--automotive');
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function renderTable(container, table, query, t) {
|
|
113
|
+
const rows = query ? table.rows.filter(row => row.some(cell => String(cell).toLowerCase().includes(query))) : table.rows;
|
|
114
|
+
const shown = rows.slice(0, 1000);
|
|
115
|
+
const header = element('div', 'omni-auto__panel-header');
|
|
116
|
+
header.append(element('h2', 'omni-auto__panel-title', table.title), element('span', 'omni-auto__caption', t('automotive.rowsShown', { shown: shown.length, total: rows.length })));
|
|
117
|
+
const wrap = element('div', 'omni-auto__table-wrap');
|
|
118
|
+
const tableElement = element('table');
|
|
119
|
+
const head = element('thead');
|
|
120
|
+
const headRow = element('tr');
|
|
121
|
+
table.headers.forEach(value => headRow.append(element('th', undefined, value)));
|
|
122
|
+
head.append(headRow);
|
|
123
|
+
const body = element('tbody');
|
|
124
|
+
shown.forEach(row => {
|
|
125
|
+
const tr = element('tr');
|
|
126
|
+
row.forEach(value => { const td = element('td', undefined, String(value)); td.title = String(value); tr.append(td); });
|
|
127
|
+
body.append(tr);
|
|
128
|
+
});
|
|
129
|
+
tableElement.append(head, body);
|
|
130
|
+
wrap.append(tableElement);
|
|
131
|
+
container.append(header, wrap);
|
|
132
|
+
}
|
|
133
|
+
function formatBytes(bytes) {
|
|
134
|
+
if (bytes < 1024)
|
|
135
|
+
return `${bytes} B`;
|
|
136
|
+
const units = ['KB', 'MB', 'GB', 'TB'];
|
|
137
|
+
let value = bytes / 1024;
|
|
138
|
+
let unit = 0;
|
|
139
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
140
|
+
value /= 1024;
|
|
141
|
+
unit++;
|
|
142
|
+
}
|
|
143
|
+
return `${value.toFixed(value >= 10 ? 1 : 2)} ${units[unit]}`;
|
|
144
|
+
}
|
|
145
|
+
function element(tag, className, text) {
|
|
146
|
+
const node = document.createElement(tag);
|
|
147
|
+
if (className)
|
|
148
|
+
node.className = className;
|
|
149
|
+
if (text !== undefined)
|
|
150
|
+
node.textContent = text;
|
|
151
|
+
return node;
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const automotiveViewerCss = ":host,.omni-viewer--automotive{display:block;height:100%;color:var(--omni-fg,#ddd);background:var(--omni-bg,#1e1e1e);font:13px var(--omni-font,system-ui)}.omni-auto{height:100%;display:flex;flex-direction:column;min-width:0}.omni-auto__header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:16px 18px 12px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-panel-bg,#252526)}.omni-auto__eyebrow,.omni-auto__subtitle,.omni-auto__caption{color:var(--omni-fg-muted,#999);font-size:12px}.omni-auto__title{display:block;margin:2px 0 4px;font-size:20px}.omni-auto__summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));border-bottom:1px solid var(--omni-border,#444);background:var(--omni-border,#444);gap:1px}.omni-auto__summary-item{padding:11px 14px;background:var(--omni-bg,#1e1e1e);min-width:0}.omni-auto__summary-value{font-size:18px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.omni-auto__summary-label{margin-top:4px;color:var(--omni-fg-muted,#999);font-size:12px}.omni-auto__toolbar{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-panel-bg,#252526)}.omni-auto input,.omni-auto button{box-sizing:border-box;border:1px solid var(--omni-border,#555);border-radius:4px;background:var(--omni-button-bg,#333);color:inherit;font:inherit;padding:6px 9px}.omni-auto input{width:min(300px,35vw);min-width:170px;background:var(--omni-input-bg,#171717)}.omni-auto button{cursor:pointer}.omni-auto button[aria-pressed=true]{background:var(--omni-accent,#0e639c);color:var(--omni-accent-fg,#fff)}.omni-auto button:disabled{opacity:.5;cursor:default}.omni-auto__tabs{display:flex;flex:1;flex-wrap:wrap;gap:4px}.omni-auto__warnings{padding:9px 13px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-warning-bg,#4d3b12);color:var(--omni-warning-fg,#f5d88a)}.omni-auto__content{flex:1;min-height:0;overflow:auto}.omni-auto__panel-header{position:sticky;top:0;z-index:1;display:flex;justify-content:space-between;gap:12px;align-items:center;padding:9px 12px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-bg,#1e1e1e)}.omni-auto__panel-title{margin:0;font-size:15px}.omni-auto__table-wrap{overflow:auto}.omni-auto table{width:100%;border-collapse:collapse}.omni-auto th,.omni-auto td{padding:7px 9px;border-bottom:1px solid var(--omni-border,#444);text-align:left;vertical-align:top;white-space:nowrap}.omni-auto th{position:sticky;top:42px;background:var(--omni-panel-bg,#252526)}.omni-auto td{max-width:520px;overflow:hidden;text-overflow:ellipsis}.omni-auto tr:hover td{background:var(--omni-hover-bg,#2a2d2e)}.omni-auto__raw{box-sizing:border-box;margin:0;padding:14px;white-space:pre-wrap;font:12px/1.5 var(--omni-font-mono,ui-monospace,monospace)}.omni-auto__empty{padding:24px;color:var(--omni-fg-muted,#999)}@media(max-width:720px){.omni-auto__header,.omni-auto__toolbar{align-items:stretch;flex-direction:column}.omni-auto input{width:100%}}";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const automotiveViewerCss = `:host,.omni-viewer--automotive{display:block;height:100%;color:var(--omni-fg,#ddd);background:var(--omni-bg,#1e1e1e);font:13px var(--omni-font,system-ui)}.omni-auto{height:100%;display:flex;flex-direction:column;min-width:0}.omni-auto__header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding:16px 18px 12px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-panel-bg,#252526)}.omni-auto__eyebrow,.omni-auto__subtitle,.omni-auto__caption{color:var(--omni-fg-muted,#999);font-size:12px}.omni-auto__title{display:block;margin:2px 0 4px;font-size:20px}.omni-auto__summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));border-bottom:1px solid var(--omni-border,#444);background:var(--omni-border,#444);gap:1px}.omni-auto__summary-item{padding:11px 14px;background:var(--omni-bg,#1e1e1e);min-width:0}.omni-auto__summary-value{font-size:18px;font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.omni-auto__summary-label{margin-top:4px;color:var(--omni-fg-muted,#999);font-size:12px}.omni-auto__toolbar{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-panel-bg,#252526)}.omni-auto input,.omni-auto button{box-sizing:border-box;border:1px solid var(--omni-border,#555);border-radius:4px;background:var(--omni-button-bg,#333);color:inherit;font:inherit;padding:6px 9px}.omni-auto input{width:min(300px,35vw);min-width:170px;background:var(--omni-input-bg,#171717)}.omni-auto button{cursor:pointer}.omni-auto button[aria-pressed=true]{background:var(--omni-accent,#0e639c);color:var(--omni-accent-fg,#fff)}.omni-auto button:disabled{opacity:.5;cursor:default}.omni-auto__tabs{display:flex;flex:1;flex-wrap:wrap;gap:4px}.omni-auto__warnings{padding:9px 13px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-warning-bg,#4d3b12);color:var(--omni-warning-fg,#f5d88a)}.omni-auto__content{flex:1;min-height:0;overflow:auto}.omni-auto__panel-header{position:sticky;top:0;z-index:1;display:flex;justify-content:space-between;gap:12px;align-items:center;padding:9px 12px;border-bottom:1px solid var(--omni-border,#444);background:var(--omni-bg,#1e1e1e)}.omni-auto__panel-title{margin:0;font-size:15px}.omni-auto__table-wrap{overflow:auto}.omni-auto table{width:100%;border-collapse:collapse}.omni-auto th,.omni-auto td{padding:7px 9px;border-bottom:1px solid var(--omni-border,#444);text-align:left;vertical-align:top;white-space:nowrap}.omni-auto th{position:sticky;top:42px;background:var(--omni-panel-bg,#252526)}.omni-auto td{max-width:520px;overflow:hidden;text-overflow:ellipsis}.omni-auto tr:hover td{background:var(--omni-hover-bg,#2a2d2e)}.omni-auto__raw{box-sizing:border-box;margin:0;padding:14px;white-space:pre-wrap;font:12px/1.5 var(--omni-font-mono,ui-monospace,monospace)}.omni-auto__empty{padding:24px;color:var(--omni-fg-muted,#999)}@media(max-width:720px){.omni-auto__header,.omni-auto__toolbar{align-items:stretch;flex-direction:column}.omni-auto input{width:100%}}`;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AutomotiveViewerContext } from '../automotive/index.js';
|
|
2
|
+
import type { MountOptions, ViewerHandle, ViewerInput } from '../types.js';
|
|
3
|
+
export { parseAvro } from '../../parsers/automotive/index.js';
|
|
4
|
+
export { automotiveViewerCss as avroViewerCss } from '../automotive/styles.js';
|
|
5
|
+
export type AvroViewerContext = AutomotiveViewerContext;
|
|
6
|
+
export declare const AVRO_VIEWER_META: {
|
|
7
|
+
id: string;
|
|
8
|
+
displayNameKey: string;
|
|
9
|
+
extensions: string[];
|
|
10
|
+
priority: number;
|
|
11
|
+
requiredServices: readonly [];
|
|
12
|
+
optionalServices: readonly ["clipboard"];
|
|
13
|
+
inputOwnership: "borrows";
|
|
14
|
+
};
|
|
15
|
+
export declare const mountAvroViewer: (input: ViewerInput, container: HTMLElement, ctx: AvroViewerContext, options?: MountOptions) => Promise<ViewerHandle>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mountAutomotiveViewer } from '../automotive/index.js';
|
|
2
|
+
export { parseAvro } from '../../parsers/automotive/index.js';
|
|
3
|
+
export { automotiveViewerCss as avroViewerCss } from '../automotive/styles.js';
|
|
4
|
+
export const AVRO_VIEWER_META = { id: 'avro', displayNameKey: 'avro.title', extensions: ['avro'], priority: 20, requiredServices: [], optionalServices: ['clipboard'], inputOwnership: 'borrows' };
|
|
5
|
+
export const mountAvroViewer = (input, container, ctx, options = {}) => mountAutomotiveViewer('avro', input, container, ctx, options);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AutomotiveViewerContext } from '../automotive/index.js';
|
|
2
|
+
import type { MountOptions, ViewerHandle, ViewerInput } from '../types.js';
|
|
3
|
+
export { parseBag } from '../../parsers/automotive/index.js';
|
|
4
|
+
export { automotiveViewerCss as bagViewerCss } from '../automotive/styles.js';
|
|
5
|
+
export type BagViewerContext = AutomotiveViewerContext;
|
|
6
|
+
export declare const BAG_VIEWER_META: {
|
|
7
|
+
id: string;
|
|
8
|
+
displayNameKey: string;
|
|
9
|
+
extensions: string[];
|
|
10
|
+
priority: number;
|
|
11
|
+
requiredServices: readonly [];
|
|
12
|
+
optionalServices: readonly ["clipboard"];
|
|
13
|
+
inputOwnership: "borrows";
|
|
14
|
+
};
|
|
15
|
+
export declare const mountBagViewer: (input: ViewerInput, container: HTMLElement, ctx: BagViewerContext, options?: MountOptions) => Promise<ViewerHandle>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mountAutomotiveViewer } from '../automotive/index.js';
|
|
2
|
+
export { parseBag } from '../../parsers/automotive/index.js';
|
|
3
|
+
export { automotiveViewerCss as bagViewerCss } from '../automotive/styles.js';
|
|
4
|
+
export const BAG_VIEWER_META = { id: 'bag', displayNameKey: 'bag.title', extensions: ['bag'], priority: 20, requiredServices: [], optionalServices: ['clipboard'], inputOwnership: 'borrows' };
|
|
5
|
+
export const mountBagViewer = (input, container, ctx, options = {}) => mountAutomotiveViewer('bag', input, container, ctx, options);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AutomotiveViewerContext } from '../automotive/index.js';
|
|
2
|
+
import type { MountOptions, ViewerHandle, ViewerInput } from '../types.js';
|
|
3
|
+
export { parseBlf } from '../../parsers/blf/index.js';
|
|
4
|
+
export { automotiveViewerCss as blfViewerCss } from '../automotive/styles.js';
|
|
5
|
+
export type BlfViewerContext = AutomotiveViewerContext;
|
|
6
|
+
export declare const BLF_VIEWER_META: {
|
|
7
|
+
id: string;
|
|
8
|
+
displayNameKey: string;
|
|
9
|
+
extensions: string[];
|
|
10
|
+
priority: number;
|
|
11
|
+
requiredServices: readonly [];
|
|
12
|
+
optionalServices: readonly ["clipboard"];
|
|
13
|
+
inputOwnership: "borrows";
|
|
14
|
+
};
|
|
15
|
+
export declare const mountBlfViewer: (input: ViewerInput, container: HTMLElement, ctx: BlfViewerContext, options?: MountOptions) => Promise<ViewerHandle>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { mountAutomotiveViewer } from '../automotive/index.js';
|
|
2
|
+
export { parseBlf } from '../../parsers/blf/index.js';
|
|
3
|
+
export { automotiveViewerCss as blfViewerCss } from '../automotive/styles.js';
|
|
4
|
+
export const BLF_VIEWER_META = { id: 'blf', displayNameKey: 'blf.title', extensions: ['blf'], priority: 20, requiredServices: [], optionalServices: ['clipboard'], inputOwnership: 'borrows' };
|
|
5
|
+
export const mountBlfViewer = (input, container, ctx, options = {}) => mountAutomotiveViewer('blf', input, container, ctx, options);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Diagnostic, ParseFailure } from '../../parsers/types.js';
|
|
2
|
+
import { type ColumnStats, type ColumnType, type CsvDelimiter, type CsvParseOptions, type SortState } from '../../parsers/csv/index.js';
|
|
3
|
+
export declare const DEFAULT_PAGE_SIZE = 500;
|
|
4
|
+
export declare const UNDO_STACK_LIMIT = 200;
|
|
5
|
+
export type RowId = number;
|
|
6
|
+
/** Avoid a full-table scan for each very broad single-character query. */
|
|
7
|
+
export declare const CSV_MIN_SEARCH_LENGTH = 2;
|
|
8
|
+
export interface CsvViewState {
|
|
9
|
+
/** Parse status of the current document ('failed' keeps the last good doc absent). */
|
|
10
|
+
status: 'ok' | 'partial' | 'failed';
|
|
11
|
+
/** Failure detail when status is 'failed' — the renderer must surface it. */
|
|
12
|
+
failure: ParseFailure | null;
|
|
13
|
+
diagnostics: Diagnostic[];
|
|
14
|
+
headers: string[];
|
|
15
|
+
columnCount: number;
|
|
16
|
+
rowCount: number;
|
|
17
|
+
delimiter: CsvDelimiter;
|
|
18
|
+
detectionSource: 'auto' | 'extension' | 'override';
|
|
19
|
+
sort: SortState;
|
|
20
|
+
sortedColumnType: ColumnType | null;
|
|
21
|
+
/** Entered search text; queries shorter than CSV_MIN_SEARCH_LENGTH are inactive. */
|
|
22
|
+
search: string;
|
|
23
|
+
/** Rows matching the active search (== rowCount when search is inactive). */
|
|
24
|
+
matchedRowCount: number;
|
|
25
|
+
showRowNumbers: boolean;
|
|
26
|
+
/** Unsaved edits exist (undo back to the save point clears this). */
|
|
27
|
+
dirty: boolean;
|
|
28
|
+
canUndo: boolean;
|
|
29
|
+
canRedo: boolean;
|
|
30
|
+
page: number;
|
|
31
|
+
pageCount: number;
|
|
32
|
+
pageSize: number;
|
|
33
|
+
viewMode: 'table' | 'raw';
|
|
34
|
+
statsVisible: boolean;
|
|
35
|
+
/** RowIds visible on the current page, in display order
|
|
36
|
+
* (sorted, then search-filtered, then paged). */
|
|
37
|
+
visibleRowIds: RowId[];
|
|
38
|
+
}
|
|
39
|
+
export type CsvAction = {
|
|
40
|
+
type: 'sort-column';
|
|
41
|
+
columnIndex: number;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'set-delimiter';
|
|
44
|
+
delimiter: CsvDelimiter | 'auto';
|
|
45
|
+
} | {
|
|
46
|
+
type: 'set-search';
|
|
47
|
+
search: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'set-page';
|
|
50
|
+
page: number;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'next-page';
|
|
53
|
+
} | {
|
|
54
|
+
type: 'prev-page';
|
|
55
|
+
} | {
|
|
56
|
+
type: 'set-page-size';
|
|
57
|
+
pageSize: number;
|
|
58
|
+
} | {
|
|
59
|
+
type: 'toggle-row-numbers';
|
|
60
|
+
} | {
|
|
61
|
+
type: 'set-view-mode';
|
|
62
|
+
mode: 'table' | 'raw';
|
|
63
|
+
} | {
|
|
64
|
+
type: 'toggle-stats';
|
|
65
|
+
} | {
|
|
66
|
+
type: 'edit-cell';
|
|
67
|
+
rowId: RowId;
|
|
68
|
+
columnIndex: number;
|
|
69
|
+
value: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: 'edit-header';
|
|
72
|
+
columnIndex: number;
|
|
73
|
+
value: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: 'insert-row';
|
|
76
|
+
afterRowId: RowId | 'end';
|
|
77
|
+
} | {
|
|
78
|
+
type: 'delete-row';
|
|
79
|
+
rowId: RowId;
|
|
80
|
+
} | {
|
|
81
|
+
type: 'insert-column';
|
|
82
|
+
columnIndex: number;
|
|
83
|
+
} | {
|
|
84
|
+
type: 'delete-column';
|
|
85
|
+
columnIndex: number;
|
|
86
|
+
} | {
|
|
87
|
+
type: 'replace-document';
|
|
88
|
+
text: string;
|
|
89
|
+
} | {
|
|
90
|
+
type: 'undo';
|
|
91
|
+
} | {
|
|
92
|
+
type: 'redo';
|
|
93
|
+
};
|
|
94
|
+
export interface CsvControllerOptions {
|
|
95
|
+
fileName?: string;
|
|
96
|
+
pageSize?: number;
|
|
97
|
+
limits?: CsvParseOptions['limits'];
|
|
98
|
+
}
|
|
99
|
+
export interface CsvController {
|
|
100
|
+
readonly state: CsvViewState;
|
|
101
|
+
dispatch(action: CsvAction): void;
|
|
102
|
+
subscribe(listener: (state: CsvViewState) => void): () => void;
|
|
103
|
+
/** Cells of a row by its immutable id (padded to columnCount by the parser). */
|
|
104
|
+
getRowById(rowId: RowId): readonly string[];
|
|
105
|
+
/** 1-based position of the row in the current document order. */
|
|
106
|
+
getRowNumber(rowId: RowId): number;
|
|
107
|
+
/** Column statistics for the current document (computed lazily, cached). */
|
|
108
|
+
getStatistics(): ColumnStats[];
|
|
109
|
+
/** Display result (sorted + filtered) as TSV, headers included. */
|
|
110
|
+
toTsv(): string;
|
|
111
|
+
/** Display result as the csv-export@1 JSON envelope. */
|
|
112
|
+
toJson(): string;
|
|
113
|
+
/** Display result as normalized CSV with the active delimiter (file export). */
|
|
114
|
+
toCsv(): string;
|
|
115
|
+
/** Whole document in original order as normalized CSV (save/writeback —
|
|
116
|
+
* ignores search and sort so hidden rows are never dropped). */
|
|
117
|
+
toDocumentCsv(): string;
|
|
118
|
+
/** Mark the current edit depth as the saved point (clears dirty). */
|
|
119
|
+
markSaved(): void;
|
|
120
|
+
/** Decoded source text (raw view). */
|
|
121
|
+
readonly rawText: string;
|
|
122
|
+
/** Raw-view text: the verbatim source while the document is unedited,
|
|
123
|
+
* the normalized document serialization once edits exist. */
|
|
124
|
+
toRawText(): string;
|
|
125
|
+
}
|
|
126
|
+
export declare function createCsvController(source: string | Uint8Array, options?: CsvControllerOptions): CsvController;
|