@deepseek-ai/libreoffice-kit 0.2.0-alpha7 → 0.2.2

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.
Files changed (49) hide show
  1. package/NOTICE +1 -1
  2. package/README.md +7 -7
  3. package/README.zh.md +7 -7
  4. package/frame-forwarding/CMakeLists.txt +3 -4
  5. package/frame-forwarding/README.md +18 -18
  6. package/frame-forwarding/README.zh.md +19 -19
  7. package/frame-forwarding/include/dsh_frame_forwarding.h +33 -9
  8. package/frame-forwarding/index.d.ts +58 -54
  9. package/frame-forwarding/index.mjs +14 -17
  10. package/frame-forwarding/prebuilds/darwin-arm64/frame-forwarding.node +0 -0
  11. package/frame-forwarding/prebuilds/darwin-arm64/libdsh_frame_forwarding_sdk.a +0 -0
  12. package/frame-forwarding/prebuilds/darwin-arm64/manifest.json +22 -21
  13. package/frame-forwarding/prebuilds/darwin-x64/frame-forwarding.node +0 -0
  14. package/frame-forwarding/prebuilds/darwin-x64/libdsh_frame_forwarding_sdk.a +0 -0
  15. package/frame-forwarding/prebuilds/darwin-x64/manifest.json +22 -21
  16. package/frame-forwarding/prebuilds/win32-arm64/dsh_frame_forwarding_sdk.lib +0 -0
  17. package/frame-forwarding/prebuilds/win32-arm64/frame-forwarding.node +0 -0
  18. package/frame-forwarding/prebuilds/win32-arm64/manifest.json +22 -21
  19. package/frame-forwarding/prebuilds/win32-x64/dsh_frame_forwarding_sdk.lib +0 -0
  20. package/frame-forwarding/prebuilds/win32-x64/frame-forwarding.node +0 -0
  21. package/frame-forwarding/prebuilds/win32-x64/manifest.json +22 -21
  22. package/frame-forwarding/receipt.json +15 -14
  23. package/frame-forwarding/scripts/build-webgpu.mjs +1 -0
  24. package/frame-forwarding/scripts/build.mjs +5 -4
  25. package/frame-forwarding/scripts/metadata.mjs +11 -8
  26. package/frame-forwarding/scripts/source-identity.mjs +3 -3
  27. package/frame-forwarding/sdk.json +6 -5
  28. package/frame-forwarding/{include/dsh_webgpu.h → src/graphite-interop-internal.hxx} +22 -22
  29. package/frame-forwarding/src/{webgpu.cc → graphite-interop.cc} +34 -24
  30. package/frame-forwarding/src/node-producer.cc +24 -154
  31. package/frame-forwarding/src/producer.cc +93 -26
  32. package/frame-forwarding/src/receiver.cc +416 -212
  33. package/frame-forwarding/src/relay-transport.inc +38 -10
  34. package/frame-forwarding/src/transport.cc +307 -141
  35. package/frame-forwarding/src/transport.h +60 -9
  36. package/frame-forwarding/verify.d.mts +1 -1
  37. package/frame-forwarding/verify.mjs +19 -17
  38. package/lib/cli.js +79 -8
  39. package/lib/editor.js +16 -11
  40. package/lib/index.js +79 -8
  41. package/lib/types/editor.d.ts +17 -4
  42. package/lib/types/engine.d.ts +1 -1
  43. package/lib/types/fonts.d.ts +1 -1
  44. package/lib/types/index.d.ts +4 -2
  45. package/lib/types/pdf.d.ts +10 -0
  46. package/lib/worker.js +4 -3
  47. package/package.json +8 -10
  48. package/frame-forwarding/include/dsh_frame_forwarding_engine.h +0 -66
  49. package/frame-forwarding/include/dsh_frame_forwarding_node.h +0 -27
package/lib/worker.js CHANGED
@@ -157,7 +157,7 @@ var SystemFontCatalog = class {
157
157
  }
