@shware/workflow-ui 2.1.3 → 2.1.4

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.
package/dist/index.mjs CHANGED
@@ -8,7 +8,7 @@ import { Fragment as Fragment$1, createContext, useContext, useId, useMemo, useS
8
8
  import { TemplateValidationError, formatEmailAddress, renderDiscordContent, renderPushContent, renderSlackContent, resolveEmail } from "@shware/workflow";
9
9
  import { useTranslation } from "react-i18next";
10
10
  import { FloatingFocusManager, autoUpdate, flip, offset, shift, useClick, useDismiss, useFloating, useInteractions, useRole } from "@floating-ui/react";
11
- //#region \0rolldown/runtime.js
11
+ // \0rolldown/runtime.js
12
12
  var __create = Object.create;
13
13
  var __defProp = Object.defineProperty;
14
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -30,13 +30,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
30
  value: mod,
31
31
  enumerable: true
32
32
  }) : target, mod));
33
- //#endregion
34
- //#region src/utils/cn.ts
33
+ // src/utils/cn.ts
35
34
  function cn(...inputs) {
36
35
  return twMerge(clsx(inputs));
37
36
  }
38
- //#endregion
39
- //#region src/components/corner-shape.ts
37
+ // src/components/corner-shape.ts
40
38
  /**
41
39
  * Every rounded surface that is not a full pill carries this.
42
40
  *
@@ -48,8 +46,7 @@ function cn(...inputs) {
48
46
  * Cast because `corner-shape` is not in React's CSSProperties yet.
49
47
  */
50
48
  const superellipse = { cornerShape: "superellipse(1.2)" };
51
- //#endregion
52
- //#region src/components/button/index.tsx
49
+ // src/components/button/index.tsx
53
50
  const SIZE_STYLE$2 = {
54
51
  xs: "h-7 px-3 text-xs rounded-md focus-visible:ring-2",
55
52
  sm: "h-9 px-3 text-sm rounded-lg focus-visible:ring-3",
@@ -77,8 +74,7 @@ function Button({ children, className, size = "md", style, type = "button", vari
77
74
  children
78
75
  });
79
76
  }
80
- //#endregion
81
- //#region src/components/layout.ts
77
+ // src/components/layout.ts
82
78
  /** Card sizes: the single source shared by layout and renderer, all on the 16/8 grid. */
83
79
  const CARD_SIZE = {
84
80
  w: 288,
@@ -367,8 +363,7 @@ function layout(ir, stats) {
367
363
  edges
368
364
  };
369
365
  }
370
- //#endregion
371
- //#region src/components/workflow-canvas.tsx
366
+ // src/components/workflow-canvas.tsx
372
367
  /** The callback travels by context: react-flow node data should carry serializable data only. */
373
368
  /** Same reason: selection is view state, not node data, so it must not enter the layout. */
374
369
  const SelectedContext = createContext(void 0);
@@ -723,8 +718,7 @@ function CanvasSurface({ nodes, edges, colorMode, onSelectNode }) {
723
718
  })
724
719
  });
725
720
  }
726
- //#endregion
727
- //#region src/utils/template-content.ts
721
+ // src/utils/template-content.ts
728
722
  /** The sample props the studio renders with: the template's `preview`. */
729
723
  function previewPropsOf(entry) {
730
724
  return { ...entry.preview };
@@ -788,8 +782,7 @@ function resolveSlack(entry, props) {
788
782
  };
789
783
  }
790
784
  }
791
- //#endregion
792
- //#region src/components/chat-markup.tsx
785
+ // src/components/chat-markup.tsx
793
786
  const code = (text, key) => /* @__PURE__ */ jsx("code", {
794
787
  className: "rounded bg-black/10 px-1 py-px font-mono text-[0.85em] dark:bg-white/10",
795
788
  children: text
@@ -883,8 +876,7 @@ function ChatMarkup({ text, dialect, linkClass }) {
883
876
  const lines = text.split("\n");
884
877
  return /* @__PURE__ */ jsx(Fragment, { children: lines.map((line, i) => /* @__PURE__ */ jsxs("span", { children: [inline(line, dialect, linkClass, `${i}-`), i < lines.length - 1 && /* @__PURE__ */ jsx("br", {})] }, i)) });
885
878
  }
886
- //#endregion
887
- //#region src/components/discord-preview.tsx
879
+ // src/components/discord-preview.tsx
888
880
  const PALETTE$1 = {
889
881
  dark: {
890
882
  bg: "#313338",
@@ -1036,31 +1028,26 @@ function DiscordPreview({ message, appName, scheme, zoom }) {
1036
1028
  })
1037
1029
  });
1038
1030
  }
