flexdesk 0.12.1 → 0.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flexdesk",
3
- "version": "0.12.1",
3
+ "version": "0.13.0",
4
4
  "description": "A tiling window manager and widget set for desktop-class web applications. Zero runtime dependencies.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -566,12 +566,17 @@ export function buildLegendLayout(position) {
566
566
  * `yAxisId` matches an axis id in sp.yAxes[].id; omitted → first axis.
567
567
  * @param {Array<{x0:number, x1:number, label?:string, color?:string, opacity?:number, labelY?:number, labelColor?:string}>} [opts.shadedBands]
568
568
  * Vertical stripes (rectangles spanning full y range) to mark policy/recession periods.
569
+ * @param {Array<{x:(number|string|Date), label?:string, color?:string, lineStyle?:string, lineWidth?:number, labelY?:number}>} [opts.verticalLines]
570
+ * Vertical markers at one x — a "today" line on a burndown. Drawn full height
571
+ * (`yref: 'paper'`), after the reference lines, so a call without them builds
572
+ * exactly what it built before they existed. `x` is in the x axis's own units:
573
+ * a number, a category, or a date string/Date on a date axis.
569
574
  * @param {Object<string,string>} [opts.yRefByAxisId]
570
575
  * Mapping from subplot yAxes[i].id → Plotly yref ('y', 'y2', ...).
571
576
  * @returns {{shapes: Array, annotations: Array}}
572
577
  */
573
578
  export function buildOverlayShapes(opts = {}) {
574
- const { referenceLines = [], shadedBands = [], yRefByAxisId = {} } = opts;
579
+ const { referenceLines = [], shadedBands = [], verticalLines = [], yRefByAxisId = {} } = opts;
575
580
  const shapes = [];
576
581
  const annotations = [];
577
582
  const dashMap = { solid: 'solid', dashed: 'dash', dotted: 'dot', dashdot: 'dashdot' };
@@ -643,6 +648,40 @@ export function buildOverlayShapes(opts = {}) {
643
648
  }
644
649
  }
645
650
 
651
+ for (const mark of verticalLines) {
652
+ // `0` is a real x, so the test is null/undefined/NaN — never truthiness.
653
+ if (mark == null || mark.x == null || (typeof mark.x === 'number' && !Number.isFinite(mark.x))) continue;
654
+ const color = mark.color || 'rgba(255, 200, 0, 0.75)';
655
+ shapes.push({
656
+ type: 'line',
657
+ xref: 'x',
658
+ yref: 'paper',
659
+ x0: mark.x,
660
+ x1: mark.x,
661
+ y0: 0,
662
+ y1: 1,
663
+ line: {
664
+ color,
665
+ width: mark.lineWidth ?? 1.5,
666
+ dash: dashMap[mark.lineStyle || 'dashed'] || 'dash',
667
+ },
668
+ layer: 'above',
669
+ });
670
+ if (mark.label) {
671
+ annotations.push({
672
+ x: mark.x,
673
+ y: mark.labelY ?? 1.0,
674
+ xref: 'x',
675
+ yref: 'paper',
676
+ text: mark.label,
677
+ showarrow: false,
678
+ font: { size: 10, color },
679
+ xanchor: 'left',
680
+ yanchor: 'bottom',
681
+ });
682
+ }
683
+ }
684
+
646
685
  return { shapes, annotations };
647
686
  }
648
687