ooxml-core 1.43.0 → 1.45.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/dist/{PptxHandler-V23RDNEX.cjs → PptxHandler-3RDVJFQV.cjs} +2 -2
- package/dist/{PptxHandler-WB3KL2WH.mjs → PptxHandler-EI6DMHPM.mjs} +1 -1
- package/dist/{PptxHandler-3VAVJDFB.mjs → PptxHandler-FXLXIOLT.mjs} +2 -2
- package/dist/{PresentationBuilder-7LJMTRJ6.mjs → PresentationBuilder-3FKFRSSV.mjs} +2 -2
- package/dist/{PresentationBuilder-KHL6GONR.cjs → PresentationBuilder-CSKLG64K.cjs} +4 -4
- package/dist/{PresentationBuilder-PY2GB4IG.mjs → PresentationBuilder-DDYHRV26.mjs} +1 -1
- package/dist/automation/index.cjs +10 -1
- package/dist/automation/index.mjs +10 -1
- package/dist/chart/edit/fill.d.ts +6 -2
- package/dist/chart/edit/fill.d.ts.map +1 -1
- package/dist/chart/index.cjs +12 -3
- package/dist/chart/index.mjs +12 -3
- package/dist/{chunk-HLYOHD2Z.mjs → chunk-CVJX6NNO.mjs} +438 -108
- package/dist/{chunk-243ZYX2B.mjs → chunk-GGJUWJXB.mjs} +1 -1
- package/dist/{chunk-KCDLTVUI.mjs → chunk-GXYK3H4O.mjs} +1 -1
- package/dist/{chunk-WEAWSXUX.mjs → chunk-LCXBTJXE.mjs} +4 -4
- package/dist/{chunk-JHYU7HGG.mjs → chunk-RVYGAYCP.mjs} +1 -1
- package/dist/{chunk-4LEVL6ZW.mjs → chunk-U5BXJQZG.mjs} +457 -105
- package/dist/{chunk-RNZQ2OU4.cjs → chunk-YBSNMVSN.cjs} +437 -107
- package/dist/index.cjs +164 -71
- package/dist/index.mjs +165 -72
- package/dist/opc/declared-fonts.d.ts +9 -0
- package/dist/opc/declared-fonts.d.ts.map +1 -0
- package/dist/opc/index.cjs +84 -0
- package/dist/opc/index.d.ts +1 -0
- package/dist/opc/index.d.ts.map +1 -1
- package/dist/opc/index.mjs +85 -2
- package/dist/pptx/automation/index.cjs +529 -167
- package/dist/pptx/automation/index.d.ts +6 -6
- package/dist/pptx/automation/index.mjs +5 -5
- package/dist/pptx/chunks/{elements-PBugbKtv.d.ts → elements-B4Z6N-Gz.d.ts} +4 -477
- package/dist/pptx/chunks/elements-B4Z6N-Gz.d.ts.map +1 -0
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts → index-6Ot1b-4U.d.ts} +6 -6
- package/dist/pptx/chunks/{index-CCJiD-Bm.d.ts.map → index-6Ot1b-4U.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts → index-DGKI80Hj.d.ts} +61 -6
- package/dist/pptx/chunks/{index-CGNb1TV9.d.ts.map → index-DGKI80Hj.d.ts.map} +1 -1
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts → index-jdZUtLGB.d.ts} +4 -4
- package/dist/pptx/chunks/{index-Bj-hur0D.d.ts.map → index-jdZUtLGB.d.ts.map} +1 -1
- package/dist/pptx/chunks/{table-C7ITXL3Y.d.ts → table-BfgZfw5R.d.ts} +488 -4
- package/dist/pptx/chunks/table-BfgZfw5R.d.ts.map +1 -0
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts → text-operations-Mek86RBL.d.ts} +3 -3
- package/dist/pptx/chunks/{text-operations-BNJr7aGa.d.ts.map → text-operations-Mek86RBL.d.ts.map} +1 -1
- package/dist/pptx/cli/index.cjs +525 -163
- package/dist/pptx/cli/index.d.ts +1 -1
- package/dist/pptx/cli/index.mjs +4 -4
- package/dist/pptx/converter/index.d.ts +1 -1
- package/dist/pptx/converter/index.mjs +2 -2
- package/dist/pptx/editor/render/find-replace.d.ts +2 -2
- package/dist/pptx/editor/render/slide-operations.cjs +1 -1
- package/dist/pptx/editor/render/slide-operations.mjs +1 -1
- package/dist/pptx/editor/render/table-layout.d.ts +1 -1
- package/dist/pptx/editor/render/text-runs-style-patch.d.ts +1 -1
- package/dist/pptx/editor/render/text-style-scope.d.ts +1 -1
- package/dist/pptx/index.cjs +558 -168
- package/dist/pptx/index.d.ts +7 -7
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/node/index.d.ts +1 -1
- package/dist/xlsx/index.cjs +10 -1
- package/dist/xlsx/index.mjs +10 -1
- package/dist/xlsx/ui/index.cjs +50 -6
- package/dist/xlsx/ui/index.mjs +50 -6
- package/dist/xlsx/ui/locales/de/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/en/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/es/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/fr/options.d.ts.map +1 -1
- package/dist/xlsx/ui/locales/zh-CN/options.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/pptx/chunks/elements-PBugbKtv.d.ts.map +0 -1
- package/dist/pptx/chunks/table-C7ITXL3Y.d.ts.map +0 -1
package/dist/opc/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
|
|
2
2
|
import JSZip2 from 'jszip';
|
|
3
|
-
import { zlibSync } from 'fflate';
|
|
3
|
+
import { zlibSync, unzipSync, strFromU8 } from 'fflate';
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __export = (target, all) => {
|
|
@@ -2280,5 +2280,88 @@ async function stripPackageSignatures(zip) {
|
|
|
2280
2280
|
function zlibCompress(data) {
|
|
2281
2281
|
return zlibSync(data);
|
|
2282
2282
|
}
|
|
2283
|
+
var PARTS = [
|
|
2284
|
+
/^word\/(fontTable|styles)\.xml$/u,
|
|
2285
|
+
/^xl\/styles\.xml$/u,
|
|
2286
|
+
/^ppt\/presentation\.xml$/u,
|
|
2287
|
+
/^ppt\/slideMasters\/slideMaster\d+\.xml$/u,
|
|
2288
|
+
/^ppt\/slides\/slide([1-9]|1[0-9]|20)\.xml$/u,
|
|
2289
|
+
/^visio\/document\.xml$/u,
|
|
2290
|
+
/^(word|xl|ppt|visio)\/theme\/theme\d+\.xml$/u
|
|
2291
|
+
];
|
|
2292
|
+
var MAX_PART_BYTES = 2 * 1024 * 1024;
|
|
2293
|
+
var MAX_TOTAL_BYTES = 8 * 1024 * 1024;
|
|
2294
|
+
var FAMILY_PATTERNS = [
|
|
2295
|
+
/\btypeface="([^"]+)"/gu,
|
|
2296
|
+
/<w:font\s+w:name="([^"]+)"/gu,
|
|
2297
|
+
/\bw:(?:ascii|hAnsi|eastAsia|cs)="([^"]+)"/gu,
|
|
2298
|
+
/<name\s+val="([^"]+)"/gu,
|
|
2299
|
+
/<FaceName\b[^>]*?\bNameU="([^"]+)"/gu
|
|
2300
|
+
];
|
|
2301
|
+
var decodeXml = (value) => value.replace(/"/gu, '"').replace(/'/gu, "'").replace(/</gu, "<").replace(/>/gu, ">").replace(/&/gu, "&");
|
|
2302
|
+
function add(into, raw) {
|
|
2303
|
+
const family = decodeXml(raw).trim();
|
|
2304
|
+
if (!family || family.startsWith("+") || family.length > 64) return;
|
|
2305
|
+
const key = family.toLowerCase();
|
|
2306
|
+
if (!into.has(key)) into.set(key, family);
|
|
2307
|
+
}
|
|
2308
|
+
function collectEmbedded(name, xml2, into) {
|
|
2309
|
+
if (name === "ppt/presentation.xml") {
|
|
2310
|
+
for (const match of xml2.matchAll(/<p:embeddedFont>\s*<p:font\b[^>]*?\btypeface="([^"]+)"/gu)) {
|
|
2311
|
+
if (match[1]) add(into, match[1]);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
if (name === "word/fontTable.xml") {
|
|
2315
|
+
for (const match of xml2.matchAll(/<w:font\s+w:name="([^"]+)"[^>]*>([\s\S]*?)<\/w:font>/gu)) {
|
|
2316
|
+
if (match[1] && /<w:embed(Regular|Bold|Italic|BoldItalic)\b/u.test(match[2] ?? "")) {
|
|
2317
|
+
add(into, match[1]);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
function readDeclaredFonts(bytes) {
|
|
2323
|
+
const data = bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes);
|
|
2324
|
+
let total = 0;
|
|
2325
|
+
let parts;
|
|
2326
|
+
try {
|
|
2327
|
+
parts = unzipSync(data, {
|
|
2328
|
+
filter: (file) => {
|
|
2329
|
+
if (!PARTS.some((pattern) => pattern.test(file.name))) return false;
|
|
2330
|
+
if (file.originalSize > MAX_PART_BYTES || total + file.originalSize > MAX_TOTAL_BYTES) {
|
|
2331
|
+
return false;
|
|
2332
|
+
}
|
|
2333
|
+
total += file.originalSize;
|
|
2334
|
+
return true;
|
|
2335
|
+
}
|
|
2336
|
+
});
|
|
2337
|
+
} catch {
|
|
2338
|
+
return { families: [], embedded: [] };
|
|
2339
|
+
}
|
|
2340
|
+
const families = /* @__PURE__ */ new Map();
|
|
2341
|
+
const embedded = /* @__PURE__ */ new Map();
|
|
2342
|
+
for (const name of Object.keys(parts).sort(byPriority)) {
|
|
2343
|
+
const part = parts[name];
|
|
2344
|
+
if (!part) continue;
|
|
2345
|
+
const xml2 = strFromU8(part);
|
|
2346
|
+
for (const pattern of FAMILY_PATTERNS) {
|
|
2347
|
+
for (const match of xml2.matchAll(pattern)) if (match[1]) add(families, match[1]);
|
|
2348
|
+
}
|
|
2349
|
+
collectEmbedded(name, xml2, embedded);
|
|
2350
|
+
}
|
|
2351
|
+
const embeddedKeys = new Set(embedded.keys());
|
|
2352
|
+
return {
|
|
2353
|
+
families: [...families].filter(([key]) => !embeddedKeys.has(key)).map(([, name]) => name),
|
|
2354
|
+
embedded: [...embedded.values()]
|
|
2355
|
+
};
|
|
2356
|
+
}
|
|
2357
|
+
function priority(name) {
|
|
2358
|
+
if (name.includes("/theme/")) return 0;
|
|
2359
|
+
if (/styles\.xml$|fontTable\.xml$|presentation\.xml$|document\.xml$/u.test(name)) return 1;
|
|
2360
|
+
if (name.includes("slideMaster")) return 2;
|
|
2361
|
+
return 3;
|
|
2362
|
+
}
|
|
2363
|
+
function byPriority(a, b) {
|
|
2364
|
+
return priority(a) - priority(b) || a.localeCompare(b, "en", { numeric: true });
|
|
2365
|
+
}
|
|
2283
2366
|
|
|
2284
|
-
export { CORE_PROPERTY_FIELDS, CUSTOM_PROPERTIES_FMTID, DEFAULT_ZIP_LIMITS, PROPERTY_CONTENT_TYPES, PROPERTY_PART_NAMES, RELATIONSHIP_TYPES, STRICT_APP_NAMESPACES, ZipLimitError, allocateCustomPropertyIds, buildContentTypesXml, buildRelationshipsXml, clonePartGraph, contentTypeForPart, customPropertyFromText, declaredEntrySize, diffOpcPackages, ensureContentTypeDefault, ensureContentTypeOverride, ensureRelationship, findOfficeDocumentPart, formatW3cdtf, fromTitleGroups, getRelationshipId, guardZip, hyperlinkPolicy, inflateEntryGuarded, isOpenableHyperlinkHref, isSafeHyperlinkHref, isSafePartName, isStorableHyperlinkHref, listEmbeddedPackages, mergeOpcSnapshots, nextRelationshipId, openZip, parseAppProperties, parseContentTypes, parseCoreProperties, parseCustomProperties, parseCustomPropertyTexts, parseRelationships, relationshipsPartFor, relativePartTarget, removeContentTypeOverride, replaceEmbeddedPackage, replaceTitleGroup, resolvePartPath, signature_exports as signature, streamEntryGuarded, titleGroups, writeAppProperties, writeCoreProperties, writeCustomProperties, zlibCompress };
|
|
2367
|
+
export { CORE_PROPERTY_FIELDS, CUSTOM_PROPERTIES_FMTID, DEFAULT_ZIP_LIMITS, PROPERTY_CONTENT_TYPES, PROPERTY_PART_NAMES, RELATIONSHIP_TYPES, STRICT_APP_NAMESPACES, ZipLimitError, allocateCustomPropertyIds, buildContentTypesXml, buildRelationshipsXml, clonePartGraph, contentTypeForPart, customPropertyFromText, declaredEntrySize, diffOpcPackages, ensureContentTypeDefault, ensureContentTypeOverride, ensureRelationship, findOfficeDocumentPart, formatW3cdtf, fromTitleGroups, getRelationshipId, guardZip, hyperlinkPolicy, inflateEntryGuarded, isOpenableHyperlinkHref, isSafeHyperlinkHref, isSafePartName, isStorableHyperlinkHref, listEmbeddedPackages, mergeOpcSnapshots, nextRelationshipId, openZip, parseAppProperties, parseContentTypes, parseCoreProperties, parseCustomProperties, parseCustomPropertyTexts, parseRelationships, readDeclaredFonts, relationshipsPartFor, relativePartTarget, removeContentTypeOverride, replaceEmbeddedPackage, replaceTitleGroup, resolvePartPath, signature_exports as signature, streamEntryGuarded, titleGroups, writeAppProperties, writeCoreProperties, writeCustomProperties, zlibCompress };
|