@openpresentation/opf 0.26.10 → 0.27.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 (79) hide show
  1. package/README.md +6 -0
  2. package/dist/browser.js +20 -17
  3. package/dist/{chunk-H7XMO36O.js → chunk-353VBJ6K.js} +5 -5
  4. package/dist/chunk-43JWUIGF.js +8 -0
  5. package/dist/chunk-4ACS57MG.js +236 -0
  6. package/dist/{chunk-F4HFDP6I.js → chunk-4ZM5G3XX.js} +1 -1
  7. package/dist/{chunk-NVT2YDVC.js → chunk-7XUEKIXH.js} +2 -2
  8. package/dist/{chunk-Y25DYRME.js → chunk-ABFDFZIW.js} +1 -1
  9. package/dist/{chunk-A54NGT2K.js → chunk-APLNGCEZ.js} +2 -2
  10. package/dist/{chunk-G5WJMJV3.js → chunk-CXPBU5W4.js} +1 -1
  11. package/dist/{chunk-PHP45MO7.js → chunk-EO3JWEO5.js} +1 -1
  12. package/dist/chunk-GJO5NUVT.js +1 -0
  13. package/dist/chunk-GM7WFPGG.js +10 -0
  14. package/dist/{chunk-3S2XVDPN.js → chunk-GNKESMZT.js} +6 -6
  15. package/dist/chunk-JBARNYFR.js +23 -0
  16. package/dist/{chunk-TKQ2VFV5.js → chunk-JSHMFTSY.js} +1 -1
  17. package/dist/{chunk-VZBFQLCA.js → chunk-KZPZRHL6.js} +6 -6
  18. package/dist/{chunk-XRMV2GMB.js → chunk-LRTQXGJO.js} +236 -144
  19. package/dist/{chunk-EQ6S5SEZ.js → chunk-O3SA5SJ4.js} +1 -1
  20. package/dist/{chunk-GIWNHRTX.js → chunk-OSM3LZ2Y.js} +4 -4
  21. package/dist/{chunk-IVPA6NG6.js → chunk-PAGVSTVF.js} +348 -97
  22. package/dist/{chunk-Y4TZCE7R.js → chunk-SYW4BCGZ.js} +2 -2
  23. package/dist/{chunk-D25BNPTW.js → chunk-TMREBZBQ.js} +4 -4
  24. package/dist/{chunk-77KL2PMM.js → chunk-WJ4XTCOD.js} +2 -2
  25. package/dist/{chunk-L52N5FZZ.js → chunk-ZGTOZA2S.js} +6 -6
  26. package/dist/{composition-DIftf6iP.d.ts → composition-BGmpe5e4.d.ts} +51 -5
  27. package/dist/composition.d.ts +1 -1
  28. package/dist/composition.js +2 -1
  29. package/dist/{conversion-ChmGA8Ul.d.ts → conversion-8SQD4dqu.d.ts} +6 -6
  30. package/dist/conversion-LN6PFRZL.js +24 -0
  31. package/dist/convert.d.ts +2 -2
  32. package/dist/convert.js +9 -7
  33. package/dist/data.d.ts +1 -1
  34. package/dist/data.js +3 -2
  35. package/dist/{deck-report-5vwMGcQz.d.ts → deck-report-BaKgPh_N.d.ts} +2 -2
  36. package/dist/deck.d.ts +6 -6
  37. package/dist/deck.js +13 -11
  38. package/dist/diff.d.ts +1 -1
  39. package/dist/diff.js +6 -4
  40. package/dist/docs.js +6 -4
  41. package/dist/examples.d.ts +1 -1
  42. package/dist/examples.js +2 -0
  43. package/dist/{finding-l9dlQ2NF.d.ts → finding-Bh56sGtF.d.ts} +1 -1
  44. package/dist/font-policy.js +1 -0
  45. package/dist/format.js +3 -2
  46. package/dist/ids.d.ts +113 -0
  47. package/dist/ids.js +6 -0
  48. package/dist/index.d.ts +15 -12
  49. package/dist/index.js +24 -21
  50. package/dist/markdown.d.ts +4 -4
  51. package/dist/markdown.js +10 -8
  52. package/dist/node-engine.d.ts +8 -8
  53. package/dist/node-engine.js +24 -21
  54. package/dist/{pagination-D_kJe4jH.d.ts → pagination-BsUTsQvk.d.ts} +1 -1
  55. package/dist/pagination.d.ts +2 -2
  56. package/dist/pagination.js +6 -4
  57. package/dist/patch.d.ts +87 -4
  58. package/dist/patch.js +5 -3
  59. package/dist/precompiled.d.ts +2 -0
  60. package/dist/precompiled.js +7 -0
  61. package/dist/{presentation-Bwo8Ko6D.d.ts → presentation-C-nHZyMw.d.ts} +1 -1
  62. package/dist/repo-readme.js +2 -0
  63. package/dist/schema-engine-ajv.js +37 -0
  64. package/dist/schema-engine-precompiled.js +3 -0
  65. package/dist/schema.js +5 -3
  66. package/dist/schemas.js +2 -1
  67. package/dist/source.d.ts +1 -1
  68. package/dist/source.js +12 -10
  69. package/dist/spec/schemas/opf.schema.json +1 -1
  70. package/dist/spec-files.js +1 -0
  71. package/dist/symbol-font-encodings.js +2 -0
  72. package/dist/types.d.ts +2 -2
  73. package/dist/{validation-types-3ARvTsB0.d.ts → validation-types-6_jEaHeE.d.ts} +2 -2
  74. package/dist/validator.d.ts +5 -5
  75. package/dist/validator.js +5 -3
  76. package/dist/yaml.d.ts +4 -4
  77. package/dist/yaml.js +9 -7
  78. package/package.json +29 -8
  79. package/dist/conversion-IVKCKMCN.js +0 -21
