@linxiraos/pi-wire 1.4.0 → 1.4.1
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/CHANGELOG.md +4 -0
- package/dist/types/tsp.d.ts +45 -3
- package/package.json +1 -1
- package/src/tsp.ts +44 -4
package/CHANGELOG.md
CHANGED
package/dist/types/tsp.d.ts
CHANGED
|
@@ -99,6 +99,15 @@ export interface TspCommonProps {
|
|
|
99
99
|
* run), `drop` dims what the choice discards.
|
|
100
100
|
*/
|
|
101
101
|
mark?: TspMark;
|
|
102
|
+
/**
|
|
103
|
+
* A floating card shown when the pointer rests on the node (~350 ms; ~200 ms
|
|
104
|
+
* right after another tooltip or card), anchored below it (above without
|
|
105
|
+
* room) and clamped to the window. It stays open while the pointer is over
|
|
106
|
+
* the node or the card, closes on leave (short grace), press, key or scroll,
|
|
107
|
+
* and replaces the node's `title` tooltip while open. Terminals that don't
|
|
108
|
+
* know it ignore it and keep showing `title`.
|
|
109
|
+
*/
|
|
110
|
+
hovercard?: TspPropNode;
|
|
102
111
|
}
|
|
103
112
|
/** A {@link TspCommonProps.mark}. */
|
|
104
113
|
export type TspMark = "pick" | "drop";
|
|
@@ -828,6 +837,14 @@ export interface TspMeterProps {
|
|
|
828
837
|
total?: TspText;
|
|
829
838
|
size?: "sm" | "md" | "lg";
|
|
830
839
|
}
|
|
840
|
+
/** A horizontal reference line across a bars/spark chart (a target, a baseline). */
|
|
841
|
+
export interface TspChartMark {
|
|
842
|
+
/** Position in the series' value units. */
|
|
843
|
+
value: number;
|
|
844
|
+
tone?: TspTone;
|
|
845
|
+
/** Tooltip of the line (`target 200 tok/s`). */
|
|
846
|
+
title?: string;
|
|
847
|
+
}
|
|
831
848
|
/** Series data drawn natively: the usage heatmap, app dashboards (§9.2). */
|
|
832
849
|
export interface TspChartProps {
|
|
833
850
|
kind: "heatmap" | "bars" | "spark";
|
|
@@ -842,12 +859,21 @@ export interface TspChartProps {
|
|
|
842
859
|
rows?: readonly string[];
|
|
843
860
|
/** Per-cell tooltips, same shape as `cells` (omit for none). */
|
|
844
861
|
tips?: readonly (readonly (string | null)[])[];
|
|
845
|
-
/** bars/spark: one series
|
|
862
|
+
/** bars/spark: one series; `tone` fills that one column instead of `token`. */
|
|
846
863
|
series?: readonly {
|
|
847
864
|
label?: string;
|
|
848
865
|
value: number;
|
|
849
866
|
title?: string;
|
|
867
|
+
tone?: TspTone;
|
|
850
868
|
}[];
|
|
869
|
+
/**
|
|
870
|
+
* bars/spark: fixed value domain. Without them the low end is 0 and the
|
|
871
|
+
* high end the largest series or mark value.
|
|
872
|
+
*/
|
|
873
|
+
min?: number;
|
|
874
|
+
max?: number;
|
|
875
|
+
/** bars/spark: dashed horizontal reference lines, in value units. */
|
|
876
|
+
marks?: readonly TspChartMark[];
|
|
851
877
|
/** Colour token of the fill (`accent`, `statusLineCost`). */
|
|
852
878
|
token?: string;
|
|
853
879
|
summary?: TspText;
|
|
@@ -900,8 +926,24 @@ export interface TspPropsByKind {
|
|
|
900
926
|
meter: TspMeterProps;
|
|
901
927
|
effort: TspEffortProps;
|
|
902
928
|
}
|
|
903
|
-
/**
|
|
904
|
-
|
|
929
|
+
/**
|
|
930
|
+
* Props of a node of kind `K`: its kind-specific props plus the common ones.
|
|
931
|
+
* A chart's numeric `min`/`max` (its value domain) take the place of the
|
|
932
|
+
* common layout `min`/`max` extents.
|
|
933
|
+
*/
|
|
934
|
+
export type TspProps<K extends TspKind = TspKind> = [K] extends ["chart"] ? TspChartProps & Omit<TspCommonProps, "min" | "max"> : TspPropsByKind[K] & TspCommonProps;
|
|
935
|
+
/**
|
|
936
|
+
* A node tree carried inside a prop (a {@link TspCommonProps.hovercard}): a
|
|
937
|
+
* wire node without ids, mounted by the terminal on demand. `key` is ignored.
|
|
938
|
+
*/
|
|
939
|
+
export type TspPropNode = {
|
|
940
|
+
[K in TspKind]: {
|
|
941
|
+
k: K;
|
|
942
|
+
p?: TspProps<K>;
|
|
943
|
+
c?: readonly TspPropNode[];
|
|
944
|
+
key?: string;
|
|
945
|
+
};
|
|
946
|
+
}[TspKind];
|
|
905
947
|
/** Kinds whose primary text the `text` and `splice` ops address (the `text` prop). */
|
|
906
948
|
export declare const TSP_TEXT_KINDS: readonly ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer"];
|
|
907
949
|
/** A node on the wire. */
|
package/package.json
CHANGED
package/src/tsp.ts
CHANGED
|
@@ -149,6 +149,15 @@ export interface TspCommonProps {
|
|
|
149
149
|
* run), `drop` dims what the choice discards.
|
|
150
150
|
*/
|
|
151
151
|
mark?: TspMark;
|
|
152
|
+
/**
|
|
153
|
+
* A floating card shown when the pointer rests on the node (~350 ms; ~200 ms
|
|
154
|
+
* right after another tooltip or card), anchored below it (above without
|
|
155
|
+
* room) and clamped to the window. It stays open while the pointer is over
|
|
156
|
+
* the node or the card, closes on leave (short grace), press, key or scroll,
|
|
157
|
+
* and replaces the node's `title` tooltip while open. Terminals that don't
|
|
158
|
+
* know it ignore it and keep showing `title`.
|
|
159
|
+
*/
|
|
160
|
+
hovercard?: TspPropNode;
|
|
152
161
|
}
|
|
153
162
|
|
|
154
163
|
/** A {@link TspCommonProps.mark}. */
|
|
@@ -798,6 +807,15 @@ export interface TspMeterProps {
|
|
|
798
807
|
total?: TspText;
|
|
799
808
|
size?: "sm" | "md" | "lg";
|
|
800
809
|
}
|
|
810
|
+
/** A horizontal reference line across a bars/spark chart (a target, a baseline). */
|
|
811
|
+
export interface TspChartMark {
|
|
812
|
+
/** Position in the series' value units. */
|
|
813
|
+
value: number;
|
|
814
|
+
tone?: TspTone;
|
|
815
|
+
/** Tooltip of the line (`target 200 tok/s`). */
|
|
816
|
+
title?: string;
|
|
817
|
+
}
|
|
818
|
+
|
|
801
819
|
/** Series data drawn natively: the usage heatmap, app dashboards (§9.2). */
|
|
802
820
|
export interface TspChartProps {
|
|
803
821
|
kind: "heatmap" | "bars" | "spark";
|
|
@@ -809,8 +827,16 @@ export interface TspChartProps {
|
|
|
809
827
|
rows?: readonly string[];
|
|
810
828
|
/** Per-cell tooltips, same shape as `cells` (omit for none). */
|
|
811
829
|
tips?: readonly (readonly (string | null)[])[];
|
|
812
|
-
/** bars/spark: one series
|
|
813
|
-
series?: readonly { label?: string; value: number; title?: string }[];
|
|
830
|
+
/** bars/spark: one series; `tone` fills that one column instead of `token`. */
|
|
831
|
+
series?: readonly { label?: string; value: number; title?: string; tone?: TspTone }[];
|
|
832
|
+
/**
|
|
833
|
+
* bars/spark: fixed value domain. Without them the low end is 0 and the
|
|
834
|
+
* high end the largest series or mark value.
|
|
835
|
+
*/
|
|
836
|
+
min?: number;
|
|
837
|
+
max?: number;
|
|
838
|
+
/** bars/spark: dashed horizontal reference lines, in value units. */
|
|
839
|
+
marks?: readonly TspChartMark[];
|
|
814
840
|
/** Colour token of the fill (`accent`, `statusLineCost`). */
|
|
815
841
|
token?: string;
|
|
816
842
|
summary?: TspText;
|
|
@@ -865,8 +891,22 @@ export interface TspPropsByKind {
|
|
|
865
891
|
effort: TspEffortProps;
|
|
866
892
|
}
|
|
867
893
|
|
|
868
|
-
/**
|
|
869
|
-
|
|
894
|
+
/**
|
|
895
|
+
* Props of a node of kind `K`: its kind-specific props plus the common ones.
|
|
896
|
+
* A chart's numeric `min`/`max` (its value domain) take the place of the
|
|
897
|
+
* common layout `min`/`max` extents.
|
|
898
|
+
*/
|
|
899
|
+
export type TspProps<K extends TspKind = TspKind> = [K] extends ["chart"]
|
|
900
|
+
? TspChartProps & Omit<TspCommonProps, "min" | "max">
|
|
901
|
+
: TspPropsByKind[K] & TspCommonProps;
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* A node tree carried inside a prop (a {@link TspCommonProps.hovercard}): a
|
|
905
|
+
* wire node without ids, mounted by the terminal on demand. `key` is ignored.
|
|
906
|
+
*/
|
|
907
|
+
export type TspPropNode = {
|
|
908
|
+
[K in TspKind]: { k: K; p?: TspProps<K>; c?: readonly TspPropNode[]; key?: string };
|
|
909
|
+
}[TspKind];
|
|
870
910
|
|
|
871
911
|
/** Kinds whose primary text the `text` and `splice` ops address (the `text` prop). */
|
|
872
912
|
export const TSP_TEXT_KINDS = ["text", "md", "code", "ansi", "math", "editor", "input", "shimmer"] as const;
|