@kymoscope/sdk 0.22.0 → 0.23.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.
@@ -123,6 +123,24 @@
123
123
  .kymo-mark-hit { fill: transparent; pointer-events: auto; cursor: pointer; }
124
124
  /* From backlog data that arrived late: the same span, quieter. */
125
125
  .kymo-mark--late { opacity: 0.6; }
126
+ /* One rule singled out (engine.marks.focus, Show in the alerts list): its spans stand out and are named, the rest dim. */
127
+ .kymo-mark { transition: opacity 0.2s ease; }
128
+ .kymo-mark.is-dim { opacity: 0.25; }
129
+ .kymo-mark.is-focus .kymo-mark-fill { fill-opacity: 0.26; }
130
+ .kymo-mark-label {
131
+ position: absolute;
132
+ max-width: 60%;
133
+ padding: 2px 7px;
134
+ border: 1px solid currentColor;
135
+ border-radius: 4px;
136
+ background: var(--chart-bg);
137
+ font: 600 11px/1.3 var(--font-sans, system-ui, sans-serif);
138
+ white-space: nowrap;
139
+ overflow: hidden;
140
+ text-overflow: ellipsis;
141
+ pointer-events: none;
142
+ }
143
+ @media (prefers-reduced-motion: reduce) { .kymo-mark { transition: none; } }
126
144
  .kymo-ann-hit {
127
145
  fill: none;
128
146
  stroke: transparent;
@@ -147,6 +165,9 @@
147
165
  position: absolute;
148
166
  pointer-events: auto;
149
167
  cursor: move;
168
+ /* its own width, not the room left of its anchor: near the plot's right edge that was a letter a line, before
169
+ keepInPlot slid it back in */
170
+ width: max-content;
150
171
  max-width: 60%;
151
172
  padding: 0.15em 0.45em;
152
173
  border-radius: 4px;
@@ -13,13 +13,15 @@ interface Props {
13
13
  marks?: ChartMark[];
14
14
  /** A press on a mark's top strip: its rule id. */
15
15
  onMarkSelect?: (ruleId: string) => void;
16
+ /** The rule singled out (engine.marks.focus): its spans stand out with its name, the others dim. */
17
+ markFocus?: string | null;
16
18
  }
17
19
  type Pt = [number, number];
18
20
  /** Elements outside the chart marked with this attribute keep the selection when pressed (a host's style controls). */
19
21
  export declare const ANNOTATION_CONTROLS_ATTR = "data-kymo-annotation-controls";
20
22
  /** Pixel positions of an annotation's points (null: pinned to X on a chart without an X frame now). */
21
23
  export declare function annotationPx(a: ChartAnnotation, W: number, H: number, frame: PlotFrame | null): Pt[] | null;
22
- export declare const AnnotationLayer: import("react").MemoExoticComponent<({ annotations, tool, plotFrame, onChange, onToolEnd, onSelect, marks: alertList, onMarkSelect }: Props) => import("react/jsx-runtime").JSX.Element>;
24
+ export declare const AnnotationLayer: import("react").MemoExoticComponent<({ annotations, tool, plotFrame, onChange, onToolEnd, onSelect, marks: alertList, onMarkSelect, markFocus }: Props) => import("react/jsx-runtime").JSX.Element>;
23
25
  /** A smooth path through the stroke's points (quadratic curves through the midpoints). */
24
26
  export declare function brushPath(px: Pt[]): string;
25
27
  /** Head of an arrow ending at (x1, y1): its outline and where the shaft should stop. */
@@ -9,6 +9,7 @@ import { type PanelChartSettings } from '../lib/panelChartSettings';
9
9
  import { type XYZMeshChartHandle } from '../components/XYZMeshChart';
10
10
  import { type CameraCursor, type CameraRecording } from './CameraPanel';
11
11
  import type { VideoSource } from '../lib/live/videoTrack';
12
+ import { chosenColumns } from '../lib/panelChartSettings';
12
13
  import type { LiveZoomBus } from '../lib/render/liveZoomBus';
13
14
  import { type WorksheetData } from './useWorksheetData';
14
15
  import type { LiveConnection } from '../lib/live/types';
@@ -63,7 +64,7 @@ export interface ChartBodyProps {
63
64
  * from a time column, and what `view.data()` returns); the picture no longer waits for that.
64
65
  */
65
66
  export declare function spectrogramPullsLive(settings: PanelChartSettings | undefined, loneLive: boolean): boolean;
66
- export declare function chosenColumns(settings: PanelChartSettings | undefined): string[];
67
+ export { chosenColumns };
67
68
  /** Renders the chart and reports whether it had anything to draw: an empty chart whose chosen
68
69
  * channels aren't all in this data says so ('missing'), the same for every kind. */
69
70
  export declare function renderChart(p: ChartBodyProps): {
@@ -74,5 +74,6 @@ export declare function disposeCharts(engine: KymoscopeEngine): void;
74
74
  * X-Y scatter; '' on charts whose X is no column (spectrum frequency, histogram bins, categories…). */
75
75
  export declare function chartTimeX(settings: PanelChartSettings | undefined, worksheetX: string): string;
76
76
  export declare const chartMarks: (a: ChartMark[], b: string[], c: string) => ChartMark[];
77
+ export declare function marksForChart(marks: ChartMark[], settings: PanelChartSettings | undefined): ChartMark[];
77
78
  /** What PNG export paints: the alert marks (under) and the chart's annotations; open marks end at the plot's edge. */
78
79
  export declare function exportNotes(notes: ChartAnnotation[], marks: ChartMark[], frame: PlotFrame | null): ChartAnnotation[];
@@ -2,6 +2,11 @@ import type { AxisLineStyle } from '../lib/panelChartSettings';
2
2
  import type { PlotSeries } from '../types/plotSeries';
3
3
  import { type PointColumns } from '../lib/data/pointColumns';
4
4
  import type { LiveZoomBus } from '../lib/render/liveZoomBus';
5
+ /** For each column, the first layer (by index) that has a value of it. Each dataset (a cut's cycles: hundreds) is a
6
+ * layer with column keys of its own, so this is one pass over the layers' own columns, not layers × series. */
7
+ export declare function firstLayerOfColumns(layerColumns: Iterable<string>[], has: (layer: number, column: string) => boolean): Map<string, number>;
8
+ /** The series one layer draws, as indexes into the series in their order: `byColumn` maps a column to its series. */
9
+ export declare function layerSeries(columns: Iterable<string>, byColumn: Map<string, number[]>, has: (column: string) => boolean): number[];
5
10
  /**
6
11
  * A live feed the chart pulls straight from, every animation frame, on its own
7
12
  * rAF loop — bypassing React entirely so incoming samples never re-render the app
@@ -14,6 +14,12 @@
14
14
  /** Ed25519 public keys (raw, base64url) by key id. "1" is the original key; a key without `kid` uses "1".
15
15
  * To rotate: add the next key here, release the SDK, then switch the server's signing key and kid. */
16
16
  export declare const KYMOSCOPE_LICENSE_PUBLIC_KEYS: Record<string, string>;
17
+ /** Kymoscope Site root public keys (raw, base64url) by kid: an on-site SDK licence carries `chain`, a site licence
18
+ * that ends at one of these and certifies the site key that signed it. r1: the production root (its private half is
19
+ * offline with the founder). */
20
+ export declare const KYMOSCOPE_SITE_ROOT_KEYS: Record<string, string>;
21
+ /** The warning days after a site licence's exp, before the install is read-only (and its SDK keys expire). */
22
+ export declare const SITE_GRACE_SEC: number;
17
23
  export type LicenseResult = {
18
24
  ok: true;
19
25
  sub: string;
@@ -24,6 +30,30 @@ export type LicenseResult = {
24
30
  };
25
31
  /** Verify against explicit public keys (by kid, or a single key used for every kid) and clock.
26
32
  * Internal: tests use it with their own keypair. */
27
- export declare function verifyLicenseWith(key: string | undefined | null, hostname: string, publicKeys: Record<string, string> | string, nowSec: number): Promise<LicenseResult>;
33
+ export declare function verifyLicenseWith(key: string | undefined | null, hostname: string, publicKeys: Record<string, string> | string, nowSec: number, siteRootKeys?: Readonly<Record<string, string>>): Promise<LicenseResult>;
28
34
  /** Check a Kymoscope license key for `hostname` (usually `location.hostname`). */
29
35
  export declare function verifyLicense(key: string | undefined | null, hostname: string): Promise<LicenseResult>;
36
+ export interface SiteLicense {
37
+ lic: string;
38
+ org: string;
39
+ plan: 'team' | 'enterprise';
40
+ mod: Record<string, unknown>;
41
+ seats: number;
42
+ site_pub: string;
43
+ exp: number;
44
+ /** Host names the install serves (exact or `*.x`); the site key signs SDK licences only within them. Absent in
45
+ * licences signed before `hosts` existed: then only intranet names (a transition rule). */
46
+ hosts?: string[];
47
+ }
48
+ export type SiteLicenseResult = {
49
+ ok: true;
50
+ licence: SiteLicense;
51
+ } | {
52
+ ok: false;
53
+ reason: 'malformed' | 'bad_signature' | 'expired' | 'issuer_scope';
54
+ };
55
+ /** Verify a site licence chain to the root (never throws). `ignoreExp` accepts a lapsed licence (a read-only
56
+ * install still signs entitlement tokens under it). */
57
+ export declare function verifySiteLicense(token: unknown, nowSec: number, rootKeys?: Readonly<Record<string, string>>, opts?: {
58
+ ignoreExp?: boolean;
59
+ }): Promise<SiteLicenseResult>;
@@ -13,7 +13,12 @@ export interface ChartMark {
13
13
  t1: number | null;
14
14
  /** From backlog data evaluated after it arrived late (alerts phase 2, D6). */
15
15
  late?: boolean;
16
+ /** The channels its rule reads (a formula: its math channel). Only charts plotting one of them draw the mark;
17
+ * absent or empty: every time chart of the target. */
18
+ channels?: string[];
16
19
  }
20
+ /** The channel names a rule reads (a formula signal: its math channel's name). */
21
+ export declare function ruleChannels(r: RuleDoc): string[];
17
22
  export interface RuleStateInfo {
18
23
  ruleId: string;
19
24
  target: RuleTarget;
@@ -65,6 +65,8 @@ export interface InternalState {
65
65
  licensed: boolean | null;
66
66
  history: EngineState['history'];
67
67
  marks: ChartMark[];
68
+ /** The rule whose marks are singled out (engine.marks.focus): its spans stand out, the others dim. */
69
+ markFocus: string | null;
68
70
  alerts: RuleStateInfo[];
69
71
  /** The rules in force (engine.alerts.rules()), here so a new set re-renders the lines linked to them. */
70
72
  alertRules: RuleDoc[];
@@ -498,6 +500,8 @@ export declare function createEngine(options?: EngineOptions): {
498
500
  /** Read-only spans on the charts from alert episodes (never stored in chart settings). */
499
501
  marks: {
500
502
  list: () => ChartMark[];
503
+ /** Single out one rule's marks on the charts (its spans stand out with its name, the others dim); null: none. */
504
+ focus: (ruleId: string | null) => void;
501
505
  };
502
506
  dispose(): void;
503
507
  };
@@ -231,6 +231,8 @@ export interface EngineState {
231
231
  };
232
232
  /** Read-only spans from alert rule episodes (engine.alerts), drawn on time charts. */
233
233
  marks: ChartMark[];
234
+ /** The rule singled out on the charts (engine.marks.focus), or null. */
235
+ markFocus: string | null;
234
236
  /** Per rule and open target: waiting (with the missing channel names), idle, pending, active, clearing… */
235
237
  alerts: RuleStateInfo[];
236
238
  }
@@ -20,6 +20,8 @@ export type { ChartKindInfo } from './engine/kinds';
20
20
  export type { ColumnsInput } from './engine/columns';
21
21
  export { verifyLicense } from './embed/license';
22
22
  export type { LicenseResult } from './embed/license';
23
+ export { verifySiteLicense, KYMOSCOPE_SITE_ROOT_KEYS } from './embed/license';
24
+ export type { SiteLicense, SiteLicenseResult } from './embed/license';
23
25
  export type { ChartView, ChartViewEvents, MountOptions, ChartStyle } from './charts/runtime';
24
26
  export type { ChartWindow, ChartWindowOptions, WindowPlacement } from './charts/chartWindow';
25
27
  export type { ChartStatus, ContextMenuEvent } from './charts/ChartBody';
@@ -478,3 +478,5 @@ export declare function ensurePanelSettingsForPanels(panels: {
478
478
  id: string;
479
479
  kind: string;
480
480
  }[], current: Record<string, PanelChartSettings>, defaultXyColor: string, defaultXyzRadius: number): Record<string, PanelChartSettings>;
481
+ /** Every column a chart's settings pick (series, slots, lists); helper fields such as the multiband's add picker don't count. */
482
+ export declare function chosenColumns(settings: PanelChartSettings | undefined): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kymoscope/sdk",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "The Kymoscope data engine and charts for the browser: import large measurement files, plot them, stream live data end-to-end encrypted.",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "homepage": "https://kymoscope.com/docs/introduction",