@pipelex/mthds-ui 0.39.0 → 0.41.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 (41) hide show
  1. package/README.md +8 -6
  2. package/dist/chunk-6S5TQPTO.js +1349 -0
  3. package/dist/chunk-6S5TQPTO.js.map +1 -0
  4. package/dist/chunk-7JZBXBZS.js +258 -0
  5. package/dist/chunk-7JZBXBZS.js.map +1 -0
  6. package/dist/{chunk-AGFLCOWW.js → chunk-HPARBH6K.js} +14 -197
  7. package/dist/chunk-HPARBH6K.js.map +1 -0
  8. package/dist/chunk-N2F62MW7.js +55 -0
  9. package/dist/chunk-N2F62MW7.js.map +1 -0
  10. package/dist/chunk-P6IGZVWE.js +155 -0
  11. package/dist/chunk-P6IGZVWE.js.map +1 -0
  12. package/dist/form/react/index.d.ts +1 -1
  13. package/dist/graph/index.d.ts +19 -3
  14. package/dist/graph/index.js +20 -12
  15. package/dist/graph/react/index.d.ts +13 -13
  16. package/dist/graph/react/index.js +387 -560
  17. package/dist/graph/react/index.js.map +1 -1
  18. package/dist/graph/react/viewer/GraphToolbar.css +2 -107
  19. package/dist/graph/react/viewer/StyleMenu.css +109 -0
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +20 -12
  22. package/dist/registryJoin-C6Wfkik-.d.ts +441 -0
  23. package/dist/standalone/graph-standalone.html +176 -171
  24. package/dist/standalone/graph-viewer.css +75 -70
  25. package/dist/standalone/graph-viewer.js +101 -101
  26. package/dist/static-graph/index.d.ts +1 -1
  27. package/dist/timeline/index.d.ts +344 -83
  28. package/dist/timeline/index.js +67 -3
  29. package/dist/timeline/react/RunTimeline.css +141 -0
  30. package/dist/timeline/react/index.d.ts +57 -6
  31. package/dist/timeline/react/index.js +929 -120
  32. package/dist/timeline/react/index.js.map +1 -1
  33. package/dist/timeline/react/styles/simple/SimpleProgress.css +354 -0
  34. package/dist/{types-DsrzH6gM.d.ts → types-DLAnYNoi.d.ts} +1 -1
  35. package/package.json +6 -4
  36. package/dist/chunk-AGFLCOWW.js.map +0 -1
  37. package/dist/chunk-ILZJIORT.js +0 -54
  38. package/dist/chunk-ILZJIORT.js.map +0 -1
  39. package/dist/chunk-JJG2TO7P.js +0 -473
  40. package/dist/chunk-JJG2TO7P.js.map +0 -1
  41. package/dist/progressSnapshot-VZ4PLul9.d.ts +0 -191
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/graph/react/viewer/useSystemTheme.ts","../src/graph/react/viewer/usePopoverDismiss.ts","../src/graph/react/viewer/StyleMenu.tsx"],"sourcesContent":["/**\n * Resolve the host environment's color scheme to a binary `GraphTheme`.\n *\n * In a browser this follows `prefers-color-scheme` live. Non-browser hosts (a\n * VS Code webview, where `prefers-color-scheme` is historically flaky) stay\n * authoritative by injecting `systemTheme` — the hook then returns it verbatim\n * and re-renders are driven by the host updating that value.\n *\n * Keeping the `matchMedia` logic in a hook (not inline in GraphViewer) mirrors\n * how the standalone isolated it for testing, and lets the pure\n * `detectSystemTheme` seam be unit-tested without rendering.\n */\nimport React from \"react\";\nimport { GRAPH_THEME, type GraphTheme } from \"@graph/types\";\n\nconst PREFERS_DARK_QUERY = \"(prefers-color-scheme: dark)\";\n\n/** Map a `prefers-color-scheme: dark` match result to a resolved theme. */\nexport function prefersDarkToTheme(prefersDark: boolean): GraphTheme {\n return prefersDark ? GRAPH_THEME.DARK : GRAPH_THEME.LIGHT;\n}\n\n/**\n * Read the environment's current color scheme once. SSR / no-`matchMedia` safe:\n * defaults to `dark` when `window.matchMedia` is unavailable. Exported so\n * non-React callers (e.g. the standalone adapter's initial body-palette paint,\n * before any `onThemeChange` fires) can resolve `system` the same way the hook does.\n */\nexport function detectSystemTheme(): GraphTheme {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return GRAPH_THEME.DARK;\n }\n return prefersDarkToTheme(window.matchMedia(PREFERS_DARK_QUERY).matches);\n}\n\n/**\n * Subscribe to `prefers-color-scheme` changes, invoking `onChange` on each flip.\n * Returns an unsubscribe. SSR / no-`matchMedia` safe: returns a no-op.\n *\n * Older WebKit, some Electron builds, and certain VS Code webview hosts expose\n * a `MediaQueryList` with only the legacy `addListener`/`removeListener` API.\n * Calling `addEventListener` unconditionally throws there — and because this\n * runs inside the `useSyncExternalStore` subscribe during render, the throw\n * crashes the whole GraphViewer (blank graph) on exactly the webview host\n * class the `systemTheme` prop exists to support. Prefer the modern API, fall\n * back to the legacy one (mirrors the deleted standalone `pageTheme.ts`).\n *\n * Exported as a pure seam so the modern/legacy/SSR branches can be unit-tested\n * in a node env (no renderer) — see `__tests__/useSystemTheme.test.ts`.\n */\nexport function subscribeToSystemTheme(onChange: () => void): () => void {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return () => {};\n }\n const mql = window.matchMedia(PREFERS_DARK_QUERY);\n if (typeof mql.addEventListener === \"function\") {\n mql.addEventListener(\"change\", onChange);\n return () => mql.removeEventListener(\"change\", onChange);\n }\n mql.addListener(onChange);\n return () => mql.removeListener(onChange);\n}\n\n/** The `useSyncExternalStore` triple `useSystemTheme` drives. */\nexport interface SystemThemeStore {\n subscribe: (onChange: () => void) => () => void;\n getSnapshot: () => GraphTheme;\n getServerSnapshot: () => GraphTheme;\n}\n\n/**\n * Build the `useSyncExternalStore` triple for a given `injected` value.\n *\n * - `injected` set → host owns detection: `subscribe` is a no-op (no live\n * `matchMedia` listener is ever registered) and both snapshots return\n * `injected`. Spending an OS listener + per-render `detectSystemTheme` on a\n * result we'd discard is pure waste — and wrong to keep alive on the very\n * webview hosts where `prefers-color-scheme` is unreliable.\n * - otherwise → subscribe to `prefers-color-scheme` live; the server snapshot\n * falls back to `dark` (see `docs/theming.md` → \"SSR\").\n *\n * Pure + exported so the injected-skip path is unit-testable without a renderer.\n */\nexport function systemThemeStore(injected?: GraphTheme): SystemThemeStore {\n if (injected !== undefined) {\n return {\n subscribe: () => () => {},\n getSnapshot: () => injected,\n getServerSnapshot: () => injected,\n };\n }\n return {\n subscribe: subscribeToSystemTheme,\n getSnapshot: detectSystemTheme,\n getServerSnapshot: () => GRAPH_THEME.DARK,\n };\n}\n\n/**\n * Resolved environment theme.\n *\n * - `injected` set → return it (host owns detection; host re-renders drive\n * updates). No live `matchMedia` subscription is registered.\n * - otherwise → subscribe to `prefers-color-scheme` and re-render on `change`.\n *\n * Uses `useSyncExternalStore` so the subscription is concurrent-safe. The hook\n * is always called (rules-of-hooks); only the `systemThemeStore` triple branches\n * on `injected`, memoized so the `subscribe` reference stays stable across\n * renders (no re-subscribe churn). SSR with no injected value falls back to\n * `dark` via the server snapshot — see `docs/theming.md` → \"SSR\" for the\n * consequence and the recommended `theme` / `systemTheme` pinning.\n */\nexport function useSystemTheme(injected?: GraphTheme): GraphTheme {\n const store = React.useMemo(() => systemThemeStore(injected), [injected]);\n return React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);\n}\n","import React from \"react\";\n\n/** Why an open popover asked to close: a press outside it, or the Escape key. */\nexport type PopoverDismissReason = \"outside\" | \"escape\";\n\n/**\n * Close a toolbar popover (the validation dropdown, the style menu) on a press\n * outside its wrapper or on Escape, while it is open. The listeners live on the\n * document only while `open` is true. `onDismiss` may change between renders\n * without re-registering them.\n *\n * The press is heard in the capture phase: the graph's pane handles its own\n * presses for panning and stops them there, so a listener waiting for them to\n * bubble to the document never hears a press on the canvas, the most common\n * place to click away from a popover.\n */\nexport function usePopoverDismiss(\n open: boolean,\n wrapperRef: React.RefObject<HTMLElement | null>,\n onDismiss: (reason: PopoverDismissReason) => void,\n): void {\n const onDismissRef = React.useRef(onDismiss);\n onDismissRef.current = onDismiss;\n React.useEffect(() => {\n if (!open) return;\n const onPointerDown = (event: PointerEvent) => {\n const wrapper = wrapperRef.current;\n if (wrapper && event.target instanceof Node && !wrapper.contains(event.target)) {\n onDismissRef.current(\"outside\");\n }\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onDismissRef.current(\"escape\");\n };\n document.addEventListener(\"pointerdown\", onPointerDown, true);\n document.addEventListener(\"keydown\", onKeyDown);\n return () => {\n document.removeEventListener(\"pointerdown\", onPointerDown, true);\n document.removeEventListener(\"keydown\", onKeyDown);\n };\n }, [open, wrapperRef]);\n}\n","import React from \"react\";\nimport { GRAPH_STYLE, type GraphStyleId } from \"@graph/types\";\nimport { GRAPH_STYLES } from \"@graph/styles/graphStyles\";\nimport type { ValidationPanelPlacement } from \"./ValidationPanel\";\nimport { usePopoverDismiss } from \"./usePopoverDismiss\";\n\nconst ICON_PROPS = {\n viewBox: \"0 0 24 24\",\n width: 14,\n height: 14,\n fill: \"none\",\n stroke: \"currentColor\",\n strokeWidth: 2,\n strokeLinecap: \"round\" as const,\n strokeLinejoin: \"round\" as const,\n};\n\n/**\n * Each style's icon, on the toolbar button (the current style) and in its menu\n * row. Keyed by `GraphStyleId`, so a new style does not compile without one.\n */\nconst STYLE_ICONS: Record<GraphStyleId, React.ReactElement> = {\n // Cards with their rows: every pipe with its slots.\n [GRAPH_STYLE.DETAILED]: (\n <svg {...ICON_PROPS}>\n <rect x=\"3\" y=\"3\" width=\"7\" height=\"7\" rx=\"1\" />\n <rect x=\"3\" y=\"14\" width=\"7\" height=\"7\" rx=\"1\" />\n <line x1=\"14\" y1=\"4\" x2=\"21\" y2=\"4\" />\n <line x1=\"14\" y1=\"9\" x2=\"21\" y2=\"9\" />\n <line x1=\"14\" y1=\"15\" x2=\"21\" y2=\"15\" />\n <line x1=\"14\" y1=\"20\" x2=\"21\" y2=\"20\" />\n </svg>\n ),\n // Two steps and the arrow between them: a flowchart.\n [GRAPH_STYLE.SIMPLE]: (\n <svg {...ICON_PROPS}>\n <rect x=\"3\" y=\"3\" width=\"8\" height=\"8\" rx=\"2\" />\n <path d=\"M7 11v4a2 2 0 0 0 2 2h4\" />\n <rect x=\"13\" y=\"13\" width=\"8\" height=\"8\" rx=\"2\" />\n </svg>\n ),\n};\n\nconst CHECK_ICON = (\n <svg {...ICON_PROPS}>\n <polyline points=\"20 6 9 17 4 12\" />\n </svg>\n);\n\n/** Accessible label of the menu button: the current style, and what the button does. */\nexport function styleMenuLabel(style: GraphStyleId): string {\n return `Graph style: ${GRAPH_STYLES[style].name} — choose how the graph is drawn`;\n}\n\n/** What a style menu shows of one style: its name, its one-line description and its icon. */\nexport interface StyleMenuEntry {\n name: string;\n description: string;\n icon: React.ReactElement;\n}\n\n/** The graph's styles as its menu shows them. */\nexport const GRAPH_STYLE_MENU_ENTRIES: Record<GraphStyleId, StyleMenuEntry> = {\n [GRAPH_STYLE.DETAILED]: { ...GRAPH_STYLES[GRAPH_STYLE.DETAILED], icon: STYLE_ICONS.detailed },\n [GRAPH_STYLE.SIMPLE]: { ...GRAPH_STYLES[GRAPH_STYLE.SIMPLE], icon: STYLE_ICONS.simple },\n};\n\nexport interface StyleMenuProps<Id extends string> {\n /** The active style, shown on the button and checked in the list. */\n value: Id;\n /** The styles offered, in order. */\n options: readonly Id[];\n onChange: (style: Id) => void;\n /** Where the list opens, from the button — the validation dropdown's vocabulary. */\n placement: ValidationPanelPlacement;\n /** Each style's name, description and icon. */\n entries: Readonly<Record<Id, StyleMenuEntry>>;\n /** The menu's accessible name: \"Graph style\". */\n menuLabel: string;\n /** The button's accessible label for the active style. */\n buttonLabel: (style: Id) => string;\n /** The button's class, and with `--open` its class while the list is open. */\n buttonClassName: string;\n}\n\n/**\n * A style menu: a button showing the current style's icon, opening a list of\n * radio items, each with its icon, name and one-line description, and a check\n * on the current one. A list rather than a two-state toggle, because a style\n * registry is built for more than two styles. Keyboard: arrows, Home and End\n * move, Enter or Space choose, Escape closes and returns to the button. The\n * graph's toolbar shows it over the graph's styles, and the run timeline's\n * header over the timeline's.\n */\nexport function StyleMenu<Id extends string>({\n value,\n options,\n onChange,\n placement,\n entries,\n menuLabel,\n buttonLabel,\n buttonClassName,\n}: StyleMenuProps<Id>) {\n const [open, setOpen] = React.useState(false);\n const [activeIndex, setActiveIndex] = React.useState(0);\n const wrapperRef = React.useRef<HTMLDivElement | null>(null);\n const buttonRef = React.useRef<HTMLButtonElement | null>(null);\n const itemRefs = React.useRef<(HTMLButtonElement | null)[]>([]);\n // useId, not a constant: several viewers can coexist on one page.\n const menuId = React.useId();\n\n usePopoverDismiss(open, wrapperRef, (reason) => {\n setOpen(false);\n if (reason === \"escape\") buttonRef.current?.focus();\n });\n\n // Opening moves focus to the checked item, as a radio menu does.\n React.useEffect(() => {\n if (!open) return;\n const index = Math.max(0, options.indexOf(value));\n setActiveIndex(index);\n itemRefs.current[index]?.focus();\n // Only on opening: choosing a style closes the menu anyway.\n }, [open]);\n\n const focusItem = (index: number) => {\n const count = options.length;\n const next = ((index % count) + count) % count;\n setActiveIndex(next);\n itemRefs.current[next]?.focus();\n };\n\n const onMenuKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n focusItem(activeIndex + 1);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n focusItem(activeIndex - 1);\n break;\n case \"Home\":\n event.preventDefault();\n focusItem(0);\n break;\n case \"End\":\n event.preventDefault();\n focusItem(options.length - 1);\n break;\n case \"Tab\":\n setOpen(false);\n break;\n default:\n break;\n }\n };\n\n const choose = (style: Id) => {\n setOpen(false);\n buttonRef.current?.focus();\n if (style !== value) onChange(style);\n };\n\n const label = buttonLabel(value);\n return (\n <div className=\"graph-toolbar-style\" ref={wrapperRef}>\n <button\n ref={buttonRef}\n type=\"button\"\n className={`${buttonClassName}${open ? ` ${buttonClassName}--open` : \"\"}`}\n onClick={() => setOpen(!open)}\n onKeyDown={(event) => {\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n setOpen(true);\n }\n }}\n title={label}\n aria-label={label}\n aria-haspopup=\"menu\"\n aria-expanded={open}\n aria-controls={open ? menuId : undefined}\n >\n {entries[value].icon}\n </button>\n {open && (\n <div\n id={menuId}\n role=\"menu\"\n aria-label={menuLabel}\n className={`graph-style-menu graph-style-menu--${placement}`}\n onKeyDown={onMenuKeyDown}\n >\n {options.map((style, index) => {\n const descriptor = entries[style];\n const checked = style === value;\n return (\n <button\n key={style}\n ref={(el) => {\n itemRefs.current[index] = el;\n }}\n type=\"button\"\n role=\"menuitemradio\"\n aria-checked={checked}\n tabIndex={index === activeIndex ? 0 : -1}\n className={`graph-style-menu-item${checked ? \" graph-style-menu-item--checked\" : \"\"}`}\n onClick={() => choose(style)}\n >\n <span className=\"graph-style-menu-icon\" aria-hidden=\"true\">\n {descriptor.icon}\n </span>\n <span className=\"graph-style-menu-text\">\n <span className=\"graph-style-menu-name\">{descriptor.name}</span>\n <span className=\"graph-style-menu-description\">{descriptor.description}</span>\n </span>\n <span className=\"graph-style-menu-check\" aria-hidden=\"true\">\n {checked ? CHECK_ICON : null}\n </span>\n </button>\n );\n })}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,OAAO,WAAW;AAGlB,IAAM,qBAAqB;AAGpB,SAAS,mBAAmB,aAAkC;AACnE,SAAO,cAAc,YAAY,OAAO,YAAY;AACtD;AAQO,SAAS,oBAAgC;AAC9C,MAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY;AAC5E,WAAO,YAAY;AAAA,EACrB;AACA,SAAO,mBAAmB,OAAO,WAAW,kBAAkB,EAAE,OAAO;AACzE;AAiBO,SAAS,uBAAuB,UAAkC;AACvE,MAAI,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,YAAY;AAC5E,WAAO,MAAM;AAAA,IAAC;AAAA,EAChB;AACA,QAAM,MAAM,OAAO,WAAW,kBAAkB;AAChD,MAAI,OAAO,IAAI,qBAAqB,YAAY;AAC9C,QAAI,iBAAiB,UAAU,QAAQ;AACvC,WAAO,MAAM,IAAI,oBAAoB,UAAU,QAAQ;AAAA,EACzD;AACA,MAAI,YAAY,QAAQ;AACxB,SAAO,MAAM,IAAI,eAAe,QAAQ;AAC1C;AAsBO,SAAS,iBAAiB,UAAyC;AACxE,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AA,cACd,UAAU,UAAU,cAAc,IAAI;AAAA,cACtC,WAAW,wBAAwB,UAAU,oCAAoC,EAAE;AAAA,cACnF,SAAS,MAAM,OAAO,KAAK;AAAA,cAE3B;AAAA,oCAAC,UAAK,WAAU,yBAAwB,eAAY,QACjD,qBAAW,MACd;AAAA,gBACA,qBAAC,UAAK,WAAU,yBACd;AAAA,sCAAC,UAAK,WAAU,yBAAyB,qBAAW,MAAK;AAAA,kBACzD,oBAAC,UAAK,WAAU,gCAAgC,qBAAW,aAAY;AAAA,mBACzE;AAAA,gBACA,oBAAC,UAAK,WAAU,0BAAyB,eAAY,QAClD,oBAAU,aAAa,MAC1B;AAAA;AAAA;AAAA,YApBK;AAAA,UAqBP;AAAA,QAEJ,CAAC;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":["React","React","React"]}
@@ -3,8 +3,14 @@ import {
3
3
  parsePipeRef
4
4
  } from "./chunk-2N65P32H.js";
