@office-open/core 0.5.0 → 0.5.1
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/index.d.mts +3 -3
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
package/dist/chart/index.d.mts
CHANGED
|
@@ -71,7 +71,7 @@ interface IChartTypeOptions {
|
|
|
71
71
|
readonly series: readonly IChartSeriesData[];
|
|
72
72
|
readonly categories: readonly string[];
|
|
73
73
|
}
|
|
74
|
-
declare const createChartType: (options: IChartTypeOptions) => BarChart | LineChart | PieChart | AreaChart
|
|
74
|
+
declare const createChartType: (options: IChartTypeOptions) => ScatterChart | BarChart | LineChart | PieChart | AreaChart;
|
|
75
75
|
//#endregion
|
|
76
76
|
//#region src/chart/chart-space.d.ts
|
|
77
77
|
interface IChartSpaceOptions {
|
package/dist/index.d.mts
CHANGED
|
@@ -223,8 +223,8 @@ declare class ParsedDocument {
|
|
|
223
223
|
/** Serialize back to a ZIP buffer, merging original zip + modifications. */
|
|
224
224
|
save(): Uint8Array;
|
|
225
225
|
}
|
|
226
|
-
/** Parse an OOXML
|
|
227
|
-
declare function
|
|
226
|
+
/** Parse an OOXML archive (.docx, .pptx, .xlsx) into a ParsedDocument. */
|
|
227
|
+
declare function parseArchive(data: Uint8Array): ParsedDocument;
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/raw-passthrough.d.ts
|
|
230
230
|
/**
|
|
@@ -271,4 +271,4 @@ interface SmartArtRelOptions {
|
|
|
271
271
|
declare function replaceSmartArtPlaceholders(xml: string, keys: readonly string[], dataOffset: number, idFormat?: IdFormat): string;
|
|
272
272
|
declare function addSmartArtRelationships(keys: readonly string[], addRel: (id: number, type: RelationshipType, target: string, targetMode?: string) => void, baseOffset: number, globalStartIndex: number, options: SmartArtRelOptions): void;
|
|
273
273
|
//#endregion
|
|
274
|
-
export { AppProperties, AttributeData, AttributeMap, AttributePayload, BaseXmlComponent, BuilderElement, COLOR_CATEGORIES, Connection, ContentTypeAttributes, CoreProperties, DEFAULT_DRAWING_XML, DataModel, type DefaultAttributes, EMPTY_OBJECT, EmptyElement, Formatter, HpsMeasureElement, IContext, ISmartArtData, ITreeNode, IXmlAttribute, IXmlableObject, IXmlifyedFile, IdFormat, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, NextAttributeComponent, NumberValueElement, OnOffElement, OoxmlMimeType, OutputByType, OutputType, type OverrideAttributes, ParsedDocument, Percentage, Point, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RawPassthrough, Relationship, type RelationshipType, Relationships, RelativeMeasure, STYLE_CATEGORIES, SmartArtCollection, SmartArtRelOptions, StringContainer, StringEnumValueElement, StringValueElement, TargetModeType, ThemeColor, ThemeFont, TransPoint, UniqueNumericIdCreator, UniversalMeasure, XmlAttributeComponent, XmlComponent, addSmartArtRelationships, buildCorePropertiesXml, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createDataModel, createDefault, createOverride, 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,
|
|
274
|
+
export { AppProperties, AttributeData, AttributeMap, AttributePayload, BaseXmlComponent, BuilderElement, COLOR_CATEGORIES, Connection, ContentTypeAttributes, CoreProperties, DEFAULT_DRAWING_XML, DataModel, type DefaultAttributes, EMPTY_OBJECT, EmptyElement, Formatter, HpsMeasureElement, IContext, ISmartArtData, ITreeNode, IXmlAttribute, IXmlableObject, IXmlifyedFile, IdFormat, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, NextAttributeComponent, NumberValueElement, OnOffElement, OoxmlMimeType, OutputByType, OutputType, type OverrideAttributes, ParsedDocument, Percentage, Point, PositivePercentage, PositiveUniversalMeasure, PrettifyType, RawPassthrough, Relationship, type RelationshipType, Relationships, RelativeMeasure, STYLE_CATEGORIES, SmartArtCollection, SmartArtRelOptions, StringContainer, StringEnumValueElement, StringValueElement, TargetModeType, ThemeColor, ThemeFont, TransPoint, UniqueNumericIdCreator, UniversalMeasure, XmlAttributeComponent, XmlComponent, addSmartArtRelationships, buildCorePropertiesXml, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createDataModel, createDefault, createOverride, 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, parseRels, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, readAllXmlParts, readBinaryFromZip, readTextFromZip, readXmlFromZip, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, stringContainerObj, stringEnumValObj, stringValObj, twipsMeasureValue, uCharHexNumber, uint8ToBase64, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipToMap, wrapEl, zipToBuffer };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,E as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as ee,l as te,m as ne,n as re,o as ie,p as ae,r as f,s as oe,t as se,u as ce,v as le,w as ue,x as de,y as fe}from"./xml-components-Csq7gWPd.mjs";import{ThemeColor as pe,ThemeFont as me,dateTimeValue as he,decimalNumber as p,eighthPointMeasureValue as m,hexBinary as h,hexColorValue as g,hpsMeasureValue as _,longHexNumber as v,measurementOrPercentValue as y,percentageValue as b,pointMeasureValue as x,positiveUniversalMeasureValue as S,shortHexNumber as C,signedHpsMeasureValue as w,signedTwipsMeasureValue as T,twipsMeasureValue as E,uCharHexNumber as D,universalMeasureValue as O,unsignedDecimalNumber as k}from"./values.mjs";import{a as A,c as j,d as M,f as N,i as P,l as F,n as I,o as L,r as R,s as ge,t as _e,u as ve}from"./id-generators-Dd0w7vti.mjs";import{a as ye,c as be,d as xe,f as Se,i as Ce,l as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,u as z}from"./smartart-C-ZIRmWU.mjs";import{elementToXml as je,findRel as Me,findRelsByType as Ne,getImageType as Pe,listFiles as Fe,parseRels as Ie,readAllXmlParts as Le,readBinaryFromZip as Re,readTextFromZip as ze,readXmlFromZip as B,uint8ToBase64 as Be,unzipToMap as V,zipToBuffer as H}from"./archive.mjs";import{js2xml as Ve,textOf as U,xml2js as W}from"@office-open/xml";import{strFromU8 as G,strToU8 as He}from"fflate";const K={DOCX:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,PPTX:`application/vnd.openxmlformats-officedocument.presentationml.presentation`},Ue=(e,t,n=K.DOCX)=>{switch(t){case`nodebuffer`:return Buffer.from(e);case`blob`:return new Blob([e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)],{type:n});case`arraybuffer`:return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case`uint8array`:return e;case`base64`:return btoa(G(e,!0));case`string`:case`text`:case`binarystring`:return G(e,!0);case`array`:return[...e];default:return e}},q={NONE:``,WITH_2_BLANKS:` `,WITH_4_BLANKS:` `,WITH_TAB:` `},We=e=>e===!0?q.WITH_2_BLANKS:e===!1?void 0:e;var Ge=class e extends f{static instance=f.fromXmlString(`<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"/>`);constructor(){super(`Properties`)}prepForXml(){return e.instance.prepForXml({stack:[]})}};const Ke={EXTERNAL:`External`},qe={_attr:{xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}};var Je=class extends t{entries=[];constructor(){super(`Relationships`)}addRelationship(e,t,n,r){this.entries.push({id:`rId${e}`,type:t,target:n,targetMode:r})}get RelationshipCount(){return this.entries.length}prepForXml(e){let t=[qe];for(let e of this.entries){let n={Id:e.id,Type:e.type,Target:e.target};e.targetMode&&(n.TargetMode=e.targetMode),t.push({Relationship:{_attr:n}})}return t.length===1&&`_attr`in t[0]?{Relationships:t[0]}:{Relationships:t}}};const Ye=(e,t)=>new a({attributes:{contentType:{key:`ContentType`,value:e},extension:{key:`Extension`,value:t}},name:`Default`}),Xe=(e,t)=>new a({attributes:{contentType:{key:`ContentType`,value:e},partName:{key:`PartName`,value:t}},name:`Override`});var Ze=class extends n{xmlKeys={xmlns:`xmlns`}},Qe=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error(`XMLComponent did not format correctly`)}formatToXml(e,t,n){let r=e.toXml(t);return n?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`+r:r}};const $e=[{name:`dc:title`,key:`title`},{name:`dc:subject`,key:`subject`},{name:`dc:creator`,key:`creator`},{name:`dc:description`,key:`description`},{name:`cp:keywords`,key:`keywords`},{name:`cp:lastModifiedBy`,key:`lastModifiedBy`}];function et(e){let t=B(e,`docProps/core.xml`);if(!t)return{};let n={};for(let e of $e){let r=t.elements?.find(t=>t.name===e.name),i=U(r)||void 0;i&&(n[e.key]=i)}let r=t.elements?.find(e=>e.name===`cp:revision`);if(r){let e=U(r);if(e){let t=Number(e);isNaN(t)||(n.revision=e)}}return n}const tt=Object.freeze({_attr:Object.freeze({"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`})}),J=Object.freeze({_attr:Object.freeze({"xsi:type":`dcterms:W3CDTF`})});function nt(e){let t=[tt];e.title&&t.push({"dc:title":[e.title]}),e.subject&&t.push({"dc:subject":[e.subject]}),e.creator&&t.push({"dc:creator":[e.creator]}),e.keywords&&t.push({"cp:keywords":[e.keywords]}),e.description&&t.push({"dc:description":[e.description]}),e.lastModifiedBy&&t.push({"cp:lastModifiedBy":[e.lastModifiedBy]}),e.revision&&t.push({"cp:revision":[String(e.revision)]});let n=new Date().toISOString();return t.push({"dcterms:created":[J,n]}),t.push({"dcterms:modified":[J,n]}),{"cp:coreProperties":t}}const Y={nativeTypeAttributes:!0,captureSpacesBetweenElements:!0};var X=class{zip;modified=new Map;wrapperCache=new Map;constructor(e){this.zip=e}get(e){let t=this.modified.get(e);if(t){let n=W(G(t),Y);return this.wrapperCache.set(e,n),n.elements?.find(e=>e.type===`element`)}let n=this.zip.get(e);if(n===void 0)return;let r=this.wrapperCache.get(e);if(r)return r.elements?.find(e=>e.type===`element`);let i=W(G(n),Y);return this.wrapperCache.set(e,i),i.elements?.find(e=>e.type===`element`)}set(e,t){let n=this.wrapperCache.get(e),r=Ve(n?{...n,elements:[{...t,type:`element`}]}:{elements:[{...t,type:`element`}]});this.modified.set(e,He(r))}getRaw(e){return this.modified.get(e)??this.zip.get(e)}setRaw(e,t){this.modified.set(e,t),this.wrapperCache.delete(e)}remove(e){return this.wrapperCache.delete(e),this.modified.delete(e)||this.zip.delete(e)}has(e){return this.modified.has(e)||this.zip.has(e)}keys(e){let t=new Set;for(let n of this.zip.keys())(!e||n.startsWith(e))&&t.add(n);for(let n of this.modified.keys())(!e||n.startsWith(e))&&t.add(n);return[...t]}save(){let e=new Map;for(let[t,n]of this.zip)this.modified.has(t)||e.set(t,n);for(let[t,n]of this.modified)e.set(t,n);return H(e)}};function rt(e){return new X(V(e))}function Z(e){let t={};if(e.attributes&&Object.keys(e.attributes).length>0&&(t._attributes=e.attributes),e.cdata?t._cdata=e.cdata:e.text!=null&&(t._text=e.text),e.elements)for(let n of e.elements){let e=n.name??`_unknown`,r=Z(n);t[e]?(Array.isArray(t[e])||(t[e]=[t[e]]),t[e].push(r)):t[e]=r}let n=e.name??`unknown`;return Object.keys(t).length===0?{[n]:{}}:{[n]:t}}var it=class extends t{constructor(e){super(e.name??`unknown`),this.element=e}prepForXml(e){return Z(this.element)}};const Q=(e,t,n)=>n===`rId`?`rId${e+t}`:`${e+t}`;function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function at(e){return e.includes(`{`)}function ot(e,t){let n=[],r=`{${t}`,i=0;for(;(i=e.indexOf(r,i))!==-1;){let t=i+r.length,a=e.indexOf(`}`,t);if(a===-1)break;let o=e.substring(t,a);o.length>0&&!n.includes(o)&&n.push(o),i=a+1}return n}function st(e,t,n,r=`rId`){let i=e;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{${$(e.fileName)}\\}`,`g`),Q(n,t,r))}),i}function ct(e,t){return t.filter(t=>e.includes(`{${t.fileName}}`))}function lt(e,t,n,r=`rId`){let i=e;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{chart:${$(e)}\\}`,`g`),Q(n,t,r))}),i}function ut(e,t,n,r=`rId`){let i=e,a=t.length,o=n+a,s=o+a,c=s+a;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{smartart:${$(e)}\\}`,`g`),Q(n,t,r)),i=i.replace(RegExp(`\\{smartart-lo:${$(e)}\\}`,`g`),Q(o,t,r)),i=i.replace(RegExp(`\\{smartart-qs:${$(e)}\\}`,`g`),Q(s,t,r)),i=i.replace(RegExp(`\\{smartart-cs:${$(e)}\\}`,`g`),Q(c,t,r))}),i}function dt(e,t,n,r,i){let{pathPrefix:a,styleRelType:o}=i,s=e.length,c=n+s,l=c+s,u=l+s;e.forEach((e,i)=>{let d=r+i;t(n+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData`,`${a}diagrams/data${d+1}.xml`),t(c+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout`,`${a}diagrams/layout${d+1}.xml`),t(l+i,o,`${a}diagrams/quickStyle${d+1}.xml`),t(u+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors`,`${a}diagrams/colors${d+1}.xml`),t(u+s+i,`http://schemas.microsoft.com/office/2007/relationships/diagramDrawing`,`${a}diagrams/drawing${d+1}.xml`)})}export{Ge as AppProperties,t as BaseXmlComponent,a as BuilderElement,xe as COLOR_CATEGORIES,Ee as Connection,Ze as ContentTypeAttributes,ke as DEFAULT_DRAWING_XML,ye as DataModel,e as EMPTY_OBJECT,ie as EmptyElement,Qe as Formatter,oe as HpsMeasureElement,ue as IgnoreIfEmptyXmlComponent,re as ImportedRootElementAttributes,f as ImportedXmlComponent,se as InitializableXmlComponent,Se as LAYOUT_CATEGORIES,de as NextAttributeComponent,s as NumberValueElement,te as OnOffElement,K as OoxmlMimeType,X as ParsedDocument,Oe as Point,q as PrettifyType,it as RawPassthrough,Je as Relationships,De as STYLE_CATEGORIES,Te as SmartArtCollection,ce as StringContainer,c as StringEnumValueElement,l as StringValueElement,Ke as TargetModeType,pe as ThemeColor,me as ThemeFont,Ce as TransPoint,n as XmlAttributeComponent,r as XmlComponent,dt as addSmartArtRelationships,nt as buildCorePropertiesXml,ae as chartAttr,ot as collectPlaceholderKeys,A as convertEmuToInches,L as convertEmuToPixels,ge as convertEmuToPoints,j as convertInchesToEmu,F as convertInchesToTwip,ve as convertMillimetersToTwip,Ue as convertOutput,M as convertPixelsToEmu,N as convertPointsToEmu,We as convertPrettifyType,ee as convertToXmlComponent,Ae as createDataModel,Ye as createDefault,Xe as createOverride,he as dateTimeValue,p as decimalNumber,m as eighthPointMeasureValue,Z as elementToCompact,je as elementToXml,$ as escapeRegex,Me as findRel,Ne as findRelsByType,Q as formatId,be as getColorXml,Pe as getImageType,we as getLayoutXml,ct as getReferencedMedia,z as getStyleXml,at as hasPlaceholders,_e as hashedId,h as hexBinary,g as hexColorValue,ne as hpsMeasureObj,_ as hpsMeasureValue,Fe as listFiles,v as longHexNumber,y as measurementOrPercentValue,d as numberValObj,u as onOffObj,et as parseCoreProperties,rt as parseDocument,Ie as parseRels,b as percentageValue,x as pointMeasureValue,S as positiveUniversalMeasureValue,Le as readAllXmlParts,Re as readBinaryFromZip,ze as readTextFromZip,B as readXmlFromZip,lt as replaceChartPlaceholders,st as replaceImagePlaceholders,ut as replaceSmartArtPlaceholders,C as shortHexNumber,w as signedHpsMeasureValue,T as signedTwipsMeasureValue,i as stringContainerObj,le as stringEnumValObj,fe as stringValObj,E as twipsMeasureValue,D as uCharHexNumber,Be as uint8ToBase64,I as uniqueId,R as uniqueNumericIdCreator,P as uniqueUuid,O as universalMeasureValue,k as unsignedDecimalNumber,V as unzipToMap,o as wrapEl,H as zipToBuffer};
|
|
1
|
+
import{C as e,E as t,S as n,T as r,_ as i,a,b as o,c as s,d as c,f as l,g as u,h as d,i as ee,l as te,m as ne,n as re,o as ie,p as ae,r as f,s as oe,t as se,u as ce,v as le,w as ue,x as de,y as fe}from"./xml-components-Csq7gWPd.mjs";import{ThemeColor as pe,ThemeFont as me,dateTimeValue as he,decimalNumber as p,eighthPointMeasureValue as m,hexBinary as h,hexColorValue as g,hpsMeasureValue as _,longHexNumber as v,measurementOrPercentValue as y,percentageValue as b,pointMeasureValue as x,positiveUniversalMeasureValue as S,shortHexNumber as C,signedHpsMeasureValue as w,signedTwipsMeasureValue as T,twipsMeasureValue as E,uCharHexNumber as D,universalMeasureValue as O,unsignedDecimalNumber as k}from"./values.mjs";import{a as A,c as j,d as M,f as N,i as P,l as F,n as I,o as L,r as R,s as ge,t as _e,u as ve}from"./id-generators-Dd0w7vti.mjs";import{a as ye,c as be,d as xe,f as Se,i as Ce,l as we,n as Te,o as Ee,p as De,r as Oe,s as ke,t as Ae,u as z}from"./smartart-C-ZIRmWU.mjs";import{elementToXml as je,findRel as Me,findRelsByType as Ne,getImageType as Pe,listFiles as Fe,parseRels as Ie,readAllXmlParts as Le,readBinaryFromZip as Re,readTextFromZip as ze,readXmlFromZip as B,uint8ToBase64 as Be,unzipToMap as V,zipToBuffer as H}from"./archive.mjs";import{js2xml as Ve,textOf as U,xml2js as W}from"@office-open/xml";import{strFromU8 as G,strToU8 as He}from"fflate";const K={DOCX:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,PPTX:`application/vnd.openxmlformats-officedocument.presentationml.presentation`},Ue=(e,t,n=K.DOCX)=>{switch(t){case`nodebuffer`:return Buffer.from(e);case`blob`:return new Blob([e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)],{type:n});case`arraybuffer`:return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);case`uint8array`:return e;case`base64`:return btoa(G(e,!0));case`string`:case`text`:case`binarystring`:return G(e,!0);case`array`:return[...e];default:return e}},q={NONE:``,WITH_2_BLANKS:` `,WITH_4_BLANKS:` `,WITH_TAB:` `},We=e=>e===!0?q.WITH_2_BLANKS:e===!1?void 0:e;var Ge=class e extends f{static instance=f.fromXmlString(`<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"/>`);constructor(){super(`Properties`)}prepForXml(){return e.instance.prepForXml({stack:[]})}};const Ke={EXTERNAL:`External`},qe={_attr:{xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}};var Je=class extends t{entries=[];constructor(){super(`Relationships`)}addRelationship(e,t,n,r){this.entries.push({id:`rId${e}`,type:t,target:n,targetMode:r})}get RelationshipCount(){return this.entries.length}prepForXml(e){let t=[qe];for(let e of this.entries){let n={Id:e.id,Type:e.type,Target:e.target};e.targetMode&&(n.TargetMode=e.targetMode),t.push({Relationship:{_attr:n}})}return t.length===1&&`_attr`in t[0]?{Relationships:t[0]}:{Relationships:t}}};const Ye=(e,t)=>new a({attributes:{contentType:{key:`ContentType`,value:e},extension:{key:`Extension`,value:t}},name:`Default`}),Xe=(e,t)=>new a({attributes:{contentType:{key:`ContentType`,value:e},partName:{key:`PartName`,value:t}},name:`Override`});var Ze=class extends n{xmlKeys={xmlns:`xmlns`}},Qe=class{format(e,t={stack:[]}){let n=e.prepForXml(t);if(n)return n;throw Error(`XMLComponent did not format correctly`)}formatToXml(e,t,n){let r=e.toXml(t);return n?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`+r:r}};const $e=[{name:`dc:title`,key:`title`},{name:`dc:subject`,key:`subject`},{name:`dc:creator`,key:`creator`},{name:`dc:description`,key:`description`},{name:`cp:keywords`,key:`keywords`},{name:`cp:lastModifiedBy`,key:`lastModifiedBy`}];function et(e){let t=B(e,`docProps/core.xml`);if(!t)return{};let n={};for(let e of $e){let r=t.elements?.find(t=>t.name===e.name),i=U(r)||void 0;i&&(n[e.key]=i)}let r=t.elements?.find(e=>e.name===`cp:revision`);if(r){let e=U(r);if(e){let t=Number(e);isNaN(t)||(n.revision=e)}}return n}const tt=Object.freeze({_attr:Object.freeze({"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`})}),J=Object.freeze({_attr:Object.freeze({"xsi:type":`dcterms:W3CDTF`})});function nt(e){let t=[tt];e.title&&t.push({"dc:title":[e.title]}),e.subject&&t.push({"dc:subject":[e.subject]}),e.creator&&t.push({"dc:creator":[e.creator]}),e.keywords&&t.push({"cp:keywords":[e.keywords]}),e.description&&t.push({"dc:description":[e.description]}),e.lastModifiedBy&&t.push({"cp:lastModifiedBy":[e.lastModifiedBy]}),e.revision&&t.push({"cp:revision":[String(e.revision)]});let n=new Date().toISOString();return t.push({"dcterms:created":[J,n]}),t.push({"dcterms:modified":[J,n]}),{"cp:coreProperties":t}}const Y={nativeTypeAttributes:!0,captureSpacesBetweenElements:!0};var X=class{zip;modified=new Map;wrapperCache=new Map;constructor(e){this.zip=e}get(e){let t=this.modified.get(e);if(t){let n=W(G(t),Y);return this.wrapperCache.set(e,n),n.elements?.find(e=>e.type===`element`)}let n=this.zip.get(e);if(n===void 0)return;let r=this.wrapperCache.get(e);if(r)return r.elements?.find(e=>e.type===`element`);let i=W(G(n),Y);return this.wrapperCache.set(e,i),i.elements?.find(e=>e.type===`element`)}set(e,t){let n=this.wrapperCache.get(e),r=Ve(n?{...n,elements:[{...t,type:`element`}]}:{elements:[{...t,type:`element`}]});this.modified.set(e,He(r))}getRaw(e){return this.modified.get(e)??this.zip.get(e)}setRaw(e,t){this.modified.set(e,t),this.wrapperCache.delete(e)}remove(e){return this.wrapperCache.delete(e),this.modified.delete(e)||this.zip.delete(e)}has(e){return this.modified.has(e)||this.zip.has(e)}keys(e){let t=new Set;for(let n of this.zip.keys())(!e||n.startsWith(e))&&t.add(n);for(let n of this.modified.keys())(!e||n.startsWith(e))&&t.add(n);return[...t]}save(){let e=new Map;for(let[t,n]of this.zip)this.modified.has(t)||e.set(t,n);for(let[t,n]of this.modified)e.set(t,n);return H(e)}};function rt(e){return new X(V(e))}function Z(e){let t={};if(e.attributes&&Object.keys(e.attributes).length>0&&(t._attributes=e.attributes),e.cdata?t._cdata=e.cdata:e.text!=null&&(t._text=e.text),e.elements)for(let n of e.elements){let e=n.name??`_unknown`,r=Z(n);t[e]?(Array.isArray(t[e])||(t[e]=[t[e]]),t[e].push(r)):t[e]=r}let n=e.name??`unknown`;return Object.keys(t).length===0?{[n]:{}}:{[n]:t}}var it=class extends t{constructor(e){super(e.name??`unknown`),this.element=e}prepForXml(e){return Z(this.element)}};const Q=(e,t,n)=>n===`rId`?`rId${e+t}`:`${e+t}`;function $(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function at(e){return e.includes(`{`)}function ot(e,t){let n=[],r=`{${t}`,i=0;for(;(i=e.indexOf(r,i))!==-1;){let t=i+r.length,a=e.indexOf(`}`,t);if(a===-1)break;let o=e.substring(t,a);o.length>0&&!n.includes(o)&&n.push(o),i=a+1}return n}function st(e,t,n,r=`rId`){let i=e;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{${$(e.fileName)}\\}`,`g`),Q(n,t,r))}),i}function ct(e,t){return t.filter(t=>e.includes(`{${t.fileName}}`))}function lt(e,t,n,r=`rId`){let i=e;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{chart:${$(e)}\\}`,`g`),Q(n,t,r))}),i}function ut(e,t,n,r=`rId`){let i=e,a=t.length,o=n+a,s=o+a,c=s+a;return t.forEach((e,t)=>{i=i.replace(RegExp(`\\{smartart:${$(e)}\\}`,`g`),Q(n,t,r)),i=i.replace(RegExp(`\\{smartart-lo:${$(e)}\\}`,`g`),Q(o,t,r)),i=i.replace(RegExp(`\\{smartart-qs:${$(e)}\\}`,`g`),Q(s,t,r)),i=i.replace(RegExp(`\\{smartart-cs:${$(e)}\\}`,`g`),Q(c,t,r))}),i}function dt(e,t,n,r,i){let{pathPrefix:a,styleRelType:o}=i,s=e.length,c=n+s,l=c+s,u=l+s;e.forEach((e,i)=>{let d=r+i;t(n+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData`,`${a}diagrams/data${d+1}.xml`),t(c+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout`,`${a}diagrams/layout${d+1}.xml`),t(l+i,o,`${a}diagrams/quickStyle${d+1}.xml`),t(u+i,`http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors`,`${a}diagrams/colors${d+1}.xml`),t(u+s+i,`http://schemas.microsoft.com/office/2007/relationships/diagramDrawing`,`${a}diagrams/drawing${d+1}.xml`)})}export{Ge as AppProperties,t as BaseXmlComponent,a as BuilderElement,xe as COLOR_CATEGORIES,Ee as Connection,Ze as ContentTypeAttributes,ke as DEFAULT_DRAWING_XML,ye as DataModel,e as EMPTY_OBJECT,ie as EmptyElement,Qe as Formatter,oe as HpsMeasureElement,ue as IgnoreIfEmptyXmlComponent,re as ImportedRootElementAttributes,f as ImportedXmlComponent,se as InitializableXmlComponent,Se as LAYOUT_CATEGORIES,de as NextAttributeComponent,s as NumberValueElement,te as OnOffElement,K as OoxmlMimeType,X as ParsedDocument,Oe as Point,q as PrettifyType,it as RawPassthrough,Je as Relationships,De as STYLE_CATEGORIES,Te as SmartArtCollection,ce as StringContainer,c as StringEnumValueElement,l as StringValueElement,Ke as TargetModeType,pe as ThemeColor,me as ThemeFont,Ce as TransPoint,n as XmlAttributeComponent,r as XmlComponent,dt as addSmartArtRelationships,nt as buildCorePropertiesXml,ae as chartAttr,ot as collectPlaceholderKeys,A as convertEmuToInches,L as convertEmuToPixels,ge as convertEmuToPoints,j as convertInchesToEmu,F as convertInchesToTwip,ve as convertMillimetersToTwip,Ue as convertOutput,M as convertPixelsToEmu,N as convertPointsToEmu,We as convertPrettifyType,ee as convertToXmlComponent,Ae as createDataModel,Ye as createDefault,Xe as createOverride,he as dateTimeValue,p as decimalNumber,m as eighthPointMeasureValue,Z as elementToCompact,je as elementToXml,$ as escapeRegex,Me as findRel,Ne as findRelsByType,Q as formatId,be as getColorXml,Pe as getImageType,we as getLayoutXml,ct as getReferencedMedia,z as getStyleXml,at as hasPlaceholders,_e as hashedId,h as hexBinary,g as hexColorValue,ne as hpsMeasureObj,_ as hpsMeasureValue,Fe as listFiles,v as longHexNumber,y as measurementOrPercentValue,d as numberValObj,u as onOffObj,rt as parseArchive,et as parseCoreProperties,Ie as parseRels,b as percentageValue,x as pointMeasureValue,S as positiveUniversalMeasureValue,Le as readAllXmlParts,Re as readBinaryFromZip,ze as readTextFromZip,B as readXmlFromZip,lt as replaceChartPlaceholders,st as replaceImagePlaceholders,ut as replaceSmartArtPlaceholders,C as shortHexNumber,w as signedHpsMeasureValue,T as signedTwipsMeasureValue,i as stringContainerObj,le as stringEnumValObj,fe as stringValObj,E as twipsMeasureValue,D as uCharHexNumber,Be as uint8ToBase64,I as uniqueId,R as uniqueNumericIdCreator,P as uniqueUuid,O as universalMeasureValue,k as unsignedDecimalNumber,V as unzipToMap,o as wrapEl,H as zipToBuffer};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-open/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
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.5.
|
|
62
|
+
"@office-open/xml": "0.5.1"
|
|
63
63
|
},
|
|
64
64
|
"scripts": {
|
|
65
65
|
"dev": "basis build --stub",
|