1039
- //#endregion
1040
- //#region src/components/email-thumbnail.tsx
1031
+ // src/components/email-thumbnail.tsx
1041
1032
  /**
1042
1033
  * Dark-mode simulation for a rendered email: emails are authored light, so a
1043
1034
  * dark stage inverts the document and re-inverts imagery. Shared with the
1044
1035
  * templates page so the thumbnail and the full preview agree.
1045
1036
  */
1046
1037
  const DARK_SIMULATION = "<style>html{background:#fff;filter:invert(0.92) hue-rotate(180deg)}img,video{filter:invert(1) hue-rotate(180deg)}</style>";
1047
- //#endregion
1048
- //#region src/app/assets/devices/iphone-17-pro.png
1038
+ // src/app/assets/devices/iphone-17-pro.png
1049
1039
  var require_iphone_17_pro = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1050
1040
  module.exports = "./assets/iphone-17-pro-DzaacWSl.png";
1051
1041
  }));
1052
- //#endregion
1053
- //#region src/app/assets/devices/pixel-10-pro-back.webp
1042
+ // src/app/assets/devices/pixel-10-pro-back.webp
1054
1043
  var require_pixel_10_pro_back = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1055
1044
  module.exports = "./assets/pixel-10-pro-back-7MDj1_lz.webp";
1056
1045
  }));
1057
- //#endregion
1058
- //#region src/app/assets/devices/pixel-10-pro-mask.webp
1046
+ // src/app/assets/devices/pixel-10-pro-mask.webp
1059
1047
  var require_pixel_10_pro_mask = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1060
1048
  module.exports = "./assets/pixel-10-pro-mask-Bi1deQ9Y.webp";
1061
1049
  }));
1062
- //#endregion
1063
- //#region src/components/push-preview.tsx
1050
+ // src/components/push-preview.tsx
1064
1051
  var import_iphone_17_pro = /* @__PURE__ */ __toESM(require_iphone_17_pro(), 1);
1065
1052
  var import_pixel_10_pro_back = /* @__PURE__ */ __toESM(require_pixel_10_pro_back(), 1);
1066
1053
  var import_pixel_10_pro_mask = /* @__PURE__ */ __toESM(require_pixel_10_pro_mask(), 1);
@@ -1430,8 +1417,7 @@ function PushPreview({ appName, title, body, scheme, zoom }) {
1430
1417
  })]
1431
1418
  });
1432
1419
  }
1433
- //#endregion
1434
- //#region src/components/slack-preview.tsx
1420
+ // src/components/slack-preview.tsx
1435
1421
  const PALETTE = {
1436
1422
  dark: {
1437
1423
  bg: "#1a1d21",
@@ -1608,8 +1594,7 @@ function SlackPreview({ message, appName, scheme, zoom }) {
1608
1594
  })
1609
1595
  });
1610
1596
  }
1611
- //#endregion
1612
- //#region src/components/textarea/index.tsx
1597
+ // src/components/textarea/index.tsx
1613
1598
  const SIZE_STYLE$1 = {
1614
1599
  xs: "px-2 py-[5px] text-xs rounded-md focus-visible:ring-2",
1615
1600
  sm: "px-2 py-[7px] text-sm rounded-lg focus-visible:ring-3",
@@ -1623,8 +1608,7 @@ function Textarea({ size = "md", className, ...props }) {
1623
1608
  className: cn("transition-colors duration-100 focus:outline-none", "border bg-textfield placeholder-placeholder focus-visible:border-accent", "focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50", SIZE_STYLE$1[size], className)
1624
1609
  });
1625
1610
  }
1626
- //#endregion
1627
- //#region src/components/templates-page.tsx
1611
+ // src/components/templates-page.tsx
1628
1612
  /**
1629
1613
  * One label/value row. A fragment rather than a wrapper so the rows land
1630
1614
  * directly in the parent grid: the label column then sizes to the longest label
@@ -1998,8 +1982,7 @@ function TemplatesPage({ refs, emails, pushes = {}, discords = {}, slacks = {},
1998
1982
  })
1999
1983
  });
2000
1984
  }
2001
- //#endregion
2002
- //#region src/utils/label.ts
1985
+ // src/utils/label.ts
2003
1986
  /**
2004
1987
  * What to call a code-owned asset in the UI.
2005
1988
  *
@@ -2012,8 +1995,7 @@ function displayName(name, untitled) {
2012
1995
  const trimmed = name?.trim();
2013
1996
  return trimmed !== void 0 && trimmed !== "" ? trimmed : untitled;
2014
1997
  }
2015
- //#endregion
2016
- //#region src/components/sparkline.tsx
1998
+ // src/components/sparkline.tsx
2017
1999
  function Sparkline({ values, width = 76, height = 26, className }) {
2018
2000
  if (values.length < 2) return /* @__PURE__ */ jsx("svg", {
2019
2001
  width,
@@ -2053,8 +2035,7 @@ function Sparkline({ values, width = 76, height = 26, className }) {
2053
2035
  })
2054
2036
  });
