@ksp-gonogo/ui-kit 1.0.0-rc.34 → 1.0.0-rc.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +30 -16
- package/dist/index.js +83 -64
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ declare function DefaultThemeProvider({ children, }: Readonly<DefaultThemeProvid
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* `default-dark`: the built-in mission-control theme, and the one the app
|
|
52
|
-
* mounts. It is a
|
|
52
|
+
* mounts. It is a `UiKitTheme`, which lists the colour and type roles a
|
|
53
53
|
* component can read. Every value is the CSS variable it names (`text.primary` is
|
|
54
54
|
* `var(--color-text-primary)`), so mounting it changes nothing: the values come
|
|
55
55
|
* from `@ksp-gonogo/ui-kit/tokens.css`, which has to be imported once for any
|
|
@@ -1671,7 +1671,7 @@ declare function Box({ surface, pad, bordered, radius, children, ...rest }: BoxP
|
|
|
1671
1671
|
* {@link CommandButton}, and by {@link Button} through its `predictedOutcome`
|
|
1672
1672
|
* prop.
|
|
1673
1673
|
*
|
|
1674
|
-
* @category
|
|
1674
|
+
* @category CommandButton
|
|
1675
1675
|
*/
|
|
1676
1676
|
type PredictedOutcome = "held" | "at-risk";
|
|
1677
1677
|
/**
|
|
@@ -1680,7 +1680,7 @@ type PredictedOutcome = "held" | "at-risk";
|
|
|
1680
1680
|
* and `undefined` for an order that goes at once or when nothing is known.
|
|
1681
1681
|
* Used by {@link CommandButton}.
|
|
1682
1682
|
*
|
|
1683
|
-
* @category
|
|
1683
|
+
* @category CommandButton
|
|
1684
1684
|
*/
|
|
1685
1685
|
declare function predictedOutcomeOf(status: SendStatus | undefined): PredictedOutcome | undefined;
|
|
1686
1686
|
|
|
@@ -6202,10 +6202,10 @@ interface GraphProps {
|
|
|
6202
6202
|
footer?: ReactNode;
|
|
6203
6203
|
/**
|
|
6204
6204
|
* Figures the plot shows about the present, as one fixed card. Where the plot
|
|
6205
|
-
* has measured room for it, the card
|
|
6206
|
-
*
|
|
6207
|
-
*
|
|
6208
|
-
* drawn.
|
|
6205
|
+
* has measured room for it, the card stands in the one column beside the plot
|
|
6206
|
+
* that also holds the legend, under the legend chips. Where it does not, the
|
|
6207
|
+
* card stands over the plot in a corner no trace, line or legend chip
|
|
6208
|
+
* crosses, and where no corner is clear it is not drawn.
|
|
6209
6209
|
*/
|
|
6210
6210
|
plotReadout?: ReactNode | ((room: ReadoutRoom) => ReactNode);
|
|
6211
6211
|
/** `"panel"` (the default) wraps the plot in a panel with a header; `"bare"` draws the framed plot alone, for a plot composed inside another layout. */
|
|
@@ -7638,9 +7638,9 @@ declare function MeterStack({ children, ...rest }: HTMLAttributes<HTMLDivElement
|
|
|
7638
7638
|
*/
|
|
7639
7639
|
declare const MeterRowGroup: styled_components_dist_types.IStyledComponentBase<"web", styled_components.FastOmit<styled_components.FastOmit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | "ref" | keyof HTMLAttributes<HTMLDivElement>> & Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7640
7640
|
ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
7641
|
-
}, "
|
|
7641
|
+
}, "slot" | "style" | "title" | "dir" | "id" | "about" | "resource" | "nonce" | "prefix" | "results" | "children" | "hidden" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "content" | "datatype" | "inlist" | "property" | "rel" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture"> & Partial<Pick<styled_components.FastOmit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | "ref" | keyof HTMLAttributes<HTMLDivElement>> & Omit<react.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
7642
7642
|
ref?: ((instance: HTMLDivElement | null) => void | react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof react.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | react.RefObject<HTMLDivElement> | null | undefined;
|
|
7643
|
-
}, "
|
|
7643
|
+
}, "slot" | "style" | "title" | "dir" | "id" | "about" | "resource" | "nonce" | "prefix" | "results" | "children" | "hidden" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "content" | "datatype" | "inlist" | "property" | "rel" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture">>> & string;
|
|
7644
7644
|
|
|
7645
7645
|
/**
|
|
7646
7646
|
* Which clock an instant is on: SCET, when the event happens at the vessel, or
|
|
@@ -7886,7 +7886,7 @@ declare function useModal(): ModalContextValue;
|
|
|
7886
7886
|
* What a modal dialog offers the content inside it: a sticky footer and an
|
|
7887
7887
|
* unsaved-changes flag. Read it through {@link useModalChrome} or
|
|
7888
7888
|
* {@link useModalSaveBar} rather than directly. Useful for keeping Save within the
|
|
7889
|
-
* operator's reach however far a form scrolls. Provided by {@link
|
|
7889
|
+
* operator's reach however far a form scrolls. Provided by {@link ModalProvider} around
|
|
7890
7890
|
* every dialog's content.
|
|
7891
7891
|
*
|
|
7892
7892
|
* @category Modal
|
|
@@ -7900,7 +7900,7 @@ interface ModalChromeValue {
|
|
|
7900
7900
|
/**
|
|
7901
7901
|
* The footer and unsaved-changes controls each open modal dialog provides to
|
|
7902
7902
|
* its content, `null` outside a modal. Content uses {@link useModalChrome} or
|
|
7903
|
-
* {@link useModalSaveBar} rather than reading it. Provided by {@link
|
|
7903
|
+
* {@link useModalSaveBar} rather than reading it. Provided by {@link ModalProvider}
|
|
7904
7904
|
* around every dialog's content.
|
|
7905
7905
|
*
|
|
7906
7906
|
* @intent Published so content that calls useModalChrome can be rendered under a stand-in modal in a test.
|
|
@@ -9001,6 +9001,10 @@ interface PlotReadoutSpace {
|
|
|
9001
9001
|
height: number;
|
|
9002
9002
|
/** Width the column's widest line needs to be read whole: a legend chip, a caption, a card row, in CSS pixels. */
|
|
9003
9003
|
contentWidth: number;
|
|
9004
|
+
/** Height the legend chips need stacked in the column, in CSS pixels. Taken as 0 when omitted. */
|
|
9005
|
+
legendHeight?: number;
|
|
9006
|
+
/** Height the fixed card needs, in CSS pixels. Taken as 0 when omitted. */
|
|
9007
|
+
cardHeight?: number;
|
|
9004
9008
|
}
|
|
9005
9009
|
/**
|
|
9006
9010
|
* Where a chart's readouts stand: the crosshair card, the legend and the limit
|
|
@@ -9008,7 +9012,9 @@ interface PlotReadoutSpace {
|
|
|
9008
9012
|
* reading. Returned by {@link placePlotReadouts}.
|
|
9009
9013
|
*
|
|
9010
9014
|
* `beside` gives them a column to the right of the plot, so none covers a
|
|
9011
|
-
* trace or a dot. `
|
|
9015
|
+
* trace or a dot. `below` is for a tall or narrow chart: the legend is a
|
|
9016
|
+
* horizontal strip under the plot, and the rest stay inside the plot as in
|
|
9017
|
+
* `overlay`. `overlay` keeps them all inside the plot, drawn only where they
|
|
9012
9018
|
* cover no data.
|
|
9013
9019
|
*
|
|
9014
9020
|
* @category LineGraph
|
|
@@ -9016,11 +9022,16 @@ interface PlotReadoutSpace {
|
|
|
9016
9022
|
type PlotReadoutPlacement = {
|
|
9017
9023
|
/** The card, legend and captions sit over the plot. */
|
|
9018
9024
|
placement: "overlay";
|
|
9025
|
+
} | {
|
|
9026
|
+
/** The legend sits in a strip under the plot; the card and captions sit over the plot. */
|
|
9027
|
+
placement: "below";
|
|
9019
9028
|
} | {
|
|
9020
9029
|
/** The card, legend and captions sit in a column beside the plot. */
|
|
9021
9030
|
placement: "beside";
|
|
9022
9031
|
/** The column's width, in CSS px. */
|
|
9023
9032
|
columnWidth: number;
|
|
9033
|
+
/** Whether the legend sits in a strip under the plot because the column has no height for it beside the card. */
|
|
9034
|
+
legendBelow: boolean;
|
|
9024
9035
|
};
|
|
9025
9036
|
/**
|
|
9026
9037
|
* The placement for a chart's card, legend and captions, decided from the
|
|
@@ -9028,12 +9039,15 @@ type PlotReadoutPlacement = {
|
|
|
9028
9039
|
* reads. Used by the line chart.
|
|
9029
9040
|
*
|
|
9030
9041
|
* A chart with room gives them a column beside the plot, as
|
|
9031
|
-
* wide as its widest line needs so nothing is cut
|
|
9032
|
-
*
|
|
9042
|
+
* wide as its widest line needs so nothing is cut, and as tall as the legend
|
|
9043
|
+
* and the card need stacked, or with the legend under the plot where the
|
|
9044
|
+
* column only has the height for the card. A chart taller than it is wide, or narrower than
|
|
9045
|
+
* a column allows, but tall enough for a strip, puts the legend under the plot;
|
|
9046
|
+
* one that is smaller keeps them over the plot.
|
|
9033
9047
|
*
|
|
9034
9048
|
* @category LineGraph
|
|
9035
9049
|
*/
|
|
9036
|
-
declare function placePlotReadouts({ width, height, contentWidth, }: PlotReadoutSpace): PlotReadoutPlacement;
|
|
9050
|
+
declare function placePlotReadouts({ width, height, contentWidth, legendHeight, cardHeight, }: PlotReadoutSpace): PlotReadoutPlacement;
|
|
9037
9051
|
|
|
9038
9052
|
/**
|
|
9039
9053
|
* One frame a {@link ReadFrameControl} can offer, and what an operator calls
|
|
@@ -9493,7 +9507,7 @@ declare function SelectableRow({ selected, gap, layout, selectedLook, children,
|
|
|
9493
9507
|
* arrive). Written for a tooltip or an accessible name. Used by
|
|
9494
9508
|
* {@link CommandButton} for its tooltip.
|
|
9495
9509
|
*
|
|
9496
|
-
* @category
|
|
9510
|
+
* @category CommandButton
|
|
9497
9511
|
*/
|
|
9498
9512
|
declare function describeSendStatus(status: SendStatus): string;
|
|
9499
9513
|
|
package/dist/index.js
CHANGED
|
@@ -4303,6 +4303,9 @@ function PlotCrosshair({
|
|
|
4303
4303
|
// src/plotReadoutPlacement.ts
|
|
4304
4304
|
var BESIDE_MIN_WIDTH = 480;
|
|
4305
4305
|
var BESIDE_MIN_HEIGHT = 110;
|
|
4306
|
+
var BELOW_MIN_HEIGHT = 200;
|
|
4307
|
+
var PLOT_CHROME_PX = 56;
|
|
4308
|
+
var LEGEND_STRIP_PX = 20;
|
|
4306
4309
|
var COLUMN_MIN_PX = 112;
|
|
4307
4310
|
var COLUMN_MAX_PX = 260;
|
|
4308
4311
|
var COLUMN_MAX_SHARE = 0.4;
|
|
@@ -4310,13 +4313,23 @@ var PLOT_KEEPS_PX = 300;
|
|
|
4310
4313
|
function placePlotReadouts({
|
|
4311
4314
|
width,
|
|
4312
4315
|
height,
|
|
4313
|
-
contentWidth
|
|
4316
|
+
contentWidth,
|
|
4317
|
+
legendHeight = 0,
|
|
4318
|
+
cardHeight = 0
|
|
4314
4319
|
}) {
|
|
4315
4320
|
const columnWidth = Math.max(COLUMN_MIN_PX, Math.ceil(contentWidth));
|
|
4321
|
+
const tallOrNarrow = height > width || width < BESIDE_MIN_WIDTH;
|
|
4322
|
+
if (tallOrNarrow && height >= BELOW_MIN_HEIGHT) {
|
|
4323
|
+
return { placement: "below" };
|
|
4324
|
+
}
|
|
4316
4325
|
if (width < BESIDE_MIN_WIDTH || height < BESIDE_MIN_HEIGHT || columnWidth > Math.min(COLUMN_MAX_PX, width * COLUMN_MAX_SHARE) || width - columnWidth < PLOT_KEEPS_PX) {
|
|
4317
4326
|
return { placement: "overlay" };
|
|
4318
4327
|
}
|
|
4319
|
-
|
|
4328
|
+
const stacked = height >= PLOT_CHROME_PX + legendHeight + cardHeight;
|
|
4329
|
+
if (!stacked && height < PLOT_CHROME_PX + LEGEND_STRIP_PX + cardHeight) {
|
|
4330
|
+
return { placement: "overlay" };
|
|
4331
|
+
}
|
|
4332
|
+
return { placement: "beside", columnWidth, legendBelow: !stacked };
|
|
4320
4333
|
}
|
|
4321
4334
|
|
|
4322
4335
|
// src/reckoningBasisPhrase.ts
|
|
@@ -6304,6 +6317,24 @@ var Y_LABEL_INSET = 4;
|
|
|
6304
6317
|
var MAX_GUTTER_SHARE = 0.4;
|
|
6305
6318
|
var SPATIAL_GRID_PITCH_PX = 26;
|
|
6306
6319
|
var AXIS_TITLE_PX = 14;
|
|
6320
|
+
var LEGEND_ROW_PX = 16;
|
|
6321
|
+
var LEGEND_STRIP_EDGE_PX = 4;
|
|
6322
|
+
var LEGEND_STRIP_GAP_PX = 6;
|
|
6323
|
+
var chipWidth = (label, room) => Math.min(label.length * 6 + 8, room);
|
|
6324
|
+
function legendStripRows(widths, room) {
|
|
6325
|
+
const positions = [];
|
|
6326
|
+
let row = 0;
|
|
6327
|
+
let x = 0;
|
|
6328
|
+
for (const width of widths) {
|
|
6329
|
+
if (x > 0 && x + width > room) {
|
|
6330
|
+
row += 1;
|
|
6331
|
+
x = 0;
|
|
6332
|
+
}
|
|
6333
|
+
positions.push({ row, x });
|
|
6334
|
+
x += width + LEGEND_STRIP_GAP_PX;
|
|
6335
|
+
}
|
|
6336
|
+
return { rows: widths.length === 0 ? 0 : row + 1, positions };
|
|
6337
|
+
}
|
|
6307
6338
|
var CARD_EDGE_PX = 4;
|
|
6308
6339
|
var VALUE_READ_SHARE = 0.03;
|
|
6309
6340
|
function fitTitle(text, px) {
|
|
@@ -6372,7 +6403,8 @@ function readoutColumnWidth({
|
|
|
6372
6403
|
thresholds,
|
|
6373
6404
|
heading,
|
|
6374
6405
|
crosshairOn,
|
|
6375
|
-
yTickFormat
|
|
6406
|
+
yTickFormat,
|
|
6407
|
+
cardWidth
|
|
6376
6408
|
}) {
|
|
6377
6409
|
const px = (chars) => chars * LABEL_CHAR_PX2;
|
|
6378
6410
|
const widths = [];
|
|
@@ -6398,6 +6430,7 @@ function readoutColumnWidth({
|
|
|
6398
6430
|
if (crosshairOn) {
|
|
6399
6431
|
widths.push(Math.max(...heading.map((h) => px(h.length))) + CARD_PAD_PX);
|
|
6400
6432
|
}
|
|
6433
|
+
widths.push(cardWidth);
|
|
6401
6434
|
return Math.max(0, ...widths) + COLUMN_SLACK_PX;
|
|
6402
6435
|
}
|
|
6403
6436
|
function LineChart({
|
|
@@ -6472,13 +6505,36 @@ function LineChart({
|
|
|
6472
6505
|
(s) => s.axis === "secondary" && s.data.x.length > 0
|
|
6473
6506
|
);
|
|
6474
6507
|
const hasSecondary = secondarySeries.length > 0;
|
|
6508
|
+
const hasReadouts = crosshairOn || hasCard || legend !== "none" && series.length > 0 || (thresholds ?? []).some((t) => t.label);
|
|
6509
|
+
const readouts = bare || !hasReadouts ? { placement: "overlay" } : placePlotReadouts({
|
|
6510
|
+
width: w,
|
|
6511
|
+
height: h,
|
|
6512
|
+
contentWidth: readoutColumnWidth({
|
|
6513
|
+
series,
|
|
6514
|
+
thresholds: thresholds ?? [],
|
|
6515
|
+
heading: [xDomain[0], xDomain[1]].map(
|
|
6516
|
+
(v) => xTickFormat(v, xDomain)
|
|
6517
|
+
),
|
|
6518
|
+
crosshairOn,
|
|
6519
|
+
yTickFormat,
|
|
6520
|
+
cardWidth: hasCard && cardSize !== null ? cardSize.w : 0
|
|
6521
|
+
}),
|
|
6522
|
+
legendHeight: legend === "none" ? 0 : series.length * LEGEND_ROW_PX + 6,
|
|
6523
|
+
cardHeight: hasCard && cardSize !== null ? cardSize.h : 0
|
|
6524
|
+
});
|
|
6525
|
+
const legendBelow = legend !== "none" && (readouts.placement === "below" || readouts.placement === "beside" && readouts.legendBelow);
|
|
6526
|
+
const legendStrip = legendBelow ? legendStripRows(
|
|
6527
|
+
series.map((s) => chipWidth(s.label, w - 2 * LEGEND_STRIP_EDGE_PX)),
|
|
6528
|
+
w - 2 * LEGEND_STRIP_EDGE_PX
|
|
6529
|
+
) : { rows: 0, positions: [] };
|
|
6530
|
+
const legendStripH = legendStrip.rows === 0 ? 0 : legendStrip.rows * LEGEND_ROW_PX + 4;
|
|
6475
6531
|
const titledX = !bare && !hideXAxis && !!xAxisLabel;
|
|
6476
6532
|
const titledY = !bare && !!yAxisLabel;
|
|
6477
6533
|
const titledSecondary = !bare && hasSecondary && !!ySecondaryAxisLabel;
|
|
6478
6534
|
const base = bare ? { top: 1, right: 1, bottom: 1, left: 1 } : fitMargins(w, h, hasSecondary);
|
|
6479
6535
|
const fitted = {
|
|
6480
6536
|
...base,
|
|
6481
|
-
bottom: base.bottom + (titledX ? AXIS_TITLE_PX : 0)
|
|
6537
|
+
bottom: base.bottom + (titledX ? AXIS_TITLE_PX : 0) + legendStripH
|
|
6482
6538
|
};
|
|
6483
6539
|
const plotY0 = fitted.top;
|
|
6484
6540
|
const plotY1 = h - fitted.bottom;
|
|
@@ -6559,20 +6615,6 @@ function LineChart({
|
|
|
6559
6615
|
right: (hasSecondary ? labelGutter(yTicksSecondary, fitted.right) : fitted.right) + (titledSecondary ? AXIS_TITLE_PX : 0)
|
|
6560
6616
|
};
|
|
6561
6617
|
const plotX0 = margin.left;
|
|
6562
|
-
const hasReadouts = crosshairOn || legend !== "none" && series.length > 0 || (thresholds ?? []).some((t) => t.label);
|
|
6563
|
-
const readouts = bare || !hasReadouts ? { placement: "overlay" } : placePlotReadouts({
|
|
6564
|
-
width: w,
|
|
6565
|
-
height: h,
|
|
6566
|
-
contentWidth: readoutColumnWidth({
|
|
6567
|
-
series,
|
|
6568
|
-
thresholds: thresholds ?? [],
|
|
6569
|
-
heading: [xDomain[0], xDomain[1]].map(
|
|
6570
|
-
(v) => xTickFormat(v, xDomain)
|
|
6571
|
-
),
|
|
6572
|
-
crosshairOn,
|
|
6573
|
-
yTickFormat
|
|
6574
|
-
})
|
|
6575
|
-
});
|
|
6576
6618
|
const columnWidth = readouts.placement === "beside" ? readouts.columnWidth : 0;
|
|
6577
6619
|
const plotX1 = w - margin.right - columnWidth;
|
|
6578
6620
|
const plotW = plotX1 - plotX0;
|
|
@@ -6823,6 +6865,16 @@ function LineChart({
|
|
|
6823
6865
|
]);
|
|
6824
6866
|
const cardBox = (() => {
|
|
6825
6867
|
if (!hasCard || cardSize === null || bare) return void 0;
|
|
6868
|
+
if (column) {
|
|
6869
|
+
const box = {
|
|
6870
|
+
x0: column.x0,
|
|
6871
|
+
y0: plotY1 - cardSize.h,
|
|
6872
|
+
x1: column.x0 + cardSize.w,
|
|
6873
|
+
y1: plotY1
|
|
6874
|
+
};
|
|
6875
|
+
const legendFoot = plotY0 + (legend === "none" || legendBelow ? 0 : series.length * LEGEND_ROW_PX + 6);
|
|
6876
|
+
return box.x1 <= column.x1 && box.y0 >= legendFoot ? box : void 0;
|
|
6877
|
+
}
|
|
6826
6878
|
const half = LIMIT_MARK_SIZE / 2;
|
|
6827
6879
|
const traces = [
|
|
6828
6880
|
...series.filter((s) => (s.type ?? "line") !== "band").flatMap((s) => {
|
|
@@ -6840,7 +6892,7 @@ function LineChart({
|
|
|
6840
6892
|
x1: m.x + half,
|
|
6841
6893
|
y1: m.y + half
|
|
6842
6894
|
})),
|
|
6843
|
-
...legend === "none" || column ? [] : series.map((s, i) => ({
|
|
6895
|
+
...legend === "none" || column || legendBelow ? [] : series.map((s, i) => ({
|
|
6844
6896
|
x0: plotX0 + 3,
|
|
6845
6897
|
y0: plotY0 + 6 + i * 16,
|
|
6846
6898
|
x1: plotX0 + 3 + Math.min(s.label.length * 6 + 8, plotW - 6),
|
|
@@ -6873,7 +6925,7 @@ function LineChart({
|
|
|
6873
6925
|
x1: m.x + half,
|
|
6874
6926
|
y1: m.y + half
|
|
6875
6927
|
})),
|
|
6876
|
-
...legend === "none" ? [] : series.map((s, i) => ({
|
|
6928
|
+
...legend === "none" || legendBelow ? [] : series.map((s, i) => ({
|
|
6877
6929
|
x0: column ? column.x0 : plotX0 + 3,
|
|
6878
6930
|
y0: plotY0 + 6 + i * 16,
|
|
6879
6931
|
x1: (column ? column.x0 : plotX0 + 3) + Math.min(
|
|
@@ -6897,6 +6949,7 @@ function LineChart({
|
|
|
6897
6949
|
thresholdLines,
|
|
6898
6950
|
crossingMarks,
|
|
6899
6951
|
legend,
|
|
6952
|
+
legendBelow,
|
|
6900
6953
|
series,
|
|
6901
6954
|
scaleX,
|
|
6902
6955
|
scaleYPrimary,
|
|
@@ -7234,7 +7287,7 @@ function LineChart({
|
|
|
7234
7287
|
"text",
|
|
7235
7288
|
{
|
|
7236
7289
|
x: (plotX0 + plotX1) / 2,
|
|
7237
|
-
y: h - 5,
|
|
7290
|
+
y: h - legendStripH - 5,
|
|
7238
7291
|
textAnchor: "middle",
|
|
7239
7292
|
fill: "var(--color-text-muted)",
|
|
7240
7293
|
fontSize: 10,
|
|
@@ -7517,12 +7570,13 @@ function LineChart({
|
|
|
7517
7570
|
},
|
|
7518
7571
|
mark.key
|
|
7519
7572
|
)),
|
|
7520
|
-
legend !== "none" && !cardShown && series.map((s, i) => {
|
|
7521
|
-
const
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
const
|
|
7525
|
-
const
|
|
7573
|
+
legend !== "none" && (legendBelow || !cardShown) && series.map((s, i) => {
|
|
7574
|
+
const at = legendBelow ? legendStrip.positions[i] : void 0;
|
|
7575
|
+
const rowY = at ? h - legendStripH + 2 + at.row * LEGEND_ROW_PX : plotY0 + 6 + i * LEGEND_ROW_PX;
|
|
7576
|
+
if (!legendBelow && rowY + 13 > plotY1) return null;
|
|
7577
|
+
const chipX = at ? LEGEND_STRIP_EDGE_PX + at.x : column ? column.x0 : plotX0 + 3;
|
|
7578
|
+
const chipRoom = legendBelow ? w - 2 * LEGEND_STRIP_EDGE_PX : column ? column.x1 - column.x0 : plotW - 6;
|
|
7579
|
+
const chipW = chipWidth(s.label, chipRoom);
|
|
7526
7580
|
const maxChars = Math.max(1, Math.floor((chipW - 8) / 6));
|
|
7527
7581
|
const labelText = s.label.length > maxChars ? `${s.label.slice(0, Math.max(1, maxChars - 1))}...` : s.label;
|
|
7528
7582
|
return /* @__PURE__ */ jsxs30(React.Fragment, { children: [
|
|
@@ -7685,9 +7739,6 @@ function thresholdRuleOf(line, index) {
|
|
|
7685
7739
|
};
|
|
7686
7740
|
}
|
|
7687
7741
|
var EMPTY_LAYERS = Object.freeze([]);
|
|
7688
|
-
var ASIDE_GUESS_PX = 180;
|
|
7689
|
-
var ASIDE_CHROME_PX = 24;
|
|
7690
|
-
var ASIDE_PLOT_KEEPS_PX = 300;
|
|
7691
7742
|
var CHART_BODY = {
|
|
7692
7743
|
flex: 1,
|
|
7693
7744
|
display: "flex",
|
|
@@ -7696,13 +7747,6 @@ var CHART_BODY = {
|
|
|
7696
7747
|
minWidth: 0
|
|
7697
7748
|
};
|
|
7698
7749
|
var CHART_FRAME = { flex: 1, minHeight: 0, minWidth: 0 };
|
|
7699
|
-
var PLOT_ASIDE = {
|
|
7700
|
-
flex: "0 0 auto",
|
|
7701
|
-
display: "flex",
|
|
7702
|
-
flexDirection: "column",
|
|
7703
|
-
justifyContent: "center",
|
|
7704
|
-
borderLeft: "1px solid var(--color-border-subtle)"
|
|
7705
|
-
};
|
|
7706
7750
|
var CHART_AREA = {
|
|
7707
7751
|
flex: 1,
|
|
7708
7752
|
position: "relative",
|
|
@@ -7777,21 +7821,6 @@ function Graph({
|
|
|
7777
7821
|
ro.observe(el);
|
|
7778
7822
|
return () => ro.disconnect();
|
|
7779
7823
|
}, []);
|
|
7780
|
-
const [asideSize, setAsideSize] = useState12(
|
|
7781
|
-
null
|
|
7782
|
-
);
|
|
7783
|
-
const [asideEl, setAsideEl] = useState12(null);
|
|
7784
|
-
useEffect9(() => {
|
|
7785
|
-
if (!asideEl || typeof ResizeObserver === "undefined") return;
|
|
7786
|
-
const ro = new ResizeObserver(
|
|
7787
|
-
() => setAsideSize({
|
|
7788
|
-
w: asideEl.offsetWidth + ASIDE_CHROME_PX,
|
|
7789
|
-
h: asideEl.offsetHeight + ASIDE_CHROME_PX
|
|
7790
|
-
})
|
|
7791
|
-
);
|
|
7792
|
-
ro.observe(asideEl);
|
|
7793
|
-
return () => ro.disconnect();
|
|
7794
|
-
}, [asideEl]);
|
|
7795
7824
|
const thresholdRules = (thresholds ?? []).map(thresholdRuleOf).filter((rule) => rule !== null);
|
|
7796
7825
|
const overlaySeries = !xIsTime && referenceCurves ? referenceCurves.map((curve) => ({
|
|
7797
7826
|
id: `__ref_${curve.id}`,
|
|
@@ -7833,15 +7862,6 @@ function Graph({
|
|
|
7833
7862
|
}
|
|
7834
7863
|
return { x, y: lead.data.y[last], references };
|
|
7835
7864
|
})();
|
|
7836
|
-
const columnReadout = typeof plotReadout === "function" ? plotReadout({
|
|
7837
|
-
width: Number.POSITIVE_INFINITY,
|
|
7838
|
-
height: Number.POSITIVE_INFINITY,
|
|
7839
|
-
present,
|
|
7840
|
-
compact: false,
|
|
7841
|
-
tight: false
|
|
7842
|
-
}) : plotReadout;
|
|
7843
|
-
const hasReadout = columnReadout !== void 0 && columnReadout !== null;
|
|
7844
|
-
const readoutBeside = hasReadout && area !== null && area.w - (asideSize?.w ?? ASIDE_GUESS_PX) >= ASIDE_PLOT_KEEPS_PX && area.h >= (asideSize?.h ?? 0);
|
|
7845
7865
|
const Frame = density === "compact" ? PlainFrame : FramedDisplay;
|
|
7846
7866
|
const chartBody = /* @__PURE__ */ jsxs31(
|
|
7847
7867
|
"div",
|
|
@@ -7880,13 +7900,13 @@ function Graph({
|
|
|
7880
7900
|
xAxisLabel: spatial ? void 0 : xAxisLabel,
|
|
7881
7901
|
yAxisLabel: spatial ? void 0 : yAxisLabel,
|
|
7882
7902
|
ySecondaryAxisLabel: spatial ? void 0 : ySecondaryAxisLabel,
|
|
7883
|
-
card:
|
|
7903
|
+
card: typeof plotReadout === "function" ? (room) => plotReadout({
|
|
7884
7904
|
width: room.width,
|
|
7885
7905
|
height: room.height,
|
|
7886
7906
|
present,
|
|
7887
7907
|
compact: room.form > 0,
|
|
7888
7908
|
tight: room.form > 1
|
|
7889
|
-
}) : plotReadout
|
|
7909
|
+
}) : plotReadout,
|
|
7890
7910
|
cardForms: typeof plotReadout === "function" ? 3 : 1,
|
|
7891
7911
|
width: size.w,
|
|
7892
7912
|
height: size.h
|
|
@@ -7894,7 +7914,6 @@ function Graph({
|
|
|
7894
7914
|
),
|
|
7895
7915
|
notices.length > 0 && noticePlacement === "center" && noticeNode
|
|
7896
7916
|
] }),
|
|
7897
|
-
readoutBeside && /* @__PURE__ */ jsx44(Box, { pad: "surface", style: PLOT_ASIDE, children: /* @__PURE__ */ jsx44("div", { ref: setAsideEl, "data-plot-aside": "", children: columnReadout }) }),
|
|
7898
7917
|
children
|
|
7899
7918
|
] }),
|
|
7900
7919
|
notices.length > 0 && noticePlacement !== "center" && noticeNode
|