@@ -1877,11 +1877,18 @@ function tableCellDisplayValue(cell, columnFormat2) {
1877
1877
 
1878
1878
  // src/chart-axis.ts
1879
1879
  var CHART_TEXT_PX = 20;
1880
+ var CHART_TEXT_FLOOR_PX = 18;
1881
+ var CHART_FLOOR_MIN_HEIGHT = 12 * CHART_TEXT_FLOOR_PX;
1882
+ var CHART_FLOOR_MIN_WIDTH = 16 * CHART_TEXT_FLOOR_PX;
1883
+ var CHART_MIN_TICK_SPACING_PX = 48;
1884
+ var CHART_MAX_INTERVALS = 8;
1880
1885
  function chartTextSize(geometry) {
1881
1886
  const { width, height, scale: scale2 } = geometry;
1882
1887
  const minimum = geometry.minFontSize ?? 16;
1883
1888
  if (![width, height, scale2].every(Number.isFinite) || width <= 0 || height <= 0 || scale2 <= 0) return Math.max(CHART_TEXT_PX, minimum);
1884
- return Math.max(Math.floor(Math.min(CHART_TEXT_PX, height / scale2 / 18, width / scale2 / 30)), minimum);
1889
+ const roomy = Math.floor(Math.min(CHART_TEXT_PX, height / scale2 / 18, width / scale2 / 30));
1890
+ const roomForFloor = height / scale2 >= CHART_FLOOR_MIN_HEIGHT && width / scale2 >= CHART_FLOOR_MIN_WIDTH;
1891
+ return Math.max(roomy, minimum, roomForFloor ? CHART_TEXT_FLOOR_PX : 0);
1885
1892
  }
1886
1893
  function clean(value) {
1887
1894
  const rounded = Number(value.toPrecision(12));
@@ -1949,6 +1956,10 @@ function normalizedScale(dataMin, dataMax, limit) {
1949
1956
  function maxIntervalsFor(length, labelExtent) {
1950
1957
  return Math.max(1, Math.min(10, Math.floor(length / Math.max(1, labelExtent))));
1951
1958
  }
1959
+ function chartIntervalsFor(length, labelExtent, scale2) {
1960
+ const spacing = CHART_MIN_TICK_SPACING_PX * (Number.isFinite(scale2) && scale2 > 0 ? scale2 : 1);
1961
+ return Math.min(CHART_MAX_INTERVALS, maxIntervalsFor(length, Math.max(labelExtent, spacing)));
1962
+ }
1952
1963
  var bar = (horizontal, grouping) => ({ kind: "bar", horizontal, grouping });
1953
1964
  var line = (grouping) => ({ kind: "line", horizontal: false, grouping });
1954
1965
  var area = (grouping) => ({ kind: "area", horizontal: false, grouping });
@@ -2024,7 +2035,7 @@ function chartValueAxis(chart, resolved, geometry) {
2024
2035
  const legendBand = options.legend === "top" || options.legend === "bottom" ? lineHeight + pad : 0;
2025
2036
  const titleBand = options.axisTitles.category ? lineHeight : 0;
2026
2037
  const length = spec.horizontal ? width * 0.7 - 2 * pad - fontPx : height - 2 * pad - lineHeight * 1.5 - legendBand - titleBand;
2027
- const fitted = niceScale(dataMin, dataMax, maxIntervalsFor(Math.max(1, length), spec.horizontal ? 4 * fontPx : lineHeight * 1.2), { percent });
2038
+ const fitted = niceScale(dataMin, dataMax, chartIntervalsFor(Math.max(1, length), spec.horizontal ? 4 * fontPx : lineHeight * 1.2, scale2), { percent });
2028
2039
  return { min: fitted.min, max: fitted.max, majorUnit: fitted.step, ...percent ? { percent: true } : {} };
2029
2040
  }
2030
2041
 
@@ -3458,6 +3469,54 @@ function numberingFindings(payload) {
3458
3469
  return { errors, warnings };
3459
3470
  }
3460
3471
 
3472
+ // src/legible-color.ts
3473
+ var channels = (hex) => [1, 3, 5].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
3474
+ var toHex = (values) => `#${values.map((value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
3475
+ var linear = (value) => {
3476
+ const n = value / 255;
3477
+ return n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
3478
+ };
3479
+ var luminance = (hex) => {
3480
+ const [r, g, b] = channels(hex);
3481
+ return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
3482
+ };
3483
+ var contrast = (a, b) => {
3484
+ const x = luminance(a), y = luminance(b);
3485
+ return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
3486
+ };
3487
+ var normalize = (value) => {
3488
+ if (typeof value !== "string") return void 0;
3489
+ const text2 = value.trim();
3490
+ if (/^#[0-9a-f]{3}$/i.test(text2)) return `#${[...text2.slice(1)].map((c) => c + c).join("")}`.toUpperCase();
3491
+ return /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(text2) ? text2.slice(0, 7).toUpperCase() : void 0;
3492
+ };
3493
+ function toHsl(hex) {
3494
+ const [r, g, b] = channels(hex).map((value) => value / 255);
3495
+ const max = Math.max(r, g, b), min = Math.min(r, g, b), l = (max + min) / 2, d = max - min;
3496
+ if (d === 0) return [0, 0, l];
3497
+ const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
3498
+ const h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
3499
+ return [h * 60, s, l];
3500
+ }
3501
+ function fromHsl(h, s, l) {
3502
+ const hue = (h % 360 + 360) % 360, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hue / 60 % 2 - 1)), m = l - c / 2;
3503
+ const [r, g, b] = hue < 60 ? [c, x, 0] : hue < 120 ? [x, c, 0] : hue < 180 ? [0, c, x] : hue < 240 ? [0, x, c] : hue < 300 ? [x, 0, c] : [c, 0, x];
3504
+ return toHex([(r + m) * 255, (g + m) * 255, (b + m) * 255]);
3505
+ }
3506
+ function legible(foreground, background, minimum) {
3507
+ if (contrast(foreground, background) >= minimum) return foreground;
3508
+ const [h, s, l] = toHsl(foreground), preferred = luminance(background) < 0.5 ? 1 : -1;
3509
+ for (const direction of [preferred, -preferred]) {
3510
+ for (let step = 1; step <= 100; step++) {
3511
+ const lightness = l + direction * step / 100;
3512
+ if (lightness < 0 || lightness > 1) break;
3513
+ const candidate = fromHsl(h, s, lightness);
3514
+ if (contrast(candidate, background) >= minimum) return candidate;
3515
+ }
3516
+ }
3517
+ return contrast("#FFFFFF", background) >= contrast("#000000", background) ? "#FFFFFF" : "#000000";
3518
+ }
3519
+
3461
3520
  // src/color.ts
