@poe-platform/safe-bash 0.1.750 → 0.1.752

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.
@@ -100951,13 +100951,35 @@ function metadataNode(value3, charge) {
100951
100951
  }
100952
100952
  return visit(value3);
100953
100953
  }
100954
+ var richUnderlines = {
100955
+ none: "none",
100956
+ single: "single",
100957
+ double: "double",
100958
+ low: "singleAccounting",
100959
+ error: "single",
100960
+ "single-line": "single",
100961
+ "double-line": "double",
100962
+ "error-line": "single",
100963
+ singleAccounting: "singleAccounting",
100964
+ doubleAccounting: "doubleAccounting"
100965
+ };
100954
100966
  function writeRichString(value3, runs, xml2, charge, target = "cell") {
100955
100967
  charge?.(value3.length);
100956
100968
  const t = (text2) => xml2("t", text2.trim() !== text2 ? { "xml:space": "preserve" } : {}, escapeXlsx(encodeXlsxString(text2)));
100957
100969
  if (!runs?.length) return t(value3);
100958
100970
  charge?.(runs.length);
100959
- const bytes = new TextEncoder().encode(value3), decoder = new TextDecoder("UTF-8", { fatal: true });
100960
- const points = [.../* @__PURE__ */ new Set([0, bytes.length, ...runs.flatMap((run) => [run.start, run.end])])].sort((a3, b3) => a3 - b3);
100971
+ const length = new TextEncoder().encode(value3).length;
100972
+ const points = [.../* @__PURE__ */ new Set([0, length, ...runs.flatMap((run) => [run.start, run.end])])].sort((a3, b3) => a3 - b3);
100973
+ let byteOffset = 0, characterOffset = 0;
100974
+ const characters = points.map((point) => {
100975
+ while (byteOffset < point && characterOffset < value3.length) {
100976
+ const code = value3.codePointAt(characterOffset);
100977
+ byteOffset += code < 128 ? 1 : code < 2048 ? 2 : code < 65536 ? 3 : 4;
100978
+ characterOffset += code > 65535 ? 2 : 1;
100979
+ }
100980
+ if (byteOffset !== point) throw new SsconvertError("invalid-request", "Invalid rich text UTF-8 boundary");
100981
+ return characterOffset;
100982
+ });
100961
100983
  let result2 = target === "comment" ? xml2("r", {}, t("")) : "";
100962
100984
  for (let i = 0; i + 1 < points.length; i++) {
100963
100985
  charge?.(runs.length);
@@ -100973,9 +100995,11 @@ function writeRichString(value3, runs, xml2, charge, target = "cell") {
100973
100995
  if (attrs.size !== void 0) properties += xml2("sz", { val: Number(attrs.size) / 1024 });
100974
100996
  if (typeof attrs.family === "string") properties += xml2("rFont", { val: encodeXlsxString(attrs.family) });
100975
100997
  if (typeof attrs.color === "string") properties += xml2("color", { rgb: "FF" + attrs.color.split("x").join("").toUpperCase() });
100976
- if (typeof attrs.underline === "string") properties += xml2("u", { val: attrs.underline === "low" ? "singleAccounting" : attrs.underline === "error" ? "single" : attrs.underline });
100998
+ if (typeof attrs.underline === "string") properties += xml2("u", {
100999
+ val: Object.hasOwn(richUnderlines, attrs.underline) ? richUnderlines[attrs.underline] : "none"
101000
+ });
100977
101001
  if (attrs.subscript || attrs.superscript) properties += xml2("vertAlign", { val: attrs.subscript ? "subscript" : "superscript" });
100978
- result2 += xml2("r", {}, (properties || target === "comment" ? xml2("rPr", {}, properties) : "") + t(decoder.decode(bytes.subarray(start, end2))));
101002
+ result2 += xml2("r", {}, (properties || target === "comment" ? xml2("rPr", {}, properties) : "") + t(value3.slice(characters[i], characters[i + 1])));
100979
101003
  }
100980
101004
  return result2;
100981
101005
  }
@@ -136301,7 +136325,7 @@ function createHtmlWriter(profile) {
136301
136325
  closures.unshift(close);
136302
136326
  }
136303
136327
  }
136304
- put(encoded2(new TextDecoder().decode(bytes.subarray(from, to))));
136328
+ put(encoded2(new TextDecoder("utf-8", { ignoreBOM: true }).decode(bytes.subarray(from, to))));
136305
136329
  for (const closure of closures) put(closure);
136306
136330
  }
136307
136331
  } else if (cell) put(encoded2(await renderCellText(cell, book, context, "preserve")));
@@ -144460,7 +144484,11 @@ function odfCellStyle(node3, parent, charge) {
144460
144484
  const italic = attr4(p2, "font-style", "fo");
144461
144485
  if (italic !== void 0) font2.Italic = italic === "italic" || italic === "oblique" ? 1 : 0;
144462
144486
  const underline = attr4(p2, "text-underline-style", "style");
144463
- if (underline !== void 0) font2.Underline = underline === "none" ? 0 : attr4(p2, "text-underline-type", "style") === "double" ? 2 : 1;
144487
+ if (underline !== void 0) {
144488
+ const type = attr4(p2, "text-underline-type", "style");
144489
+ const double = type === "double" || attr4(p2, "text-underline-width", "style") === "bold";
144490
+ font2.Underline = underline === "none" || type === "none" ? 0 : (double ? 2 : 1) + (attr4(p2, "text-underline-placement", "gnm") === "low" ? 2 : 0);
144491
+ }
144464
144492
  const strike = attr4(p2, "text-line-through-style", "style");
144465
144493
  if (strike !== void 0) font2.StrikeThrough = strike === "none" ? 0 : 1;
144466
144494
  family = attr4(p2, "font-family", "fo") ?? attr4(p2, "font-name", "style") ?? family;
@@ -144964,8 +144992,13 @@ function createOdfStyles(xml2, extended, book, context) {
144964
144992
  if (f2.Bold !== void 0) text2["fo:font-weight"] = Number(f2.Bold) ? "bold" : "normal";
144965
144993
  if (f2.Italic !== void 0) text2["fo:font-style"] = Number(f2.Italic) ? "italic" : "normal";
144966
144994
  if (f2.Underline !== void 0) {
144967
- text2["style:text-underline-style"] = Number(f2.Underline) ? "solid" : "none";
144968
- text2["style:text-underline-type"] = Number(f2.Underline) === 2 ? "double" : "single";
144995
+ const underline = Number(f2.Underline), low = underline === 3 || underline === 4;
144996
+ text2["style:text-underline-style"] = underline ? "solid" : "none";
144997
+ text2["style:text-underline-type"] = underline === 2 || underline === 4 ? "double" : underline ? "single" : "none";
144998
+ text2["style:text-underline-width"] = "auto";
144999
+ text2["style:text-underline-color"] = "font-color";
145000
+ text2["style:text-underline-mode"] = "continuous";
145001
+ if (extended && low) text2["gnm:text-underline-placement"] = "low";
144969
145002
  }
144970
145003
  if (f2.StrikeThrough !== void 0) text2["style:text-line-through-style"] = Number(f2.StrikeThrough) ? "solid" : "none";
144971
145004
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.750",
3
+ "version": "0.1.752",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -645,7 +645,7 @@
645
645
  "access": "public"
646
646
  },
647
647
  "dependencies": {
648
- "@poe-platform/safe-fs": "0.1.750",
648
+ "@poe-platform/safe-fs": "0.1.752",
649
649
  "pdf-lib": "1.17.1",
650
650
  "@types/node": "^25.2.2",
651
651
  "pako": "3.0.1",