oasis-editor 0.0.233 → 0.0.234

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.
@@ -8147,13 +8147,13 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
8147
8147
  styleId: e.styleId,
8148
8148
  bold: i(e.bold, r.bold, n.bold),
8149
8149
  italic: i(e.italic, r.italic, n.italic),
8150
- underline: o(r.underline, n.underline),
8151
- underlineStyle: o(r.underlineStyle, n.underlineStyle),
8150
+ underline: i(e.underline, r.underline, n.underline),
8151
+ underlineStyle: i(e.underlineStyle, r.underlineStyle, n.underlineStyle),
8152
8152
  underlineColor: o(r.underlineColor, n.underlineColor),
8153
8153
  strike: i(e.strike, r.strike, n.strike),
8154
8154
  doubleStrike: i(e.doubleStrike, r.doubleStrike, n.doubleStrike),
8155
- superscript: o(r.superscript, n.superscript),
8156
- subscript: o(r.subscript, n.subscript),
8155
+ superscript: i(e.superscript, r.superscript, n.superscript),
8156
+ subscript: i(e.subscript, r.subscript, n.subscript),
8157
8157
  smallCaps: i(e.smallCaps, r.smallCaps, n.smallCaps),
8158
8158
  allCaps: i(e.allCaps, r.allCaps, n.allCaps),
8159
8159
  hidden: i(e.hidden, r.hidden, n.hidden),
@@ -8179,7 +8179,7 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
8179
8179
  numberSpacing: o(r.numberSpacing, n.numberSpacing),
8180
8180
  numberForm: o(r.numberForm, n.numberForm),
8181
8181
  stylisticSet: o(r.stylisticSet, n.stylisticSet),
8182
- contextualAlternates: o(r.contextualAlternates, n.contextualAlternates),
8182
+ contextualAlternates: i(e.contextualAlternates, r.contextualAlternates, n.contextualAlternates),
8183
8183
  fontFamily: i(e.fontFamily, r.fontFamily, n.fontFamily),
8184
8184
  fontSize: i(e.fontSize, r.fontSize, n.fontSize),
8185
8185
  color: o(r.color, n.color),
@@ -8286,15 +8286,15 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
8286
8286
  }
8287
8287
  }
8288
8288
  const B = Pe(Re(e, ke, "cntxtAlts"), "val");
8289
- null === B ? Re(e, "http://schemas.microsoft.com/office/word/2010/wordml", "cntxtAlts") && (r.contextualAlternates = !0) : Le(B) && (r.contextualAlternates = !0);
8289
+ null === B ? Re(e, "http://schemas.microsoft.com/office/word/2010/wordml", "cntxtAlts") && (r.contextualAlternates = !0) : r.contextualAlternates = Le(B);
8290
8290
  const U = Re(e, Se, "u"), z = Pe(U, "val");
