@office-open/core 0.6.2 → 0.6.4
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/chart/index.d.mts +1 -1
- package/dist/chart/index.mjs +1 -1
- package/dist/drawingml/index.d.mts +116 -116
- package/dist/drawingml/index.mjs +124 -140
- package/dist/{index-DVqYs1vv.d.mts → index-DigYTiB_.d.mts} +1 -1
- package/dist/index.d.mts +118 -3
- package/dist/index.mjs +4 -4
- package/dist/smartart/index.d.mts +1 -1
- package/dist/smartart/index.mjs +1 -1
- package/dist/{smartart-CwzSHTBd.mjs → smartart-DBQ_rRfK.mjs} +1 -1
- package/dist/xsd-mappings-BiTj9yJn.mjs +279 -0
- package/package.json +2 -2
- package/dist/id-generators-CM3u923a.mjs +0 -72
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Relationship, elementToXml, findRel, findRelsByType, getImageType, listFiles, parseRels, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, uint8ToBase64, unzipToMap, zipToBuffer } from "./archive.mjs";
|
|
2
2
|
import { C as XmlComponent, D as IXmlableObject, E as IXmlAttribute, S as IgnoreIfEmptyXmlComponent, T as Context, _ as AttributeMap, a as BuilderElement, b as XmlAttributeComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as AttributeData, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as AttributePayload, w as BaseXmlComponent, x as EMPTY_OBJECT, y as NextAttributeComponent } from "./index-mjYQ4KiG.mjs";
|
|
3
3
|
import { C as uCharHexNumber, S as twipsMeasureValue, T as unsignedDecimalNumber, _ as pointMeasureValue, a as ThemeColor, b as signedHpsMeasureValue, c as dateTimeValue, d as hexBinary, f as hexColorValue, g as percentageValue, h as measurementOrPercentValue, i as RelativeMeasure, l as decimalNumber, m as longHexNumber, n as PositivePercentage, o as ThemeFont, p as hpsMeasureValue, r as PositiveUniversalMeasure, s as UniversalMeasure, t as Percentage, u as eighthPointMeasureValue, v as positiveUniversalMeasureValue, w as universalMeasureValue, x as signedTwipsMeasureValue, y as shortHexNumber } from "./values-CIh0bdS1.mjs";
|
|
4
|
-
import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "./index-
|
|
4
|
+
import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "./index-DigYTiB_.mjs";
|
|
5
5
|
import { Element } from "@office-open/xml";
|
|
6
6
|
import { ZipOptions, Zippable, Zippable as Zippable$1, strFromU8, unzipSync } from "fflate";
|
|
7
7
|
import { Readable } from "stream";
|
|
@@ -204,7 +204,7 @@ declare class Relationships extends BaseXmlComponent {
|
|
|
204
204
|
private entries;
|
|
205
205
|
constructor();
|
|
206
206
|
addRelationship(id: number | string, type: RelationshipType, target: string, targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType]): void;
|
|
207
|
-
get
|
|
207
|
+
get relationshipCount(): number;
|
|
208
208
|
prepForXml(_context: Context): IXmlableObject;
|
|
209
209
|
}
|
|
210
210
|
//#endregion
|
|
@@ -346,4 +346,119 @@ interface SmartArtRelOptions {
|
|
|
346
346
|
declare function replaceSmartArtPlaceholders(xml: string, keys: readonly string[], dataOffset: number, idFormat?: IdFormat): string;
|
|
347
347
|
declare function addSmartArtRelationships(keys: readonly string[], addRel: (id: number, type: RelationshipType, target: string, targetMode?: string) => void, baseOffset: number, globalStartIndex: number, options: SmartArtRelOptions): void;
|
|
348
348
|
//#endregion
|
|
349
|
-
|
|
349
|
+
//#region src/xsd-mappings.d.ts
|
|
350
|
+
/**
|
|
351
|
+
* Bidirectional mappings between user-friendly values and XSD abbreviated values.
|
|
352
|
+
*
|
|
353
|
+
* When XSD uses full English words (e.g. "center", "start"), values are used directly — no mapping needed.
|
|
354
|
+
* When XSD uses abbreviations (e.g. "ctr", "l", "rnd"), this module maps them to full words.
|
|
355
|
+
*
|
|
356
|
+
* Usage in generation (Options → XML): xsdAlign.to("center") → "ctr"
|
|
357
|
+
* Usage in parsing (XML → Options): xsdAlign.from("ctr") → "center"
|
|
358
|
+
*/
|
|
359
|
+
/** Invert a Record<K, V> into Record<V, K>. */
|
|
360
|
+
declare function invertMap<K extends string, V extends string>(map: Record<K, V>): Record<V, K>;
|
|
361
|
+
declare const xsdRectAlignment: {
|
|
362
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
363
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
364
|
+
forward: Record<"center" | "topLeft" | "top" | "topRight" | "left" | "right" | "bottomLeft" | "bottom" | "bottomRight", "tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br">; /** The reverse map (XSD → user) */
|
|
365
|
+
reverse: Record<"tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br", "center" | "topLeft" | "top" | "topRight" | "left" | "right" | "bottomLeft" | "bottom" | "bottomRight">;
|
|
366
|
+
};
|
|
367
|
+
declare const xsdTextAlign: {
|
|
368
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
369
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
370
|
+
forward: Record<"center" | "left" | "right" | "justify", "l" | "ctr" | "r" | "just">; /** The reverse map (XSD → user) */
|
|
371
|
+
reverse: Record<"l" | "ctr" | "r" | "just", "center" | "left" | "right" | "justify">;
|
|
372
|
+
};
|
|
373
|
+
declare const xsdTextAnchor: {
|
|
374
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
375
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
376
|
+
forward: Record<"center" | "top" | "bottom", "t" | "ctr" | "b">; /** The reverse map (XSD → user) */
|
|
377
|
+
reverse: Record<"t" | "ctr" | "b", "center" | "top" | "bottom">;
|
|
378
|
+
};
|
|
379
|
+
declare const xsdLineCap: {
|
|
380
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
381
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
382
|
+
forward: Record<"flat" | "round" | "square", "flat" | "rnd" | "sq">; /** The reverse map (XSD → user) */
|
|
383
|
+
reverse: Record<"flat" | "rnd" | "sq", "flat" | "round" | "square">;
|
|
384
|
+
};
|
|
385
|
+
declare const xsdCompoundLine: {
|
|
386
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
387
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
388
|
+
forward: Record<"single" | "double" | "thickThin" | "thinThick" | "triple", "thickThin" | "thinThick" | "sng" | "dbl" | "tri">; /** The reverse map (XSD → user) */
|
|
389
|
+
reverse: Record<"thickThin" | "thinThick" | "sng" | "dbl" | "tri", "single" | "double" | "thickThin" | "thinThick" | "triple">;
|
|
390
|
+
};
|
|
391
|
+
declare const xsdPenAlignment: {
|
|
392
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
393
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
394
|
+
forward: Record<"center" | "inside", "in" | "ctr">; /** The reverse map (XSD → user) */
|
|
395
|
+
reverse: Record<"in" | "ctr", "center" | "inside">;
|
|
396
|
+
};
|
|
397
|
+
declare const xsdLineEndSize: {
|
|
398
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
399
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
400
|
+
forward: Record<"small" | "medium" | "large", "sm" | "med" | "lg">; /** The reverse map (XSD → user) */
|
|
401
|
+
reverse: Record<"sm" | "med" | "lg", "small" | "medium" | "large">;
|
|
402
|
+
};
|
|
403
|
+
declare const xsdBlendMode: {
|
|
404
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
405
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
406
|
+
forward: Record<"lighten" | "darken" | "over" | "multiply" | "screen", "lighten" | "darken" | "over" | "screen" | "mult">; /** The reverse map (XSD → user) */
|
|
407
|
+
reverse: Record<"lighten" | "darken" | "over" | "screen" | "mult", "lighten" | "darken" | "over" | "multiply" | "screen">;
|
|
408
|
+
};
|
|
409
|
+
declare const xsdPathFillMode: {
|
|
410
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
411
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
412
|
+
forward: Record<"none" | "normal" | "lighten" | "lightenLess" | "darken" | "darkenLess", "none" | "lighten" | "lightenLess" | "darken" | "darkenLess" | "norm">; /** The reverse map (XSD → user) */
|
|
413
|
+
reverse: Record<"none" | "lighten" | "lightenLess" | "darken" | "darkenLess" | "norm", "none" | "normal" | "lighten" | "lightenLess" | "darken" | "darkenLess">;
|
|
414
|
+
};
|
|
415
|
+
declare const xsdEffectContainer: {
|
|
416
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
417
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
418
|
+
forward: Record<"sibling" | "tree", "tree" | "sib">; /** The reverse map (XSD → user) */
|
|
419
|
+
reverse: Record<"tree" | "sib", "sibling" | "tree">;
|
|
420
|
+
};
|
|
421
|
+
declare const xsdPresetShadow: {
|
|
422
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
423
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
424
|
+
forward: Record<"shadow1" | "shadow2" | "shadow3" | "shadow4" | "shadow5" | "shadow6" | "shadow7" | "shadow8" | "shadow9" | "shadow10" | "shadow11" | "shadow12" | "shadow13" | "shadow14" | "shadow15" | "shadow16" | "shadow17" | "shadow18" | "shadow19" | "shadow20", "shdw1" | "shdw2" | "shdw3" | "shdw4" | "shdw5" | "shdw6" | "shdw7" | "shdw8" | "shdw9" | "shdw10" | "shdw11" | "shdw12" | "shdw13" | "shdw14" | "shdw15" | "shdw16" | "shdw17" | "shdw18" | "shdw19" | "shdw20">; /** The reverse map (XSD → user) */
|
|
425
|
+
reverse: Record<"shdw1" | "shdw2" | "shdw3" | "shdw4" | "shdw5" | "shdw6" | "shdw7" | "shdw8" | "shdw9" | "shdw10" | "shdw11" | "shdw12" | "shdw13" | "shdw14" | "shdw15" | "shdw16" | "shdw17" | "shdw18" | "shdw19" | "shdw20", "shadow1" | "shadow2" | "shadow3" | "shadow4" | "shadow5" | "shadow6" | "shadow7" | "shadow8" | "shadow9" | "shadow10" | "shadow11" | "shadow12" | "shadow13" | "shadow14" | "shadow15" | "shadow16" | "shadow17" | "shadow18" | "shadow19" | "shadow20">;
|
|
426
|
+
};
|
|
427
|
+
declare const xsdMaterialType: {
|
|
428
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
429
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
430
|
+
forward: Record<"legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "flat" | "softMetal", "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "flat" | "dkEdge" | "softmetal">; /** The reverse map (XSD → user) */
|
|
431
|
+
reverse: Record<"legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "flat" | "dkEdge" | "softmetal", "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "flat" | "softMetal">;
|
|
432
|
+
};
|
|
433
|
+
declare const xsdPattern: {
|
|
434
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
435
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
436
|
+
forward: Record<"percent5" | "percent10" | "percent20" | "percent25" | "percent30" | "percent40" | "percent50" | "percent60" | "percent70" | "percent75" | "percent80" | "percent90" | "horizontal" | "vertical" | "lightHorizontal" | "lightVertical" | "darkHorizontal" | "darkVertical" | "narrowHorizontal" | "narrowVertical" | "dashedHorizontal" | "dashedVertical" | "cross" | "downDiagonal" | "upDiagonal" | "lightDownDiagonal" | "lightUpDiagonal" | "darkDownDiagonal" | "darkUpDiagonal" | "wideDownDiagonal" | "wideUpDiagonal" | "dashedDownDiagonal" | "dashedUpDiagonal" | "diagonalCross" | "smallChecker" | "largeChecker" | "smallGrid" | "largeGrid" | "dotGrid" | "smallConfetti" | "largeConfetti" | "horizontalBrick" | "diagonalBrick" | "solidDiamond" | "openDiamond" | "dottedDiamond" | "plaid" | "sphere" | "weave" | "divot" | "shingle" | "wave" | "trellis" | "zigZag", "cross" | "dotGrid" | "plaid" | "sphere" | "weave" | "divot" | "shingle" | "wave" | "trellis" | "zigZag" | "pct5" | "pct10" | "pct20" | "pct25" | "pct30" | "pct40" | "pct50" | "pct60" | "pct70" | "pct75" | "pct80" | "pct90" | "horz" | "vert" | "ltHorz" | "ltVert" | "dkHorz" | "dkVert" | "narHorz" | "narVert" | "dashHorz" | "dashVert" | "dnDiag" | "upDiag" | "ltDnDiag" | "ltUpDiag" | "dkDnDiag" | "dkUpDiag" | "wdDnDiag" | "wdUpDiag" | "dashDnDiag" | "dashUpDiag" | "diagCross" | "smCheck" | "lgCheck" | "smGrid" | "lgGrid" | "smConfetti" | "lgConfetti" | "horzBrick" | "diagBrick" | "solidDmnd" | "openDmnd" | "dotDmnd">; /** The reverse map (XSD → user) */
|
|
437
|
+
reverse: Record<"cross" | "dotGrid" | "plaid" | "sphere" | "weave" | "divot" | "shingle" | "wave" | "trellis" | "zigZag" | "pct5" | "pct10" | "pct20" | "pct25" | "pct30" | "pct40" | "pct50" | "pct60" | "pct70" | "pct75" | "pct80" | "pct90" | "horz" | "vert" | "ltHorz" | "ltVert" | "dkHorz" | "dkVert" | "narHorz" | "narVert" | "dashHorz" | "dashVert" | "dnDiag" | "upDiag" | "ltDnDiag" | "ltUpDiag" | "dkDnDiag" | "dkUpDiag" | "wdDnDiag" | "wdUpDiag" | "dashDnDiag" | "dashUpDiag" | "diagCross" | "smCheck" | "lgCheck" | "smGrid" | "lgGrid" | "smConfetti" | "lgConfetti" | "horzBrick" | "diagBrick" | "solidDmnd" | "openDmnd" | "dotDmnd", "percent5" | "percent10" | "percent20" | "percent25" | "percent30" | "percent40" | "percent50" | "percent60" | "percent70" | "percent75" | "percent80" | "percent90" | "horizontal" | "vertical" | "lightHorizontal" | "lightVertical" | "darkHorizontal" | "darkVertical" | "narrowHorizontal" | "narrowVertical" | "dashedHorizontal" | "dashedVertical" | "cross" | "downDiagonal" | "upDiagonal" | "lightDownDiagonal" | "lightUpDiagonal" | "darkDownDiagonal" | "darkUpDiagonal" | "wideDownDiagonal" | "wideUpDiagonal" | "dashedDownDiagonal" | "dashedUpDiagonal" | "diagonalCross" | "smallChecker" | "largeChecker" | "smallGrid" | "largeGrid" | "dotGrid" | "smallConfetti" | "largeConfetti" | "horizontalBrick" | "diagonalBrick" | "solidDiamond" | "openDiamond" | "dottedDiamond" | "plaid" | "sphere" | "weave" | "divot" | "shingle" | "wave" | "trellis" | "zigZag">;
|
|
438
|
+
};
|
|
439
|
+
declare const xsdVerticalMergeRev: {
|
|
440
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
441
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
442
|
+
forward: Record<"continue" | "restart", "cont" | "rest">; /** The reverse map (XSD → user) */
|
|
443
|
+
reverse: Record<"cont" | "rest", "continue" | "restart">;
|
|
444
|
+
};
|
|
445
|
+
declare const xsdUnderlineStyle: {
|
|
446
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
447
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
448
|
+
forward: Record<"none" | "single" | "double", "none" | "sng" | "dbl">; /** The reverse map (XSD → user) */
|
|
449
|
+
reverse: Record<"none" | "sng" | "dbl", "none" | "single" | "double">;
|
|
450
|
+
};
|
|
451
|
+
declare const xsdStrikeStyle: {
|
|
452
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
453
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
454
|
+
forward: Record<"singleStrike" | "doubleStrike" | "noStrike", "sngStrike" | "dblStrike" | "noStrike">; /** The reverse map (XSD → user) */
|
|
455
|
+
reverse: Record<"sngStrike" | "dblStrike" | "noStrike", "singleStrike" | "doubleStrike" | "noStrike">;
|
|
456
|
+
};
|
|
457
|
+
declare const xsdTextCaps: {
|
|
458
|
+
/** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
|
|
459
|
+
from: (xsd: string) => string; /** The forward map (user → XSD) */
|
|
460
|
+
forward: Record<"none" | "small" | "all", "none" | "small" | "all">; /** The reverse map (XSD → user) */
|
|
461
|
+
reverse: Record<"none" | "small" | "all", "none" | "small" | "all">;
|
|
462
|
+
};
|
|
463
|
+
//#endregion
|
|
464
|
+
export { AppProperties, AttributeData, AttributeMap, AttributePayload, BaseXmlComponent, BuilderElement, COLOR_CATEGORIES, CompileFn, Connection, Context, CoreProperties, DEFAULT_DRAWING_XML, DataModel, type DefaultAttributes, EMPTY_OBJECT, EmptyElement, Formatter, IXmlAttribute, IXmlableObject, IdFormat, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, NextAttributeComponent, OoxmlMimeType, OutputByType, OutputType, type OverrideAttributes, Packer, ParsedDocument, Percentage, Point, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RawPassthrough, Relationship, type RelationshipType, Relationships, RelativeMeasure, STYLE_CATEGORIES, SmartArtCollection, SmartArtData, SmartArtRelOptions, TargetModeType, ThemeColor, ThemeFont, TransPoint, TreeNode, UniqueNumericIdCreator, UniversalMeasure, XmlAttributeComponent, XmlComponent, XmlifyedFile, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, type ZipOptions, type Zippable, addSmartArtRelationships, attrObj, buildCorePropertiesXml, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createDataModel, createDefault, createOverride, createPacker, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, elementToXml, escapeRegex, findRel, findRelsByType, formatId, getColorXml, getImageType, getLayoutXml, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, listFiles, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCoreProperties, parseCorePropsElement, parseRels, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, twipsMeasureValue, uCharHexNumber, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, unzipToMap, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert, zipToBuffer };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as XmlAttributeComponent, a as BuilderElement, b as XmlComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as NextAttributeComponent, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as EMPTY_OBJECT, x as BaseXmlComponent, y as IgnoreIfEmptyXmlComponent } from "./xml-components-CADgke8j.mjs";
|
|
2
2
|
import { ThemeColor, ThemeFont, dateTimeValue, decimalNumber, eighthPointMeasureValue, hexBinary, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, universalMeasureValue, unsignedDecimalNumber } from "./values.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-
|
|
3
|
+
import { A as convertPointsToEmu, C as convertEmuToInches, D as convertInchesToTwip, E as convertInchesToEmu, O as convertMillimetersToTwip, S as uniqueUuid, T as convertEmuToPoints, _ as xsdUnderlineStyle, a as xsdLineCap, b as uniqueId, c as xsdPathFillMode, d as xsdPresetShadow, f as xsdRectAlignment, g as xsdTextCaps, h as xsdTextAnchor, i as xsdEffectContainer, k as convertPixelsToEmu, l as xsdPattern, m as xsdTextAlign, n as xsdBlendMode, o as xsdLineEndSize, p as xsdStrikeStyle, r as xsdCompoundLine, s as xsdMaterialType, t as invertMap, u as xsdPenAlignment, v as xsdVerticalMergeRev, w as convertEmuToPixels, x as uniqueNumericIdCreator, y as hashedId } from "./xsd-mappings-BiTj9yJn.mjs";
|
|
4
|
+
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-DBQ_rRfK.mjs";
|
|
5
5
|
import { elementToXml, findRel, findRelsByType, getImageType, listFiles, parseRels, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, uint8ToBase64, unzipToMap, zipToBuffer } from "./archive.mjs";
|
|
6
6
|
import { js2xml, textOf, xml2js } from "@office-open/xml";
|
|
7
7
|
import { AsyncZipDeflate, Zip, ZipPassThrough, strFromU8, strFromU8 as strFromU8$1, strToU8, unzipSync, zip, zipSync } from "fflate";
|
|
@@ -190,7 +190,7 @@ var Relationships = class extends BaseXmlComponent {
|
|
|
190
190
|
targetMode
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
-
get
|
|
193
|
+
get relationshipCount() {
|
|
194
194
|
return this.entries.length;
|
|
195
195
|
}
|
|
196
196
|
prepForXml(_context) {
|
|
@@ -545,4 +545,4 @@ function addSmartArtRelationships(keys, addRel, baseOffset, globalStartIndex, op
|
|
|
545
545
|
});
|
|
546
546
|
}
|
|
547
547
|
//#endregion
|
|
548
|
-
export { AppProperties, BaseXmlComponent, BuilderElement, COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, EMPTY_OBJECT, EmptyElement, Formatter, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, NextAttributeComponent, OoxmlMimeType, ParsedDocument, Point, PrettifyType, RawPassthrough, Relationships, STYLE_CATEGORIES, SmartArtCollection, TargetModeType, ThemeColor, ThemeFont, TransPoint, XmlAttributeComponent, XmlComponent, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, attrObj, buildCorePropertiesXml, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createDataModel, createDefault, createOverride, createPacker, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, elementToXml, escapeRegex, findRel, findRelsByType, formatId, getColorXml, getImageType, getLayoutXml, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, listFiles, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCoreProperties, parseCorePropsElement, parseRels, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, twipsMeasureValue, uCharHexNumber, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, unzipToMap, wrapEl, zipAndConvert, zipSyncAndConvert, zipToBuffer };
|
|
548
|
+
export { AppProperties, BaseXmlComponent, BuilderElement, COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, EMPTY_OBJECT, EmptyElement, Formatter, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, NextAttributeComponent, OoxmlMimeType, ParsedDocument, Point, PrettifyType, RawPassthrough, Relationships, STYLE_CATEGORIES, SmartArtCollection, TargetModeType, ThemeColor, ThemeFont, TransPoint, XmlAttributeComponent, XmlComponent, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, attrObj, buildCorePropertiesXml, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createDataModel, createDefault, createOverride, createPacker, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, elementToXml, escapeRegex, findRel, findRelsByType, formatId, getColorXml, getImageType, getLayoutXml, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, listFiles, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCoreProperties, parseCorePropsElement, parseRels, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, twipsMeasureValue, uCharHexNumber, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, unzipToMap, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert, zipToBuffer };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "../index-
|
|
1
|
+
import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "../index-DigYTiB_.mjs";
|
|
2
2
|
export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, SmartArtData, TransPoint, TreeNode, createDataModel, getColorXml, getLayoutXml, getStyleXml };
|
package/dist/smartart/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-
|
|
1
|
+
import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-DBQ_rRfK.mjs";
|
|
2
2
|
export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, TransPoint, createDataModel, getColorXml, getLayoutXml, getStyleXml };
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import hash from "hash.js";
|
|
2
|
+
import { customAlphabet, nanoid } from "nanoid/non-secure";
|
|
3
|
+
//#region src/converters.ts
|
|
4
|
+
/**
|
|
5
|
+
* OOXML unit conversion utilities.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Converts millimeters to TWIP (twentieths of a point).
|
|
11
|
+
*/
|
|
12
|
+
const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
|
|
13
|
+
/**
|
|
14
|
+
* Converts inches to TWIP (twentieths of a point).
|
|
15
|
+
*/
|
|
16
|
+
const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
|
|
17
|
+
/**
|
|
18
|
+
* Converts pixels to EMU (96 DPI).
|
|
19
|
+
*/
|
|
20
|
+
const convertPixelsToEmu = (pixels) => Math.round(pixels * 9525);
|
|
21
|
+
/**
|
|
22
|
+
* Converts EMU to pixels (96 DPI).
|
|
23
|
+
*/
|
|
24
|
+
const convertEmuToPixels = (emus) => Math.round(emus / 9525);
|
|
25
|
+
/**
|
|
26
|
+
* Converts inches to EMU.
|
|
27
|
+
*/
|
|
28
|
+
const convertInchesToEmu = (inches) => Math.round(inches * 914400);
|
|
29
|
+
/**
|
|
30
|
+
* Converts EMU to inches.
|
|
31
|
+
*/
|
|
32
|
+
const convertEmuToInches = (emus) => emus / 914400;
|
|
33
|
+
/**
|
|
34
|
+
* Converts points to EMU.
|
|
35
|
+
*/
|
|
36
|
+
const convertPointsToEmu = (points) => Math.round(points * 12700);
|
|
37
|
+
/**
|
|
38
|
+
* Converts EMU to points.
|
|
39
|
+
*/
|
|
40
|
+
const convertEmuToPoints = (emus) => emus / 12700;
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/id-generators.ts
|
|
43
|
+
/**
|
|
44
|
+
* Unique ID generation utilities.
|
|
45
|
+
*
|
|
46
|
+
* @module
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* Creates a unique numeric ID generator with sequential numbering.
|
|
50
|
+
*/
|
|
51
|
+
const uniqueNumericIdCreator = (initial = 0) => {
|
|
52
|
+
let currentCount = initial;
|
|
53
|
+
return () => ++currentCount;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Generates a unique lowercase alphanumeric ID using nanoid.
|
|
57
|
+
*/
|
|
58
|
+
const uniqueId = () => nanoid().toLowerCase();
|
|
59
|
+
/**
|
|
60
|
+
* Generates a SHA-1 hash of the provided data.
|
|
61
|
+
*/
|
|
62
|
+
const hashedId = (data) => hash.sha1().update(data instanceof ArrayBuffer ? new Uint8Array(data) : data).digest("hex");
|
|
63
|
+
/**
|
|
64
|
+
* Generates a random hexadecimal string of specified length.
|
|
65
|
+
*/
|
|
66
|
+
const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
|
|
67
|
+
/**
|
|
68
|
+
* Generates a UUID v4-style unique identifier.
|
|
69
|
+
*/
|
|
70
|
+
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/xsd-mappings.ts
|
|
73
|
+
/**
|
|
74
|
+
* Bidirectional mappings between user-friendly values and XSD abbreviated values.
|
|
75
|
+
*
|
|
76
|
+
* When XSD uses full English words (e.g. "center", "start"), values are used directly — no mapping needed.
|
|
77
|
+
* When XSD uses abbreviations (e.g. "ctr", "l", "rnd"), this module maps them to full words.
|
|
78
|
+
*
|
|
79
|
+
* Usage in generation (Options → XML): xsdAlign.to("center") → "ctr"
|
|
80
|
+
* Usage in parsing (XML → Options): xsdAlign.from("ctr") → "center"
|
|
81
|
+
*/
|
|
82
|
+
/** Invert a Record<K, V> into Record<V, K>. */
|
|
83
|
+
function invertMap(map) {
|
|
84
|
+
const result = {};
|
|
85
|
+
for (const key in map) result[map[key]] = key;
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
/** Create a bidirectional mapping helper from a single forward map. */
|
|
89
|
+
function bidi(forward) {
|
|
90
|
+
const reverse = invertMap(forward);
|
|
91
|
+
return {
|
|
92
|
+
/** User-friendly value → XSD value */
|
|
93
|
+
to: (key) => forward[key] ?? key,
|
|
94
|
+
/** XSD value → user-friendly value */
|
|
95
|
+
from: (xsd) => reverse[xsd] ?? xsd,
|
|
96
|
+
/** The forward map (user → XSD) */
|
|
97
|
+
forward,
|
|
98
|
+
/** The reverse map (XSD → user) */
|
|
99
|
+
reverse
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const xsdRectAlignment = bidi({
|
|
103
|
+
topLeft: "tl",
|
|
104
|
+
top: "t",
|
|
105
|
+
topRight: "tr",
|
|
106
|
+
left: "l",
|
|
107
|
+
center: "ctr",
|
|
108
|
+
right: "r",
|
|
109
|
+
bottomLeft: "bl",
|
|
110
|
+
bottom: "b",
|
|
111
|
+
bottomRight: "br"
|
|
112
|
+
});
|
|
113
|
+
const xsdTextAlign = bidi({
|
|
114
|
+
left: "l",
|
|
115
|
+
center: "ctr",
|
|
116
|
+
right: "r",
|
|
117
|
+
justify: "just"
|
|
118
|
+
});
|
|
119
|
+
const xsdTextAnchor = bidi({
|
|
120
|
+
top: "t",
|
|
121
|
+
center: "ctr",
|
|
122
|
+
bottom: "b"
|
|
123
|
+
});
|
|
124
|
+
const xsdLineCap = bidi({
|
|
125
|
+
round: "rnd",
|
|
126
|
+
square: "sq",
|
|
127
|
+
flat: "flat"
|
|
128
|
+
});
|
|
129
|
+
const xsdCompoundLine = bidi({
|
|
130
|
+
single: "sng",
|
|
131
|
+
double: "dbl",
|
|
132
|
+
thickThin: "thickThin",
|
|
133
|
+
thinThick: "thinThick",
|
|
134
|
+
triple: "tri"
|
|
135
|
+
});
|
|
136
|
+
const xsdPenAlignment = bidi({
|
|
137
|
+
center: "ctr",
|
|
138
|
+
inside: "in"
|
|
139
|
+
});
|
|
140
|
+
const xsdLineEndSize = bidi({
|
|
141
|
+
small: "sm",
|
|
142
|
+
medium: "med",
|
|
143
|
+
large: "lg"
|
|
144
|
+
});
|
|
145
|
+
const xsdBlendMode = bidi({
|
|
146
|
+
over: "over",
|
|
147
|
+
multiply: "mult",
|
|
148
|
+
screen: "screen",
|
|
149
|
+
darken: "darken",
|
|
150
|
+
lighten: "lighten"
|
|
151
|
+
});
|
|
152
|
+
const xsdPathFillMode = bidi({
|
|
153
|
+
none: "none",
|
|
154
|
+
normal: "norm",
|
|
155
|
+
lighten: "lighten",
|
|
156
|
+
lightenLess: "lightenLess",
|
|
157
|
+
darken: "darken",
|
|
158
|
+
darkenLess: "darkenLess"
|
|
159
|
+
});
|
|
160
|
+
const xsdEffectContainer = bidi({
|
|
161
|
+
sibling: "sib",
|
|
162
|
+
tree: "tree"
|
|
163
|
+
});
|
|
164
|
+
const xsdPresetShadow = bidi({
|
|
165
|
+
shadow1: "shdw1",
|
|
166
|
+
shadow2: "shdw2",
|
|
167
|
+
shadow3: "shdw3",
|
|
168
|
+
shadow4: "shdw4",
|
|
169
|
+
shadow5: "shdw5",
|
|
170
|
+
shadow6: "shdw6",
|
|
171
|
+
shadow7: "shdw7",
|
|
172
|
+
shadow8: "shdw8",
|
|
173
|
+
shadow9: "shdw9",
|
|
174
|
+
shadow10: "shdw10",
|
|
175
|
+
shadow11: "shdw11",
|
|
176
|
+
shadow12: "shdw12",
|
|
177
|
+
shadow13: "shdw13",
|
|
178
|
+
shadow14: "shdw14",
|
|
179
|
+
shadow15: "shdw15",
|
|
180
|
+
shadow16: "shdw16",
|
|
181
|
+
shadow17: "shdw17",
|
|
182
|
+
shadow18: "shdw18",
|
|
183
|
+
shadow19: "shdw19",
|
|
184
|
+
shadow20: "shdw20"
|
|
185
|
+
});
|
|
186
|
+
const xsdMaterialType = bidi({
|
|
187
|
+
legacyMatte: "legacyMatte",
|
|
188
|
+
legacyPlastic: "legacyPlastic",
|
|
189
|
+
legacyMetal: "legacyMetal",
|
|
190
|
+
legacyWireframe: "legacyWireframe",
|
|
191
|
+
matte: "matte",
|
|
192
|
+
plastic: "plastic",
|
|
193
|
+
metal: "metal",
|
|
194
|
+
warmMatte: "warmMatte",
|
|
195
|
+
translucentPowder: "translucentPowder",
|
|
196
|
+
powder: "powder",
|
|
197
|
+
darkEdge: "dkEdge",
|
|
198
|
+
softEdge: "softEdge",
|
|
199
|
+
clear: "clear",
|
|
200
|
+
flat: "flat",
|
|
201
|
+
softMetal: "softmetal"
|
|
202
|
+
});
|
|
203
|
+
const xsdPattern = bidi({
|
|
204
|
+
percent5: "pct5",
|
|
205
|
+
percent10: "pct10",
|
|
206
|
+
percent20: "pct20",
|
|
207
|
+
percent25: "pct25",
|
|
208
|
+
percent30: "pct30",
|
|
209
|
+
percent40: "pct40",
|
|
210
|
+
percent50: "pct50",
|
|
211
|
+
percent60: "pct60",
|
|
212
|
+
percent70: "pct70",
|
|
213
|
+
percent75: "pct75",
|
|
214
|
+
percent80: "pct80",
|
|
215
|
+
percent90: "pct90",
|
|
216
|
+
horizontal: "horz",
|
|
217
|
+
vertical: "vert",
|
|
218
|
+
lightHorizontal: "ltHorz",
|
|
219
|
+
lightVertical: "ltVert",
|
|
220
|
+
darkHorizontal: "dkHorz",
|
|
221
|
+
darkVertical: "dkVert",
|
|
222
|
+
narrowHorizontal: "narHorz",
|
|
223
|
+
narrowVertical: "narVert",
|
|
224
|
+
dashedHorizontal: "dashHorz",
|
|
225
|
+
dashedVertical: "dashVert",
|
|
226
|
+
cross: "cross",
|
|
227
|
+
downDiagonal: "dnDiag",
|
|
228
|
+
upDiagonal: "upDiag",
|
|
229
|
+
lightDownDiagonal: "ltDnDiag",
|
|
230
|
+
lightUpDiagonal: "ltUpDiag",
|
|
231
|
+
darkDownDiagonal: "dkDnDiag",
|
|
232
|
+
darkUpDiagonal: "dkUpDiag",
|
|
233
|
+
wideDownDiagonal: "wdDnDiag",
|
|
234
|
+
wideUpDiagonal: "wdUpDiag",
|
|
235
|
+
dashedDownDiagonal: "dashDnDiag",
|
|
236
|
+
dashedUpDiagonal: "dashUpDiag",
|
|
237
|
+
diagonalCross: "diagCross",
|
|
238
|
+
smallChecker: "smCheck",
|
|
239
|
+
largeChecker: "lgCheck",
|
|
240
|
+
smallGrid: "smGrid",
|
|
241
|
+
largeGrid: "lgGrid",
|
|
242
|
+
dotGrid: "dotGrid",
|
|
243
|
+
smallConfetti: "smConfetti",
|
|
244
|
+
largeConfetti: "lgConfetti",
|
|
245
|
+
horizontalBrick: "horzBrick",
|
|
246
|
+
diagonalBrick: "diagBrick",
|
|
247
|
+
solidDiamond: "solidDmnd",
|
|
248
|
+
openDiamond: "openDmnd",
|
|
249
|
+
dottedDiamond: "dotDmnd",
|
|
250
|
+
plaid: "plaid",
|
|
251
|
+
sphere: "sphere",
|
|
252
|
+
weave: "weave",
|
|
253
|
+
divot: "divot",
|
|
254
|
+
shingle: "shingle",
|
|
255
|
+
wave: "wave",
|
|
256
|
+
trellis: "trellis",
|
|
257
|
+
zigZag: "zigZag"
|
|
258
|
+
});
|
|
259
|
+
const xsdVerticalMergeRev = bidi({
|
|
260
|
+
continue: "cont",
|
|
261
|
+
restart: "rest"
|
|
262
|
+
});
|
|
263
|
+
const xsdUnderlineStyle = bidi({
|
|
264
|
+
single: "sng",
|
|
265
|
+
double: "dbl",
|
|
266
|
+
none: "none"
|
|
267
|
+
});
|
|
268
|
+
const xsdStrikeStyle = bidi({
|
|
269
|
+
singleStrike: "sngStrike",
|
|
270
|
+
doubleStrike: "dblStrike",
|
|
271
|
+
noStrike: "noStrike"
|
|
272
|
+
});
|
|
273
|
+
const xsdTextCaps = bidi({
|
|
274
|
+
none: "none",
|
|
275
|
+
all: "all",
|
|
276
|
+
small: "small"
|
|
277
|
+
});
|
|
278
|
+
//#endregion
|
|
279
|
+
export { convertPointsToEmu as A, convertEmuToInches as C, convertInchesToTwip as D, convertInchesToEmu as E, convertMillimetersToTwip as O, uniqueUuid as S, convertEmuToPoints as T, xsdUnderlineStyle as _, xsdLineCap as a, uniqueId as b, xsdPathFillMode as c, xsdPresetShadow as d, xsdRectAlignment as f, xsdTextCaps as g, xsdTextAnchor as h, xsdEffectContainer as i, convertPixelsToEmu as k, xsdPattern as l, xsdTextAlign as m, xsdBlendMode as n, xsdLineEndSize as o, xsdStrikeStyle as p, xsdCompoundLine as r, xsdMaterialType as s, invertMap as t, xsdPenAlignment as u, xsdVerticalMergeRev as v, convertEmuToPixels as w, uniqueNumericIdCreator as x, hashedId as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/core",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Shared OOXML infrastructure: XmlComponent, value validators, unit converters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"core",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"fflate": "0.8.3",
|
|
60
60
|
"hash.js": "1.1.7",
|
|
61
61
|
"nanoid": "5.1.11",
|
|
62
|
-
"@office-open/xml": "0.6.
|
|
62
|
+
"@office-open/xml": "0.6.4"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"dev": "basis build --stub",
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import hash from "hash.js";
|
|
2
|
-
import { customAlphabet, nanoid } from "nanoid/non-secure";
|
|
3
|
-
//#region src/converters.ts
|
|
4
|
-
/**
|
|
5
|
-
* OOXML unit conversion utilities.
|
|
6
|
-
*
|
|
7
|
-
* @module
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Converts millimeters to TWIP (twentieths of a point).
|
|
11
|
-
*/
|
|
12
|
-
const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
|
|
13
|
-
/**
|
|
14
|
-
* Converts inches to TWIP (twentieths of a point).
|
|
15
|
-
*/
|
|
16
|
-
const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
|
|
17
|
-
/**
|
|
18
|
-
* Converts pixels to EMU (96 DPI).
|
|
19
|
-
*/
|
|
20
|
-
const convertPixelsToEmu = (pixels) => Math.round(pixels * 9525);
|
|
21
|
-
/**
|
|
22
|
-
* Converts EMU to pixels (96 DPI).
|
|
23
|
-
*/
|
|
24
|
-
const convertEmuToPixels = (emus) => Math.round(emus / 9525);
|
|
25
|
-
/**
|
|
26
|
-
* Converts inches to EMU.
|
|
27
|
-
*/
|
|
28
|
-
const convertInchesToEmu = (inches) => Math.round(inches * 914400);
|
|
29
|
-
/**
|
|
30
|
-
* Converts EMU to inches.
|
|
31
|
-
*/
|
|
32
|
-
const convertEmuToInches = (emus) => emus / 914400;
|
|
33
|
-
/**
|
|
34
|
-
* Converts points to EMU.
|
|
35
|
-
*/
|
|
36
|
-
const convertPointsToEmu = (points) => Math.round(points * 12700);
|
|
37
|
-
/**
|
|
38
|
-
* Converts EMU to points.
|
|
39
|
-
*/
|
|
40
|
-
const convertEmuToPoints = (emus) => emus / 12700;
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/id-generators.ts
|
|
43
|
-
/**
|
|
44
|
-
* Unique ID generation utilities.
|
|
45
|
-
*
|
|
46
|
-
* @module
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* Creates a unique numeric ID generator with sequential numbering.
|
|
50
|
-
*/
|
|
51
|
-
const uniqueNumericIdCreator = (initial = 0) => {
|
|
52
|
-
let currentCount = initial;
|
|
53
|
-
return () => ++currentCount;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Generates a unique lowercase alphanumeric ID using nanoid.
|
|
57
|
-
*/
|
|
58
|
-
const uniqueId = () => nanoid().toLowerCase();
|
|
59
|
-
/**
|
|
60
|
-
* Generates a SHA-1 hash of the provided data.
|
|
61
|
-
*/
|
|
62
|
-
const hashedId = (data) => hash.sha1().update(data instanceof ArrayBuffer ? new Uint8Array(data) : data).digest("hex");
|
|
63
|
-
/**
|
|
64
|
-
* Generates a random hexadecimal string of specified length.
|
|
65
|
-
*/
|
|
66
|
-
const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
|
|
67
|
-
/**
|
|
68
|
-
* Generates a UUID v4-style unique identifier.
|
|
69
|
-
*/
|
|
70
|
-
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
71
|
-
//#endregion
|
|
72
|
-
export { convertEmuToInches as a, convertInchesToEmu as c, convertPixelsToEmu as d, convertPointsToEmu as f, uniqueUuid as i, convertInchesToTwip as l, uniqueId as n, convertEmuToPixels as o, uniqueNumericIdCreator as r, convertEmuToPoints as s, hashedId as t, convertMillimetersToTwip as u };
|