@orangelogic/design-system 4.43.0 → 4.44.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "4.43.0",
4
+ "version": "4.44.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -4,10 +4,14 @@ export default class Alert extends CoreFeature implements IAlert {
4
4
  element: HTMLElement;
5
5
  msgElement: HTMLElement;
6
6
  type: string | null;
7
+ private loadingWidthObserver;
8
+ private loadingWidthCleanupSubscribed;
7
9
  constructor(table: ITabulator);
8
10
  _createAlertElement(): HTMLElement;
9
11
  _createMsgElement(): HTMLElement;
10
12
  _typeClass(): string;
11
13
  alert(content: string | HTMLElement | (() => string | HTMLElement) | undefined, type?: string): void;
14
+ private observeLoadingWidth;
15
+ private disconnectLoadingWidthObserver;
12
16
  clear(): void;
13
17
  }
@@ -42,7 +42,7 @@ export interface CapacityBand {
42
42
  * @cssproperty [--cx-capacity-bar-height=22px] - Height of the bar.
43
43
  * @cssproperty [--cx-capacity-bar-radius=6px] - Corner radius of the bar.
44
44
  * @cssproperty --cx-capacity-track-bg - Background of the track behind the bands.
45
- * @cssproperty [--cx-capacity-zero-handle-width=10px] - Width of the grab handle shown for a 0-hour band.
45
+ * @cssproperty [--cx-capacity-zero-handle-width=10px] - Width of the grab handle shown for a 0-hour band. Must be a px length: the label layout reads it in px.
46
46
  *
47
47
  * @event {{ barWidth: number, categoryId: string, pointerEvent: PointerEvent }} cx-capacity-week-bar-band-pointer-down - Fired when a resizable band is pressed.
48
48
  * @event {{ categoryId: string, deltaHours: number }} cx-capacity-week-bar-band-step - Fired when a band is stepped via the keyboard.
@@ -76,11 +76,22 @@ export default class CxCapacityWeekBar extends CortexElement {
76
76
  * 0-hours category keeps its handle and stays grabbable to grow back.
77
77
  */
78
78
  collapseZeroBands: boolean;
79
- /** Px width threshold above which the full "{h}h · {name}" label is shown. */
79
+ /**
80
+ * Minimum px width of the room a band has for the full "{h}h · {name}" label
81
+ * (the band less any 0-hour handles over it). The label is shown only when it
82
+ * also fits its measured text.
83
+ */
80
84
  fullLabelThreshold: number;
81
- /** Px width threshold above which the number-only label is shown. */
85
+ /**
86
+ * Minimum px width of the room a band has for the number-only label. The label
87
+ * is shown only when it also fits its measured text.
88
+ */
82
89
  shortLabelThreshold: number;
83
90
  private readonly barEl;
91
+ /** Hidden full-label span whose computed font is what the full label is measured in. */
92
+ private readonly fullMeasureEl;
93
+ /** Hidden number-only-label span whose computed font is what that label is measured in. */
94
+ private readonly shortMeasureEl;
84
95
  private summary;
85
96
  /** Hours not held by an editable band: capacity − Σ non-derived hours (≥ 0). */
86
97
  private spareHours;
@@ -90,13 +101,22 @@ export default class CxCapacityWeekBar extends CortexElement {
90
101
  private geometries;
91
102
  /** Actual rendered width of the bar element, updated by ResizeObserver. */
92
103
  renderedBarWidth: number;
104
+ /**
105
+ * Bumped each time a web font finishes loading, so label widths measured in
106
+ * the fallback font are measured again. Not `private` (like `renderedBarWidth`):
107
+ * `willUpdate` reads it through `changed.has`, which only accepts public keys.
108
+ */
109
+ fontEpoch: number;
93
110
  private barResizeObserver;
111
+ constructor();
94
112
  connectedCallback(): void;
95
113
  disconnectedCallback(): void;
96
114
  runFirstUpdated(): void;
97
115
  willUpdate(changed: PropertyValues<this>): void;
98
116
  /** Measure the live bar width; falls back to the cached prop if unmeasurable. */
99
117
  private measuredBarWidth;
118
+ /** A web font finished loading: drop the cached widths and fit the labels again. */
119
+ private handleFontsLoaded;
100
120
  private handleBandPointerDown;
101
121
  private handleBandKeyDown;
102
122
  private bandValueMax;
@@ -106,10 +126,13 @@ export default class CxCapacityWeekBar extends CortexElement {
106
126
  * `render` so the tip shows/hides in exact sync with the inline label (and so
107
127
  * the tip text tracks a band being resized under a captured pointer).
108
128
  *
109
- * Every band is on the same fixed scale, so the label thresholds see the
110
- * band's real width. A real 0-hour band on a resizable bar is `zero` (0px,
111
- * grabbed through its handle); in `collapseZeroBands` mode a 0-hour band is
112
- * `collapsed` instead.
129
+ * Every band is on the same fixed scale, so the label fit sees the band's
130
+ * real width. A real 0-hour band on a resizable bar is `zero` (0px, grabbed
131
+ * through its handle); in `collapseZeroBands` mode a 0-hour band is
132
+ * `collapsed` instead. Only the width and zero flags are set here: the handle
133
+ * placement comes from `placeZeroHandles`, the label insets from
134
+ * `insetLabelsPastHandles` and the labels from `applyLabelFit`, which run
135
+ * after it, in that order.
113
136
  */
114
137
  private bandGeometry;
115
138
  /**
@@ -118,9 +141,38 @@ export default class CxCapacityWeekBar extends CortexElement {
118
141
  * spot, so each run of them gets increasing indices and the handles are laid
119
142
  * side by side. A run that starts at (or past) the right edge of the bar is
120
143
  * drawn leftwards instead, so the edge does not clip it. Bands that take no
121
- * width (other 0-hour bands) do not break a run.
144
+ * width (other 0-hour bands) do not break a run. Returns the runs, with where
145
+ * each starts along a bar of `barPx`, for `insetLabelsPastHandles`.
122
146
  */
123
147
  private placeZeroHandles;
148
+ /**
149
+ * Write `labelInsetStartPx` / `labelInsetEndPx` into `geometries`: how far the
150
+ * handles reach into each band from its left and right end, so its label can
151
+ * be padded past them. A run's handles cover `[startPx, startPx + length *
152
+ * handleWidth]`, or `[startPx - length * handleWidth, startPx]` for a run
153
+ * drawn leftwards at the right edge, clipped to the bar (a run clipped away
154
+ * entirely, such as an `atEnd` run past the bar in an over-capacity week,
155
+ * covers nothing). A run wider than the band beside it also reaches the bands
156
+ * after it. Must run after `placeZeroHandles`.
157
+ */
158
+ private insetLabelsPastHandles;
159
+ /**
160
+ * Decide which label each band shows, writing `showFull` / `showShort` into
161
+ * `geometries`. A label shows only when the room the band has (its width less
162
+ * the handles over it) both reaches the label's threshold and fits the
163
+ * label's measured text. Where the text cannot be measured (the hidden
164
+ * measuring spans are not rendered yet, or there is no canvas), only the
165
+ * thresholds apply. Must run after `insetLabelsPastHandles`.
166
+ */
167
+ private applyLabelFit;
168
+ /** Width (px) of a 0-hour handle, read from the host's CSS custom property. */
169
+ private zeroHandleWidth;
170
+ /**
171
+ * Font and horizontal padding a hidden measuring span resolves to (it carries
172
+ * the label classes and no inset, so these are exactly a label's);
173
+ * `undefined` before it renders.
174
+ */
175
+ private labelMetrics;
124
176
  private renderBand;
125
177
  render(): TemplateResult;
126
178
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "4.43.0",
4
+ "version": "4.44.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {