@file-viewer/renderer-iwork 3.3.1 → 3.3.3
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/parser.js +0 -21
- package/package.json +2 -2
package/dist/parser.js
CHANGED
|
@@ -6,10 +6,6 @@ import * as keynoteArchivesNamespace from 'keynote-archives';
|
|
|
6
6
|
import { IworkContainerMismatchError } from './errors.js';
|
|
7
7
|
import { DEFAULT_IWORK_PARSE_LIMITS } from './limits.js';
|
|
8
8
|
import { decompressIwaFile } from './snappy.js';
|
|
9
|
-
// keynote-archives 2.x publishes CommonJS only. A named ESM import happens to
|
|
10
|
-
// work in the workspace build, but fails when a cold Vite project consumes the
|
|
11
|
-
// published renderer. Resolve the CommonJS namespace once and keep the parser
|
|
12
|
-
// independent of the bundler's named-export interop policy.
|
|
13
9
|
const keynoteArchivesModule = ('default' in keynoteArchivesNamespace && keynoteArchivesNamespace.default
|
|
14
10
|
? keynoteArchivesNamespace.default
|
|
15
11
|
: keynoteArchivesNamespace);
|
|
@@ -433,11 +429,6 @@ const legacySceneDimensions = (root, kind, tables) => {
|
|
|
433
429
|
const legacyPagesValues = (scene, root) => {
|
|
434
430
|
if (scene !== root)
|
|
435
431
|
return legacyText(scene);
|
|
436
|
-
// Pages '09 embeds complete section prototypes in the document root. Those
|
|
437
|
-
// prototypes are editing templates, not visible document content. Reading
|
|
438
|
-
// every <p> from the root made an empty Apple document render pages of
|
|
439
|
-
// overlapping template text. Only the body storage outside a prototype is
|
|
440
|
-
// the document's live word-processing flow.
|
|
441
432
|
return descendants(root, ['text-storage'])
|
|
442
433
|
.filter(storage => attribute(storage, 'sf:kind', 'kind') === 'body')
|
|
443
434
|
.filter(storage => !hasAncestor(storage, ['prototype'], root))
|
|
@@ -471,9 +462,6 @@ const parseLegacy = async (zip, kind, limits, createParser) => {
|
|
|
471
462
|
throw new Error('iWork scene count exceeds the configured safety limit.');
|
|
472
463
|
const scenes = sceneElements.map((scene, index) => {
|
|
473
464
|
var _a;
|
|
474
|
-
// Numbers workspaces contain implementation layer names such as
|
|
475
|
-
// LSWorkspaceCommentLayer. They are not document text and must not leak
|
|
476
|
-
// into search or export. Cell text is represented by the table model.
|
|
477
465
|
const values = kind === 'numbers' ? [] : kind === 'pages' ? legacyPagesValues(scene, root) : legacyText(scene);
|
|
478
466
|
const notes = kind === 'keynote' ? descendants(scene, ['notes', 'speaker-notes']).map(nodeText).filter(Boolean) : [];
|
|
479
467
|
const tables = legacyTables(scene, limits).map(table => {
|
|
@@ -482,10 +470,6 @@ const parseLegacy = async (zip, kind, limits, createParser) => {
|
|
|
482
470
|
...table,
|
|
483
471
|
x: table.x + 71,
|
|
484
472
|
y: table.y + 71,
|
|
485
|
-
// Numbers '09 stores the usable row content height. Apple includes the
|
|
486
|
-
// half-point grid stroke for every rendered row when calculating the
|
|
487
|
-
// table frame. Preserve that distinction so dense legacy sheets do not
|
|
488
|
-
// progressively drift vertically from the native export.
|
|
489
473
|
height: table.height == null ? table.height : table.height + table.rows.length * 0.5,
|
|
490
474
|
rowHeights: (_a = table.rowHeights) === null || _a === void 0 ? void 0 : _a.map(height => height + 0.5),
|
|
491
475
|
headerRows: Math.min(1, table.rows.length),
|
|
@@ -803,9 +787,6 @@ const resolveTextStyle = (objects, id, visited = new Set()) => {
|
|
|
803
787
|
...(typeof character.bold === 'boolean' ? { bold: character.bold } : {}),
|
|
804
788
|
...(typeof character.italic === 'boolean' ? { italic: character.italic } : {}),
|
|
805
789
|
...(Number.isFinite(character.tracking) ? { letterSpacing: Number(character.tracking) } : {}),
|
|
806
|
-
// Apple stores proportional line spacing relative to its font metrics.
|
|
807
|
-
// CSS line-height uses the full em box, which is about 0.2 larger for the
|
|
808
|
-
// Helvetica Neue metrics used by current Keynote documents.
|
|
809
790
|
...(Number.isFinite(lineHeight) && lineHeight > 0 ? { lineHeight: lineHeight < 1 ? lineHeight + 0.2 : lineHeight } : {}),
|
|
810
791
|
...(Number.isFinite(paragraph.alignment) ? { align: paragraphAlignment(paragraph.alignment) } : {}),
|
|
811
792
|
};
|
|
@@ -1004,8 +985,6 @@ const decodeKeynoteFrame = (frame) => {
|
|
|
1004
985
|
messages.push({ info: { type: Number(info.type) }, data: messageType.fromBinary(payload) });
|
|
1005
986
|
}
|
|
1006
987
|
catch {
|
|
1007
|
-
// Newer Keynote releases can add fields or message variants. Other typed
|
|
1008
|
-
// messages in the same frame remain useful, so isolate this one payload.
|
|
1009
988
|
}
|
|
1010
989
|
}
|
|
1011
990
|
objects.push({ identifier: archive.identifier, messages });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/renderer-iwork",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Offline Apple Pages, Numbers and Keynote renderer for modern IWA and iWork '09 containers.",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"THIRD_PARTY_NOTICES.md"
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@file-viewer/core": "3.3.
|
|
85
|
+
"@file-viewer/core": "3.3.3",
|
|
86
86
|
"@xmldom/xmldom": "^0.9.12",
|
|
87
87
|
"jszip": "3.10.2",
|
|
88
88
|
"keynote-archives": "2.0.1",
|