@dashspec/renderer 0.1.41 → 0.1.43

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 (37) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/FlowMapView-BSTKU7D4.js +458 -0
  4. package/dist/FlowMapView-BSTKU7D4.js.map +1 -0
  5. package/dist/chunk-5LRFKK4I.js +118 -0
  6. package/dist/chunk-5LRFKK4I.js.map +1 -0
  7. package/dist/{chunk-NLKXHTLO.js → chunk-D4GFCPCL.js} +6 -33
  8. package/dist/chunk-D4GFCPCL.js.map +1 -0
  9. package/dist/chunk-E4CT25TF.js +440 -0
  10. package/dist/chunk-E4CT25TF.js.map +1 -0
  11. package/dist/chunk-HUBYJ34E.js +38 -0
  12. package/dist/chunk-HUBYJ34E.js.map +1 -0
  13. package/dist/{chunk-YOCDUP7X.js → chunk-IBSZQEYY.js} +207 -527
  14. package/dist/chunk-IBSZQEYY.js.map +1 -0
  15. package/dist/{chunk-M4WXE3FW.js → chunk-JCPQBIAL.js} +5 -3
  16. package/dist/{chunk-M4WXE3FW.js.map → chunk-JCPQBIAL.js.map} +1 -1
  17. package/dist/{core-DE2SVeij.d.ts → core-DJ1ABh7P.d.ts} +34 -1
  18. package/dist/core.d.ts +1 -1
  19. package/dist/core.js +18 -16
  20. package/dist/index.d.ts +33 -4
  21. package/dist/index.js +354 -290
  22. package/dist/index.js.map +1 -1
  23. package/dist/sandbox-RCDZ7SDZ.js +11 -0
  24. package/dist/sandbox.js +3 -2
  25. package/dist/schema.json +15 -0
  26. package/docs/README.md +1 -1
  27. package/docs/api.md +1 -1
  28. package/docs/data.md +8 -0
  29. package/docs/design-systems.md +21 -0
  30. package/docs/getting-started.md +1 -1
  31. package/docs/json-format.md +3 -1
  32. package/docs/widgets.md +2 -1
  33. package/package.json +1 -1
  34. package/dist/chunk-NLKXHTLO.js.map +0 -1
  35. package/dist/chunk-YOCDUP7X.js.map +0 -1
  36. package/dist/sandbox-WEMG76LE.js +0 -10
  37. /package/dist/{sandbox-WEMG76LE.js.map → sandbox-RCDZ7SDZ.js.map} +0 -0
package/dist/index.js CHANGED
@@ -30,8 +30,8 @@ import {
30
30
  EventHandler,
31
31
  EventMap,
32
32
  Expression,
33
- ExpressionError,
34
33
  FilterContract,
34
+ FlowMapContract,
35
35
  FnProp,
36
36
  GaugeContract,
37
37
  Handler,
@@ -83,49 +83,66 @@ import {
83
83
  buildUrl,
84
84
  builtInWidgetChecks,
85
85
  checkWidget,
86
- collectReferences,
87
- compile,
88
86
  createHelpers,
89
87
  createHttpClient,
90
88
  createWidgetRegistry,
91
89
  dashboardJsonSchema,
92
- evaluate,
93
- evaluateSafe,
94
- expressionReferences,
95
90
  graphqlData,
96
- interpolate,
97
- interpolateUrl,
98
91
  isCallbackSource,
99
92
  isSafeUrl,
100
93
  loadDocument,
101
94
  mergeConnections,
102
95
  migrateDocument,
103
- parse,
104
96
  parseDuration,
105
- placeholders,
106
97
  plantDate,
107
98
  plantDayStart,
108
- resolve,
109
99
  resolveBaseUrl,
110
- resolveRequest,
111
100
  safeLink,
112
101
  satisfies,
113
- scope,
114
- stripStrings,
115
- templateReferences,
116
102
  translator,
117
103
  validateDocument,
118
104
  widgetChecks
119
- } from "./chunk-YOCDUP7X.js";
105
+ } from "./chunk-IBSZQEYY.js";
106
+ import {
107
+ Chips,
108
+ asRows,
109
+ deepMerge,
110
+ evalOver,
111
+ field,
112
+ formatValue,
113
+ safeImageSrc,
114
+ toNumber,
115
+ tone,
116
+ toneOf
117
+ } from "./chunk-5LRFKK4I.js";
118
+ import {
119
+ ExpressionError,
120
+ collectReferences,
121
+ compile,
122
+ evaluate,
123
+ evaluateSafe,
124
+ expressionReferences,
125
+ interpolate,
126
+ interpolateUrl,
127
+ parse,
128
+ placeholders,
129
+ resolve,
130
+ resolveRequest,
131
+ scope,
132
+ stripStrings,
133
+ templateReferences
134
+ } from "./chunk-E4CT25TF.js";
120
135
  import {
121
136
  createStateProxy,
122
- getPath,
123
137
  offRunner,
124
138
  stateActions,
125
139
  stateSlice,
126
140
  stateWriteProblem,
127
141
  trustedRunner
128
- } from "./chunk-NLKXHTLO.js";
142
+ } from "./chunk-D4GFCPCL.js";
143
+ import {
144
+ getPath
145
+ } from "./chunk-HUBYJ34E.js";
129
146
 
130
147
  // src/components/context.tsx
131
148
  import { createContext, useCallback, useContext, useRef, useSyncExternalStore } from "react";