5
5
  import {
6
- DEFAULT_GRAPH_CONFIG
7
- } from "./chunk-ENRYQOCO.js";
6
+ conceptPlainName,
7
+ humanizeIdentifier,
8
+ humanizeInSentence,
9
+ isGenericConcept,
10
+ outcomeLabel,
11
+ pipeTitle,
12
+ stripDomain
13
+ } from "./chunk-P6IGZVWE.js";
8
14
  import {
9
15
  ARROW_CLOSED_MARKER,
10
16
  BINDING_STEP_TYPE,
@@ -1905,179 +1911,6 @@ function sortParentsFirst(nodes) {
1905
1911
  return [...nodes].sort((a, b) => depthOf[a.id] - depthOf[b.id]);
1906
1912
  }
1907
1913
 
1908
- // src/graph/styles/graphStyles.ts
1909
- var GRAPH_STYLES = {
1910
- [GRAPH_STYLE.DETAILED]: {
1911
- id: GRAPH_STYLE.DETAILED,
1912
- name: "Detailed",
1913
- description: "Every pipe with its inputs, outputs and settings",
1914
- capabilities: { controllerFrameToggle: true, foldAll: true }
1915
- },
1916
- [GRAPH_STYLE.SIMPLE]: {
1917
- id: GRAPH_STYLE.SIMPLE,
1918
- name: "Simple",
1919
- description: "The method's steps in plain words",
1920
- capabilities: { controllerFrameToggle: false, foldAll: true },
1921
- layout: {
1922
- nodesep: 28,
1923
- ranksep: 44,
1924
- routeEdges: true,
1925
- groupPadding: { x: 20, top: 40, bottom: 16 }
1926
- }
1927
- }
1928
- };
1929
- var GRAPH_STYLE_IDS = [GRAPH_STYLE.DETAILED, GRAPH_STYLE.SIMPLE];
1930
- function isGraphStyleId(value) {
1931
- return typeof value === "string" && Object.hasOwn(GRAPH_STYLES, value);
1932
- }
1933
- function resolveGraphStyle(styleProp, configStyle) {
1934
- if (isGraphStyleId(styleProp)) return styleProp;
1935
- if (isGraphStyleId(configStyle)) return configStyle;
1936
- return DEFAULT_GRAPH_CONFIG.graphStyle;
1937
- }
1938
- function resolveStyleMenu(styleMenu) {
1939
- if (styleMenu === void 0 || styleMenu === false) return [];
1940
- const requested = styleMenu === true ? GRAPH_STYLE_IDS : styleMenu;
1941
- const offered = [];
1942
- for (const id of requested) {
1943
- if (isGraphStyleId(id) && !offered.includes(id)) offered.push(id);
1944
- }
1945
- return offered.length >= 2 ? offered : [];
1946
- }
1947
-
1948
- // src/graph/styles/humanize.ts
1949
- var VOWELED_ACRONYMS = /* @__PURE__ */ new Set([
1950
- "ai",
1951
- "api",
1952
- "faq",
1953
- "iban",
1954
- "id",
1955
- "io",
1956
- "ip",
1957
- "json",
1958
- "kpi",
1959
- "ocr",
1960
- "roi",
1961
- "seo",
1962
- "ui",
1963
- "uri",
1964
- "url",
1965
- "uuid",
1966
- "ux"
1967
- ]);
1968
- var VOWELS = /[aeiouy]/;
1969
- var VOWELLESS_WORDS = /* @__PURE__ */ new Set([
1970
- "cfg",
1971
- "cm",
1972
- "cnt",
1973
- "ctx",
1974
- "dr",
1975
- "dst",
1976
- "fn",
1977
- "ft",
1978
- "hmm",
1979
- "hr",
1980
- "kg",
1981
- "km",
1982
- "lb",
1983
- "mg",
1984
- "ml",
1985
- "mm",
1986
- "mr",
1987
- "mrs",
1988
- "ms",
1989
- "msg",
1990
- "nd",
1991
- "nth",
1992
- "pkg",
1993
- "pt",
1994
- "rd",
1995
- "src",
1996
- "st",
1997
- "th",
1998
- "tmp",
1999
- "vs"
2000
- ]);
2001
- var SINGULAR_S_ACRONYMS = /* @__PURE__ */ new Set([
2002
- "cms",
2003
- "css",
2004
- "dns",
2005
- "gps",
2006
- "rss",
2007
- "sms"
2008
- ]);
2009
- var NATIVE_PLAIN_NAMES = {
2010
- Html: "HTML",
2011
- JSON: "JSON",
2012
- TextAndImages: "Text and images",
2013
- YesNo: "Yes or no",
2014
- SearchResult: "Search result",
2015
- Composite: "Combined results",
2016
- Dynamic: "Data"
2017
- };
2018
- var GENERIC_NATIVES = /* @__PURE__ */ new Set(["Anything", "Dynamic", "Composite"]);
2019
- function isAcronymWord(lower) {
2020
- if (lower.length < 2 || !/^[a-z]+$/.test(lower)) return false;
2021
- if (VOWELLESS_WORDS.has(lower)) return false;
2022
- if (lower.endsWith("s") && VOWELLESS_WORDS.has(lower.slice(0, -1))) return false;
2023
- return !VOWELS.test(lower) || VOWELED_ACRONYMS.has(lower);
2024
- }
2025
- function spellWord(lower, wasAllCaps) {
2026
- if (/^\d+$/.test(lower)) return lower;
2027
- if (wasAllCaps && lower.length >= 2) return lower.toUpperCase();
2028
- if (lower.endsWith("s") && !SINGULAR_S_ACRONYMS.has(lower) && isAcronymWord(lower.slice(0, -1))) {
2029
- return lower.slice(0, -1).toUpperCase() + "s";
2030
- }
2031
- if (isAcronymWord(lower)) return lower.toUpperCase();
2032
- return lower;
2033
- }
2034
- function splitIdentifier(identifier) {
2035
- const parts = identifier.replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/([A-Za-z])(\d)/g, "$1 $2").split(/[\s_\-.]+/).filter((p) => p.length > 0);
2036
- return parts.map((p) => ({
2037
- word: p.toLowerCase(),
2038
- wasAllCaps: p.length >= 2 && p === p.toUpperCase() && /[A-Z]/.test(p)
2039
- }));
2040
- }
2041
- function capitalizeFirst(text) {
2042
- return text.length === 0 ? text : text.charAt(0).toUpperCase() + text.slice(1);
2043
- }
2044
- function stripDomain(ref) {
2045
- const dot = ref.lastIndexOf(".");
2046
- return dot === -1 ? ref : ref.slice(dot + 1);
2047
- }
2048
- function humanizeIdentifier(identifier) {
2049
- const words = splitIdentifier(stripDomain(identifier.trim()));
2050
- if (words.length === 0) return "";
2051
- return capitalizeFirst(words.map((w) => spellWord(w.word, w.wasAllCaps)).join(" "));
2052
- }
2053
- function conceptPlainName(conceptRef) {
2054
- var _a;
2055
- const code = stripDomain(conceptRef.trim());
2056
- return (_a = NATIVE_PLAIN_NAMES[code]) != null ? _a : humanizeIdentifier(code);
2057
- }
2058
- function isGenericConcept(conceptRef) {
2059
- return GENERIC_NATIVES.has(stripDomain(conceptRef.trim()));
2060
- }
2061
- function sentenceCase(text) {
2062
- const collapsed = text.replace(/\s+/g, " ").trim();
2063
- const trimmed = collapsed.endsWith(".") && !collapsed.endsWith("..") ? collapsed.slice(0, -1) : collapsed;
2064
- return capitalizeFirst(trimmed);
2065
- }
2066
- var OUTCOME_WORDS = {
2067
- true: "Yes",
2068
- false: "No",
2069
- default: "Otherwise"
2070
- };
2071
- function outcomeLabel(outcome) {
2072
- const outcomes = outcome.split("|").map((o) => o.trim()).filter((o) => o.length > 0);
2073
- const labels = outcomes.map((o, index) => {
2074
- var _a;
2075
- const label = (_a = OUTCOME_WORDS[o.toLowerCase()]) != null ? _a : humanizeIdentifier(o);
2076
- return index === 0 ? label : label.charAt(0).toLowerCase() + label.slice(1);
2077
- });
2078
- return labels.join(" or ");
2079
- }
2080
-
2081
1914
  // src/graph/styles/textMetrics.ts