158
158
  /**
159
159
  * Find installed faces covering the requested family or missing characters.
160
- * Exact families precede configured alternatives, symbol families for missing symbols,
160
+ * Exact families precede configured alternatives, symbol families for requests without letters or numbers,
161
161
  * generic families, then other glyph-covering faces.
162
162
  * @param request - VCL family/style attributes and Unicode scalars missing from its current font.
163
163
  * @param signal - cancellation checked between synchronous font reads.
@@ -170,7 +170,8 @@ var SystemFontCatalog = class {
170
170
  const primary = requested[0];
171
171
  let missingFamily;
172
172
  if (primary !== void 0 && !GENERIC_FAMILIES.has(normalize(primary)) && !this.faces.some((face) => face.aliases.includes(normalize(primary)))) missingFamily = primary;
173
- const priority = fontFamilyPriority(requested, this.options.fallbackFamilies, request.pitch, request.codePoints.some((point) => /\p{Symbol}/u.test(String.fromCodePoint(point)))).map(normalize);
173
+ const symbols = request.codePoints.some((point) => /\p{Symbol}/u.test(String.fromCodePoint(point))) && !request.codePoints.some((point) => /[\p{Letter}\p{Number}]/u.test(String.fromCodePoint(point)));
174
+ const priority = fontFamilyPriority(requested, this.options.fallbackFamilies, request.pitch, symbols).map(normalize);
174
175
  const missing = new Set(request.codePoints);
175
176
  const ranked = this.faces.map((face) => {
176
177
  const rank = priority.findIndex((family) => face.aliases.includes(family));
@@ -675,7 +676,7 @@ async function withWasmSession(request, use) {
675
676
  mainScriptUrlOrBlob: engine.loader,
676
677
  locateFile(name) {
677
678
  const file = basename(name);
678
- if (file === "soffice.wasm") return engine.wasm;
679
+ if (file === "dsoffice.wasm") return engine.wasm;
679
680
  for (const asset of [
680
681
  engine.loader,
681
682
  engine.data,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deepseek-ai/libreoffice-kit",
3
3
  "description": "Convert, recalculate, and render Office documents with prebuilt LibreOffice",
4
- "version": "0.2.0-alpha7",
4
+ "version": "0.2.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -69,9 +69,7 @@
69
69
  "frame-forwarding/README.md",
70
70
  "frame-forwarding/README.zh.md",
71
71
  "frame-forwarding/include/dsh_frame_forwarding.h",
72
- "frame-forwarding/include/dsh_frame_forwarding_engine.h",
73
- "frame-forwarding/include/dsh_frame_forwarding_node.h",
74
- "frame-forwarding/include/dsh_webgpu.h",
72
+ "frame-forwarding/src/graphite-interop-internal.hxx",
75
73
  "frame-forwarding/src/node-producer.cc",
76
74
  "frame-forwarding/src/producer-internal.h",
77
75
  "frame-forwarding/src/transport.h",
@@ -81,7 +79,7 @@
81
79
  "frame-forwarding/src/receiver.cc",
82
80
  "frame-forwarding/src/win-delay-load.cc",
83
81
  "frame-forwarding/src/win-delay-load.LICENSE",
84
- "frame-forwarding/src/webgpu.cc",
82
+ "frame-forwarding/src/graphite-interop.cc",
85
83
  "frame-forwarding/CMakeLists.txt",
86
84
  "frame-forwarding/sdk.json",
87
85
  "frame-forwarding/scripts/build.mjs",
@@ -126,11 +124,11 @@
126
124
  },
127
125
  "optionalDependencies": {
128
126
  "koffi": "3.1.1",
129
- "@deepseek-ai/libreoffice-kit-darwin-arm64": "0.2.0-alpha7",
130
- "@deepseek-ai/libreoffice-kit-darwin-x64": "0.2.0-alpha7",
131
- "@deepseek-ai/libreoffice-kit-wasm": "0.2.0-alpha5",
132
- "@deepseek-ai/libreoffice-kit-win32-arm64": "0.1.5",
133
- "@deepseek-ai/libreoffice-kit-win32-x64": "0.2.0-alpha7"
127
+ "@deepseek-ai/libreoffice-kit-darwin-arm64": "0.2.2",
128
+ "@deepseek-ai/libreoffice-kit-darwin-x64": "0.2.2",
129
+ "@deepseek-ai/libreoffice-kit-win32-arm64": "0.2.2",
130
+ "@deepseek-ai/libreoffice-kit-wasm": "0.2.2",
131
+ "@deepseek-ai/libreoffice-kit-win32-x64": "0.2.2"
134
132
  },
135
133
  "bin": {
136
134
  "dsoffice": "./lib/cli.js"
@@ -1,66 +0,0 @@
1
- #ifndef DSH_FRAME_FORWARDING_ENGINE_H
2
- #define DSH_FRAME_FORWARDING_ENGINE_H
3
- #include <stddef.h>
4
- #include <stdint.h>
5
- #ifdef __cplusplus
6
- extern "C" {
7
- #endif
8
- /** A borrowed GPU target valid only during render(). Native objects never enter JS. */
9
- typedef struct dsh_frame_forwarding_target {
10
- void* texture; /* IOSurfaceRef on macOS; ID3D11Texture2D* on Windows. */
11
- void* shared_handle; /* Borrowed Windows NT handle; NULL on macOS. */
12
- void* device; /* Borrowed ID3D11Device*; NULL on macOS. */
13
- uint32_t width, height;
14
- uint64_t frame_id, input_sequence;
15
- double time_seconds; /* Monotonic time since this producer was created. */
16
- void* cancellation_context;
17
- int (*cancelled)(void*); /* Close or operation deadline; callable from this worker. */
18
- } dsh_frame_forwarding_target;
19
- /** Native engine adapter ABI v1. The factory and its configuration outlive the
20
- * producer. Every callback runs serially on that producer's native worker.
21
- * create/destroy own one engine instance; device returns its borrowed D3D11
22
- * device (or NULL for default/macOS). update receives bounded application JSON.
23
- * On Windows the SDK owns key 0 around render: queue commands on target.device's
24
- * immediate context without acquiring the mutex again. Release imported views
25
- * before returning 1; no completion wait is required. On macOS GPU writes must
26
- * be complete on return. External devices/import APIs that acquire their own lock
27
- * use the C surface API instead of this callback. Return 0 with diagnostic text on failure; the producer closes
28
- * instead of reusing a target whose completion is uncertain. Long-running work
29
- * must observe target.cancelled. No callback may throw across this C ABI.
30
- */
31
- typedef struct dsh_frame_forwarding_engine_v1 {
32
- uint32_t version, size;
33
- void* configuration;
34
- void* (*create)(void* configuration, char* error, size_t error_size);
35
- void (*destroy)(void* engine);
36
- void* (*device)(void* engine);
37
- int (*update)(void* engine, const char* json, char* error, size_t error_size);
38
- int (*render)(void* engine, const dsh_frame_forwarding_target* target, char* error, size_t error_size);
39
- } dsh_frame_forwarding_engine_v1;
40
- /** Surface-free frame information borrowed during prepare(). */
41
- typedef struct dsh_frame_forwarding_frame_info {
42
- uint32_t width, height;
43
- uint64_t input_sequence;
44
- double time_seconds;
45
- void* cancellation_context;
46
- int (*cancelled)(void*);
47
- } dsh_frame_forwarding_frame_info;
48
- /** Engine ABI v2: base.version is 2 and base.size is sizeof(dsh_frame_forwarding_engine_v2).
49
- * The v1 callbacks and ownership rules are unchanged. prepare runs on the same
50
- * worker before acquiring a surface: 1 declares a changed frame, 0 declares no
51
- * change, and -1 reports failure with diagnostic text. It must honor cancelled
52
- * and must not acquire or access a transport surface. A declared change remains
53
- * pending across credit waits; update may replace that pending application state
54
- * before render. prepare continues at the stream cadence while credit is held.
55
- * A successful render consumes the prepared state. Starting or
56
- * resizing a stream forces one render even when prepare reports no change.
57
- * Manual surface.render() invokes base.render directly, without prepare.
58
- */
59
- typedef struct dsh_frame_forwarding_engine_v2 {
60
- dsh_frame_forwarding_engine_v1 base;
61
- int (*prepare)(void* engine, const dsh_frame_forwarding_frame_info* frame, char* error, size_t error_size);
62
- } dsh_frame_forwarding_engine_v2;
63
- #ifdef __cplusplus
64
- }
65
- #endif
66
- #endif
@@ -1,27 +0,0 @@
1
- #ifndef DSH_FRAME_FORWARDING_NODE_H
2
- #define DSH_FRAME_FORWARDING_NODE_H
3
- #include <node_api.h>
4
- #include "dsh_frame_forwarding_engine.h"
5
- /** Shared type tag for engine objects produced by cooperating native addons. */
6
- static const napi_type_tag dsh_frame_forwarding_engine_tag = {0xe1910c31bb654d4aULL, 0x9c30d42b2c88ee15ULL};
7
- /** Export a native engine factory as an opaque JS object. The descriptor and its
8
- * configuration must remain alive until finalize runs. The producer retains the
9
- * object through native teardown. The addon supplying callbacks must remain
10
- * loaded for the object's lifetime. No graphics work runs in this helper.
11
- */
12
- static inline napi_status dsh_frame_forwarding_export_engine(napi_env env, dsh_frame_forwarding_engine_v1* factory,
13
- napi_finalize finalize, void* hint, napi_value* result) {
14
- napi_status status = napi_create_object(env, result);
15
- if (status == napi_ok) status = napi_wrap(env, *result, factory, finalize, hint, NULL);
16
- if (status == napi_ok) {
17
- status = napi_type_tag_object(env, *result, &dsh_frame_forwarding_engine_tag);
18
- if (status != napi_ok) { void* removed = NULL; napi_remove_wrap(env, *result, &removed); }
19
- }
20
- return status;
21
- }
22
- /** Export v2 with the same descriptor, configuration, and addon lifetime as v1. */
23
- static inline napi_status dsh_frame_forwarding_export_engine_v2(napi_env env, dsh_frame_forwarding_engine_v2* factory,
24
- napi_finalize finalize, void* hint, napi_value* result) {
25
- return dsh_frame_forwarding_export_engine(env, &factory->base, finalize, hint, result);
26
- }
27
- #endif