ooxml-core 1.19.2 → 1.20.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.
Files changed (75) hide show
  1. package/README.md +12 -1
  2. package/dist/{PptxHandler-2V4PQL6O.mjs → PptxHandler-FYD7IYXT.mjs} +2 -2
  3. package/dist/PptxHandler-SITN3K3F.mjs +4 -0
  4. package/dist/{PptxHandler-6TNIQ7S5.cjs → PptxHandler-TEKISCJO.cjs} +3 -3
  5. package/dist/{PresentationBuilder-HQ6C7L4V.mjs → PresentationBuilder-EYI6Z2JP.mjs} +2 -2
  6. package/dist/{PresentationBuilder-G7MPEGXJ.mjs → PresentationBuilder-IMB4DVRN.mjs} +2 -2
  7. package/dist/{PresentationBuilder-RM52LCVN.cjs → PresentationBuilder-NCKASKXU.cjs} +5 -5
  8. package/dist/automation/index.cjs +257 -30
  9. package/dist/automation/index.mjs +256 -31
  10. package/dist/automation/xlsx-read.d.ts +56 -0
  11. package/dist/automation/xlsx-read.d.ts.map +1 -0
  12. package/dist/automation/xlsx.d.ts +105 -4
  13. package/dist/automation/xlsx.d.ts.map +1 -1
  14. package/dist/{chunk-M6GDBVQ7.mjs → chunk-GQYQQ3GA.mjs} +1 -1
  15. package/dist/{chunk-SLNQNVQM.mjs → chunk-LEV2SVMK.mjs} +1 -1
  16. package/dist/{chunk-JUABSM7C.mjs → chunk-LVM3IZJ2.mjs} +1 -1
  17. package/dist/{chunk-TJPUAUWL.mjs → chunk-MN27HKHM.mjs} +8 -194
  18. package/dist/{chunk-4FTUAD2B.mjs → chunk-MNXKRXFB.mjs} +715 -200
  19. package/dist/{chunk-R5FIHHGB.cjs → chunk-NXKATFM5.cjs} +1598 -1204
  20. package/dist/{chunk-ZJ2OKIJN.mjs → chunk-WXY5EDGT.mjs} +592 -198
  21. package/dist/index.cjs +25 -0
  22. package/dist/index.mjs +25 -0
  23. package/dist/pptx/automation/index.cjs +887 -453
  24. package/dist/pptx/automation/index.d.ts +2 -2
  25. package/dist/pptx/automation/index.mjs +5 -5
  26. package/dist/pptx/chunks/{index-Bqm-jFG-.d.ts → index-CgFX0T7b.d.ts} +7573 -7508
  27. package/dist/pptx/chunks/index-CgFX0T7b.d.ts.map +1 -0
  28. package/dist/pptx/chunks/{index-B9x557hr.d.ts → index-qwVYoFn6.d.ts} +2 -2
  29. package/dist/pptx/chunks/{index-B9x557hr.d.ts.map → index-qwVYoFn6.d.ts.map} +1 -1
  30. package/dist/pptx/cli/index.cjs +654 -221
  31. package/dist/pptx/cli/index.mjs +4 -4
  32. package/dist/pptx/converter/index.d.ts +1 -1
  33. package/dist/pptx/converter/index.mjs +2 -2
  34. package/dist/pptx/editor/render/find-replace.cjs +14 -14
  35. package/dist/pptx/editor/render/find-replace.d.ts +1 -1
  36. package/dist/pptx/editor/render/find-replace.mjs +1 -1
  37. package/dist/pptx/editor/render/slide-operations.cjs +8 -8
  38. package/dist/pptx/editor/render/slide-operations.mjs +2 -2
  39. package/dist/pptx/index.cjs +991 -619
  40. package/dist/pptx/index.d.ts +3 -3
  41. package/dist/pptx/index.mjs +5 -5
  42. package/dist/visio/index.cjs +61 -7
  43. package/dist/visio/index.mjs +61 -7
  44. package/dist/visio/ui/contract.d.ts +2 -1
  45. package/dist/visio/ui/contract.d.ts.map +1 -1
  46. package/dist/visio/ui/index.cjs +62 -7
  47. package/dist/visio/ui/index.mjs +62 -7
  48. package/dist/xlsx/edit/dimensions.d.ts.map +1 -1
  49. package/dist/xlsx/edit/history-rows.d.ts +7 -0
  50. package/dist/xlsx/edit/history-rows.d.ts.map +1 -0
  51. package/dist/xlsx/edit/history.d.ts +11 -1
  52. package/dist/xlsx/edit/history.d.ts.map +1 -1
  53. package/dist/xlsx/edit/outline.d.ts.map +1 -1
  54. package/dist/xlsx/edit/row-autofit.d.ts.map +1 -1
  55. package/dist/xlsx/index.cjs +90 -16
  56. package/dist/xlsx/index.mjs +90 -16
  57. package/dist/xlsx/load/index.cjs +61 -7
  58. package/dist/xlsx/load/index.mjs +61 -7
  59. package/dist/xlsx/numfmt/format.d.ts +8 -0
  60. package/dist/xlsx/numfmt/format.d.ts.map +1 -1
  61. package/dist/xlsx/read/sheet-data-source.d.ts.map +1 -1
  62. package/dist/xlsx/ui/index.cjs +138 -16
  63. package/dist/xlsx/ui/index.d.ts +1 -0
  64. package/dist/xlsx/ui/index.d.ts.map +1 -1
  65. package/dist/xlsx/ui/index.mjs +138 -17
  66. package/dist/xlsx/ui/selection-format.d.ts +13 -0
  67. package/dist/xlsx/ui/selection-format.d.ts.map +1 -0
  68. package/dist/xml/index.cjs +25 -0
  69. package/dist/xml/index.mjs +25 -0
  70. package/dist/xml/lite.d.ts.map +1 -1
  71. package/package.json +1 -1
  72. package/dist/PptxHandler-HSPKEP5E.mjs +0 -4
  73. package/dist/pptx/chunks/index-Bqm-jFG-.d.ts.map +0 -1
  74. /package/dist/{chunk-NYTR4UZ5.cjs → chunk-3IENHIFD.cjs} +0 -0
  75. /package/dist/{chunk-XTSHZGSM.mjs → chunk-CC5UNZOO.mjs} +0 -0
