@pipelex/mthds-ui 0.30.0 → 0.31.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.
@@ -5,7 +5,7 @@ import {
5
5
  GRAPH_THEME,
6
6
  GRAPH_THEME_MODE,
7
7
  TOOLBAR_POSITION
8
- } from "./chunk-PJTYQURQ.js";
8
+ } from "./chunk-QRO3TYZE.js";
9
9
  import {
10
10
  __spreadProps,
11
11
  __spreadValues
@@ -195,4 +195,4 @@ export {
195
195
  DEFAULT_GRAPH_CONFIG,
196
196
  getPaletteColors
197
197
  };
198
- //# sourceMappingURL=chunk-GAOBB3UT.js.map
198
+ //# sourceMappingURL=chunk-7H3RHOYA.js.map
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-2N65P32H.js";
5
5
  import {
6
6
  DEFAULT_GRAPH_CONFIG
7
- } from "./chunk-GAOBB3UT.js";
7
+ } from "./chunk-7H3RHOYA.js";
8
8
  import {
9
9
  ARROW_CLOSED_MARKER,
10
10
  BINDING_STEP_TYPE,
@@ -31,7 +31,7 @@ import {
31
31
  nodeWidth,
32
32
  stuffDigestFromId,
33
33
  stuffNodeId
34
- } from "./chunk-PJTYQURQ.js";
34
+ } from "./chunk-QRO3TYZE.js";
35
35
  import {
36
36
  __objRest,
37
37
  __spreadProps,
@@ -2088,9 +2088,12 @@ var STEP_PADDING_Y = 10;
2088
2088
  var STEP_BORDER = 1.5;
2089
2089
  var STEP_HEADER_HEIGHT = 16;
2090
2090
  var STEP_GAP = 6;
2091
- var SIMPLE_STEP_TITLE_FONT_PX = 15;
2092
- var STEP_TITLE_LINE_HEIGHT = 20;
2093
- var SIMPLE_TITLE_MAX_LINES = 3;
2091
+ var SIMPLE_STEP_TITLE_FITS = [
2092
+ { boxWidth: SIMPLE_STEP_WIDTH, fontPx: 15, lineHeightPx: 20, maxLines: 3 },
2093
+ { boxWidth: SIMPLE_STEP_WIDE_WIDTH, fontPx: 15, lineHeightPx: 20, maxLines: 3 },
2094
+ { boxWidth: SIMPLE_STEP_WIDTH, fontPx: 13, lineHeightPx: 17, maxLines: 5 },
2095
+ { boxWidth: SIMPLE_STEP_WIDTH, fontPx: 12, lineHeightPx: 16, maxLines: 7 }
2096
+ ];
2094
2097
  var STEP_MARKER_HEIGHT = 18;
2095
2098
  var STEP_INNER_HEIGHT = 22;
2096
2099
  var EDGE_LABEL_FONT_PX = 11;
@@ -2108,6 +2111,7 @@ var TERMINAL_MIN_HEIGHT = 52;
2108
2111
  var SIMPLE_DECISION_WIDTHS = [188, 220, 252, 284];
2109
2112
  var DECISION_TITLE_FONT_PX = 13;
2110
2113
  var DECISION_TITLE_LINE_HEIGHT = 16;
2114
+ var DECISION_TITLE_MAX_LINES = 3;
2111
2115
  var DECISION_TEXT_WIDTH_SHARE = 0.56;
2112
2116
  var DECISION_TEXT_HEIGHT_SHARE = 0.4;
2113
2117
  var DECISION_MIN_HEIGHT = 84;
@@ -2153,20 +2157,20 @@ var STEP_CATEGORY_WORDS = {
2153
2157
  repeat: "For each",
2154
2158
  pick: "Pick"
2155
2159
  };
2156
- function simpleStepSize(title, options = {}) {
2157
- let width = SIMPLE_STEP_WIDTH;
2158
- let wrap = simpleTitleWrap(title);
2159
- if (wrap.clamped) {
2160
- const wide = simpleTitleWrap(title, SIMPLE_STEP_WIDE_WIDTH);
2161
- if (!wide.clamped) {
2162
- width = SIMPLE_STEP_WIDE_WIDTH;
2163
- wrap = wide;
2164
- }
2160
+ function simpleTitleFit(title) {
2161
+ for (const fit of SIMPLE_STEP_TITLE_FITS) {
2162
+ const wrap = simpleTitleWrap(title, fit);
2163
+ if (!wrap.clamped) return { fit, wrap };
2165
2164
  }
2166
- let height = 2 * STEP_PADDING_Y + STEP_HEADER_HEIGHT + STEP_GAP + Math.max(1, wrap.drawnLines) * STEP_TITLE_LINE_HEIGHT;
2165
+ const floor = SIMPLE_STEP_TITLE_FITS[SIMPLE_STEP_TITLE_FITS.length - 1];
2166
+ return { fit: floor, wrap: simpleTitleWrap(title, floor) };
2167
+ }
2168
+ function simpleStepSize(title, options = {}) {
2169
+ const { fit, wrap } = simpleTitleFit(title);
2170
+ let height = 2 * STEP_PADDING_Y + STEP_HEADER_HEIGHT + STEP_GAP + Math.max(1, wrap.drawnLines) * fit.lineHeightPx;
2167
2171
  if (options.forEach) height += STEP_GAP + STEP_MARKER_HEIGHT;
2168
2172
  if (options.innerSteps) height += STEP_GAP + STEP_INNER_HEIGHT;
2169
- return { width, height: Math.ceil(height + 2 * STEP_BORDER) };
2173
+ return { width: fit.boxWidth, height: Math.ceil(height + 2 * STEP_BORDER) };
2170
2174
  }
2171
2175
  function simpleTerminalSize(title, hasSubtitle) {
2172
2176
  const wrap = estimateWrap(
@@ -2184,7 +2188,7 @@ function simpleDecisionSize(title) {
2184
2188
  title,
2185
2189
  decisionTextWidth(width),
2186
2190
  DECISION_TITLE_FONT_PX,
2187
- SIMPLE_TITLE_MAX_LINES
2191
+ DECISION_TITLE_MAX_LINES
2188
2192
  );
2189
2193
  for (const candidate of SIMPLE_DECISION_WIDTHS.slice(1)) {
2190
2194
  if (!wrap.clamped) break;
@@ -2193,20 +2197,15 @@ function simpleDecisionSize(title) {
2193
2197
  title,
2194
2198
  decisionTextWidth(width),
2195
2199
  DECISION_TITLE_FONT_PX,
2196
- SIMPLE_TITLE_MAX_LINES
2200
+ DECISION_TITLE_MAX_LINES
2197
2201
  );
2198
2202
  }
2199
2203
  const textHeight = Math.max(1, wrap.drawnLines) * DECISION_TITLE_LINE_HEIGHT;
2200
2204
  const height = Math.max(DECISION_MIN_HEIGHT, Math.ceil(textHeight / DECISION_TEXT_HEIGHT_SHARE));
2201
2205
  return { width, height };
2202
2206
  }
2203
- function simpleTitleWrap(title, boxWidth = SIMPLE_STEP_WIDTH) {
2204
- return estimateWrap(
2205
- title,
2206
- stepTitleWidth(boxWidth),
2207
- SIMPLE_STEP_TITLE_FONT_PX,
2208
- SIMPLE_TITLE_MAX_LINES
2209
- );
2207
+ function simpleTitleWrap(title, fit) {
2208
+ return estimateWrap(title, stepTitleWidth(fit.boxWidth), fit.fontPx, fit.maxLines);
2210
2209
  }
2211
2210
  var STATUS_PRECEDENCE = [
2212
2211
  "failed",
@@ -2655,6 +2654,7 @@ function projectSimpleGraph(input) {
2655
2654
  const simple = __spreadValues(__spreadValues(__spreadValues(__spreadValues({
2656
2655
  kind: "step",
2657
2656
  title,
2657
+ titleFit: simpleTitleFit(title).fit,
2658
2658
  category: STEP_CATEGORY_BY_PIPE_TYPE[pipeType],
2659
2659
  status: stepStatus(spec)
2660
2660
  }, graphMode !== void 0 ? { graphMode } : {}), forEach ? { forEach } : {}), innerStepCount !== void 0 ? { innerStepCount } : {}), onExpand ? { onExpand } : {});
@@ -2965,13 +2965,13 @@ export {
2965
2965
  estimateWrap,
2966
2966
  SIMPLE_STEP_WIDTH,
2967
2967
  SIMPLE_STEP_WIDE_WIDTH,
2968
- SIMPLE_STEP_TITLE_FONT_PX,
2969
- SIMPLE_TITLE_MAX_LINES,
2968
+ SIMPLE_STEP_TITLE_FITS,
2970
2969
  SIMPLE_TERMINAL_WIDTH,
2971
2970
  SIMPLE_DECISION_WIDTHS,
2972
2971
  SIMPLE_FOLD_DEPTH,
2973
2972
  STEP_CATEGORY_BY_PIPE_TYPE,
2974
2973
  STEP_CATEGORY_WORDS,
2974
+ simpleTitleFit,
2975
2975
  simpleStepSize,
2976
2976
  simpleTerminalSize,
2977
2977
  simpleDecisionSize,
@@ -2983,4 +2983,4 @@ export {
2983
2983
  applySimpleFrames,
2984
2984
  GRAPH_STYLE_PIPELINES
2985
2985
  };
2986
- //# sourceMappingURL=chunk-3BXB6HSF.js.map
2986
+ //# sourceMappingURL=chunk-BXRVND2C.js.map