@@ -251,7 +268,8 @@ function buildTree(state, data, inputs) {
251
268
  computing.add(id);
252
269
  const up = derive(def.from);
253
270
  computing.delete(id);
254
- const filters = readsState(def.transform);
271
+ const pathTpl = typeof def.path === "string" ? def.path : void 0;
272
+ const filters = readsState(def.transform) || Boolean(pathTpl?.includes("${"));
255
273
  const keyState = filters ? state : null;
256
274
  const keyContext = filters ? inputs.context : null;
257
275
  const prev = memo.get(id);
@@ -264,7 +282,12 @@ function buildTree(state, data, inputs) {
264
282
  if (up.data === void 0) result = { status: up.status, ...up.error ? { error: up.error } : {} };
265
283
  else {
266
284
  try {
267
- const out = applyTransform(up.data, def.transform ?? [], root, {
285
+ let input = up.data;
286
+ if (pathTpl) {
287
+ const resolved = pathTpl.includes("${") ? String(interpolate(pathTpl, root) ?? "") : pathTpl;
288
+ input = resolved ? getPath(up.data, resolved) : up.data;
289
+ }
290
+ const out = applyTransform(input, def.transform ?? [], root, {
268
291
  ...inputs.runFn ? { runFn: inputs.runFn } : {},
269
292
  ...inputs.maxRows ? { maxRows: inputs.maxRows } : {}
270
293
  });
@@ -1962,6 +1985,18 @@ function partsCss(theme, scope2, mode = "light") {
1962
1985
  decl({ width: px(p.liveDot?.size), height: px(p.liveDot?.size), background: c(p.liveDot?.color) })
1963
1986
  ],
1964
1987
  [".ds-live[data-stale] > span", decl({ background: c(p.liveDot?.staleColor) })],
1988
+ [
1989
+ ".ds-flow-hover",
1990
+ decl({
1991
+ padding: p.popover?.padding,
1992
+ "border-radius": px(p.popover?.radius),
1993
+ border: p.popover?.border,
1994
+ "backdrop-filter": p.popover?.blur !== void 0 ? `blur(${p.popover.blur}px)` : void 0,
1995
+ display: p.popover?.gap !== void 0 ? "flex" : void 0,
1996
+ "flex-direction": p.popover?.gap !== void 0 ? "column" : void 0,
1997
+ gap: px(p.popover?.gap)
1998
+ })
1999
+ ],
1965
2000
  [".ds-filters", decl({ padding: p.filterBar?.padding, "border-radius": px(p.filterBar?.radius) })],
1966
2001
  [".ds-chart-legend", decl({ gap: px(p.legend?.gap) })],
1967
2002
  [
@@ -2034,54 +2069,6 @@ function defineWidget(def) {
2034
2069
  return def;
2035
2070
  }
2036
2071
 
2037
- // src/widgets/shared/format.ts
2038
- var field = (row, path) => path === void 0 ? row : getPath(row, path);
2039
- var toNumber = (v2) => {
2040
- if (typeof v2 === "number") return Number.isFinite(v2) ? v2 : void 0;
2041
- if (typeof v2 === "string" && v2.trim() !== "" && !Number.isNaN(Number(v2))) return Number(v2);
2042
- return void 0;
2043
- };
2044
- function formatValue(v2, h, format = "number", decimals) {
2045
- if (v2 === null || v2 === void 0 || v2 === "") return "\u2013";
2046
- switch (format) {
2047
- case "text":
2048
- return String(v2);
2049
- case "compact":
2050
- return h.fmt.compact(v2);
2051
- case "percent":
2052
- return h.fmt.percent(v2, decimals ?? 0);
2053
- case "duration":
2054
- return h.fmt.duration(v2);
2055
- case "date":
2056
- return h.fmt.date(v2, "date");
2057
- case "datetime":
2058
- return h.fmt.date(v2, "datetime");
2059
- case "time":
2060
- return h.fmt.date(v2, "time");
2061
- default: {
2062
- const n = toNumber(v2);
2063
- return n === void 0 ? String(v2) : h.fmt.number(n, decimals);
2064
- }
2065
- }
2066
- }
2067
- var tone = (t) => {
2068
- const k = t && ["good", "warn", "bad", "neutral", "info"].includes(t) ? t : "neutral";
2069
- return {
2070
- fg: `var(--ds-color-status-${k}-fg)`,
2071
- bg: `var(--ds-color-status-${k}-bg)`,
2072
- border: `var(--ds-color-status-${k}-border)`,
2073
- solid: `var(--ds-color-status-${k}-solid)`
2074
- };
2075
- };
2076
- var asRows = (data) => Array.isArray(data) ? data : data && typeof data === "object" ? [data] : [];
2077
- function deepMerge(base, extra) {
2078
- if (!extra || typeof extra !== "object" || Array.isArray(extra)) return extra ?? base;
2079
- if (!base || typeof base !== "object" || Array.isArray(base)) return extra;
2080
- const out = { ...base };
2081
- for (const [k, v2] of Object.entries(extra)) out[k] = k in out ? deepMerge(out[k], v2) : v2;
2082
- return out;
2083
- }
2084
-
2085
2072
  // src/widgets/builtins/Breakdown.tsx
2086
2073
  import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
2087
2074
  var Breakdown = defineWidget({
@@ -2321,7 +2308,8 @@ var Container = defineWidget({
2321
2308
  gap: spec.gap,
2322
2309
  justifyContent: JUSTIFY[spec.justify],
2323
2310
  alignItems: ALIGN[spec.align],
2324
- ["--ds-child-flex"]: spec.equal ? `1 1 ${spec.childMinWidth}px` : "0 0 auto",
2311
+ // An equal split is across a row; in a column, children keep their own height.
2312
+ ["--ds-child-flex"]: spec.equal && spec.direction === "row" ? `1 1 ${spec.childMinWidth}px` : "0 0 auto",
2325
2313
  ["--ds-child-min"]: `${spec.direction === "row" ? spec.childMinWidth : 0}px`,
2326
2314
  overflow: spec.scroll ? "auto" : "visible"
2327
2315
  };
@@ -3256,6 +3244,7 @@ function ControlField({
3256
3244
  min: bound("min"),
3257
3245
  max: bound("max"),
3258
3246
  maxDays: def.maxDays,
3247
+ single: Boolean(def.single),
3259
3248
  locale,
3260
3249
  onChange: (v2) => onChange(v2),
3261
3250
  onReject: (m) => runtime.runAction({ do: "toast", message: m, tone: "warn" })
@@ -3710,21 +3699,69 @@ var Filter = defineWidget({
3710
3699
  }
3711
3700
  });
3712
3701
 
3713
- // src/widgets/builtins/Image.tsx
3714
- import "zod";
3715
-
3716
- // src/widgets/shared/safeSrc.ts
3717
- function safeImageSrc(u) {
3718
- if (typeof u !== "string") return void 0;
3719
- let i = 0;
3720
- while (i < u.length && u.charCodeAt(i) <= 32) i++;
3721
- const t = u.slice(i);
3722
- if (/^[/\\]{2}/.test(t)) return void 0;
3723
- return /^(https?:|\/|\.|data:image\/)/i.test(t) ? u : void 0;
3702
+ // src/widgets/wrap.tsx
3703
+ import { Suspense, lazy } from "react";
3704
+ import { z as z6 } from "zod";
3705
+ import { jsx as jsx10 } from "react/jsx-runtime";
3706
+ function wrapComponent(Component2, o) {
3707
+ const schema = o.schema ?? z6.record(z6.unknown());
3708
+ const eventNames = [...new Set(Object.values(o.events ?? {}))];
3709
+ return defineWidget({
3710
+ kind: o.kind,
3711
+ version: o.version ?? 1,
3712
+ meta: o.meta,
3713
+ schema,
3714
+ ...o.defaults ? { defaults: o.defaults } : {},
3715
+ ...o.implements ? { implements: o.implements } : {},
3716
+ ...o.exposes ? { exposes: o.exposes } : {},
3717
+ ...o.frame ? { frame: o.frame } : {},
3718
+ ...o.small ? { small: true } : {},
3719
+ events: eventNames,
3720
+ ...o.slots ? { slots: Object.fromEntries(Object.values(o.slots).map((s) => [s, { label: s }])) } : {},
3721
+ component: function Wrapped(props) {
3722
+ const mapped = o.mapProps ? o.mapProps(props) : { ...props.spec, data: props.data };
3723
+ const handlers = {};
3724
+ for (const [prop, event] of Object.entries(o.events ?? {}))
3725
+ handlers[prop] = (value, ...rest) => props.emit(event, void 0, { value, args: [value, ...rest] });
3726
+ for (const [prop, path] of Object.entries(o.writes ?? {})) {
3727
+ const before = handlers[prop];
3728
+ handlers[prop] = (value, ...rest) => {
3729
+ props.store.set(path, value);
3730
+ before?.(value, ...rest);
3731
+ };
3732
+ }
3733
+ const slotProps = {};
3734
+ for (const [prop, slot] of Object.entries(o.slots ?? {})) slotProps[prop] = props.renderSlot(slot);
3735
+ return /* @__PURE__ */ jsx10(Component2, { ...mapped, ...handlers, ...slotProps });
3736
+ }
3737
+ });
3738
+ }
3739
+ function lazyWidget(def) {
3740
+ const { load, fallback, ...rest } = def;
3741
+ let Comp;
3742
+ return defineWidget({
3743
+ ...rest,
3744
+ component: function LazyWidget(props) {
3745
+ Comp ??= lazy(load);
3746
+ return /* @__PURE__ */ jsx10(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx10("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx10(Comp, { ...props }) });
3747
+ }
3748
+ });
3724
3749
  }
3725
3750
 
3751
+ // src/widgets/builtins/FlowMap.tsx
3752
+ var FlowMap = lazyWidget({
3753
+ ...FlowMapContract,
3754
+ implements: "flow-map",
3755
+ exposes: { selection: "the clicked step's row" },
3756
+ meta: { label: "Flow map", icon: "flow", category: "Process", size: { w: 12, h: 12, minW: 6, minH: 6 } },
3757
+ events: ["click", "hover", "hoverEnd"],
3758
+ parts: ["step", "chip", "tag"],
3759
+ load: () => import("./FlowMapView-BSTKU7D4.js").then((m) => ({ default: m.FlowMapView }))
3760
+ });
3761
+
3726
3762
  // src/widgets/builtins/Image.tsx
3727
- import { jsx as jsx10 } from "react/jsx-runtime";
3763
+ import "zod";
3764
+ import { jsx as jsx11 } from "react/jsx-runtime";
3728
3765
  var Image = defineWidget({
3729
3766
  ...ImageContract,
3730
3767
  implements: "image",
@@ -3732,15 +3769,15 @@ var Image = defineWidget({
3732
3769
  events: ["click"],
3733
3770
  component: function ImageWidget({ spec, data, emit }) {
3734
3771
  const src = safeImageSrc(spec.src ?? field(data, spec.srcField) ?? (typeof data === "string" ? data : void 0));
3735
- if (!src) return /* @__PURE__ */ jsx10("div", { className: "ds-state", children: "No image" });
3736
- return /* @__PURE__ */ jsx10(
3772
+ if (!src) return /* @__PURE__ */ jsx11("div", { className: "ds-state", children: "No image" });
3773
+ return /* @__PURE__ */ jsx11(
3737
3774
  "button",
3738
3775
  {
3739
3776
  type: "button",
3740
3777
  className: "ds-plain",
3741
3778
  onClick: () => emit("click", "image", { value: src }),
3742
3779
  style: { width: "100%", height: "100%" },
3743
- children: /* @__PURE__ */ jsx10("img", { src, alt: spec.alt, style: { width: "100%", height: "100%", objectFit: spec.fit } })
3780
+ children: /* @__PURE__ */ jsx11("img", { src, alt: spec.alt, style: { width: "100%", height: "100%", objectFit: spec.fit } })
3744
3781
  }
3745
3782
  );
3746
3783
  }
@@ -3748,7 +3785,7 @@ var Image = defineWidget({
3748
3785
 
3749
3786
  // src/widgets/builtins/ImageMap.tsx
3750
3787
  import "zod";
3751
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
3788
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
3752
3789
  var ImageMap = defineWidget({
3753
3790
  ...ImageMapContract,
3754
3791
  implements: "image-map",
@@ -3767,7 +3804,7 @@ var ImageMap = defineWidget({
3767
3804
  })) : [];
3768
3805
  const src = safeImageSrc(spec.src);
3769
3806
  return /* @__PURE__ */ jsxs7("div", { className: "ds-imagemap", children: [
3770
- src && /* @__PURE__ */ jsx11("img", { src, alt: spec.alt }),
3807
+ src && /* @__PURE__ */ jsx12("img", { src, alt: spec.alt }),
3771
3808
  markers.map((mk, i) => {
3772
3809
  const t = mk.status ? spec.statusMap?.[mk.status] ?? mk.status : "info";
3773
3810
  return /* @__PURE__ */ jsxs7(
@@ -3806,7 +3843,7 @@ import "zod";
3806
3843
  // src/widgets/shared/InfoTip.tsx
3807
3844
  import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
3808
3845
  import { createPortal as createPortal2 } from "react-dom";
3809
- import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
3846
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
3810
3847
  function InfoTip({ text: text2 }) {
3811
3848
  const ref = useRef4(null);
3812
3849
  const tip = useRef4(null);
@@ -3859,11 +3896,11 @@ function InfoTip({ text: text2 }) {
3859
3896
  onBlur: hide,
3860
3897
  children: [
3861
3898
  /* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", children: [
3862
- /* @__PURE__ */ jsx12("circle", { cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeWidth: "1" }),
3863
- /* @__PURE__ */ jsx12("path", { d: "M8 7.2v3.6M8 5.2v.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
3899
+ /* @__PURE__ */ jsx13("circle", { cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeWidth: "1" }),
3900
+ /* @__PURE__ */ jsx13("path", { d: "M8 7.2v3.6M8 5.2v.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
3864
3901
  ] }),
3865
3902
  mounted && root && createPortal2(
3866
- /* @__PURE__ */ jsx12(
3903
+ /* @__PURE__ */ jsx13(
3867
3904
  "span",
3868
3905
  {
3869
3906
  ref: tip,
@@ -3949,7 +3986,7 @@ var Boundary = class extends Component {
3949
3986
 
3950
3987
  // src/components/Slot.tsx
3951
3988
  import { createContext as createContext3, useContext as useContext4 } from "react";
3952
- import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
3989
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
3953
3990
  var NodeScopeContext = createContext3({});
3954
3991
  var useNodeScope = () => useContext4(NodeScopeContext);
3955
3992
  var SlotOwnerContext = createContext3(null);
@@ -3985,7 +4022,7 @@ function Slot({
3985
4022
  item: item !== void 0 ? item : outer.item,
3986
4023
  index: index !== void 0 ? index : outer.index
3987
4024
  };
3988
- return /* @__PURE__ */ jsx13(NodeScopeContext.Provider, { value: scope2, children: /* @__PURE__ */ jsxs9(
4025
+ return /* @__PURE__ */ jsx14(NodeScopeContext.Provider, { value: scope2, children: /* @__PURE__ */ jsxs9(
3989
4026
  "div",
3990
4027
  {
3991
4028
  className: className ? `ds-slot ${className}` : "ds-slot",
@@ -3994,16 +4031,16 @@ function Slot({
3994
4031
  "data-owner": owner.id,
3995
4032
  "data-empty": ids.length === 0 || void 0,
3996
4033
  children: [
3997
- ids.map((id) => /* @__PURE__ */ jsx13(SlotItem, { children: renderChild(id) }, id)),
3998
- ids.length === 0 && editing && (empty ?? /* @__PURE__ */ jsx13("span", { className: "ds-slot-hint", children: "Drop here" }))
4034
+ ids.map((id) => /* @__PURE__ */ jsx14(SlotItem, { children: renderChild(id) }, id)),
4035
+ ids.length === 0 && editing && (empty ?? /* @__PURE__ */ jsx14("span", { className: "ds-slot-hint", children: "Drop here" }))
3999
4036
  ]
4000
4037
  }
4001
4038
  ) });
4002
4039
  }
4003
- var SlotItem = ({ children }) => /* @__PURE__ */ jsx13(Fragment5, { children });
4040
+ var SlotItem = ({ children }) => /* @__PURE__ */ jsx14(Fragment5, { children });
4004
4041
 
4005
4042
  // src/components/PanelFrame.tsx
4006
- import { jsx as jsx14, jsxs as jsxs10 } from "react/jsx-runtime";
4043
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
4007
4044
  var isEmpty = (d) => d === void 0 || d === null || Array.isArray(d) && d.length === 0 || typeof d === "object" && !Array.isArray(d) && Object.keys(d).length === 0;
4008
4045
  function useSize() {
4009
4046
  const [size2, setSize] = useState4({ width: 0, height: 0 });
@@ -4215,7 +4252,7 @@ function dropIndexAt(panel, x, y) {
4215
4252
  return { slot: box.getAttribute("data-slot") ?? void 0, index: indexIn(box, x, y) };
4216
4253
  }
4217
4254
  function PanelFrame({ id, nested = false }) {
4218
- return /* @__PURE__ */ jsx14(Boundary, { resetKeys: [id], fallback: (e) => /* @__PURE__ */ jsx14(PanelCrash, { id, error: e }), children: /* @__PURE__ */ jsx14(PanelFrameInner, { id, nested }) });
4255
+ return /* @__PURE__ */ jsx15(Boundary, { resetKeys: [id], fallback: (e) => /* @__PURE__ */ jsx15(PanelCrash, { id, error: e }), children: /* @__PURE__ */ jsx15(PanelFrameInner, { id, nested }) });
4219
4256
  }
4220
4257
  function PanelCrash({ id, error }) {
4221
4258
  const { options } = useDashboard();
@@ -4225,7 +4262,7 @@ function PanelCrash({ id, error }) {
4225
4262
  } catch {
4226
4263
  custom = void 0;
4227
4264
  }
4228
- return /* @__PURE__ */ jsx14("section", { className: "ds-panel", "data-panel": id, "aria-label": id, children: /* @__PURE__ */ jsx14("div", { className: "ds-panel-body", children: custom ?? /* @__PURE__ */ jsxs10("div", { className: "ds-state ds-state-error", role: "alert", children: [
4265
+ return /* @__PURE__ */ jsx15("section", { className: "ds-panel", "data-panel": id, "aria-label": id, children: /* @__PURE__ */ jsx15("div", { className: "ds-panel-body", children: custom ?? /* @__PURE__ */ jsxs10("div", { className: "ds-state ds-state-error", role: "alert", children: [
4229
4266
  "This panel could not be shown: ",
4230
4267
  error.message
4231
4268
  ] }) }) });
@@ -4312,7 +4349,7 @@ function PanelFrameInner({ id, nested }) {
4312
4349
  ),
4313
4350
  samePanelView
4314
4351
  );
4315
- const renderNested = useCallback4((child) => /* @__PURE__ */ jsx14(PanelFrame, { id: child, nested: true }, child), []);
4352
+ const renderNested = useCallback4((child) => /* @__PURE__ */ jsx15(PanelFrame, { id: child, nested: true }, child), []);
4316
4353
  const store = useMemo3(() => widgetStore(runtime), [runtime]);
4317
4354
  const [bodyRef, size2] = useSize();
4318
4355
  const frameRef = useRef5(null);
@@ -4403,14 +4440,14 @@ function PanelFrameInner({ id, nested }) {
4403
4440
  "\u201D"
4404
4441
  ] });
4405
4442
  else if (view.error && view.data === void 0)
4406
- body = options.renderError?.(view.error, id) ?? /* @__PURE__ */ jsx14("div", { className: "ds-state ds-state-error", role: "alert", children: view.messages?.error ?? view.error.message });
4443
+ body = options.renderError?.(view.error, id) ?? /* @__PURE__ */ jsx15("div", { className: "ds-state ds-state-error", role: "alert", children: view.messages?.error ?? view.error.message });
4407
4444
  else if (view.source && view.data === void 0 && (view.status === "loading" || view.status === "idle"))
4408
- body = options.renderLoading?.(id, loadingText(view.messages)) ?? /* @__PURE__ */ jsx14(LoadingState, { text: loadingText(view.messages) });
4445
+ body = options.renderLoading?.(id, loadingText(view.messages)) ?? /* @__PURE__ */ jsx15(LoadingState, { text: loadingText(view.messages) });
4409
4446
  else if (view.source && isEmpty(view.data) && widget.empty !== "widget")
4410
- body = options.renderEmpty?.(id) ?? /* @__PURE__ */ jsx14("div", { className: "ds-state", children: view.messages?.empty ?? "No data" });
4447
+ body = options.renderEmpty?.(id) ?? /* @__PURE__ */ jsx15("div", { className: "ds-state", children: view.messages?.empty ?? "No data" });
4411
4448
  else {
4412
4449
  const W = widget.component;
4413
- body = /* @__PURE__ */ jsx14(
4450
+ body = /* @__PURE__ */ jsx15(
4414
4451
  Boundary,
4415
4452
  {
4416
4453
  resetKeys: [view.data, props],
@@ -4418,7 +4455,7 @@ function PanelFrameInner({ id, nested }) {
4418
4455
  "This panel could not be shown: ",
4419
4456
  e.message
4420
4457
  ] }),
4421
- children: /* @__PURE__ */ jsx14(
4458
+ children: /* @__PURE__ */ jsx15(
4422
4459
  W,
4423
4460
  {
4424
4461
  spec: props,
@@ -4434,7 +4471,7 @@ function PanelFrameInner({ id, nested }) {
4434
4471
  mode: options.mode,
4435
4472
  helpers: runtime.helpers,
4436
4473
  panelId: id,
4437
- renderSlot: (name, o) => /* @__PURE__ */ jsx14(Slot, { name, ...o }),
4474
+ renderSlot: (name, o) => /* @__PURE__ */ jsx15(Slot, { name, ...o }),
4438
4475
  store
4439
4476
  }
4440
4477
  )
@@ -4451,7 +4488,7 @@ function PanelFrameInner({ id, nested }) {
4451
4488
  const name = el?.getAttribute("data-slot") ?? defaultSlot;
4452
4489
  return { slot: name, index: el ? indexIn(el, x, y) : void 0 };
4453
4490
  };
4454
- return /* @__PURE__ */ jsx14(SlotOwnerContext.Provider, { value: { id, data: view.data, def }, children: /* @__PURE__ */ jsx14(SlotChildContext.Provider, { value: renderNested, children: /* @__PURE__ */ jsxs10(
4491
+ return /* @__PURE__ */ jsx15(SlotOwnerContext.Provider, { value: { id, data: view.data, def }, children: /* @__PURE__ */ jsx15(SlotChildContext.Provider, { value: renderNested, children: /* @__PURE__ */ jsxs10(
4455
4492
  "section",
4456
4493
  {
4457
4494
  ref: frameRef,
@@ -4504,15 +4541,15 @@ function PanelFrameInner({ id, nested }) {
4504
4541
  /* @__PURE__ */ jsxs10("div", { style: { minWidth: 0 }, children: [
4505
4542
  title && /* @__PURE__ */ jsxs10("h3", { className: "ds-panel-title", children: [
4506
4543
  title,
4507
- info && /* @__PURE__ */ jsx14(InfoTip, { text: info })
4544
+ info && /* @__PURE__ */ jsx15(InfoTip, { text: info })
4508
4545
  ] }),
4509
- subtitle && /* @__PURE__ */ jsx14("p", { className: "ds-panel-subtitle", children: subtitle }),
4546
+ subtitle && /* @__PURE__ */ jsx15("p", { className: "ds-panel-subtitle", children: subtitle }),
4510
4547
  drill.length > 0 && /* @__PURE__ */ jsxs10("nav", { className: "ds-crumbs", "aria-label": "Drill path", children: [
4511
- /* @__PURE__ */ jsx14("button", { type: "button", onClick: () => runtime.runAction({ do: "drillReset", panel: id }), children: "All" }),
4548
+ /* @__PURE__ */ jsx15("button", { type: "button", onClick: () => runtime.runAction({ do: "drillReset", panel: id }), children: "All" }),
4512
4549
  drill.map((d, i) => /* @__PURE__ */ jsxs10("span", { children: [
4513
4550
  "\u203A",
4514
4551
  " ",
4515
- i < drill.length - 1 ? /* @__PURE__ */ jsx14(
4552
+ i < drill.length - 1 ? /* @__PURE__ */ jsx15(
4516
4553
  "button",
4517
4554
  {
4518
4555
  type: "button",
@@ -4526,13 +4563,13 @@ function PanelFrameInner({ id, nested }) {
4526
4563
  ] })
4527
4564
  ] }),
4528
4565
  /* @__PURE__ */ jsxs10("div", { className: "ds-panel-tools", children: [
4529
- headerKids.length > 0 && /* @__PURE__ */ jsx14(Slot, { name: "header", className: "ds-panel-addons" }),
4530
- meta2 && /* @__PURE__ */ jsx14("span", { className: "ds-panel-meta", children: meta2 }),
4566
+ headerKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "header", className: "ds-panel-addons" }),
4567
+ meta2 && /* @__PURE__ */ jsx15("span", { className: "ds-panel-meta", children: meta2 }),
4531
4568
  live2 ? /* @__PURE__ */ jsxs10("span", { className: "ds-live", "data-stale": view.stale || void 0, title: view.error?.message, children: [
4532
- /* @__PURE__ */ jsx14("span", { "aria-hidden": "true" }),
4569
+ /* @__PURE__ */ jsx15("span", { "aria-hidden": "true" }),
4533
4570
  liveLabel(props.liveText, view.updatedAt, runtime.helpers)
4534
- ] }) : view.stale && /* @__PURE__ */ jsx14("span", { className: "ds-badge ds-badge-stale", title: view.error?.message, children: "Stale" }),
4535
- controls.map((c) => /* @__PURE__ */ jsx14(
4571
+ ] }) : view.stale && /* @__PURE__ */ jsx15("span", { className: "ds-badge ds-badge-stale", title: view.error?.message, children: "Stale" }),
4572
+ controls.map((c) => /* @__PURE__ */ jsx15(
4536
4573
  ControlField,
4537
4574
  {
4538
4575
  def: c,
@@ -4549,9 +4586,9 @@ function PanelFrameInner({ id, nested }) {
4549
4586
  ))
4550
4587
  ] })
4551
4588
  ] }),
4552
- toolbarKids.length > 0 && /* @__PURE__ */ jsx14(Slot, { name: "toolbar", className: "ds-panel-toolbar" }),
4553
- /* @__PURE__ */ jsx14("div", { className: "ds-panel-body", ref: bodyRef, children: body }),
4554
- footerKids.length > 0 && /* @__PURE__ */ jsx14(Slot, { name: "footer", className: "ds-panel-foot" })
4589
+ toolbarKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "toolbar", className: "ds-panel-toolbar" }),
4590
+ /* @__PURE__ */ jsx15("div", { className: "ds-panel-body", ref: bodyRef, children: body }),
4591
+ footerKids.length > 0 && /* @__PURE__ */ jsx15(Slot, { name: "footer", className: "ds-panel-foot" })
4555
4592
  ]
4556
4593
  }
4557
4594
  ) }) });
@@ -4561,10 +4598,10 @@ function loadingText(messages) {
4561
4598
  return v2 === void 0 || v2 === null || v2 === "" ? void 0 : String(v2);
4562
4599
  }
4563
4600
  function LoadingState({ text: text2 }) {
4564
- if (!text2) return /* @__PURE__ */ jsx14("div", { className: "ds-skeleton", "aria-busy": "true", "aria-label": "Loading" });
4601
+ if (!text2) return /* @__PURE__ */ jsx15("div", { className: "ds-skeleton", "aria-busy": "true", "aria-label": "Loading" });
4565
4602
  return /* @__PURE__ */ jsxs10("output", { className: "ds-loading", "aria-busy": "true", children: [
4566
- /* @__PURE__ */ jsx14("div", { className: "ds-skeleton", "aria-hidden": "true" }),
4567
- /* @__PURE__ */ jsx14("span", { className: "ds-loading-text", children: text2 })
4603
+ /* @__PURE__ */ jsx15("div", { className: "ds-skeleton", "aria-hidden": "true" }),
4604
+ /* @__PURE__ */ jsx15("span", { className: "ds-loading-text", children: text2 })
4568
4605
  ] });
4569
4606
  }
4570
4607
 
@@ -4618,7 +4655,7 @@ function useCountUp(target, ms = 700) {
4618
4655
  }
4619
4656
 
4620
4657
  // src/widgets/builtins/Kpi.tsx
4621
- import { Fragment as Fragment6, jsx as jsx15, jsxs as jsxs11 } from "react/jsx-runtime";
4658
+ import { Fragment as Fragment6, jsx as jsx16, jsxs as jsxs11 } from "react/jsx-runtime";
4622
4659
  var Kpi = defineWidget({
4623
4660
  ...KpiContract,
4624
4661
  implements: "kpi",
@@ -4654,10 +4691,10 @@ var Kpi = defineWidget({
4654
4691
  const ratio = n !== void 0 && pTarget ? Math.min(spec.progress?.cap ?? Number.POSITIVE_INFINITY, n / pTarget * 100) : void 0;
4655
4692
  return /* @__PURE__ */ jsxs11("div", { className: "ds-kpi", "data-size": spec.size, children: [
4656
4693
  /* @__PURE__ */ jsxs11("div", { className: "ds-kpi-label", children: [
4657
- /* @__PURE__ */ jsx15("span", { children: spec.title }),
4658
- spec.info && /* @__PURE__ */ jsx15(InfoTip, { text: spec.info })
4694
+ /* @__PURE__ */ jsx16("span", { children: spec.title }),
4695
+ spec.info && /* @__PURE__ */ jsx16(InfoTip, { text: spec.info })
4659
4696
  ] }),
4660
- /* @__PURE__ */ jsx15(
4697
+ /* @__PURE__ */ jsx16(
4661
4698
  "button",
4662
4699
  {
4663
4700
  type: "button",
@@ -4668,7 +4705,7 @@ var Kpi = defineWidget({
4668
4705
  "aria-label": `${spec.title ?? "Value"}: ${empty ? spec.emptyText ?? "no value" : fmt(value)}${unit ? ` ${unit}` : ""}`,
4669
4706
  children: empty ? (
4670
4707
  // No value is not zero: the author's text, else a dash.
4671
- /* @__PURE__ */ jsx15("span", { className: "ds-kpi-empty", children: spec.emptyText || "\u2014" })
4708
+ /* @__PURE__ */ jsx16("span", { className: "ds-kpi-empty", children: spec.emptyText || "\u2014" })
4672
4709
  ) : /* @__PURE__ */ jsxs11(Fragment6, { children: [
4673
4710
  /* @__PURE__ */ jsxs11(
4674
4711
  "span",
@@ -4681,7 +4718,7 @@ var Kpi = defineWidget({
4681
4718
  ]
4682
4719
  }
4683
4720
  ),
4684
- unit && spec.unitStyle !== "value" && /* @__PURE__ */ jsx15("span", { className: "ds-kpi-unit", children: unit })
4721
+ unit && spec.unitStyle !== "value" && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-unit", children: unit })
4685
4722
  ] })
4686
4723
  }
4687
4724
  ),
@@ -4701,8 +4738,8 @@ var Kpi = defineWidget({
4701
4738
  ]
4702
4739
  }
4703
4740
  ),
4704
- spec.note && /* @__PURE__ */ jsx15("span", { className: "ds-kpi-sub", children: spec.note }),
4705
- spec.sublabel && /* @__PURE__ */ jsx15("span", { className: "ds-kpi-sub", children: spec.sublabel }),
4741
+ spec.note && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-sub", children: spec.note }),
4742
+ spec.sublabel && /* @__PURE__ */ jsx16("span", { className: "ds-kpi-sub", children: spec.sublabel }),
4706
4743
  low !== void 0 && high !== void 0 && /* @__PURE__ */ jsxs11("span", { className: "ds-kpi-sub", children: [
4707
4744
  "Expected ",
4708
4745
  fmt(low),
@@ -4710,7 +4747,7 @@ var Kpi = defineWidget({
4710
4747
  fmt(high)
4711
4748
  ] }),
4712
4749
  ratio !== void 0 && // biome-ignore lint/a11y/useFocusableInteractive: a progress bar is read-only, not interactive
4713
- /* @__PURE__ */ jsx15(
4750
+ /* @__PURE__ */ jsx16(
4714
4751
  "span",
4715
4752
  {
4716
4753
  className: "ds-progress",
@@ -4718,7 +4755,7 @@ var Kpi = defineWidget({
4718
4755
  "aria-valuenow": Math.round(ratio),
4719
4756
  "aria-valuemin": 0,
4720
4757
  "aria-valuemax": 100,
4721
- children: /* @__PURE__ */ jsx15(
4758
+ children: /* @__PURE__ */ jsx16(
4722
4759
  "span",
4723
4760
  {
4724
4761
  style: { width: `${Math.min(100, ratio)}%`, background: tone(ratio >= 100 ? "good" : "info").solid }
@@ -4727,8 +4764,8 @@ var Kpi = defineWidget({
4727
4764
  }
4728
4765
  ),
4729
4766
  (hasTarget || targetText) && /* @__PURE__ */ jsxs11("div", { className: "ds-kpi-foot", children: [
4730
- hasTarget && target === void 0 ? /* @__PURE__ */ jsx15("span", { className: "ds-chip", "data-tone": "bad", children: spec.targetMissing }) : /* @__PURE__ */ jsx15("span", { "data-ds-part": "target", children: targetText }),
4731
- spec.badge !== false && met !== void 0 && !empty && /* @__PURE__ */ jsx15("span", { className: "ds-chip", "data-tone": met ? "good" : "bad", "data-ds-part": "badge", children: met ? labels.good : labels.bad })
4767
+ hasTarget && target === void 0 ? /* @__PURE__ */ jsx16("span", { className: "ds-chip", "data-tone": "bad", children: spec.targetMissing }) : /* @__PURE__ */ jsx16("span", { "data-ds-part": "target", children: targetText }),
4768
+ spec.badge !== false && met !== void 0 && !empty && /* @__PURE__ */ jsx16("span", { className: "ds-chip", "data-tone": met ? "good" : "bad", "data-ds-part": "badge", children: met ? labels.good : labels.bad })
4732
4769
  ] })
4733
4770
  ] });
4734
4771
  }
@@ -4736,7 +4773,7 @@ var Kpi = defineWidget({
4736
4773
 
4737
4774
  // src/widgets/builtins/Sparkline.tsx
4738
4775
  import "zod";
4739
- import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
4776
+ import { jsx as jsx17, jsxs as jsxs12 } from "react/jsx-runtime";
4740
4777
  function sparkPath(values, w, h, pad = 2) {
4741
4778
  if (values.length === 0) return { line: "", area: "" };
4742
4779
  const min = values.reduce((a, b) => Math.min(a, b));
@@ -4757,8 +4794,8 @@ function SparkSvg({
4757
4794
  const w = 120;
4758
4795
  const { line, area: fill } = sparkPath(values, w, height);
4759
4796
  return /* @__PURE__ */ jsxs12("svg", { viewBox: `0 0 ${w} ${height}`, preserveAspectRatio: "none", style: { width: "100%", height }, "aria-hidden": "true", children: [
4760
- area && /* @__PURE__ */ jsx16("path", { d: fill, fill: color2, opacity: 0.15 }),
4761
- /* @__PURE__ */ jsx16("path", { d: line, fill: "none", stroke: color2, strokeWidth: 1.5, vectorEffect: "non-scaling-stroke" })
4797
+ area && /* @__PURE__ */ jsx17("path", { d: fill, fill: color2, opacity: 0.15 }),
4798
+ /* @__PURE__ */ jsx17("path", { d: line, fill: "none", stroke: color2, strokeWidth: 1.5, vectorEffect: "non-scaling-stroke" })
4762
4799
  ] });
4763
4800
  }
4764
4801
  var Sparkline = defineWidget({
@@ -4770,14 +4807,14 @@ var Sparkline = defineWidget({
4770
4807
  component: function SparklineWidget({ spec, data, size: size2, emit }) {
4771
4808
  const rows = asRows(data);
4772
4809
  const values = rows.map((r) => toNumber(field(r, spec.y)) ?? 0);
4773
- return /* @__PURE__ */ jsx16(
4810
+ return /* @__PURE__ */ jsx17(
4774
4811
  "div",
4775
4812
  {
4776
4813
  onMouseEnter: () => emit("hover", "line", { value: values[values.length - 1] }),
4777
4814
  style: { height: "100%" },
4778
4815
  role: "img",
4779
4816
  "aria-label": `${spec.title ?? spec.y}: ${values.length} points`,
4780
- children: /* @__PURE__ */ jsx16(SparkSvg, { values, area: spec.area, height: Math.max(24, size2.height || 32) })
4817
+ children: /* @__PURE__ */ jsx17(SparkSvg, { values, area: spec.area, height: Math.max(24, size2.height || 32) })
4781
4818
  }
4782
4819
  );
4783
4820
  }
@@ -4785,7 +4822,7 @@ var Sparkline = defineWidget({
4785
4822
 
4786
4823
  // src/widgets/builtins/StageTracker.tsx
4787
4824
  import "zod";
4788
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
4825
+ import { jsx as jsx18, jsxs as jsxs13 } from "react/jsx-runtime";
4789
4826
  var StageTracker = defineWidget({
4790
4827
  ...StageTrackerContract,
4791
4828
  implements: "stages",
@@ -4795,16 +4832,16 @@ var StageTracker = defineWidget({
4795
4832
  component: function StageTrackerWidget({ spec, data, emit }) {
4796
4833
  const raw = typeof data === "string" || typeof data === "number" ? data : field(data, spec.current);
4797
4834
  const idx = typeof raw === "number" ? raw : spec.stages.findIndex((s) => s.toLowerCase() === String(raw ?? "").toLowerCase());
4798
- return /* @__PURE__ */ jsx17("ol", { className: "ds-stages", children: spec.stages.map((s, i) => {
4835
+ return /* @__PURE__ */ jsx18("ol", { className: "ds-stages", children: spec.stages.map((s, i) => {
4799
4836
  const state = i < idx ? "done" : i === idx ? "current" : "todo";
4800
- return /* @__PURE__ */ jsx17("li", { "data-state": state, children: /* @__PURE__ */ jsxs13(
4837
+ return /* @__PURE__ */ jsx18("li", { "data-state": state, children: /* @__PURE__ */ jsxs13(
4801
4838
  "button",
4802
4839
  {
4803
4840
  type: "button",
4804
4841
  onClick: () => emit("click", "stage", { value: s, index: i, datum: data }),
4805
4842
  "aria-current": state === "current" ? "step" : void 0,
4806
4843
  children: [
4807
- /* @__PURE__ */ jsx17("span", { className: "ds-stage-dot", "aria-hidden": "true", children: state === "done" ? "\u2713" : i + 1 }),
4844
+ /* @__PURE__ */ jsx18("span", { className: "ds-stage-dot", "aria-hidden": "true", children: state === "done" ? "\u2713" : i + 1 }),
4808
4845
  s
4809
4846
  ]
4810
4847
  }
@@ -4815,7 +4852,7 @@ var StageTracker = defineWidget({
4815
4852
 
4816
4853
  // src/widgets/builtins/StateTimeline.tsx
4817
4854
  import "zod";
4818
- import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
4855
+ import { jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
4819
4856
  var StateTimeline = defineWidget({
4820
4857
  ...StateTimelineContract,
4821
4858
  implements: "timeline",
@@ -4840,10 +4877,10 @@ var StateTimeline = defineWidget({
4840
4877
  return { p, from, to, state };
4841
4878
  });
4842
4879
  return /* @__PURE__ */ jsxs14("div", { className: "ds-timeline-lane", children: [
4843
- lane && /* @__PURE__ */ jsx18("span", { className: "ds-timeline-name", children: lane }),
4844
- /* @__PURE__ */ jsx18("div", { className: "ds-timeline-bar", role: "img", "aria-label": `${spec.title ?? "Timeline"} ${lane}`, children: segs.filter((s) => s.to > s.from).map((s) => (
4880
+ lane && /* @__PURE__ */ jsx19("span", { className: "ds-timeline-name", children: lane }),
4881
+ /* @__PURE__ */ jsx19("div", { className: "ds-timeline-bar", role: "img", "aria-label": `${spec.title ?? "Timeline"} ${lane}`, children: segs.filter((s) => s.to > s.from).map((s) => (
4845
4882
  // biome-ignore lint/a11y/useKeyWithClickEvents: the per-state totals below summarise the same data for keyboard users
4846
- /* @__PURE__ */ jsx18(
4883
+ /* @__PURE__ */ jsx19(
4847
4884
  "span",
4848
4885
  {
4849
4886
  title: `${s.state} \xB7 ${helpers.fmt.date(s.from, "time")}\u2013${helpers.fmt.date(s.to, "time")} (${helpers.fmt.duration((s.to - s.from) / 1e3)})`,
@@ -4861,11 +4898,11 @@ var StateTimeline = defineWidget({
4861
4898
  ] }, lane);
4862
4899
  }),
4863
4900
  /* @__PURE__ */ jsxs14("div", { className: "ds-timeline-axis", children: [
4864
- /* @__PURE__ */ jsx18("span", { children: helpers.fmt.date(start, "time") }),
4865
- /* @__PURE__ */ jsx18("span", { children: spec.endLabel ?? helpers.fmt.date(end, "time") })
4901
+ /* @__PURE__ */ jsx19("span", { children: helpers.fmt.date(start, "time") }),
4902
+ /* @__PURE__ */ jsx19("span", { children: spec.endLabel ?? helpers.fmt.date(end, "time") })
4866
4903
  ] }),
4867
- /* @__PURE__ */ jsx18("ul", { className: "ds-legend", children: [...states.entries()].map(([s, ms]) => /* @__PURE__ */ jsxs14("li", { children: [
4868
- /* @__PURE__ */ jsx18(
4904
+ /* @__PURE__ */ jsx19("ul", { className: "ds-legend", children: [...states.entries()].map(([s, ms]) => /* @__PURE__ */ jsxs14("li", { children: [
4905
+ /* @__PURE__ */ jsx19(
4869
4906
  "span",
4870
4907
  {
4871
4908
  className: "ds-dot",
@@ -4875,7 +4912,7 @@ var StateTimeline = defineWidget({
4875
4912
  ),
4876
4913
  s,
4877
4914
  " ",
4878
- /* @__PURE__ */ jsx18("strong", { children: helpers.fmt.duration(ms / 1e3) })
4915
+ /* @__PURE__ */ jsx19("strong", { children: helpers.fmt.duration(ms / 1e3) })
4879
4916
  ] }, s)) })
4880
4917
  ] });
4881
4918
  }
@@ -4883,7 +4920,7 @@ var StateTimeline = defineWidget({
4883
4920
 
4884
4921
  // src/widgets/builtins/Status.tsx
4885
4922
  import "zod";
4886
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
4923
+ import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
4887
4924
  var Status = defineWidget({
4888
4925
  ...StatusContract,
4889
4926
  implements: "badge",
@@ -4898,56 +4935,16 @@ var Status = defineWidget({
4898
4935
  const text2 = spec.text ?? spec.labels?.[state] ?? state.charAt(0).toUpperCase() + state.slice(1);
4899
4936
  return /* @__PURE__ */ jsxs15("button", { type: "button", className: "ds-status", onClick: () => emit("click", "status", { datum: row, value: state }), children: [
4900
4937
  /* @__PURE__ */ jsxs15("span", { className: "ds-pill", style: { background: tone(t).bg, color: tone(t).fg, borderColor: tone(t).border }, children: [
4901
- /* @__PURE__ */ jsx19("span", { className: "ds-dot", style: { background: tone(t).solid }, "aria-hidden": "true" }),
4938
+ /* @__PURE__ */ jsx20("span", { className: "ds-dot", style: { background: tone(t).solid }, "aria-hidden": "true" }),
4902
4939
  text2
4903
4940
  ] }),
4904
- spec.label && /* @__PURE__ */ jsx19("span", { className: "ds-status-label", children: String(field(row, spec.label) ?? "") })
4941
+ spec.label && /* @__PURE__ */ jsx20("span", { className: "ds-status-label", children: String(field(row, spec.label) ?? "") })
4905
4942
  ] });
4906
4943
  }
4907
4944
  });
4908
4945
 
4909
4946
  // src/widgets/builtins/Table.tsx
4910
4947
  import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useState as useState6 } from "react";
4911
-
4912
- // src/widgets/shared/chips.tsx
4913
- import { jsx as jsx20 } from "react/jsx-runtime";
4914
- var TONES = /* @__PURE__ */ new Set(["good", "warn", "bad", "neutral", "info", "action", "muted"]);
4915
- function evalOver(expr, vars, helpers) {
4916
- try {
4917
- return evaluate(expr, scope(vars, helpers));
4918
- } catch {
4919
- return void 0;
4920
- }
4921
- }
4922
- function toneOf(tone2, vars, helpers) {
4923
- if (!tone2) return void 0;
4924
- if (TONES.has(tone2)) return tone2;
4925
- const t = evalOver(tone2, vars, helpers);
4926
- return typeof t === "string" ? t : void 0;
4927
- }
4928
- function Chips({
4929
- chips,
4930
- vars,
4931
- helpers
4932
- }) {
4933
- if (!chips?.length) return null;
4934
- const shown = chips.filter((c) => c.when === void 0 || Boolean(evalOver(c.when, vars, helpers))).map((c) => {
4935
- let text2 = "";
4936
- try {
4937
- const v2 = interpolate(c.text, scope(vars, helpers));
4938
- text2 = v2 === null || v2 === void 0 ? "" : String(v2);
4939
- } catch {
4940
- }
4941
- return { text: text2, tone: toneOf(c.tone, vars, helpers) ?? "neutral" };
4942
- }).filter((c) => c.text);
4943
- if (shown.length === 0) return null;
4944
- return /* @__PURE__ */ jsx20("span", { className: "ds-chips", children: shown.map((c, i) => (
4945
- // biome-ignore lint/suspicious/noArrayIndexKey: chips come from a fixed list in the spec
4946
- /* @__PURE__ */ jsx20("span", { className: "ds-chip", "data-tone": c.tone, children: c.text }, i)
4947
- )) });
4948
- }
4949
-
4950
- // src/widgets/builtins/Table.tsx
4951
4948
  import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
4952
4949
  var ROW_H = 36;
4953
4950
  function pageList(current, pages) {
@@ -6604,6 +6601,7 @@ var builtInWidgets = [
6604
6601
  Status,
6605
6602
  CardGrid,
6606
6603
  ImageMap,
6604
+ FlowMap,
6607
6605
  Sparkline,
6608
6606
  Content,
6609
6607
  Image,
@@ -6873,11 +6871,11 @@ function Grid({
6873
6871
 
6874
6872
  // src/components/ModalHost.tsx
6875
6873
  import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef10 } from "react";
6876
- import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
6874
+ import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
6877
6875
  var WIDTH = { sm: "420px", md: "720px", lg: "1040px", xl: "1320px", full: "100%" };
6878
6876
  var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
6879
6877
  function ModalHost() {
6880
- const { runtime } = useDashboard();
6878
+ const { runtime, options } = useDashboard();
6881
6879
  const modals = runtime.doc.spec.modals ?? {};
6882
6880
  const open = useTree(
6883
6881
  // biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
@@ -6886,10 +6884,10 @@ function ModalHost() {
6886
6884
  const byExpression = useTree(
6887
6885
  // biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
6888
6886
  useCallback6(
6889
- (t) => Object.entries(modals).filter(([, m2]) => {
6890
- if (typeof m2.open !== "string") return false;
6887
+ (t) => Object.entries(modals).filter(([, m]) => {
6888
+ if (typeof m.open !== "string") return false;
6891
6889
  try {
6892
- return Boolean(interpolate(m2.open, rootScope(t, runtime.helpers)));
6890
+ return Boolean(interpolate(m.open, rootScope(t, runtime.helpers)));
6893
6891
  } catch {
6894
6892
  return false;
6895
6893
  }
@@ -6913,9 +6911,9 @@ function ModalHost() {
6913
6911
  }
6914
6912
  }, [byExpression, runtime]);
6915
6913
  function titleOf(t, id) {
6916
- const m2 = modals[id];
6914
+ const m = modals[id];
6917
6915
  try {
6918
- return m2?.title ? String(interpolate(m2.title, rootScope(t, runtime.helpers)) ?? "") : "";
6916
+ return m?.title ? String(interpolate(m.title, rootScope(t, runtime.helpers)) ?? "") : "";
6919
6917
  } catch {
6920
6918
  return "";
6921
6919
  }
@@ -6932,8 +6930,9 @@ function ModalHost() {
6932
6930
  }, [openId, runtime, modals]);
6933
6931
  const closeRef = useRef10(close);
6934
6932
  closeRef.current = close;
6933
+ const hostDrawerOpen = Boolean(options.ui?.Drawer && openId && modals[openId]?.presentation === "drawer");
6935
6934
  useEffect9(() => {
6936
- if (!openId) return;
6935
+ if (!openId || hostDrawerOpen) return;
6937
6936
  const prev = document.activeElement;
6938
6937
  dialog.current?.focus();
6939
6938
  const onKey = (e) => {
@@ -6968,35 +6967,56 @@ function ModalHost() {
6968
6967
  for (const el of siblings) el.removeAttribute("inert");
6969
6968
  prev?.focus?.();
6970
6969
  };
6971
- }, [openId]);
6970
+ }, [openId, hostDrawerOpen]);
6972
6971
  const hidden = useHiddenPanels(open ? Object.keys(modals[open.id]?.panels ?? {}) : []);
6973
- if (!open) return null;
6974
- const m = modals[open.id];
6975
- if (!m) return null;
6976
- const grid = runtime.doc.spec.grid;
6977
- return /* @__PURE__ */ jsx28(
6978
- "div",
6979
- {
6980
- ref: scrim,
6981
- className: "ds-scrim",
6982
- "data-presentation": m.presentation ?? "modal",
6983
- onMouseDown: (e) => e.target === e.currentTarget && close(),
6984
- children: /* @__PURE__ */ jsxs21(
6985
- "dialog",
6986
- {
6987
- open: true,
6988
- className: "ds-dialog",
6989
- "aria-modal": "true",
6990
- "aria-label": open.title || open.id,
6991
- tabIndex: -1,
6992
- ref: dialog,
6993
- style: { ["--ds-dialog-w"]: WIDTH[m.size ?? "md"] ?? WIDTH.md },
6994
- children: [
6995
- /* @__PURE__ */ jsxs21("div", { className: "ds-dialog-head", children: [
6996
- /* @__PURE__ */ jsx28("h2", { children: open.title }),
6997
- /* @__PURE__ */ jsx28("button", { type: "button", className: "ds-close", "aria-label": "Close", onClick: close, children: "\xD7" })
6998
- ] }),
6999
- /* @__PURE__ */ jsx28(
6972
+ const HostDrawer = options.ui?.Drawer;
6973
+ const available = useTree(
6974
+ // biome-ignore lint/correctness/useExhaustiveDependencies: modals are fixed per runtime
6975
+ useCallback6(
6976
+ (t) => Object.entries(modals).filter(([, m]) => {
6977
+ if (typeof m.availableWhen !== "string") return true;
6978
+ try {
6979
+ return Boolean(evaluate(m.availableWhen, rootScope(t, runtime.helpers)));
6980
+ } catch {
6981
+ return false;
6982
+ }
6983
+ }).map(([id]) => id).join("\0"),
6984
+ [runtime]
6985
+ ),
6986
+ Object.is
6987
+ ).split("\0");
6988
+ useEffect9(() => {
6989
+ if (openId && modals[openId]?.availableWhen && !available.includes(openId))
6990
+ runtime.store.dispatch(stateActions.closeModal());
6991
+ });
6992
+ const lastArgs = useRef10(/* @__PURE__ */ new Map());
6993
+ const openArgs = useTree(
6994
+ useCallback6((t) => t.modal ? t.modal.args : void 0, []),
6995
+ Object.is
6996
+ );
6997
+ if (open?.id) lastArgs.current.set(open.id, openArgs);
6998
+ if (HostDrawer) {
6999
+ const drawers = Object.entries(modals).filter(
7000
+ ([id, m]) => m.presentation === "drawer" && (!m.availableWhen || available.includes(id))
7001
+ );
7002
+ if (drawers.length) {
7003
+ const grid = runtime.doc.spec.grid;
7004
+ const drawerEls = /* @__PURE__ */ jsx28(Fragment10, { children: drawers.map(([id, m]) => {
7005
+ const isOpen = open?.id === id;
7006
+ return /* @__PURE__ */ jsx28(
7007
+ HostDrawer,
7008
+ {
7009
+ id,
7010
+ open: isOpen,
7011
+ title: isOpen ? open.title : "",
7012
+ onClose: isOpen ? close : () => {
7013
+ },
7014
+ onReopen: () => void runtime.runAction({
7015
+ do: "openModal",
7016
+ modal: id,
7017
+ args: lastArgs.current.get(id) ?? m.defaultArgs
7018
+ }),
7019
+ children: isOpen ? /* @__PURE__ */ jsx28(
7000
7020
  Grid,
7001
7021
  {
7002
7022
  layouts: [{ items: m.layout }],
@@ -7005,14 +7025,68 @@ function ModalHost() {
7005
7025
  columns: grid.columns,
7006
7026
  rowHeight: grid.rowHeight,
7007
7027
  gap: grid.gap,
7008
- children: (id) => /* @__PURE__ */ jsx28(PanelFrame, { id })
7028
+ exactHeights: grid.exactHeights,
7029
+ children: (pid) => /* @__PURE__ */ jsx28(PanelFrame, { id: pid })
7009
7030
  }
7010
- )
7011
- ]
7012
- }
7013
- )
7031
+ ) : null
7032
+ },
7033
+ id
7034
+ );
7035
+ }) });
7036
+ if (!open || modals[open.id]?.presentation === "drawer") return drawerEls;
7037
+ return /* @__PURE__ */ jsxs21(Fragment10, { children: [
7038
+ drawerEls,
7039
+ renderModal(open)
7040
+ ] });
7014
7041
  }
7015
- );
7042
+ }
7043
+ if (!open) return null;
7044
+ return renderModal(open);
7045
+ function renderModal(open2) {
7046
+ const m = modals[open2.id];
7047
+ if (!m) return null;
7048
+ const grid = runtime.doc.spec.grid;
7049
+ return /* @__PURE__ */ jsx28(
7050
+ "div",
7051
+ {
7052
+ ref: scrim,
7053
+ className: "ds-scrim",
7054
+ "data-presentation": m.presentation ?? "modal",
7055
+ onMouseDown: (e) => e.target === e.currentTarget && close(),
7056
+ children: /* @__PURE__ */ jsxs21(
7057
+ "dialog",
7058
+ {
7059
+ open: true,
7060
+ className: "ds-dialog",
7061
+ "aria-modal": "true",
7062
+ "aria-label": open2.title || open2.id,
7063
+ tabIndex: -1,
7064
+ ref: dialog,
7065
+ style: { ["--ds-dialog-w"]: WIDTH[m.size ?? "md"] ?? WIDTH.md },
7066
+ children: [
7067
+ /* @__PURE__ */ jsxs21("div", { className: "ds-dialog-head", children: [
7068
+ /* @__PURE__ */ jsx28("h2", { children: open2.title }),
7069
+ /* @__PURE__ */ jsx28("button", { type: "button", className: "ds-close", "aria-label": "Close", onClick: close, children: "\xD7" })
7070
+ ] }),
7071
+ /* @__PURE__ */ jsx28(
7072
+ Grid,
7073
+ {
7074
+ layouts: [{ items: m.layout }],
7075
+ hidden,
7076
+ view: null,
7077
+ columns: grid.columns,
7078
+ rowHeight: grid.rowHeight,
7079
+ gap: grid.gap,
7080
+ exactHeights: grid.exactHeights,
7081
+ children: (id) => /* @__PURE__ */ jsx28(PanelFrame, { id })
7082
+ }
7083
+ )
7084
+ ]
7085
+ }
7086
+ )
7087
+ }
7088
+ );
7089
+ }
7016
7090
  }
7017
7091
 
7018
7092
  // src/components/Provider.tsx
@@ -7066,7 +7140,7 @@ function pickTheme(name, themes, fallback) {
7066
7140
 
7067
7141
  // src/components/Tour.tsx
7068
7142
  import { useCallback as useCallback7, useEffect as useEffect10, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef12, useState as useState9 } from "react";
7069
- import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
7143
+ import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
7070
7144
  var useClientLayoutEffect = typeof window === "undefined" ? useEffect10 : useLayoutEffect3;
7071
7145
  function panelElement(root, id) {
7072
7146
  if (!root || !id) return null;
@@ -7143,7 +7217,7 @@ function TourButton({ steps }) {
7143
7217
  }, [isOpen]);
7144
7218
  if (steps.length === 0) return null;
7145
7219
  const last = at === steps.length - 1;
7146
- return /* @__PURE__ */ jsxs22(Fragment10, { children: [
7220
+ return /* @__PURE__ */ jsxs22(Fragment11, { children: [
7147
7221
  /* @__PURE__ */ jsx30(
7148
7222
  "button",
7149
7223
  {
@@ -7825,6 +7899,45 @@ var RENDERER_CSS = `
7825
7899
  .ds-repeater { height: 100%; overflow: auto; }
7826
7900
  .ds-repeater-item { display: flex; flex-direction: column; gap: 8px; }
7827
7901
  .ds-repeater-item > .ds-panel { height: auto; }
7902
+ /* FlowMap: a process flow; every colour from the theme, so it works in light and dark */
7903
+ .ds-flow { display: block; min-width: 0; }
7904
+ .ds-flow-scroll { flex: none; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
7905
+ .ds-flow-svg { display: block; width: 100%; height: auto; margin: 0 auto; }
7906
+ .ds-flow-track { fill: none; stroke: var(--ds-flow-track, var(--ds-color-border-default)); stroke-width: var(--ds-flow-track-width, 6); stroke-linecap: round; stroke-linejoin: round; }
7907
+ .ds-flow-track[data-dashed] { stroke-linecap: butt; stroke-dasharray: 5 2.5; }
7908
+ .ds-flow-chevron { fill: none; stroke: var(--ds-color-text-subtle); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
7909
+ .ds-flow-tag rect { fill: var(--ds-color-status-info-bg); }
7910
+ .ds-flow-tag text { font-family: var(--ds-font-heading); font-size: 11px; font-weight: 500; fill: var(--ds-color-status-info-fg); }
7911
+ .ds-flow-tag[data-dim] rect { fill: var(--ds-color-surface-table-header); }
7912
+ .ds-flow-tag[data-dim] text { fill: var(--ds-color-text-subtle); }
7913
+ .ds-flow-step { cursor: pointer; outline: none; }
7914
+ .ds-flow-step[data-untracked] { cursor: default; }
7915
+ .ds-flow-step:focus-visible .ds-flow-hit { stroke: var(--ds-color-border-focus); stroke-width: 2; }
7916
+ .ds-flow-hit { fill: transparent; pointer-events: all; }
7917
+ .ds-flow-label { font-family: var(--ds-font-heading); font-size: 14px; font-weight: 700; fill: var(--ds-color-text-primary); paint-order: stroke; stroke: var(--ds-color-surface-card); stroke-width: 6px; stroke-linejoin: round; }
7918
+ .ds-flow-label[data-selected] { font-size: 16px; }
7919
+ .ds-flow-step[data-untracked] .ds-flow-label { fill: var(--ds-color-text-disabled); }
7920
+ .ds-flow-untracked { fill: var(--ds-color-surface-card); stroke: var(--ds-color-text-disabled); stroke-width: 2; stroke-dasharray: 3 2; }
7921
+ .ds-flow-shape { stroke: var(--ds-color-surface-card); stroke-width: 3; paint-order: stroke; }
7922
+ .ds-flow-step[data-dim] .ds-flow-shape { fill: var(--ds-color-text-subtle); }
7923
+ .ds-flow-step[data-dim] image { filter: grayscale(1); }
7924
+ .ds-flow-halo { animation: ds-flow-pulse 1.2s ease-in-out infinite; }
7925
+ @keyframes ds-flow-pulse { 50% { opacity: .7; } }
7926
+ @media (prefers-reduced-motion: reduce) { .ds-flow-halo { animation: none; } }
7927
+ .ds-flow-chip rect { fill: var(--ds-color-surface-table-header); }
7928
+ .ds-flow-chip text { font-family: var(--ds-font-body); fill: var(--ds-color-text-primary); }
7929
+ .ds-flow-chip-value { font-size: 14px; font-weight: 700; }
7930
+ .ds-flow-chip-unit { font-size: 12px; font-weight: 400; fill: var(--ds-color-text-subtle); }
7931
+ .ds-flow-chip[data-tone="good"] rect { fill: var(--ds-color-status-good-bg); }
7932
+ .ds-flow-chip[data-tone="good"] text, .ds-flow-chip[data-tone="good"] .ds-flow-chip-unit { fill: var(--ds-color-status-good-fg); }
7933
+ .ds-flow-chip[data-tone="dim"] text, .ds-flow-chip[data-tone="dim"] .ds-flow-chip-unit { fill: var(--ds-color-text-subtle); }
7934
+ .ds-flow-chip[data-tone="selected"] rect { fill: var(--ds-color-surface-selection); }
7935
+ .ds-flow-chip[data-tone="selected"] text, .ds-flow-chip[data-tone="selected"] .ds-flow-chip-unit { fill: var(--ds-color-action-primary); }
7936
+ .ds-flow-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 20px; font-family: var(--ds-font-body); font-size: 12px; color: var(--ds-color-text-primary); }
7937
+ .ds-flow-legend li { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
7938
+ .ds-panel-tools .ds-flow-legend { flex: none; }
7939
+ .ds-flow-hover { position: fixed; z-index: var(--ds-z-tooltip); min-width: 220px; max-width: 320px; padding: 12px; border-radius: 12px; background: var(--ds-color-chart-tooltip-bg); color: var(--ds-color-chart-tooltip-text); box-shadow: var(--ds-shadow-overlay); backdrop-filter: blur(16px); }
7940
+ .ds-flow-hover > * { margin: 0; }
7828
7941
  `;
7829
7942
 
7830
7943
  // src/components/urlSync.ts
@@ -7893,7 +8006,7 @@ function releaseDefaultPrefix(owner) {
7893
8006
  }
7894
8007
 
7895
8008
  // src/components/DashboardRenderer.tsx
7896
- import { Fragment as Fragment11, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
8009
+ import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
7897
8010
  function usesScripts(doc) {
7898
8011
  const handler = (h) => {
7899
8012
  if (typeof h === "string") return isCallbackSource(h);
@@ -8023,7 +8136,7 @@ var DashboardRenderer = forwardRef(
8023
8136
  useEffect12(() => {
8024
8137
  if (!needsSandbox || sandbox) return;
8025
8138
  let cancelled = false;
8026
- import("./sandbox-WEMG76LE.js").then((m) => m.createSandboxRunner()).then((r) => !cancelled && setSandbox(r)).catch((e) => !cancelled && setSandboxError(String(e?.message ?? e)));
8139
+ import("./sandbox-RCDZ7SDZ.js").then((m) => m.createSandboxRunner()).then((r) => !cancelled && setSandbox(r)).catch((e) => !cancelled && setSandboxError(String(e?.message ?? e)));
8027
8140
  return () => {
8028
8141
  cancelled = true;
8029
8142
  };
@@ -8365,7 +8478,7 @@ function DashboardBody({
8365
8478
  const grid = doc.spec.grid;
8366
8479
  const tour = editable ? NO_STEPS : doc.spec.tour ?? NO_STEPS;
8367
8480
  const hidden = useHiddenPanels(Object.keys(doc.spec.panels));
8368
- return /* @__PURE__ */ jsxs23(Fragment11, { children: [
8481
+ return /* @__PURE__ */ jsxs23(Fragment12, { children: [
8369
8482
  !hideHeader && (head.title || head.synced || tour.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "ds-header", children: [
8370
8483
  head.title && /* @__PURE__ */ jsx31("h2", { className: "ds-title", children: head.title }),
8371
8484
  head.description && /* @__PURE__ */ jsx31("p", { className: "ds-desc", children: head.description }),
@@ -8443,55 +8556,6 @@ var token = {
8443
8556
  /** A font family: `token.font("heading")`. */
8444
8557
  font: (name) => `var(--ds-font-${name})`
8445
8558
  };
8446
-
8447
- // src/widgets/wrap.tsx
8448
- import { Suspense, lazy } from "react";
8449
- import { z as z17 } from "zod";
8450
- import { jsx as jsx32 } from "react/jsx-runtime";
8451
- function wrapComponent(Component2, o) {
8452
- const schema = o.schema ?? z17.record(z17.unknown());
8453
- const eventNames = [...new Set(Object.values(o.events ?? {}))];
8454
- return defineWidget({
8455
- kind: o.kind,
8456
- version: o.version ?? 1,
8457
- meta: o.meta,
8458
- schema,
8459
- ...o.defaults ? { defaults: o.defaults } : {},
8460
- ...o.implements ? { implements: o.implements } : {},
8461
- ...o.exposes ? { exposes: o.exposes } : {},
8462
- ...o.frame ? { frame: o.frame } : {},
8463
- ...o.small ? { small: true } : {},
8464
- events: eventNames,
8465
- ...o.slots ? { slots: Object.fromEntries(Object.values(o.slots).map((s) => [s, { label: s }])) } : {},
8466
- component: function Wrapped(props) {
8467
- const mapped = o.mapProps ? o.mapProps(props) : { ...props.spec, data: props.data };
8468
- const handlers = {};
8469
- for (const [prop, event] of Object.entries(o.events ?? {}))
8470
- handlers[prop] = (value, ...rest) => props.emit(event, void 0, { value, args: [value, ...rest] });
8471
- for (const [prop, path] of Object.entries(o.writes ?? {})) {
8472
- const before = handlers[prop];
8473
- handlers[prop] = (value, ...rest) => {
8474
- props.store.set(path, value);
8475
- before?.(value, ...rest);
8476
- };
8477
- }
8478
- const slotProps = {};
8479
- for (const [prop, slot] of Object.entries(o.slots ?? {})) slotProps[prop] = props.renderSlot(slot);
8480
- return /* @__PURE__ */ jsx32(Component2, { ...mapped, ...handlers, ...slotProps });
8481
- }
8482
- });
8483
- }
8484
- function lazyWidget(def) {
8485
- const { load, fallback, ...rest } = def;
8486
- let Comp;
8487
- return defineWidget({
8488
- ...rest,
8489
- component: function LazyWidget(props) {
8490
- Comp ??= lazy(load);
8491
- return /* @__PURE__ */ jsx32(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx32("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx32(Comp, { ...props }) });
8492
- }
8493
- });
8494
- }
8495
8559
  export {
8496
8560
  ACTION_KINDS,
8497
8561
  ACTION_SCHEMAS,