@repa/document-viewer 0.0.0-stage → 0.1.0-alpha.21

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/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "@repa/document-viewer",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-alpha.21",
4
+ "description": "Read-only DSDX document rendering, semantic selection, and structure geometry for browsers.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/devcited-labs/repa.git"
9
+ },
10
+ "type": "module",
11
+ "sideEffects": false,
12
+ "repaRelease": {
13
+ "train": "document-viewer",
14
+ "coordinatedVersion": "0.1.0-alpha.21",
15
+ "channel": "alpha",
16
+ "licenseStatus": "evaluation-only"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "wasm",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
+ },
30
+ "./react": {
31
+ "types": "./dist/react.d.ts",
32
+ "import": "./dist/react.js",
33
+ "default": "./dist/react.js"
34
+ },
35
+ "./package.json": "./package.json",
36
+ "./build-info.json": "./wasm/build-info.json"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "peerDependencies": {
42
+ "react": ">=18.3.0 <20.0.0"
43
+ },
44
+ "peerDependenciesMeta": {
45
+ "react": {
46
+ "optional": true
47
+ }
48
+ },
49
+ "devDependencies": {
50
+ "@types/node": "24.6.0",
51
+ "@types/react": "^19.2.18",
52
+ "react": "19.2.8",
53
+ "tsup": "^8.5.1",
54
+ "typescript": "5.9.3",
55
+ "vitest": "4.1.11",
56
+ "@repa/document-surface": "0.0.0"
57
+ },
58
+ "scripts": {
59
+ "build": "tsup && node scripts/ensure-client-directive.mjs",
60
+ "typecheck": "tsc --noEmit -p tsconfig.json",
61
+ "test": "pnpm run build && vitest run"
62
+ }
6
63
  }