2055
2037
  }
2056
- //#endregion
2057
- //#region src/components/workflow-list.tsx
2038
+ // src/components/workflow-list.tsx
2058
2039
  /** Count message and delay nodes across the whole tree, arms included. */
2059
2040
  function countNodes(nodes, acc = {
2060
2041
  messages: 0,
@@ -2199,8 +2180,7 @@ function WorkflowList({ items, reports, onOpen }) {
2199
2180
  })
2200
2181
  });
2201
2182
  }
2202
- //#endregion
2203
- //#region src/components/metric-card.tsx
2183
+ // src/components/metric-card.tsx
2204
2184
  /**
2205
2185
  * viewBox units; `preserveAspectRatio="none"` stretches them to the card.
2206
2186
  *
@@ -2444,8 +2424,7 @@ function HoverReadout({ x, date, rows }) {
2444
2424
  ]
2445
2425
  });
2446
2426
  }
2447
- //#endregion
2448
- //#region src/components/input/index.tsx
2427
+ // src/components/input/index.tsx
2449
2428
  const SIZE_STYLE = {
2450
2429
  xs: "h-7 px-2 text-xs rounded-md focus-visible:ring-2",
2451
2430
  sm: "h-9 px-2 text-sm rounded-lg focus-visible:ring-3",
@@ -2461,8 +2440,7 @@ function Input({ size = "md", type = "text", htmlSize, className, ...props }) {
2461
2440
  className: cn("transition-colors duration-100 focus:outline-none", "border bg-textfield placeholder-placeholder focus-visible:border-accent", "focus-visible:ring-accent/40 dark:focus-visible:ring-accent/50", SIZE_STYLE[size], className)
2462
2441
  });
2463
2442
  }
2464
- //#endregion
2465
- //#region src/components/date-range.tsx
2443
+ // src/components/date-range.tsx
2466
2444
  /**
2467
2445
  * A local calendar day, not a UTC instant. `toISOString().slice(0, 10)` is the
2468
2446
  * usual shortcut and it is wrong west of Greenwich for most of the day: it
@@ -2613,8 +2591,7 @@ function DateRangePicker({ value, onChange, className }) {
2613
2591
  })
2614
2592
  })] });
2615
2593
  }
2616
- //#endregion
2617
- //#region src/components/channel-icon.ts
2594
+ // src/components/channel-icon.ts
2618
2595
  /**
2619
2596
  * One glyph per delivery channel, shared by the chart cards, the channel
2620
2597
  * pickers and the message table — a channel has to read the same everywhere or
@@ -2637,8 +2614,7 @@ const CHANNEL_ICON = {
2637
2614
  /** Stand-in for "every channel": still a send, just not one transport. */
2638
2615
  const ALL_CHANNELS_ICON = Send;
2639
2616
  const channelIcon = (channel) => channel === void 0 ? ALL_CHANNELS_ICON : CHANNEL_ICON[channel];
2640
- //#endregion
2641
- //#region src/components/avatar.tsx
2617
+ // src/components/avatar.tsx
2642
2618
  const SIZES = {
2643
2619
  sm: "size-6 text-xs",
2644
2620
  md: "size-9 text-sm"
@@ -2658,8 +2634,7 @@ function Avatar({ picture, label, size = "md" }) {
2658
2634
  children: label.trim().charAt(0).toUpperCase()
2659
2635
  });
2660
2636
  }
2661
- //#endregion
2662
- //#region src/components/template-refs.ts
2637
+ // src/components/template-refs.ts
2663
2638
  const TEMPLATE_CHANNELS = /* @__PURE__ */ new Set([
2664
2639
  "email",
2665
2640
  "push",
@@ -2729,7 +2704,6 @@ function collectTemplates(irs, registries) {
2729
2704
  });
2730
2705
  return Array.from(byKey.values()).sort((a, b) => a.key.localeCompare(b.key) || a.channel.localeCompare(b.channel));
2731
2706
  }
2732
- //#endregion
2733
2707
  export { ALL_CHANNELS_ICON, Avatar, Button, CARD_SIZE, CHANNEL_ICON, DateRangePicker, ICON_SIZE, METRIC_CHANNELS, MetricCard, PushPreview, Sparkline, TemplatesPage, WorkflowCanvas, WorkflowList, channelIcon, collectTemplateRefs, collectTemplates, defineStats, formatDay, isoDay, lastDays, layout, parseIsoDay, superellipse };
2734
2708
 
2735
2709
  //# sourceMappingURL=index.mjs.map