ducjs 3.4.0 → 3.4.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.
- package/dist/ducjs_wasm.d.ts +38 -38
- package/dist/ducjs_wasm.js +93 -93
- package/dist/ducjs_wasm_bg.wasm +0 -0
- package/dist/restore/restoreElements.js +1 -0
- package/dist/types/elements/index.d.ts +36 -0
- package/dist/types/elements/index.js +118 -0
- package/dist/utils/elements/newElement.js +7 -7
- package/package.json +1 -1
package/dist/ducjs_wasm.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Parse a `.duc` file (Uint8Array) into a JS object (ExportedDataState).
|
|
5
|
+
*/
|
|
6
|
+
export function parseDuc(buf: Uint8Array): any;
|
|
7
|
+
/**
|
|
8
|
+
* Restore a specific checkpoint by its ID from a `.duc` file buffer.
|
|
5
9
|
*
|
|
6
|
-
* Returns a JS object
|
|
7
|
-
* or `undefined` if no version graph exists.
|
|
10
|
+
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
8
11
|
*/
|
|
9
|
-
export function
|
|
12
|
+
export function restoreCheckpoint(duc_buf: Uint8Array, checkpoint_id: string): any;
|
|
10
13
|
/**
|
|
11
14
|
* Compute a checkpoint-relative binary diff changeset using bsdiff.
|
|
12
15
|
*
|
|
@@ -18,6 +21,12 @@ export function readVersionGraph(duc_buf: Uint8Array): any;
|
|
|
18
21
|
* offsets, which is critical for SQLite databases.
|
|
19
22
|
*/
|
|
20
23
|
export function createDeltaChangeset(base_state: Uint8Array, current_state: Uint8Array): Uint8Array;
|
|
24
|
+
/**
|
|
25
|
+
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
26
|
+
*
|
|
27
|
+
* Returns the file entry as a JS object, or `undefined` if not found.
|
|
28
|
+
*/
|
|
29
|
+
export function getExternalFile(buf: Uint8Array, file_id: string): any;
|
|
21
30
|
/**
|
|
22
31
|
* Apply a changeset to reconstruct document state.
|
|
23
32
|
*
|
|
@@ -29,44 +38,16 @@ export function createDeltaChangeset(base_state: Uint8Array, current_state: Uint
|
|
|
29
38
|
*/
|
|
30
39
|
export function applyDeltaChangeset(base_state: Uint8Array, changeset: Uint8Array): Uint8Array;
|
|
31
40
|
/**
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export function parseDuc(buf: Uint8Array): any;
|
|
35
|
-
/**
|
|
36
|
-
* Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
|
|
37
|
-
*/
|
|
38
|
-
export function serializeDuc(data: any): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
41
|
-
*
|
|
42
|
-
* Returns the file entry as a JS object, or `undefined` if not found.
|
|
43
|
-
*/
|
|
44
|
-
export function getExternalFile(buf: Uint8Array, file_id: string): any;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the current version-control schema version defined in Rust.
|
|
47
|
-
*
|
|
48
|
-
* TypeScript should use this as the source of truth instead of hardcoding
|
|
49
|
-
* its own constant. When this value is bumped in Rust, the version control
|
|
50
|
-
* system will automatically handle migration bookkeeping (closing old chains,
|
|
51
|
-
* recording migrations) the next time a checkpoint or delta is created.
|
|
52
|
-
*/
|
|
53
|
-
export function getCurrentSchemaVersion(): number;
|
|
54
|
-
/**
|
|
55
|
-
* Revert the document to a specific version, removing all newer versions.
|
|
56
|
-
*
|
|
57
|
-
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
41
|
+
* List metadata for all external files (without loading the heavy data blobs).
|
|
58
42
|
*/
|
|
59
|
-
export function
|
|
43
|
+
export function listExternalFiles(buf: Uint8Array): any;
|
|
60
44
|
/**
|
|
61
|
-
*
|
|
45
|
+
* Read the full VersionGraph from a `.duc` file buffer.
|
|
62
46
|
*
|
|
63
|
-
* Returns a JS object `
|
|
64
|
-
|
|
65
|
-
export function restoreCheckpoint(duc_buf: Uint8Array, checkpoint_id: string): any;
|
|
66
|
-
/**
|
|
67
|
-
* List metadata for all external files (without loading the heavy data blobs).
|
|
47
|
+
* Returns a JS object matching the `VersionGraph` TypeScript interface,
|
|
48
|
+
* or `undefined` if no version graph exists.
|
|
68
49
|
*/
|
|
69
|
-
export function
|
|
50
|
+
export function readVersionGraph(duc_buf: Uint8Array): any;
|
|
70
51
|
/**
|
|
71
52
|
* List all versions (checkpoints + deltas) from a `.duc` file buffer.
|
|
72
53
|
*
|
|
@@ -88,6 +69,25 @@ export function parseDucLazy(buf: Uint8Array): any;
|
|
|
88
69
|
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
89
70
|
*/
|
|
90
71
|
export function restoreVersion(duc_buf: Uint8Array, version_number: number): any;
|
|
72
|
+
/**
|
|
73
|
+
* Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
|
|
74
|
+
*/
|
|
75
|
+
export function serializeDuc(data: any): Uint8Array;
|
|
76
|
+
/**
|
|
77
|
+
* Returns the current version-control schema version defined in Rust.
|
|
78
|
+
*
|
|
79
|
+
* TypeScript should use this as the source of truth instead of hardcoding
|
|
80
|
+
* its own constant. When this value is bumped in Rust, the version control
|
|
81
|
+
* system will automatically handle migration bookkeeping (closing old chains,
|
|
82
|
+
* recording migrations) the next time a checkpoint or delta is created.
|
|
83
|
+
*/
|
|
84
|
+
export function getCurrentSchemaVersion(): number;
|
|
85
|
+
/**
|
|
86
|
+
* Revert the document to a specific version, removing all newer versions.
|
|
87
|
+
*
|
|
88
|
+
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
89
|
+
*/
|
|
90
|
+
export function revertToVersion(duc_buf: Uint8Array, target_version: number): any;
|
|
91
91
|
|
|
92
92
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
93
93
|
|
package/dist/ducjs_wasm.js
CHANGED
|
@@ -195,17 +195,34 @@ function takeFromExternrefTable0(idx) {
|
|
|
195
195
|
return value;
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
198
|
-
*
|
|
198
|
+
* Parse a `.duc` file (Uint8Array) into a JS object (ExportedDataState).
|
|
199
|
+
* @param {Uint8Array} buf
|
|
200
|
+
* @returns {any}
|
|
201
|
+
*/
|
|
202
|
+
export function parseDuc(buf) {
|
|
203
|
+
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
204
|
+
const len0 = WASM_VECTOR_LEN;
|
|
205
|
+
const ret = wasm.parseDuc(ptr0, len0);
|
|
206
|
+
if (ret[2]) {
|
|
207
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
208
|
+
}
|
|
209
|
+
return takeFromExternrefTable0(ret[0]);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Restore a specific checkpoint by its ID from a `.duc` file buffer.
|
|
199
214
|
*
|
|
200
|
-
* Returns a JS object
|
|
201
|
-
* or `undefined` if no version graph exists.
|
|
215
|
+
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
202
216
|
* @param {Uint8Array} duc_buf
|
|
217
|
+
* @param {string} checkpoint_id
|
|
203
218
|
* @returns {any}
|
|
204
219
|
*/
|
|
205
|
-
export function
|
|
220
|
+
export function restoreCheckpoint(duc_buf, checkpoint_id) {
|
|
206
221
|
const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
|
|
207
222
|
const len0 = WASM_VECTOR_LEN;
|
|
208
|
-
const
|
|
223
|
+
const ptr1 = passStringToWasm0(checkpoint_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
224
|
+
const len1 = WASM_VECTOR_LEN;
|
|
225
|
+
const ret = wasm.restoreCheckpoint(ptr0, len0, ptr1, len1);
|
|
209
226
|
if (ret[2]) {
|
|
210
227
|
throw takeFromExternrefTable0(ret[1]);
|
|
211
228
|
}
|
|
@@ -239,6 +256,26 @@ export function createDeltaChangeset(base_state, current_state) {
|
|
|
239
256
|
return v3;
|
|
240
257
|
}
|
|
241
258
|
|
|
259
|
+
/**
|
|
260
|
+
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
261
|
+
*
|
|
262
|
+
* Returns the file entry as a JS object, or `undefined` if not found.
|
|
263
|
+
* @param {Uint8Array} buf
|
|
264
|
+
* @param {string} file_id
|
|
265
|
+
* @returns {any}
|
|
266
|
+
*/
|
|
267
|
+
export function getExternalFile(buf, file_id) {
|
|
268
|
+
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
const ptr1 = passStringToWasm0(file_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
271
|
+
const len1 = WASM_VECTOR_LEN;
|
|
272
|
+
const ret = wasm.getExternalFile(ptr0, len0, ptr1, len1);
|
|
273
|
+
if (ret[2]) {
|
|
274
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
275
|
+
}
|
|
276
|
+
return takeFromExternrefTable0(ret[0]);
|
|
277
|
+
}
|
|
278
|
+
|
|
242
279
|
/**
|
|
243
280
|
* Apply a changeset to reconstruct document state.
|
|
244
281
|
*
|
|
@@ -266,49 +303,14 @@ export function applyDeltaChangeset(base_state, changeset) {
|
|
|
266
303
|
}
|
|
267
304
|
|
|
268
305
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @param {Uint8Array} buf
|
|
271
|
-
* @returns {any}
|
|
272
|
-
*/
|
|
273
|
-
export function parseDuc(buf) {
|
|
274
|
-
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
275
|
-
const len0 = WASM_VECTOR_LEN;
|
|
276
|
-
const ret = wasm.parseDuc(ptr0, len0);
|
|
277
|
-
if (ret[2]) {
|
|
278
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
279
|
-
}
|
|
280
|
-
return takeFromExternrefTable0(ret[0]);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
/**
|
|
284
|
-
* Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
|
|
285
|
-
* @param {any} data
|
|
286
|
-
* @returns {Uint8Array}
|
|
287
|
-
*/
|
|
288
|
-
export function serializeDuc(data) {
|
|
289
|
-
const ret = wasm.serializeDuc(data);
|
|
290
|
-
if (ret[3]) {
|
|
291
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
292
|
-
}
|
|
293
|
-
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
294
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
295
|
-
return v1;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Fetch a single external file from a `.duc` buffer by file ID.
|
|
300
|
-
*
|
|
301
|
-
* Returns the file entry as a JS object, or `undefined` if not found.
|
|
306
|
+
* List metadata for all external files (without loading the heavy data blobs).
|
|
302
307
|
* @param {Uint8Array} buf
|
|
303
|
-
* @param {string} file_id
|
|
304
308
|
* @returns {any}
|
|
305
309
|
*/
|
|
306
|
-
export function
|
|
310
|
+
export function listExternalFiles(buf) {
|
|
307
311
|
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
308
312
|
const len0 = WASM_VECTOR_LEN;
|
|
309
|
-
const
|
|
310
|
-
const len1 = WASM_VECTOR_LEN;
|
|
311
|
-
const ret = wasm.getExternalFile(ptr0, len0, ptr1, len1);
|
|
313
|
+
const ret = wasm.listExternalFiles(ptr0, len0);
|
|
312
314
|
if (ret[2]) {
|
|
313
315
|
throw takeFromExternrefTable0(ret[1]);
|
|
314
316
|
}
|
|
@@ -316,30 +318,17 @@ export function getExternalFile(buf, file_id) {
|
|
|
316
318
|
}
|
|
317
319
|
|
|
318
320
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* TypeScript should use this as the source of truth instead of hardcoding
|
|
322
|
-
* its own constant. When this value is bumped in Rust, the version control
|
|
323
|
-
* system will automatically handle migration bookkeeping (closing old chains,
|
|
324
|
-
* recording migrations) the next time a checkpoint or delta is created.
|
|
325
|
-
* @returns {number}
|
|
326
|
-
*/
|
|
327
|
-
export function getCurrentSchemaVersion() {
|
|
328
|
-
return 3000003;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Revert the document to a specific version, removing all newer versions.
|
|
321
|
+
* Read the full VersionGraph from a `.duc` file buffer.
|
|
333
322
|
*
|
|
334
|
-
* Returns a JS object `
|
|
323
|
+
* Returns a JS object matching the `VersionGraph` TypeScript interface,
|
|
324
|
+
* or `undefined` if no version graph exists.
|
|
335
325
|
* @param {Uint8Array} duc_buf
|
|
336
|
-
* @param {number} target_version
|
|
337
326
|
* @returns {any}
|
|
338
327
|
*/
|
|
339
|
-
export function
|
|
328
|
+
export function readVersionGraph(duc_buf) {
|
|
340
329
|
const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
|
|
341
330
|
const len0 = WASM_VECTOR_LEN;
|
|
342
|
-
const ret = wasm.
|
|
331
|
+
const ret = wasm.readVersionGraph(ptr0, len0);
|
|
343
332
|
if (ret[2]) {
|
|
344
333
|
throw takeFromExternrefTable0(ret[1]);
|
|
345
334
|
}
|
|
@@ -347,19 +336,16 @@ export function revertToVersion(duc_buf, target_version) {
|
|
|
347
336
|
}
|
|
348
337
|
|
|
349
338
|
/**
|
|
350
|
-
*
|
|
339
|
+
* List all versions (checkpoints + deltas) from a `.duc` file buffer.
|
|
351
340
|
*
|
|
352
|
-
* Returns a JS
|
|
341
|
+
* Returns a JS array of `VersionEntry` objects (no heavy data blobs).
|
|
353
342
|
* @param {Uint8Array} duc_buf
|
|
354
|
-
* @param {string} checkpoint_id
|
|
355
343
|
* @returns {any}
|
|
356
344
|
*/
|
|
357
|
-
export function
|
|
345
|
+
export function listVersions(duc_buf) {
|
|
358
346
|
const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
|
|
359
347
|
const len0 = WASM_VECTOR_LEN;
|
|
360
|
-
const
|
|
361
|
-
const len1 = WASM_VECTOR_LEN;
|
|
362
|
-
const ret = wasm.restoreCheckpoint(ptr0, len0, ptr1, len1);
|
|
348
|
+
const ret = wasm.listVersions(ptr0, len0);
|
|
363
349
|
if (ret[2]) {
|
|
364
350
|
throw takeFromExternrefTable0(ret[1]);
|
|
365
351
|
}
|
|
@@ -367,14 +353,16 @@ export function restoreCheckpoint(duc_buf, checkpoint_id) {
|
|
|
367
353
|
}
|
|
368
354
|
|
|
369
355
|
/**
|
|
370
|
-
*
|
|
356
|
+
* Parse a `.duc` file lazily — returns everything EXCEPT external file data blobs.
|
|
357
|
+
*
|
|
358
|
+
* Use `getExternalFile()` or `listExternalFiles()` for on-demand access.
|
|
371
359
|
* @param {Uint8Array} buf
|
|
372
360
|
* @returns {any}
|
|
373
361
|
*/
|
|
374
|
-
export function
|
|
362
|
+
export function parseDucLazy(buf) {
|
|
375
363
|
const ptr0 = passArray8ToWasm0(buf, wasm.__wbindgen_malloc);
|
|
376
364
|
const len0 = WASM_VECTOR_LEN;
|
|
377
|
-
const ret = wasm.
|
|
365
|
+
const ret = wasm.parseDucLazy(ptr0, len0);
|
|
378
366
|
if (ret[2]) {
|
|
379
367
|
throw takeFromExternrefTable0(ret[1]);
|
|
380
368
|
}
|
|
@@ -382,16 +370,20 @@ export function listExternalFiles(buf) {
|
|
|
382
370
|
}
|
|
383
371
|
|
|
384
372
|
/**
|
|
385
|
-
*
|
|
373
|
+
* Restore the document state at `version_number` from a `.duc` file buffer.
|
|
386
374
|
*
|
|
387
|
-
*
|
|
375
|
+
* The `.duc` file is a SQLite database — this function opens it and queries
|
|
376
|
+
* the `checkpoints` / `deltas` tables directly for version restoration.
|
|
377
|
+
*
|
|
378
|
+
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
388
379
|
* @param {Uint8Array} duc_buf
|
|
380
|
+
* @param {number} version_number
|
|
389
381
|
* @returns {any}
|
|
390
382
|
*/
|
|
391
|
-
export function
|
|
383
|
+
export function restoreVersion(duc_buf, version_number) {
|
|
392
384
|
const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
|
|
393
385
|
const len0 = WASM_VECTOR_LEN;
|
|
394
|
-
const ret = wasm.
|
|
386
|
+
const ret = wasm.restoreVersion(ptr0, len0, version_number);
|
|
395
387
|
if (ret[2]) {
|
|
396
388
|
throw takeFromExternrefTable0(ret[1]);
|
|
397
389
|
}
|
|
@@ -399,37 +391,45 @@ export function listVersions(duc_buf) {
|
|
|
399
391
|
}
|
|
400
392
|
|
|
401
393
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* @param {Uint8Array} buf
|
|
406
|
-
* @returns {any}
|
|
394
|
+
* Serialize a JS object (ExportedDataState) into `.duc` bytes (Uint8Array).
|
|
395
|
+
* @param {any} data
|
|
396
|
+
* @returns {Uint8Array}
|
|
407
397
|
*/
|
|
408
|
-
export function
|
|
409
|
-
const
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
if (ret[2]) {
|
|
413
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
398
|
+
export function serializeDuc(data) {
|
|
399
|
+
const ret = wasm.serializeDuc(data);
|
|
400
|
+
if (ret[3]) {
|
|
401
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
414
402
|
}
|
|
415
|
-
|
|
403
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
404
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
405
|
+
return v1;
|
|
416
406
|
}
|
|
417
407
|
|
|
418
408
|
/**
|
|
419
|
-
*
|
|
409
|
+
* Returns the current version-control schema version defined in Rust.
|
|
420
410
|
*
|
|
421
|
-
*
|
|
422
|
-
*
|
|
411
|
+
* TypeScript should use this as the source of truth instead of hardcoding
|
|
412
|
+
* its own constant. When this value is bumped in Rust, the version control
|
|
413
|
+
* system will automatically handle migration bookkeeping (closing old chains,
|
|
414
|
+
* recording migrations) the next time a checkpoint or delta is created.
|
|
415
|
+
* @returns {number}
|
|
416
|
+
*/
|
|
417
|
+
export function getCurrentSchemaVersion() {
|
|
418
|
+
return 3000004;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Revert the document to a specific version, removing all newer versions.
|
|
423
423
|
*
|
|
424
424
|
* Returns a JS object `{ versionNumber, schemaVersion, data, fromCheckpoint }`.
|
|
425
425
|
* @param {Uint8Array} duc_buf
|
|
426
|
-
* @param {number}
|
|
426
|
+
* @param {number} target_version
|
|
427
427
|
* @returns {any}
|
|
428
428
|
*/
|
|
429
|
-
export function
|
|
429
|
+
export function revertToVersion(duc_buf, target_version) {
|
|
430
430
|
const ptr0 = passArray8ToWasm0(duc_buf, wasm.__wbindgen_malloc);
|
|
431
431
|
const len0 = WASM_VECTOR_LEN;
|
|
432
|
-
const ret = wasm.
|
|
432
|
+
const ret = wasm.revertToVersion(ptr0, len0, target_version);
|
|
433
433
|
if (ret[2]) {
|
|
434
434
|
throw takeFromExternrefTable0(ret[1]);
|
|
435
435
|
}
|
package/dist/ducjs_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -324,6 +324,7 @@ const restoreElement = (element, currentScope, restoredBlocks, localState, globa
|
|
|
324
324
|
return restoreElementWithProperties(element, {
|
|
325
325
|
text: isValidString(docElement.text),
|
|
326
326
|
fileId: isValidString(docElement.fileId) || null,
|
|
327
|
+
referencedFileIds: docElement.referencedFileIds || [],
|
|
327
328
|
gridConfig: restoreDocumentGridConfig(docElement.gridConfig),
|
|
328
329
|
}, localState);
|
|
329
330
|
}
|
|
@@ -133,6 +133,40 @@ export type DucGenericElement = DucSelectionElement | DucRectangleElement;
|
|
|
133
133
|
*/
|
|
134
134
|
export type DucElement = DucGenericElement | DucTextElement | DucLinearElement | DucFreeDrawElement | DucArrowElement | DucImageElement | DucFrameElement | DucEmbeddableElement | DucTableElement | DucDocElement | DucEllipseElement | DucPolygonElement | DucModelElement | DucPlotElement | DucPdfElement;
|
|
135
135
|
export type DucElementTypes = DucElement["type"];
|
|
136
|
+
export type DucElementSelectableField = keyof DucElement | keyof Extract<DucElement, {
|
|
137
|
+
type: "model";
|
|
138
|
+
}> | keyof Extract<DucElement, {
|
|
139
|
+
type: "text";
|
|
140
|
+
}> | keyof Extract<DucElement, {
|
|
141
|
+
type: "line";
|
|
142
|
+
}> | keyof Extract<DucElement, {
|
|
143
|
+
type: "arrow";
|
|
144
|
+
}> | keyof Extract<DucElement, {
|
|
145
|
+
type: "freedraw";
|
|
146
|
+
}> | keyof Extract<DucElement, {
|
|
147
|
+
type: "ellipse";
|
|
148
|
+
}> | keyof Extract<DucElement, {
|
|
149
|
+
type: "polygon";
|
|
150
|
+
}> | keyof Extract<DucElement, {
|
|
151
|
+
type: "image";
|
|
152
|
+
}> | keyof Extract<DucElement, {
|
|
153
|
+
type: "frame";
|
|
154
|
+
}> | keyof Extract<DucElement, {
|
|
155
|
+
type: "plot";
|
|
156
|
+
}> | keyof Extract<DucElement, {
|
|
157
|
+
type: "doc";
|
|
158
|
+
}> | keyof Extract<DucElement, {
|
|
159
|
+
type: "pdf";
|
|
160
|
+
}> | keyof Extract<DucElement, {
|
|
161
|
+
type: "table";
|
|
162
|
+
}> | keyof Extract<DucElement, {
|
|
163
|
+
type: "embeddable";
|
|
164
|
+
}>;
|
|
165
|
+
export declare const DUC_ELEMENT_SELECTABLE_FIELDS: readonly ["id", "type", "label", "x", "y", "width", "height", "angle", "opacity", "isDeleted", "isVisible", "groupIds", "frameId", "scope", "layerId", "zIndex", "description", "customData", "roundness", "blending", "background", "stroke", "boundElements", "link", "locked", "regionIds", "blockIds", "instanceId", "index", "updated", "version", "versionNonce", "seed", "modelType", "fileIds", "code", "thumbnail", "viewerState", "text", "autoResize", "containerId", "originalText", "isLtr", "fontFamily", "bigFontFamily", "fontSize", "textAlign", "verticalAlign", "lineHeight", "lineSpacing", "obliqueAngle", "widthFactor", "isUpsideDown", "isBackwards", "points", "fileId", "status", "scaleFlip", "crop", "filter", "elbowed", "wipeoutBelow", "clip", "labelVisible", "layout", "gridConfig", "referencedFileIds", "sides", "ratio", "startAngle", "endAngle", "showAuxCrosshair", "size", "thinning", "smoothing", "streamline", "easing", "start", "end", "pressures", "simulatePressure", "lastCommittedPoint", "lines", "pathOverrides", "startBinding", "endBinding", "svgPath", "isPlot", "isCollapsed"];
|
|
166
|
+
export declare const DUC_ELEMENT_COMMUNICATION_DENY_FIELDS: readonly ["seed", "versionNonce", "thumbnail", "svgPath", "originalText"];
|
|
167
|
+
export type DucElementCommunicationDenyField = typeof DUC_ELEMENT_COMMUNICATION_DENY_FIELDS[number];
|
|
168
|
+
export declare const DUC_ELEMENT_COMMUNICATION_DENY_FIELD_SET: ReadonlySet<string>;
|
|
169
|
+
export declare const DUC_ELEMENT_TYPE_VALUES: readonly ["rectangle", "polygon", "ellipse", "line", "arrow", "freedraw", "text", "image", "frame", "embeddable", "table", "model", "pdf", "doc", "plot"];
|
|
136
170
|
export type NonDeleted<TElement extends DucElement> = TElement & {
|
|
137
171
|
isDeleted: boolean;
|
|
138
172
|
};
|
|
@@ -750,6 +784,8 @@ export type DucDocElement = _DucElementBase & {
|
|
|
750
784
|
type: "doc";
|
|
751
785
|
text: string;
|
|
752
786
|
fileId: ExternalFileId | null;
|
|
787
|
+
/** Files referenced by the Typst source, such as images or data files. */
|
|
788
|
+
referencedFileIds: ExternalFileId[];
|
|
753
789
|
/** Configuration for rendering the document in a grid layout */
|
|
754
790
|
gridConfig: DocumentGridConfig;
|
|
755
791
|
};
|
|
@@ -1 +1,119 @@
|
|
|
1
1
|
export * from "./typeChecks";
|
|
2
|
+
export const DUC_ELEMENT_SELECTABLE_FIELDS = [
|
|
3
|
+
"id",
|
|
4
|
+
"type",
|
|
5
|
+
"label",
|
|
6
|
+
"x",
|
|
7
|
+
"y",
|
|
8
|
+
"width",
|
|
9
|
+
"height",
|
|
10
|
+
"angle",
|
|
11
|
+
"opacity",
|
|
12
|
+
"isDeleted",
|
|
13
|
+
"isVisible",
|
|
14
|
+
"groupIds",
|
|
15
|
+
"frameId",
|
|
16
|
+
"scope",
|
|
17
|
+
"layerId",
|
|
18
|
+
"zIndex",
|
|
19
|
+
"description",
|
|
20
|
+
"customData",
|
|
21
|
+
"roundness",
|
|
22
|
+
"blending",
|
|
23
|
+
"background",
|
|
24
|
+
"stroke",
|
|
25
|
+
"boundElements",
|
|
26
|
+
"link",
|
|
27
|
+
"locked",
|
|
28
|
+
"regionIds",
|
|
29
|
+
"blockIds",
|
|
30
|
+
"instanceId",
|
|
31
|
+
"index",
|
|
32
|
+
"updated",
|
|
33
|
+
"version",
|
|
34
|
+
"versionNonce",
|
|
35
|
+
"seed",
|
|
36
|
+
"modelType",
|
|
37
|
+
"fileIds",
|
|
38
|
+
"code",
|
|
39
|
+
"thumbnail",
|
|
40
|
+
"viewerState",
|
|
41
|
+
"text",
|
|
42
|
+
"autoResize",
|
|
43
|
+
"containerId",
|
|
44
|
+
"originalText",
|
|
45
|
+
"isLtr",
|
|
46
|
+
"fontFamily",
|
|
47
|
+
"bigFontFamily",
|
|
48
|
+
"fontSize",
|
|
49
|
+
"textAlign",
|
|
50
|
+
"verticalAlign",
|
|
51
|
+
"lineHeight",
|
|
52
|
+
"lineSpacing",
|
|
53
|
+
"obliqueAngle",
|
|
54
|
+
"widthFactor",
|
|
55
|
+
"isUpsideDown",
|
|
56
|
+
"isBackwards",
|
|
57
|
+
"points",
|
|
58
|
+
"fileId",
|
|
59
|
+
"status",
|
|
60
|
+
"scaleFlip",
|
|
61
|
+
"crop",
|
|
62
|
+
"filter",
|
|
63
|
+
"elbowed",
|
|
64
|
+
"wipeoutBelow",
|
|
65
|
+
"clip",
|
|
66
|
+
"labelVisible",
|
|
67
|
+
"layout",
|
|
68
|
+
"gridConfig",
|
|
69
|
+
"referencedFileIds",
|
|
70
|
+
"sides",
|
|
71
|
+
"ratio",
|
|
72
|
+
"startAngle",
|
|
73
|
+
"endAngle",
|
|
74
|
+
"showAuxCrosshair",
|
|
75
|
+
"size",
|
|
76
|
+
"thinning",
|
|
77
|
+
"smoothing",
|
|
78
|
+
"streamline",
|
|
79
|
+
"easing",
|
|
80
|
+
"start",
|
|
81
|
+
"end",
|
|
82
|
+
"pressures",
|
|
83
|
+
"simulatePressure",
|
|
84
|
+
"lastCommittedPoint",
|
|
85
|
+
"lines",
|
|
86
|
+
"pathOverrides",
|
|
87
|
+
"startBinding",
|
|
88
|
+
"endBinding",
|
|
89
|
+
"svgPath",
|
|
90
|
+
"isPlot",
|
|
91
|
+
"isCollapsed",
|
|
92
|
+
];
|
|
93
|
+
const _fieldCoverage = true;
|
|
94
|
+
export const DUC_ELEMENT_COMMUNICATION_DENY_FIELDS = [
|
|
95
|
+
"seed",
|
|
96
|
+
"versionNonce",
|
|
97
|
+
"thumbnail",
|
|
98
|
+
"svgPath",
|
|
99
|
+
"originalText",
|
|
100
|
+
];
|
|
101
|
+
export const DUC_ELEMENT_COMMUNICATION_DENY_FIELD_SET = new Set(DUC_ELEMENT_COMMUNICATION_DENY_FIELDS);
|
|
102
|
+
export const DUC_ELEMENT_TYPE_VALUES = [
|
|
103
|
+
"rectangle",
|
|
104
|
+
"polygon",
|
|
105
|
+
"ellipse",
|
|
106
|
+
"line",
|
|
107
|
+
"arrow",
|
|
108
|
+
"freedraw",
|
|
109
|
+
"text",
|
|
110
|
+
"image",
|
|
111
|
+
"frame",
|
|
112
|
+
"embeddable",
|
|
113
|
+
"table",
|
|
114
|
+
"model",
|
|
115
|
+
"pdf",
|
|
116
|
+
"doc",
|
|
117
|
+
"plot",
|
|
118
|
+
];
|
|
119
|
+
const _typeCoverage = true;
|
|
@@ -161,13 +161,13 @@ export const newTableElement = (currentScope, opts) => {
|
|
|
161
161
|
return (Object.assign(Object.assign({}, _newElementBase("table", currentScope, opts)), { fileId: (_a = opts.fileId) !== null && _a !== void 0 ? _a : null, type: "table" }));
|
|
162
162
|
};
|
|
163
163
|
export const newDocElement = (currentScope, opts) => {
|
|
164
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
165
|
-
return (Object.assign(Object.assign({}, _newElementBase("doc", currentScope, Object.assign(Object.assign({}, opts), getDocumentElementStyle(opts)))), { type: "doc", text: opts.text || "", fileId: (_a = opts.fileId) !== null && _a !== void 0 ? _a : null, gridConfig: {
|
|
166
|
-
columns: (
|
|
167
|
-
gapX: (
|
|
168
|
-
gapY: (
|
|
169
|
-
firstPageAlone: (
|
|
170
|
-
scale: (
|
|
164
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
165
|
+
return (Object.assign(Object.assign({}, _newElementBase("doc", currentScope, Object.assign(Object.assign({}, opts), getDocumentElementStyle(opts)))), { type: "doc", text: opts.text || "", fileId: (_a = opts.fileId) !== null && _a !== void 0 ? _a : null, referencedFileIds: (_b = opts.referencedFileIds) !== null && _b !== void 0 ? _b : [], gridConfig: {
|
|
166
|
+
columns: (_d = (_c = opts.gridConfig) === null || _c === void 0 ? void 0 : _c.columns) !== null && _d !== void 0 ? _d : 1,
|
|
167
|
+
gapX: (_f = (_e = opts.gridConfig) === null || _e === void 0 ? void 0 : _e.gapX) !== null && _f !== void 0 ? _f : 0,
|
|
168
|
+
gapY: (_h = (_g = opts.gridConfig) === null || _g === void 0 ? void 0 : _g.gapY) !== null && _h !== void 0 ? _h : 0,
|
|
169
|
+
firstPageAlone: (_k = (_j = opts.gridConfig) === null || _j === void 0 ? void 0 : _j.firstPageAlone) !== null && _k !== void 0 ? _k : false,
|
|
170
|
+
scale: (_m = (_l = opts.gridConfig) === null || _l === void 0 ? void 0 : _l.scale) !== null && _m !== void 0 ? _m : 1,
|
|
171
171
|
} }));
|
|
172
172
|
};
|
|
173
173
|
export const newPdfElement = (currentScope, opts) => (Object.assign(Object.assign({ fileId: null, gridConfig: { columns: 1, gapX: 0, gapY: 0, firstPageAlone: false, scale: 1 } }, _newElementBase("pdf", currentScope, Object.assign(Object.assign({}, opts), getDocumentElementStyle(opts)))), { type: "pdf" }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ducjs",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2",
|
|
4
4
|
"description": "The duc 2D CAD file format is a cornerstone of our advanced design system, conceived to cater to professionals seeking precision and efficiency in their design work.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|