@@ -0,0 +1,123 @@
1
+ {
2
+ "buildContract": {
3
+ "artifactStem": "document_viewer_wasm",
4
+ "profile": "release",
5
+ "target": "wasm32-unknown-unknown",
6
+ "wasmOptFlags": [
7
+ "-Oz",
8
+ "--enable-simd",
9
+ "--enable-bulk-memory",
10
+ "--enable-nontrapping-float-to-int",
11
+ "--enable-sign-ext"
12
+ ]
13
+ },
14
+ "buildId": "7762f0a7ab4443f2",
15
+ "fontReaderCapabilities": {
16
+ "engineParserCompat": "font-core.v1",
17
+ "fontClosureSchemaVersion": "1.2.0",
18
+ "operations": [
19
+ "render"
20
+ ],
21
+ "resolverPolicyVersion": 1,
22
+ "schemaVersion": "devcited.font-reader-capabilities.v1",
23
+ "shapingContractVersion": 1,
24
+ "supportedFeatures": [
25
+ {
26
+ "id": "devcited.script-font-substitution",
27
+ "operations": [
28
+ "render"
29
+ ],
30
+ "version": "1.0.0"
31
+ },
32
+ {
33
+ "id": "devcited.document-font-decisions",
34
+ "operations": [
35
+ "render"
36
+ ],
37
+ "version": "1.0.0"
38
+ }
39
+ ]
40
+ },
41
+ "harfbuzzSource": {
42
+ "archiveSha256": "16070d77cfc4ba1f1e7327e83bf9b3f55898081cabdb94e56a33e04fc8874eae",
43
+ "shapingProfile": "devcited-hb14-host-independent-shaping-script-itemizer-semantic-position-precision-v7",
44
+ "source": "https://github.com/harfbuzz/harfbuzz/releases/download/14.3.0/harfbuzz-14.3.0.tar.xz",
45
+ "treeSha256": "c8db563e9ce9627e1e11351539bd307f0aabb51b2e84f621ad649936e44d1a94",
46
+ "version": "14.3.0"
47
+ },
48
+ "outputs": {
49
+ "document_viewer_wasm.d.ts": {
50
+ "byteLength": 7988,
51
+ "sha256": "a46f6c593c774e1a861caff52cb662f7b33873c5091d8d377fedce90f18c5387"
52
+ },
53
+ "document_viewer_wasm.js": {
54
+ "byteLength": 47456,
55
+ "sha256": "7fb509525edae4403e158fd2317bc731687b39ce80c5193838c3a00efb2132f7"
56
+ },
57
+ "document_viewer_wasm_bg.wasm": {
58
+ "byteLength": 12481020,
59
+ "sha256": "36c0bbe511acedc035ad637602b3bb3cd5587986f23f2f51b1740342b5f81653"
60
+ }
61
+ },
62
+ "schemaVersion": 2,
63
+ "sourceFileCount": 1146,
64
+ "sourceHash": "beccb98399819727f95df447376b203f239d45e894befa6b7bba2a3454f4aeee",
65
+ "toolchains": {
66
+ "binaryenWasmOpt": {
67
+ "executableSha256": "945bd42c417fadcd7a522919cfee341317c16de7cc47cef8add1e6d7f7f88eea",
68
+ "tool": "wasm-opt",
69
+ "version": "wasm-opt version 108"
70
+ },
71
+ "cargo": {
72
+ "executableSha256": "da77c8b33849312255ccde3179198ada4c8deb370488d050286146b1d1b27e14",
73
+ "tool": "cargo",
74
+ "version": "cargo 1.98.1 (797e8a9bc 2026-08-05)\nrelease: 1.98.1\ncommit-hash: 797e8a9bca276c1c9f9f738d2a20f484fa4eea9d\ncommit-date: 2026-08-05\nhost: x86_64-unknown-linux-gnu\nlibgit2: 1.9.4 (sys:0.21.0 vendored)\nlibcurl: 8.21.0-DEV (sys:0.4.90+curl-8.21.0 vendored ssl:OpenSSL/3.6.3)\nssl: OpenSSL 3.6.3 9 Jun 2026\nos: Ubuntu 24.4.0 (noble) [64-bit]"
75
+ },
76
+ "rustc": {
77
+ "executableSha256": "859254978c0a0402c32f949f6de0d99aee73be8d15f45aac00ae1448aac51e74",
78
+ "tool": "rustc",
79
+ "version": "rustc 1.98.1 (48a229cea 2026-09-01)\nbinary: rustc\ncommit-hash: 48a229ceaefd4985c50990b14116b6d856af0985\ncommit-date: 2026-09-01\nhost: x86_64-unknown-linux-gnu\nrelease: 1.98.1\nLLVM version: 22.1.8"
80
+ },
81
+ "wasiSdk": {
82
+ "clang": {
83
+ "executableSha256": "6985ec66b1065976616156773f95ed318b1793f7761fe9e9f38f8e771571021c",
84
+ "tool": "clang",
85
+ "version": "clang version 22.1.0-wasi-sdk (https://github.com/llvm/llvm-project 4434dabb69916856b824f68a64b029c67175e532)\nTarget: wasm32-unknown-wasip1\nThread model: posix"
86
+ },
87
+ "clangxx": {
88
+ "executableSha256": "6985ec66b1065976616156773f95ed318b1793f7761fe9e9f38f8e771571021c",
89
+ "tool": "clang++",
90
+ "version": "clang version 22.1.0-wasi-sdk (https://github.com/llvm/llvm-project 4434dabb69916856b824f68a64b029c67175e532)\nTarget: wasm32-unknown-wasip1\nThread model: posix"
91
+ },
92
+ "llvmAr": {
93
+ "executableSha256": "0b52c0242b9c3998dd106ce11bcff8ac33b134dd0d05aa9215692ecd7feb1da9",
94
+ "tool": "llvm-ar",
95
+ "version": "LLVM (http://llvm.org/):\n LLVM version 22.1.0-wasi-sdk\n Optimized build."
96
+ },
97
+ "sysroot": {
98
+ "archives": {
99
+ "libc++.a": {
100
+ "byteLength": 8132070,
101
+ "sha256": "b68666d885ebd77da15e328f8589e64dc878e8174ee9866dac83cb1c7426f171"
102
+ },
103
+ "libc++abi.a": {
104
+ "byteLength": 1389252,
105
+ "sha256": "36d345420c096fa76fa3d58c560057a2c1236f0a766cf7c5db89c549384905dc"
106
+ }
107
+ },
108
+ "headers": {
109
+ "byteLength": 64584177,
110
+ "fileCount": 9427,
111
+ "sha256": "a1570cc24a7189002493355157fed9ed89668080b17584e02290dfec43c22f6c"
112
+ }
113
+ },
114
+ "tool": "wasi-sdk",
115
+ "version": "32.0\nwasi-libc: 2fc32bc81b9f\nllvm: 4434dabb6991\nllvm-version: 22.1.0\nconfig: f992bcc08219"
116
+ },
117
+ "wasmBindgen": {
118
+ "executableSha256": "f0bce622baeb9253b729365a6f1764a8c684cbda08358e450336fce738dd757b",
119
+ "tool": "wasm-bindgen",
120
+ "version": "wasm-bindgen 0.2.114"
121
+ }
122
+ }
123
+ }
@@ -0,0 +1,160 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * The generated viewer-only WASM boundary. Public JavaScript consumers use the
6
+ * typed package wrapper rather than receiving this class directly.
7
+ */
8
+ export class DocumentViewerEngine {
9
+ free(): void;
10
+ [Symbol.dispose](): void;
11
+ /**
12
+ * Paint the exact canonical page into a supplied canvas. CSS sizing stays
13
+ * host-owned; this method controls only the backing bitmap and raster.
14
+ */
15
+ attach_page_canvas(page_index: number, canvas: HTMLCanvasElement, css_scale: number, device_pixel_ratio: number): void;
16
+ /**
17
+ * Begin the existing canonical click gesture contract: one click places a
18
+ * caret, two select a word, and three or more select a paragraph.
19
+ */
20
+ begin_pointer_gesture(page_index: number, x_pt: number, y_pt: number, click_count: number): string;
21
+ /**
22
+ * Begin a pointer-driven canonical selection at one page-space point.
23
+ */
24
+ begin_pointer_selection(page_index: number, x_pt: number, y_pt: number): string;
25
+ clear_selection(): void;
26
+ /**
27
+ * Release all canonical document, layout, and font bytes immediately.
28
+ */
29
+ dispose(): void;
30
+ /**
31
+ * Extend the active pointer selection to another page-space point. The
32
+ * original anchor remains authoritative across runs, lines, paragraphs,
33
+ * tables, and page boundaries accepted by the canonical topology.
34
+ */
35
+ extend_pointer_selection(page_index: number, x_pt: number, y_pt: number): string;
36
+ /**
37
+ * Combined semantic pointer target for browser hover and cursor policy.
38
+ * Browser pointer metadata remains outside WASM; this result owns only
39
+ * immutable document meaning at the supplied page-space point.
40
+ */
41
+ hit_test_pointer_target(page_index: number, x_pt: number, y_pt: number): string;
42
+ /**
43
+ * Semantic structures under one page-space point. Hosts can use the
44
+ * returned canonical ids to drive application-specific hover actions.
45
+ */
46
+ hit_test_structures(page_index: number, x_pt: number, y_pt: number): string;
47
+ load(dsdx_bytes: Uint8Array, font_files: Array<any>): string;
48
+ constructor();
49
+ /**
50
+ * Restore an engine-produced semantic selection. A different package
51
+ * fingerprint fails closed and no existing selection is changed.
52
+ */
53
+ restore_selection(selection_json: string): string;
54
+ /**
55
+ * Select application-supplied canonical ranges. Geometry and visible text
56
+ * are recomputed by the runtime and cannot be injected by the caller.
57
+ */
58
+ select_ranges(target_json: string): string;
59
+ /**
60
+ * Current fingerprint-bound semantic selection and canonical geometry.
61
+ */
62
+ selection(): string;
63
+ /**
64
+ * Every semantic structure intersected by the active canonical selection.
65
+ */
66
+ selection_structures(): string;
67
+ /**
68
+ * Current immutable document identity and canonical page geometry.
69
+ */
70
+ snapshot(): string;
71
+ /**
72
+ * All canonical block, placeholder, table, row, and cell identities with
73
+ * occurrence-aware page-space geometry for this immutable snapshot.
74
+ */
75
+ structure_index(): string;
76
+ }
77
+
78
+ /**
79
+ * Inspect a package before viewer load; saved choices remain accessible when
80
+ * its text cannot yet render. Uses the same native/editor inspection owner.
81
+ */
82
+ export function dsdx_font_inspection_json(dsdx_bytes: Uint8Array): string;
83
+
84
+ /**
85
+ * Return the exact, sorted, content-addressed font files required by the
86
+ * authoritative closure embedded in DSDX bytes.
87
+ */
88
+ export function dsdx_font_requirements_json(dsdx_bytes: Uint8Array): string;
89
+
90
+ /**
91
+ * The public viewer admits rendering only; it does not claim editor support.
92
+ */
93
+ export function engine_font_capabilities_json(): string;
94
+
95
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
96
+
97
+ export interface InitOutput {
98
+ readonly memory: WebAssembly.Memory;
99
+ readonly __wbg_documentviewerengine_free: (a: number, b: number) => void;
100
+ readonly documentviewerengine_attach_page_canvas: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
101
+ readonly documentviewerengine_begin_pointer_gesture: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
102
+ readonly documentviewerengine_begin_pointer_selection: (a: number, b: number, c: number, d: number, e: number) => void;
103
+ readonly documentviewerengine_clear_selection: (a: number) => void;
104
+ readonly documentviewerengine_dispose: (a: number) => void;
105
+ readonly documentviewerengine_extend_pointer_selection: (a: number, b: number, c: number, d: number, e: number) => void;
106
+ readonly documentviewerengine_hit_test_pointer_target: (a: number, b: number, c: number, d: number, e: number) => void;
107
+ readonly documentviewerengine_hit_test_structures: (a: number, b: number, c: number, d: number, e: number) => void;
108
+ readonly documentviewerengine_load: (a: number, b: number, c: number, d: number, e: number) => void;
109
+ readonly documentviewerengine_new: () => number;
110
+ readonly documentviewerengine_restore_selection: (a: number, b: number, c: number, d: number) => void;
111
+ readonly documentviewerengine_select_ranges: (a: number, b: number, c: number, d: number) => void;
112
+ readonly documentviewerengine_selection: (a: number, b: number) => void;
113
+ readonly documentviewerengine_selection_structures: (a: number, b: number) => void;
114
+ readonly documentviewerengine_snapshot: (a: number, b: number) => void;
115
+ readonly documentviewerengine_structure_index: (a: number, b: number) => void;
116
+ readonly dsdx_font_inspection_json: (a: number, b: number, c: number) => void;
117
+ readonly dsdx_font_requirements_json: (a: number, b: number, c: number) => void;
118
+ readonly engine_font_capabilities_json: (a: number) => void;
119
+ readonly calloc: (a: number, b: number) => number;
120
+ readonly free: (a: number) => void;
121
+ readonly malloc: (a: number) => number;
122
+ readonly realloc: (a: number, b: number) => number;
123
+ readonly rust_zstd_wasm_shim_calloc: (a: number, b: number) => number;
124
+ readonly rust_zstd_wasm_shim_free: (a: number) => void;
125
+ readonly rust_zstd_wasm_shim_malloc: (a: number) => number;
126
+ readonly rust_zstd_wasm_shim_memcmp: (a: number, b: number, c: number) => number;
127
+ readonly rust_zstd_wasm_shim_memcpy: (a: number, b: number, c: number) => number;
128
+ readonly rust_zstd_wasm_shim_memmove: (a: number, b: number, c: number) => number;
129
+ readonly rust_zstd_wasm_shim_memset: (a: number, b: number, c: number) => number;
130
+ readonly rust_zstd_wasm_shim_qsort: (a: number, b: number, c: number, d: number) => void;
131
+ readonly __wasm_bindgen_func_elem_4021: (a: number, b: number) => void;
132
+ readonly __wasm_bindgen_func_elem_4024: (a: number, b: number) => void;
133
+ readonly __wbindgen_export: (a: number, b: number) => number;
134
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
135
+ readonly __wbindgen_export3: (a: number) => void;
136
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
137
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
138
+ }
139
+
140
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
141
+
142
+ /**
143
+ * Instantiates the given `module`, which can either be bytes or
144
+ * a precompiled `WebAssembly.Module`.
145
+ *
146
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
147
+ *
148
+ * @returns {InitOutput}
149
+ */
150
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
151
+
152
+ /**
153
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
154
+ * for everything else, calls `WebAssembly.instantiate` directly.
155
+ *
156
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
157
+ *
158
+ * @returns {Promise<InitOutput>}
159
+ */
160
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;