@dashspec/renderer 0.1.8 → 0.1.10

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.js CHANGED
@@ -10,6 +10,7 @@ import {
10
10
  BUILT_IN_DATASOURCE_TYPES,
11
11
  BarChartContract,
12
12
  BreakdownContract,
13
+ ButtonContract,
13
14
  Callback,
14
15
  CardContract,
15
16
  CardGridContract,
@@ -115,7 +116,7 @@ import {
115
116
  translator,
116
117
  validateDocument,
117
118
  widgetChecks
118
- } from "./chunk-CLT55JEM.js";
119
+ } from "./chunk-TAOP57T2.js";
119
120
  import {
120
121
  createStateProxy,
121
122
  getPath,
@@ -164,7 +165,7 @@ import {
164
165
  createElement,
165
166
  forwardRef,
166
167
  useCallback as useCallback8,
167
- useEffect as useEffect11,
168
+ useEffect as useEffect12,
168
169
  useImperativeHandle,
169
170
  useMemo as useMemo8,
170
171
  useRef as useRef14,
@@ -3525,16 +3526,32 @@ var ImageMap = defineWidget({
3525
3526
  import "zod";
3526
3527
 
3527
3528
  // src/widgets/shared/InfoTip.tsx
3528
- import { useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
3529
+ import { useEffect as useEffect3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState3 } from "react";
3529
3530
  import { createPortal as createPortal2 } from "react-dom";
3530
3531
  import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
3531
3532
  function InfoTip({ text }) {
3532
3533
  const ref = useRef4(null);
3533
3534
  const tip = useRef4(null);
3534
3535
  const [open, setOpen] = useState3(false);
3536
+ const [mounted, setMounted] = useState3(false);
3537
+ const closing = useRef4(void 0);
3538
+ useEffect3(() => () => clearTimeout(closing.current), []);
3539
+ const show = () => {
3540
+ clearTimeout(closing.current);
3541
+ setMounted(true);
3542
+ setOpen(true);
3543
+ };
3544
+ const hide = () => {
3545
+ setOpen(false);
3546
+ clearTimeout(closing.current);
3547
+ closing.current = setTimeout(() => {
3548
+ setMounted(false);
3549
+ setPos(null);
3550
+ }, 160);
3551
+ };
3535
3552
  const [pos, setPos] = useState3(null);
3536
3553
  useLayoutEffect2(() => {
3537
- if (!open || !ref.current || !tip.current) return;
3554
+ if (!mounted || !ref.current || !tip.current) return;
3538
3555
  const a = ref.current.getBoundingClientRect();
3539
3556
  const t = tip.current.getBoundingClientRect();
3540
3557
  const gap = 8;
@@ -3548,7 +3565,7 @@ function InfoTip({ text }) {
3548
3565
  const centre = a.left + a.width / 2;
3549
3566
  const left = Math.min(Math.max(centre - t.width / 2, minX), Math.max(minX, maxX - t.width));
3550
3567
  setPos({ left, top: below ? a.bottom + gap : a.top - t.height - gap, arrow: centre - left, below });
3551
- }, [open]);
3568
+ }, [mounted]);
3552
3569
  const root = ref.current?.closest(".ds-root") ?? (typeof document !== "undefined" ? document.body : null);
3553
3570
  return /* @__PURE__ */ jsxs8(
3554
3571
  "button",
@@ -3558,22 +3575,16 @@ function InfoTip({ text }) {
3558
3575
  className: "ds-info",
3559
3576
  "aria-label": text,
3560
3577
  onClick: (e) => e.stopPropagation(),
3561
- onMouseEnter: () => setOpen(true),
3562
- onMouseLeave: () => {
3563
- setOpen(false);
3564
- setPos(null);
3565
- },
3566
- onFocus: () => setOpen(true),
3567
- onBlur: () => {
3568
- setOpen(false);
3569
- setPos(null);
3570
- },
3578
+ onMouseEnter: show,
3579
+ onMouseLeave: hide,
3580
+ onFocus: show,
3581
+ onBlur: hide,
3571
3582
  children: [
3572
3583
  /* @__PURE__ */ jsxs8("svg", { viewBox: "0 0 16 16", width: "14", height: "14", "aria-hidden": "true", children: [
3573
3584
  /* @__PURE__ */ jsx12("circle", { cx: "8", cy: "8", r: "6.5", fill: "none", stroke: "currentColor", strokeWidth: "1" }),
3574
3585
  /* @__PURE__ */ jsx12("path", { d: "M8 7.2v3.6M8 5.2v.1", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round" })
3575
3586
  ] }),
3576
- open && root && createPortal2(
3587
+ mounted && root && createPortal2(
3577
3588
  /* @__PURE__ */ jsx12(
3578
3589
  "span",
3579
3590
  {
@@ -3581,6 +3592,7 @@ function InfoTip({ text }) {
3581
3592
  className: "ds-tip",
3582
3593
  role: "tooltip",
3583
3594
  "data-below": pos?.below || void 0,
3595
+ "data-open": open && pos ? "" : void 0,
3584
3596
  style: {
3585
3597
  left: pos?.left ?? 0,
3586
3598
  top: pos?.top ?? 0,
@@ -3601,7 +3613,7 @@ function InfoTip({ text }) {
3601
3613
  import { useContext as useContext4 } from "react";
3602
3614
 
3603
3615
  // src/components/PanelFrame.tsx
3604
- import { useCallback as useCallback4, useEffect as useEffect3, useId as useId4, useMemo as useMemo3, useRef as useRef5, useState as useState4 } from "react";
3616
+ import { useCallback as useCallback4, useEffect as useEffect4, useId as useId4, useMemo as useMemo3, useRef as useRef5, useState as useState4 } from "react";
3605
3617
 
3606
3618
  // src/widgets/parseProps.ts
3607
3619
  function without(value, path) {
@@ -4020,7 +4032,7 @@ function PanelFrameInner({ id, nested }) {
4020
4032
  const store = useMemo3(() => widgetStore(runtime), [runtime]);
4021
4033
  const [bodyRef, size2] = useSize();
4022
4034
  const frameRef = useRef5(null);
4023
- useEffect3(() => {
4035
+ useEffect4(() => {
4024
4036
  if (!view.visible || view.hidden) {
4025
4037
  visibility.set(instance, null);
4026
4038
  return;
@@ -4087,6 +4099,7 @@ function PanelFrameInner({ id, nested }) {
4087
4099
  const tone2 = def.style?.tone ?? (widget?.frame === "plain" ? "plain" : "default");
4088
4100
  const headerKids = slotChildren(def, "header");
4089
4101
  const footerKids = slotChildren(def, "footer");
4102
+ const toolbarKids = slotChildren(def, "toolbar");
4090
4103
  const hideHeader = Boolean(def.style?.hideHeader) || !title && !meta2 && !live2 && drill.length === 0 && controls.length === 0 && !view.stale && headerKids.length === 0;
4091
4104
  const dnd = Boolean(options.onDropOnPanel);
4092
4105
  let body;
@@ -4138,7 +4151,9 @@ function PanelFrameInner({ id, nested }) {
4138
4151
  const defaultSlot = widget?.slots ? Object.keys(widget.slots)[0] ?? "header" : "header";
4139
4152
  const dropTarget = (target, x, y) => {
4140
4153
  const own = `[data-slot][data-owner="${CSS.escape(id)}"]`;
4141
- const el = target?.closest(own) ?? frameRef.current?.querySelector(`${own}:not([data-slot="header"]):not([data-slot="footer"])`) ?? void 0;
4154
+ const el = target?.closest(own) ?? frameRef.current?.querySelector(
4155
+ `${own}:not([data-slot="header"]):not([data-slot="footer"]):not([data-slot="toolbar"])`
4156
+ ) ?? void 0;
4142
4157
  const name = el?.getAttribute("data-slot") ?? defaultSlot;
4143
4158
  return { slot: name, index: el ? indexIn(el, x, y) : void 0 };
4144
4159
  };
@@ -4239,6 +4254,7 @@ function PanelFrameInner({ id, nested }) {
4239
4254
  ))
4240
4255
  ] })
4241
4256
  ] }),
4257
+ toolbarKids.length > 0 && /* @__PURE__ */ jsx14(Slot, { name: "toolbar", className: "ds-panel-toolbar" }),
4242
4258
  /* @__PURE__ */ jsx14("div", { className: "ds-panel-body", ref: bodyRef, children: body }),
4243
4259
  footerKids.length > 0 && /* @__PURE__ */ jsx14(Slot, { name: "footer", className: "ds-panel-foot" })
4244
4260
  ]
@@ -4276,13 +4292,13 @@ function useClickable(panelId, activate) {
4276
4292
  }
4277
4293
 
4278
4294
  // src/widgets/shared/motion.ts
4279
- import { useEffect as useEffect4, useRef as useRef6, useState as useState5 } from "react";
4295
+ import { useEffect as useEffect5, useRef as useRef6, useState as useState5 } from "react";
4280
4296
  var reduced = () => typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
4281
4297
  var easeOut = (t) => 1 - (1 - t) ** 3;
4282
4298
  function useCountUp(target, ms = 700) {
4283
4299
  const [shown, setShown] = useState5(() => typeof target === "number" && !reduced() ? 0 : target);
4284
4300
  const from = useRef6(0);
4285
- useEffect4(() => {
4301
+ useEffect5(() => {
4286
4302
  if (typeof target !== "number" || !Number.isFinite(target) || reduced()) {
4287
4303
  setShown(target);
4288
4304
  return;
@@ -4596,8 +4612,48 @@ var Status = defineWidget({
4596
4612
  });
4597
4613
 
4598
4614
  // src/widgets/builtins/Table.tsx
4599
- import { useEffect as useEffect5, useMemo as useMemo4, useRef as useRef7, useState as useState6 } from "react";
4600
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4615
+ import { useEffect as useEffect6, useMemo as useMemo4, useRef as useRef7, useState as useState6 } from "react";
4616
+
4617
+ // src/widgets/shared/chips.tsx
4618
+ import { jsx as jsx20 } from "react/jsx-runtime";
4619
+ var TONES = /* @__PURE__ */ new Set(["good", "warn", "bad", "neutral", "info", "action", "muted"]);
4620
+ function evalOver(expr, vars, helpers) {
4621
+ try {
4622
+ return evaluate(expr, scope(vars, helpers));
4623
+ } catch {
4624
+ return void 0;
4625
+ }
4626
+ }
4627
+ function toneOf(tone2, vars, helpers) {
4628
+ if (!tone2) return void 0;
4629
+ if (TONES.has(tone2)) return tone2;
4630
+ const t = evalOver(tone2, vars, helpers);
4631
+ return typeof t === "string" ? t : void 0;
4632
+ }
4633
+ function Chips({
4634
+ chips,
4635
+ vars,
4636
+ helpers
4637
+ }) {
4638
+ if (!chips?.length) return null;
4639
+ const shown = chips.filter((c) => c.when === void 0 || Boolean(evalOver(c.when, vars, helpers))).map((c) => {
4640
+ let text = "";
4641
+ try {
4642
+ const v = interpolate(c.text, scope(vars, helpers));
4643
+ text = v === null || v === void 0 ? "" : String(v);
4644
+ } catch {
4645
+ }
4646
+ return { text, tone: toneOf(c.tone, vars, helpers) ?? "neutral" };
4647
+ }).filter((c) => c.text);
4648
+ if (shown.length === 0) return null;
4649
+ return /* @__PURE__ */ jsx20("span", { className: "ds-chips", children: shown.map((c, i) => (
4650
+ // biome-ignore lint/suspicious/noArrayIndexKey: chips come from a fixed list in the spec
4651
+ /* @__PURE__ */ jsx20("span", { className: "ds-chip", "data-tone": c.tone, children: c.text }, i)
4652
+ )) });
4653
+ }
4654
+
4655
+ // src/widgets/builtins/Table.tsx
4656
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
4601
4657
  var ROW_H = 36;
4602
4658
  function pageList(current, pages) {
4603
4659
  if (pages <= 7) return Array.from({ length: pages }, (_, i) => i + 1);
@@ -4618,7 +4674,7 @@ var Table = defineWidget({
4618
4674
  events: ["rowClick", "cellClick", "hover"],
4619
4675
  parts: ["row", "cell"],
4620
4676
  rows: (data) => asRows(data),
4621
- component: function TableWidget({ spec, data, source, emit, helpers, size: size2, state, setUi, status }) {
4677
+ component: function TableWidget({ spec, data, source, emit, helpers, size: size2, state, setUi, status, renderSlot }) {
4622
4678
  const tpl = (t, row, item) => {
4623
4679
  try {
4624
4680
  const v = interpolate(t, scope({ row, item, datum: row }, helpers));
@@ -4632,16 +4688,29 @@ var Table = defineWidget({
4632
4688
  return spec.pivot ? applyTransform(rows2, [{ pivot: spec.pivot }], scope()) : rows2;
4633
4689
  }, [data, spec.pivot]);
4634
4690
  const columns = useMemo4(() => {
4635
- if (spec.columns?.length) return spec.columns;
4636
- if (spec.columnsFrom) {
4691
+ const generated = () => {
4637
4692
  const cf = spec.columnsFrom;
4638
- return asRows(field(source, cf.path)).map((c) => ({
4639
- key: String(field(c, cf.key)),
4640
- label: String(field(c, cf.label) ?? field(c, cf.key)),
4641
- ...cf.type ? { type: cf.type } : {},
4642
- ...cf.format ? { format: cf.format } : {}
4643
- }));
4693
+ if (!cf) return [];
4694
+ return asRows(field(source, cf.path)).map((c) => {
4695
+ const key = String(field(c, cf.key));
4696
+ const label = String(field(c, cf.label) ?? field(c, cf.key));
4697
+ const fill = (v) => typeof v === "string" ? v.replaceAll("{key}", key).replaceAll("{label}", label) : Array.isArray(v) ? v.map(fill) : v && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, x]) => [k, fill(x)])) : v;
4698
+ return {
4699
+ key,
4700
+ label,
4701
+ ...cf.type ? { type: cf.type } : {},
4702
+ ...cf.format ? { format: cf.format } : {},
4703
+ ...fill(cf.column ?? {}) ?? {}
4704
+ };
4705
+ });
4706
+ };
4707
+ if (spec.columns?.length) {
4708
+ if (!spec.columnsFrom) return spec.columns;
4709
+ const gen = generated();
4710
+ const at = spec.columnsFrom.after ? spec.columns.findIndex((c) => c.key === spec.columnsFrom?.after) : -1;
4711
+ return at < 0 ? [...spec.columns, ...gen] : [...spec.columns.slice(0, at + 1), ...gen, ...spec.columns.slice(at + 1)];
4644
4712
  }
4713
+ if (spec.columnsFrom) return generated();
4645
4714
  return Object.keys(base[0] ?? {}).map((k) => ({ key: k }));
4646
4715
  }, [spec.columns, spec.columnsFrom, source, base]);
4647
4716
  const pg = spec.pagination && spec.pagination.enabled !== false ? spec.pagination : void 0;
@@ -4681,7 +4750,7 @@ var Table = defineWidget({
4681
4750
  };
4682
4751
  const [searchText, setSearchText] = useState6(view.search);
4683
4752
  const searchTimer = useRef7(void 0);
4684
- useEffect5(() => () => clearTimeout(searchTimer.current), []);
4753
+ useEffect6(() => () => clearTimeout(searchTimer.current), []);
4685
4754
  const [scrollTop, setScrollTop] = useState6(0);
4686
4755
  const scroller = useRef7(null);
4687
4756
  const sort = view.sortKey ? { key: view.sortKey, order: view.sortOrder } : void 0;
@@ -4743,7 +4812,7 @@ var Table = defineWidget({
4743
4812
  const v = field(row, c.key);
4744
4813
  if (c.type === "badge") {
4745
4814
  const text = c.template ? tpl(c.template, row) : v === null || v === void 0 || v === "" ? "" : String(v);
4746
- if (!text) return c.empty ? /* @__PURE__ */ jsx20("span", { className: "ds-cell-empty", children: c.empty }) : "";
4815
+ if (!text) return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
4747
4816
  let t = c.map?.[String(v)] ?? "neutral";
4748
4817
  if (c.tone) {
4749
4818
  try {
@@ -4753,37 +4822,37 @@ var Table = defineWidget({
4753
4822
  } catch {
4754
4823
  }
4755
4824
  }
4756
- return /* @__PURE__ */ jsx20("span", { className: "ds-chip", "data-tone": t, children: text });
4825
+ return /* @__PURE__ */ jsx21("span", { className: "ds-chip", "data-tone": t, children: text });
4757
4826
  }
4758
- if (c.template) return tpl(c.template, row) || (c.empty ? /* @__PURE__ */ jsx20("span", { className: "ds-cell-empty", children: c.empty }) : "");
4827
+ if (c.template) return tpl(c.template, row) || (c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "");
4759
4828
  if (c.list !== void 0) {
4760
4829
  const items = Array.isArray(v) ? v : [];
4761
4830
  if (items.length === 0) return c.empty ?? "";
4762
- return /* @__PURE__ */ jsx20("span", { className: "ds-cell-list", children: items.map((it, i) => (
4831
+ return /* @__PURE__ */ jsx21("span", { className: "ds-cell-list", children: items.map((it, i) => (
4763
4832
  // biome-ignore lint/suspicious/noArrayIndexKey: list items have no id and never reorder within a render
4764
- /* @__PURE__ */ jsx20("span", { children: tpl(c.list, row, it) }, i)
4833
+ /* @__PURE__ */ jsx21("span", { children: tpl(c.list, row, it) }, i)
4765
4834
  )) });
4766
4835
  }
4767
4836
  if (v === null || v === void 0 || v === "")
4768
- return c.empty ? /* @__PURE__ */ jsx20("span", { className: "ds-cell-empty", children: c.empty }) : "";
4837
+ return c.empty ? /* @__PURE__ */ jsx21("span", { className: "ds-cell-empty", children: c.empty }) : "";
4769
4838
  switch (c.type) {
4770
4839
  case "link": {
4771
4840
  const href = safeLink(c.href ? tpl(c.href, row) : String(v));
4772
- return href ? /* @__PURE__ */ jsx20("a", { className: "ds-link", href, onClick: (e) => e.stopPropagation(), children: String(v) }) : String(v);
4841
+ return href ? /* @__PURE__ */ jsx21("a", { className: "ds-link", href, onClick: (e) => e.stopPropagation(), children: String(v) }) : String(v);
4773
4842
  }
4774
4843
  case "image":
4775
- return safeImageSrc(v) ? /* @__PURE__ */ jsx20("img", { src: v, alt: "", style: { height: 28, borderRadius: 4 } }) : null;
4844
+ return safeImageSrc(v) ? /* @__PURE__ */ jsx21("img", { src: v, alt: "", style: { height: 28, borderRadius: 4 } }) : null;
4776
4845
  case "progress": {
4777
4846
  const n = toNumber(v) ?? 0;
4778
4847
  const pct = Math.min(100, n / (c.max ?? 100) * 100);
4779
4848
  return /* @__PURE__ */ jsxs16("span", { className: "ds-inline", children: [
4780
- /* @__PURE__ */ jsx20("span", { className: "ds-progress", style: { flex: 1, minWidth: 40 }, children: /* @__PURE__ */ jsx20("span", { style: { width: `${pct}%`, background: "var(--ds-series-1)" } }) }),
4849
+ /* @__PURE__ */ jsx21("span", { className: "ds-progress", style: { flex: 1, minWidth: 40 }, children: /* @__PURE__ */ jsx21("span", { style: { width: `${pct}%`, background: "var(--ds-series-1)" } }) }),
4781
4850
  formatValue(n, helpers, c.format, c.decimals),
4782
4851
  c.suffix
4783
4852
  ] });
4784
4853
  }
4785
4854
  case "sparkline":
4786
- return /* @__PURE__ */ jsx20(
4855
+ return /* @__PURE__ */ jsx21(
4787
4856
  SparkSvg,
4788
4857
  {
4789
4858
  values: (Array.isArray(v) ? v : []).map(
@@ -4797,6 +4866,22 @@ var Table = defineWidget({
4797
4866
  return `${c.prefix ?? ""}${typeof v === "number" || c.format ? formatValue(v, helpers, c.format, c.decimals) : String(v)}${c.suffix ?? ""}`;
4798
4867
  }
4799
4868
  };
4869
+ const WEIGHT = { regular: 400, medium: 500, semibold: 600, bold: 700 };
4870
+ const decorated = (c, row) => {
4871
+ const content = cell(c, row);
4872
+ if (!c.sub && !c.chips && !c.weight && !c.valueTone) return content;
4873
+ const vars = { row, value: field(row, c.key) };
4874
+ const t = toneOf(c.valueTone, vars, helpers);
4875
+ const color2 = t === "action" ? "var(--ds-color-action-primary)" : t === "muted" ? "var(--ds-color-text-disabled)" : t ? `var(--ds-color-status-${t}-fg)` : void 0;
4876
+ const sub = c.sub ? tpl(c.sub, row) : "";
4877
+ return /* @__PURE__ */ jsxs16("span", { className: "ds-cell", children: [
4878
+ /* @__PURE__ */ jsx21("span", { className: "ds-cell-value", style: { fontWeight: c.weight ? WEIGHT[c.weight] : void 0, color: color2 }, children: content }),
4879
+ sub && /* @__PURE__ */ jsx21("span", { className: "ds-cell-sub", children: sub }),
4880
+ /* @__PURE__ */ jsx21(Chips, { chips: c.chips, vars, helpers })
4881
+ ] });
4882
+ };
4883
+ const totalsRow = spec.totalsRow ? field(source, spec.totalsRow.path) : void 0;
4884
+ const expandedKey = spec.expand ? ui.expanded : void 0;
4800
4885
  const total = (c) => {
4801
4886
  const how = spec.totals?.columns[c.key];
4802
4887
  if (!how) return null;
@@ -4818,10 +4903,10 @@ var Table = defineWidget({
4818
4903
  sr && /* @__PURE__ */ jsxs16("div", { className: "ds-table-tools", children: [
4819
4904
  /* @__PURE__ */ jsxs16("label", { className: "ds-search", children: [
4820
4905
  /* @__PURE__ */ jsxs16("svg", { viewBox: "0 0 16 16", width: "15", height: "15", "aria-hidden": "true", children: [
4821
- /* @__PURE__ */ jsx20("circle", { cx: "7", cy: "7", r: "4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
4822
- /* @__PURE__ */ jsx20("path", { d: "m10.5 10.5 3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
4906
+ /* @__PURE__ */ jsx21("circle", { cx: "7", cy: "7", r: "4.5", fill: "none", stroke: "currentColor", strokeWidth: "1.5" }),
4907
+ /* @__PURE__ */ jsx21("path", { d: "m10.5 10.5 3 3", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
4823
4908
  ] }),
4824
- /* @__PURE__ */ jsx20(
4909
+ /* @__PURE__ */ jsx21(
4825
4910
  "input",
4826
4911
  {
4827
4912
  type: "search",
@@ -4851,12 +4936,12 @@ var Table = defineWidget({
4851
4936
  style: { maxHeight: height },
4852
4937
  onScroll: windowed ? (e) => setScrollTop(e.currentTarget.scrollTop) : void 0,
4853
4938
  children: [
4854
- busy && /* @__PURE__ */ jsx20("div", { className: "ds-table-busy", "aria-hidden": "true" }),
4939
+ busy && /* @__PURE__ */ jsx21("div", { className: "ds-table-busy", "aria-hidden": "true" }),
4855
4940
  /* @__PURE__ */ jsxs16("table", { className: "ds-table", "aria-busy": busy || void 0, children: [
4856
4941
  /* @__PURE__ */ jsxs16("thead", { "data-sticky": spec.sticky || void 0, children: [
4857
- /* @__PURE__ */ jsx20("tr", { children: columns.map((c, i) => {
4942
+ /* @__PURE__ */ jsx21("tr", { children: columns.map((c, i) => {
4858
4943
  const sorted = sort?.key === c.key ? sort.order : void 0;
4859
- return /* @__PURE__ */ jsx20(
4944
+ return /* @__PURE__ */ jsx21(
4860
4945
  "th",
4861
4946
  {
4862
4947
  "data-ds-part": `column:${i}`,
@@ -4871,7 +4956,7 @@ var Table = defineWidget({
4871
4956
  ),
4872
4957
  children: [
4873
4958
  c.label ?? c.key,
4874
- /* @__PURE__ */ jsx20("span", { className: "ds-sort", "data-dir": sorted, "aria-hidden": "true" })
4959
+ /* @__PURE__ */ jsx21("span", { className: "ds-sort", "data-dir": sorted, "aria-hidden": "true" })
4875
4960
  ]
4876
4961
  }
4877
4962
  )
@@ -4879,7 +4964,7 @@ var Table = defineWidget({
4879
4964
  `${c.key}-${i}`
4880
4965
  );
4881
4966
  }) }),
4882
- hasFilters && /* @__PURE__ */ jsx20("tr", { className: "ds-filter-row", children: columns.map((c, i) => /* @__PURE__ */ jsx20("th", { children: c.filter === "select" ? /* @__PURE__ */ jsx20(
4967
+ hasFilters && /* @__PURE__ */ jsx21("tr", { className: "ds-filter-row", children: columns.map((c, i) => /* @__PURE__ */ jsx21("th", { children: c.filter === "select" ? /* @__PURE__ */ jsx21(
4883
4968
  SelectControl,
4884
4969
  {
4885
4970
  size: "sm",
@@ -4893,7 +4978,7 @@ var Table = defineWidget({
4893
4978
  value: view.filters[c.key] ?? "",
4894
4979
  onChange: (v) => update({ filters: { ...view.filters, [c.key]: String(v ?? "") }, page: 1 })
4895
4980
  }
4896
- ) : c.filter ? /* @__PURE__ */ jsx20(
4981
+ ) : c.filter ? /* @__PURE__ */ jsx21(
4897
4982
  "input",
4898
4983
  {
4899
4984
  className: "ds-cell-filter",
@@ -4906,37 +4991,54 @@ var Table = defineWidget({
4906
4991
  ) : null }, `f-${c.key}-${i}`)) })
4907
4992
  ] }),
4908
4993
  /* @__PURE__ */ jsxs16("tbody", { children: [
4909
- windowed && first > 0 && /* @__PURE__ */ jsx20("tr", { className: "ds-spacer", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, style: { height: first * ROW_H, padding: 0 } }) }),
4994
+ windowed && first > 0 && /* @__PURE__ */ jsx21("tr", { className: "ds-spacer", children: /* @__PURE__ */ jsx21("td", { colSpan: columns.length, style: { height: first * ROW_H, padding: 0 } }) }),
4910
4995
  shown.slice(first, last).map((row, k) => {
4911
4996
  const i = first + k;
4912
4997
  const key = spec.rowKey ? String(field(row, spec.rowKey)) : String(i);
4913
- return /* @__PURE__ */ jsx20(
4914
- "tr",
4915
- {
4916
- "data-muted": muted(row) || void 0,
4917
- onClick: () => emit("rowClick", "row", { datum: row, index: i }),
4918
- onMouseEnter: () => emit("hover", "row", { datum: row, index: i }),
4919
- tabIndex: 0,
4920
- onKeyDown: (e) => e.key === "Enter" && emit("rowClick", "row", { datum: row, index: i }),
4921
- children: columns.map((c, j) => (
4922
- // biome-ignore lint/a11y/useKeyWithClickEvents: rows are focusable and open with Enter; cell clicks add detail for pointer users
4923
- /* @__PURE__ */ jsx20(
4924
- "td",
4925
- {
4926
- style: { textAlign: align(c) },
4927
- onClick: () => emit("cellClick", "cell", { datum: row, index: i, value: field(row, c.key), column: c.key }),
4928
- children: cell(c, row)
4929
- },
4930
- `${c.key}-${j}`
4931
- )
4932
- ))
4933
- },
4934
- key
4935
- );
4998
+ const open = expandedKey !== void 0 && expandedKey === key;
4999
+ const toggle = () => {
5000
+ if (spec.expand) setUi({ expanded: open ? void 0 : key, expandedRow: open ? void 0 : row });
5001
+ };
5002
+ return [
5003
+ /* @__PURE__ */ jsx21(
5004
+ "tr",
5005
+ {
5006
+ "data-muted": muted(row) || void 0,
5007
+ "data-expanded": open || void 0,
5008
+ "aria-expanded": spec.expand ? open : void 0,
5009
+ onClick: () => {
5010
+ toggle();
5011
+ emit("rowClick", "row", { datum: row, index: i });
5012
+ },
5013
+ onMouseEnter: () => emit("hover", "row", { datum: row, index: i }),
5014
+ tabIndex: 0,
5015
+ onKeyDown: (e) => {
5016
+ if (e.key !== "Enter") return;
5017
+ toggle();
5018
+ emit("rowClick", "row", { datum: row, index: i });
5019
+ },
5020
+ children: columns.map((c, j) => (
5021
+ // biome-ignore lint/a11y/useKeyWithClickEvents: rows are focusable and open with Enter; cell clicks add detail for pointer users
5022
+ /* @__PURE__ */ jsx21(
5023
+ "td",
5024
+ {
5025
+ style: { textAlign: align(c) },
5026
+ onClick: () => emit("cellClick", "cell", { datum: row, index: i, value: field(row, c.key), column: c.key }),
5027
+ children: decorated(c, row)
5028
+ },
5029
+ `${c.key}-${j}`
5030
+ )
5031
+ ))
5032
+ },
5033
+ key
5034
+ ),
5035
+ open ? /* @__PURE__ */ jsx21("tr", { className: "ds-row-detail", children: /* @__PURE__ */ jsx21("td", { colSpan: columns.length, children: renderSlot("detail", { item: row, data: row }) }) }, `${key}-detail`) : null
5036
+ ];
4936
5037
  }),
4937
- windowed && last < shown.length && /* @__PURE__ */ jsx20("tr", { className: "ds-spacer", children: /* @__PURE__ */ jsx20("td", { colSpan: columns.length, style: { height: (shown.length - last) * ROW_H, padding: 0 } }) })
5038
+ windowed && last < shown.length && /* @__PURE__ */ jsx21("tr", { className: "ds-spacer", children: /* @__PURE__ */ jsx21("td", { colSpan: columns.length, style: { height: (shown.length - last) * ROW_H, padding: 0 } }) })
4938
5039
  ] }),
4939
- spec.totals && /* @__PURE__ */ jsx20("tfoot", { children: /* @__PURE__ */ jsx20("tr", { children: columns.map((c, j) => /* @__PURE__ */ jsx20("td", { style: { textAlign: align(c) }, children: j === 0 && !spec.totals?.columns[c.key] ? spec.totals?.label : total(c) }, `${c.key}-${j}`)) }) })
5040
+ totalsRow && !spec.totals && /* @__PURE__ */ jsx21("tfoot", { children: /* @__PURE__ */ jsx21("tr", { children: columns.map((c, j) => /* @__PURE__ */ jsx21("td", { style: { textAlign: align(c) }, children: j === 0 && spec.totalsRow?.label ? tpl(spec.totalsRow.label, totalsRow) : decorated(c, totalsRow) }, `${c.key}-${j}`)) }) }),
5041
+ spec.totals && /* @__PURE__ */ jsx21("tfoot", { children: /* @__PURE__ */ jsx21("tr", { children: columns.map((c, j) => /* @__PURE__ */ jsx21("td", { style: { textAlign: align(c) }, children: j === 0 && !spec.totals?.columns[c.key] ? spec.totals?.label : total(c) }, `${c.key}-${j}`)) }) })
4940
5042
  ] })
4941
5043
  ]
4942
5044
  }
@@ -4944,7 +5046,7 @@ var Table = defineWidget({
4944
5046
  pageSize && /* @__PURE__ */ jsxs16("div", { className: "ds-pager", children: [
4945
5047
  /* @__PURE__ */ jsxs16("span", { className: "ds-pager-size", children: [
4946
5048
  "Rows",
4947
- /* @__PURE__ */ jsx20(
5049
+ /* @__PURE__ */ jsx21(
4948
5050
  SelectControl,
4949
5051
  {
4950
5052
  size: "sm",
@@ -4965,7 +5067,7 @@ var Table = defineWidget({
4965
5067
  helpers.fmt.number(rowTotal)
4966
5068
  ] }),
4967
5069
  /* @__PURE__ */ jsxs16("span", { className: "ds-pages", children: [
4968
- /* @__PURE__ */ jsx20(
5070
+ /* @__PURE__ */ jsx21(
4969
5071
  "button",
4970
5072
  {
4971
5073
  type: "button",
@@ -4976,7 +5078,7 @@ var Table = defineWidget({
4976
5078
  }
4977
5079
  ),
4978
5080
  pageList(current, pages).map(
4979
- (n, i) => n === 0 ? /* @__PURE__ */ jsx20("span", { className: "ds-page-gap", children: "\u2026" }, `gap-${i < 3 ? "a" : "b"}`) : /* @__PURE__ */ jsx20(
5081
+ (n, i) => n === 0 ? /* @__PURE__ */ jsx21("span", { className: "ds-page-gap", children: "\u2026" }, `gap-${i < 3 ? "a" : "b"}`) : /* @__PURE__ */ jsx21(
4980
5082
  "button",
4981
5083
  {
4982
5084
  type: "button",
@@ -4987,7 +5089,7 @@ var Table = defineWidget({
4987
5089
  n
4988
5090
  )
4989
5091
  ),
4990
- /* @__PURE__ */ jsx20(
5092
+ /* @__PURE__ */ jsx21(
4991
5093
  "button",
4992
5094
  {
4993
5095
  type: "button",
@@ -5005,7 +5107,7 @@ var Table = defineWidget({
5005
5107
 
5006
5108
  // src/widgets/builtins/Tiles.tsx
5007
5109
  import "zod";
5008
- import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
5110
+ import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
5009
5111
  var Tiles = defineWidget({
5010
5112
  ...TilesContract,
5011
5113
  implements: "tiles",
@@ -5024,7 +5126,7 @@ var Tiles = defineWidget({
5024
5126
  return spec.caption;
5025
5127
  }
5026
5128
  };
5027
- return /* @__PURE__ */ jsx21(
5129
+ return /* @__PURE__ */ jsx22(
5028
5130
  "div",
5029
5131
  {
5030
5132
  className: "ds-tiles",
@@ -5037,12 +5139,15 @@ var Tiles = defineWidget({
5037
5139
  },
5038
5140
  children: rows.map((r, i) => {
5039
5141
  const label = field(r, spec.label);
5040
- const v = field(r, spec.value);
5142
+ const v = spec.value.includes("${") ? tplValue(spec.value, r, helpers) : field(r, spec.value);
5041
5143
  const n = toNumber(v);
5042
5144
  const status = spec.status ? String(field(r, spec.status)) : void 0;
5043
5145
  const st = status ? spec.statusMap?.[status] ?? status : void 0;
5044
5146
  const vt = n === void 0 || !spec.valueTone ? void 0 : n > 0 ? spec.valueTone.positive : n < 0 ? spec.valueTone.negative : spec.valueTone.zero;
5045
5147
  const active = spec.selectable && spec.selected !== void 0 && spec.selected === label;
5148
+ const vars = { row: r, value: v };
5149
+ const mutedTile = spec.mutedWhen ? Boolean(evalOver(spec.mutedWhen, vars, helpers)) : false;
5150
+ const lit = spec.highlightWhen ? Boolean(evalOver(spec.highlightWhen, vars, helpers)) : false;
5046
5151
  return /* @__PURE__ */ jsxs17(
5047
5152
  "button",
5048
5153
  {
@@ -5051,6 +5156,8 @@ var Tiles = defineWidget({
5051
5156
  role: spec.selectable ? "radio" : "listitem",
5052
5157
  "aria-checked": spec.selectable ? active : void 0,
5053
5158
  "data-active": active || void 0,
5159
+ "data-muted": mutedTile || void 0,
5160
+ "data-highlight": lit ? spec.highlightTone ?? "warn" : void 0,
5054
5161
  onClick: () => {
5055
5162
  emit("click", "tile", { datum: r, value: label, index: i });
5056
5163
  if (spec.selectable) emit("select", "tile", { datum: r, value: label, index: i });
@@ -5058,9 +5165,9 @@ var Tiles = defineWidget({
5058
5165
  onMouseEnter: () => emit("hover", "tile", { datum: r, value: label, index: i }),
5059
5166
  children: [
5060
5167
  /* @__PURE__ */ jsxs17("span", { className: "ds-tile-label", children: [
5061
- st && /* @__PURE__ */ jsx21("span", { className: "ds-dot", style: { background: tone(st).solid }, "aria-hidden": "true" }),
5168
+ st && /* @__PURE__ */ jsx22("span", { className: "ds-dot", style: { background: tone(st).solid }, "aria-hidden": "true" }),
5062
5169
  String(label ?? ""),
5063
- spec.count && /* @__PURE__ */ jsx21("span", { className: "ds-chip-count", children: String(field(r, spec.count) ?? "") })
5170
+ spec.count && /* @__PURE__ */ jsx22("span", { className: "ds-chip-count", children: String(field(r, spec.count) ?? "") })
5064
5171
  ] }),
5065
5172
  /* @__PURE__ */ jsxs17(
5066
5173
  "span",
@@ -5068,12 +5175,13 @@ var Tiles = defineWidget({
5068
5175
  className: "ds-tile-value",
5069
5176
  style: vt ? { color: vt === "muted" ? "var(--ds-color-text-disabled)" : tone(vt).fg } : void 0,
5070
5177
  children: [
5071
- /* @__PURE__ */ jsx21(CountUp, { value: v, render: (x) => formatValue(x, helpers, spec.format, spec.decimals) }),
5072
- spec.unit && /* @__PURE__ */ jsx21("span", { className: "ds-kpi-unit", children: spec.unit })
5178
+ /* @__PURE__ */ jsx22(CountUp, { value: v, render: (x) => formatValue(x, helpers, spec.format, spec.decimals) }),
5179
+ spec.unit && /* @__PURE__ */ jsx22("span", { className: "ds-kpi-unit", children: spec.unit })
5073
5180
  ]
5074
5181
  }
5075
5182
  ),
5076
- spec.caption && /* @__PURE__ */ jsx21("span", { className: "ds-tile-caption", children: caption(r) })
5183
+ spec.caption && /* @__PURE__ */ jsx22("span", { className: "ds-tile-caption", children: caption(r) }),
5184
+ /* @__PURE__ */ jsx22(Chips, { chips: spec.chips, vars, helpers })
5077
5185
  ]
5078
5186
  },
5079
5187
  `${String(label)}-${i}`
@@ -5086,12 +5194,19 @@ var Tiles = defineWidget({
5086
5194
  function CountUp({ value, render }) {
5087
5195
  const n = toNumber(value);
5088
5196
  const shown = useCountUp(n ?? value);
5089
- return /* @__PURE__ */ jsx21(Fragment6, { children: render(n === void 0 ? value : shown) });
5197
+ return /* @__PURE__ */ jsx22(Fragment6, { children: render(n === void 0 ? value : shown) });
5198
+ }
5199
+ function tplValue(t, row, helpers) {
5200
+ try {
5201
+ return interpolate(t, scope({ row }, helpers));
5202
+ } catch {
5203
+ return void 0;
5204
+ }
5090
5205
  }
5091
5206
 
5092
5207
  // src/widgets/builtins/atoms.tsx
5093
5208
  import "zod";
5094
- import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5209
+ import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
5095
5210
  var color = (t) => t === "subtle" ? "var(--ds-color-text-subtle)" : t === "primary" ? "var(--ds-color-action-primary)" : t && t !== "default" ? tone(t).fg : void 0;
5096
5211
  var boundValue = (data, path) => {
5097
5212
  if (path) return field(Array.isArray(data) ? data[0] : data, path);
@@ -5109,7 +5224,7 @@ var Text = defineWidget({
5109
5224
  const v = boundValue(data, spec.field);
5110
5225
  const click = useClickable(panelId, () => emit("click", "text", { value: v }));
5111
5226
  const shown = spec.text.includes("{value}") && (v === void 0 || v === null || v === "") ? spec.emptyText ?? spec.text.replace("{value}", "\u2013") : spec.text.replace("{value}", v === void 0 ? "" : formatValue(v, helpers, "text"));
5112
- return /* @__PURE__ */ jsx22(
5227
+ return /* @__PURE__ */ jsx23(
5113
5228
  "span",
5114
5229
  {
5115
5230
  className: "ds-atom-text",
@@ -5140,7 +5255,7 @@ var Value = defineWidget({
5140
5255
  return /* @__PURE__ */ jsxs18("span", { className: "ds-atom-value", "data-size": spec.size, style: { color: c }, ...click, children: [
5141
5256
  spec.prefix,
5142
5257
  formatValue(shown, helpers, spec.format, spec.decimals),
5143
- spec.unit && /* @__PURE__ */ jsx22("small", { children: spec.unit })
5258
+ spec.unit && /* @__PURE__ */ jsx23("small", { children: spec.unit })
5144
5259
  ] });
5145
5260
  }
5146
5261
  });
@@ -5156,7 +5271,7 @@ var Progress = defineWidget({
5156
5271
  const pct = max > 0 ? Math.max(0, Math.min(100, n / max * 100)) : 0;
5157
5272
  const fill = spec.color === "primary" ? "var(--ds-color-action-primary)" : spec.color === "byTarget" ? tone(pct >= spec.goodFrom ? "good" : "bad").solid : tone(spec.color).solid;
5158
5273
  return /* @__PURE__ */ jsxs18("div", { className: "ds-atom-progress", children: [
5159
- /* @__PURE__ */ jsx22(
5274
+ /* @__PURE__ */ jsx23(
5160
5275
  "span",
5161
5276
  {
5162
5277
  role: "progressbar",
@@ -5164,7 +5279,7 @@ var Progress = defineWidget({
5164
5279
  "aria-valuemin": 0,
5165
5280
  "aria-valuemax": 100,
5166
5281
  style: { height: spec.thickness },
5167
- children: /* @__PURE__ */ jsx22("span", { style: { width: `${pct}%`, background: fill } })
5282
+ children: /* @__PURE__ */ jsx23("span", { style: { width: `${pct}%`, background: fill } })
5168
5283
  }
5169
5284
  ),
5170
5285
  spec.showPercent && /* @__PURE__ */ jsxs18("small", { children: [
@@ -5184,7 +5299,7 @@ var Icon = defineWidget({
5184
5299
  const click = useClickable(panelId, () => emit("click", "icon", {}));
5185
5300
  const c = color(spec.color) ?? "var(--ds-color-text-primary)";
5186
5301
  const style = spec.background ? { color: c, background: `color-mix(in srgb, ${c} 12%, transparent)`, padding: spec.size / 4 } : { color: c };
5187
- return /* @__PURE__ */ jsx22("span", { className: "ds-atom-icon", style, ...click, children: /* @__PURE__ */ jsx22(
5302
+ return /* @__PURE__ */ jsx23("span", { className: "ds-atom-icon", style, ...click, children: /* @__PURE__ */ jsx23(
5188
5303
  "svg",
5189
5304
  {
5190
5305
  viewBox: "0 0 24 24",
@@ -5196,7 +5311,7 @@ var Icon = defineWidget({
5196
5311
  strokeLinecap: "round",
5197
5312
  strokeLinejoin: "round",
5198
5313
  "aria-hidden": "true",
5199
- children: /* @__PURE__ */ jsx22("path", { d: ICONS[spec.icon] ?? ICONS.bolt })
5314
+ children: /* @__PURE__ */ jsx23("path", { d: ICONS[spec.icon] ?? ICONS.bolt })
5200
5315
  }
5201
5316
  ) });
5202
5317
  }
@@ -5208,7 +5323,52 @@ var Divider = defineWidget({
5208
5323
  meta: meta("Divider", 4, 1),
5209
5324
  events: [],
5210
5325
  component: function DividerAtom({ spec }) {
5211
- return /* @__PURE__ */ jsx22("hr", { className: "ds-atom-divider", "data-dir": spec.direction, "data-dashed": spec.dashed || void 0 });
5326
+ return /* @__PURE__ */ jsx23("hr", { className: "ds-atom-divider", "data-dir": spec.direction, "data-dashed": spec.dashed || void 0 });
5327
+ }
5328
+ });
5329
+ var Button = defineWidget({
5330
+ ...ButtonContract,
5331
+ implements: "button",
5332
+ frame: "plain",
5333
+ meta: meta("Button", 2, 1),
5334
+ events: ["click"],
5335
+ component: function ButtonAtom({ spec, emit }) {
5336
+ const icon2 = spec.icon ? /* @__PURE__ */ jsx23(
5337
+ "svg",
5338
+ {
5339
+ viewBox: "0 0 24 24",
5340
+ width: spec.size === "sm" ? 14 : 16,
5341
+ height: spec.size === "sm" ? 14 : 16,
5342
+ fill: "none",
5343
+ stroke: "currentColor",
5344
+ strokeWidth: "2",
5345
+ strokeLinecap: "round",
5346
+ strokeLinejoin: "round",
5347
+ "aria-hidden": "true",
5348
+ children: /* @__PURE__ */ jsx23("path", { d: ICONS[spec.icon] ?? "" })
5349
+ }
5350
+ ) : null;
5351
+ return /* @__PURE__ */ jsxs18(
5352
+ "button",
5353
+ {
5354
+ type: "button",
5355
+ className: "ds-button",
5356
+ "data-variant": spec.variant,
5357
+ "data-size": spec.size,
5358
+ "data-icon-only": !spec.label || void 0,
5359
+ disabled: spec.disabled,
5360
+ "aria-label": spec.ariaLabel ?? spec.label,
5361
+ onClick: (e) => {
5362
+ e.stopPropagation();
5363
+ emit("click", "button", {});
5364
+ },
5365
+ children: [
5366
+ !spec.iconAfter && icon2,
5367
+ spec.label,
5368
+ spec.iconAfter && icon2
5369
+ ]
5370
+ }
5371
+ );
5212
5372
  }
5213
5373
  });
5214
5374
 
@@ -5229,7 +5389,7 @@ import {
5229
5389
  } from "echarts/components";
5230
5390
  import * as echarts from "echarts/core";
5231
5391
  import { CanvasRenderer } from "echarts/renderers";
5232
- import { useEffect as useEffect6, useMemo as useMemo5, useRef as useRef8 } from "react";
5392
+ import { useEffect as useEffect7, useMemo as useMemo5, useRef as useRef8 } from "react";
5233
5393
 
5234
5394
  // src/theme/echartsTheme.ts
5235
5395
  function echartsTheme(theme, mode) {
@@ -5274,7 +5434,7 @@ function echartsTheme(theme, mode) {
5274
5434
  }
5275
5435
 
5276
5436
  // src/widgets/shared/EChart.tsx
5277
- import { jsx as jsx23 } from "react/jsx-runtime";
5437
+ import { jsx as jsx24 } from "react/jsx-runtime";
5278
5438
  echarts.use([
5279
5439
  BarChart,
5280
5440
  LineChart,
@@ -5309,7 +5469,7 @@ function EChart({
5309
5469
  const theme = useMemo5(() => tokens ? echartsTheme(tokens.theme, tokens.mode) : void 0, [tokens]);
5310
5470
  const handlers = useRef8({ emit, rows });
5311
5471
  handlers.current = { emit, rows };
5312
- useEffect6(() => {
5472
+ useEffect7(() => {
5313
5473
  if (!el.current) return;
5314
5474
  const c = echarts.init(el.current, theme, { renderer: "canvas" });
5315
5475
  chart.current = c;
@@ -5348,7 +5508,7 @@ function EChart({
5348
5508
  chart.current = null;
5349
5509
  };
5350
5510
  }, [theme, part]);
5351
- useEffect6(() => {
5511
+ useEffect7(() => {
5352
5512
  const c = chart.current;
5353
5513
  if (!c) return;
5354
5514
  const reduce = typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
@@ -5366,16 +5526,16 @@ function EChart({
5366
5526
  }
5367
5527
  c.setOption(merged, { notMerge: true, lazyUpdate: true });
5368
5528
  }, [option, extra, hiddenSeries, theme, part]);
5369
- useEffect6(() => {
5529
+ useEffect7(() => {
5370
5530
  chart.current?.resize();
5371
5531
  });
5372
- useEffect6(() => {
5532
+ useEffect7(() => {
5373
5533
  const c = chart.current;
5374
5534
  if (!c) return;
5375
5535
  if (highlightIndex === void 0 || highlightIndex < 0) c.dispatchAction({ type: "hideTip" });
5376
5536
  else c.dispatchAction({ type: "showTip", seriesIndex: 0, dataIndex: highlightIndex });
5377
5537
  }, [highlightIndex, theme, part]);
5378
- return /* @__PURE__ */ jsx23("div", { ref: el, role: "img", "aria-label": ariaLabel, style: { width: "100%", height: Math.max(80, height) } });
5538
+ return /* @__PURE__ */ jsx24("div", { ref: el, role: "img", "aria-label": ariaLabel, style: { width: "100%", height: Math.max(80, height) } });
5379
5539
  }
5380
5540
 
5381
5541
  // src/widgets/shared/cartesian.ts
@@ -5579,7 +5739,7 @@ function cartesian(data, source, spec, type, h, colors) {
5579
5739
  }
5580
5740
 
5581
5741
  // src/widgets/builtins/charts.tsx
5582
- import { Fragment as Fragment7, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
5742
+ import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
5583
5743
  var chartEvents = ["click", "doubleClick", "hover", "hoverEnd", "legendClick", "brush", "datazoom"];
5584
5744
  var BarChart2 = defineWidget({
5585
5745
  ...BarChartContract,
@@ -5611,20 +5771,20 @@ var BarChart2 = defineWidget({
5611
5771
  legend && /* @__PURE__ */ jsxs19("ul", { className: "ds-chart-legend", children: [
5612
5772
  c.coloured && /* @__PURE__ */ jsxs19(Fragment7, { children: [
5613
5773
  /* @__PURE__ */ jsxs19("li", { children: [
5614
- /* @__PURE__ */ jsx24("span", { className: "ds-swatch", style: { background: colors?.good } }),
5774
+ /* @__PURE__ */ jsx25("span", { className: "ds-swatch", style: { background: colors?.good } }),
5615
5775
  spec.legendLabels?.above ?? "At or above avg"
5616
5776
  ] }),
5617
5777
  /* @__PURE__ */ jsxs19("li", { children: [
5618
- /* @__PURE__ */ jsx24("span", { className: "ds-swatch", style: { background: colors?.bad } }),
5778
+ /* @__PURE__ */ jsx25("span", { className: "ds-swatch", style: { background: colors?.bad } }),
5619
5779
  spec.legendLabels?.below ?? "Below avg"
5620
5780
  ] })
5621
5781
  ] }),
5622
5782
  avgText && /* @__PURE__ */ jsxs19("li", { children: [
5623
- /* @__PURE__ */ jsx24("span", { className: "ds-swatch-line" }),
5783
+ /* @__PURE__ */ jsx25("span", { className: "ds-swatch-line" }),
5624
5784
  avgText
5625
5785
  ] })
5626
5786
  ] }),
5627
- /* @__PURE__ */ jsx24(
5787
+ /* @__PURE__ */ jsx25(
5628
5788
  EChart,
5629
5789
  {
5630
5790
  option: c.option,
@@ -5652,7 +5812,7 @@ var LineChart2 = defineWidget({
5652
5812
  component: function LineChartWidget({ spec, data, source, emit, helpers, size: size2, state, highlight }) {
5653
5813
  const c = useMemo6(() => cartesian(data, source, spec, "line", helpers), [data, source, spec, helpers]);
5654
5814
  const hi = highlight === void 0 || highlight === null ? void 0 : c.categories.indexOf(String(highlight));
5655
- return /* @__PURE__ */ jsx24(
5815
+ return /* @__PURE__ */ jsx25(
5656
5816
  EChart,
5657
5817
  {
5658
5818
  option: c.option,
@@ -5701,7 +5861,7 @@ var PieChart2 = defineWidget({
5701
5861
  }),
5702
5862
  [rows, spec, helpers]
5703
5863
  );
5704
- return /* @__PURE__ */ jsx24(
5864
+ return /* @__PURE__ */ jsx25(
5705
5865
  EChart,
5706
5866
  {
5707
5867
  option,
@@ -5746,7 +5906,7 @@ var Scatter = defineWidget({
5746
5906
  }))
5747
5907
  };
5748
5908
  }, [rows, spec]);
5749
- return /* @__PURE__ */ jsx24(
5909
+ return /* @__PURE__ */ jsx25(
5750
5910
  EChart,
5751
5911
  {
5752
5912
  option,
@@ -5807,7 +5967,7 @@ var Gauge = defineWidget({
5807
5967
  ]
5808
5968
  };
5809
5969
  }, [value, spec, helpers, tokens]);
5810
- return /* @__PURE__ */ jsx24(
5970
+ return /* @__PURE__ */ jsx25(
5811
5971
  EChart,
5812
5972
  {
5813
5973
  option,
@@ -5866,7 +6026,7 @@ var MatrixChart = defineWidget({
5866
6026
  }
5867
6027
  };
5868
6028
  }, [rows, spec, helpers]);
5869
- return /* @__PURE__ */ jsx24(
6029
+ return /* @__PURE__ */ jsx25(
5870
6030
  EChart,
5871
6031
  {
5872
6032
  option,
@@ -5887,7 +6047,7 @@ var MatrixChart = defineWidget({
5887
6047
  // src/widgets/builtins/layout.tsx
5888
6048
  import { Fragment as Fragment8 } from "react";
5889
6049
  import "zod";
5890
- import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
6050
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
5891
6051
  var Row = defineWidget({
5892
6052
  ...Container,
5893
6053
  ...RowContract,
@@ -5912,7 +6072,7 @@ var Card = defineWidget({
5912
6072
  return renderSlot("body", {
5913
6073
  className: "ds-card-body",
5914
6074
  style: { display: "flex", flexDirection: spec.direction, gap: spec.gap, alignItems: align },
5915
- empty: /* @__PURE__ */ jsx25("span", { className: "ds-slot-hint", children: "Drop a label, a value, a badge\u2026" })
6075
+ empty: /* @__PURE__ */ jsx26("span", { className: "ds-slot-hint", children: "Drop a label, a value, a badge\u2026" })
5916
6076
  });
5917
6077
  }
5918
6078
  });
@@ -5925,7 +6085,7 @@ var Tabs = defineWidget({
5925
6085
  component: function TabsWidget({ spec, state, setUi, emit, renderSlot }) {
5926
6086
  const open = String(state.ui?.tab ?? spec.initial ?? spec.tabs[0]?.key);
5927
6087
  return /* @__PURE__ */ jsxs20("div", { className: "ds-tabs", children: [
5928
- /* @__PURE__ */ jsx25("div", { className: "ds-tabs-bar", role: "tablist", children: spec.tabs.map((t) => /* @__PURE__ */ jsx25(
6088
+ /* @__PURE__ */ jsx26("div", { className: "ds-tabs-bar", role: "tablist", children: spec.tabs.map((t) => /* @__PURE__ */ jsx26(
5929
6089
  "button",
5930
6090
  {
5931
6091
  type: "button",
@@ -5941,7 +6101,7 @@ var Tabs = defineWidget({
5941
6101
  )) }),
5942
6102
  renderSlot(open, {
5943
6103
  className: "ds-tabs-panel",
5944
- empty: /* @__PURE__ */ jsx25("span", { className: "ds-slot-hint", children: "Drop widgets into this tab" })
6104
+ empty: /* @__PURE__ */ jsx26("span", { className: "ds-slot-hint", children: "Drop widgets into this tab" })
5945
6105
  })
5946
6106
  ] });
5947
6107
  }
@@ -5960,14 +6120,14 @@ var Repeater = defineWidget({
5960
6120
  gridTemplateColumns: `repeat(auto-fill, minmax(${spec.minItemWidth}px, 1fr))`
5961
6121
  } : { display: "flex", flexDirection: "column", gap: spec.gap };
5962
6122
  if (rows.length === 0)
5963
- return mode === "edit" ? /* @__PURE__ */ jsx25("div", { className: "ds-repeater", children: renderSlot("item", {
6123
+ return mode === "edit" ? /* @__PURE__ */ jsx26("div", { className: "ds-repeater", children: renderSlot("item", {
5964
6124
  item: {},
5965
6125
  index: 0,
5966
- empty: /* @__PURE__ */ jsx25("span", { className: "ds-slot-hint", children: "Drop the item design here" })
5967
- }) }) : /* @__PURE__ */ jsx25("div", { className: "ds-state", children: spec.emptyText });
5968
- return /* @__PURE__ */ jsx25("div", { className: "ds-repeater", style, children: rows.map((row, i) => (
6126
+ empty: /* @__PURE__ */ jsx26("span", { className: "ds-slot-hint", children: "Drop the item design here" })
6127
+ }) }) : /* @__PURE__ */ jsx26("div", { className: "ds-state", children: spec.emptyText });
6128
+ return /* @__PURE__ */ jsx26("div", { className: "ds-repeater", style, children: rows.map((row, i) => (
5969
6129
  // biome-ignore lint/suspicious/noArrayIndexKey: rows have no guaranteed id
5970
- /* @__PURE__ */ jsx25(Fragment8, { children: renderSlot("item", { item: row, index: i, className: "ds-repeater-item" }) }, i)
6130
+ /* @__PURE__ */ jsx26(Fragment8, { children: renderSlot("item", { item: row, index: i, className: "ds-repeater-item" }) }, i)
5971
6131
  )) });
5972
6132
  }
5973
6133
  });
@@ -6003,13 +6163,14 @@ var builtInWidgets = [
6003
6163
  Value,
6004
6164
  Progress,
6005
6165
  Icon,
6006
- Divider
6166
+ Divider,
6167
+ Button
6007
6168
  ];
6008
6169
 
6009
6170
  // src/components/Grid.tsx
6010
- import { useEffect as useEffect7, useMemo as useMemo7, useRef as useRef9, useState as useState7 } from "react";
6171
+ import { useEffect as useEffect8, useMemo as useMemo7, useRef as useRef9, useState as useState7 } from "react";
6011
6172
  import { Responsive, WidthProvider } from "react-grid-layout";
6012
- import { jsx as jsx26 } from "react/jsx-runtime";
6173
+ import { jsx as jsx27 } from "react/jsx-runtime";
6013
6174
  var ResponsiveGrid = WidthProvider(Responsive);
6014
6175
  var BREAKPOINT_MIN = { tv: 1800, desktop: 1100, tablet: 700, mobile: 0 };
6015
6176
  function layoutsForView(layouts, view, columns) {
@@ -6066,7 +6227,7 @@ function Grid({
6066
6227
  const bpRef = useRef9("desktop");
6067
6228
  const [wrapEl, setWrapEl] = useState7(null);
6068
6229
  const [measured, setMeasured] = useState7("desktop");
6069
- useEffect7(() => {
6230
+ useEffect8(() => {
6070
6231
  if (!wrapEl || typeof ResizeObserver === "undefined") return;
6071
6232
  const ro = new ResizeObserver(([e]) => {
6072
6233
  const w = e?.contentRect.width ?? 0;
@@ -6127,7 +6288,7 @@ function Grid({
6127
6288
  fitObservers.current.set(panel, ro);
6128
6289
  };
6129
6290
  const fitObservers = useRef9(/* @__PURE__ */ new Map());
6130
- useEffect7(() => {
6291
+ useEffect8(() => {
6131
6292
  const observers = fitObservers.current;
6132
6293
  return () => {
6133
6294
  for (const ro of observers.values()) ro.disconnect();
@@ -6136,7 +6297,7 @@ function Grid({
6136
6297
  const active = breakpoint ?? measured;
6137
6298
  if (base.modes[active] === "flow") {
6138
6299
  const hide = editable ? void 0 : hidden;
6139
- return /* @__PURE__ */ jsx26("div", { ref: setWrapEl, className: editable ? "ds-flow ds-flow-edit" : "ds-flow", style: { gap }, children: base.ordered.filter((o) => !hide?.has(o.panel)).map((o, i) => /* @__PURE__ */ jsx26(
6300
+ return /* @__PURE__ */ jsx27("div", { ref: setWrapEl, className: editable ? "ds-flow ds-flow-edit" : "ds-flow", style: { gap }, children: base.ordered.filter((o) => !hide?.has(o.panel)).map((o, i) => /* @__PURE__ */ jsx27(
6140
6301
  "div",
6141
6302
  {
6142
6303
  className: "ds-flow-item",
@@ -6150,7 +6311,7 @@ function Grid({
6150
6311
  o.panel
6151
6312
  )) });
6152
6313
  }
6153
- return /* @__PURE__ */ jsx26("div", { ref: setWrapEl, children: /* @__PURE__ */ jsx26(
6314
+ return /* @__PURE__ */ jsx27("div", { ref: setWrapEl, children: /* @__PURE__ */ jsx27(
6154
6315
  ResponsiveGrid,
6155
6316
  {
6156
6317
  className: editable ? "ds-grid ds-grid-edit" : "ds-grid",
@@ -6188,17 +6349,17 @@ function Grid({
6188
6349
  onLayoutChange?.(toItems(current), breakpoint ?? bpRef.current);
6189
6350
  },
6190
6351
  onResizeStop: (current) => editable && onLayoutChange?.(toItems(current), breakpoint ?? bpRef.current),
6191
- children: panels.map((p, i) => /* @__PURE__ */ jsx26("div", { "data-fit": base.fit.has(p) && !editable ? "" : void 0, style: { ["--ds-i"]: i }, children: base.fit.has(p) && !editable ? (
6352
+ children: panels.map((p, i) => /* @__PURE__ */ jsx27("div", { "data-fit": base.fit.has(p) && !editable ? "" : void 0, style: { ["--ds-i"]: i }, children: base.fit.has(p) && !editable ? (
6192
6353
  // react-grid-layout replaces the ref of its own children, so the measuring ref sits one level down.
6193
- /* @__PURE__ */ jsx26("div", { className: "ds-fit", ref: observeFit(p), children: children(p) })
6354
+ /* @__PURE__ */ jsx27("div", { className: "ds-fit", ref: observeFit(p), children: children(p) })
6194
6355
  ) : children(p) }, p))
6195
6356
  }
6196
6357
  ) });
6197
6358
  }
6198
6359
 
6199
6360
  // src/components/ModalHost.tsx
6200
- import { useCallback as useCallback5, useEffect as useEffect8, useRef as useRef10 } from "react";
6201
- import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
6361
+ import { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef10 } from "react";
6362
+ import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
6202
6363
  var WIDTH = { sm: "420px", md: "720px", lg: "1040px", xl: "1320px", full: "100%" };
6203
6364
  var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
6204
6365
  function ModalHost() {
@@ -6224,7 +6385,7 @@ function ModalHost() {
6224
6385
  Object.is
6225
6386
  );
6226
6387
  const latched = useRef10(/* @__PURE__ */ new Set());
6227
- useEffect8(() => {
6388
+ useEffect9(() => {
6228
6389
  const now = new Set(byExpression ? byExpression.split("\0") : []);
6229
6390
  for (const id of [...latched.current])
6230
6391
  if (!now.has(id)) {
@@ -6257,7 +6418,7 @@ function ModalHost() {
6257
6418
  }, [openId, runtime, modals]);
6258
6419
  const closeRef = useRef10(close);
6259
6420
  closeRef.current = close;
6260
- useEffect8(() => {
6421
+ useEffect9(() => {
6261
6422
  if (!openId) return;
6262
6423
  const prev = document.activeElement;
6263
6424
  dialog.current?.focus();
@@ -6299,7 +6460,7 @@ function ModalHost() {
6299
6460
  const m = modals[open.id];
6300
6461
  if (!m) return null;
6301
6462
  const grid = runtime.doc.spec.grid;
6302
- return /* @__PURE__ */ jsx27(
6463
+ return /* @__PURE__ */ jsx28(
6303
6464
  "div",
6304
6465
  {
6305
6466
  ref: scrim,
@@ -6318,10 +6479,10 @@ function ModalHost() {
6318
6479
  style: { ["--ds-dialog-w"]: WIDTH[m.size ?? "md"] ?? WIDTH.md },
6319
6480
  children: [
6320
6481
  /* @__PURE__ */ jsxs21("div", { className: "ds-dialog-head", children: [
6321
- /* @__PURE__ */ jsx27("h2", { children: open.title }),
6322
- /* @__PURE__ */ jsx27("button", { type: "button", className: "ds-close", "aria-label": "Close", onClick: close, children: "\xD7" })
6482
+ /* @__PURE__ */ jsx28("h2", { children: open.title }),
6483
+ /* @__PURE__ */ jsx28("button", { type: "button", className: "ds-close", "aria-label": "Close", onClick: close, children: "\xD7" })
6323
6484
  ] }),
6324
- /* @__PURE__ */ jsx27(
6485
+ /* @__PURE__ */ jsx28(
6325
6486
  Grid,
6326
6487
  {
6327
6488
  layouts: [{ items: m.layout }],
@@ -6330,7 +6491,7 @@ function ModalHost() {
6330
6491
  columns: grid.columns,
6331
6492
  rowHeight: grid.rowHeight,
6332
6493
  gap: grid.gap,
6333
- children: (id) => /* @__PURE__ */ jsx27(PanelFrame, { id })
6494
+ children: (id) => /* @__PURE__ */ jsx28(PanelFrame, { id })
6334
6495
  }
6335
6496
  )
6336
6497
  ]
@@ -6342,7 +6503,7 @@ function ModalHost() {
6342
6503
 
6343
6504
  // src/components/Provider.tsx
6344
6505
  import { createContext as createContext4, useContext as useContext5, useRef as useRef11 } from "react";
6345
- import { jsx as jsx28 } from "react/jsx-runtime";
6506
+ import { jsx as jsx29 } from "react/jsx-runtime";
6346
6507
  var SettingsContext = createContext4({});
6347
6508
  function DashSpecProvider({ children, ...settings }) {
6348
6509
  const outer = useContext5(SettingsContext);
@@ -6351,7 +6512,7 @@ function DashSpecProvider({ children, ...settings }) {
6351
6512
  );
6352
6513
  if (!last.current || last.current.outer !== outer || !shallowEqual2(last.current.settings, settings))
6353
6514
  last.current = { outer, settings, value: mergeSettings(outer, settings) };
6354
- return /* @__PURE__ */ jsx28(SettingsContext.Provider, { value: last.current.value, children });
6515
+ return /* @__PURE__ */ jsx29(SettingsContext.Provider, { value: last.current.value, children });
6355
6516
  }
6356
6517
  function shallowEqual2(a, b) {
6357
6518
  const ka = Object.keys(a);
@@ -6389,9 +6550,9 @@ function pickTheme(name, themes, fallback) {
6389
6550
  }
6390
6551
 
6391
6552
  // src/components/Tour.tsx
6392
- import { useCallback as useCallback6, useEffect as useEffect9, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef12, useState as useState8 } from "react";
6393
- import { Fragment as Fragment9, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
6394
- var useClientLayoutEffect = typeof window === "undefined" ? useEffect9 : useLayoutEffect3;
6553
+ import { useCallback as useCallback6, useEffect as useEffect10, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef12, useState as useState8 } from "react";
6554
+ import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
6555
+ var useClientLayoutEffect = typeof window === "undefined" ? useEffect10 : useLayoutEffect3;
6395
6556
  function panelElement(root, id) {
6396
6557
  if (!root || !id) return null;
6397
6558
  for (const el of root.querySelectorAll("[data-panel]"))
@@ -6462,13 +6623,13 @@ function TourButton({ steps }) {
6462
6623
  };
6463
6624
  }, [step]);
6464
6625
  const isOpen = at !== null;
6465
- useEffect9(() => {
6626
+ useEffect10(() => {
6466
6627
  if (isOpen) (next.current ?? dialog.current)?.focus();
6467
6628
  }, [isOpen]);
6468
6629
  if (steps.length === 0) return null;
6469
6630
  const last = at === steps.length - 1;
6470
6631
  return /* @__PURE__ */ jsxs22(Fragment9, { children: [
6471
- /* @__PURE__ */ jsx29(
6632
+ /* @__PURE__ */ jsx30(
6472
6633
  "button",
6473
6634
  {
6474
6635
  ref: button,
@@ -6499,19 +6660,19 @@ function TourButton({ steps }) {
6499
6660
  },
6500
6661
  children: [
6501
6662
  /* @__PURE__ */ jsxs22("div", { className: "ds-tour-head", children: [
6502
- text?.title && /* @__PURE__ */ jsx29("h3", { className: "ds-tour-title", id: titleId, children: text.title }),
6663
+ text?.title && /* @__PURE__ */ jsx30("h3", { className: "ds-tour-title", id: titleId, children: text.title }),
6503
6664
  /* @__PURE__ */ jsxs22("span", { className: "ds-tour-count", children: [
6504
6665
  at + 1,
6505
6666
  " / ",
6506
6667
  steps.length
6507
6668
  ] })
6508
6669
  ] }),
6509
- /* @__PURE__ */ jsx29("p", { className: "ds-tour-text", id: textId, "aria-live": "polite", children: text?.text }),
6670
+ /* @__PURE__ */ jsx30("p", { className: "ds-tour-text", id: textId, "aria-live": "polite", children: text?.text }),
6510
6671
  /* @__PURE__ */ jsxs22("div", { className: "ds-tour-foot", children: [
6511
- /* @__PURE__ */ jsx29("button", { type: "button", className: "ds-tour-skip", onClick: close, children: "Close" }),
6512
- /* @__PURE__ */ jsx29("span", { className: "ds-filters-spacer" }),
6513
- at > 0 && /* @__PURE__ */ jsx29("button", { type: "button", className: "ds-filter-reset", onClick: () => setAt(at - 1), children: "Back" }),
6514
- /* @__PURE__ */ jsx29(
6672
+ /* @__PURE__ */ jsx30("button", { type: "button", className: "ds-tour-skip", onClick: close, children: "Close" }),
6673
+ /* @__PURE__ */ jsx30("span", { className: "ds-filters-spacer" }),
6674
+ at > 0 && /* @__PURE__ */ jsx30("button", { type: "button", className: "ds-filter-reset", onClick: () => setAt(at - 1), children: "Back" }),
6675
+ /* @__PURE__ */ jsx30(
6515
6676
  "button",
6516
6677
  {
6517
6678
  ref: next,
@@ -6529,7 +6690,7 @@ function TourButton({ steps }) {
6529
6690
  }
6530
6691
 
6531
6692
  // src/components/registryHooks.ts
6532
- import { useCallback as useCallback7, useEffect as useEffect10, useRef as useRef13, useState as useState9, useSyncExternalStore as useSyncExternalStore3 } from "react";
6693
+ import { useCallback as useCallback7, useEffect as useEffect11, useRef as useRef13, useState as useState9, useSyncExternalStore as useSyncExternalStore3 } from "react";
6533
6694
  var live = /* @__PURE__ */ new Map();
6534
6695
  var listeners = /* @__PURE__ */ new Set();
6535
6696
  var notify = () => {
@@ -6560,7 +6721,7 @@ function useDashboardState(id, select) {
6560
6721
  const [value, setValue] = useState9(() => rt ? select(rt.getTree()) : void 0);
6561
6722
  const sel = useRef13(select);
6562
6723
  sel.current = select;
6563
- useEffect10(() => {
6724
+ useEffect11(() => {
6564
6725
  if (!rt) return setValue(void 0);
6565
6726
  const update = () => setValue(() => sel.current(rt.getTree()));
6566
6727
  update();
@@ -6732,6 +6893,23 @@ var RENDERER_CSS = `
6732
6893
  .ds-table tbody tr { cursor: pointer; }
6733
6894
  .ds-table tbody tr:hover, .ds-table tbody tr:focus-visible { background: var(--ds-color-surface-selection); outline: none; }
6734
6895
  .ds-table tfoot td { font-weight: 600; border-top: 2px solid var(--ds-color-border-default); }
6896
+ /* Rich cells (sub line, chips), expandable rows and their detail. */
6897
+ .ds-cell { display: inline-flex; flex-direction: column; align-items: flex-start; gap: var(--ds-space-xxs); }
6898
+ .ds-table td[style*="right"] .ds-cell { align-items: flex-end; }
6899
+ .ds-cell-sub { color: var(--ds-color-text-secondary); font-size: var(--ds-type-caption-size); font-weight: 600; }
6900
+ .ds-chips { display: inline-flex; flex-wrap: wrap; gap: var(--ds-space-xxs); }
6901
+ .ds-table tr[aria-expanded] { cursor: pointer; }
6902
+ .ds-table tr[data-expanded] > td, .ds-row-detail > td { background: var(--ds-color-surface-sunken); }
6903
+ .ds-row-detail > td { padding: var(--ds-space-md); }
6904
+ /* Tiles: muted (dashed, greyed) and highlighted (accent border). */
6905
+ .ds-tile[data-muted] { border-style: dashed; color: var(--ds-color-text-disabled); background: transparent; }
6906
+ .ds-tile[data-muted] .ds-tile-label, .ds-tile[data-muted] .ds-tile-value, .ds-tile[data-muted] .ds-tile-caption { color: var(--ds-color-text-disabled); }
6907
+ .ds-tile[data-highlight] { border-width: 2px; }
6908
+ .ds-tile[data-highlight="warn"] { border-color: var(--ds-color-status-warn-border); }
6909
+ .ds-tile[data-highlight="bad"] { border-color: var(--ds-color-status-bad-border); }
6910
+ .ds-tile[data-highlight="good"] { border-color: var(--ds-color-status-good-border); }
6911
+ .ds-tile[data-highlight="info"] { border-color: var(--ds-color-status-info-border); }
6912
+ .ds-tile[data-highlight="neutral"] { border-color: var(--ds-color-status-neutral-border); }
6735
6913
  .ds-cell-list { display: grid; gap: 2px; }
6736
6914
  .ds-pager { display: flex; justify-content: flex-end; align-items: center; gap: var(--ds-space-sm); padding-top: var(--ds-space-xs); font-size: var(--ds-type-label-size); color: var(--ds-color-text-subtle); }
6737
6915
 
@@ -6745,7 +6923,10 @@ var RENDERER_CSS = `
6745
6923
  .ds-live[data-stale] > span { background: var(--ds-color-status-warn-fg); }
6746
6924
  .ds-info { position: relative; display: inline-flex; color: var(--ds-color-text-disabled); cursor: help; outline: none; background: none; border: 0; padding: 0; font: inherit; }
6747
6925
  .ds-info:hover, .ds-info:focus-visible { color: var(--ds-color-text-subtle); }
6748
- .ds-tip { position: fixed; z-index: var(--ds-z-tooltip); width: max-content; max-width: 320px; padding: var(--ds-space-sm) var(--ds-space-md); border-radius: var(--ds-radius-control); background: var(--ds-color-chart-tooltip-bg); color: var(--ds-color-chart-tooltip-text); font: 500 var(--ds-type-caption-size)/1.5 var(--ds-font-body); text-align: left; white-space: normal; pointer-events: none; animation: ds-fade 120ms ease both; }
6926
+ .ds-tip { position: fixed; z-index: var(--ds-z-tooltip); width: max-content; max-width: 320px; padding: var(--ds-space-sm) var(--ds-space-md); border-radius: var(--ds-radius-control); background: var(--ds-color-chart-tooltip-bg); color: var(--ds-color-chart-tooltip-text); font: 500 var(--ds-type-caption-size)/1.5 var(--ds-font-body); text-align: left; white-space: normal; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity 140ms ease, transform 140ms ease; }
6927
+ .ds-tip[data-below] { transform: translateY(-4px); }
6928
+ .ds-tip[data-open] { opacity: 1; transform: none; }
6929
+ @media (prefers-reduced-motion: reduce) { .ds-tip { transition: none; } }
6749
6930
  .ds-tip::after { content: ""; position: absolute; left: var(--ds-tip-arrow); top: 100%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ds-color-chart-tooltip-bg); }
6750
6931
  .ds-tip[data-below]::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ds-color-chart-tooltip-bg); }
6751
6932
 
@@ -7085,6 +7266,18 @@ var RENDERER_CSS = `
7085
7266
  .ds-panel[data-tone="plain"] > .ds-panel-body { container-type: normal; }
7086
7267
  /* Slots: nodes inside nodes */
7087
7268
  .ds-slot { min-width: 0; }
7269
+ .ds-slot[data-slot="toolbar"] { display: flex; flex-wrap: wrap; gap: var(--ds-space-sm); align-items: center; margin-bottom: var(--ds-space-sm); }
7270
+ .ds-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--ds-space-xs); height: var(--ds-control-height, 36px); padding: 0 var(--ds-space-md); border: 1px solid var(--ds-color-border-default); border-radius: var(--ds-radius-control); background: var(--ds-color-surface-card); color: var(--ds-color-text-primary); font: 500 var(--ds-type-label-size)/1 var(--ds-font-body); cursor: pointer; white-space: nowrap; transition: background 140ms ease, border-color 140ms ease, opacity 140ms ease; }
7271
+ .ds-button[data-size="sm"] { height: calc(var(--ds-control-height, 36px) - 8px); padding: 0 var(--ds-space-sm); }
7272
+ .ds-button[data-icon-only] { padding: 0; width: var(--ds-control-height, 36px); }
7273
+ .ds-button[data-icon-only][data-size="sm"] { width: calc(var(--ds-control-height, 36px) - 8px); }
7274
+ .ds-button[data-variant="primary"] { background: var(--ds-color-action-primary); border-color: var(--ds-color-action-primary); color: var(--ds-color-action-on-primary); }
7275
+ .ds-button[data-variant="subtle"] { background: var(--ds-color-surface-selection); border-color: transparent; color: var(--ds-color-action-primary); }
7276
+ .ds-button[data-variant="link"] { background: none; border-color: transparent; color: var(--ds-color-action-primary); padding: 0; height: auto; }
7277
+ .ds-button:hover:not(:disabled) { border-color: var(--ds-color-action-primary); }
7278
+ .ds-button[data-variant="link"]:hover:not(:disabled) { text-decoration: underline; }
7279
+ .ds-button:disabled { opacity: .4; cursor: default; }
7280
+ .ds-button:focus-visible { outline: 2px solid var(--ds-color-border-focus); outline-offset: 1px; }
7088
7281
  .ds-slot[data-slot="footer"] { margin-top: var(--ds-space-sm); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
7089
7282
  .ds-slot[data-empty] { display: grid; place-items: center; min-height: 44px; border: 1.5px dashed var(--ds-color-border-control); border-radius: var(--ds-radius-control); color: var(--ds-color-text-subtle); font-size: var(--ds-type-label-size); padding: 8px; }
7090
7283
  .ds-slot-hint { pointer-events: none; }
@@ -7167,7 +7360,7 @@ function releaseDefaultPrefix(owner) {
7167
7360
  }
7168
7361
 
7169
7362
  // src/components/DashboardRenderer.tsx
7170
- import { Fragment as Fragment10, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
7363
+ import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
7171
7364
  function usesScripts(doc) {
7172
7365
  const handler = (h) => {
7173
7366
  if (typeof h === "string") return isCallbackSource(h);
@@ -7244,8 +7437,8 @@ function InvalidDocument({ problems }) {
7244
7437
  errors.length,
7245
7438
  " problem(s)."
7246
7439
  ] }),
7247
- /* @__PURE__ */ jsx30("ul", { children: errors.slice(0, 20).map((p) => /* @__PURE__ */ jsxs23("li", { children: [
7248
- /* @__PURE__ */ jsx30("code", { children: p.path || "(root)" }),
7440
+ /* @__PURE__ */ jsx31("ul", { children: errors.slice(0, 20).map((p) => /* @__PURE__ */ jsxs23("li", { children: [
7441
+ /* @__PURE__ */ jsx31("code", { children: p.path || "(root)" }),
7249
7442
  " ",
7250
7443
  p.message
7251
7444
  ] }, `${p.path}-${p.message}`)) })
@@ -7294,7 +7487,7 @@ var DashboardRenderer = forwardRef(
7294
7487
  const needsSandbox = loaded.status === "valid" && mode === "sandbox" && usesScripts(loaded.document);
7295
7488
  const [sandbox, setSandbox] = useState10(null);
7296
7489
  const [sandboxError, setSandboxError] = useState10(null);
7297
- useEffect11(() => {
7490
+ useEffect12(() => {
7298
7491
  if (!needsSandbox || sandbox) return;
7299
7492
  let cancelled = false;
7300
7493
  import("./sandbox-WEMG76LE.js").then((m) => m.createSandboxRunner()).then((r) => !cancelled && setSandbox(r)).catch((e) => !cancelled && setSandboxError(String(e?.message ?? e)));
@@ -7354,7 +7547,7 @@ var DashboardRenderer = forwardRef(
7354
7547
  };
7355
7548
  return createDashboardRuntime(doc, { ...options, autoStart: false });
7356
7549
  }, [forRuntime, sandbox, needsSandbox, mode]);
7357
- useEffect11(() => {
7550
+ useEffect12(() => {
7358
7551
  if (!runtime || !useUrl) return;
7359
7552
  const owner = urlOwner.current;
7360
7553
  if (!props.id && !claimDefaultPrefix(owner)) {
@@ -7389,24 +7582,24 @@ var DashboardRenderer = forwardRef(
7389
7582
  if (!props.id) releaseDefaultPrefix(owner);
7390
7583
  };
7391
7584
  }, [runtime, useUrl, prefix, props.id]);
7392
- useEffect11(() => {
7585
+ useEffect12(() => {
7393
7586
  runtime?.start();
7394
7587
  return () => runtime?.stop();
7395
7588
  }, [runtime]);
7396
- useEffect11(() => runtime && props.id ? registerRuntime(props.id, runtime) : void 0, [runtime, props.id]);
7397
- useEffect11(() => {
7589
+ useEffect12(() => runtime && props.id ? registerRuntime(props.id, runtime) : void 0, [runtime, props.id]);
7590
+ useEffect12(() => {
7398
7591
  if (runtime) latest.current.onLoad?.();
7399
7592
  }, [runtime]);
7400
7593
  const variablesKey = props.variables ? JSON.stringify(props.variables) : "";
7401
7594
  const stateKey = props.state ? JSON.stringify(props.state) : "";
7402
- useEffect11(() => {
7595
+ useEffect12(() => {
7403
7596
  const vars = latest.current.variables;
7404
7597
  if (!runtime || !vars) return;
7405
7598
  for (const [name, value] of Object.entries(vars))
7406
7599
  if (!sameJson(runtime.getTree().filters[name], value))
7407
7600
  runtime.store.dispatch(stateActions.setFilter({ name, value }));
7408
7601
  }, [runtime, variablesKey]);
7409
- useEffect11(() => {
7602
+ useEffect12(() => {
7410
7603
  const st = latest.current.state;
7411
7604
  if (!runtime || !st) return;
7412
7605
  for (const [path, value] of Object.entries(st))
@@ -7416,7 +7609,7 @@ var DashboardRenderer = forwardRef(
7416
7609
  const hostDataKey = props.data ? JSON.stringify(props.data) : "";
7417
7610
  const contextKey = props.context ? JSON.stringify(props.context) : "";
7418
7611
  const hostInputsSeen = useRef14(null);
7419
- useEffect11(() => {
7612
+ useEffect12(() => {
7420
7613
  if (!runtime) return;
7421
7614
  const seen = hostInputsSeen.current;
7422
7615
  hostInputsSeen.current = { runtime, data: hostDataKey, context: contextKey };
@@ -7424,12 +7617,12 @@ var DashboardRenderer = forwardRef(
7424
7617
  if (seen.data !== hostDataKey) runtime.setHostData(latest.current.data);
7425
7618
  if (seen.context !== contextKey) runtime.setContext(latest.current.context);
7426
7619
  }, [runtime, hostDataKey, contextKey]);
7427
- useEffect11(() => {
7620
+ useEffect12(() => {
7428
7621
  if (!runtime) return;
7429
7622
  if (props.view !== void 0 && props.view !== runtime.getTree().view)
7430
7623
  runtime.store.dispatch(stateActions.setView(props.view));
7431
7624
  }, [runtime, props.view]);
7432
- useEffect11(() => {
7625
+ useEffect12(() => {
7433
7626
  if (!runtime) return;
7434
7627
  let prev = runtime.getTree();
7435
7628
  return runtime.store.subscribe(() => {
@@ -7545,7 +7738,7 @@ var DashboardRenderer = forwardRef(
7545
7738
  props.themes,
7546
7739
  props.theme ?? ds.theme ?? DEFAULT_THEME
7547
7740
  );
7548
- useEffect11(() => {
7741
+ useEffect12(() => {
7549
7742
  if (picked.unknown)
7550
7743
  latest.current.onError?.({
7551
7744
  code: "unknown-theme",
@@ -7554,16 +7747,16 @@ var DashboardRenderer = forwardRef(
7554
7747
  }, [picked.unknown]);
7555
7748
  let content;
7556
7749
  if (loaded.status === "invalid")
7557
- content = props.renderError?.({ code: "invalid", message: loaded.problems[0]?.message ?? "Invalid" }) ?? /* @__PURE__ */ jsx30(InvalidDocument, { problems: loaded.problems });
7750
+ content = props.renderError?.({ code: "invalid", message: loaded.problems[0]?.message ?? "Invalid" }) ?? /* @__PURE__ */ jsx31(InvalidDocument, { problems: loaded.problems });
7558
7751
  else if (sandboxError)
7559
7752
  content = /* @__PURE__ */ jsxs23("div", { className: "ds-invalid", children: [
7560
7753
  "Could not start the script sandbox: ",
7561
7754
  sandboxError
7562
7755
  ] });
7563
7756
  else if (!ctx)
7564
- content = /* @__PURE__ */ jsx30("div", { className: "ds-skeleton", style: { height: 200 }, "aria-busy": "true", "aria-label": "Loading dashboard" });
7757
+ content = /* @__PURE__ */ jsx31("div", { className: "ds-skeleton", style: { height: 200 }, "aria-busy": "true", "aria-label": "Loading dashboard" });
7565
7758
  else
7566
- content = /* @__PURE__ */ jsx30(
7759
+ content = /* @__PURE__ */ jsx31(
7567
7760
  DashboardBody,
7568
7761
  {
7569
7762
  doc: loaded.document,
@@ -7576,8 +7769,8 @@ var DashboardRenderer = forwardRef(
7576
7769
  }
7577
7770
  );
7578
7771
  return /* @__PURE__ */ jsxs23(ThemeScope, { theme: picked.theme, mode: picked.mode, children: [
7579
- /* @__PURE__ */ jsx30("style", { dangerouslySetInnerHTML: { __html: RENDERER_CSS } }),
7580
- /* @__PURE__ */ jsx30(
7772
+ /* @__PURE__ */ jsx31("style", { dangerouslySetInnerHTML: { __html: RENDERER_CSS } }),
7773
+ /* @__PURE__ */ jsx31(
7581
7774
  Boundary,
7582
7775
  {
7583
7776
  resetKeys: [loaded, runtime],
@@ -7586,7 +7779,7 @@ var DashboardRenderer = forwardRef(
7586
7779
  "This dashboard could not be shown: ",
7587
7780
  e.message
7588
7781
  ] }),
7589
- children: ctx ? /* @__PURE__ */ jsx30(DashboardContext.Provider, { value: ctx, children: content }) : content
7782
+ children: ctx ? /* @__PURE__ */ jsx31(DashboardContext.Provider, { value: ctx, children: content }) : content
7590
7783
  }
7591
7784
  )
7592
7785
  ] });
@@ -7603,7 +7796,7 @@ function DashboardBody({
7603
7796
  }) {
7604
7797
  const { runtime, options } = useDashboard();
7605
7798
  const tv = options.mode === "tv" ? doc.spec.display.tv : void 0;
7606
- useEffect11(() => {
7799
+ useEffect12(() => {
7607
7800
  const views = tv?.rotateViews ?? [];
7608
7801
  if (views.length < 2) return;
7609
7802
  const every = tv?.every ? parseDuration(tv.every) : 6e4;
@@ -7641,14 +7834,14 @@ function DashboardBody({
7641
7834
  const hidden = useHiddenPanels(Object.keys(doc.spec.panels));
7642
7835
  return /* @__PURE__ */ jsxs23(Fragment10, { children: [
7643
7836
  !hideHeader && (head.title || head.synced || tour.length > 0) && /* @__PURE__ */ jsxs23("div", { className: "ds-header", children: [
7644
- head.title && /* @__PURE__ */ jsx30("h2", { className: "ds-title", children: head.title }),
7645
- head.description && /* @__PURE__ */ jsx30("p", { className: "ds-desc", children: head.description }),
7646
- head.synced && /* @__PURE__ */ jsx30("span", { className: "ds-synced", children: head.synced }),
7647
- tour.length > 0 && /* @__PURE__ */ jsx30(TourButton, { steps: tour })
7837
+ head.title && /* @__PURE__ */ jsx31("h2", { className: "ds-title", children: head.title }),
7838
+ head.description && /* @__PURE__ */ jsx31("p", { className: "ds-desc", children: head.description }),
7839
+ head.synced && /* @__PURE__ */ jsx31("span", { className: "ds-synced", children: head.synced }),
7840
+ tour.length > 0 && /* @__PURE__ */ jsx31(TourButton, { steps: tour })
7648
7841
  ] }),
7649
7842
  !tv?.hideToolbar && // A control that throws (a design system's, a custom filter kind) costs the bar, not the dashboard.
7650
- /* @__PURE__ */ jsx30(Boundary, { resetKeys: [doc], fallback: (e) => /* @__PURE__ */ jsx30(PartError, { what: "The filters", error: e }), children: /* @__PURE__ */ jsx30(FilterBar, {}) }),
7651
- /* @__PURE__ */ jsx30(
7843
+ /* @__PURE__ */ jsx31(Boundary, { resetKeys: [doc], fallback: (e) => /* @__PURE__ */ jsx31(PartError, { what: "The filters", error: e }), children: /* @__PURE__ */ jsx31(FilterBar, {}) }),
7844
+ /* @__PURE__ */ jsx31(
7652
7845
  Grid,
7653
7846
  {
7654
7847
  layouts: doc.spec.layouts,
@@ -7687,10 +7880,10 @@ function DashboardBody({
7687
7880
  ...breakpoint ? { breakpoint } : {},
7688
7881
  ...onLayoutChange ? { onLayoutChange: (items, bp) => onLayoutChange(items, bp, head.view) } : {},
7689
7882
  ...onDropWidget ? { onDrop: (at, bp) => onDropWidget(at, bp, head.view), dropSize } : {},
7690
- children: (id) => /* @__PURE__ */ jsx30(PanelFrame, { id })
7883
+ children: (id) => /* @__PURE__ */ jsx31(PanelFrame, { id })
7691
7884
  }
7692
7885
  ),
7693
- /* @__PURE__ */ jsx30(Boundary, { resetKeys: [doc], fallback: (e) => /* @__PURE__ */ jsx30(PartError, { what: "The pop-up", error: e }), children: /* @__PURE__ */ jsx30(ModalHost, {}) })
7886
+ /* @__PURE__ */ jsx31(Boundary, { resetKeys: [doc], fallback: (e) => /* @__PURE__ */ jsx31(PartError, { what: "The pop-up", error: e }), children: /* @__PURE__ */ jsx31(ModalHost, {}) })
7694
7887
  ] });
7695
7888
  }
7696
7889
  var NO_STEPS = [];
@@ -7705,7 +7898,7 @@ function PartError({ what, error }) {
7705
7898
  // src/widgets/wrap.tsx
7706
7899
  import { Suspense, lazy } from "react";
7707
7900
  import { z as z17 } from "zod";
7708
- import { jsx as jsx31 } from "react/jsx-runtime";
7901
+ import { jsx as jsx32 } from "react/jsx-runtime";
7709
7902
  function wrapComponent(Component2, o) {
7710
7903
  const schema = o.schema ?? z17.record(z17.unknown());
7711
7904
  const eventNames = [...new Set(Object.values(o.events ?? {}))];
@@ -7735,7 +7928,7 @@ function wrapComponent(Component2, o) {
7735
7928
  }
7736
7929
  const slotProps = {};
7737
7930
  for (const [prop, slot] of Object.entries(o.slots ?? {})) slotProps[prop] = props.renderSlot(slot);
7738
- return /* @__PURE__ */ jsx31(Component2, { ...mapped, ...handlers, ...slotProps });
7931
+ return /* @__PURE__ */ jsx32(Component2, { ...mapped, ...handlers, ...slotProps });
7739
7932
  }
7740
7933
  });
7741
7934
  }
@@ -7746,7 +7939,7 @@ function lazyWidget(def) {
7746
7939
  ...rest,
7747
7940
  component: function LazyWidget(props) {
7748
7941
  Comp ??= lazy(load);
7749
- return /* @__PURE__ */ jsx31(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx31("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx31(Comp, { ...props }) });
7942
+ return /* @__PURE__ */ jsx32(Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx32("div", { className: "ds-skeleton", "aria-busy": "true" }), children: /* @__PURE__ */ jsx32(Comp, { ...props }) });
7750
7943
  }
7751
7944
  });
7752
7945
  }