2082
1915
  var GLYPH_EM_GROUPS = [
2083
1916
  [0.28, "il .,'"],
@@ -2340,14 +2173,10 @@ function stepIdentity(spec) {
2340
2173
  return `${spec.kind}:${ref}`;
2341
2174
  }
2342
2175
  function forEachLabel(itemName) {
2343
- var _a;
2344
- const words = humanizeIdentifier(itemName);
2345
- const first = (_a = words.split(" ")[0]) != null ? _a : "";
2346
- const inSentence = first.length >= 2 && first === first.toUpperCase() ? words : words.charAt(0).toLowerCase() + words.slice(1);
2347
- return `For each ${inSentence}`;
2176
+ return `For each ${humanizeInSentence(itemName)}`;
2348
2177
  }
2349
2178
  function projectSimpleGraph(input) {
2350
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2179
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2351
2180
  const { graphspec, nodes, analysis, rawAnalysis } = input;
2352
2181
  const graphMode = graphSpecMode(graphspec);
2353
2182
  const specById = new Map(graphspec.nodes.map((n) => [n.id, n]));
@@ -2695,7 +2524,7 @@ function projectSimpleGraph(input) {
2695
2524
  return counted.reduce((sum, child) => sum + stepsInside(child), 0);
2696
2525
  }
2697
2526
  function stepTitle(spec, folded) {
2698
- var _a2, _b2, _c2, _d2, _e2, _f2;
2527
+ var _a2, _b2, _c2, _d2, _e2;
2699
2528
  if (spec.pipe_type === BINDING_STEP_TYPE) {
2700
2529
  return humanizeIdentifier((_b2 = (_a2 = spec.pipe_code) == null ? void 0 : _a2.split(".").pop()) != null ? _b2 : "");
2701
2530
  }
@@ -2704,8 +2533,7 @@ function projectSimpleGraph(input) {
2704
2533
  const branch = specById.get((_d2 = (_c2 = rawAnalysis.containmentTree[spec.id]) == null ? void 0 : _c2[0]) != null ? _d2 : "");
2705
2534
  if (branch) source = branch;
2706
2535
  }
2707
- const described = sentenceCase((_e2 = source.description) != null ? _e2 : "");
2708
- return described || humanizeIdentifier((_f2 = source.pipe_code) != null ? _f2 : "");
2536
+ return pipeTitle(source.description, (_e2 = source.pipe_code) != null ? _e2 : "").title;
2709
2537
  }
2710
2538
  const stepById = new Map(drawnSteps.map((card) => [card.id, card]));
2711
2539
  for (const spec of graphspec.nodes) {
@@ -2749,7 +2577,7 @@ function projectSimpleGraph(input) {
2749
2577
  continue;
2750
2578
  }
2751
2579
  if (decisionSet.has(spec.id)) {
2752
- const title = sentenceCase((_i = spec.description) != null ? _i : "") || humanizeIdentifier((_j = spec.pipe_code) != null ? _j : "");
2580
+ const title = pipeTitle(spec.description, (_i = spec.pipe_code) != null ? _i : "").title;
2753
2581
  simpleNodes.push({
2754
2582
  id: spec.id,
2755
2583
  type: NODE_TYPE_SIMPLE_DECISION,
@@ -3019,17 +2847,6 @@ export {
3019
2847
  buildControllerNodes,
3020
2848
  applyControllers,
3021
2849
  sortParentsFirst,
3022
- GRAPH_STYLES,
3023
- GRAPH_STYLE_IDS,
3024
- isGraphStyleId,
3025
- resolveGraphStyle,
3026
- resolveStyleMenu,
3027
- stripDomain,
3028
- humanizeIdentifier,
3029
- conceptPlainName,
3030
- isGenericConcept,
3031
- sentenceCase,
3032
- outcomeLabel,
3033
2850
  textWidthPx,
3034
2851
  estimateWrap,
3035
2852
  SIMPLE_STEP_WIDTH,
@@ -3052,4 +2869,4 @@ export {
3052
2869
  applySimpleFrames,
3053
2870
  GRAPH_STYLE_PIPELINES
3054
2871
  };
3055
- //# sourceMappingURL=chunk-AGFLCOWW.js.map
2872
+ //# sourceMappingURL=chunk-HPARBH6K.js.map