@design.estate/dees-catalog 21.32.3 → 21.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist_bundle/bundle.js +1545 -332
  2. package/dist_bundle/bundle.js.map +1 -1
  3. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js → chunk-B3NM6BL3.js} +3 -3
  4. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js → chunk-BDUZ7I23.js} +2 -2
  5. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js → chunk-IK5OF7M4.js} +33 -2
  6. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-LDC2GECY.js.map → chunk-IK5OF7M4.js.map} +1 -1
  7. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{de-YOX3NS2W.js → de-PTMMQ5DA.js} +33 -2
  8. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-PTMMQ5DA.js.map +1 -0
  9. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js → dees-modal-BZIJFVRI.js} +3 -3
  10. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js → dees-workspace-terminal-EU377EZY.js} +4 -4
  11. package/dist_ts_web/00_commitinfo_data.js +1 -1
  12. package/dist_ts_web/elements/00group-chart/dees-chart-area/component.d.ts +18 -0
  13. package/dist_ts_web/elements/00group-chart/dees-chart-area/component.js +60 -2
  14. package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.d.ts +24 -0
  15. package/dist_ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.js +80 -0
  16. package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.d.ts +1 -0
  17. package/dist_ts_web/elements/00group-feedback/dees-hint/dees-hint.js +13 -3
  18. package/dist_ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.js +7 -5
  19. package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.d.ts +0 -3
  20. package/dist_ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.js +10 -182
  21. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.d.ts +64 -1
  22. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.js +221 -22
  23. package/dist_ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.js +544 -66
  24. package/dist_ts_web/elements/00group-harness/harness.helpers.d.ts +16 -1
  25. package/dist_ts_web/elements/00group-harness/harness.helpers.js +25 -1
  26. package/dist_ts_web/elements/00group-harness/harness.records.d.ts +27 -0
  27. package/dist_ts_web/elements/00group-harness/harness.records.js +193 -0
  28. package/dist_ts_web/elements/00group-harness/interfaces.d.ts +93 -4
  29. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.d.ts +39 -0
  30. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.js +22 -8
  31. package/dist_ts_web/elements/00group-kanban/dees-kanban/dees-kanban.js +265 -25
  32. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.d.ts +5 -0
  33. package/dist_ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.js +70 -11
  34. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.d.ts +16 -1
  35. package/dist_ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.js +188 -5
  36. package/dist_ts_web/elements/00group-kanban/interfaces.d.ts +47 -2
  37. package/dist_ts_web/elements/00group-kanban/kanban.demodata.d.ts +7 -1
  38. package/dist_ts_web/elements/00group-kanban/kanban.demodata.js +49 -7
  39. package/dist_ts_web/elements/00group-kanban/kanban.dragcontroller.js +6 -1
  40. package/dist_ts_web/elements/00group-kanban/kanban.helpers.d.ts +15 -1
  41. package/dist_ts_web/elements/00group-kanban/kanban.helpers.js +31 -1
  42. package/dist_ts_web/i18n/de.d.ts +124 -0
  43. package/dist_ts_web/i18n/de.js +32 -1
  44. package/dist_ts_web/i18n/messages.d.ts +124 -0
  45. package/dist_ts_web/i18n/messages.js +32 -1
  46. package/package.json +1 -1
  47. package/readme.md +76 -13
  48. package/ts_web/00_commitinfo_data.ts +1 -1
  49. package/ts_web/elements/00group-chart/dees-chart-area/component.ts +59 -1
  50. package/ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.ts +97 -0
  51. package/ts_web/elements/00group-feedback/dees-hint/dees-hint.ts +16 -3
  52. package/ts_web/elements/00group-harness/dees-harness-message-list/dees-harness-message-list.ts +6 -4
  53. package/ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.ts +16 -186
  54. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.ts +261 -55
  55. package/ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts +575 -88
  56. package/ts_web/elements/00group-harness/harness.helpers.ts +39 -0
  57. package/ts_web/elements/00group-harness/harness.records.ts +210 -0
  58. package/ts_web/elements/00group-harness/interfaces.ts +99 -4
  59. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts +21 -5
  60. package/ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts +256 -24
  61. package/ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts +67 -6
  62. package/ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts +202 -1
  63. package/ts_web/elements/00group-kanban/interfaces.ts +55 -3
  64. package/ts_web/elements/00group-kanban/kanban.demodata.ts +62 -6
  65. package/ts_web/elements/00group-kanban/kanban.dragcontroller.ts +5 -0
  66. package/ts_web/elements/00group-kanban/kanban.helpers.ts +53 -0
  67. package/ts_web/i18n/de.ts +31 -0
  68. package/ts_web/i18n/messages.ts +31 -0
  69. package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/de-YOX3NS2W.js.map +0 -1
  70. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-ZRD47DC6.js.map → chunk-B3NM6BL3.js.map} +0 -0
  71. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{chunk-EL3KNDIB.js.map → chunk-BDUZ7I23.js.map} +0 -0
  72. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-modal-7LJGK5SK.js.map → dees-modal-BZIJFVRI.js.map} +0 -0
  73. /package/dist_bundle/chunks/U6Ua8p1giFoD1s7vrUZUdpbg/{dees-workspace-terminal-O3NEQ4DO.js.map → dees-workspace-terminal-EU377EZY.js.map} +0 -0
@@ -26,7 +26,7 @@ import {
26
26
  ownAppuiLabels,
27
27
  resolveAppuiLabels,
28
28
  xtermStyles
29
- } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-ZRD47DC6.js";
29
+ } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-B3NM6BL3.js";
30
30
  import {
31
31
  ActionRunController,
32
32
  BarInfoController,
@@ -123,7 +123,7 @@ import {
123
123
  workspaceVisibility,
124
124
  zIndexLayers,
125
125
  zIndexRegistry
126
- } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-EL3KNDIB.js";
126
+ } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-BDUZ7I23.js";
127
127
  import {
128
128
  dcMessages,
129
129
  dcSourceI18n,
@@ -133,7 +133,7 @@ import {
133
133
  firstDayOfWeek,
134
134
  iso_exports,
135
135
  momentFormat
136
- } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-LDC2GECY.js";
136
+ } from "./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/chunk-IK5OF7M4.js";
137
137
  import {
138
138
  __decorateElement,
139
139
  __decoratorMetadata,
@@ -759,6 +759,7 @@ var hintTypeIcons = {
759
759
  warning: "lucide:TriangleAlert",
760
760
  error: "lucide:CircleAlert"
761
761
  };
762
+ var hasHintContent = /* @__PURE__ */ __name((nodes) => nodes.some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim().length > 0), "hasHintContent");
762
763
  _DeesHint_decorators = [customElement("dees-hint")];
