@graphysdk/viz-engine 0.0.1-plugins.3 → 0.0.1-plugins.4
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.cjs +13 -13
- package/dist/index.d.ts +117 -11
- package/dist/index.mjs +2731 -2123
- package/package.json +3 -8
- package/dist/extensions.cjs +0 -1
- package/dist/extensions.d.ts +0 -1296
- package/dist/extensions.mjs +0 -86
- package/dist/geom.utils-BbMUNkrO.js +0 -556
- package/dist/geom.utils-DbZj1kY1.cjs +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -96,7 +96,7 @@ export declare interface AngleExtent {
|
|
|
96
96
|
* render-half `draw` lives in the renderer and binds to this definition by import (`defineAnnotationRenderer`).
|
|
97
97
|
*/
|
|
98
98
|
/** Optional coordinate-count guardrail enforced by the builder; unbounded when omitted. */
|
|
99
|
-
declare interface AnnotationArity {
|
|
99
|
+
export declare interface AnnotationArity {
|
|
100
100
|
min?: number;
|
|
101
101
|
max?: number;
|
|
102
102
|
}
|
|
@@ -142,7 +142,7 @@ declare interface AnnotationDataPoint {
|
|
|
142
142
|
rowValue?: DataValue;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
declare interface AnnotationDef<TParams extends object = object, TType extends string = string> {
|
|
145
|
+
export declare interface AnnotationDef<TParams extends object = object, TType extends string = string> {
|
|
146
146
|
type: TType;
|
|
147
147
|
/** Carrier that lets the builder recover `TParams` and merge defaults before a param reaches `draw`. */
|
|
148
148
|
defaultParams: TParams;
|
|
@@ -1114,7 +1114,7 @@ export declare interface CompiledFreeformArrow {
|
|
|
1114
1114
|
hasStickerStyle: boolean;
|
|
1115
1115
|
}
|
|
1116
1116
|
|
|
1117
|
-
declare interface CompiledGeom {
|
|
1117
|
+
export declare interface CompiledGeom {
|
|
1118
1118
|
/** The reparameterized dataset (may have new computed variables) */
|
|
1119
1119
|
data: Dataset;
|
|
1120
1120
|
/** Any mapping overrides produced by the geom */
|
|
@@ -1864,7 +1864,7 @@ declare interface CoordTransformInput {
|
|
|
1864
1864
|
* - `'polar'` — Polar coordinates for pie, radar, and radial charts
|
|
1865
1865
|
* - `'flip'` — Cartesian with x and y axes swapped
|
|
1866
1866
|
*/
|
|
1867
|
-
declare type CoordType = 'cartesian' | 'polar' | 'flip';
|
|
1867
|
+
export declare type CoordType = 'cartesian' | 'polar' | 'flip';
|
|
1868
1868
|
|
|
1869
1869
|
declare function count(): CountStatSpec;
|
|
1870
1870
|
|
|
@@ -1916,6 +1916,9 @@ export declare const createGroupValueReader: (data: Dataset, mapping: AesMapping
|
|
|
1916
1916
|
|
|
1917
1917
|
export declare const createLabelValueReader: (data: Dataset, mapping: AesMapping) => (observation: Observation) => DataValue;
|
|
1918
1918
|
|
|
1919
|
+
/** Opens a {@link MarkTable} builder for a heterogeneous, kind-tagged Tier-C dataset. */
|
|
1920
|
+
export declare function createMarkTable(): MarkTable;
|
|
1921
|
+
|
|
1919
1922
|
/**
|
|
1920
1923
|
* Builds a per-observation reader for an `AestheticValue`:
|
|
1921
1924
|
* - `{ value: X }` → returns `X` for every observation.
|
|
@@ -2468,6 +2471,18 @@ declare type DefaultPaletteConfig = {
|
|
|
2468
2471
|
type: 'default';
|
|
2469
2472
|
};
|
|
2470
2473
|
|
|
2474
|
+
/**
|
|
2475
|
+
* `TType` is a `const` type parameter so the literal kind name (`'calloutBox'`) survives to the type
|
|
2476
|
+
* level — the registration-typed builder keys `annotation.<kind>(...)` off it, the same way
|
|
2477
|
+
* `createGraphyBuilder` captures a geom's name. `TParams` is recovered from `defaultParams`; annotate or
|
|
2478
|
+
* cast it (`defaultParams: {...} as CalloutBoxParams`) when a param's literal union would otherwise widen.
|
|
2479
|
+
*/
|
|
2480
|
+
export declare function defineAnnotation<const TType extends string, TParams extends object = object>(def: {
|
|
2481
|
+
type: TType;
|
|
2482
|
+
defaultParams?: TParams;
|
|
2483
|
+
coordinates?: AnnotationArity;
|
|
2484
|
+
}): AnnotationDef<TParams, TType>;
|
|
2485
|
+
|
|
2471
2486
|
declare interface DifferenceArrowDimensions {
|
|
2472
2487
|
/** Gap between the arrow start point and its anchored observation. */
|
|
2473
2488
|
arrowStartGap: number;
|
|
@@ -2584,9 +2599,21 @@ export declare interface ExternalMeasurements {
|
|
|
2584
2599
|
footerSize: BoxSize;
|
|
2585
2600
|
}
|
|
2586
2601
|
|
|
2602
|
+
/**
|
|
2603
|
+
* Extracts the constant value from a `{ value }` mapping. Returns undefined for variable mappings.
|
|
2604
|
+
*/
|
|
2605
|
+
export declare function extractConstantValue(aestheticValue: AestheticValue | undefined): DataValue | undefined;
|
|
2606
|
+
|
|
2587
2607
|
/** Flattens a title, subtitle, or caption to plain text for measurement and static renderers. */
|
|
2588
2608
|
export declare const extractPlainText: (content: TextContent) => string;
|
|
2589
2609
|
|
|
2610
|
+
/**
|
|
2611
|
+
* Extracts the variable name from an AestheticValue.
|
|
2612
|
+
* Returns the variable name for string shorthands and { variable } mappings.
|
|
2613
|
+
* Returns null for constant { value } mappings or undefined values.
|
|
2614
|
+
*/
|
|
2615
|
+
export declare function extractVariableName(aestheticValue: AestheticValue | undefined): VariableName | null;
|
|
2616
|
+
|
|
2590
2617
|
declare function filter(options: FilterOptions): FilterTransformInput;
|
|
2591
2618
|
|
|
2592
2619
|
/***************************************************************
|
|
@@ -2792,7 +2819,7 @@ declare type GenerateTicksOptions = {
|
|
|
2792
2819
|
* empty default and keep their typed params through the spec builder's static surface; a custom geom
|
|
2793
2820
|
* names its params type and declares matching {@link defaultParams}.
|
|
2794
2821
|
*/
|
|
2795
|
-
declare abstract class Geom<TParams extends object = object> {
|
|
2822
|
+
export declare abstract class Geom<TParams extends object = object> {
|
|
2796
2823
|
/**
|
|
2797
2824
|
* The aesthetics an author must map for this geom. Built-ins list closed aesthetic keys
|
|
2798
2825
|
* (`['x','y']`); a custom geom may also list open channel names (a box plot's `min`/`q1`/…) that it
|
|
@@ -2952,7 +2979,7 @@ declare class GeomCompiler {
|
|
|
2952
2979
|
resolveAnchorPosition(geomName: GeomIdentity, observation: Observation, coordSystem: CoordSystem): AnchorPosition | null;
|
|
2953
2980
|
}
|
|
2954
2981
|
|
|
2955
|
-
declare interface GeomCompilerInput {
|
|
2982
|
+
export declare interface GeomCompilerInput {
|
|
2956
2983
|
/** The dataset after stat transformation */
|
|
2957
2984
|
data: Dataset;
|
|
2958
2985
|
/** The effective mapping for the layer */
|
|
@@ -3020,7 +3047,7 @@ declare class GeomRegistry extends Registry<string, Geom> {
|
|
|
3020
3047
|
* data: the `label` is static text and the `variable` names a column, so the rows ride in the
|
|
3021
3048
|
* serialisable compiled spec.
|
|
3022
3049
|
*/
|
|
3023
|
-
declare interface GeomTooltipRow {
|
|
3050
|
+
export declare interface GeomTooltipRow {
|
|
3024
3051
|
/** The row's label (e.g. "Open"). Static text the geom supplies. */
|
|
3025
3052
|
label: string;
|
|
3026
3053
|
/** The data column whose per-observation value the row displays. */
|
|
@@ -3244,7 +3271,7 @@ declare type GraphyPaletteVariant = 'default' | 'waterfall';
|
|
|
3244
3271
|
* for instance. A geom declares these so the axis guide resolves grid policy from the definition
|
|
3245
3272
|
* instead of a geom-keyed lookup. Every field absent means the geom imposes no policy.
|
|
3246
3273
|
*/
|
|
3247
|
-
declare interface GridPolicy {
|
|
3274
|
+
export declare interface GridPolicy {
|
|
3248
3275
|
hideGridX?: boolean;
|
|
3249
3276
|
hideGridY?: boolean;
|
|
3250
3277
|
hideBorder?: boolean;
|
|
@@ -3792,6 +3819,17 @@ declare interface InferredScaleInput {
|
|
|
3792
3819
|
|
|
3793
3820
|
declare type InferredScaleOptions = ContinuousScaleOptions | DiscreteScaleOptions | DatetimeScaleOptions;
|
|
3794
3821
|
|
|
3822
|
+
/**
|
|
3823
|
+
* Recovers where a raw sub-value sits inside an already-scaled interval. Given a raw `[rawLo, rawHi]`
|
|
3824
|
+
* pair that the compiler mapped to the scaled `[scaledLo, scaledHi]` endpoints, returns the scaled
|
|
3825
|
+
* position of `raw` by affine interpolation. The Tier-B trick a candlestick uses to place its open/close
|
|
3826
|
+
* inside the scaled `[low, high]` wick without re-running the y-scale.
|
|
3827
|
+
*
|
|
3828
|
+
* Exact only when the scale between raw and scaled space is **linear** — both endpoints pin a straight
|
|
3829
|
+
* line every interior value reads off. A degenerate interval (`rawLo === rawHi`) returns `scaledLo`.
|
|
3830
|
+
*/
|
|
3831
|
+
export declare function interpolateInScaledInterval(raw: number, rawLo: number, rawHi: number, scaledLo: number, scaledHi: number): number;
|
|
3832
|
+
|
|
3795
3833
|
/**
|
|
3796
3834
|
* Curve interpolation method for lines and areas.
|
|
3797
3835
|
*
|
|
@@ -4283,6 +4321,30 @@ declare interface MappingItem {
|
|
|
4283
4321
|
mapping: AesMapping;
|
|
4284
4322
|
}
|
|
4285
4323
|
|
|
4324
|
+
/** Declares one mark kind's own columns and the data type of each. */
|
|
4325
|
+
export declare type MarkColumnSchema = Record<string, DataType>;
|
|
4326
|
+
|
|
4327
|
+
/**
|
|
4328
|
+
* Builds one columnar {@link Dataset} from heterogeneous marks discriminated by a `kind` column — *the*
|
|
4329
|
+
* Tier-C dataset shape (node+link, group+leaf, node+edge). Each kind declares its own columns; the union
|
|
4330
|
+
* across kinds forms the dataset's columns, and a row's off-kind columns are filled with `null` **by
|
|
4331
|
+
* construction**, so the null-padding invariant a hand-built builder maintains by hand (and breaks when a
|
|
4332
|
+
* column is omitted from one kind's push) can no longer drift.
|
|
4333
|
+
*/
|
|
4334
|
+
declare class MarkTable {
|
|
4335
|
+
/** Column name → declared type, accumulated as the union across every declared kind. */
|
|
4336
|
+
private readonly columnTypes;
|
|
4337
|
+
/** Kind name → the column names that kind owns. */
|
|
4338
|
+
private readonly kindColumns;
|
|
4339
|
+
private readonly rows;
|
|
4340
|
+
/** Declares a mark kind and the columns it carries. Throws if the kind repeats or a column's type conflicts. */
|
|
4341
|
+
kind(name: string, columns: MarkColumnSchema): this;
|
|
4342
|
+
/** Appends one row for a declared kind. Throws if the kind is unknown, or a value misses/overshoots the kind's columns. */
|
|
4343
|
+
push(kind: string, values: Record<string, DataValue>): this;
|
|
4344
|
+
/** Materialises the rows into a {@link Dataset}, null-padding every off-kind column. */
|
|
4345
|
+
toDataset(options: ToDatasetOptions): Dataset;
|
|
4346
|
+
}
|
|
4347
|
+
|
|
4286
4348
|
declare function mean(): MeanStatSpec;
|
|
4287
4349
|
|
|
4288
4350
|
/**
|
|
@@ -4745,7 +4807,7 @@ declare interface PositionalScaleMethods {
|
|
|
4745
4807
|
* derives from. A geom's channels are the manifest the position mapper and coord projection iterate
|
|
4746
4808
|
* instead of hardcoding the column set.
|
|
4747
4809
|
*/
|
|
4748
|
-
declare type PositionChannel = RolePositionChannel | ScalarPositionChannel;
|
|
4810
|
+
export declare type PositionChannel = RolePositionChannel | ScalarPositionChannel;
|
|
4749
4811
|
|
|
4750
4812
|
declare interface PositionChannelBase {
|
|
4751
4813
|
axis: ChannelAxis;
|
|
@@ -4820,6 +4882,32 @@ export declare interface RadiusExtent {
|
|
|
4820
4882
|
outerRadius: NumericDataValue;
|
|
4821
4883
|
}
|
|
4822
4884
|
|
|
4885
|
+
/**
|
|
4886
|
+
* Reads an aesthetic value by an open channel name — built-in (`x`, `color`, …) or custom. A custom
|
|
4887
|
+
* geom maps extra channels (a box plot's `q1`/`median`/`q3`, an error bar's bounds) under names outside
|
|
4888
|
+
* the closed {@link AestheticKey} set; those keys ride in the mapping at runtime and are read here
|
|
4889
|
+
* through the one sanctioned widening, so a channel's value is sourced from `aes` rather than `params`.
|
|
4890
|
+
*/
|
|
4891
|
+
export declare function readAesthetic(aesMapping: AesMapping, name: string): AestheticValue | undefined;
|
|
4892
|
+
|
|
4893
|
+
/**
|
|
4894
|
+
* Reads an author-named numeric column from an observation with the same null-discipline as the
|
|
4895
|
+
* built-in position/visual readers (`getX`, `getColor`, …): a missing or wrong-typed value is
|
|
4896
|
+
* `null`, never silently coerced to `0`. A custom geom writes its own columns and has no typed
|
|
4897
|
+
* accessor for them; these readers fill that gap without re-deriving the coercion per geom.
|
|
4898
|
+
*
|
|
4899
|
+
* Pass `fallback` to opt into a default for genuinely-missing values; the overload then narrows the
|
|
4900
|
+
* return to `number`, so a geom that wants `0`-on-missing says so explicitly.
|
|
4901
|
+
*/
|
|
4902
|
+
export declare function readNumber(observation: Observation, key: string): number | null;
|
|
4903
|
+
|
|
4904
|
+
export declare function readNumber(observation: Observation, key: string, fallback: number): number;
|
|
4905
|
+
|
|
4906
|
+
/** Reads an author-named string column from an observation; missing or wrong-typed is `null` unless a `fallback` is given. */
|
|
4907
|
+
export declare function readString(observation: Observation, key: string): string | null;
|
|
4908
|
+
|
|
4909
|
+
export declare function readString(observation: Observation, key: string, fallback: string): string;
|
|
4910
|
+
|
|
4823
4911
|
/** A rectangle in pixel coordinates, origin at top-left. */
|
|
4824
4912
|
export declare interface Rect {
|
|
4825
4913
|
x: number;
|
|
@@ -5181,7 +5269,7 @@ export declare type ScaledAestheticKey = ScaledPositionAestheticKey | ScaledVisu
|
|
|
5181
5269
|
|
|
5182
5270
|
declare type ScaledPositionAestheticKey = 'x' | 'y' | 'ySecondary';
|
|
5183
5271
|
|
|
5184
|
-
declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth' | 'lineType';
|
|
5272
|
+
export declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth' | 'lineType';
|
|
5185
5273
|
|
|
5186
5274
|
/**
|
|
5187
5275
|
* Union type for all possible scale specifications (including inferred, pre-resolution).
|
|
@@ -5491,6 +5579,11 @@ declare interface SmoothStatSpec {
|
|
|
5491
5579
|
|
|
5492
5580
|
declare function sort(options: SortOptions): SortTransformInput;
|
|
5493
5581
|
|
|
5582
|
+
/**
|
|
5583
|
+
* Sorts the data by the x variable if it is numeric or temporal.
|
|
5584
|
+
*/
|
|
5585
|
+
export declare const sortByXIfContinuous: (data: Dataset, mapping: AesMapping) => Dataset;
|
|
5586
|
+
|
|
5494
5587
|
/***************************************************************
|
|
5495
5588
|
* Sort Transform
|
|
5496
5589
|
***************************************************************/
|
|
@@ -5530,7 +5623,7 @@ export declare interface SourceContent {
|
|
|
5530
5623
|
* time (no stored cartesian, no Delaunay), staying correct across resizes. Geoms never declare it; a
|
|
5531
5624
|
* polar coord refines a `points`-natural mark to it during the coord transform.
|
|
5532
5625
|
*/
|
|
5533
|
-
declare type SpatialIndexKind = 'buckets' | 'rects' | 'points' | 'arcs' | 'noop' | 'render-hit-test' | 'polar-points';
|
|
5626
|
+
export declare type SpatialIndexKind = 'buckets' | 'rects' | 'points' | 'arcs' | 'noop' | 'render-hit-test' | 'polar-points';
|
|
5534
5627
|
|
|
5535
5628
|
/**
|
|
5536
5629
|
* A layer's geometry-agnostic hit-test declaration. Pure serialisable data riding in the compiled
|
|
@@ -5820,6 +5913,11 @@ export declare interface TextMeasurer {
|
|
|
5820
5913
|
measureText: (text: string, font: FontSpec) => MeasuredText;
|
|
5821
5914
|
}
|
|
5822
5915
|
|
|
5916
|
+
declare interface ToDatasetOptions {
|
|
5917
|
+
/** Name of the categorical column that discriminates each row's kind. Must not collide with a declared column. */
|
|
5918
|
+
kindColumn: string;
|
|
5919
|
+
}
|
|
5920
|
+
|
|
5823
5921
|
/** A chart's semantic content for the hovered observations, in reading order. */
|
|
5824
5922
|
export declare interface TooltipContent {
|
|
5825
5923
|
/** Localized main-axis value of the primary's observation. `null` for polar. */
|
|
@@ -5957,6 +6055,14 @@ declare type Variable = {
|
|
|
5957
6055
|
valueFormat?: ValueFormat;
|
|
5958
6056
|
};
|
|
5959
6057
|
|
|
6058
|
+
/**
|
|
6059
|
+
* The internal dataset variable a channel reads and writes, derived from its axis and open name. The
|
|
6060
|
+
* built-in names (`point`/`lower`/`upper`) resolve to the canonical position columns (`x`, `xMin`, …),
|
|
6061
|
+
* so value readers and renderer recipes stay untouched; any other name resolves to a namespaced column,
|
|
6062
|
+
* so a custom scaled channel never collides with a built-in or another geom's channel.
|
|
6063
|
+
*/
|
|
6064
|
+
export declare function variableFor(axis: ChannelAxis, name: string): string;
|
|
6065
|
+
|
|
5960
6066
|
/** A map of variable names to their type and values. */
|
|
5961
6067
|
declare type VariableMap = Record<VariableName, Variable>;
|
|
5962
6068
|
|