@@ -11890,6 +11890,12 @@ function parseLiteFragment(xml, container, namespaces) {
11890
11890
  }
11891
11891
  if (lt < 0) break;
11892
11892
  const next = source2.charCodeAt(lt + 1);
11893
+ if (next === 33) {
11894
+ const after = skipCommentOrCdata(source2, lt, top);
11895
+ if (after < 0) return void 0;
11896
+ pos = after;
11897
+ continue;
11898
+ }
11893
11899
  if (next === 47) {
11894
11900
  const gt = source2.indexOf(">", lt);
11895
11901
  if (gt < 0 || stack2.length < 2 || source2.slice(lt + 2, gt).trimEnd() !== top.tagName)
@@ -11910,6 +11916,25 @@ function parseLiteFragment(xml, container, namespaces) {
11910
11916
  }
11911
11917
  return stack2.length === 1 ? root : void 0;
11912
11918
  }
11919
+ var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
11920
+ function skipCommentOrCdata(source2, lt, parent) {
11921
+ if (source2.startsWith("<!--", lt)) {
11922
+ const end = source2.indexOf("-->", lt + 4);
11923
+ if (end < 0) return -1;
11924
+ const body = source2.slice(lt + 4, end);
11925
+ if (body.includes("--") || body.endsWith("-") || DECLARATIONS.test(body)) return -1;
11926
+ return end + 3;
11927
+ }
11928
+ if (source2.startsWith("<![CDATA[", lt)) {
11929
+ const end = source2.indexOf("]]>", lt + 9);
11930
+ if (end < 0) return -1;
11931
+ const text4 = source2.slice(lt + 9, end);
11932
+ if (DECLARATIONS.test(text4)) return -1;
11933
+ parent.childNodes.push(text4);
11934
+ return end + 3;
11935
+ }
11936
+ return -1;
11937
+ }
11913
11938
  function startTag(source2, from, namespaces) {
11914
11939
  const n2 = source2.length;
11915
11940
  let i2 = from;
@@ -24862,21 +24887,50 @@ function rootNamespaces(xml) {
24862
24887
  for (const match2 of (root[2] ?? "").matchAll(DECLARATION2)) out[match2[1] ?? ""] = match2[3] ?? "";
24863
24888
  return out;
24864
24889
  }
24890
+ var SPECIAL = /<[!?]/g;
24891
+ var SECTIONS = [
24892
+ ["<!--", "-->"],
24893
+ ["<![CDATA[", "]]>"],
24894
+ ["<?", "?>"]
24895
+ ];
24896
+ function blankComments(xml) {
24897
+ if (!xml.includes("<!--") && !xml.includes("<![CDATA[")) return xml;
24898
+ const pieces = [];
24899
+ let copied = 0;
24900
+ SPECIAL.lastIndex = 0;
24901
+ for (let match2 = SPECIAL.exec(xml); match2; match2 = SPECIAL.exec(xml)) {
24902
+ const at = match2.index;
24903
+ const section = SECTIONS.find(([open2]) => xml.startsWith(open2, at));
24904
+ if (!section) return void 0;
24905
+ const [open, close2] = section;
24906
+ const end = xml.indexOf(close2, at + open.length);
24907
+ if (end < 0) return void 0;
24908
+ const after = end + close2.length;
24909
+ if (open !== "<?") {
24910
+ pieces.push(xml.slice(copied, at), " ".repeat(after - at));
24911
+ copied = after;
24912
+ }
24913
+ SPECIAL.lastIndex = after;
24914
+ }
24915
+ pieces.push(xml.slice(copied));
24916
+ return pieces.join("");
24917
+ }
24865
24918
  function splitSheetData(xml) {
24866
- if (xml.includes("<!--") || xml.includes("<![CDATA[")) return void 0;
24867
- const namespaces = rootNamespaces(xml);
24868
- const open = OPEN.exec(xml);
24919
+ const plain3 = blankComments(xml);
24920
+ if (plain3 === void 0) return void 0;
24921
+ const namespaces = rootNamespaces(plain3);
24922
+ const open = OPEN.exec(plain3);
24869
24923
  if (!namespaces || !open) return void 0;
24870
24924
  const prefix = (open[1] ?? "").slice(0, -1);
24871
24925
  const ns = namespaces[prefix];
24872
24926
  if (prefix && ns === void 0) return void 0;
24873
24927
  const tagName = `${open[1] ?? ""}sheetData`;
24874
- const openEnd = xml.indexOf(">", open.index);
24928
+ const openEnd = plain3.indexOf(">", open.index);
24875
24929
  if (openEnd < 0) return void 0;
24876
- const attributes = xml.slice(open.index + tagName.length + 1, openEnd);
24930
+ const attributes = plain3.slice(open.index + tagName.length + 1, openEnd);
24877
24931
  if (attributes.trimEnd().endsWith("/") || attributes.includes("xmlns")) return void 0;
24878
- const close2 = xml.indexOf(`</${tagName}`, openEnd);
24879
- if (close2 < 0 || OPEN.test(xml.slice(openEnd))) return void 0;
24932
+ const close2 = plain3.indexOf(`</${tagName}`, openEnd);
24933
+ if (close2 < 0 || OPEN.test(plain3.slice(openEnd))) return void 0;
24880
24934
  const container = new LiteElement(tagName, "sheetData", ns || null);
24881
24935
  const data = parseLiteFragment(xml.slice(openEnd + 1, close2), container, namespaces);
24882
24936
  if (!data) return void 0;
@@ -33667,7 +33721,7 @@ function setColumnWidth(ctx, s, cols, width, measure2) {
33667
33721
  ctx.run(
33668
33722
  "Column width",
33669
33723
  "view",
33670
- [{ kind: "sheet", sheet: s }],
33724
+ [{ kind: "parts", sheet: s, parts: ["columns"] }],
33671
33725
  () => editColumns(sheet, cols, (info) => {
33672
33726
  const next = widths.get(info.min);
33673
33727
  if (next === void 0) {
@@ -33702,7 +33756,7 @@ function setRowHeight(ctx, s, rows, height) {
33702
33756
  ctx.run(
33703
33757
  "Row height",
33704
33758
  "view",
33705
- [{ kind: "sheet", sheet: s }],
33759
+ [{ kind: "rowInfo", sheet: s, rows }],
33706
33760
  () => {
33707
33761
  for (const row2 of rows) {
33708
33762
  const info = { ...sheet.rowInfo.get(row2) };
@@ -33732,7 +33786,9 @@ function setHidden(ctx, s, axis, indices, hidden) {
33732
33786
  ctx.run(
33733
33787
  `${hidden ? "Hide" : "Unhide"} ${noun}`,
33734
33788
  "view",
33735
- [{ kind: "sheet", sheet: s }],
33789
+ [
33790
+ axis === "col" ? { kind: "parts", sheet: s, parts: ["columns"] } : { kind: "rowInfo", sheet: s, rows: indices }
33791
+ ],
33736
33792
  () => {
33737
33793
  if (axis === "col") {
33738
33794
  editColumns(sheet, indices, (info) => {
@@ -34347,6 +34403,19 @@ function shiftEdgeCells(sheet, spec2, phase) {
34347
34403
  return out;
34348
34404
  }
34349
34405
 
34406
+ // xlsx/edit/history-rows.ts
34407
+ function captureRowInfo(sheet, rows) {
34408
+ return [...new Set(rows)].map((row2) => {
34409
+ const info = sheet.rowInfo.get(row2);
34410
+ return [row2, info && structuredClone(info)];
34411
+ });
34412
+ }
34413
+ function restoreRowInfo(sheet, entries) {
34414
+ for (const [row2, info] of entries)
34415
+ if (info) sheet.rowInfo.set(row2, structuredClone(info));
34416
+ else sheet.rowInfo.delete(row2);
34417
+ }
34418
+
34350
34419
  // xlsx/edit/history.ts
34351
34420
  var SETTING_KEYS = [
34352
34421
  "structureLocked",
@@ -34431,6 +34500,8 @@ function captureScope(workbook, scope, before) {
34431
34500
  if (!sheet) throw new RangeError(`No sheet at index ${scope.sheet}`);
34432
34501
  if (scope.kind === "sheet")
34433
34502
  return { kind: "sheet", sheet: scope.sheet, data: structuredClone(sheet) };
34503
+ if (scope.kind === "rowInfo")
34504
+ return { kind: "rowInfo", sheet: scope.sheet, rows: captureRowInfo(sheet, scope.rows) };
34434
34505
  if (scope.kind === "parts") {
34435
34506
  const data = {};
34436
34507
  for (const part of scope.parts) if (sheet[part] !== void 0) data[part] = sheet[part];
@@ -34482,6 +34553,7 @@ function restoreSnapshot(workbook, snapshot) {
34482
34553
  }
34483
34554
  const sheet = workbook.sheets[snapshot.sheet];
34484
34555
  if (!sheet) return;
34556
+ if (snapshot.kind === "rowInfo") return restoreRowInfo(sheet, snapshot.rows);
34485
34557
  if (snapshot.kind === "parts") {
34486
34558
  const target = sheet;
34487
34559
  const data = structuredClone(snapshot.data);
@@ -37129,12 +37201,13 @@ function span2(from, to) {
37129
37201
  }
37130
37202
  function outlineRows(ctx, s, from, to, delta) {
37131
37203
  const sheet = sheetAt(ctx.workbook, s);
37204
+ const rows = span2(from, to);
37132
37205
  ctx.run(
37133
37206
  delta > 0 ? "Group rows" : "Ungroup rows",
37134
37207
  "structure",
37135
- [{ kind: "sheet", sheet: s }],
37208
+ [{ kind: "rowInfo", sheet: s, rows }],
37136
37209
  () => {
37137
- for (const row2 of span2(from, to)) {
37210
+ for (const row2 of rows) {
37138
37211
  const info = { ...sheet.rowInfo.get(row2) };
37139
37212
  const level2 = nextLevel(info.outlineLevel, delta);
37140
37213
  if (level2) info.outlineLevel = level2;
@@ -37154,7 +37227,7 @@ function outlineColumns(ctx, s, from, to, delta) {
37154
37227
  ctx.run(
37155
37228
  delta > 0 ? "Group columns" : "Ungroup columns",
37156
37229
  "structure",
37157
- [{ kind: "sheet", sheet: s }],
37230
+ [{ kind: "parts", sheet: s, parts: ["columns"] }],
37158
37231
  () => editColumns(sheet, span2(from, to), (info) => {
37159
37232
  const level2 = nextLevel(info.outlineLevel, delta);
37160
37233
  if (level2) info.outlineLevel = level2;
@@ -37177,7 +37250,7 @@ function setDefaultColumnWidth(ctx, s, width) {
37177
37250
  ctx.run(
37178
37251
  "Standard width",
37179
37252
  "format",
37180
- [{ kind: "sheet", sheet: s }],
37253
+ [{ kind: "parts", sheet: s, parts: ["defaultColWidth"] }],
37181
37254
  () => {
37182
37255
  if (width === void 0) Reflect.deleteProperty(sheet, "defaultColWidth");
37183
37256
  else sheet.defaultColWidth = width;
@@ -39799,10 +39872,11 @@ function autoGrowRows(ctx, s, rows, measure2 = approximateMeasure) {
39799
39872
  updates.push([row2, next]);
39800
39873
  }
39801
39874
  if (!updates.length) return [];
39875
+ const changed = updates.map(([row2]) => row2);
39802
39876
  ctx.run(
39803
39877
  "Row height",
39804
39878
  "view",
39805
- [{ kind: "sheet", sheet: s }],
39879
+ [{ kind: "rowInfo", sheet: s, rows: changed }],
39806
39880
  () => {
39807
39881
  for (const [row2, height] of updates) {
39808
39882
  const info = { ...sheet.rowInfo.get(row2) };
@@ -39814,7 +39888,7 @@ function autoGrowRows(ctx, s, rows, measure2 = approximateMeasure) {
39814
39888
  },
39815
39889
  { sheet: s, structural: true }
39816
39890
  );
39817
- return updates.map(([row2]) => row2);
39891
+ return changed;
39818
39892
  }
39819
39893
  var MAX_REFIT_ROWS = 1e4;
39820
39894
  function rowsToRefit(sheet, ranges) {
@@ -3641,6 +3641,12 @@ function parseLiteFragment(xml, container2, namespaces) {
3641
3641
  }
3642
3642
  if (lt < 0) break;
3643
3643
  const next = source2.charCodeAt(lt + 1);
3644
+ if (next === 33) {
3645
+ const after = skipCommentOrCdata(source2, lt, top);
3646
+ if (after < 0) return void 0;
3647
+ pos = after;
3648
+ continue;
3649
+ }
3644
3650
  if (next === 47) {
3645
3651
  const gt = source2.indexOf(">", lt);
3646
3652
  if (gt < 0 || stack2.length < 2 || source2.slice(lt + 2, gt).trimEnd() !== top.tagName)
@@ -3661,6 +3667,25 @@ function parseLiteFragment(xml, container2, namespaces) {
3661
3667
  }
3662
3668
  return stack2.length === 1 ? root : void 0;
3663
3669
  }
3670
+ var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
3671
+ function skipCommentOrCdata(source2, lt, parent) {
3672
+ if (source2.startsWith("<!--", lt)) {
3673
+ const end = source2.indexOf("-->", lt + 4);
3674
+ if (end < 0) return -1;
3675
+ const body = source2.slice(lt + 4, end);
3676
+ if (body.includes("--") || body.endsWith("-") || DECLARATIONS.test(body)) return -1;
3677
+ return end + 3;
3678
+ }
3679
+ if (source2.startsWith("<![CDATA[", lt)) {
3680
+ const end = source2.indexOf("]]>", lt + 9);
3681
+ if (end < 0) return -1;
3682
+ const text2 = source2.slice(lt + 9, end);
3683
+ if (DECLARATIONS.test(text2)) return -1;
3684
+ parent.childNodes.push(text2);
3685
+ return end + 3;
3686
+ }
3687
+ return -1;
3688
+ }
3664
3689
  function startTag(source2, from, namespaces) {
3665
3690
  const n = source2.length;
3666
3691
  let i2 = from;
@@ -14002,21 +14027,50 @@ function rootNamespaces(xml) {
14002
14027
  for (const match2 of (root[2] ?? "").matchAll(DECLARATION2)) out[match2[1] ?? ""] = match2[3] ?? "";
14003
14028
  return out;
14004
14029
  }
14030
+ var SPECIAL = /<[!?]/g;
14031
+ var SECTIONS = [
14032
+ ["<!--", "-->"],
14033
+ ["<![CDATA[", "]]>"],
14034
+ ["<?", "?>"]
14035
+ ];
14036
+ function blankComments(xml) {
14037
+ if (!xml.includes("<!--") && !xml.includes("<![CDATA[")) return xml;
14038
+ const pieces = [];
14039
+ let copied = 0;
14040
+ SPECIAL.lastIndex = 0;
14041
+ for (let match2 = SPECIAL.exec(xml); match2; match2 = SPECIAL.exec(xml)) {
14042
+ const at = match2.index;
14043
+ const section = SECTIONS.find(([open2]) => xml.startsWith(open2, at));
14044
+ if (!section) return void 0;
14045
+ const [open, close2] = section;
14046
+ const end = xml.indexOf(close2, at + open.length);
14047
+ if (end < 0) return void 0;
14048
+ const after = end + close2.length;
14049
+ if (open !== "<?") {
14050
+ pieces.push(xml.slice(copied, at), " ".repeat(after - at));
14051
+ copied = after;
14052
+ }
14053
+ SPECIAL.lastIndex = after;
14054
+ }
14055
+ pieces.push(xml.slice(copied));
14056
+ return pieces.join("");
14057
+ }
14005
14058
  function splitSheetData(xml) {
14006
- if (xml.includes("<!--") || xml.includes("<![CDATA[")) return void 0;
14007
- const namespaces = rootNamespaces(xml);
14008
- const open = OPEN.exec(xml);
14059
+ const plain3 = blankComments(xml);
14060
+ if (plain3 === void 0) return void 0;
14061
+ const namespaces = rootNamespaces(plain3);
14062
+ const open = OPEN.exec(plain3);
14009
14063
  if (!namespaces || !open) return void 0;
14010
14064
  const prefix = (open[1] ?? "").slice(0, -1);
14011
14065
  const ns = namespaces[prefix];
14012
14066
  if (prefix && ns === void 0) return void 0;
14013
14067
  const tagName = `${open[1] ?? ""}sheetData`;
14014
- const openEnd = xml.indexOf(">", open.index);
14068
+ const openEnd = plain3.indexOf(">", open.index);
14015
14069
  if (openEnd < 0) return void 0;
14016
- const attributes = xml.slice(open.index + tagName.length + 1, openEnd);
14070
+ const attributes = plain3.slice(open.index + tagName.length + 1, openEnd);
14017
14071
  if (attributes.trimEnd().endsWith("/") || attributes.includes("xmlns")) return void 0;
14018
- const close2 = xml.indexOf(`</${tagName}`, openEnd);
14019
- if (close2 < 0 || OPEN.test(xml.slice(openEnd))) return void 0;
14072
+ const close2 = plain3.indexOf(`</${tagName}`, openEnd);
14073
+ if (close2 < 0 || OPEN.test(plain3.slice(openEnd))) return void 0;
14020
14074
  const container2 = new LiteElement(tagName, "sheetData", ns || null);
14021
14075
  const data = parseLiteFragment(xml.slice(openEnd + 1, close2), container2, namespaces);
14022
14076
  if (!data) return void 0;
@@ -3635,6 +3635,12 @@ function parseLiteFragment(xml, container2, namespaces) {
3635
3635
  }
3636
3636
  if (lt < 0) break;
3637
3637
  const next = source2.charCodeAt(lt + 1);
3638
+ if (next === 33) {
3639
+ const after = skipCommentOrCdata(source2, lt, top);
3640
+ if (after < 0) return void 0;
3641
+ pos = after;
3642
+ continue;
3643
+ }
3638
3644
  if (next === 47) {
3639
3645
  const gt = source2.indexOf(">", lt);
3640
3646
  if (gt < 0 || stack2.length < 2 || source2.slice(lt + 2, gt).trimEnd() !== top.tagName)
@@ -3655,6 +3661,25 @@ function parseLiteFragment(xml, container2, namespaces) {
3655
3661
  }
3656
3662
  return stack2.length === 1 ? root : void 0;
3657
3663
  }
3664
+ var DECLARATIONS = /<!DOCTYPE|<!ENTITY/i;
3665
+ function skipCommentOrCdata(source2, lt, parent) {
3666
+ if (source2.startsWith("<!--", lt)) {
3667
+ const end = source2.indexOf("-->", lt + 4);
3668
+ if (end < 0) return -1;
3669
+ const body = source2.slice(lt + 4, end);
3670
+ if (body.includes("--") || body.endsWith("-") || DECLARATIONS.test(body)) return -1;
3671
+ return end + 3;
3672
+ }
3673
+ if (source2.startsWith("<![CDATA[", lt)) {
3674
+ const end = source2.indexOf("]]>", lt + 9);
3675
+ if (end < 0) return -1;
3676
+ const text2 = source2.slice(lt + 9, end);
3677
+ if (DECLARATIONS.test(text2)) return -1;
3678
+ parent.childNodes.push(text2);
3679
+ return end + 3;
3680
+ }
3681
+ return -1;
3682
+ }
3658
3683
  function startTag(source2, from, namespaces) {
3659
3684
  const n = source2.length;
3660
3685
  let i2 = from;
@@ -13996,21 +14021,50 @@ function rootNamespaces(xml) {
13996
14021
  for (const match2 of (root[2] ?? "").matchAll(DECLARATION2)) out[match2[1] ?? ""] = match2[3] ?? "";
13997
14022
  return out;
13998
14023
  }
14024
+ var SPECIAL = /<[!?]/g;
14025
+ var SECTIONS = [
14026
+ ["<!--", "-->"],
14027
+ ["<![CDATA[", "]]>"],
14028
+ ["<?", "?>"]
14029
+ ];
14030
+ function blankComments(xml) {
14031
+ if (!xml.includes("<!--") && !xml.includes("<![CDATA[")) return xml;
14032
+ const pieces = [];
14033
+ let copied = 0;
14034
+ SPECIAL.lastIndex = 0;
14035
+ for (let match2 = SPECIAL.exec(xml); match2; match2 = SPECIAL.exec(xml)) {
14036
+ const at = match2.index;
14037
+ const section = SECTIONS.find(([open2]) => xml.startsWith(open2, at));
14038
+ if (!section) return void 0;
14039
+ const [open, close2] = section;
14040
+ const end = xml.indexOf(close2, at + open.length);
14041
+ if (end < 0) return void 0;
14042
+ const after = end + close2.length;
14043
+ if (open !== "<?") {
14044
+ pieces.push(xml.slice(copied, at), " ".repeat(after - at));
14045
+ copied = after;
14046
+ }
14047
+ SPECIAL.lastIndex = after;
14048
+ }
14049
+ pieces.push(xml.slice(copied));
14050
+ return pieces.join("");
14051
+ }
13999
14052
  function splitSheetData(xml) {
14000
- if (xml.includes("<!--") || xml.includes("<![CDATA[")) return void 0;
14001
- const namespaces = rootNamespaces(xml);
14002
- const open = OPEN.exec(xml);
14053
+ const plain3 = blankComments(xml);
14054
+ if (plain3 === void 0) return void 0;
14055
+ const namespaces = rootNamespaces(plain3);
14056
+ const open = OPEN.exec(plain3);
14003
14057
  if (!namespaces || !open) return void 0;
14004
14058
  const prefix = (open[1] ?? "").slice(0, -1);
14005
14059
  const ns = namespaces[prefix];
14006
14060
  if (prefix && ns === void 0) return void 0;
14007
14061
  const tagName = `${open[1] ?? ""}sheetData`;
14008
- const openEnd = xml.indexOf(">", open.index);
14062
+ const openEnd = plain3.indexOf(">", open.index);
14009
14063
  if (openEnd < 0) return void 0;
14010
- const attributes = xml.slice(open.index + tagName.length + 1, openEnd);
14064
+ const attributes = plain3.slice(open.index + tagName.length + 1, openEnd);
14011
14065
  if (attributes.trimEnd().endsWith("/") || attributes.includes("xmlns")) return void 0;
14012
- const close2 = xml.indexOf(`</${tagName}`, openEnd);
14013
- if (close2 < 0 || OPEN.test(xml.slice(openEnd))) return void 0;
14066
+ const close2 = plain3.indexOf(`</${tagName}`, openEnd);
14067
+ if (close2 < 0 || OPEN.test(plain3.slice(openEnd))) return void 0;
14014
14068
  const container2 = new LiteElement(tagName, "sheetData", ns || null);
14015
14069
  const data = parseLiteFragment(xml.slice(openEnd + 1, close2), container2, namespaces);
14016
14070
  if (!data) return void 0;
@@ -10,4 +10,12 @@ export declare const OVERFLOW_TEXT = "########";
10
10
  export declare function formatValue(value: CellValue, format: string, options?: FormatOptions): FormattedValue;
11
11
  /** True when the format shows numbers as dates or times. */
12
12
  export declare function isDateFormat(format: string): boolean;
13
+ /**
14
+ * What the section of `format` that shows `value` displays: a calendar date, a time of day or
15
+ * both; `undefined` when that section shows a number, text or a duration (`[h]:mm`).
16
+ */
17
+ export declare function dateTimeParts(format: string, value: number): {
18
+ date: boolean;
19
+ time: boolean;
20
+ } | undefined;
13
21
  //# sourceMappingURL=format.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../xlsx/numfmt/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,UAAU,CAAC;AAMvD,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAS,MAAM,SAAS,CAAC;AAEpE,kGAAkG;AAClG,eAAO,MAAM,aAAa,aAAa,CAAC;AAoHxC;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GACzB,cAAc,CAOhB;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD"}
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../xlsx/numfmt/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAe,MAAM,UAAU,CAAC;AAMvD,OAAO,KAAK,EAAY,aAAa,EAAE,cAAc,EAAS,MAAM,SAAS,CAAC;AAE9E,kGAAkG;AAClG,eAAO,MAAM,aAAa,aAAa,CAAC;AAoHxC;;;;GAIG;AACH,wBAAgB,WAAW,CAC1B,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,aAAkB,GACzB,cAAc,CAOhB;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEpD;AAqBD;;;GAGG;AACH,wBAAgB,aAAa,CAC5B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAa9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"sheet-data-source.d.ts","sourceRoot":"","sources":["../../../xlsx/read/sheet-data-source.ts"],"names":[],"mappings":"AAMA,OAAO,EAIN,KAAK,UAAU,EACf,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC9B,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,SAAS,EAAE,UAAU,CAAC;CACtB;AAeD,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAmBtE"}
1
+ {"version":3,"file":"sheet-data-source.d.ts","sourceRoot":"","sources":["../../../xlsx/read/sheet-data-source.ts"],"names":[],"mappings":"AAOA,OAAO,EAIN,KAAK,UAAU,EACf,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,cAAc;IAC9B,+DAA+D;IAC/D,GAAG,EAAE,MAAM,CAAC;IACZ,qFAAqF;IACrF,SAAS,EAAE,UAAU,CAAC;CACtB;AAmDD,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAqBtE"}