763
764
  var _DeesHint = class _DeesHint extends (_a2 = DeesElement, _type_dec = [n({ type: String, reflect: true })], _text_dec = [n({ type: String, reflect: true })], _hasSlottedContent_dec = [r2()], _a2) {
764
765
  constructor() {
@@ -767,11 +768,15 @@ var _DeesHint = class _DeesHint extends (_a2 = DeesElement, _type_dec = [n({ typ
767
768
  __privateAdd(this, _text, __runInitializers(_init3, 12, this, "")), __runInitializers(_init3, 15, this);
768
769
  __privateAdd(this, _hasSlottedContent, __runInitializers(_init3, 16, this, false)), __runInitializers(_init3, 19, this);
769
770
  __publicField(this, "handleSlotChange", /* @__PURE__ */ __name((eventArg) => {
770
- const assigned = eventArg.target.assignedNodes({ flatten: true });
771
- this.hasSlottedContent = assigned.some((node) => node.nodeType === Node.ELEMENT_NODE || (node.textContent ?? "").trim().length > 0);
771
+ this.hasSlottedContent = hasHintContent(eventArg.target.assignedNodes({ flatten: true }));
772
772
  }, "handleSlotChange"));
773
773
  domtools_elementbasic_exports.setup();
774
774
  }
775
+ willUpdate(changedProperties) {
776
+ super.willUpdate(changedProperties);
777
+ if (!this.hasUpdated)
778
+ this.hasSlottedContent = hasHintContent([...this.childNodes].flatMap((node) => node instanceof HTMLSlotElement ? node.assignedNodes({ flatten: true }) : [node]));
779
+ }
775
780
  render() {
776
781
  const isEmpty = !this.text && !this.hasSlottedContent;
777
782
  return b`
@@ -833,7 +838,9 @@ __publicField(_DeesHint, "styles", [themeDefaultStyles, cssManager.defaultStyles
833
838
  margin-top: 1px;
834
839
  }
835
840
 
841
+ /* Spans the hint, so slotted rows reach its padding rather than their longest line. */
836
842
  .content {
843
+ flex: 1 1 auto;
837
844
  min-width: 0;
838
845
  color: var(--dees-color-text-secondary);
839
846
  }
@@ -19328,6 +19335,54 @@ var createZonedTimeScale = /* @__PURE__ */ __name((lcBundleArg, formatsArg) => {
19328
19335
  return new ZonedTimeScale();
19329
19336
  }, "createZonedTimeScale");
19330
19337
 
19338
+ // ts_web/elements/00group-chart/dees-chart-area/priceaxislabels.ts
19339
+ var priceAxisLabelHeight = /* @__PURE__ */ __name((fontSizeArg) => fontSizeArg + 2 * 2.5 * fontSizeArg / 12, "priceAxisLabelHeight");
19340
+ var placedAt = /* @__PURE__ */ __name((labelArg) => labelArg.placed ?? labelArg.coordinate, "placedAt");
19341
+ var moveApart = /* @__PURE__ */ __name((labelsArg, directionArg, labelHeightArg, scaleHeightArg) => {
19342
+ if (labelsArg.length === 0) return;
19343
+ let runStart = 0;
19344
+ let roomBeforeRun = Math.max(0, directionArg === 1 ? scaleHeightArg / 2 - (placedAt(labelsArg[0]) - labelHeightArg / 2) : placedAt(labelsArg[0]) - labelHeightArg / 2 - scaleHeightArg / 2);
19345
+ for (let index = 1; index < labelsArg.length; index++) {
19346
+ const coordinate = placedAt(labelsArg[index]);
19347
+ const previous = placedAt(labelsArg[index - 1]);
19348
+ const overlaps2 = directionArg === 1 ? coordinate > previous - labelHeightArg : coordinate < previous + labelHeightArg;
19349
+ if (!overlaps2) {
19350
+ runStart = index;
19351
+ roomBeforeRun = directionArg === 1 ? previous - labelHeightArg - coordinate : coordinate - (previous + labelHeightArg);
19352
+ continue;
19353
+ }
19354
+ const placed = previous - labelHeightArg * directionArg;
19355
+ labelsArg[index].placed = placed;
19356
+ const edge = placed - directionArg * labelHeightArg / 2;
19357
+ const outside = directionArg === 1 ? edge < 0 : edge > scaleHeightArg;
19358
+ if (outside && roomBeforeRun > 0) {
19359
+ const shift = Math.min(directionArg === 1 ? -1 - edge : edge - scaleHeightArg, roomBeforeRun);
19360
+ for (let later = runStart; later < labelsArg.length; later++) {
19361
+ labelsArg[later].placed = placedAt(labelsArg[later]) + directionArg * shift;
19362
+ }
19363
+ roomBeforeRun -= shift;
19364
+ }
19365
+ }
19366
+ }, "moveApart");
19367
+ var placePriceAxisLabels = /* @__PURE__ */ __name((coordinatesArg, centerArg, labelHeightArg, scaleHeightArg) => {
19368
+ const labels = coordinatesArg.map((coordinate) => ({ coordinate, placed: null }));
19369
+ const above = labels.filter((label) => label.coordinate <= centerArg).sort((a, b2) => b2.coordinate - a.coordinate);
19370
+ const below = labels.filter((label) => label.coordinate > centerArg);
19371
+ if (above.length > 0 && below.length > 0) below.push(above[0]);
19372
+ below.sort((a, b2) => a.coordinate - b2.coordinate);
19373
+ const halfHeight = Math.floor(labelHeightArg / 2);
19374
+ for (const label of labels) {
19375
+ if (label.coordinate > -halfHeight && label.coordinate < halfHeight) label.placed = halfHeight;
19376
+ if (label.coordinate > scaleHeightArg - halfHeight && label.coordinate < scaleHeightArg + halfHeight) {
19377
+ label.placed = scaleHeightArg - halfHeight;
19378
+ }
19379
+ }
19380
+ moveApart(above, 1, labelHeightArg, scaleHeightArg);
19381
+ moveApart(below, -1, labelHeightArg, scaleHeightArg);
19382
+ return labels.map(placedAt);
19383
+ }, "placePriceAxisLabels");
19384
+ var labelCoversTick = /* @__PURE__ */ __name((labelCoordinatesArg, tickArg, labelHeightArg, fontSizeArg) => labelCoordinatesArg.some((label) => Math.abs(tickArg - label) < (labelHeightArg + fontSizeArg) / 2), "labelCoversTick");
19385
+
19331
19386
  // ts_web/elements/00group-chart/dees-chart-area/component.ts
19332
19387
  var _selectedRange_dec, _rangeSelectionEnabled_dec, _chartLines_dec, _frameless_dec6, _compact_dec2, _hideLegend_dec, _legendStats_dec, _autoScrollInterval_dec, _yAxisMax_dec, _yAxisScaling_dec, _realtimeMode_dec, _rollingWindow_dec, _summary_dec, _yAxisFormatter_dec, _series_dec, _meta_dec, _label_dec4, _isFullPage_dec, _seriesStats_dec, _chart_dec, _a30, _DeesChartArea_decorators, _init32, _chart, _seriesStats, _isFullPage, _label4, _meta, _series, _yAxisFormatter, _summary, _rollingWindow, _realtimeMode, _yAxisScaling, _yAxisMax, _autoScrollInterval, _legendStats, _hideLegend, _compact2, _frameless6, _chartLines, _rangeSelectionEnabled, _selectedRange;
19333
19388
  var readSeries = /* @__PURE__ */ __name((data) => {
@@ -19474,6 +19529,22 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
19474
19529
  __publicField(this, "tooltipScrollTargets", []);
19475
19530
  /** Lightweight Charts formats the axis through this one function, which writes with the current `yAxisFormatter`. */
19476
19531
  __publicField(this, "priceFormatter", /* @__PURE__ */ __name((priceArg) => this.yAxisFormatter(priceArg), "priceFormatter"));
19532
+ /**
19533
+ * The price axis's tick labels. The axis draws the reference lines' labels over its tick labels
19534
+ * and leaves a tick label under one in place, so that a tick next to a reference line showed
19535
+ * through between two labels as a cut off value of its own; a tick label a label covers is
19536
+ * left out, its grid line stays.
19537
+ */
19538
+ __publicField(this, "tickmarksPriceFormatter", /* @__PURE__ */ __name((pricesArg) => {
19539
+ const fontSize = this.chart?.options().layout.fontSize ?? 12;
19540
+ const labelHeight = priceAxisLabelHeight(fontSize);
19541
+ const labels = this.priceAxisLabelCoordinates(labelHeight);
19542
+ const first = this.seriesApis.values().next().value;
19543
+ return pricesArg.map((price) => {
19544
+ const coordinate = labels.length > 0 && first ? first.priceToCoordinate(price) : null;
19545
+ return coordinate !== null && labelCoversTick(labels, coordinate, labelHeight, fontSize) ? "" : this.yAxisFormatter(price);
19546
+ });
19547
+ }, "tickmarksPriceFormatter"));
19477
19548
  /**
19478
19549
  * The crosshair's time label, in the time zone and with the 24-hour clock of the time scale
19479
19550
  * (`createZonedTimeScale`): the time alone while the plot shows a single day, with the date
@@ -19869,6 +19940,7 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
19869
19940
  this.applyYAxisScale(chartSeries);
19870
19941
  this.computeStats(chartSeries);
19871
19942
  this.pendingRealtimePrune = false;
19943
+ this.relabelPriceTicks();
19872
19944
  this.fitTimeAxis();
19873
19945
  }
19874
19946
  /**
@@ -19934,6 +20006,7 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
19934
20006
  });
19935
20007
  this.computeStats(chartSeries);
19936
20008
  this.applyYAxisScale(chartSeries);
20009
+ this.relabelPriceTicks();
19937
20010
  }
19938
20011
  applyYAxisScale(series) {
19939
20012
  let minValue = 0;
@@ -20044,6 +20117,36 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
20044
20117
  }
20045
20118
  }
20046
20119
  }
20120
+ /**
20121
+ * Where the price axis draws the reference lines' labels. The axis moves overlapping labels
20122
+ * apart from the first series' last visible value, the way `placePriceAxisLabels` works out.
20123
+ */
20124
+ priceAxisLabelCoordinates(labelHeightArg) {
20125
+ const first = this.seriesApis.values().next().value;
20126
+ if (!this.chart || !first) return [];
20127
+ const coordinates = [];
20128
+ for (const [key, lines] of this.priceLines) {
20129
+ const api = this.seriesApis.get(key);
20130
+ if (!api) continue;
20131
+ for (const line of Object.values(lines)) {
20132
+ const coordinate = api.priceToCoordinate(line.options().price);
20133
+ if (coordinate !== null) coordinates.push(coordinate);
20134
+ }
20135
+ }
20136
+ if (coordinates.length === 0) return [];
20137
+ const range = this.chart.timeScale().getVisibleLogicalRange();
20138
+ const last = range ? first.dataByIndex(Math.ceil(range.to), -1) : null;
20139
+ const center = last && "value" in last ? first.priceToCoordinate(last.value) ?? 0 : 0;
20140
+ return placePriceAxisLabels(coordinates, center, labelHeightArg, this.chart.paneSize().height);
20141
+ }
20142
+ /**
20143
+ * Has the price axis write its tick labels anew, for reference lines that moved or changed:
20144
+ * Lightweight Charts keeps the tick labels it wrote while its price range and height stay,
20145
+ * and writes them anew once its price scale is given options.
20146
+ */
20147
+ relabelPriceTicks() {
20148
+ this.chart?.priceScale("right").applyOptions({});
20149
+ }
20047
20150
  /**
20048
20151
  * Whether a new `yAxisFormatter` writes other text than the one it replaces, for the values the
20049
20152
  * chart writes with it: across the price axis's visible range and the series' statistics. A
@@ -20171,7 +20274,11 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
20171
20274
  this.timeLabelsIn = this.currentTimeLabels();
20172
20275
  this.chart = this.lcBundle.createChartEx(chartContainer, createZonedTimeScale(this.lcBundle, () => this.t.format), {
20173
20276
  autoSize: true,
20174
- localization: { priceFormatter: this.priceFormatter, timeFormatter: this.crosshairTimeFormatter },
20277
+ localization: {
20278
+ priceFormatter: this.priceFormatter,
20279
+ tickmarksPriceFormatter: this.tickmarksPriceFormatter,
20280
+ timeFormatter: this.crosshairTimeFormatter
20281
+ },
20175
20282
  layout: {
20176
20283
  background: { type: this.lcBundle.ColorType.Solid, color: "transparent" },
20177
20284
  textColor: getThemeColors(this.goBright).textSecondary,
@@ -20394,6 +20501,7 @@ var _DeesChartArea = class _DeesChartArea extends (_a30 = DeesElement, _chart_de
20394
20501
  if (!api) return;
20395
20502
  this.updatePriceLines(seriesKey, api, s.data, this.resolveSeriesColor(s, index, isDark));
20396
20503
  });
20504
+ this.relabelPriceTicks();
20397
20505
  }
20398
20506
  startAutoScroll() {
20399
20507
  if (this.autoScrollTimer !== null) return;
@@ -43649,6 +43757,18 @@ var harnessSidebarStyles = i`
43649
43757
  // ts_web/elements/00group-harness/harness.helpers.ts
43650
43758
  var harnessMaxAttachmentBytes = 10 * 1024 * 1024;
43651
43759
  var harnessMaxTotalAttachmentBytes = 30 * 1024 * 1024;
43760
+ var harnessProposalState = /* @__PURE__ */ __name((requestArg, responseArg = requestArg.response) => {
43761
+ if (requestArg.state && requestArg.state !== "pending") return requestArg.state;
43762
+ if (responseArg === void 0) return requestArg.outcome?.tone === "running" ? "confirmed" : "pending";
43763
+ return responseArg[0] === "confirm" ? "confirmed" : "declined";
43764
+ }, "harnessProposalState");
43765
+ var harnessQuestionPending = /* @__PURE__ */ __name((requestArg) => requestArg.kind === "proposal" ? harnessProposalState(requestArg) === "pending" : requestArg.response === void 0, "harnessQuestionPending");
43766
+ var SEVERITY_RANK = { info: 0, warning: 1, danger: 2 };
43767
+ var harnessQuestionSeverity = /* @__PURE__ */ __name((requestArg) => (requestArg.items ?? []).reduce(
43768
+ (highest, item) => SEVERITY_RANK[item.severity ?? "info"] > SEVERITY_RANK[highest] ? item.severity : highest,
43769
+ requestArg.severity ?? "info"
43770
+ ), "harnessQuestionSeverity");
43771
+ var harnessWithoutCredentials = /* @__PURE__ */ __name((requestArg) => requestArg.items?.some((item) => item.credential !== void 0) ? { ...requestArg, items: requestArg.items.map(({ credential: _credential, ...item }) => item) } : requestArg, "harnessWithoutCredentials");
43652
43772
  var harnessCanWithdrawPending = /* @__PURE__ */ __name((messageArg) => messageArg.role === "user" && (messageArg.pending === "queued" || messageArg.pending === "held") && messageArg.pendingActionAvailable === true, "harnessCanWithdrawPending");
43653
43773
  var harnessSupportedImageTypes = /* @__PURE__ */ new Set([
43654
43774
  "image/png",
@@ -48473,6 +48593,174 @@ var demoFunc42 = /* @__PURE__ */ __name(() => demoPage("Permissions", "Review th
48473
48593
  </div>
48474
48594
  `), "demoFunc");
48475
48595
 
48596
+ // ts_web/elements/00group-harness/harness.records.ts
48597
+ var harnessRecordsShown = 5;
48598
+ var OUTCOME_ICON = {
48599
+ running: "lucide:LoaderCircle",
48600
+ success: "lucide:CircleCheck",
48601
+ warning: "lucide:TriangleAlert",
48602
+ error: "lucide:CircleX",
48603
+ neutral: "lucide:Info"
48604
+ };
48605
+ var harnessRecordStyles = i`
48606
+ .items {
48607
+ list-style: none;
48608
+ margin: 12px 0;
48609
+ padding: 0;
48610
+ border: var(--dees-line-width-hairline) solid var(--dees-color-control-border);
48611
+ border-radius: var(--dees-radius-lg);
48612
+ background: var(--dees-color-control-bg);
48613
+ font-size: 12px;
48614
+ }
48615
+
48616
+ .item {
48617
+ display: grid;
48618
+ gap: 4px;
48619
+ padding: 8px 12px;
48620
+ min-width: 0;
48621
+ }
48622
+
48623
+ .item + .item {
48624
+ border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
48625
+ }
48626
+
48627
+ .itemHead {
48628
+ display: flex;
48629
+ align-items: center;
48630
+ gap: var(--dees-spacing-sm);
48631
+ min-width: 0;
48632
+ }
48633
+
48634
+ .itemLabel {
48635
+ flex: 1;
48636
+ min-width: 0;
48637
+ color: var(--dees-color-text-primary);
48638
+ font-weight: 500;
48639
+ overflow-wrap: anywhere;
48640
+ }
48641
+
48642
+ a.itemLabel {
48643
+ color: var(--dees-color-accent-primary);
48644
+ text-decoration: none;
48645
+ border-radius: var(--dees-radius-xs);
48646
+ }
48647
+
48648
+ a.itemLabel:hover {
48649
+ text-decoration: underline;
48650
+ }
48651
+
48652
+ a.itemLabel:focus-visible {
48653
+ outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
48654
+ outline-offset: 2px;
48655
+ }
48656
+
48657
+ .changes {
48658
+ display: grid;
48659
+ grid-template-columns: auto minmax(0, 1fr);
48660
+ gap: var(--dees-spacing-2xs) var(--dees-spacing-md);
48661
+ margin: 0;
48662
+ }
48663
+
48664
+ .changes dt {
48665
+ color: var(--dees-color-text-secondary);
48666
+ white-space: nowrap;
48667
+ }
48668
+
48669
+ .changes dd {
48670
+ margin: 0;
48671
+ color: var(--dees-color-text-primary);
48672
+ overflow-wrap: anywhere;
48673
+ }
48674
+
48675
+ .before {
48676
+ color: var(--dees-color-text-secondary);
48677
+ text-decoration: line-through;
48678
+ }
48679
+
48680
+ .arrow {
48681
+ margin: 0 4px;
48682
+ color: var(--dees-color-text-secondary);
48683
+ }
48684
+
48685
+ .moreItems {
48686
+ margin: -4px 0 12px;
48687
+ padding: 0;
48688
+ border: none;
48689
+ background: none;
48690
+ color: var(--dees-color-accent-primary);
48691
+ font: inherit;
48692
+ font-size: var(--dees-font-caption1-size, 11px);
48693
+ cursor: pointer;
48694
+ border-radius: var(--dees-radius-xs);
48695
+ }
48696
+
48697
+ .moreItems:hover {
48698
+ text-decoration: underline;
48699
+ }
48700
+
48701
+ .outcome {
48702
+ display: inline-flex;
48703
+ align-items: center;
48704
+ gap: 6px;
48705
+ min-width: 0;
48706
+ color: var(--dees-color-text-secondary);
48707
+ font-size: var(--dees-font-caption1-size, 11px);
48708
+ overflow-wrap: anywhere;
48709
+ }
48710
+
48711
+ .item .outcome {
48712
+ flex: 0 1 auto;
48713
+ }
48714
+
48715
+ .outcome dees-icon {
48716
+ flex: 0 0 auto;
48717
+ }
48718
+
48719
+ .outcome.tone-running dees-icon { color: var(--dees-color-accent-primary); }
48720
+ .outcome.tone-success dees-icon { color: var(--dees-color-accent-success); }
48721
+ .outcome.tone-warning dees-icon { color: var(--dees-color-accent-warning); }
48722
+ .outcome.tone-error dees-icon { color: var(--dees-color-accent-error); }
48723
+ .outcome.tone-error { color: var(--dees-color-text-primary); }
48724
+
48725
+ .srOnly { ${visuallyHidden} }
48726
+ `;
48727
+ var harnessShownRecords = /* @__PURE__ */ __name((recordsArg, expandedArg) => expandedArg || recordsArg.length <= harnessRecordsShown ? recordsArg : recordsArg.slice(0, harnessRecordsShown), "harnessShownRecords");
48728
+ var renderHarnessMoreRecords = /* @__PURE__ */ __name((tArg, countArg, expandedArg, toggleArg) => {
48729
+ const hidden = countArg - harnessRecordsShown;
48730
+ if (hidden <= 0) return "";
48731
+ return b`
48732
+ <button class="moreItems" type="button" aria-expanded=${expandedArg ? "true" : "false"} @click=${toggleArg}>
48733
+ ${expandedArg ? tArg("permission.fewerItems") : tArg("permission.moreItems", { count: hidden })}
48734
+ </button>
48735
+ `;
48736
+ }, "renderHarnessMoreRecords");
48737
+ var renderHarnessChanges = /* @__PURE__ */ __name((tArg, changesArg) => b`
48738
+ <dl class="changes">
48739
+ ${changesArg.map((change) => b`
48740
+ <dt>${change.label}</dt>
48741
+ <dd>
48742
+ <span aria-hidden="true">${change.before !== void 0 ? b`<span class="before">${change.before}</span><span class="arrow">→</span>` : ""}<span class="after">${change.after}</span></span>
48743
+ <span class="srOnly">${change.before !== void 0 ? tArg("permission.change", { label: change.label, before: change.before, after: change.after }) : tArg("permission.changeNew", { label: change.label, after: change.after })}</span>
48744
+ </dd>
48745
+ `)}
48746
+ </dl>
48747
+ `, "renderHarnessChanges");
48748
+ var renderHarnessOutcome = /* @__PURE__ */ __name((outcomeArg) => b`
48749
+ <span class="outcome tone-${outcomeArg.tone}" role="status">
48750
+ <dees-icon
48751
+ class=${outcomeArg.tone === "running" ? "harnessActivity" : ""}
48752
+ icon=${OUTCOME_ICON[outcomeArg.tone]}
48753
+ iconSize="13"
48754
+ aria-hidden="true"
48755
+ ></dees-icon>
48756
+ <span>${outcomeArg.text}</span>
48757
+ </span>
48758
+ `, "renderHarnessOutcome");
48759
+ var routeHarnessRecordLink = /* @__PURE__ */ __name((eventArg, dispatchArg) => {
48760
+ if (eventArg.button !== 0 || eventArg.metaKey || eventArg.ctrlKey || eventArg.shiftKey || eventArg.altKey) return;
48761
+ if (!dispatchArg()) eventArg.preventDefault();
48762
+ }, "routeHarnessRecordLink");
48763
+
48476
48764
  // ts_web/elements/00group-harness/dees-harness-permission-card/dees-harness-permission-card.ts
48477
48765
  var _itemsExpanded_dec, _answered_dec, _remember_dec, _viewState_dec5, _busy_dec, _request_dec, _a62, _DeesHarnessPermissionCard_decorators, _init64, _request, _busy, _viewState5, _remember, _answered, _itemsExpanded;
48478
48766
  var badgeTypeForPermission = /* @__PURE__ */ __name((permissionType) => {
@@ -48491,14 +48779,6 @@ var DEFAULT_EMPHASIS = {
48491
48779
  reject: "destructive"
48492
48780
  };
48493
48781
  var BUTTON_TYPE = { accent: "accent", plain: "default", destructive: "destructive" };
48494
- var OUTCOME_ICON = {
48495
- running: "lucide:LoaderCircle",
48496
- success: "lucide:CircleCheck",
48497
- warning: "lucide:TriangleAlert",
48498
- error: "lucide:CircleX",
48499
- neutral: "lucide:Info"
48500
- };
48501
- var ITEMS_SHOWN = 5;
48502
48782
  _DeesHarnessPermissionCard_decorators = [customElement("dees-harness-permission-card")];
48503
48783
  var _DeesHarnessPermissionCard = class _DeesHarnessPermissionCard extends (_a62 = DeesElement, _request_dec = [n({ attribute: false })], _busy_dec = [n({ type: Boolean, reflect: true })], _viewState_dec5 = [n({ attribute: false })], _remember_dec = [r2()], _answered_dec = [r2()], _itemsExpanded_dec = [r2()], _a62) {
48504
48784
  constructor() {
@@ -48553,7 +48833,7 @@ var _DeesHarnessPermissionCard = class _DeesHarnessPermissionCard extends (_a62
48553
48833
  </div>
48554
48834
  ` : ""}
48555
48835
  <div class="actions">
48556
- ${this.effectiveResponse ? request.outcome ? this.renderOutcome(request.outcome) : b`<span class="answeredNote">${this.t(this.rememberable && this.effectiveRemember ? "permission.answeredRemembered" : "permission.answered", {
48836
+ ${this.effectiveResponse ? request.outcome ? renderHarnessOutcome(request.outcome) : b`<span class="answeredNote">${this.t(this.rememberable && this.effectiveRemember ? "permission.answeredRemembered" : "permission.answered", {
48557
48837
  response: this.responseWords(this.effectiveResponse)
48558
48838
  })}</span>` : b`
48559
48839
  ${this.actions.map((action) => b`
@@ -48589,52 +48869,19 @@ var _DeesHarnessPermissionCard = class _DeesHarnessPermissionCard extends (_a62
48589
48869
  renderItems(itemsArg) {
48590
48870
  if (itemsArg.length === 0) return "";
48591
48871
  const expanded = this.effectiveItemsExpanded;
48592
- const shown = expanded || itemsArg.length <= ITEMS_SHOWN ? itemsArg : itemsArg.slice(0, ITEMS_SHOWN);
48593
- const hidden = itemsArg.length - ITEMS_SHOWN;
48594
48872
  return b`
48595
48873
  <ul class="items" aria-label=${this.t("permission.items")}>
48596
- ${shown.map((item) => b`
48874
+ ${harnessShownRecords(itemsArg, expanded).map((item) => b`
48597
48875
  <li class="item">
48598
48876
  <div class="itemHead">
48599
48877
  ${item.href ? b`<a class="itemLabel" href=${item.href} @click=${(event) => this.openItem(event, item)}>${item.label}</a>` : b`<span class="itemLabel">${item.label}</span>`}
48600
- ${item.outcome ? this.renderOutcome(item.outcome) : ""}
48878
+ ${item.outcome ? renderHarnessOutcome(item.outcome) : ""}
48601
48879
  </div>
48602
- ${item.changes?.length ? this.renderChanges(item.changes) : ""}
48880
+ ${item.changes?.length ? renderHarnessChanges(this.t, item.changes) : ""}
48603
48881
  </li>
48604
48882
  `)}
48605
48883
  </ul>
48606
- ${hidden > 0 ? b`
48607
- <button class="moreItems" type="button" aria-expanded=${expanded ? "true" : "false"} @click=${this.toggleItems}>
48608
- ${expanded ? this.t("permission.fewerItems") : this.t("permission.moreItems", { count: hidden })}
48609
- </button>
48610
- ` : ""}
48611
- `;
48612
- }
48613
- /** What changes in a record: each field, its value before struck through, and after. */
48614
- renderChanges(changesArg) {
48615
- return b`
48616
- <dl class="changes">
48617
- ${changesArg.map((change) => b`
48618
- <dt>${change.label}</dt>
48619
- <dd>
48620
- <span aria-hidden="true">${change.before !== void 0 ? b`<span class="before">${change.before}</span><span class="arrow">→</span>` : ""}<span class="after">${change.after}</span></span>
48621
- <span class="srOnly">${change.before !== void 0 ? this.t("permission.change", { label: change.label, before: change.before, after: change.after }) : this.t("permission.changeNew", { label: change.label, after: change.after })}</span>
48622
- </dd>
48623
- `)}
48624
- </dl>
48625
- `;
48626
- }
48627
- renderOutcome(outcomeArg) {
48628
- return b`
48629
- <span class="outcome tone-${outcomeArg.tone}" role="status">
48630
- <dees-icon
48631
- class=${outcomeArg.tone === "running" ? "harnessActivity" : ""}
48632
- icon=${OUTCOME_ICON[outcomeArg.tone]}
48633
- iconSize="13"
48634
- aria-hidden="true"
48635
- ></dees-icon>
48636
- <span>${outcomeArg.text}</span>
48637
- </span>
48884
+ ${renderHarnessMoreRecords(this.t, itemsArg.length, expanded, this.toggleItems)}
48638
48885
  `;
48639
48886
  }
48640
48887
  /** An answer as the answered note names it: the host's words for it where it gave them. */
@@ -48644,14 +48891,12 @@ var _DeesHarnessPermissionCard = class _DeesHarnessPermissionCard extends (_a62
48644
48891
  }
48645
48892
  /** A record's link: the host may route it itself (it cancels the event); a plain or modified click otherwise follows it. */
48646
48893
  openItem(eventArg, itemArg) {
48647
- if (eventArg.button !== 0 || eventArg.metaKey || eventArg.ctrlKey || eventArg.shiftKey || eventArg.altKey) return;
48648
- const proceed = this.dispatchEvent(new CustomEvent("harness-permission-link", {
48894
+ routeHarnessRecordLink(eventArg, () => this.dispatchEvent(new CustomEvent("harness-permission-link", {
48649
48895
  detail: { requestId: this.request.id, item: itemArg, request: this.request },
48650
48896
  bubbles: true,
48651
48897
  composed: true,
48652
48898
  cancelable: true
48653
- }));
48654
- if (!proceed) eventArg.preventDefault();
48899
+ })));
48655
48900
  }
48656
48901
  respond(response) {
48657
48902
  if (this.busy || this.effectiveResponse !== void 0) return;
@@ -48707,6 +48952,7 @@ __publicField(_DeesHarnessPermissionCard, "styles", [
48707
48952
  cssManager.defaultStyles,
48708
48953
  harnessControlStyles,
48709
48954
  harnessActivityStyles,
48955
+ harnessRecordStyles,
48710
48956
  i`
48711
48957
  :host {
48712
48958
  display: block;
@@ -48799,127 +49045,6 @@ __publicField(_DeesHarnessPermissionCard, "styles", [
48799
49045
  line-height: 1.5;
48800
49046
  overflow-wrap: anywhere;
48801
49047
  }
48802
-
48803
- .items {
48804
- list-style: none;
48805
- margin: 12px 0;
48806
- padding: 0;
48807
- border: var(--dees-line-width-hairline) solid var(--dees-color-control-border);
48808
- border-radius: var(--dees-radius-lg);
48809
- background: var(--dees-color-control-bg);
48810
- font-size: 12px;
48811
- }
48812
-
48813
- .item {
48814
- display: grid;
48815
- gap: 4px;
48816
- padding: 8px 12px;
48817
- min-width: 0;
48818
- }
48819
-
48820
- .item + .item {
48821
- border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
48822
- }
48823
-
48824
- .itemHead {
48825
- display: flex;
48826
- align-items: center;
48827
- gap: var(--dees-spacing-sm);
48828
- min-width: 0;
48829
- }
48830
-
48831
- .itemLabel {
48832
- flex: 1;
48833
- min-width: 0;
48834
- color: var(--dees-color-text-primary);
48835
- font-weight: 500;
48836
- overflow-wrap: anywhere;
48837
- }
48838
-
48839
- a.itemLabel {
48840
- color: var(--dees-color-accent-primary);
48841
- text-decoration: none;
48842
- border-radius: var(--dees-radius-xs);
48843
- }
48844
-
48845
- a.itemLabel:hover {
48846
- text-decoration: underline;
48847
- }
48848
-
48849
- a.itemLabel:focus-visible {
48850
- outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
48851
- outline-offset: 2px;
48852
- }
48853
-
48854
- .changes {
48855
- display: grid;
48856
- grid-template-columns: auto minmax(0, 1fr);
48857
- gap: var(--dees-spacing-2xs) var(--dees-spacing-md);
48858
- margin: 0;
48859
- }
48860
-
48861
- .changes dt {
48862
- color: var(--dees-color-text-secondary);
48863
- white-space: nowrap;
48864
- }
48865
-
48866
- .changes dd {
48867
- margin: 0;
48868
- color: var(--dees-color-text-primary);
48869
- overflow-wrap: anywhere;
48870
- }
48871
-
48872
- .before {
48873
- color: var(--dees-color-text-secondary);
48874
- text-decoration: line-through;
48875
- }
48876
-
48877
- .arrow {
48878
- margin: 0 4px;
48879
- color: var(--dees-color-text-secondary);
48880
- }
48881
-
48882
- .moreItems {
48883
- margin: -4px 0 12px;
48884
- padding: 0;
48885
- border: none;
48886
- background: none;
48887
- color: var(--dees-color-accent-primary);
48888
- font: inherit;
48889
- font-size: var(--dees-font-caption1-size, 11px);
48890
- cursor: pointer;
48891
- border-radius: var(--dees-radius-xs);
48892
- }
48893
-
48894
- .moreItems:hover {
48895
- text-decoration: underline;
48896
- }
48897
-
48898
- .outcome {
48899
- display: inline-flex;
48900
- align-items: center;
48901
- gap: 6px;
48902
- min-width: 0;
48903
- color: var(--dees-color-text-secondary);
48904
- font-size: var(--dees-font-caption1-size, 11px);
48905
- overflow-wrap: anywhere;
48906
- }
48907
-
48908
- .item .outcome {
48909
- flex: 0 1 auto;
48910
- }
48911
-
48912
- .outcome dees-icon {
48913
- flex: 0 0 auto;
48914
- }
48915
-
48916
- .outcome.tone-running dees-icon { color: var(--dees-color-accent-primary); }
48917
- .outcome.tone-success dees-icon { color: var(--dees-color-accent-success); }
48918
- .outcome.tone-warning dees-icon { color: var(--dees-color-accent-warning); }
48919
- .outcome.tone-error dees-icon { color: var(--dees-color-accent-error); }
48920
- .outcome.tone-error { color: var(--dees-color-text-primary); }
48921
-
48922
- .srOnly { ${visuallyHidden} }
48923
49048
  `
48924
49049
  ]);
48925
49050
  __runInitializers(_init64, 1, _DeesHarnessPermissionCard);
@@ -49582,13 +49707,182 @@ var DeesHarnessStatus = _DeesHarnessStatus;
49582
49707
  // ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.demo.ts
49583
49708
  var logResponse2 = /* @__PURE__ */ __name((event) => {
49584
49709
  const card = event.target;
49585
- card.request = { ...card.request, response: event.detail.answers, respondedAt: Date.now() };
49710
+ card.request = {
49711
+ ...card.request,
49712
+ response: event.detail.answers,
49713
+ respondedAt: Date.now(),
49714
+ declinedItemIds: event.detail.declinedItemIds
49715
+ };
49586
49716
  showDemoResult(event.currentTarget, event.detail);
49587
49717
  }, "logResponse");
49588
- var demoFunc44 = /* @__PURE__ */ __name(() => demoPage("Questions", "Single choices, multiple choices and written answers.", b`
49589
- <div class="questionDemo dees-demo-stack" @harness-question-response=${logResponse2}>
49590
- <dees-harness-question-card
49591
- .request=${{
49718
+ var runProposal = /* @__PURE__ */ __name((event) => {
49719
+ logResponse2(event);
49720
+ const card = event.target;
49721
+ if (event.detail.answers[0] !== "confirm") return;
49722
+ card.request = { ...card.request, outcome: { tone: "running", text: "Making the changes\u2026" } };
49723
+ setTimeout(() => {
49724
+ card.request = { ...card.request, outcome: { tone: "success", text: "Changes made" } };
49725
+ }, 1500);
49726
+ }, "runProposal");
49727
+ var routeLink = /* @__PURE__ */ __name((event) => {
49728
+ event.preventDefault();
49729
+ showDemoResult(event.currentTarget, { link: event.detail.item.label, requestId: event.detail.requestId });
49730
+ }, "routeLink");
49731
+ var invoices2 = /* @__PURE__ */ __name((countArg) => Array.from({ length: countArg }, (_, index) => {
49732
+ const number = `R-2026-01${String(40 + index).padStart(2, "0")}`;
49733
+ return {
49734
+ id: `invoice-${number}`,
49735
+ summary: "Books it to 8400 Revenue",
49736
+ label: `Invoice ${number}`,
49737
+ href: "#",
49738
+ changes: [{ label: "Status", before: "Draft", after: "Booked" }]
49739
+ };
49740
+ }), "invoices");
49741
+ var proposals = [
49742
+ {
49743
+ id: "p-single",
49744
+ kind: "proposal",
49745
+ question: "Create this customer?",
49746
+ items: [{
49747
+ id: "customer",
49748
+ summary: "Creates the customer, ready for invoices",
49749
+ changes: [{ label: "Name", after: "Lindqvist Design AB" }, { label: "Country", after: "Sweden" }]
49750
+ }]
49751
+ },
49752
+ {
49753
+ id: "p-warning",
49754
+ kind: "proposal",
49755
+ severity: "warning",
49756
+ question: "Archive the project Q3 Campaign?",
49757
+ items: [{ id: "project", summary: "Archives the project and its 14 tasks; it can be restored for 30 days", label: "Q3 Campaign", href: "#" }]
49758
+ },
49759
+ {
49760
+ id: "p-danger",
49761
+ kind: "proposal",
49762
+ severity: "danger",
49763
+ question: "Change the account every future payout goes to?",
49764
+ confirmLabel: "Change account",
49765
+ items: [{
49766
+ id: "payout-account",
49767
+ summary: "Sends every future payout to the new account",
49768
+ label: "Payout settings",
49769
+ href: "#",
49770
+ changes: [
49771
+ { label: "IBAN", before: "DE89 3704 0044 0532 0130 00", after: "DE02 1203 0000 0000 2020 51" },
49772
+ { label: "Account holder", before: "Acme GmbH", after: "Acme Holding GmbH" }
49773
+ ]
49774
+ }]
49775
+ },
49776
+ {
49777
+ id: "p-mixed",
49778
+ kind: "proposal",
49779
+ question: "Tidy up the customer Nordwind GmbH?",
49780
+ items: [
49781
+ {
49782
+ id: "contact",
49783
+ summary: "Merges the duplicate contact into the customer",
49784
+ label: "Contact Nordwind GmbH (2)",
49785
+ href: "#"
49786
+ },
49787
+ {
49788
+ id: "terms",
49789
+ severity: "warning",
49790
+ summary: "Shortens the payment terms; open invoices keep theirs",
49791
+ label: "Customer Nordwind GmbH",
49792
+ href: "#",
49793
+ changes: [{ label: "Payment terms", before: "30 days", after: "14 days" }]
49794
+ },
49795
+ {
49796
+ id: "draft",
49797
+ severity: "danger",
49798
+ summary: "Deletes the unsent draft invoice",
49799
+ label: "Invoice R-2026-0098",
49800
+ href: "#"
49801
+ }
49802
+ ]
49803
+ },
49804
+ {
49805
+ id: "p-several",
49806
+ kind: "proposal",
49807
+ question: "Book these six invoices?",
49808
+ itemsDeclinable: true,
49809
+ items: invoices2(6)
49810
+ }
49811
+ ];
49812
+ var decided = [
49813
+ {
49814
+ id: "p-running",
49815
+ kind: "proposal",
49816
+ question: "Send a payment reminder to three customers?",
49817
+ items: [{ id: "reminders", summary: "Sends the reminder by e-mail to Lindqvist Design AB, Nordwind GmbH and Kaya Studio" }],
49818
+ response: ["confirm"],
49819
+ outcome: { tone: "running", text: "Sending 3 reminders\u2026" }
49820
+ },
49821
+ {
49822
+ id: "p-confirmed",
49823
+ kind: "proposal",
49824
+ question: "Book these three invoices?",
49825
+ itemsDeclinable: true,
49826
+ items: invoices2(3).map((item) => item.id === "invoice-R-2026-0141" ? item : { ...item, outcome: { tone: "success", text: "Booked" } }),
49827
+ response: ["confirm"],
49828
+ declinedItemIds: ["invoice-R-2026-0141"],
49829
+ outcome: { tone: "success", text: "2 invoices booked, 1 left out" }
49830
+ },
49831
+ {
49832
+ id: "p-credential",
49833
+ kind: "proposal",
49834
+ severity: "warning",
49835
+ question: "Issue an API key for the accounting export?",
49836
+ items: [{
49837
+ id: "api-key",
49838
+ summary: "Issues a key that reads invoices and bookings, valid for a year",
49839
+ label: "Accounting export",
49840
+ href: "#",
49841
+ outcome: { tone: "success", text: "Issued" },
49842
+ credential: { label: "API key", value: "demo_key_7Hq2-x9Lw-4Rt8-Kd3m-Vb6n", note: "Shown once: store it now. Only you can see it; the agent is not shown it." }
49843
+ }],
49844
+ response: ["confirm"],
49845
+ outcome: { tone: "success", text: "API key issued" }
49846
+ },
49847
+ {
49848
+ id: "p-declined",
49849
+ kind: "proposal",
49850
+ severity: "danger",
49851
+ question: "Delete the draft offer A-2026-0031?",
49852
+ items: [{ id: "offer", summary: "Deletes the draft and its 3 attachments", label: "Offer A-2026-0031", href: "#" }],
49853
+ response: ["decline"]
49854
+ },
49855
+ {
49856
+ id: "p-expired",
49857
+ kind: "proposal",
49858
+ severity: "warning",
49859
+ question: "Pay the supplier invoice E-4471 today?",
49860
+ items: [{ id: "payment", summary: "Transfers 2,480.00 \u20AC to Nordwind GmbH", label: "Invoice E-4471", href: "#" }],
49861
+ state: "expired",
49862
+ outcome: { tone: "neutral", text: "The conversation ended before an answer." }
49863
+ },
49864
+ {
49865
+ id: "p-failed",
49866
+ kind: "proposal",
49867
+ question: "Rename the account 1200?",
49868
+ items: [{
49869
+ id: "account",
49870
+ summary: "Renames the account in the chart of accounts",
49871
+ label: "Account 1200",
49872
+ href: "#",
49873
+ changes: [{ label: "Name", before: "Bank", after: "Bank \u2014 Sparkasse" }],
49874
+ outcome: { tone: "error", text: "Not changed" }
49875
+ }],
49876
+ response: ["confirm"],
49877
+ state: "failed",
49878
+ outcome: { tone: "error", text: "The ledger refused the change: account 1200 is locked for the closed year 2025." }
49879
+ }
49880
+ ];
49881
+ var demoFunc44 = /* @__PURE__ */ __name(() => demoPage("Questions", "Questions the agent asks, and changes it proposes that wait for a confirmation.", b`
49882
+ ${demoSection("Questions", "Single choices, multiple choices and written answers.", b`
49883
+ <div class="questionDemo dees-demo-stack" @harness-question-response=${logResponse2}>
49884
+ <dees-harness-question-card
49885
+ .request=${{
49592
49886
  id: "q1",
49593
49887
  question: "Which database should the new service use?",
49594
49888
  createdAt: Date.now(),
@@ -49598,9 +49892,9 @@ var demoFunc44 = /* @__PURE__ */ __name(() => demoPage("Questions", "Single choi
49598
49892
  { label: "SQLite", description: "Embedded, zero ops" }
49599
49893
  ]
49600
49894
  }}
49601
- ></dees-harness-question-card>
49602
- <dees-harness-question-card
49603
- .request=${{
49895
+ ></dees-harness-question-card>
49896
+ <dees-harness-question-card
49897
+ .request=${{
49604
49898
  id: "q2",
49605
49899
  question: "Which environments should the rollout include?",
49606
49900
  multiSelect: true,
@@ -49611,39 +49905,76 @@ var demoFunc44 = /* @__PURE__ */ __name(() => demoPage("Questions", "Single choi
49611
49905
  { label: "production-us" }
49612
49906
  ]
49613
49907
  }}
49614
- ></dees-harness-question-card>
49615
- <dees-harness-question-card
49616
- .request=${{
49908
+ ></dees-harness-question-card>
49909
+ <dees-harness-question-card
49910
+ .request=${{
49911
+ id: "q-warning",
49912
+ severity: "warning",
49913
+ question: "The import brings its own tax settings. Replace the current ones?",
49914
+ allowCustom: false,
49915
+ options: [
49916
+ { label: "Replace them", description: "The imported rates apply from the next booking on" },
49917
+ { label: "Keep the current ones" }
49918
+ ]
49919
+ }}
49920
+ ></dees-harness-question-card>
49921
+ <dees-harness-question-card
49922
+ .request=${{
49617
49923
  id: "q3",
49618
49924
  question: "Anything else I should know before migrating?",
49619
49925
  options: []
49620
49926
  }}
49621
- ></dees-harness-question-card>
49622
- <dees-harness-question-card
49623
- busy
49624
- .request=${{
49927
+ ></dees-harness-question-card>
49928
+ <dees-harness-question-card
49929
+ busy
49930
+ .request=${{
49625
49931
  id: "q-busy",
49626
49932
  question: "Waiting for the runtime \u2014 which region?",
49627
49933
  options: [{ label: "eu-central" }, { label: "us-east" }]
49628
49934
  }}
49629
- ></dees-harness-question-card>
49630
- <dees-harness-question-card
49631
- .request=${{
49935
+ ></dees-harness-question-card>
49936
+ <dees-harness-question-card
49937
+ .request=${{
49632
49938
  id: "q4",
49633
49939
  question: "Which framework for the admin UI?",
49634
49940
  options: [{ label: "Lit" }, { label: "React" }],
49635
49941
  response: ["Lit"],
49636
49942
  respondedAt: Date.now() - 6e4
49637
49943
  }}
49638
- ></dees-harness-question-card>
49944
+ ></dees-harness-question-card>
49945
+ </div>
49639
49946
  ${demoOutput()}
49640
- </div>
49947
+ `)}
49948
+ ${demoSection("Proposals", "A change the agent makes once confirmed: a single one, one that asks for care, one that cannot be taken back, several collected into one decision (the most serious change sets the card's colour), and several the reader may leave single ones out of.", b`
49949
+ <div class="dees-demo-stack" @harness-question-response=${runProposal} @harness-question-link=${routeLink}>
49950
+ ${proposals.map((request) => b`<dees-harness-question-card .request=${request}></dees-harness-question-card>`)}
49951
+ </div>
49952
+ ${demoOutput()}
49953
+ `)}
49954
+ ${demoSection("Decided proposals", "Read-only once decided: confirmed and under way, confirmed with a change left out, confirmed with a secret only the reader sees, declined, expired, failed.", b`
49955
+ <div class="dees-demo-stack" @harness-question-link=${routeLink}>
49956
+ ${decided.map((request) => b`<dees-harness-question-card .request=${request}></dees-harness-question-card>`)}
49957
+ </div>
49958
+ ${demoOutput()}
49959
+ `)}
49641
49960
  `), "demoFunc");
49642
49961
 
49643
49962
  // ts_web/elements/00group-harness/dees-harness-question-card/dees-harness-question-card.ts
49644
- var _customText_dec, _selected_dec, _answered_dec2, _viewState_dec6, _busy_dec2, _request_dec2, _a64, _DeesHarnessQuestionCard_decorators, _init66, _request2, _busy2, _viewState6, _answered2, _selected, _customText;
49963
+ var _copyFeedback_dec2, _credentialsShown_dec, _leftOut_dec, _itemsExpanded_dec2, _customText_dec, _selected_dec, _answered_dec2, _viewState_dec6, _busy_dec2, _request_dec2, _a64, _DeesHarnessQuestionCard_decorators, _init66, _request2, _busy2, _viewState6, _answered2, _selected, _customText, _itemsExpanded2, _leftOut, _credentialsShown, _copyFeedback2;
49964
+ var titleIcon = /* @__PURE__ */ __name((kindArg, severityArg) => severityArg === "danger" ? "lucide:OctagonAlert" : severityArg === "warning" ? "lucide:TriangleAlert" : kindArg === "proposal" ? "lucide:ListChecks" : "lucide:MessageCircleQuestionMark", "titleIcon");
49965
+ var ITEM_ICON = {
49966
+ warning: "lucide:TriangleAlert",
49967
+ danger: "lucide:OctagonAlert"
49968
+ };
49969
+ var CREDENTIAL_MASK = "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022";
49970
+ var STATE_BADGE = {
49971
+ confirmed: "success",
49972
+ declined: "default",
49973
+ expired: "default",
49974
+ failed: "error"
49975
+ };
49645
49976
  _DeesHarnessQuestionCard_decorators = [customElement("dees-harness-question-card")];
49646
- var _DeesHarnessQuestionCard = class _DeesHarnessQuestionCard extends (_a64 = DeesElement, _request_dec2 = [n({ attribute: false })], _busy_dec2 = [n({ type: Boolean, reflect: true })], _viewState_dec6 = [n({ attribute: false })], _answered_dec2 = [r2()], _selected_dec = [r2()], _customText_dec = [r2()], _a64) {
49977
+ var _DeesHarnessQuestionCard = class _DeesHarnessQuestionCard extends (_a64 = DeesElement, _request_dec2 = [n({ attribute: false })], _busy_dec2 = [n({ type: Boolean, reflect: true })], _viewState_dec6 = [n({ attribute: false })], _answered_dec2 = [r2()], _selected_dec = [r2()], _customText_dec = [r2()], _itemsExpanded_dec2 = [r2()], _leftOut_dec = [r2()], _credentialsShown_dec = [r2()], _copyFeedback_dec2 = [r2()], _a64) {
49647
49978
  constructor() {
49648
49979
  super(...arguments);
49649
49980
  __publicField(this, "t", dcLocalize(this));
@@ -49653,90 +49984,282 @@ var _DeesHarnessQuestionCard = class _DeesHarnessQuestionCard extends (_a64 = De
49653
49984
  __privateAdd(this, _answered2, __runInitializers(_init66, 20, this)), __runInitializers(_init66, 23, this);
49654
49985
  __privateAdd(this, _selected, __runInitializers(_init66, 24, this, /* @__PURE__ */ new Set())), __runInitializers(_init66, 27, this);
49655
49986
  __privateAdd(this, _customText, __runInitializers(_init66, 28, this, "")), __runInitializers(_init66, 31, this);
49987
+ __privateAdd(this, _itemsExpanded2, __runInitializers(_init66, 32, this)), __runInitializers(_init66, 35, this);
49988
+ __privateAdd(this, _leftOut, __runInitializers(_init66, 36, this)), __runInitializers(_init66, 39, this);
49989
+ __privateAdd(this, _credentialsShown, __runInitializers(_init66, 40, this, /* @__PURE__ */ new Set())), __runInitializers(_init66, 43, this);
49990
+ __privateAdd(this, _copyFeedback2, __runInitializers(_init66, 44, this)), __runInitializers(_init66, 47, this);
49991
+ __publicField(this, "copyRequest", 0);
49992
+ __publicField(this, "copyResetTimeout");
49993
+ __publicField(this, "footerActions");
49994
+ __publicField(this, "toggleItems", /* @__PURE__ */ __name(() => {
49995
+ this.itemsExpanded = !this.effectiveItemsExpanded;
49996
+ if (this.viewState) this.viewState.itemsExpanded = this.itemsExpanded;
49997
+ }, "toggleItems"));
49656
49998
  }
49657
49999
  get effectiveResponse() {
49658
50000
  return this.request.response ?? this.answered ?? this.viewState?.answered;
49659
50001
  }
50002
+ /** Where a proposal stands, the reader's answer counted before the host echoes it; a question is never more than `pending`. */
50003
+ get proposalState() {
50004
+ return this.request.kind === "proposal" ? harnessProposalState(this.request, this.effectiveResponse) : "pending";
50005
+ }
49660
50006
  get effectiveSelected() {
49661
50007
  return this.selected.size > 0 ? this.selected : new Set(this.viewState?.selected ?? []);
49662
50008
  }
49663
50009
  get effectiveCustomText() {
49664
50010
  return this.customText || this.viewState?.customText || "";
49665
50011
  }
50012
+ get effectiveItemsExpanded() {
50013
+ return this.itemsExpanded ?? this.viewState?.itemsExpanded ?? false;
50014
+ }
50015
+ /** Whether the reader may leave single changes out: a declinable proposal of two or more. */
50016
+ get itemsDeclinable() {
50017
+ return this.request.kind === "proposal" && this.request.itemsDeclinable === true && (this.request.items?.length ?? 0) >= 2;
50018
+ }
50019
+ /**
50020
+ * The changes left out, by item id, of those the proposal still has: while it waits, the
50021
+ * reader's choice; once confirmed, the host's echo of the answer, else the reader's choice.
50022
+ */
50023
+ get effectiveLeftOut() {
50024
+ if (!this.itemsDeclinable) return /* @__PURE__ */ new Set();
50025
+ const ids = this.proposalState === "pending" ? this.leftOut ?? this.viewState?.declinedItemIds ?? [] : this.request.declinedItemIds ?? this.leftOut ?? this.viewState?.declinedItemIds ?? [];
50026
+ const chosen = new Set(ids);
50027
+ return new Set((this.request.items ?? []).filter((item) => chosen.has(item.id)).map((item) => item.id));
50028
+ }
50029
+ /** Whether the card takes no answer: answered, waiting for the host (`busy`), or its changes under way or decided. */
50030
+ get locked() {
50031
+ return this.busy || this.effectiveResponse !== void 0 || this.proposalState !== "pending";
50032
+ }
49666
50033
  render() {
49667
50034
  const request = this.request;
49668
- const response = this.effectiveResponse;
49669
- const disabled = this.busy || response !== void 0;
50035
+ const severity = harnessQuestionSeverity(request);
50036
+ const waiting = request.kind === "proposal" ? this.proposalState === "pending" : this.effectiveResponse === void 0;
49670
50037
  return b`
49671
- <div class="card">
49672
- <div class="titleRow">
49673
- <dees-icon icon="lucide:MessageCircleQuestionMark" iconSize="15"></dees-icon>
49674
- <span class="questionText">${request.question}</span>
50038
+ <div class="card severity-${severity} ${waiting ? "waiting" : ""}">
50039
+ <div class="body">
50040
+ <div class="titleRow">
50041
+ <dees-icon icon=${titleIcon(request.kind, severity)} iconSize="15" aria-hidden="true"></dees-icon>
50042
+ <span class="questionText">${severity === "info" ? "" : b`<span class="srOnly">${this.t(severity === "danger" ? "question.danger" : "question.warning")} </span>`}${request.question}</span>
50043
+ </div>
50044
+ ${request.kind === "proposal" ? this.renderProposal() : this.renderQuestion()}
49675
50045
  </div>
49676
- ${response ? b`
49677
- <div class="answeredNote">
49678
- ${this.t("question.answered")}
49679
- <span class="answerText">${this.t.format.list(response, "unit") || "\u2014"}</span>
49680
- </div>
49681
- ` : b`
49682
- ${request.options?.length ? b`
49683
- <div class="options" role=${request.multiSelect ? "group" : "radiogroup"}>
49684
- ${request.options.map((option) => b`
49685
- <button
49686
- class="option ${this.effectiveSelected.has(option.label) ? "selected" : ""}"
49687
- type="button"
49688
- ?disabled=${disabled}
49689
- @click=${() => this.handleOptionClick(option.label)}
49690
- >
49691
- <div class="optionLabel">${option.label}</div>
49692
- ${option.description ? b`<div class="optionDescription">${option.description}</div>` : ""}
49693
- </button>
49694
- `)}
49695
- </div>
49696
- ` : ""}
49697
- ${request.allowCustom !== false ? b`
49698
- <div class="customRow">
49699
- <input
49700
- placeholder=${this.t("question.custom")}
49701
- .value=${this.effectiveCustomText}
49702
- ?disabled=${disabled}
49703
- @input=${(event) => {
50046
+ ${request.kind === "proposal" && waiting ? b`
50047
+ <dees-actionfooter
50048
+ source="harness-question-card"
50049
+ .actions=${this.proposalActions}
50050
+ .primaryActionType=${severity === "danger" ? "destructive" : "accent"}
50051
+ .disabled=${this.busy}
50052
+ ></dees-actionfooter>
50053
+ ` : ""}
50054
+ </div>
50055
+ `;
50056
+ }
50057
+ renderQuestion() {
50058
+ const request = this.request;
50059
+ const response = this.effectiveResponse;
50060
+ const disabled = this.busy || response !== void 0;
50061
+ return response ? b`
50062
+ <div class="answeredNote">
50063
+ ${this.t("question.answered")}
50064
+ <span class="answerText">${this.t.format.list(response, "unit") || "\u2014"}</span>
50065
+ </div>
50066
+ ` : b`
50067
+ ${request.options?.length ? b`
50068
+ <div class="options" role=${request.multiSelect ? "group" : "radiogroup"}>
50069
+ ${request.options.map((option) => b`
50070
+ <button
50071
+ class="option ${this.effectiveSelected.has(option.label) ? "selected" : ""}"
50072
+ type="button"
50073
+ ?disabled=${disabled}
50074
+ @click=${() => this.handleOptionClick(option.label)}
50075
+ >
50076
+ <div class="optionLabel">${option.label}</div>
50077
+ ${option.description ? b`<div class="optionDescription">${option.description}</div>` : ""}
50078
+ </button>
50079
+ `)}
50080
+ </div>
50081
+ ` : ""}
50082
+ ${request.allowCustom !== false ? b`
50083
+ <div class="customRow">
50084
+ <input
50085
+ placeholder=${this.t("question.custom")}
50086
+ .value=${this.effectiveCustomText}
50087
+ ?disabled=${disabled}
50088
+ @input=${(event) => {
49704
50089
  this.customText = event.currentTarget.value;
49705
50090
  if (this.viewState) this.viewState.customText = this.customText;
49706
50091
  }}
49707
- @keydown=${(event) => {
50092
+ @keydown=${(event) => {
49708
50093
  if (event.key === "Enter" && this.effectiveCustomText.trim()) {
49709
50094
  this.respond([...this.effectiveSelected, this.effectiveCustomText.trim()]);
49710
50095
  }
49711
50096
  }}
49712
- />
49713
- <dees-button
49714
- size="sm"
49715
- ?disabled=${disabled || !this.effectiveCustomText.trim() && !this.effectiveSelected.size}
49716
- @clicked=${() => {
50097
+ />
50098
+ <dees-button
50099
+ size="sm"
50100
+ ?disabled=${disabled || !this.effectiveCustomText.trim() && !this.effectiveSelected.size}
50101
+ @clicked=${() => {
49717
50102
  const answers = [...this.effectiveSelected];
49718
50103
  if (this.effectiveCustomText.trim()) answers.push(this.effectiveCustomText.trim());
49719
50104
  this.respond(answers);
49720
50105
  }}
49721
- >${this.t("question.send")}</dees-button>
49722
- </div>
49723
- ` : ""}
49724
- ${request.multiSelect && request.allowCustom === false ? b`
49725
- <div class="confirmRow">
49726
- <dees-button
49727
- type="accent"
49728
- size="sm"
49729
- ?disabled=${disabled || !this.effectiveSelected.size}
49730
- @clicked=${() => this.respond([...this.effectiveSelected])}
49731
- >${this.t("question.confirm")}</dees-button>
50106
+ >${this.t("question.send")}</dees-button>
50107
+ </div>
50108
+ ` : ""}
50109
+ ${request.multiSelect && request.allowCustom === false ? b`
50110
+ <div class="confirmRow">
50111
+ <dees-button
50112
+ type="accent"
50113
+ size="sm"
50114
+ ?disabled=${disabled || !this.effectiveSelected.size}
50115
+ @clicked=${() => this.respond([...this.effectiveSelected])}
50116
+ >${this.t("question.confirm")}</dees-button>
50117
+ </div>
50118
+ ` : ""}
50119
+ `;
50120
+ }
50121
+ /** The proposed changes and, once decided, the state and what came of it. */
50122
+ renderProposal() {
50123
+ const items = this.request.items ?? [];
50124
+ const expanded = this.effectiveItemsExpanded;
50125
+ const proposalState = this.proposalState;
50126
+ const choosing = this.itemsDeclinable && proposalState === "pending";
50127
+ const leftOut = choosing || proposalState === "confirmed" || proposalState === "failed" ? this.effectiveLeftOut : /* @__PURE__ */ new Set();
50128
+ return b`
50129
+ ${items.length ? b`
50130
+ <ul class="items" aria-label=${this.t("question.items")}>
50131
+ ${harnessShownRecords(items, expanded).map((item) => {
50132
+ const severity = item.severity ?? "info";
50133
+ const isLeftOut = leftOut.has(item.id);
50134
+ return b`
50135
+ <li class="item ${isLeftOut ? "leftOut" : ""}">
50136
+ <div class="itemHead">
50137
+ ${choosing ? b`
50138
+ <input
50139
+ class="include"
50140
+ type="checkbox"
50141
+ aria-label=${this.t("question.includeItem", { summary: item.summary })}
50142
+ .checked=${!isLeftOut}
50143
+ ?disabled=${this.locked}
50144
+ @change=${(event) => this.setIncluded(item.id, event.currentTarget.checked)}
50145
+ />
50146
+ ` : ""}
50147
+ ${severity === "info" ? "" : b`<dees-icon class="itemMarker severity-${severity}" icon=${ITEM_ICON[severity]} iconSize="13" aria-hidden="true"></dees-icon>`}
50148
+ <span class="itemSummary">${severity === "info" ? "" : b`<span class="srOnly">${this.t(severity === "danger" ? "question.danger" : "question.warning")} </span>`}${item.summary}</span>
50149
+ ${isLeftOut ? b`<span class="leftOutNote">${this.t("question.leftOut")}</span>` : ""}
50150
+ ${item.outcome ? renderHarnessOutcome(item.outcome) : ""}
49732
50151
  </div>
49733
- ` : ""}
49734
- `}
50152
+ ${item.label ? item.href ? b`<a class="itemLabel" href=${item.href} @click=${(event) => this.openItem(event, item)}>${item.label}</a>` : b`<span class="itemLabel">${item.label}</span>` : ""}
50153
+ ${item.changes?.length ? renderHarnessChanges(this.t, item.changes) : ""}
50154
+ ${item.credential ? this.renderCredential(item) : ""}
50155
+ </li>
50156
+ `;
50157
+ })}
50158
+ </ul>
50159
+ ${renderHarnessMoreRecords(this.t, items.length, expanded, this.toggleItems)}
50160
+ ` : ""}
50161
+ ${proposalState === "pending" ? "" : b`
50162
+ <div class="decision" tabindex="-1">
50163
+ <dees-badge type=${STATE_BADGE[proposalState]} .text=${this.t(`question.${proposalState}`)} rounded></dees-badge>
50164
+ ${this.request.outcome ? renderHarnessOutcome(this.request.outcome) : ""}
50165
+ </div>
50166
+ `}
50167
+ `;
50168
+ }
50169
+ /**
50170
+ * A secret a change issued, for the reader's eyes: masked (its value not in the page) until
50171
+ * shown, and copied on request with a word on how that went.
50172
+ */
50173
+ renderCredential(itemArg) {
50174
+ const credential = itemArg.credential;
50175
+ const shown = this.credentialsShown.has(itemArg.id);
50176
+ const feedback = this.copyFeedback?.itemId === itemArg.id ? this.copyFeedback : void 0;
50177
+ return b`
50178
+ <div class="credential">
50179
+ <div class="credentialRow">
50180
+ <span class="credentialLabel">${credential.label}</span>
50181
+ <code class="credentialValue">${shown ? credential.value : b`<span aria-hidden="true">${CREDENTIAL_MASK}</span><span class="srOnly">${this.t("question.credentialHidden")}</span>`}</code>
50182
+ <button
50183
+ class="credentialAction"
50184
+ type="button"
50185
+ aria-label=${this.t(shown ? "question.credentialHide" : "question.credentialShow", { label: credential.label })}
50186
+ @click=${() => this.toggleCredential(itemArg.id)}
50187
+ >${this.t(shown ? "question.credentialHideShort" : "question.credentialShowShort")}</button>
50188
+ <button
50189
+ class="credentialAction"
50190
+ type="button"
50191
+ aria-label=${this.t("question.credentialCopy", { label: credential.label })}
50192
+ @click=${() => this.copyCredential(itemArg)}
50193
+ >${this.t("common.copy")}</button>
50194
+ <span class="credentialFeedback ${feedback?.failed ? "failed" : ""}" role="status" aria-live="polite">${feedback?.text ?? ""}</span>
50195
+ </div>
50196
+ <p class="credentialNote">${credential.note ?? this.t("question.credentialNote")}</p>
49735
50197
  </div>
49736
50198
  `;
49737
50199
  }
50200
+ /** Decline, and Confirm as the primary; kept while their words and Confirm's availability stay, so the footer knows a running one by its object. */
50201
+ get proposalActions() {
50202
+ const confirm2 = this.request.confirmLabel ?? this.t("question.proposalConfirm");
50203
+ const decline = this.request.declineLabel ?? this.t("question.proposalDecline");
50204
+ const nothingIncluded = this.itemsDeclinable && this.effectiveLeftOut.size === (this.request.items?.length ?? 0);
50205
+ if (this.footerActions?.confirm !== confirm2 || this.footerActions.decline !== decline || this.footerActions.nothingIncluded !== nothingIncluded) {
50206
+ this.footerActions = {
50207
+ confirm: confirm2,
50208
+ decline,
50209
+ nothingIncluded,
50210
+ actions: [
50211
+ { name: decline, action: /* @__PURE__ */ __name(async () => this.respond(["decline"]), "action") },
50212
+ { name: confirm2, primary: true, disabled: nothingIncluded, action: /* @__PURE__ */ __name(async () => this.respond(["confirm"]), "action") }
50213
+ ]
50214
+ };
50215
+ }
50216
+ return this.footerActions.actions;
50217
+ }
50218
+ /** The reader includes a change in the proposal, or leaves it out. */
50219
+ setIncluded(itemIdArg, includedArg) {
50220
+ if (this.locked) return;
50221
+ const next = new Set(this.effectiveLeftOut);
50222
+ if (includedArg) next.delete(itemIdArg);
50223
+ else next.add(itemIdArg);
50224
+ this.leftOut = next;
50225
+ if (this.viewState) this.viewState.declinedItemIds = [...next];
50226
+ }
50227
+ toggleCredential(itemIdArg) {
50228
+ const next = new Set(this.credentialsShown);
50229
+ if (next.has(itemIdArg)) next.delete(itemIdArg);
50230
+ else next.add(itemIdArg);
50231
+ this.credentialsShown = next;
50232
+ }
50233
+ async copyCredential(itemArg) {
50234
+ const credential = itemArg.credential;
50235
+ const request = ++this.copyRequest;
50236
+ clearTimeout(this.copyResetTimeout);
50237
+ this.copyFeedback = void 0;
50238
+ try {
50239
+ await navigator.clipboard.writeText(credential.value);
50240
+ if (!this.isConnected || request !== this.copyRequest) return;
50241
+ this.copyFeedback = { itemId: itemArg.id, text: this.t("question.credentialCopied", { label: credential.label }), failed: false };
50242
+ } catch {
50243
+ if (!this.isConnected || request !== this.copyRequest) return;
50244
+ this.copyFeedback = { itemId: itemArg.id, text: this.t("question.credentialCopyFailed"), failed: true };
50245
+ }
50246
+ this.copyResetTimeout = setTimeout(() => {
50247
+ this.copyFeedback = void 0;
50248
+ this.copyResetTimeout = void 0;
50249
+ }, 3e3);
50250
+ }
50251
+ /** A proposed change's link: the host may route it itself (it cancels the event); a plain or modified click otherwise follows it. */
50252
+ openItem(eventArg, itemArg) {
50253
+ const { credential: _credential, ...item } = itemArg;
50254
+ routeHarnessRecordLink(eventArg, () => this.dispatchEvent(new CustomEvent("harness-question-link", {
50255
+ detail: { requestId: this.request.id, item, request: harnessWithoutCredentials(this.request) },
50256
+ bubbles: true,
50257
+ composed: true,
50258
+ cancelable: true
50259
+ })));
50260
+ }
49738
50261
  handleOptionClick(label) {
49739
- if (this.busy || this.effectiveResponse !== void 0) return;
50262
+ if (this.locked) return;
49740
50263
  if (this.request.multiSelect) {
49741
50264
  const next = new Set(this.effectiveSelected);
49742
50265
  if (next.has(label)) next.delete(label);
@@ -49748,20 +50271,35 @@ var _DeesHarnessQuestionCard = class _DeesHarnessQuestionCard extends (_a64 = De
49748
50271
  this.respond([label]);
49749
50272
  }
49750
50273
  respond(answers) {
49751
- if (this.busy || this.effectiveResponse !== void 0 || !answers.length) return;
50274
+ if (this.locked || !answers.length) return;
50275
+ const items = this.request.items ?? [];
50276
+ const leftOut = answers[0] === "confirm" && this.itemsDeclinable ? this.effectiveLeftOut : /* @__PURE__ */ new Set();
50277
+ if (leftOut.size > 0 && leftOut.size === items.length) return;
50278
+ const footerFocused = this.shadowRoot?.activeElement?.localName === "dees-actionfooter";
49752
50279
  this.answered = answers;
49753
50280
  if (this.viewState) this.viewState.answered = answers;
49754
- this.dispatchEvent(
49755
- new CustomEvent("harness-question-response", {
49756
- detail: {
49757
- requestId: this.request.id,
49758
- answers,
49759
- request: this.request
49760
- },
49761
- bubbles: true,
49762
- composed: true
49763
- })
49764
- );
50281
+ if (footerFocused) {
50282
+ void this.updateComplete.then(() => this.shadowRoot?.querySelector(".decision")?.focus());
50283
+ }
50284
+ const detail = {
50285
+ requestId: this.request.id,
50286
+ answers,
50287
+ request: harnessWithoutCredentials(this.request)
50288
+ };
50289
+ if (leftOut.size > 0) detail.declinedItemIds = items.filter((item) => leftOut.has(item.id)).map((item) => item.id);
50290
+ this.dispatchEvent(new CustomEvent("harness-question-response", {
50291
+ detail,
50292
+ bubbles: true,
50293
+ composed: true
50294
+ }));
50295
+ }
50296
+ async disconnectedCallback() {
50297
+ ++this.copyRequest;
50298
+ clearTimeout(this.copyResetTimeout);
50299
+ this.copyResetTimeout = void 0;
50300
+ this.copyFeedback = void 0;
50301
+ this.credentialsShown = /* @__PURE__ */ new Set();
50302
+ await super.disconnectedCallback();
49765
50303
  }
49766
50304
  };
49767
50305
  _init66 = __decoratorStart(_a64);
@@ -49771,12 +50309,20 @@ _viewState6 = new WeakMap();
49771
50309
  _answered2 = new WeakMap();
49772
50310
  _selected = new WeakMap();
49773
50311
  _customText = new WeakMap();
50312
+ _itemsExpanded2 = new WeakMap();
50313
+ _leftOut = new WeakMap();
50314
+ _credentialsShown = new WeakMap();
50315
+ _copyFeedback2 = new WeakMap();
49774
50316
  __decorateElement(_init66, 4, "request", _request_dec2, _DeesHarnessQuestionCard, _request2);
49775
50317
  __decorateElement(_init66, 4, "busy", _busy_dec2, _DeesHarnessQuestionCard, _busy2);
49776
50318
  __decorateElement(_init66, 4, "viewState", _viewState_dec6, _DeesHarnessQuestionCard, _viewState6);
49777
50319
  __decorateElement(_init66, 4, "answered", _answered_dec2, _DeesHarnessQuestionCard, _answered2);
49778
50320
  __decorateElement(_init66, 4, "selected", _selected_dec, _DeesHarnessQuestionCard, _selected);
49779
50321
  __decorateElement(_init66, 4, "customText", _customText_dec, _DeesHarnessQuestionCard, _customText);
50322
+ __decorateElement(_init66, 4, "itemsExpanded", _itemsExpanded_dec2, _DeesHarnessQuestionCard, _itemsExpanded2);
50323
+ __decorateElement(_init66, 4, "leftOut", _leftOut_dec, _DeesHarnessQuestionCard, _leftOut);
50324
+ __decorateElement(_init66, 4, "credentialsShown", _credentialsShown_dec, _DeesHarnessQuestionCard, _credentialsShown);
50325
+ __decorateElement(_init66, 4, "copyFeedback", _copyFeedback_dec2, _DeesHarnessQuestionCard, _copyFeedback2);
49780
50326
  _DeesHarnessQuestionCard = __decorateElement(_init66, 0, "DeesHarnessQuestionCard", _DeesHarnessQuestionCard_decorators, _DeesHarnessQuestionCard);
49781
50327
  __name(_DeesHarnessQuestionCard, "DeesHarnessQuestionCard");
49782
50328
  __publicField(_DeesHarnessQuestionCard, "demo", demoFunc44);
@@ -49785,6 +50331,8 @@ __publicField(_DeesHarnessQuestionCard, "styles", [
49785
50331
  themeDefaultStyles,
49786
50332
  cssManager.defaultStyles,
49787
50333
  harnessControlStyles,
50334
+ harnessActivityStyles,
50335
+ harnessRecordStyles,
49788
50336
  i`
49789
50337
  :host {
49790
50338
  display: block;
@@ -49793,13 +50341,34 @@ __publicField(_DeesHarnessQuestionCard, "styles", [
49793
50341
  }
49794
50342
 
49795
50343
  .card {
49796
- padding: 16px;
50344
+ overflow: clip;
49797
50345
  border: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
49798
50346
  border-radius: var(--dees-radius-xl);
49799
50347
  corner-shape: var(--dees-corner-shape);
49800
50348
  background: var(--dees-color-bg-secondary);
49801
50349
  }
49802
50350
 
50351
+ /* the border asks for attention while the card waits; a decided card keeps only its icon */
50352
+ .card.waiting.severity-warning {
50353
+ border-color: var(--dees-color-accent-warning);
50354
+ }
50355
+
50356
+ .card.waiting.severity-danger {
50357
+ border-color: var(--dees-color-accent-error);
50358
+ }
50359
+
50360
+ .body {
50361
+ padding: 16px;
50362
+ }
50363
+
50364
+ .body > :last-child {
50365
+ margin-bottom: 0;
50366
+ }
50367
+
50368
+ dees-actionfooter {
50369
+ --dees-actionfooter-inset: 16px;
50370
+ }
50371
+
49803
50372
  .titleRow {
49804
50373
  display: flex;
49805
50374
  align-items: flex-start;
@@ -49815,6 +50384,16 @@ __publicField(_DeesHarnessQuestionCard, "styles", [
49815
50384
  color: var(--dees-color-accent-primary);
49816
50385
  }
49817
50386
 
50387
+ .severity-warning .titleRow dees-icon {
50388
+ background: var(--dees-color-badge-warning-bg);
50389
+ color: var(--dees-color-badge-warning-fg);
50390
+ }
50391
+
50392
+ .severity-danger .titleRow dees-icon {
50393
+ background: var(--dees-color-badge-error-bg);
50394
+ color: var(--dees-color-badge-error-fg);
50395
+ }
50396
+
49818
50397
  .questionText {
49819
50398
  min-width: 0;
49820
50399
  color: var(--dees-color-text-primary);
@@ -49920,6 +50499,134 @@ __publicField(_DeesHarnessQuestionCard, "styles", [
49920
50499
  font-weight: 500;
49921
50500
  overflow-wrap: anywhere;
49922
50501
  }
50502
+
50503
+ .itemSummary {
50504
+ flex: 1;
50505
+ min-width: 0;
50506
+ color: var(--dees-color-text-primary);
50507
+ overflow-wrap: anywhere;
50508
+ }
50509
+
50510
+ .item .itemLabel {
50511
+ flex: none;
50512
+ justify-self: start;
50513
+ font-size: var(--dees-font-caption1-size, 11px);
50514
+ }
50515
+
50516
+ .decision {
50517
+ display: flex;
50518
+ flex-wrap: wrap;
50519
+ align-items: center;
50520
+ gap: var(--dees-spacing-sm);
50521
+ border-radius: var(--dees-radius-xs);
50522
+ }
50523
+
50524
+ .decision:focus {
50525
+ outline: none;
50526
+ }
50527
+
50528
+ .decision:focus-visible {
50529
+ outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
50530
+ outline-offset: 2px;
50531
+ }
50532
+
50533
+ .include {
50534
+ flex: none;
50535
+ width: 16px;
50536
+ height: 16px;
50537
+ margin: 0;
50538
+ accent-color: var(--dees-color-accent-primary);
50539
+ cursor: pointer;
50540
+ }
50541
+
50542
+ .itemMarker {
50543
+ flex: none;
50544
+ }
50545
+
50546
+ .itemMarker.severity-warning {
50547
+ color: var(--dees-color-badge-warning-fg);
50548
+ }
50549
+
50550
+ .itemMarker.severity-danger {
50551
+ color: var(--dees-color-badge-error-fg);
50552
+ }
50553
+
50554
+ .item.leftOut .itemSummary {
50555
+ color: var(--dees-color-text-secondary);
50556
+ }
50557
+
50558
+ .leftOutNote {
50559
+ flex: none;
50560
+ color: var(--dees-color-text-secondary);
50561
+ font-size: var(--dees-font-caption1-size, 11px);
50562
+ }
50563
+
50564
+ .credential {
50565
+ display: grid;
50566
+ gap: 4px;
50567
+ margin-top: 4px;
50568
+ padding: 8px 10px;
50569
+ border: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
50570
+ border-radius: var(--dees-radius-md);
50571
+ corner-shape: var(--dees-corner-shape);
50572
+ background: var(--dees-color-bg-secondary);
50573
+ }
50574
+
50575
+ .credentialRow {
50576
+ display: flex;
50577
+ flex-wrap: wrap;
50578
+ align-items: baseline;
50579
+ gap: 4px var(--dees-spacing-sm);
50580
+ min-width: 0;
50581
+ }
50582
+
50583
+ .credentialLabel {
50584
+ color: var(--dees-color-text-secondary);
50585
+ }
50586
+
50587
+ .credentialValue {
50588
+ flex: 1 1 12em;
50589
+ min-width: 0;
50590
+ color: var(--dees-color-text-primary);
50591
+ font-family: var(--dees-font-family-mono);
50592
+ overflow-wrap: anywhere;
50593
+ user-select: all;
50594
+ }
50595
+
50596
+ .credentialAction {
50597
+ padding: 0;
50598
+ border: none;
50599
+ background: none;
50600
+ color: var(--dees-color-accent-primary);
50601
+ font: inherit;
50602
+ font-size: var(--dees-font-caption1-size, 11px);
50603
+ cursor: pointer;
50604
+ border-radius: var(--dees-radius-xs);
50605
+ }
50606
+
50607
+ .credentialAction:hover {
50608
+ text-decoration: underline;
50609
+ }
50610
+
50611
+ .credentialAction:focus-visible {
50612
+ outline: var(--dees-line-width-focus-ring) solid var(--dees-color-focus-ring);
50613
+ outline-offset: 2px;
50614
+ }
50615
+
50616
+ .credentialFeedback {
50617
+ color: var(--dees-color-text-secondary);
50618
+ font-size: var(--dees-font-caption1-size, 11px);
50619
+ }
50620
+
50621
+ .credentialFeedback.failed {
50622
+ color: var(--dees-color-text-error);
50623
+ }
50624
+
50625
+ .credentialNote {
50626
+ margin: 0;
50627
+ color: var(--dees-color-text-secondary);
50628
+ font-size: var(--dees-font-caption1-size, 11px);
50629
+ }
49923
50630
  `
49924
50631
  ]);
49925
50632
  __runInitializers(_init66, 1, _DeesHarnessQuestionCard);
@@ -50278,7 +50985,9 @@ var _DeesHarnessMessageList = class _DeesHarnessMessageList extends (_a65 = Dees
50278
50985
  for (const question of this.questions) {
50279
50986
  items.push({
50280
50987
  kind: "question",
50281
- time: question.response ? question.respondedAt ?? question.createdAt ?? 0 : pinnedRequestTime,
50988
+ // a pending question or proposal pins to the end; an answered,
50989
+ // expired or failed one keeps its place in the flow
50990
+ time: harnessQuestionPending(question) ? pinnedRequestTime : question.respondedAt ?? question.createdAt ?? 0,
50282
50991
  insertionIndex: items.length,
50283
50992
  key: `question:${question.id}`,
50284
50993
  question
@@ -70735,7 +71444,7 @@ var _DeesHarnessConversationPicker = class _DeesHarnessConversationPicker extend
70735
71444
  * cancelled. Focus returns to whatever had it when the picker opened.
70736
71445
  */
70737
71446
  static async pick(optionsArg = {}) {
70738
- const { DeesModal: DeesModal2 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-modal-7LJGK5SK.js");
71447
+ const { DeesModal: DeesModal2 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-modal-BZIJFVRI.js");
70739
71448
  const picker = new _DeesHarnessConversationPicker();
70740
71449
  picker.sessions = optionsArg.sessions ?? [];
70741
71450
  picker.groups = optionsArg.groups ?? [];
@@ -71196,7 +71905,7 @@ var handleResourceContext = /* @__PURE__ */ __name(async (event) => {
71196
71905
  list.selectedResourceId = event.detail.resource.id;
71197
71906
  }, "handleResourceContext");
71198
71907
  var openModal = /* @__PURE__ */ __name(async (sessions, groups) => {
71199
- const { DeesModal: DeesModal2 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-modal-7LJGK5SK.js");
71908
+ const { DeesModal: DeesModal2 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-modal-BZIJFVRI.js");
71200
71909
  const content = document.createElement("dees-harness-session-list");
71201
71910
  content.sessions = sessions;
71202
71911
  content.groups = groups;
@@ -74191,8 +74900,24 @@ var ticketDraft = /* @__PURE__ */ __name((ticket) => ({
74191
74900
  assigneeId: ticket.assignee?.id ?? "",
74192
74901
  parentId: ticket.parentId ?? "",
74193
74902
  labels: [...ticket.labels ?? []],
74194
- project: ticket.project ?? ""
74903
+ project: ticket.project ?? "",
74904
+ ...ticket.revision === void 0 ? {} : { revision: ticket.revision }
74195
74905
  }), "ticketDraft");
74906
+ var kanbanTicketVersion = /* @__PURE__ */ __name((ticket) => ticket?.revision !== void 0 ? `revision:${ticket.revision}` : ticket?.updatedAt, "kanbanTicketVersion");
74907
+ var kanbanDraftFields = [
74908
+ "title",
74909
+ "description",
74910
+ "project",
74911
+ "priority",
74912
+ "assigneeId",
74913
+ "parentId",
74914
+ "labels"
74915
+ ];
74916
+ var sameDraftField = /* @__PURE__ */ __name((field, a, b2) => field === "labels" ? sameKanbanLabels(a.labels ?? [], b2.labels ?? []) : (a[field] ?? "") === (b2[field] ?? ""), "sameDraftField");
74917
+ var kanbanDraftChanges = /* @__PURE__ */ __name((base, draft, latest) => Object.fromEntries(
74918
+ kanbanDraftFields.filter((field) => draft[field] !== void 0 && !sameDraftField(field, draft, base) && !sameDraftField(field, draft, latest)).map((field) => [field, draft[field]])
74919
+ ), "kanbanDraftChanges");
74920
+ var isKanbanRevisionConflict = /* @__PURE__ */ __name((error) => error instanceof Error && error.code === "revision_conflict", "isKanbanRevisionConflict");
74196
74921
  var kanbanProjectName = /* @__PURE__ */ __name((projects, id) => projects.find((project2) => project2.id === id)?.name ?? id, "kanbanProjectName");
74197
74922
  var kanbanProjects = /* @__PURE__ */ __name((projects, tickets) => {
74198
74923
  const known = new Set(projects.map((project2) => project2.id));
@@ -74586,9 +75311,9 @@ __runInitializers(_init104, 1, _DeesKanbanActivity);
74586
75311
  var DeesKanbanActivity = _DeesKanbanActivity;
74587
75312
 
74588
75313
  // ts_web/elements/00group-kanban/dees-kanban-ticket-detail/dees-kanban-ticket-detail.ts
74589
- var _feed_dec, _editing_dec3, _showTicketKey_dec, _canGoBack_dec, _saving_dec2, _error_dec6, _projects_dec2, _activityError_dec, _loadingActivity_dec, _activity_dec2, _commentsError_dec, _loadingComments_dec, _searchTickets_dec2, _comments_dec2, _commentDraft_dec, _draft_dec4, _provider_dec3, _people_dec, _columns_dec4, _tickets_dec2, _ticket_dec, _a104, _DeesKanbanTicketDetail_decorators, _init105, _ticket, _tickets2, _columns4, _people, _provider3, _draft4, _commentDraft, _comments2, _searchTickets2, _loadingComments, _commentsError, _activity2, _loadingActivity, _activityError, _projects2, _error6, _saving2, _canGoBack, _showTicketKey, _editing3, _feed;
75314
+ var _feed_dec, _editing_dec3, _conflict_dec, _showTicketKey_dec, _canGoBack_dec, _saving_dec2, _error_dec6, _projects_dec2, _activityError_dec, _loadingActivity_dec, _activity_dec2, _commentsError_dec, _loadingComments_dec, _searchTickets_dec2, _comments_dec2, _commentDraft_dec, _draft_dec4, _provider_dec3, _people_dec, _columns_dec4, _tickets_dec2, _ticket_dec, _a104, _DeesKanbanTicketDetail_decorators, _init105, _ticket, _tickets2, _columns4, _people, _provider3, _draft4, _commentDraft, _comments2, _searchTickets2, _loadingComments, _commentsError, _activity2, _loadingActivity, _activityError, _projects2, _error6, _saving2, _canGoBack, _showTicketKey, _conflict, _editing3, _feed;
74590
75315
  _DeesKanbanTicketDetail_decorators = [customElement("dees-kanban-ticket-detail")];
74591
- var _DeesKanbanTicketDetail = class _DeesKanbanTicketDetail extends (_a104 = DeesElement, _ticket_dec = [n({ attribute: false })], _tickets_dec2 = [n({ attribute: false })], _columns_dec4 = [n({ attribute: false })], _people_dec = [n({ attribute: false })], _provider_dec3 = [n({ attribute: false })], _draft_dec4 = [n({ attribute: false })], _commentDraft_dec = [n({ attribute: false })], _comments_dec2 = [n({ attribute: false })], _searchTickets_dec2 = [n({ attribute: false })], _loadingComments_dec = [n({ type: Boolean, reflect: true })], _commentsError_dec = [n({ type: String, reflect: true })], _activity_dec2 = [n({ attribute: false })], _loadingActivity_dec = [n({ type: Boolean, reflect: true })], _activityError_dec = [n({ type: String, reflect: true })], _projects_dec2 = [n({ attribute: false })], _error_dec6 = [n({ type: String, reflect: true })], _saving_dec2 = [n({ type: Boolean, reflect: true })], _canGoBack_dec = [n({ type: Boolean, reflect: true })], _showTicketKey_dec = [n({ type: Boolean, reflect: true })], _editing_dec3 = [r2()], _feed_dec = [r2()], _a104) {
75316
+ var _DeesKanbanTicketDetail = class _DeesKanbanTicketDetail extends (_a104 = DeesElement, _ticket_dec = [n({ attribute: false })], _tickets_dec2 = [n({ attribute: false })], _columns_dec4 = [n({ attribute: false })], _people_dec = [n({ attribute: false })], _provider_dec3 = [n({ attribute: false })], _draft_dec4 = [n({ attribute: false })], _commentDraft_dec = [n({ attribute: false })], _comments_dec2 = [n({ attribute: false })], _searchTickets_dec2 = [n({ attribute: false })], _loadingComments_dec = [n({ type: Boolean, reflect: true })], _commentsError_dec = [n({ type: String, reflect: true })], _activity_dec2 = [n({ attribute: false })], _loadingActivity_dec = [n({ type: Boolean, reflect: true })], _activityError_dec = [n({ type: String, reflect: true })], _projects_dec2 = [n({ attribute: false })], _error_dec6 = [n({ type: String, reflect: true })], _saving_dec2 = [n({ type: Boolean, reflect: true })], _canGoBack_dec = [n({ type: Boolean, reflect: true })], _showTicketKey_dec = [n({ type: Boolean, reflect: true })], _conflict_dec = [n({ attribute: false })], _editing_dec3 = [r2()], _feed_dec = [r2()], _a104) {
74592
75317
  constructor() {
74593
75318
  super(...arguments);
74594
75319
  __publicField(this, "t", dcLocalize(this));
@@ -74611,14 +75336,127 @@ var _DeesKanbanTicketDetail = class _DeesKanbanTicketDetail extends (_a104 = Dee
74611
75336
  __privateAdd(this, _saving2, __runInitializers(_init105, 72, this, false)), __runInitializers(_init105, 75, this);
74612
75337
  __privateAdd(this, _canGoBack, __runInitializers(_init105, 76, this, false)), __runInitializers(_init105, 79, this);
74613
75338
  __privateAdd(this, _showTicketKey, __runInitializers(_init105, 80, this, true)), __runInitializers(_init105, 83, this);
74614
- __privateAdd(this, _editing3, __runInitializers(_init105, 84, this, false)), __runInitializers(_init105, 87, this);
74615
- __privateAdd(this, _feed, __runInitializers(_init105, 88, this, "comments")), __runInitializers(_init105, 91, this);
75339
+ __privateAdd(this, _conflict, __runInitializers(_init105, 84, this)), __runInitializers(_init105, 87, this);
75340
+ __privateAdd(this, _editing3, __runInitializers(_init105, 88, this, false)), __runInitializers(_init105, 91, this);
75341
+ /** The reader pressed a button of the refusal, which leaves with its answer: the focus follows. */
75342
+ __publicField(this, "conflictFocus", false);
75343
+ __privateAdd(this, _feed, __runInitializers(_init105, 92, this, "comments")), __runInitializers(_init105, 95, this);
74616
75344
  __publicField(this, "addComment", /* @__PURE__ */ __name((input) => this.provider.addComment(input), "addComment"));
74617
75345
  }
74618
75346
  updated(changed3) {
74619
75347
  const previous = changed3.get("ticket");
74620
75348
  if (changed3.has("ticket") && previous?.id !== this.ticket?.id)
74621
75349
  this.editing = Boolean(this.draft);
75350
+ if (this.conflictFocus && changed3.has("conflict") && this.conflict?.state !== "reloading") {
75351
+ this.conflictFocus = false;
75352
+ const root = this.shadowRoot;
75353
+ const target = root.querySelector(".conflict dees-button") ?? root.querySelector(".edit dees-input-text");
75354
+ void target?.updateComplete.then(() => target.focus());
75355
+ }
75356
+ }
75357
+ /**
75358
+ * A save the provider refused as stale, at the top of the edit: the server's reason and the
75359
+ * reload, then what the person changed that the latest version does not hold, each change to
75360
+ * apply on its own.
75361
+ */
75362
+ renderConflict(ticket, conflict, parents, projects) {
75363
+ const press = /* @__PURE__ */ __name((type) => () => {
75364
+ this.conflictFocus = true;
75365
+ kanbanEvent(this, type, { ticketId: ticket.id });
75366
+ }, "press");
75367
+ if (conflict.state !== "reloaded") {
75368
+ const reloading = conflict.state === "reloading";
75369
+ return b`<div class="conflict" role="alert">
75370
+ <dees-hint type="warning">
75371
+ <p class="conflict-reason">${conflict.message}</p>
75372
+ <p>${this.t("kanban.conflictHint")}</p>
75373
+ <dees-button
75374
+ size="sm"
75375
+ type="accent"
75376
+ icon="lucide:RefreshCw"
75377
+ text=${this.t("kanban.reloadTicket")}
75378
+ .status=${reloading ? "pending" : "normal"}
75379
+ .disabled=${reloading}
75380
+ @clicked=${press("kanban-ticket-reload")}
75381
+ ></dees-button>
75382
+ </dees-hint>
75383
+ </div>`;
75384
+ }
75385
+ const fields = kanbanDraftFields.filter((field) => field in conflict.edit);
75386
+ return b`<section class="conflict" aria-labelledby="conflict-heading">
75387
+ <dees-hint type="info">
75388
+ <h3 id="conflict-heading">${this.t("kanban.yourEdit")}</h3>
75389
+ <p>${this.t("kanban.yourEditHint")}</p>
75390
+ <dl>${fields.map((field) => {
75391
+ const name = this.fieldName(ticket, field);
75392
+ return b`<div class="kept" data-field=${field}>
75393
+ <dt>${name}</dt>
75394
+ <dd class=${field === "title" || field === "description" ? "text" : ""}>${this.keptValue(
75395
+ field,
75396
+ conflict.edit,
75397
+ parents,
75398
+ projects
75399
+ )}</dd>
75400
+ <dees-button
75401
+ size="sm"
75402
+ type="secondary"
75403
+ text=${this.t("kanban.applyEdit")}
75404
+ aria-label=${this.t("kanban.applyField", { field: name })}
75405
+ @clicked=${() => {
75406
+ this.conflictFocus = true;
75407
+ kanbanEvent(this, "kanban-conflict-apply", { ticketId: ticket.id, field });
75408
+ }}
75409
+ ></dees-button>
75410
+ </div>`;
75411
+ })}</dl>
75412
+ <div class="conflict-actions">
75413
+ <dees-button
75414
+ size="sm"
75415
+ type="secondary"
75416
+ text=${this.t("kanban.discardEdit")}
75417
+ @clicked=${press("kanban-conflict-dismiss")}
75418
+ ></dees-button>
75419
+ </div>
75420
+ </dees-hint>
75421
+ </section>`;
75422
+ }
75423
+ /** A draft field's name, as its control is labelled. */
75424
+ fieldName(ticket, field) {
75425
+ switch (field) {
75426
+ case "title":
75427
+ return this.t("kanban.ticketTitle");
75428
+ case "description":
75429
+ return this.t("kanban.description");
75430
+ case "project":
75431
+ return this.t("kanban.project");
75432
+ case "priority":
75433
+ return this.t("kanban.priorityLabel");
75434
+ case "assigneeId":
75435
+ return this.t("kanban.assignee");
75436
+ case "parentId":
75437
+ return this.t(ticket.kind === "task" ? "kanban.epic" : "kanban.parentTask");
75438
+ case "labels":
75439
+ return this.t("kanban.labels");
75440
+ }
75441
+ }
75442
+ /** A kept change's value, as its control shows it. */
75443
+ keptValue(field, edit, parents, projects) {
75444
+ switch (field) {
75445
+ case "title":
75446
+ return edit.title ?? "";
75447
+ case "description":
75448
+ return edit.description || this.t("kanban.noDescription");
75449
+ case "project":
75450
+ return edit.project ? kanbanProjectName(projects, edit.project) : this.t("kanban.noProject");
75451
+ case "priority":
75452
+ return this.t("kanban.priority", { priority: edit.priority ?? "none" });
75453
+ case "assigneeId":
75454
+ return edit.assigneeId ? this.people.find((person) => person.id === edit.assigneeId)?.name ?? edit.assigneeId : this.t("kanban.unassigned");
75455
+ case "parentId":
75456
+ return parents.find((item) => item.id === edit.parentId)?.title ?? this.t("kanban.none");
75457
+ case "labels":
75458
+ return edit.labels?.length ? b`${edit.labels.map((label) => b`<span class="badge">${label}</span>`)}` : this.t("kanban.none");
75459
+ }
74622
75460
  }
74623
75461
  changeDraft(change) {
74624
75462
  this.draft = { ...this.draft ?? ticketDraft(this.ticket), ...change };
@@ -74671,6 +75509,7 @@ var _DeesKanbanTicketDetail = class _DeesKanbanTicketDetail extends (_a104 = Dee
74671
75509
  <div class="layout">
74672
75510
  <section class="lead">
74673
75511
  ${this.editing && editable ? b`<div class="edit">
75512
+ ${this.conflict ? this.renderConflict(ticket, this.conflict, parents, projects) : ""}
74674
75513
  <dees-input-text
74675
75514
  label=${this.t("kanban.ticketTitle")}
74676
75515
  .value=${draft.title}
@@ -74691,7 +75530,7 @@ var _DeesKanbanTicketDetail = class _DeesKanbanTicketDetail extends (_a104 = Dee
74691
75530
  size="sm"
74692
75531
  type="accent"
74693
75532
  text=${this.t("kanban.saveChanges")}
74694
- .disabled=${this.saving || !draft.title.trim()}
75533
+ .disabled=${this.saving || !draft.title.trim() || this.conflict !== void 0 && this.conflict.state !== "reloaded"}
74695
75534
  .status=${this.saving ? "pending" : "normal"}
74696
75535
  @clicked=${() => kanbanEvent(this, "kanban-ticket-save", { ticketId: ticket.id, draft })}
74697
75536
  ></dees-button>
@@ -75033,6 +75872,7 @@ _error6 = new WeakMap();
75033
75872
  _saving2 = new WeakMap();
75034
75873
  _canGoBack = new WeakMap();
75035
75874
  _showTicketKey = new WeakMap();
75875
+ _conflict = new WeakMap();
75036
75876
  _editing3 = new WeakMap();
75037
75877
  _feed = new WeakMap();
75038
75878
  __decorateElement(_init105, 4, "ticket", _ticket_dec, _DeesKanbanTicketDetail, _ticket);
@@ -75054,6 +75894,7 @@ __decorateElement(_init105, 4, "error", _error_dec6, _DeesKanbanTicketDetail, _e
75054
75894
  __decorateElement(_init105, 4, "saving", _saving_dec2, _DeesKanbanTicketDetail, _saving2);
75055
75895
  __decorateElement(_init105, 4, "canGoBack", _canGoBack_dec, _DeesKanbanTicketDetail, _canGoBack);
75056
75896
  __decorateElement(_init105, 4, "showTicketKey", _showTicketKey_dec, _DeesKanbanTicketDetail, _showTicketKey);
75897
+ __decorateElement(_init105, 4, "conflict", _conflict_dec, _DeesKanbanTicketDetail, _conflict);
75057
75898
  __decorateElement(_init105, 4, "editing", _editing_dec3, _DeesKanbanTicketDetail, _editing3);
75058
75899
  __decorateElement(_init105, 4, "feed", _feed_dec, _DeesKanbanTicketDetail, _feed);
75059
75900
  _DeesKanbanTicketDetail = __decorateElement(_init105, 0, "DeesKanbanTicketDetail", _DeesKanbanTicketDetail_decorators, _DeesKanbanTicketDetail);
@@ -75435,6 +76276,72 @@ __publicField(_DeesKanbanTicketDetail, "styles", [
75435
76276
  gap: 14px;
75436
76277
  }
75437
76278
 
76279
+ .conflict p + p,
76280
+ .conflict p + dees-button {
76281
+ margin-top: 8px;
76282
+ }
76283
+
76284
+ .conflict-reason,
76285
+ .conflict h3 {
76286
+ color: var(--dees-color-text-primary);
76287
+ font-weight: 600;
76288
+ }
76289
+
76290
+ .conflict h3 {
76291
+ font-size: inherit;
76292
+ }
76293
+
76294
+ .conflict dl {
76295
+ display: grid;
76296
+ gap: 8px;
76297
+ margin: 10px 0 0;
76298
+ }
76299
+
76300
+ .kept,
76301
+ .conflict-actions {
76302
+ padding-top: 8px;
76303
+ border-top: var(--dees-line-width-hairline) solid var(--dees-color-border-subtle);
76304
+ }
76305
+
76306
+ .conflict-actions {
76307
+ margin-top: 8px;
76308
+ }
76309
+
76310
+ .kept {
76311
+ display: grid;
76312
+ grid-template-columns: minmax(0, 1fr) auto;
76313
+ grid-template-areas: 'name apply' 'value apply';
76314
+ align-items: center;
76315
+ gap: var(--dees-spacing-2xs) 12px;
76316
+ }
76317
+
76318
+ .kept dt {
76319
+ grid-area: name;
76320
+ font-size: var(--dees-font-caption1-size);
76321
+ }
76322
+
76323
+ .kept dd {
76324
+ grid-area: value;
76325
+ margin: 0;
76326
+ min-width: 0;
76327
+ color: var(--dees-color-text-primary);
76328
+ overflow-wrap: anywhere;
76329
+ }
76330
+
76331
+ .kept dd.text {
76332
+ white-space: pre-wrap;
76333
+ max-height: 9lh;
76334
+ overflow-y: auto;
76335
+ }
76336
+
76337
+ .kept dd .badge + .badge {
76338
+ margin-left: 4px;
76339
+ }
76340
+
76341
+ .kept dees-button {
76342
+ grid-area: apply;
76343
+ }
76344
+
75438
76345
  @media (max-width: 700px) {
75439
76346
  :host {
75440
76347
  padding: 16px;
@@ -75472,13 +76379,46 @@ var kanbanDemoColumns = [
75472
76379
  { id: "review", title: "In review" },
75473
76380
  { id: "done", title: "Done", done: true }
75474
76381
  ];
76382
+ var kanbanDemoReleasedColumn = {
76383
+ id: "released",
76384
+ title: "Released",
76385
+ done: true,
76386
+ collapsible: "collapsed"
76387
+ };
75475
76388
  var kanbanDemoProjects = [
75476
76389
  { id: "app", name: "Workspace app" },
75477
76390
  { id: "catalog", name: "Design catalog" }
75478
76391
  ];
75479
76392
  var [mara2, jonas2, alex] = kanbanDemoPeople;
75480
- var createKanbanDemo = /* @__PURE__ */ __name(() => {
75481
- let tickets = [
76393
+ var releasedTickets = /* @__PURE__ */ __name(() => [
76394
+ ["Remember the last board filters", "app", "2.0.0"],
76395
+ ["Show who is viewing a ticket", "app", "2.1.0"],
76396
+ ["Add the compact card density", "catalog", "21.1.0"],
76397
+ ["Search tickets by key", "app", "2.2.0"],
76398
+ ["Load the board in one request", "app", "2.3.0"]
76399
+ ].map(([title, project2, version2], order) => ({
76400
+ id: `released-${order + 1}`,
76401
+ key: `CAT-${110 + order}`,
76402
+ kind: "task",
76403
+ title,
76404
+ columnId: "released",
76405
+ order,
76406
+ assignee: kanbanDemoPeople[order % kanbanDemoPeople.length],
76407
+ project: project2,
76408
+ links: [
76409
+ { kind: "release", package: project2 === "app" ? "@acme/workspace" : "@acme/catalog", version: version2 }
76410
+ ],
76411
+ createdAt: `2026-09-0${order + 1}T09:00:00Z`,
76412
+ createdBy: mara2,
76413
+ updatedAt: `2026-09-1${order}T15:00:00Z`,
76414
+ updatedBy: mara2
76415
+ })), "releasedTickets");
76416
+ var revised = /* @__PURE__ */ __name((ticket) => ({
76417
+ ...ticket,
76418
+ revision: (ticket.revision ?? 0) + 1
76419
+ }), "revised");
76420
+ var createKanbanDemo = /* @__PURE__ */ __name((options = {}) => {
76421
+ const seeded = [
75482
76422
  {
75483
76423
  id: "epic-1",
75484
76424
  key: "CAT-100",
@@ -75665,8 +76605,10 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75665
76605
  order: 0,
75666
76606
  assignee: alex,
75667
76607
  project: "catalog"
75668
- }
76608
+ },
76609
+ ...options.released ? releasedTickets() : []
75669
76610
  ];
76611
+ let tickets = seeded.map(revised);
75670
76612
  let comments = [
75671
76613
  {
75672
76614
  id: "comment-1",
@@ -75789,8 +76731,13 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75789
76731
  record(input.ticketId, "commented");
75790
76732
  return comment;
75791
76733
  }, "addComment"),
75792
- updateTicket: /* @__PURE__ */ __name(async ({ ticketId, changes }) => {
76734
+ updateTicket: /* @__PURE__ */ __name(async ({ ticketId, changes, expectedRevision }) => {
75793
76735
  const previous = tickets.find((ticket2) => ticket2.id === ticketId);
76736
+ if (expectedRevision !== void 0 && expectedRevision !== previous.revision)
76737
+ throw Object.assign(
76738
+ new Error(`${previous.updatedBy?.name ?? "A teammate"} changed ${previous.key} while you were editing it.`),
76739
+ { code: "revision_conflict" }
76740
+ );
75794
76741
  const next = {
75795
76742
  ...previous,
75796
76743
  ...changes,
@@ -75809,11 +76756,11 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75809
76756
  ])
75810
76757
  );
75811
76758
  if (!Object.keys(changed3).length) return previous;
75812
- const ticket = {
76759
+ const ticket = revised({
75813
76760
  ...next,
75814
76761
  updatedAt: record(ticketId, "updated", changed3),
75815
76762
  updatedBy: actor
75816
- };
76763
+ });
75817
76764
  tickets = tickets.map((item) => item.id === ticketId ? ticket : item);
75818
76765
  return ticket;
75819
76766
  }, "updateTicket"),
@@ -75830,7 +76777,9 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75830
76777
  updatedAt,
75831
76778
  updatedBy: actor
75832
76779
  });
75833
- const changed3 = destination.map((item, order) => ({ ...item, order }));
76780
+ const changed3 = destination.map(
76781
+ (item, order) => item.id === ticketId || item.order !== order ? revised({ ...item, order }) : item
76782
+ );
75834
76783
  tickets = tickets.map((item) => changed3.find((moved) => moved.id === item.id) ?? item);
75835
76784
  return changed3;
75836
76785
  }, "moveTicket"),
@@ -75845,7 +76794,8 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75845
76794
  createdAt,
75846
76795
  createdBy: actor,
75847
76796
  updatedAt: createdAt,
75848
- updatedBy: actor
76797
+ updatedBy: actor,
76798
+ revision: 1
75849
76799
  };
75850
76800
  tickets = [...tickets, ticket];
75851
76801
  return ticket;
@@ -75863,7 +76813,7 @@ var createKanbanDemo = /* @__PURE__ */ __name(() => {
75863
76813
 
75864
76814
  // ts_web/elements/00group-kanban/dees-kanban/dees-kanban.demo.ts
75865
76815
  var demoFunc71 = /* @__PURE__ */ __name(() => {
75866
- const demo11 = createKanbanDemo();
76816
+ const demo11 = createKanbanDemo({ released: true });
75867
76817
  const [mara3, jonas3, alex2] = kanbanDemoPeople;
75868
76818
  const teammate = [
75869
76819
  () => demo11.provider.moveTicket({ ticketId: "task-1", columnId: "progress" }),
@@ -75875,22 +76825,35 @@ var demoFunc71 = /* @__PURE__ */ __name(() => {
75875
76825
  () => demo11.provider.moveTicket({ ticketId: "task-2", columnId: "review" })
75876
76826
  ];
75877
76827
  let step = 0;
76828
+ const boardOf = /* @__PURE__ */ __name((event) => event.currentTarget.closest(".dees-demo-app").querySelector("dees-kanban"), "boardOf");
75878
76829
  const simulate2 = /* @__PURE__ */ __name(async (event) => {
75879
- const board = event.currentTarget.closest(".dees-demo-app").querySelector("dees-kanban");
76830
+ const board = boardOf(event);
75880
76831
  demo11.actAs(step % 2 ? alex2 : jonas3);
75881
76832
  await teammate[step++ % teammate.length]();
75882
76833
  demo11.actAs(mara3);
75883
76834
  await board.refresh();
75884
76835
  }, "simulate");
76836
+ let renames = 0;
76837
+ const rename = /* @__PURE__ */ __name(async (event) => {
76838
+ const board = boardOf(event);
76839
+ demo11.actAs(jonas3);
76840
+ await demo11.provider.updateTicket({
76841
+ ticketId: "task-2",
76842
+ changes: { title: `Connect related tickets (${++renames})` }
76843
+ });
76844
+ demo11.actAs(mara3);
76845
+ await board.refresh();
76846
+ }, "rename");
75885
76847
  return demoApp(b`<div class="dees-demo-row" style="padding: 0 24px 4px">
75886
- <p class="dees-demo-caption">Signed in as Mara Chen. Jonas and Alex work on the same board.</p>
76848
+ <p class="dees-demo-caption">Signed in as Mara Chen. Jonas and Alex work on the same board. To see a refused stale edit, start editing CAT-102, close it, let Jonas rename it and save.</p>
75887
76849
  <dees-button type="outline" size="sm" text="Simulate a teammate's change" @clicked=${simulate2}></dees-button>
76850
+ <dees-button type="outline" size="sm" text="Jonas renames CAT-102" @clicked=${rename}></dees-button>
75888
76851
  </div>
75889
76852
  <dees-kanban
75890
76853
  heading="Product workspace"
75891
76854
  currentPersonId=${mara3.id}
75892
76855
  .tickets=${demo11.tickets}
75893
- .columns=${kanbanDemoColumns}
76856
+ .columns=${[...kanbanDemoColumns, kanbanDemoReleasedColumn]}
75894
76857
  .people=${kanbanDemoPeople}
75895
76858
  .projects=${kanbanDemoProjects}
75896
76859
  .revision=${demo11.revision}
@@ -76474,6 +77437,8 @@ var KanbanDragController = class {
76474
77437
  }
76475
77438
  const columnId = column.column?.id;
76476
77439
  if (!columnId) return;
77440
+ if (column.collapsed)
77441
+ return column.tickets.some((ticket) => ticket.id === gesture.motion.ticket.id) ? this.authoritativeMove(gesture.motion.ticket.id) : { ticketId: gesture.motion.ticket.id, columnId, beforeTicketId: void 0 };
76477
77442
  const tickets = sortKanbanTickets(column.tickets).filter(
76478
77443
  (ticket) => ticket.id !== gesture.motion.ticket.id
76479
77444
  );
@@ -76880,9 +77845,10 @@ var KanbanDragController = class {
76880
77845
  };
76881
77846
 
76882
77847
  // ts_web/elements/00group-kanban/dees-kanban-column/dees-kanban-column.ts
76883
- var _motion_dec, _nativeOver_dec, _nativeDropBefore_dec, _pointerManaged_dec2, _draggingTicketId_dec, _pendingTicketId_dec, _canCreate_dec, _movesDisabled_dec, _movable_dec2, _showProjects_dec, _projects_dec3, _columns_dec6, _allTickets_dec, _tickets_dec3, _column_dec, _a106, _DeesKanbanColumn_decorators, _init107, _column, _tickets3, _allTickets, _columns6, _projects3, _showProjects, _movable2, _movesDisabled, _canCreate, _pendingTicketId, _draggingTicketId, _pointerManaged2, _nativeDropBefore, _nativeOver, _motion;
77848
+ var _motion_dec, _nativeOver_dec, _nativeDropBefore_dec, _pointerManaged_dec2, _draggingTicketId_dec, _pendingTicketId_dec, _collapsed_dec3, _canCreate_dec, _movesDisabled_dec, _movable_dec2, _showProjects_dec, _projects_dec3, _columns_dec6, _allTickets_dec, _tickets_dec3, _column_dec, _a106, _DeesKanbanColumn_decorators, _init107, _column, _tickets3, _allTickets, _columns6, _projects3, _showProjects, _movable2, _movesDisabled, _canCreate, _collapsed3, _pendingTicketId, _draggingTicketId, _pointerManaged2, _nativeDropBefore, _nativeOver, _motion;
77849
+ var collapsedCards = 3;
76884
77850
  _DeesKanbanColumn_decorators = [customElement("dees-kanban-column")];
76885
- var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _column_dec = [n({ attribute: false })], _tickets_dec3 = [n({ attribute: false })], _allTickets_dec = [n({ attribute: false })], _columns_dec6 = [n({ attribute: false })], _projects_dec3 = [n({ attribute: false })], _showProjects_dec = [n({ type: Boolean, reflect: true })], _movable_dec2 = [n({ type: Boolean, reflect: true })], _movesDisabled_dec = [n({ type: Boolean, reflect: true })], _canCreate_dec = [n({ type: Boolean, reflect: true })], _pendingTicketId_dec = [n({ type: String, reflect: true })], _draggingTicketId_dec = [n({ type: String, reflect: true })], _pointerManaged_dec2 = [n({ attribute: false })], _nativeDropBefore_dec = [r2()], _nativeOver_dec = [r2()], _motion_dec = [n({ attribute: false })], _a106) {
77851
+ var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _column_dec = [n({ attribute: false })], _tickets_dec3 = [n({ attribute: false })], _allTickets_dec = [n({ attribute: false })], _columns_dec6 = [n({ attribute: false })], _projects_dec3 = [n({ attribute: false })], _showProjects_dec = [n({ type: Boolean, reflect: true })], _movable_dec2 = [n({ type: Boolean, reflect: true })], _movesDisabled_dec = [n({ type: Boolean, reflect: true })], _canCreate_dec = [n({ type: Boolean, reflect: true })], _collapsed_dec3 = [n({ type: Boolean, reflect: true })], _pendingTicketId_dec = [n({ type: String, reflect: true })], _draggingTicketId_dec = [n({ type: String, reflect: true })], _pointerManaged_dec2 = [n({ attribute: false })], _nativeDropBefore_dec = [r2()], _nativeOver_dec = [r2()], _motion_dec = [n({ attribute: false })], _a106) {
76886
77852
  constructor() {
76887
77853
  super(...arguments);
76888
77854
  __publicField(this, "t", dcLocalize(this));
@@ -76895,27 +77861,37 @@ var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _c
76895
77861
  __privateAdd(this, _movable2, __runInitializers(_init107, 32, this, false)), __runInitializers(_init107, 35, this);
76896
77862
  __privateAdd(this, _movesDisabled, __runInitializers(_init107, 36, this, false)), __runInitializers(_init107, 39, this);
76897
77863
  __privateAdd(this, _canCreate, __runInitializers(_init107, 40, this, false)), __runInitializers(_init107, 43, this);
76898
- __privateAdd(this, _pendingTicketId, __runInitializers(_init107, 44, this, "")), __runInitializers(_init107, 47, this);
76899
- __privateAdd(this, _draggingTicketId, __runInitializers(_init107, 48, this, "")), __runInitializers(_init107, 51, this);
76900
- __privateAdd(this, _pointerManaged2, __runInitializers(_init107, 52, this, false)), __runInitializers(_init107, 55, this);
76901
- __privateAdd(this, _nativeDropBefore, __runInitializers(_init107, 56, this)), __runInitializers(_init107, 59, this);
76902
- __privateAdd(this, _nativeOver, __runInitializers(_init107, 60, this, false)), __runInitializers(_init107, 63, this);
76903
- __privateAdd(this, _motion, __runInitializers(_init107, 64, this)), __runInitializers(_init107, 67, this);
77864
+ __privateAdd(this, _collapsed3, __runInitializers(_init107, 44, this, false)), __runInitializers(_init107, 47, this);
77865
+ __privateAdd(this, _pendingTicketId, __runInitializers(_init107, 48, this, "")), __runInitializers(_init107, 51, this);
77866
+ __privateAdd(this, _draggingTicketId, __runInitializers(_init107, 52, this, "")), __runInitializers(_init107, 55, this);
77867
+ __privateAdd(this, _pointerManaged2, __runInitializers(_init107, 56, this, false)), __runInitializers(_init107, 59, this);
77868
+ __privateAdd(this, _nativeDropBefore, __runInitializers(_init107, 60, this)), __runInitializers(_init107, 63, this);
77869
+ __privateAdd(this, _nativeOver, __runInitializers(_init107, 64, this, false)), __runInitializers(_init107, 67, this);
77870
+ __privateAdd(this, _motion, __runInitializers(_init107, 68, this)), __runInitializers(_init107, 71, this);
77871
+ /** "Show all" unfolded the column and went away with it: focus moves to the header's toggle. */
77872
+ __publicField(this, "focusToggle", false);
76904
77873
  }
76905
77874
  updated() {
76906
77875
  if (!this.draggingTicketId) this.nativeOver = false;
77876
+ if (this.focusToggle) {
77877
+ this.focusToggle = false;
77878
+ this.shadowRoot?.querySelector("header .toggle")?.focus();
77879
+ }
76907
77880
  }
76908
77881
  render() {
76909
77882
  if (!this.column) return b``;
76910
77883
  const motion = this.motion;
76911
- const tickets = sortKanbanTickets(this.tickets).filter(
77884
+ const ordered = sortKanbanTickets(this.tickets).filter(
76912
77885
  (ticket) => ticket.id !== motion?.move.ticketId
76913
77886
  );
76914
77887
  const active = motion?.move.columnId === this.column.id;
76915
77888
  if (motion && active) {
76916
- const index = tickets.findIndex((ticket) => ticket.id === motion.move.beforeTicketId);
76917
- tickets.splice(index < 0 ? tickets.length : index, 0, motion.ticket);
77889
+ const index = ordered.findIndex((ticket) => ticket.id === motion.move.beforeTicketId);
77890
+ ordered.splice(index < 0 ? ordered.length : index, 0, motion.ticket);
76918
77891
  }
77892
+ const tickets = this.collapsed ? [...ordered].reverse().slice(0, collapsedCards) : ordered;
77893
+ const hidden = ordered.length - tickets.length;
77894
+ const collapsible = !!this.column.collapsible;
76919
77895
  return b`<section
76920
77896
  class=${active && motion?.placeholder || this.nativeOver ? "over" : ""}
76921
77897
  aria-label=${this.column.title}
@@ -76945,8 +77921,18 @@ var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _c
76945
77921
  <header>
76946
77922
  <span class="status ${this.column.done ? "done" : ""}" aria-hidden="true"></span>
76947
77923
  <h3>${this.column.title}</h3>
76948
- <span class="count">${tickets.length}</span>
77924
+ <span class="count">${ordered.length}</span>
76949
77925
  <span class="spacer"></span>
77926
+ ${collapsible ? b`<dees-button
77927
+ class="toggle"
77928
+ type="ghost"
77929
+ size="icon"
77930
+ icon=${this.collapsed ? "lucide:ChevronsLeftRight" : "lucide:ChevronsRightLeft"}
77931
+ text=${this.t(this.collapsed ? "kanban.expandColumn" : "kanban.collapseColumn", {
77932
+ column: this.column.title
77933
+ })}
77934
+ @clicked=${() => this.toggle()}
77935
+ ></dees-button>` : ""}
76950
77936
  ${this.canCreate ? b`<dees-button
76951
77937
  type="ghost"
76952
77938
  size="icon"
@@ -76963,7 +77949,7 @@ var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _c
76963
77949
  class="target ${this.nativeOver && this.nativeDropBefore === ticket.id ? "native-before" : ""}"
76964
77950
  data-ticket-id=${ticket.id}
76965
77951
  @dragover=${() => {
76966
- if (!this.pointerManaged) this.nativeDropBefore = ticket.id;
77952
+ if (!this.pointerManaged) this.nativeDropBefore = this.collapsed ? void 0 : ticket.id;
76967
77953
  }}
76968
77954
  >
76969
77955
  ${motion?.move.ticketId === ticket.id && motion.placeholder ? b`<div
@@ -76996,14 +77982,29 @@ var _DeesKanbanColumn = class _DeesKanbanColumn extends (_a106 = DeesElement, _c
76996
77982
  }}
76997
77983
  >${this.t("kanban.noTasks")}</div>` : ""}
76998
77984
  </div>
77985
+ ${hidden > 0 ? b`<div class="show-all">
77986
+ <dees-button
77987
+ type="ghost"
77988
+ size="sm"
77989
+ icon="lucide:ChevronDown"
77990
+ text=${this.t("kanban.showAll", { count: ordered.length })}
77991
+ @clicked=${() => {
77992
+ this.focusToggle = true;
77993
+ this.toggle();
77994
+ }}
77995
+ ></dees-button>
77996
+ </div>` : ""}
76999
77997
  <div
77000
- class="end-target ${this.nativeOver && !this.nativeDropBefore ? "native-before" : ""}"
77998
+ class="end-target ${this.nativeOver && !this.nativeDropBefore && !this.collapsed ? "native-before" : ""}"
77001
77999
  @dragover=${() => {
77002
78000
  this.nativeDropBefore = void 0;
77003
78001
  }}
77004
78002
  ></div>
77005
78003
  </section>`;
77006
78004
  }
78005
+ toggle() {
78006
+ kanbanEvent(this, "kanban-column-toggle", { columnId: this.column.id });
78007
+ }
77007
78008
  };
77008
78009
  _init107 = __decoratorStart(_a106);
77009
78010
  _column = new WeakMap();
@@ -77015,6 +78016,7 @@ _showProjects = new WeakMap();
77015
78016
  _movable2 = new WeakMap();
77016
78017
  _movesDisabled = new WeakMap();
77017
78018
  _canCreate = new WeakMap();
78019
+ _collapsed3 = new WeakMap();
77018
78020
  _pendingTicketId = new WeakMap();
77019
78021
  _draggingTicketId = new WeakMap();
77020
78022
  _pointerManaged2 = new WeakMap();
@@ -77030,6 +78032,7 @@ __decorateElement(_init107, 4, "showProjects", _showProjects_dec, _DeesKanbanCol
77030
78032
  __decorateElement(_init107, 4, "movable", _movable_dec2, _DeesKanbanColumn, _movable2);
77031
78033
  __decorateElement(_init107, 4, "movesDisabled", _movesDisabled_dec, _DeesKanbanColumn, _movesDisabled);
77032
78034
  __decorateElement(_init107, 4, "canCreate", _canCreate_dec, _DeesKanbanColumn, _canCreate);
78035
+ __decorateElement(_init107, 4, "collapsed", _collapsed_dec3, _DeesKanbanColumn, _collapsed3);
77033
78036
  __decorateElement(_init107, 4, "pendingTicketId", _pendingTicketId_dec, _DeesKanbanColumn, _pendingTicketId);
77034
78037
  __decorateElement(_init107, 4, "draggingTicketId", _draggingTicketId_dec, _DeesKanbanColumn, _draggingTicketId);
77035
78038
  __decorateElement(_init107, 4, "pointerManaged", _pointerManaged_dec2, _DeesKanbanColumn, _pointerManaged2);
@@ -77049,6 +78052,12 @@ __publicField(_DeesKanbanColumn, "styles", [
77049
78052
  flex: 1 0 272px;
77050
78053
  }
77051
78054
 
78055
+ :host([collapsed]) {
78056
+ flex: 0 0 224px;
78057
+ min-width: 224px;
78058
+ max-width: 224px;
78059
+ }
78060
+
77052
78061
  section {
77053
78062
  min-height: 220px;
77054
78063
  height: 100%;
@@ -77130,6 +78139,11 @@ __publicField(_DeesKanbanColumn, "styles", [
77130
78139
  background: var(--dees-color-row-hover);
77131
78140
  }
77132
78141
 
78142
+ .show-all {
78143
+ display: flex;
78144
+ margin-top: 8px;
78145
+ }
78146
+
77133
78147
  @media (prefers-reduced-motion: reduce) {
77134
78148
  section {
77135
78149
  transition: none;
@@ -77149,7 +78163,7 @@ __runInitializers(_init107, 1, _DeesKanbanColumn);
77149
78163
  var DeesKanbanColumn = _DeesKanbanColumn;
77150
78164
 
77151
78165
  // ts_web/elements/00group-kanban/dees-kanban/dees-kanban.ts
77152
- var _openingTicket_dec, _pendingTicketId_dec2, _filterAnnouncement_dec, _filtersOpen_dec, _operationError_dec, _revision_dec, _filterValues_dec2, _currentPersonId_dec, _projects_dec4, _error_dec7, _loading_dec11, _provider_dec4, _people_dec2, _columns_dec7, _tickets_dec4, _heading_dec10, _a107, _DeesKanban_decorators, _init108, _heading10, _tickets4, _columns7, _people2, _provider4, _loading11, _error7, _projects4, _currentPersonId, _filterValues2, _revision, _operationError, _filtersOpen, _filterAnnouncement, _pendingTicketId2, _openingTicket;
78166
+ var _columnsCollapsed_dec, _openingTicket_dec, _pendingTicketId_dec2, _filterAnnouncement_dec, _filtersOpen_dec, _operationError_dec, _revision_dec, _filterValues_dec2, _currentPersonId_dec, _projects_dec4, _error_dec7, _loading_dec11, _provider_dec4, _people_dec2, _columns_dec7, _tickets_dec4, _heading_dec10, _a107, _DeesKanban_decorators, _init108, _heading10, _tickets4, _columns7, _people2, _provider4, _loading11, _error7, _projects4, _currentPersonId, _filterValues2, _revision, _operationError, _filtersOpen, _filterAnnouncement, _pendingTicketId2, _openingTicket, _columnsCollapsed;
77153
78167
  var interactionEvents = [
77154
78168
  "kanban-ticket-open",
77155
78169
  "kanban-ticket-move",
@@ -77161,10 +78175,14 @@ var interactionEvents = [
77161
78175
  "kanban-comment-added",
77162
78176
  "kanban-comments-refresh",
77163
78177
  "kanban-activity-refresh",
77164
- "kanban-detail-back"
78178
+ "kanban-detail-back",
78179
+ "kanban-ticket-reload",
78180
+ "kanban-conflict-apply",
78181
+ "kanban-conflict-dismiss",
78182
+ "kanban-column-toggle"
77165
78183
  ];
77166
78184
  _DeesKanban_decorators = [customElement("dees-kanban")];
77167
- var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10 = [n({ type: String, reflect: true })], _tickets_dec4 = [n({ attribute: false })], _columns_dec7 = [n({ attribute: false })], _people_dec2 = [n({ attribute: false })], _provider_dec4 = [n({ attribute: false })], _loading_dec11 = [n({ type: Boolean, reflect: true })], _error_dec7 = [n({ type: String, reflect: true })], _projects_dec4 = [n({ attribute: false })], _currentPersonId_dec = [n({ type: String, reflect: true })], _filterValues_dec2 = [n({ attribute: false })], _revision_dec = [n({ attribute: false })], _operationError_dec = [r2()], _filtersOpen_dec = [r2()], _filterAnnouncement_dec = [r2()], _pendingTicketId_dec2 = [r2()], _openingTicket_dec = [r2()], _a107) {
78185
+ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10 = [n({ type: String, reflect: true })], _tickets_dec4 = [n({ attribute: false })], _columns_dec7 = [n({ attribute: false })], _people_dec2 = [n({ attribute: false })], _provider_dec4 = [n({ attribute: false })], _loading_dec11 = [n({ type: Boolean, reflect: true })], _error_dec7 = [n({ type: String, reflect: true })], _projects_dec4 = [n({ attribute: false })], _currentPersonId_dec = [n({ type: String, reflect: true })], _filterValues_dec2 = [n({ attribute: false })], _revision_dec = [n({ attribute: false })], _operationError_dec = [r2()], _filtersOpen_dec = [r2()], _filterAnnouncement_dec = [r2()], _pendingTicketId_dec2 = [r2()], _openingTicket_dec = [r2()], _columnsCollapsed_dec = [r2()], _a107) {
77168
78186
  constructor() {
77169
78187
  super(...arguments);
77170
78188
  __publicField(this, "t", dcLocalize(this));
@@ -77184,6 +78202,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77184
78202
  __privateAdd(this, _filterAnnouncement, __runInitializers(_init108, 60, this, "")), __runInitializers(_init108, 63, this);
77185
78203
  __privateAdd(this, _pendingTicketId2, __runInitializers(_init108, 64, this, "")), __runInitializers(_init108, 67, this);
77186
78204
  __privateAdd(this, _openingTicket, __runInitializers(_init108, 68, this, false)), __runInitializers(_init108, 71, this);
78205
+ __privateAdd(this, _columnsCollapsed, __runInitializers(_init108, 72, this, {})), __runInitializers(_init108, 75, this);
77187
78206
  __publicField(this, "modal");
77188
78207
  __publicField(this, "modalOpening");
77189
78208
  __publicField(this, "detail");
@@ -77204,6 +78223,17 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77204
78223
  __publicField(this, "commentRevisions", /* @__PURE__ */ new Map());
77205
78224
  __publicField(this, "commentDrafts", /* @__PURE__ */ new Map());
77206
78225
  __publicField(this, "ticketDrafts", /* @__PURE__ */ new Map());
78226
+ /** Each unsaved edit's ticket as the edit started, by ticket id: what differs from it is the person's change. */
78227
+ __publicField(this, "draftBases", /* @__PURE__ */ new Map());
78228
+ /** Saves the provider refused as stale, by ticket id, until saved, cancelled or discarded. */
78229
+ __publicField(this, "conflicts", /* @__PURE__ */ new Map());
78230
+ /**
78231
+ * The ticket whose move or save the provider refused, and the state of it the refusal answered;
78232
+ * the refusal's words leave once the board holds another state of the ticket.
78233
+ */
78234
+ __publicField(this, "refusal");
78235
+ /** Each ticket's running reload after a refused save, by ticket id. */
78236
+ __publicField(this, "reloadAborts", /* @__PURE__ */ new Map());
77207
78237
  __publicField(this, "resolvedTickets", /* @__PURE__ */ new Map());
77208
78238
  __publicField(this, "activeMove");
77209
78239
  __publicField(this, "dragController", new KanbanDragController(
@@ -77256,10 +78286,46 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77256
78286
  void this.saveTicket(detail.ticketId, detail.draft);
77257
78287
  break;
77258
78288
  case "kanban-ticket-draft":
77259
- if (detail.draft) this.ticketDrafts.set(detail.ticketId, detail.draft);
77260
- else this.ticketDrafts.delete(detail.ticketId);
78289
+ if (detail.draft) {
78290
+ if (!this.ticketDrafts.has(detail.ticketId)) {
78291
+ const ticket = this.findTicket(detail.ticketId);
78292
+ if (ticket) this.draftBases.set(detail.ticketId, ticketDraft(ticket));
78293
+ }
78294
+ this.ticketDrafts.set(detail.ticketId, detail.draft);
78295
+ } else {
78296
+ this.ticketDrafts.delete(detail.ticketId);
78297
+ this.draftBases.delete(detail.ticketId);
78298
+ this.conflicts.delete(detail.ticketId);
78299
+ this.reloadAborts.get(detail.ticketId)?.abort();
78300
+ this.reloadAborts.delete(detail.ticketId);
78301
+ }
78302
+ this.syncDetail();
78303
+ break;
78304
+ case "kanban-ticket-reload":
78305
+ void this.reloadTicket(detail.ticketId);
78306
+ break;
78307
+ case "kanban-conflict-apply": {
78308
+ const conflict = this.conflicts.get(detail.ticketId);
78309
+ const draft = this.ticketDrafts.get(detail.ticketId);
78310
+ if (conflict?.state !== "reloaded" || !draft || !(detail.field in conflict.edit)) break;
78311
+ const edit = { ...conflict.edit };
78312
+ this.ticketDrafts.set(detail.ticketId, { ...draft, [detail.field]: edit[detail.field] });
78313
+ delete edit[detail.field];
78314
+ if (Object.keys(edit).length) this.conflicts.set(detail.ticketId, { ...conflict, edit });
78315
+ else this.conflicts.delete(detail.ticketId);
78316
+ this.syncDetail();
78317
+ break;
78318
+ }
78319
+ case "kanban-conflict-dismiss":
78320
+ this.conflicts.delete(detail.ticketId);
77261
78321
  this.syncDetail();
77262
78322
  break;
78323
+ case "kanban-column-toggle": {
78324
+ const column = this.columns.find((item) => item.id === detail.columnId);
78325
+ if (column?.collapsible)
78326
+ this.columnsCollapsed = { ...this.columnsCollapsed, [column.id]: !this.isCollapsed(column) };
78327
+ break;
78328
+ }
77263
78329
  case "kanban-comment-draft":
77264
78330
  this.commentDrafts.set(detail.ticketId, detail.body);
77265
78331
  break;
@@ -77297,6 +78363,12 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77297
78363
  this.dragController.connect();
77298
78364
  await connection;
77299
78365
  }
78366
+ willUpdate(changed3) {
78367
+ super.willUpdate(changed3);
78368
+ const refusal = this.refusal;
78369
+ if (refusal && changed3.has("tickets") && kanbanTicketVersion(this.findTicket(refusal.ticketId)) !== refusal.version)
78370
+ this.clearOperationError();
78371
+ }
77300
78372
  updated() {
77301
78373
  this.syncDetail();
77302
78374
  this.dragController.sync();
@@ -77411,6 +78483,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77411
78483
  .canCreate=${Boolean(this.provider.createTicket)}
77412
78484
  .movesDisabled=${Boolean(this.pendingTicketId)}
77413
78485
  .pendingTicketId=${this.pendingTicketId}
78486
+ .collapsed=${this.isCollapsed(column)}
77414
78487
  ></dees-kanban-column>`)}
77415
78488
  </div>`}`;
77416
78489
  }
@@ -77438,6 +78511,10 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77438
78511
  >${this.t("kanban.clearAll")}</button>
77439
78512
  </div>`;
77440
78513
  }
78514
+ /** Whether a collapsible column is folded: as the reader left it, else as it starts. */
78515
+ isCollapsed(column) {
78516
+ return column.collapsible ? this.columnsCollapsed[column.id] ?? column.collapsible === "collapsed" : false;
78517
+ }
77441
78518
  /** Whether a ticket belongs to a project: its own, or for an epic, one of its tasks'. */
77442
78519
  inProject(ticket, project2) {
77443
78520
  return ticket.project === project2 || ticket.kind === "epic" && this.tickets.some((task) => task.parentId === ticket.id && task.project === project2);
@@ -77596,7 +78673,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77596
78673
  this.openAbort?.abort();
77597
78674
  const controller = this.openAbort = new AbortController();
77598
78675
  this.openingTicket = true;
77599
- this.operationError = "";
78676
+ this.clearOperationError();
77600
78677
  try {
77601
78678
  const ticket = this.provider.getTicket ? await this.provider.getTicket(id, controller.signal) : this.findTicket(id);
77602
78679
  if (controller.signal.aborted || !this.isConnected) return;
@@ -77673,6 +78750,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77673
78750
  this.detail.activity = this.activityCache.get(this.selectedId) ?? [];
77674
78751
  this.detail.commentDraft = this.commentDrafts.get(this.selectedId) ?? [];
77675
78752
  this.detail.draft = this.ticketDrafts.get(this.selectedId);
78753
+ this.detail.conflict = this.conflicts.get(this.selectedId);
77676
78754
  this.detail.canGoBack = this.history.length > 0;
77677
78755
  this.detail.saving = this.pendingTicketId === this.selectedId;
77678
78756
  if (this.modal) this.modal.heading = this.detail.ticket.key;
@@ -77837,7 +78915,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77837
78915
  }
77838
78916
  const operation = this.activeMove = /* @__PURE__ */ Symbol();
77839
78917
  this.pendingTicketId = ticket.id;
77840
- this.operationError = "";
78918
+ this.clearOperationError();
77841
78919
  try {
77842
78920
  const changed3 = await this.provider.moveTicket(input);
77843
78921
  if (this.activeMove !== operation) return false;
@@ -77851,7 +78929,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77851
78929
  }
77852
78930
  return true;
77853
78931
  } catch (error) {
77854
- if (this.activeMove === operation) this.reportError(error);
78932
+ if (this.activeMove === operation) this.reportError(error, ticket.id);
77855
78933
  return false;
77856
78934
  } finally {
77857
78935
  if (this.activeMove === operation) {
@@ -77861,9 +78939,15 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77861
78939
  }
77862
78940
  }
77863
78941
  }
78942
+ /**
78943
+ * Saves an edit through the provider's `updateTicket`, with the revision it started from. A save
78944
+ * the provider refuses as stale (`IKanbanRevisionConflict`) keeps the edit and holds the refusal
78945
+ * in the detail, which offers to reload the ticket; another save waits for the reload.
78946
+ */
77864
78947
  async saveTicket(ticketId, draft) {
77865
78948
  const ticket = this.findTicket(ticketId);
77866
- if (!ticket || !this.provider.updateTicket || ticket.permissions?.edit === false || this.pendingTicketId || !draft.title.trim())
78949
+ const conflict = this.conflicts.get(ticketId);
78950
+ if (!ticket || !this.provider.updateTicket || ticket.permissions?.edit === false || this.pendingTicketId || !draft.title.trim() || conflict && conflict.state !== "reloaded")
77867
78951
  return;
77868
78952
  const parent = draft.parentId ? this.findTicket(draft.parentId) : void 0;
77869
78953
  if (ticket.kind === "subtask" && parent?.kind !== "task" || ticket.kind === "task" && draft.parentId && parent?.kind !== "epic") {
@@ -77876,7 +78960,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77876
78960
  return;
77877
78961
  }
77878
78962
  this.pendingTicketId = ticketId;
77879
- this.operationError = "";
78963
+ this.clearOperationError();
77880
78964
  if (this.detail) this.detail.error = "";
77881
78965
  try {
77882
78966
  const saved = await this.provider.updateTicket({
@@ -77889,20 +78973,78 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77889
78973
  parentId: ticket.kind === "epic" ? null : draft.parentId || null,
77890
78974
  ...draft.labels && !sameKanbanLabels(draft.labels, ticket.labels ?? []) ? { labels: [...draft.labels] } : {},
77891
78975
  ...draft.project && draft.project !== (ticket.project ?? "") ? { project: draft.project } : {}
77892
- }
78976
+ },
78977
+ ...draft.revision === void 0 ? {} : { expectedRevision: draft.revision }
77893
78978
  });
77894
78979
  if (saved.id !== ticketId)
77895
78980
  throw new Error(this.t("kanban.updateMismatch"));
77896
78981
  this.ticketDrafts.delete(ticketId);
78982
+ this.draftBases.delete(ticketId);
78983
+ this.conflicts.delete(ticketId);
77897
78984
  this.mergeTickets([saved]);
77898
78985
  if (this.selectedId === ticketId) this.detail?.finishEditing();
77899
78986
  } catch (error) {
77900
- this.reportError(error);
78987
+ if (isKanbanRevisionConflict(error)) {
78988
+ const message = kanbanError(error);
78989
+ this.conflicts.set(ticketId, { message, edit: {}, state: "stale" });
78990
+ kanbanEvent(this, "kanban-error", { error, message });
78991
+ } else this.reportError(error, ticketId);
77901
78992
  } finally {
77902
78993
  this.pendingTicketId = "";
77903
78994
  this.syncDetail();
77904
78995
  }
77905
78996
  }
78997
+ /**
78998
+ * Loads a ticket whose save the provider refused as stale and starts its edit again from the
78999
+ * latest version. What the person changed that the latest version does not hold stays in the
79000
+ * refusal, to apply field by field.
79001
+ */
79002
+ async reloadTicket(ticketId) {
79003
+ const conflict = this.conflicts.get(ticketId);
79004
+ if (!conflict || conflict.state === "reloading") return;
79005
+ const controller = new AbortController();
79006
+ this.reloadAborts.set(ticketId, controller);
79007
+ const held = this.findTicket(ticketId);
79008
+ this.conflicts.set(ticketId, { ...conflict, state: "reloading" });
79009
+ this.syncDetail();
79010
+ try {
79011
+ let fresh;
79012
+ if (this.provider.getTicket) fresh = await this.provider.getTicket(ticketId, controller.signal);
79013
+ else {
79014
+ await this.refresh();
79015
+ fresh = this.findTicket(ticketId);
79016
+ }
79017
+ if (controller.signal.aborted || !this.isConnected) return;
79018
+ if (!fresh || fresh.id !== ticketId) throw new Error(this.t("kanban.ticketUnavailable"));
79019
+ const latest = fresh;
79020
+ this.resolvedTickets.set(latest.id, latest);
79021
+ this.tickets = this.tickets.map((item) => item.id === latest.id ? latest : item);
79022
+ if (this.conflicts.get(ticketId)?.state !== "reloading") return;
79023
+ const draft = this.ticketDrafts.get(ticketId);
79024
+ const restart = ticketDraft(latest);
79025
+ const base = this.draftBases.get(ticketId) ?? (held ? ticketDraft(held) : restart);
79026
+ const edit = draft ? kanbanDraftChanges(base, draft, restart) : {};
79027
+ this.ticketDrafts.set(ticketId, restart);
79028
+ this.draftBases.set(ticketId, restart);
79029
+ if (Object.keys(edit).length)
79030
+ this.conflicts.set(ticketId, { ...conflict, edit, state: "reloaded" });
79031
+ else this.conflicts.delete(ticketId);
79032
+ } catch (error) {
79033
+ if (!controller.signal.aborted) this.reportError(error, ticketId);
79034
+ } finally {
79035
+ if (this.reloadAborts.get(ticketId) === controller) {
79036
+ this.reloadAborts.delete(ticketId);
79037
+ const left = this.conflicts.get(ticketId);
79038
+ if (left?.state === "reloading") this.conflicts.set(ticketId, { ...left, state: "stale" });
79039
+ }
79040
+ this.syncDetail();
79041
+ }
79042
+ }
79043
+ /**
79044
+ * Asks for a new ticket's title and, for a task or an epic while the board knows projects, its
79045
+ * project, then has the provider create it. The project starts at the board's project filter,
79046
+ * else the parent's; a subtask takes its parent's.
79047
+ */
77906
79048
  async createTicket(input) {
77907
79049
  if (!this.provider.createTicket || !this.columns.some((column) => column.id === input.columnId))
77908
79050
  return;
@@ -77911,21 +79053,73 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77911
79053
  if (input.kind === "subtask" && parent?.kind !== "task" || input.kind === "task" && parent && parent.kind !== "epic")
77912
79054
  return;
77913
79055
  const parentId = input.parentId ?? (input.kind === "task" ? this.filterValues.epic || void 0 : void 0);
77914
- const project2 = input.project || this.filterValues.project || (parentId ? this.findTicket(parentId)?.project : void 0);
77915
- await DeesModal.prompt({
77916
- heading: this.t("kanban.newTicket", { kind: input.kind }),
77917
- label: this.t("kanban.ticketTitle"),
77918
- i18n: this.t.i18n,
77919
- onConfirm: /* @__PURE__ */ __name(async (title) => {
79056
+ const parentProject = parentId ? this.findTicket(parentId)?.project : void 0;
79057
+ const project2 = (input.kind === "subtask" ? parentProject || input.project : input.project || this.filterValues.project || parentProject) || "";
79058
+ const projects = kanbanProjects(this.projects, this.tickets);
79059
+ let choice;
79060
+ if (input.kind !== "subtask" && projects.length) {
79061
+ choice = new DeesInputDropdown();
79062
+ choice.label = this.t("kanban.project");
79063
+ choice.options = [
79064
+ ...project2 ? [] : [{ key: "", option: this.t("kanban.noProject") }],
79065
+ ...projects.map((item) => ({ key: item.id, option: item.name })),
79066
+ ...project2 && !projects.some((item) => item.id === project2) ? [{ key: project2, option: project2 }] : []
79067
+ ];
79068
+ choice.selectedOption = choice.options.find((option) => option.key === project2) ?? null;
79069
+ }
79070
+ const title = new DeesInputText();
79071
+ title.label = this.t("kanban.ticketTitle");
79072
+ title.required = true;
79073
+ let modal;
79074
+ let creating = false;
79075
+ const create2 = /* @__PURE__ */ __name(async () => {
79076
+ const value = String(title.value ?? "").trim();
79077
+ if (!value) {
79078
+ title.validationState = "invalid";
79079
+ title.validationText = this.t("kanban.titleRequired");
79080
+ await title.focus();
79081
+ return;
79082
+ }
79083
+ const chosen = choice ? choice.getValue()?.key ?? "" : project2;
79084
+ creating = true;
79085
+ title.disabled = true;
79086
+ if (choice) choice.disabled = true;
79087
+ try {
77920
79088
  const ticket = await this.provider.createTicket({
77921
- ...input,
77922
- parentId,
77923
- title,
77924
- ...project2 ? { project: project2 } : {}
79089
+ kind: input.kind,
79090
+ columnId: input.columnId,
79091
+ title: value,
79092
+ ...parentId ? { parentId } : {},
79093
+ ...chosen ? { project: chosen } : {}
77925
79094
  });
79095
+ creating = false;
77926
79096
  this.mergeTickets([ticket], true);
77927
- }, "onConfirm")
79097
+ await modal?.destroy();
79098
+ } catch (error) {
79099
+ creating = false;
79100
+ title.disabled = false;
79101
+ if (choice) choice.disabled = false;
79102
+ title.validationState = "invalid";
79103
+ title.validationText = kanbanError(error);
79104
+ await title.updateComplete;
79105
+ await title.focus();
79106
+ }
79107
+ }, "create");
79108
+ modal = await DeesModal.createAndShow({
79109
+ heading: this.t("kanban.newTicket", { kind: input.kind }),
79110
+ width: "small",
79111
+ content: b`<dees-form>${choice ?? ""}${title}</dees-form>`,
79112
+ menuOptions: [
79113
+ catalogAction("common.cancel", async () => {
79114
+ await modal?.destroy();
79115
+ }),
79116
+ catalogAction("common.create", create2)
79117
+ ],
79118
+ beforeClose: /* @__PURE__ */ __name(() => !creating, "beforeClose"),
79119
+ i18n: this.t.i18n
77928
79120
  });
79121
+ await title.updateComplete;
79122
+ await title.focus();
77929
79123
  }
77930
79124
  async openMoveMenu(ticketId, anchor) {
77931
79125
  const ticket = this.findTicket(ticketId);
@@ -77974,11 +79168,23 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77974
79168
  { ownerElement: anchor, i18n: this.t.i18n }
77975
79169
  );
77976
79170
  }
77977
- reportError(error) {
79171
+ /**
79172
+ * Shows a failure on the board and in the open detail, and tells the host. A failure that answered
79173
+ * a ticket's move or save stays until the board holds another state of that ticket.
79174
+ */
79175
+ reportError(error, ticketId) {
77978
79176
  this.operationError = kanbanError(error);
79177
+ const version2 = ticketId ? kanbanTicketVersion(this.findTicket(ticketId)) : void 0;
79178
+ this.refusal = ticketId && version2 !== void 0 ? { ticketId, version: version2 } : void 0;
77979
79179
  if (this.detail && this.modal) this.detail.error = this.operationError;
77980
79180
  kanbanEvent(this, "kanban-error", { error, message: this.operationError });
77981
79181
  }
79182
+ /** Takes the last failure's words off the board and out of the detail that shows them. */
79183
+ clearOperationError() {
79184
+ if (this.detail?.error && this.detail.error === this.operationError) this.detail.error = "";
79185
+ this.operationError = "";
79186
+ this.refusal = void 0;
79187
+ }
77982
79188
  async disconnectedCallback() {
77983
79189
  for (const name of interactionEvents) this.removeEventListener(name, this.handleInteraction);
77984
79190
  this.dragController.disconnect();
@@ -77990,6 +79196,7 @@ var _DeesKanban = class _DeesKanban extends (_a107 = DeesElement, _heading_dec10
77990
79196
  this.commentsAbort?.abort();
77991
79197
  this.activityAbort?.abort();
77992
79198
  this.boardAbort?.abort();
79199
+ for (const controller of this.reloadAborts.values()) controller.abort();
77993
79200
  void this.modal?.destroy();
77994
79201
  await super.disconnectedCallback();
77995
79202
  }
@@ -78011,6 +79218,7 @@ _filtersOpen = new WeakMap();
78011
79218
  _filterAnnouncement = new WeakMap();
78012
79219
  _pendingTicketId2 = new WeakMap();
78013
79220
  _openingTicket = new WeakMap();
79221
+ _columnsCollapsed = new WeakMap();
78014
79222
  __decorateElement(_init108, 4, "heading", _heading_dec10, _DeesKanban, _heading10);
78015
79223
  __decorateElement(_init108, 4, "tickets", _tickets_dec4, _DeesKanban, _tickets4);
78016
79224
  __decorateElement(_init108, 4, "columns", _columns_dec7, _DeesKanban, _columns7);
@@ -78027,6 +79235,7 @@ __decorateElement(_init108, 4, "filtersOpen", _filtersOpen_dec, _DeesKanban, _fi
78027
79235
  __decorateElement(_init108, 4, "filterAnnouncement", _filterAnnouncement_dec, _DeesKanban, _filterAnnouncement);
78028
79236
  __decorateElement(_init108, 4, "pendingTicketId", _pendingTicketId_dec2, _DeesKanban, _pendingTicketId2);
78029
79237
  __decorateElement(_init108, 4, "openingTicket", _openingTicket_dec, _DeesKanban, _openingTicket);
79238
+ __decorateElement(_init108, 4, "columnsCollapsed", _columnsCollapsed_dec, _DeesKanban, _columnsCollapsed);
78030
79239
  _DeesKanban = __decorateElement(_init108, 0, "DeesKanban", _DeesKanban_decorators, _DeesKanban);
78031
79240
  __name(_DeesKanban, "DeesKanban");
78032
79241
  __publicField(_DeesKanban, "demo", demoFunc71);
@@ -114017,9 +115226,9 @@ var DeesDemoSimpleStudio = _DeesDemoSimpleStudio;
114017
115226
  var demoFunc83 = /* @__PURE__ */ __name(() => demoApp(b`<dees-demo-simple-studio></dees-demo-simple-studio>`), "demoFunc");
114018
115227
 
114019
115228
  // ts_web/elements/00group-simple/dees-simple-appdash/dees-simple-appdash.ts
114020
- var _terminalOpen_dec, _compact_dec9, __activeMessages_dec, _selectedView_dec, _collapsed_dec3, _globalMessages_dec, _executionEnvironment_dec, _terminalSetupCommand_dec, _viewTabs_dec, _name_dec3, _a138, _DeesSimpleAppDash_decorators, _init145, _name3, _viewTabs, _terminalSetupCommand, _executionEnvironment, _globalMessages, _collapsed3, _selectedView, __activeMessages, _compact9, _terminalOpen;
115229
+ var _terminalOpen_dec, _compact_dec9, __activeMessages_dec, _selectedView_dec, _collapsed_dec4, _globalMessages_dec, _executionEnvironment_dec, _terminalSetupCommand_dec, _viewTabs_dec, _name_dec3, _a138, _DeesSimpleAppDash_decorators, _init145, _name3, _viewTabs, _terminalSetupCommand, _executionEnvironment, _globalMessages, _collapsed4, _selectedView, __activeMessages, _compact9, _terminalOpen;
114021
115230
  _DeesSimpleAppDash_decorators = [customElement("dees-simple-appdash")];
114022
- var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a138 = DeesElement, _name_dec3 = [n({ reflect: true })], _viewTabs_dec = [n({ type: Array })], _terminalSetupCommand_dec = [n({ reflect: true })], _executionEnvironment_dec = [n({ type: Object })], _globalMessages_dec = [n({ type: Array })], _collapsed_dec3 = [n({ type: Boolean, reflect: true })], _selectedView_dec = [r2()], __activeMessages_dec = [r2()], _compact_dec9 = [r2()], _terminalOpen_dec = [r2()], _a138) {
115231
+ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a138 = DeesElement, _name_dec3 = [n({ reflect: true })], _viewTabs_dec = [n({ type: Array })], _terminalSetupCommand_dec = [n({ reflect: true })], _executionEnvironment_dec = [n({ type: Object })], _globalMessages_dec = [n({ type: Array })], _collapsed_dec4 = [n({ type: Boolean, reflect: true })], _selectedView_dec = [r2()], __activeMessages_dec = [r2()], _compact_dec9 = [r2()], _terminalOpen_dec = [r2()], _a138) {
114023
115232
  constructor() {
114024
115233
  super();
114025
115234
  __publicField(this, "t", dcLocalize(this));
@@ -114028,7 +115237,7 @@ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a138 = DeesElement,
114028
115237
  __privateAdd(this, _terminalSetupCommand, __runInitializers(_init145, 16, this, 'echo "Terminal ready"')), __runInitializers(_init145, 19, this);
114029
115238
  __privateAdd(this, _executionEnvironment, __runInitializers(_init145, 20, this, null)), __runInitializers(_init145, 23, this);
114030
115239
  __privateAdd(this, _globalMessages, __runInitializers(_init145, 24, this, [])), __runInitializers(_init145, 27, this);
114031
- __privateAdd(this, _collapsed3, __runInitializers(_init145, 28, this, false)), __runInitializers(_init145, 31, this);
115240
+ __privateAdd(this, _collapsed4, __runInitializers(_init145, 28, this, false)), __runInitializers(_init145, 31, this);
114032
115241
  __privateAdd(this, _selectedView, __runInitializers(_init145, 32, this)), __runInitializers(_init145, 35, this);
114033
115242
  __privateAdd(this, __activeMessages, __runInitializers(_init145, 36, this, [])), __runInitializers(_init145, 39, this);
114034
115243
  __privateAdd(this, _compact9, __runInitializers(_init145, 40, this, false)), __runInitializers(_init145, 43, this);
@@ -114162,7 +115371,7 @@ var _DeesSimpleAppDash = class _DeesSimpleAppDash extends (_a138 = DeesElement,
114162
115371
  this.terminalOpen = true;
114163
115372
  const request = ++this.terminalRequest;
114164
115373
  try {
114165
- const { DeesWorkspaceTerminal: DeesWorkspaceTerminal3 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-workspace-terminal-O3NEQ4DO.js");
115374
+ const { DeesWorkspaceTerminal: DeesWorkspaceTerminal3 } = await import("./chunks/U6Ua8p1giFoD1s7vrUZUdpbg/dees-workspace-terminal-EU377EZY.js");
114166
115375
  await this.updateComplete;
114167
115376
  if (!this.isConnected || request !== this.terminalRequest) return;
114168
115377
  const terminal = new DeesWorkspaceTerminal3();
@@ -114214,7 +115423,7 @@ _viewTabs = new WeakMap();
114214
115423
  _terminalSetupCommand = new WeakMap();
114215
115424
  _executionEnvironment = new WeakMap();
114216
115425
  _globalMessages = new WeakMap();
114217
- _collapsed3 = new WeakMap();
115426
+ _collapsed4 = new WeakMap();
114218
115427
  _selectedView = new WeakMap();
114219
115428
  __activeMessages = new WeakMap();
114220
115429
  _compact9 = new WeakMap();
@@ -114224,7 +115433,7 @@ __decorateElement(_init145, 4, "viewTabs", _viewTabs_dec, _DeesSimpleAppDash, _v
114224
115433
  __decorateElement(_init145, 4, "terminalSetupCommand", _terminalSetupCommand_dec, _DeesSimpleAppDash, _terminalSetupCommand);
114225
115434
  __decorateElement(_init145, 4, "executionEnvironment", _executionEnvironment_dec, _DeesSimpleAppDash, _executionEnvironment);
114226
115435
  __decorateElement(_init145, 4, "globalMessages", _globalMessages_dec, _DeesSimpleAppDash, _globalMessages);
114227
- __decorateElement(_init145, 4, "collapsed", _collapsed_dec3, _DeesSimpleAppDash, _collapsed3);
115436
+ __decorateElement(_init145, 4, "collapsed", _collapsed_dec4, _DeesSimpleAppDash, _collapsed4);
114228
115437
  __decorateElement(_init145, 4, "selectedView", _selectedView_dec, _DeesSimpleAppDash, _selectedView);
114229
115438
  __decorateElement(_init145, 4, "_activeMessages", __activeMessages_dec, _DeesSimpleAppDash, __activeMessages);
114230
115439
  __decorateElement(_init145, 4, "compact", _compact_dec9, _DeesSimpleAppDash, _compact9);
@@ -121167,7 +122376,7 @@ var bright = {
121167
122376
  // ts_web/00_commitinfo_data.ts
121168
122377
  var commitinfo = {
121169
122378
  name: "@design.estate/dees-catalog",
121170
- version: "21.32.3",
122379
+ version: "21.33.0",
121171
122380
  description: "A comprehensive library that provides dynamic web components for building sophisticated and modern web applications using JavaScript and TypeScript."
121172
122381
  };
121173
122382
  export {
@@ -121405,6 +122614,9 @@ export {
121405
122614
  harnessParseApplyPatch,
121406
122615
  harnessParseTodos,
121407
122616
  harnessPillStyles,
122617
+ harnessProposalState,
122618
+ harnessQuestionPending,
122619
+ harnessQuestionSeverity,
121408
122620
  harnessRendersToolRow,
121409
122621
  harnessStringifyValue,
121410
122622
  harnessStripAnsi,
@@ -121417,6 +122629,7 @@ export {
121417
122629
  harnessTerminalResultSummary,
121418
122630
  harnessToolStatusPresentation,
121419
122631
  harnessTruncate,
122632
+ harnessWithoutCredentials,
121420
122633
  hintTypeIcons,
121421
122634
  insetInlineStyles,
121422
122635
  isInViewport,