3462
3521
  var schemeColorSlots = /* @__PURE__ */ new Set([
3463
3522
  "accent1",
@@ -3539,7 +3598,7 @@ function resolveColorRef(reference, options) {
3539
3598
  var DARK_BACKGROUND_LUMINANCE = 0.179;
3540
3599
  function isDarkColor(color) {
3541
3600
  const hex = normalizeHexColor(color);
3542
- const value = hex ? luminance(hex) : void 0;
3601
+ const value = hex ? luminance2(hex) : void 0;
3543
3602
  return value !== void 0 && value < DARK_BACKGROUND_LUMINANCE;
3544
3603
  }
3545
3604
  function defaultSlideBackground(colorScheme) {
@@ -3697,7 +3756,7 @@ function readableSchemeColor(fill, roles) {
3697
3756
  const ink = { slot: "tx1", hex: normalizeHexColor(roles.text) ?? roles.text };
3698
3757
  return (colorContrast(light.hex, fill) ?? 0) >= (colorContrast(ink.hex, fill) ?? 0) ? light : ink;
3699
3758
  }
3700
- function luminance(value) {
3759
+ function luminance2(value) {
3701
3760
  if (typeof value !== "string") return void 0;
3702
3761
  let hex = value.trim();
3703
3762
  if (/^#[0-9a-f]{3}$/i.test(hex)) hex = `#${[...hex.slice(1)].map((c) => c + c).join("")}`;
@@ -3710,11 +3769,11 @@ function luminance(value) {
3710
3769
  }, 0);
3711
3770
  }
3712
3771
  function colorContrast(foreground, background) {
3713
- const a = luminance(foreground), b = luminance(background);
3772
+ const a = luminance2(foreground), b = luminance2(background);
3714
3773
  return a === void 0 || b === void 0 ? void 0 : (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
3715
3774
  }
3716
3775
  function textColorForFill(fill, preferred) {
3717
- const background = luminance(fill), contrast2 = colorContrast(preferred, fill);
3776
+ const background = luminance2(fill), contrast2 = colorContrast(preferred, fill);
3718
3777
  if (background === void 0 || contrast2 === void 0 || contrast2 >= 4.5) return preferred;
3719
3778
  return (background + 0.05) / 0.05 >= 1.05 / (background + 0.05) ? "#000000" : "#FFFFFF";
3720
3779
  }
@@ -3738,7 +3797,7 @@ var CHART_SERIES_MIN_LIGHTNESS_STEP = 11;
3738
3797
  var CHART_SERIES_MIN_DIFFERENCE = 12;
3739
3798
  var D65 = [0.95047, 1, 1.08883];
3740
3799
  function opaqueChannels(value) {
3741
- if (luminance(value) === void 0) return void 0;
3800
+ if (luminance2(value) === void 0) return void 0;
3742
3801
  let hex = value.trim();
3743
3802
  if (hex.length === 4) hex = `#${[...hex.slice(1)].map((c) => c + c).join("")}`;
3744
3803
  return [1, 3, 5].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
@@ -3787,8 +3846,13 @@ function labDifference(a, b) {
3787
3846
  var CHART_SERIES_TIER_SIZE = 6;
3788
3847
  var tierOf = (index) => Math.floor(index / CHART_SERIES_TIER_SIZE);
3789
3848
  var CHART_SERIES_SHORTFALL_WEIGHT = 8;
3790
- function chartPaletteForFill(fill, palette) {
3849
+ var CHART_LEAD_MIN_CONTRAST = 4.5;
3850
+ function chartPaletteForFill(fill, palette, options = {}) {
3791
3851
  const opaqueFill = colorContrast(fill, fill) !== void 0;
3852
+ if (options.legibleLead && opaqueFill && isDarkColor(fill) && palette.length > 0) {
3853
+ const lead = normalizeHexColor(palette[0]);
3854
+ if (lead) palette = [legible(lead, normalizeHexColor(fill), CHART_LEAD_MIN_CONTRAST), ...palette.slice(1)];
3855
+ }
3792
3856
  const preferredLab = palette.map((color) => {
3793
3857
  const channels2 = opaqueChannels(color);
3794
3858
  return channels2 ? labOf(channels2) : void 0;
@@ -3846,6 +3910,9 @@ function chartSeriesPalette(colorScheme = {}, colors, context = {}) {
3846
3910
  });
3847
3911
  return palette;
3848
3912
  }
3913
+ function chartLeadFromScheme(colors, colorScheme = {}, context = {}) {
3914
+ return resolveChartColors(colors, colorScheme, context)[0] === void 0;
3915
+ }
3849
3916
  function resolveChartColors(colors, colorScheme = {}, context = {}) {
3850
3917
  if (!Array.isArray(colors)) return [];
3851
3918
  return colors.map((entry) => {
@@ -3882,7 +3949,7 @@ function surfaceAltColor(surface, text2) {
3882
3949
  if (!readable(band)) break;
3883
3950
  if (step(band)) return band;
3884
3951
  }
3885
- const away = (luminance(ink) ?? 0) > (luminance(fill) ?? 0) ? [0, 0, 0] : [255, 255, 255];
3952
+ const away = (luminance2(ink) ?? 0) > (luminance2(fill) ?? 0) ? [0, 0, 0] : [255, 255, 255];
3886
3953
  for (let amount = SURFACE_ALT_MIX; amount <= 1 + 1e-9; amount += 0.02) {
3887
3954
  const band = mixChannels(from, away, Math.min(1, amount));
3888
3955
  if (step(band)) return band;
@@ -3890,54 +3957,6 @@ function surfaceAltColor(surface, text2) {
3890
3957
  return mixChannels(from, toText, SURFACE_ALT_MIX);
3891
3958
  }
3892
3959
 
3893
- // src/legible-color.ts
3894
- var channels = (hex) => [1, 3, 5].map((offset) => Number.parseInt(hex.slice(offset, offset + 2), 16));
3895
- var toHex = (values) => `#${values.map((value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, "0")).join("").toUpperCase()}`;
3896
- var linear = (value) => {
3897
- const n = value / 255;
3898
- return n <= 0.04045 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
3899
- };
3900
- var luminance2 = (hex) => {
3901
- const [r, g, b] = channels(hex);
3902
- return 0.2126 * linear(r) + 0.7152 * linear(g) + 0.0722 * linear(b);
3903
- };
3904
- var contrast = (a, b) => {
3905
- const x = luminance2(a), y = luminance2(b);
3906
- return (Math.max(x, y) + 0.05) / (Math.min(x, y) + 0.05);
3907
- };
3908
- var normalize = (value) => {
3909
- if (typeof value !== "string") return void 0;
3910
- const text2 = value.trim();
3911
- if (/^#[0-9a-f]{3}$/i.test(text2)) return `#${[...text2.slice(1)].map((c) => c + c).join("")}`.toUpperCase();
3912
- return /^#[0-9a-f]{6}([0-9a-f]{2})?$/i.test(text2) ? text2.slice(0, 7).toUpperCase() : void 0;
3913
- };
3914
- function toHsl(hex) {
3915
- const [r, g, b] = channels(hex).map((value) => value / 255);
3916
- const max = Math.max(r, g, b), min = Math.min(r, g, b), l = (max + min) / 2, d = max - min;
3917
- if (d === 0) return [0, 0, l];
3918
- const s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
3919
- const h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4;
3920
- return [h * 60, s, l];
3921
- }
3922
- function fromHsl(h, s, l) {
3923
- const hue = (h % 360 + 360) % 360, c = (1 - Math.abs(2 * l - 1)) * s, x = c * (1 - Math.abs(hue / 60 % 2 - 1)), m = l - c / 2;
3924
- const [r, g, b] = hue < 60 ? [c, x, 0] : hue < 120 ? [x, c, 0] : hue < 180 ? [0, c, x] : hue < 240 ? [0, x, c] : hue < 300 ? [x, 0, c] : [c, 0, x];
3925
- return toHex([(r + m) * 255, (g + m) * 255, (b + m) * 255]);
3926
- }
3927
- function legible(foreground, background, minimum) {
3928
- if (contrast(foreground, background) >= minimum) return foreground;
3929
- const [h, s, l] = toHsl(foreground), preferred = luminance2(background) < 0.5 ? 1 : -1;
3930
- for (const direction of [preferred, -preferred]) {
3931
- for (let step = 1; step <= 100; step++) {
3932
- const lightness = l + direction * step / 100;
3933
- if (lightness < 0 || lightness > 1) break;
3934
- const candidate = fromHsl(h, s, lightness);
3935
- if (contrast(candidate, background) >= minimum) return candidate;
3936
- }
3937
- }
3938
- return contrast("#FFFFFF", background) >= contrast("#000000", background) ? "#FFFFFF" : "#000000";
3939
- }
3940
-
3941
3960
  // src/code-syntax.ts
3942
3961
  var CODE_HIGHLIGHT_MAX_LENGTH = 2e5;
3943
3962
  var CODE_SYNTAX_MIN_CONTRAST = 4.5;
@@ -4637,6 +4656,12 @@ function metricEffectiveSentiment(trend, sentiment) {
4637
4656
  }
4638
4657
  var METRIC_TREND_SHAPES = Object.freeze({ up: "upArrow", down: "downArrow", flat: "rightArrow" });
4639
4658
  var METRIC_TREND_MIN_CONTRAST = 4.5;
4659
+ var METRIC_VALUE_MIN_CONTRAST = 4.5;
4660
+ function metricValueColor(color, background) {
4661
+ const foreground = normalize(color), surface = normalize(background);
4662
+ if (!foreground || !surface || !isDarkColor(surface)) return color;
4663
+ return legible(foreground, surface, METRIC_VALUE_MIN_CONTRAST);
4664
+ }
4640
4665
  var SEMANTIC = {
4641
4666
  positive: { light: "#15803D", dark: "#4ADE80" },
4642
4667
  negative: { light: "#B91C1C", dark: "#F87171" }
@@ -4644,9 +4669,9 @@ var SEMANTIC = {
4644
4669
  function metricTrendColor(trend, options) {
4645
4670
  const background = normalize(options.background) ?? "#FFFFFF";
4646
4671
  const sentiment = metricEffectiveSentiment(trend, options.sentiment);
4647
- if (sentiment === "neutral") return legible(normalize(options.neutral) ?? (luminance2(background) < 0.5 ? "#CBD5E1" : "#475569"), background, METRIC_TREND_MIN_CONTRAST);
4672
+ if (sentiment === "neutral") return legible(normalize(options.neutral) ?? (luminance(background) < 0.5 ? "#CBD5E1" : "#475569"), background, METRIC_TREND_MIN_CONTRAST);
4648
4673
  const pair = SEMANTIC[sentiment];
4649
- return legible(luminance2(background) < 0.5 ? pair.dark : pair.light, background, METRIC_TREND_MIN_CONTRAST);
4674
+ return legible(luminance(background) < 0.5 ? pair.dark : pair.light, background, METRIC_TREND_MIN_CONTRAST);
4650
4675
  }
4651
4676
  function metricTrendPoints(shape, box) {
4652
4677
  const { x: l, y: t, width: w, height: h } = box, r = l + w, b = t + h, hc = l + w / 2, vc = t + h / 2, ss = Math.min(w, h);
@@ -5979,6 +6004,8 @@ function layoutMetric(value, box, options = {}) {
5979
6004
  return { bounds, algorithm: "metric-flow-v1", alignment, textMeasurement: options.textMeasurement ? "provided" : "estimated", arrangement: selected.arrangement, ...metric.sentiment === void 0 ? {} : { sentiment: metric.sentiment }, attempts, parts, diagnostics, overflow: diagnostics.length > 0 };
5980
6005
  }
5981
6006
  var TIMELINE_STATUS_VALUES = ["done", "current", "planned"];
6007
+ var TIMELINE_NARROW_EM = 8;
6008
+ var TIMELINE_NARROW_REDUCTIONS = 4;
5982
6009
  var TIMELINE_RING_RATIO = 1.6;
5983
6010
  function layoutTimeline(value, box, options = {}) {
5984
6011
  const shorthand = Array.isArray(value), timeline = shorthand ? { events: value } : value;
@@ -6042,87 +6069,96 @@ function layoutTimeline(value, box, options = {}) {
6042
6069
  let reductionLimit = 0;
6043
6070
  for (const part of source) reductionLimit = Math.max(reductionLimit, (part.requestedFontSize - minimum) / scale2);
6044
6071
  const reductions = Math.min(24, Math.ceil(reductionLimit));
6045
- for (let reduction = 0; reduction <= reductions; reduction++) {
6046
- for (const arrangement of ["alternating", "vertical"]) {
6047
- attempts++;
6048
- const parts = [], markers = [], diagnostics = [];
6049
- let score2 = 0;
6050
- const report = (part, reason, message, excess = 1) => {
6051
- diagnostics.push({ code: "text-overflow", reason, path: part.path, message });
6052
- score2 += Math.max(1, excess);
6053
- };
6054
- const place = (part, x, y2, width, alignment) => {
6055
- const measured = measure(part, gridFontSize(part.requestedFontSize - reduction * scale2, minimum), Math.max(scale2, width), alignment);
6056
- const area2 = { x, y: y2, width: Math.max(scale2, width), height: Math.max(scale2, measured.height) }, placement = outlines ? placeTextLines(measured.ink, area2, alignment, padding, measured.fit.directions) : void 0;
6057
- const fit = { ...measured.fit, ...placement ? { placement } : {}, overflow: measured.fit.overflow || !!placement?.overflow };
6058
- const accepted = { ...part, box: area2, alignment, fit };
6059
- parts.push(accepted);
6060
- if (fit.overflow) report(accepted, "text-fit", "Timeline field exceeds its readable width; increase its space or split the timeline.");
6061
- if (breaksInsideWord(part.text, fit)) report(accepted, "text-fit", "Timeline field would split a word; use a wider vertical arrangement or paginate events.");
6062
- if (area2.x < box.x - 0.01 || area2.y < box.y - 0.01 || area2.x + area2.width > box.x + box.width + 0.01 || area2.y + area2.height > box.y + box.height + 0.01) report(accepted, "part-outside-cell", "Timeline field extends outside its cell; increase the cell or paginate events.", Math.max(area2.x + area2.width - box.x - box.width, area2.y + area2.height - box.y - box.height));
6063
- return accepted;
6064
- };
6065
- let y = box.y;
6066
- for (const part of metadata) {
6067
- const placed = place(part, box.x, y, box.width, "center");
6068
- y += placed.box.height + 8 * scale2;
6069
- }
6070
- const available = box.y + box.height - y, count = events.length, radius = Math.min(9 * scale2, box.width / Math.max(2, count) / 5, Math.max(scale2, available) * 0.04);
6071
- const statusOf = (index) => timeline.events[index].status, ringRadius = radius * TIMELINE_RING_RATIO, strokeWidth = Math.min(2 * scale2, radius / 2);
6072
- const hasRing = timeline.events.some((event) => event.status === "current");
6073
- const marker = (index, x, y2) => {
6074
- const status = statusOf(index);
6075
- return { path: eventPath(index), eventIndex: index, x, y: y2, radius, ...status ? { status } : {}, ...status === "current" ? { ring: { radius: ringRadius } } : {}, ...status === "current" || status === "planned" ? { strokeWidth } : {} };
6076
- };
6077
- if (arrangement === "alternating") {
6078
- const width = box.width / Math.max(2, count), step = (box.width - width) / Math.max(1, count - 1), start = count === 1 ? box.x + box.width / 2 : box.x + width / 2;
6079
- const fieldGap = 4 * scale2, clearance = 24 * scale2;
6080
- const heights = events.map((fields2) => fields2.reduce((height, part) => height + measure(part, gridFontSize(part.requestedFontSize - reduction * scale2, minimum), width, "center").height, 0) + Math.max(0, fields2.length - 1) * fieldGap);
6081
- const markerExtent = hasRing ? ringRadius + strokeWidth / 2 : radius;
6082
- const upper = Math.max(markerExtent, ...heights.filter((_, index) => index % 2 === 0).map((height) => height + clearance));
6083
- const lower = Math.max(markerExtent, ...heights.filter((_, index) => index % 2 === 1).map((height) => height + clearance));
6084
- const lineY = y + Math.max(0, (available - upper - lower) / 2) + upper;
6085
- events.forEach((fields2, index) => {
6086
- const x = start + (rtl ? count - 1 - index : index) * step, top = index % 2 === 0 ? lineY - clearance - heights[index] : lineY + clearance, bottom = index % 2 === 0 ? lineY - clearance : box.y + box.height;
6087
- markers.push(marker(index, x, lineY));
6088
- let cursor = top;
6089
- for (const [fieldIndex, part] of fields2.entries()) {
6090
- const placed = place(part, x - width / 2, cursor, width, "center");
6091
- cursor += placed.box.height;
6092
- if (cursor > bottom + 0.01) report(placed, "event-space", "Timeline event labels exceed their side of the connector; change the arrangement or paginate events.", cursor - bottom);
6093
- if (fieldIndex < fields2.length - 1) cursor += fieldGap;
6094
- }
6095
- });
6096
- } else {
6097
- const outlined = timeline.events.some((event) => event.status === "planned");
6098
- const lead = hasRing ? ringRadius + strokeWidth / 2 : radius + (outlined ? strokeWidth / 2 : 0), gap = 2 * lead + 12 * scale2;
6099
- const x = rtl ? box.x + box.width - lead : box.x + lead, textX = rtl ? box.x : box.x + gap, width = box.width - gap;
6100
- events.forEach((fields2, index) => {
6101
- const top = y;
6102
- let first2;
6103
- for (const [fieldIndex, part] of fields2.entries()) {
6104
- const placed = place(part, textX, y, width, "left");
6105
- first2 ??= placed;
6106
- y += placed.box.height;
6107
- if (fieldIndex < fields2.length - 1) y += 4 * scale2;
6108
- }
6109
- markers.push(marker(index, x, top + Math.min(first2?.box.height ?? 2 * radius, 2 * radius) / 2));
6110
- y += 16 * scale2;
6111
- });
6112
- }
6113
- for (const marker2 of markers) {
6114
- const extent = (marker2.ring?.radius ?? marker2.radius) + (marker2.strokeWidth ?? 0) / 2;
6115
- if (marker2.x - extent < box.x - 0.01 || marker2.y - extent < box.y - 0.01 || marker2.x + extent > box.x + box.width + 0.01 || marker2.y + extent > box.y + box.height + 0.01) {
6116
- diagnostics.push({ code: "text-overflow", reason: "event-space", path: marker2.path, message: "Timeline marker has no usable space; increase the cell or paginate events." });
6117
- score2 += 1;
6072
+ const labelSize = source.find((part) => part.role === "what")?.requestedFontSize ?? gridFontSize(22 * scale2, minimum);
6073
+ const narrow = timeline.events.length > 1 && box.width / Math.max(2, timeline.events.length) < TIMELINE_NARROW_EM * labelSize;
6074
+ const tryArrangement = (arrangement, reduction) => {
6075
+ attempts++;
6076
+ const parts = [], markers = [], diagnostics = [];
6077
+ let score2 = 0;
6078
+ const report = (part, reason, message, excess = 1) => {
6079
+ diagnostics.push({ code: "text-overflow", reason, path: part.path, message });
6080
+ score2 += Math.max(1, excess);
6081
+ };
6082
+ const place = (part, x, y2, width, alignment) => {
6083
+ const measured = measure(part, gridFontSize(part.requestedFontSize - reduction * scale2, minimum), Math.max(scale2, width), alignment);
6084
+ const area2 = { x, y: y2, width: Math.max(scale2, width), height: Math.max(scale2, measured.height) }, placement = outlines ? placeTextLines(measured.ink, area2, alignment, padding, measured.fit.directions) : void 0;
6085
+ const fit = { ...measured.fit, ...placement ? { placement } : {}, overflow: measured.fit.overflow || !!placement?.overflow };
6086
+ const accepted = { ...part, box: area2, alignment, fit };
6087
+ parts.push(accepted);
6088
+ if (fit.overflow) report(accepted, "text-fit", "Timeline field exceeds its readable width; increase its space or split the timeline.");
6089
+ if (breaksInsideWord(part.text, fit)) report(accepted, "text-fit", "Timeline field would split a word; use a wider vertical arrangement or paginate events.");
6090
+ if (area2.x < box.x - 0.01 || area2.y < box.y - 0.01 || area2.x + area2.width > box.x + box.width + 0.01 || area2.y + area2.height > box.y + box.height + 0.01) report(accepted, "part-outside-cell", "Timeline field extends outside its cell; increase the cell or paginate events.", Math.max(area2.x + area2.width - box.x - box.width, area2.y + area2.height - box.y - box.height));
6091
+ return accepted;
6092
+ };
6093
+ let y = box.y;
6094
+ for (const part of metadata) {
6095
+ const placed = place(part, box.x, y, box.width, "center");
6096
+ y += placed.box.height + 8 * scale2;
6097
+ }
6098
+ const available = box.y + box.height - y, count = events.length, radius = Math.min(9 * scale2, box.width / Math.max(2, count) / 5, Math.max(scale2, available) * 0.04);
6099
+ const statusOf = (index) => timeline.events[index].status, ringRadius = radius * TIMELINE_RING_RATIO, strokeWidth = Math.min(2 * scale2, radius / 2);
6100
+ const hasRing = timeline.events.some((event) => event.status === "current");
6101
+ const marker = (index, x, y2) => {
6102
+ const status = statusOf(index);
6103
+ return { path: eventPath(index), eventIndex: index, x, y: y2, radius, ...status ? { status } : {}, ...status === "current" ? { ring: { radius: ringRadius } } : {}, ...status === "current" || status === "planned" ? { strokeWidth } : {} };
6104
+ };
6105
+ if (arrangement === "alternating") {
6106
+ const width = box.width / Math.max(2, count), step = (box.width - width) / Math.max(1, count - 1), start = count === 1 ? box.x + box.width / 2 : box.x + width / 2;
6107
+ const fieldGap = 4 * scale2, clearance = 24 * scale2;
6108
+ const heights = events.map((fields2) => fields2.reduce((height, part) => height + measure(part, gridFontSize(part.requestedFontSize - reduction * scale2, minimum), width, "center").height, 0) + Math.max(0, fields2.length - 1) * fieldGap);
6109
+ const markerExtent = hasRing ? ringRadius + strokeWidth / 2 : radius;
6110
+ const upper = Math.max(markerExtent, ...heights.filter((_, index) => index % 2 === 0).map((height) => height + clearance));
6111
+ const lower = Math.max(markerExtent, ...heights.filter((_, index) => index % 2 === 1).map((height) => height + clearance));
6112
+ const lineY = y + Math.max(0, (available - upper - lower) / 2) + upper;
6113
+ events.forEach((fields2, index) => {
6114
+ const x = start + (rtl ? count - 1 - index : index) * step, top = index % 2 === 0 ? lineY - clearance - heights[index] : lineY + clearance, bottom = index % 2 === 0 ? lineY - clearance : box.y + box.height;
6115
+ markers.push(marker(index, x, lineY));
6116
+ let cursor = top;
6117
+ for (const [fieldIndex, part] of fields2.entries()) {
6118
+ const placed = place(part, x - width / 2, cursor, width, "center");
6119
+ cursor += placed.box.height;
6120
+ if (cursor > bottom + 0.01) report(placed, "event-space", "Timeline event labels exceed their side of the connector; change the arrangement or paginate events.", cursor - bottom);
6121
+ if (fieldIndex < fields2.length - 1) cursor += fieldGap;
6122
+ }
6123
+ });
6124
+ } else {
6125
+ const outlined = timeline.events.some((event) => event.status === "planned");
6126
+ const lead = hasRing ? ringRadius + strokeWidth / 2 : radius + (outlined ? strokeWidth / 2 : 0), gap = 2 * lead + 12 * scale2;
6127
+ const x = rtl ? box.x + box.width - lead : box.x + lead, textX = rtl ? box.x : box.x + gap, width = box.width - gap;
6128
+ events.forEach((fields2, index) => {
6129
+ const top = y;
6130
+ let first2;
6131
+ for (const [fieldIndex, part] of fields2.entries()) {
6132
+ const placed = place(part, textX, y, width, "left");
6133
+ first2 ??= placed;
6134
+ y += placed.box.height;
6135
+ if (fieldIndex < fields2.length - 1) y += 4 * scale2;
6118
6136
  }
6137
+ markers.push(marker(index, x, top + Math.min(first2?.box.height ?? 2 * radius, 2 * radius) / 2));
6138
+ y += 16 * scale2;
6139
+ });
6140
+ }
6141
+ for (const marker2 of markers) {
6142
+ const extent = (marker2.ring?.radius ?? marker2.radius) + (marker2.strokeWidth ?? 0) / 2;
6143
+ if (marker2.x - extent < box.x - 0.01 || marker2.y - extent < box.y - 0.01 || marker2.x + extent > box.x + box.width + 0.01 || marker2.y + extent > box.y + box.height + 0.01) {
6144
+ diagnostics.push({ code: "text-overflow", reason: "event-space", path: marker2.path, message: "Timeline marker has no usable space; increase the cell or paginate events." });
6145
+ score2 += 1;
6146
+ }
6147
+ }
6148
+ const first = markers[0], last = markers.at(-1), connector = rtl ? { x1: Math.min(first.x, last.x), y1: first.y, x2: Math.max(first.x, last.x), y2: last.y } : { x1: first.x, y1: first.y, x2: last.x, y2: last.y };
6149
+ const candidate = { arrangement, parts, markers, connector, diagnostics, score: score2 };
6150
+ if (!selected || score2 < selected.score) selected = candidate;
6151
+ return !diagnostics.length;
6152
+ };
6153
+ let settled = false;
6154
+ if (narrow) for (let reduction = 0; reduction <= Math.min(reductions, TIMELINE_NARROW_REDUCTIONS) && !settled; reduction++) settled = tryArrangement("vertical", reduction);
6155
+ for (let reduction = 0; reduction <= reductions && !settled; reduction++) {
6156
+ for (const arrangement of ["alternating", "vertical"]) {
6157
+ if (tryArrangement(arrangement, reduction)) {
6158
+ settled = true;
6159
+ break;
6119
6160
  }
6120
- const first = markers[0], last = markers.at(-1), connector = rtl ? { x1: Math.min(first.x, last.x), y1: first.y, x2: Math.max(first.x, last.x), y2: last.y } : { x1: first.x, y1: first.y, x2: last.x, y2: last.y };
6121
- const candidate = { arrangement, parts, markers, connector, diagnostics, score: score2 };
6122
- if (!selected || score2 < selected.score) selected = candidate;
6123
- if (!diagnostics.length) break;
6124
6161
  }
6125
- if (!selected.diagnostics.length) break;
6126
6162
  }
6127
6163
  const { score, ...result } = selected;
6128
6164
  if (result.diagnostics.length && options.overflow === "error") throw new OPFCompositionError(result.diagnostics);
@@ -6537,15 +6573,16 @@ function layoutTable(value, box, options = {}) {
6537
6573
  const shown = tableCellDisplayValue(cell.input, formats[cell.column]);
6538
6574
  if (shown !== cell.input) cell.value = typeof shown === "object" && shown !== null && !Array.isArray(shown) ? shown.value : shown;
6539
6575
  }
6540
- const columnCount = grid.columnCount, cellWidth = box.width / columnCount;
6576
+ const columnCount = grid.columnCount;
6541
6577
  const cells = grid.rows.flat().map((cell) => {
6542
6578
  const padding = { top: 8, right: 10, bottom: 4, left: 10, ...cell.style.padding };
6543
- const width = cellWidth * cell.colSpan - (padding.left + padding.right) * scale2;
6579
+ const width = 0;
6544
6580
  const style = { fontFamily: options.fontFamily ?? "sans-serif", fontWeight: cell.header || cell.style.bold ? 700 : 400, italic: false, path: cell.valuePath };
6545
6581
  const numericDefault = numeric.has(cell) || (cell.header || Array.isArray(cell.value)) && cell.colSpan === 1 && numericColumns.has(cell.column);
6546
6582
  const alignment = cell.style.align ?? options.alignment ?? (numericDefault ? options.direction === "rtl" ? "left" : "right" : "left");
6547
6583
  return { ...cell, padding, width, textStyle: style, alignment };
6548
6584
  });
6585
+ const columnWidths2 = Array(columnCount).fill(box.width / columnCount);
6549
6586
  const cellMinimum = (cell) => Array.isArray(cell.value) ? richMinimum(cell.value, requested, minimum) : minimum;
6550
6587
  let trial = requested;
6551
6588
  const cellSize = (cell) => {
@@ -6556,6 +6593,59 @@ function layoutTable(value, box, options = {}) {
6556
6593
  const textBox = { width: Math.max(scale2, cell.width), height: Math.max(scale2, height) }, size = cellSize(cell);
6557
6594
  return Array.isArray(cell.value) ? richTextLayouter(cell.value, textBox, requested, { style: cell.textStyle, ...options.codeFontFamily ? { codeFontFamily: options.codeFontFamily } : {}, textMeasurement: options.textMeasurement, uniformLineHeight: true, direction: options.direction }, minimum)(size) : fitText(flatten(cell.value), textBox, size, size, textWidthMeasurer(resolveTextStyle(cell.textStyle, options.textMeasurement), options.textMeasurement), options.direction);
6558
6595
  };
6596
+ const horizontalPadding = (cell) => (cell.padding.left + cell.padding.right) * scale2;
6597
+ const measureText2 = (cell) => textWidthMeasurer(resolveTextStyle(cell.textStyle, options.textMeasurement), options.textMeasurement);
6598
+ const wordSplit = /[^\S\u00a0\u202f\ufeff]+/u;
6599
+ const demand = (cell) => {
6600
+ const measure = measureText2(cell), size = cellSize(cell);
6601
+ let widest = 0, longest = 0;
6602
+ for (const line2 of flatten(cell.value).split(/\r\n|\r|\n/)) {
6603
+ longest = Math.max(longest, measure(line2.replace(/\t/g, " "), size));
6604
+ for (const word of line2.split(wordSplit)) {
6605
+ if (!word) continue;
6606
+ widest = Math.max(widest, UNSPACED_SCRIPT.test(word) ? Math.max(...[...word].map((character) => measure(character, size))) : measure(word, size));
6607
+ }
6608
+ }
6609
+ const padding = horizontalPadding(cell), slack = 0.5 * scale2;
6610
+ return { min: widest > 0 ? widest + padding + slack : padding, max: Math.max(longest + padding + slack, padding) };
6611
+ };
6612
+ const sizeColumns = () => {
6613
+ const min = Array(columnCount).fill(0), max = Array(columnCount).fill(0), demands = cells.map(demand);
6614
+ cells.forEach((cell, index) => {
6615
+ if (cell.colSpan === 1) {
6616
+ min[cell.column] = Math.max(min[cell.column], demands[index].min);
6617
+ max[cell.column] = Math.max(max[cell.column], demands[index].max);
6618
+ }
6619
+ });
6620
+ cells.forEach((cell, index) => {
6621
+ if (cell.colSpan > 1) for (const [need, target] of [[demands[index].min, min], [demands[index].max, max]]) {
6622
+ const columns2 = Array.from({ length: cell.colSpan }, (_, offset) => cell.column + offset), have = columns2.reduce((sum2, column) => sum2 + target[column], 0);
6623
+ if (need > have) for (const column of columns2) target[column] += (need - have) / cell.colSpan;
6624
+ }
6625
+ });
6626
+ const total = box.width, sum = (values) => values.reduce((a, b) => a + b, 0);
6627
+ for (let column = 0; column < columnCount; column++) max[column] = Math.max(max[column], min[column], 1);
6628
+ const minTotal = sum(min), maxTotal = sum(max);
6629
+ let widths;
6630
+ if (maxTotal <= total) widths = max.map((value2) => value2 + (total - maxTotal) * value2 / maxTotal);
6631
+ else if (minTotal <= total) {
6632
+ let low = 0, high = total;
6633
+ for (let step = 0; step < 60; step++) {
6634
+ const level = (low + high) / 2;
6635
+ if (sum(min.map((value2, column) => Math.min(max[column], Math.max(value2, level)))) > total) high = level;
6636
+ else low = level;
6637
+ }
6638
+ widths = min.map((value2, column) => Math.min(max[column], Math.max(value2, low)));
6639
+ const rest = total - sum(widths), open = widths.map((value2, column) => value2 > min[column] + 1e-9 && value2 < max[column] - 1e-9);
6640
+ const target = open.indexOf(true);
6641
+ if (target >= 0) widths[target] += rest;
6642
+ else widths[widths.indexOf(Math.max(...widths))] += rest;
6643
+ } else widths = min.map((value2) => value2 * total / Math.max(minTotal, Number.EPSILON));
6644
+ columnWidths2.splice(0, columnCount, ...widths);
6645
+ for (const cell of cells) cell.width = sum(columnWidths2.slice(cell.column, cell.column + cell.colSpan)) - horizontalPadding(cell);
6646
+ return min;
6647
+ };
6648
+ const splitsWords = () => cells.some((cell) => demand(cell).min - 0.5 * scale2 > cell.width + horizontalPadding(cell) + 0.01);
6559
6649
  const textHeight = (fit) => "height" in fit ? fit.height : fit.lines.length * fit.lineHeight;
6560
6650
  const required = (cell, natural) => {
6561
6651
  const floor = cellMinimum(cell), size = gridFontSize(natural ? Math.max(trial, floor) : floor, floor);
@@ -6584,7 +6674,8 @@ function layoutTable(value, box, options = {}) {
6584
6674
  let overflow = false;
6585
6675
  const rows3 = heights.map((height, r) => ({ box: { x: box.x, y: ys[r], width: box.width, height }, cells: [] }));
6586
6676
  for (const cell of cells) {
6587
- const cellBox = { x: box.x + (options.direction === "rtl" ? columnCount - cell.column - cell.colSpan : cell.column) * cellWidth, y: ys[cell.row], width: cell.colSpan * cellWidth, height: ys[cell.row + cell.rowSpan] - ys[cell.row] };
6677
+ const before = options.direction === "rtl" ? columnWidths2.slice(cell.column + cell.colSpan) : columnWidths2.slice(0, cell.column);
6678
+ const cellBox = { x: box.x + before.reduce((a, b) => a + b, 0), y: ys[cell.row], width: columnWidths2.slice(cell.column, cell.column + cell.colSpan).reduce((a, b) => a + b, 0), height: ys[cell.row + cell.rowSpan] - ys[cell.row] };
6588
6679
  const available = cellBox.height - (cell.padding.top + cell.padding.bottom) * scale2;
6589
6680
  const fit = fitCell(cell, available), height = textHeight(fit);
6590
6681
  const offset = cell.style.verticalAlign === "bottom" ? Math.max(0, available - height) : cell.style.verticalAlign === "middle" ? Math.max(0, (available - height) / 2) : 0;
@@ -6592,13 +6683,14 @@ function layoutTable(value, box, options = {}) {
6592
6683
  overflow ||= cell.width <= 0 || available <= 0 || fit.overflow;
6593
6684
  rows3[cell.row].cells.push({ value: cell.value, input: cell.input, path: cell.valuePath, sourcePath: cell.path, style: cell.style, alignment: cell.alignment, row: cell.row, column: cell.column, rowSpan: cell.rowSpan, colSpan: cell.colSpan, header: cell.header, rich: Array.isArray(cell.value), box: cellBox, textBox, textStyle: resolveTextStyle(cell.textStyle, options.textMeasurement), fit, ...fit.directions ? { direction: fit.directions[0] } : {} });
6594
6685
  }
6595
- return { rows: rows3, columnCount, height: sum(heights), overflow };
6686
+ return { rows: rows3, columnCount, height: sum(heights), overflow, columnWidths: [...columnWidths2], splitsWords: false };
6596
6687
  };
6597
6688
  for (let step = 0; ; step++) {
6598
6689
  const raw = requested - step * scale2, last = step === 64 || raw <= minimum;
6599
6690
  trial = last ? snapFontSizeUp(minimum) : gridFontSize(raw, minimum);
6600
- const layout = place();
6601
- if (last || !layout.overflow) return layout;
6691
+ sizeColumns();
6692
+ const layout = place(), splits = splitsWords();
6693
+ if (last || !layout.overflow && !splits) return { ...layout, splitsWords: splits };
6602
6694
  }
6603
6695
  }
6604
6696
  function tableOverflows(value, box, scale2, settings, options, path) {
@@ -7499,4 +7591,4 @@ function resolveCanvasDimensions(input) {
7499
7591
  return { width, height };
7500
7592
  }
7501
7593
 
7502
- export { AUTO_LAYOUT, CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_SERIES_TIER_SIZE, CHART_SERIES_TINT_MIX, CHART_TEXT_PX, CHART_TYPES, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT, DEFAULT_VARIABLE_DATE_FORMAT, DESIGN_HINT_KEYS, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, FONT_SIZE_GRID_PER_PX, FOOTNOTE_MAX_RATIO, FURNITURE_GAP, FURNITURE_IMAGE_SHARE, FURNITURE_ZONE_GUTTER, HEADING_AREAS, LANGUAGES, LAYOUT_BODY_KINDS, LOGO_SHAPES, MAX_COMPOSITION_DEPTH, MAX_NUMBERING_LEVELS, MAX_NUMBERING_VALUE, MAX_REGION_BLOCKS, MAX_REGION_DEPTH, MAX_REGION_ENTRIES, MAX_ROMAN_VALUE, MAX_TEMPLATE_TRACKS, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, NEUTRAL_SHARES, NUMBERING_STYLES, NUMBERING_SUFFIXES, OPFCatalogsOptionError, OPFCompositionError, OPFLayoutTemplateError, OPFUnresolvedReferenceError, OPFVariableError, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, PICTURE_BULLET_SCALE, PROMOTED_REGION_KEY, REGION_ANCHORS, REGION_FLOWS, REGION_KINDS, REGION_ROLES, RESERVED_REGION_NAMES, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, SURFACE_ALT_MIN_CONTRAST, SURFACE_ALT_MIX, THEME_DESIGN_KEYS, TIMELINE_OUTLINE_MIN_CONTRAST, TIMELINE_STATUSES, TIMELINE_TEXT_MIN_CONTRAST, VARIABLE_KINDS, allocateRows, annotationText, applyLuminance, bindRegions, blockKind, captionSettings, catalogGroupDeclared, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartColorForFill, chartHighlightColors, chartHighlightMarks, chartLabelText, chartNumber, chartNumberFixesByCell, chartOptionSupport, chartOptionTarget, chartPaletteForFill, chartSeriesPalette, chartTextSize, chartValueAxis, checkCatalogsOption, citationMarkerText, clrMapAttributes, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeHighlightSlice, codeLineNumbers, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForRoles, codeSyntaxPaletteForScheme, coerceVariableValue, collectCitations, colorContrast, colorMapFor, composeLayoutAreas, composeSlide, datasetDiagnostics, defaultSlideBackground, dottedPath, embeddedCopy, fitImage, fitList, fitRichText, fitText, formatChartLabelNumber, formatChartLabelPercent, formatDataNumber, formatFurnitureDate, formatListNumber, formatVariableNumber, fromExcelNumberFormat, gridFlowShape, hasContentVariables, imageBackground, imageShape, inlineChartData, inlineDatasets, inlineTableData, instantiateForValidation, intrinsicImageAspect, intrinsicImageSize, isColorVariant, isDarkColor, isDatasetRef, isLayoutTemplate, isRecord, isTemplate, isXYChartType, layoutCaption, layoutCode, layoutContent, layoutEntries, layoutFootnotes, layoutFurniture, layoutMetric, layoutQuote, layoutRegion, layoutStructure, layoutTable, layoutTemplate, layoutTemplateIssues, layoutTimeline, layoutWatermark, listBuiltinVariables, listColumnBreaks, listNumbers, listVariables, maxIntervalsFor, measureText, measureTextOutline, metricTrendColor, metricTrendMark, metricTrendPoints, niceScale, normalizeColorVariant, normalizeHexColor, normalizeLanguageFamily, numberFormatError, numberingAtLevel, numberingFindings, numberingStyleDraws, paragraphDirection, paragraphDirectionAt, parseReference, pathFor, patternBitmap, patternRuns, physicalAlignment, placeTextLines, placedImageBlocks, pointerPath, promotedRegionKeys, provenanceOf, readableSchemeColor, readingRows, recordReferenceSites, referencesSlide, regionAccepts, regionRoleRank, registeredCatalog, resolveCanvasDimensions, resolveChartColors, resolveChartData, resolveChartOptions, resolveCodeLanguage, resolveColorRef, resolveColorRoles, resolveDesignHints, resolveDesignRecords, resolveFontFamilies, resolveFontScheme, resolveLogo, resolveNumbering, resolvePatternPreset, resolveReference, resolveScriptFonts, resolveSlideDirection, resolveSlideVariables, resolveSocialProfile, resolveTableData, resolveTextStyle, resolveVariables, rootNodes, scriptFontRole, sliceNumberedItems, slideCitations, slideTokenSpans, snapFontSizeDown, snapFontSizeUp, stackCategoryValues, suggestChartNumberFix, surfaceAltColor, tableCellDisplayValue, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, timelineMarkerShapes, timelineTextColor, toExcelNumberFormat, tokenizeCode, unresolvedReference, unusedDatasets, usesSlideBuiltin, variableDeclarations, visitContentPayloads, visualReadingOrder, walkCitationRuns, wrapText };
7594
+ export { AUTO_LAYOUT, CAPTIONABLE_FIELDS, CAPTION_FONT_RATIO, CAPTION_MAX_RATIO, CATALOG_GROUP_PATTERN, CATALOG_REFERENCE_PATTERN, CHART_HIGHLIGHT_MUTED_MIN_CONTRAST, CHART_HIGHLIGHT_MUTED_MIX, CHART_LEAD_MIN_CONTRAST, CHART_MAX_INTERVALS, CHART_MIN_TICK_SPACING_PX, CHART_SERIES_MIN_DIFFERENCE, CHART_SERIES_MIN_LIGHTNESS_STEP, CHART_SERIES_TIER_SIZE, CHART_SERIES_TINT_MIX, CHART_TEXT_FLOOR_PX, CHART_TEXT_PX, CHART_TYPES, CITATION_MARKER_RAISE, CITATION_MARKER_SCALE, CODE_HIGHLIGHT_LANGUAGES, CODE_HIGHLIGHT_MAX_LENGTH, CODE_PANEL_BACKGROUND, CODE_PANEL_FOREGROUND, CODE_SYNTAX_MIN_CONTRAST, DARK_BACKGROUND_LUMINANCE, DEFAULT_CHART_LABEL_SEPARATOR, DEFAULT_FURNITURE_DATE_FORMAT, DEFAULT_VARIABLE_DATE_FORMAT, DESIGN_HINT_KEYS, ENGINE_DEFAULT_CHART_TYPES, ENGINE_DEFAULT_COLOR_SCHEME, ENGINE_DEFAULT_FONT_SCHEME, ENGINE_DEFAULT_THEME, FONT_SIZE_GRID_PER_PX, FOOTNOTE_MAX_RATIO, FURNITURE_GAP, FURNITURE_IMAGE_SHARE, FURNITURE_ZONE_GUTTER, HEADING_AREAS, LANGUAGES, LAYOUT_BODY_KINDS, LOGO_SHAPES, MAX_COMPOSITION_DEPTH, MAX_NUMBERING_LEVELS, MAX_NUMBERING_VALUE, MAX_REGION_BLOCKS, MAX_REGION_DEPTH, MAX_REGION_ENTRIES, MAX_ROMAN_VALUE, MAX_TEMPLATE_TRACKS, METRIC_TREND_MIN_CONTRAST, METRIC_TREND_SHAPES, METRIC_VALUE_MIN_CONTRAST, NEUTRAL_SHARES, NUMBERING_STYLES, NUMBERING_SUFFIXES, OPFCatalogsOptionError, OPFCompositionError, OPFLayoutTemplateError, OPFUnresolvedReferenceError, OPFVariableError, PATTERN_PRESETS, PATTERN_PRESET_ALIASES, PATTERN_TILE_SIZE, PICTURE_BULLET_SCALE, PROMOTED_REGION_KEY, REGION_ANCHORS, REGION_FLOWS, REGION_KINDS, REGION_ROLES, RESERVED_REGION_NAMES, SLIDE_SCOPED_BUILTINS, SOCIAL_PLATFORMS, SURFACE_ALT_MIN_CONTRAST, SURFACE_ALT_MIX, THEME_DESIGN_KEYS, TIMELINE_OUTLINE_MIN_CONTRAST, TIMELINE_STATUSES, TIMELINE_TEXT_MIN_CONTRAST, VARIABLE_KINDS, allocateRows, annotationText, applyLuminance, bindRegions, blockKind, captionSettings, catalogGroupDeclared, catalogGroupSource, catalogKinds, catalogRecords, catalogReferenceSites, chartColorForFill, chartHighlightColors, chartHighlightMarks, chartIntervalsFor, chartLabelText, chartLeadFromScheme, chartNumber, chartNumberFixesByCell, chartOptionSupport, chartOptionTarget, chartPaletteForFill, chartSeriesPalette, chartTextSize, chartValueAxis, checkCatalogsOption, citationMarkerText, clrMapAttributes, codeHighlightBands, codeHighlightColors, codeHighlightLines, codeHighlightSlice, codeLineNumbers, codeLineRuns, codeSyntaxPalette, codeSyntaxPaletteForRoles, codeSyntaxPaletteForScheme, coerceVariableValue, collectCitations, colorContrast, colorMapFor, composeLayoutAreas, composeSlide, datasetDiagnostics, defaultSlideBackground, dottedPath, embeddedCopy, fitImage, fitList, fitRichText, fitText, formatChartLabelNumber, formatChartLabelPercent, formatDataNumber, formatFurnitureDate, formatListNumber, formatVariableNumber, fromExcelNumberFormat, gridFlowShape, hasContentVariables, imageBackground, imageShape, inlineChartData, inlineDatasets, inlineTableData, instantiateForValidation, intrinsicImageAspect, intrinsicImageSize, isColorVariant, isDarkColor, isDatasetRef, isLayoutTemplate, isRecord, isTemplate, isXYChartType, layoutCaption, layoutCode, layoutContent, layoutEntries, layoutFootnotes, layoutFurniture, layoutMetric, layoutQuote, layoutRegion, layoutStructure, layoutTable, layoutTemplate, layoutTemplateIssues, layoutTimeline, layoutWatermark, listBuiltinVariables, listColumnBreaks, listNumbers, listVariables, maxIntervalsFor, measureText, measureTextOutline, metricTrendColor, metricTrendMark, metricTrendPoints, metricValueColor, niceScale, normalizeColorVariant, normalizeHexColor, normalizeLanguageFamily, numberFormatError, numberingAtLevel, numberingFindings, numberingStyleDraws, paragraphDirection, paragraphDirectionAt, parseReference, pathFor, patternBitmap, patternRuns, physicalAlignment, placeTextLines, placedImageBlocks, pointerPath, promotedRegionKeys, provenanceOf, readableSchemeColor, readingRows, recordReferenceSites, referencesSlide, regionAccepts, regionRoleRank, registeredCatalog, resolveCanvasDimensions, resolveChartColors, resolveChartData, resolveChartOptions, resolveCodeLanguage, resolveColorRef, resolveColorRoles, resolveDesignHints, resolveDesignRecords, resolveFontFamilies, resolveFontScheme, resolveLogo, resolveNumbering, resolvePatternPreset, resolveReference, resolveScriptFonts, resolveSlideDirection, resolveSlideVariables, resolveSocialProfile, resolveTableData, resolveTextStyle, resolveVariables, rootNodes, scriptFontRole, sliceNumberedItems, slideCitations, slideTokenSpans, snapFontSizeDown, snapFontSizeUp, stackCategoryValues, suggestChartNumberFix, surfaceAltColor, tableCellDisplayValue, tableGrid, tableRowBoundaries, textColorForFill, textWidthMeasurer, timelineMarkerShapes, timelineTextColor, toExcelNumberFormat, tokenizeCode, unresolvedReference, unusedDatasets, usesSlideBuiltin, variableDeclarations, visitContentPayloads, visualReadingOrder, walkCitationRuns, wrapText };
@@ -1,4 +1,4 @@
1
- import { presentation } from './chunk-F4HFDP6I.js';
1
+ import { presentation } from './chunk-4ZM5G3XX.js';
2
2
 
3
3
  // src/format.ts
4
4
  var OPFFormatError = class extends Error {
@@ -1,8 +1,8 @@
1
- import { fromMarkdown, toMarkdown } from './chunk-3S2XVDPN.js';
2
- import { fromYaml, toYaml } from './chunk-VZBFQLCA.js';
1
+ import { fromMarkdown, toMarkdown } from './chunk-GNKESMZT.js';
2
+ import { fromYaml, toYaml } from './chunk-KZPZRHL6.js';
3
3
  import { NOT_CHECKED } from './chunk-RYZPBJLB.js';
4
- import { parseSource, validate, OPFValidationError } from './chunk-IVPA6NG6.js';
5
- import { checkCatalogsOption } from './chunk-XRMV2GMB.js';
4
+ import { parseSource, validate, OPFValidationError } from './chunk-PAGVSTVF.js';
5
+ import { checkCatalogsOption } from './chunk-LRTQXGJO.js';
6
6
 
7
7
  // src/deck-report.ts
8
8
  var DECK_FORMATS = ["json", "yaml", "markdown"];