8291
- if (U && "none" !== z) {
8292
- r.underline = !0, z && "single" !== z && (r.underlineStyle = z);
8291
+ if (U) {
8292
+ r.underline = "none" !== z, r.underlineStyle = "none" === z ? null : z || "single";
8293
8293
  const e = Pe(U, "color");
8294
8294
  e && "auto" !== e && (r.underlineColor = Je(e));
8295
8295
  }
8296
8296
  const H = Pe(Re(e, Se, "vertAlign"), "val");
8297
- "superscript" === H && (r.superscript = !0), "subscript" === H && (r.subscript = !0);
8297
+ "superscript" !== H && "subscript" !== H && "baseline" !== H || (r.superscript = "superscript" === H, r.subscript = "subscript" === H);
8298
8298
  const j = Re(e, Se, "rFonts"), q = Pe(j, "ascii") ?? Pe(j, "hAnsi") ?? Pe(j, "cs") ?? Pe(j, "eastAsia") ?? function(e, t) {
8299
8299
  const r = Pe(e, "asciiTheme") ?? Pe(e, "hAnsiTheme") ?? Pe(e, "eastAsiaTheme") ?? Pe(e, "cstheme");
8300
8300
  if (!r) return;
@@ -12574,17 +12574,19 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
12574
12574
  };
12575
12575
  function Pi(e) {
12576
12576
  if (!e) return "";
12577
- const t = [];
12578
- if (e.bold && t.push("<w:b/>", "<w:bCs/>"), e.italic && t.push("<w:i/>", "<w:iCs/>"), e.underline) {
12577
+ const t = [], r = (e, ...r) => {
12578
+ if (null != e) for (const n of r) t.push(e ? `<w:${n}/>` : `<w:${n} w:val="0"/>`);
12579
+ };
12580
+ if (r(e.bold, "b", "bCs"), r(e.italic, "i", "iCs"), e.underline) {
12579
12581
  const r = e.underlineStyle ?? "single", n = e.underlineColor ? ` w:color="${ro(e.underlineColor.replace(/^#/, ""))}"` : "";
12580
12582
  t.push(`<w:u w:val="${ro(r)}"${n}/>`);
12581
- }
12582
- if (e.strike && t.push("<w:strike/>"), e.doubleStrike && t.push("<w:dstrike/>"), e.outline && t.push("<w:outline/>"), e.shadow && t.push("<w:shadow/>"), e.emboss && t.push("<w:emboss/>"), e.imprint && t.push("<w:imprint/>"), e.smallCaps && t.push("<w:smallCaps/>"), e.allCaps && t.push("<w:caps/>"), e.hidden && t.push("<w:vanish/>"), e.noProof && t.push("<w:noProof/>"), e.webHidden && t.push("<w:webHidden/>"), e.specVanish && t.push("<w:specVanish/>"), !1 === e.snapToGrid && t.push("<w:snapToGrid w:val=\"0\"/>"), e.textEffect && t.push(`<w:effect w:val="${ro(e.textEffect)}"/>`), e.textBorder && t.push(`<w:bdr ${mo(e.textBorder)}`), void 0 !== e.characterScale && null !== e.characterScale && Number.isFinite(e.characterScale) && t.push(`<w:w w:val="${Math.max(1, Math.round(e.characterScale))}"/>`), void 0 !== e.characterSpacing && null !== e.characterSpacing) {
12583
+ } else !1 === e.underline && t.push("<w:u w:val=\"none\"/>");
12584
+ if (r(e.strike, "strike"), r(e.doubleStrike, "dstrike"), r(e.outline, "outline"), r(e.shadow, "shadow"), r(e.emboss, "emboss"), r(e.imprint, "imprint"), r(e.smallCaps, "smallCaps"), r(e.allCaps, "caps"), r(e.hidden, "vanish"), r(e.noProof, "noProof"), r(e.webHidden, "webHidden"), r(e.specVanish, "specVanish"), !1 === e.snapToGrid && t.push("<w:snapToGrid w:val=\"0\"/>"), e.textEffect && t.push(`<w:effect w:val="${ro(e.textEffect)}"/>`), e.textBorder && t.push(`<w:bdr ${mo(e.textBorder)}`), void 0 !== e.characterScale && null !== e.characterScale && Number.isFinite(e.characterScale) && t.push(`<w:w w:val="${Math.max(1, Math.round(e.characterScale))}"/>`), void 0 !== e.characterSpacing && null !== e.characterSpacing) {
12583
12585
  const r = $i(e.characterSpacing);
12584
12586
  null !== r && t.push(`<w:spacing w:val="${r}"/>`);
12585
12587
  }
12586
12588
  void 0 !== e.baselineShift && null !== e.baselineShift && Number.isFinite(e.baselineShift) && t.push(`<w:position w:val="${Math.round(2 * e.baselineShift)}"/>`), void 0 !== e.kerningThreshold && null !== e.kerningThreshold && Number.isFinite(e.kerningThreshold) && t.push(`<w:kern w:val="${Math.max(0, Math.round(2 * e.kerningThreshold))}"/>`);
12587
- const r = function(e) {
12589
+ const n = function(e) {
12588
12590
  switch (e) {
12589
12591
  case "none": return "none";
12590
12592
  case "standard": return "standard";
@@ -12594,27 +12596,27 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
12594
12596
  default: return null;
12595
12597
  }
12596
12598
  }(e.ligatures);
12597
- r && t.push(`<w14:ligatures w14:val="${r}"/>`);
12598
- const n = function(e) {
12599
+ n && t.push(`<w14:ligatures w14:val="${n}"/>`);
12600
+ const o = function(e) {
12599
12601
  switch (e) {
12600
12602
  case "proportional": return "proportional";
12601
12603
  case "tabular": return "tabular";
12602
12604
  default: return null;
12603
12605
  }
12604
12606
  }(e.numberSpacing);
12605
- n && t.push(`<w14:numSpacing w14:val="${n}"/>`);
12606
- const o = function(e) {
12607
+ o && t.push(`<w14:numSpacing w14:val="${o}"/>`);
12608
+ const i = function(e) {
12607
12609
  switch (e) {
12608
12610
  case "lining": return "lining";
12609
12611
  case "oldStyle": return "oldStyle";
12610
12612
  default: return null;
12611
12613
  }
12612
12614
  }(e.numberForm);
12613
- o && t.push(`<w14:numForm w14:val="${o}"/>`);
12614
- const i = function(e) {
12615
+ i && t.push(`<w14:numForm w14:val="${i}"/>`);
12616
+ const a = function(e) {
12615
12617
  return "number" != typeof e || e < 1 || e > 20 ? null : (1 << e - 1).toString(16).toUpperCase().padStart(8, "0");
12616
12618
  }(e.stylisticSet);
12617
- if (i && t.push(`<w14:stylisticSets w14:val="${i}"/>`), e.contextualAlternates && t.push("<w14:cntxtAlts w14:val=\"1\"/>"), e.superscript ? t.push("<w:vertAlign w:val=\"superscript\"/>") : e.subscript && t.push("<w:vertAlign w:val=\"subscript\"/>"), e.fontFamily && t.push(`<w:rFonts w:ascii="${ro(e.fontFamily)}" w:hAnsi="${ro(e.fontFamily)}" w:cs="${ro(e.fontFamily)}"/>`), void 0 !== e.fontSize && null !== e.fontSize) {
12619
+ if (a && t.push(`<w14:stylisticSets w14:val="${a}"/>`), void 0 !== e.contextualAlternates && t.push(`<w14:cntxtAlts w14:val="${e.contextualAlternates ? 1 : 0}"/>`), e.superscript ? t.push("<w:vertAlign w:val=\"superscript\"/>") : e.subscript ? t.push("<w:vertAlign w:val=\"subscript\"/>") : !1 !== e.superscript && !1 !== e.subscript || t.push("<w:vertAlign w:val=\"baseline\"/>"), e.fontFamily && t.push(`<w:rFonts w:ascii="${ro(e.fontFamily)}" w:hAnsi="${ro(e.fontFamily)}" w:cs="${ro(e.fontFamily)}"/>`), void 0 !== e.fontSize && null !== e.fontSize) {
12618
12620
  const r = function(e) {
12619
12621
  return null != e && Number.isFinite(e) ? Math.round(e / 96 * 72 * 2) : null;
12620
12622
  }(e.fontSize);
@@ -12655,7 +12657,7 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
12655
12657
  const r = $i(e.fitText);
12656
12658
  null !== r && r > 0 && t.push(`<w:fitText w:val="${r}"/>`);
12657
12659
  }
12658
- if (e.rtl && t.push("<w:rtl/>"), e.complexScript && t.push("<w:cs/>"), e.emphasisMark && t.push(`<w:em w:val="${ro(e.emphasisMark)}"/>`), e.language) {
12660
+ if (r(e.rtl, "rtl"), r(e.complexScript, "cs"), e.emphasisMark && t.push(`<w:em w:val="${ro(e.emphasisMark)}"/>`), e.language) {
12659
12661
  const r = [];
12660
12662
  e.language.value && r.push(`w:val="${ro(e.language.value)}"`), e.language.eastAsia && r.push(`w:eastAsia="${ro(e.language.eastAsia)}"`), e.language.bidi && r.push(`w:bidi="${ro(e.language.bidi)}"`), r.length > 0 && t.push(`<w:lang ${r.join(" ")}/>`);
12661
12663
  }
@@ -13057,7 +13059,8 @@ while (n === s[++o] && n === s[++o] && n === s[++o] && n === s[++o] && n === s[+
13057
13059
  shading: n.shading,
13058
13060
  language: n.language,
13059
13061
  propertyRevision: e.styles?.propertyRevision
13060
- };
13062
+ }, i = oe(e.styles?.styleId ? { styleId: e.styles.styleId } : void 0, t, r);
13063
+ for (const a of Object.keys(o)) !1 === o[a] && !1 !== e.styles?.[a] && !0 !== i[a] && delete o[a];
13061
13064
  return e.styles?.link && (o.link = e.styles.link), o;
13062
13065
  }(e, r, n), s = () => Pi(a), l = () => `<w:r>${s()}${Oi(e.text)}</w:r>`;
13063
13066
  return fa(e, z(e, {