@akcelik/strct 0.26.0 → 0.29.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akcelik/strct",
3
- "version": "0.26.0",
3
+ "version": "0.29.0",
4
4
  "description": "UIStruct — a standalone Angular component library with a tokenised, multi-palette theme system, built for datacenter / infrastructure management UIs.",
5
5
  "author": "Serkan Akcelik <serkan.akcelik@gmail.com>",
6
6
  "license": "MIT",
@@ -113,8 +113,16 @@ declare const STRCT_RAW_ICONS: Record<string, string>;
113
113
  declare function registerStrctIcon(name: string, content: string, options?: {
114
114
  raw?: boolean;
115
115
  }): void;
116
- /** Icon status dot variants. */
117
- type StrctIconBadge = 'none' | 'success' | 'warning' | 'critical' | 'off' | 'info' | 'maintenance';
116
+ /**
117
+ * Icon status badge variants — two families, both color-blind safe:
118
+ *
119
+ * **Health** (silhouette-coded): circle ✓ success · triangle ! warning ·
120
+ * diamond × critical · circle i info · circle wrench maintenance.
121
+ *
122
+ * **Lifecycle** (vCenter media language — glyphs in a badge disc):
123
+ * green disc ▶ running · amber disc ⏸ paused · grey disc ■ off.
124
+ */
125
+ type StrctIconBadge = 'none' | 'success' | 'warning' | 'critical' | 'running' | 'paused' | 'off' | 'info' | 'maintenance';
118
126
  /**
119
127
  * Inline stroke icon. `<strct-icon name="host" badge="success" />` renders the host
120
128
  * glyph with a green status dot (a "running host"). Unknown names render
@@ -2232,7 +2240,8 @@ type StrctChartType = 'line' | 'area' | 'bar';
2232
2240
  type StrctChartCurve = 'smooth' | 'linear' | 'step';
2233
2241
  /** One series in a multi-series chart. */
2234
2242
  interface StrctChartSeries {
2235
- data: number[];
2243
+ /** Values; `null` (or `NaN`) marks a data gap — the line breaks, no interpolation. */
2244
+ data: (number | null)[];
2236
2245
  /** Legend + tooltip name. */
2237
2246
  label?: string;
2238
2247
  /** Per-series color; falls back to the chart's `status`. */
@@ -2247,6 +2256,24 @@ interface StrctChartSeries {
2247
2256
  * custom SVG dasharray string to tune it.
2248
2257
  */
2249
2258
  dash?: boolean | string;
2259
+ /**
2260
+ * Optional per-point lower/upper bound (e.g. min/max per downsampled bucket).
2261
+ * When both are set a soft band is filled between them behind the line, so
2262
+ * within-bucket spikes stay visible; the tooltip shows `avg (min–max)`.
2263
+ */
2264
+ lower?: (number | null)[];
2265
+ upper?: (number | null)[];
2266
+ }
2267
+ /** A vertical event / annotation marker anchored to a data index. */
2268
+ interface StrctChartAnnotation {
2269
+ /** X position as a data index. */
2270
+ index: number;
2271
+ /** Shown near the top of the line and in the tooltip at that index. */
2272
+ label?: string;
2273
+ /** Line color; default 'accent'. */
2274
+ status?: StrctChartStatus;
2275
+ /** Dashed line; default true. */
2276
+ dashed?: boolean;
2250
2277
  }
2251
2278
  /** A horizontal reference / threshold line. */
2252
2279
  interface StrctChartThreshold {
@@ -2266,12 +2293,15 @@ interface SeriesRender {
2266
2293
  label: string;
2267
2294
  area: boolean;
2268
2295
  dash: string | null;
2269
- pts: Pt[];
2296
+ pts: (Pt | null)[];
2270
2297
  path: string;
2271
2298
  areaPath: string;
2299
+ bandPath: string;
2272
2300
  /** Global x-offset (right-aligned) so shorter series line up on the right. */
2273
2301
  offset: number;
2274
- data: number[];
2302
+ data: (number | null)[];
2303
+ lower?: (number | null)[];
2304
+ upper?: (number | null)[];
2275
2305
  }
2276
2306
  /**
2277
2307
  * Single- or multi-series chart (line / area / bar). Dependency-free SVG,
@@ -2289,8 +2319,8 @@ interface SeriesRender {
2289
2319
  * <strct-chart [series]="[{data:inArr,label:'In'},{data:outArr,label:'Out'}]" legend />
2290
2320
  */
2291
2321
  declare class StrctChart {
2292
- /** Single-series data (or use `series`). */
2293
- readonly data: _angular_core.InputSignal<number[]>;
2322
+ /** Single-series data (or use `series`). `null` / `NaN` marks a gap — the line breaks. */
2323
+ readonly data: _angular_core.InputSignal<(number | null)[]>;
2294
2324
  /** Multiple series; when set it takes precedence over `data`. */
2295
2325
  readonly series: _angular_core.InputSignal<StrctChartSeries[] | null>;
2296
2326
  /** Visual type / variant. */
@@ -2347,6 +2377,28 @@ declare class StrctChart {
2347
2377
  * `[valueFormat]="v => v.toFixed(3) + ' %'"`. When null, the raw value is shown.
2348
2378
  */
2349
2379
  readonly valueFormat: _angular_core.InputSignal<((v: number) => string) | null>;
2380
+ /** Vertical event / annotation markers ("alarm raised", "deploy", …). */
2381
+ readonly annotations: _angular_core.InputSignal<StrctChartAnnotation[]>;
2382
+ /**
2383
+ * Drive the crosshair externally (e.g. mirror a sibling chart's hover for a
2384
+ * vCenter-style synced dashboard). A local pointer wins while over this chart.
2385
+ */
2386
+ readonly activeIndex: _angular_core.InputSignal<number | null>;
2387
+ /** Drag-select a range; the selection is emitted through `brushChange`. */
2388
+ readonly brush: _angular_core.InputSignalWithTransform<boolean, unknown>;
2389
+ /**
2390
+ * Drag-select **zooms into** the selected range (implies `brush`).
2391
+ * Double-click, Escape or the reset chip zooms back out.
2392
+ */
2393
+ readonly zoom: _angular_core.InputSignalWithTransform<boolean, unknown>;
2394
+ /** Tooltip text for a gap (null) point. */
2395
+ readonly gapText: _angular_core.InputSignal<string>;
2396
+ /** Accessible label of the reset-zoom chip (localizable). */
2397
+ readonly resetLabel: _angular_core.InputSignal<string>;
2398
+ /** Emits the hovered point index (or null on leave) — wire cross-chart sync with it. */
2399
+ readonly hoverIndex: _angular_core.OutputEmitterRef<number | null>;
2400
+ /** Emits the brushed [startIndex, endIndex] (inclusive), or null when cleared. */
2401
+ readonly brushChange: _angular_core.OutputEmitterRef<[number, number] | null>;
2350
2402
  protected readonly pad: {
2351
2403
  l: number;
2352
2404
  r: number;
@@ -2368,6 +2420,14 @@ declare class StrctChart {
2368
2420
  /** Reactive OS motion preference (tracks live changes, not just first load). */
2369
2421
  private readonly reduceMotion;
2370
2422
  protected readonly hoverIdx: _angular_core.WritableSignal<number | null>;
2423
+ protected readonly dispIdx: _angular_core.Signal<number | null>;
2424
+ private readonly viewRange;
2425
+ protected readonly brushDrag: _angular_core.WritableSignal<{
2426
+ a: number;
2427
+ b: number;
2428
+ } | null>;
2429
+ private readonly brushEnabled;
2430
+ protected readonly zoomed: _angular_core.Signal<boolean>;
2371
2431
  constructor();
2372
2432
  private readonly seriesResolved;
2373
2433
  protected readonly isMulti: _angular_core.Signal<boolean>;
@@ -2376,16 +2436,22 @@ declare class StrctChart {
2376
2436
  protected readonly isEmpty: _angular_core.Signal<boolean>;
2377
2437
  /** Number of x slots. */
2378
2438
  private readonly nx;
2439
+ /** Visible index window: the brush-zoom range, or the full data. */
2440
+ private readonly domain;
2379
2441
  /** Left padding: wider when the y-axis labels are shown. */
2380
2442
  protected readonly pl: _angular_core.Signal<number>;
2381
2443
  private chartW;
2382
2444
  private chartH;
2383
- /** Horizontal gap between two data points, in px. */
2445
+ /** Horizontal gap between two data points, in px (of the visible window). */
2384
2446
  private stepX;
2447
+ /** Real values inside the visible window (multi-aware; bands included). */
2448
+ private readonly visibleValues;
2385
2449
  private readonly yMax;
2386
2450
  private readonly yMin;
2387
2451
  private yOf;
2388
- protected readonly points: _angular_core.Signal<Pt[]>;
2452
+ protected readonly points: _angular_core.Signal<(Pt | null)[]>;
2453
+ /** Non-gap points only (dot rendering). */
2454
+ protected readonly dotPts: _angular_core.Signal<Pt[]>;
2389
2455
  protected readonly head: _angular_core.Signal<Pt | null>;
2390
2456
  private readonly plotPoints;
2391
2457
  protected readonly linePath: _angular_core.Signal<string>;
@@ -2422,17 +2488,19 @@ declare class StrctChart {
2422
2488
  protected readonly hoverX: _angular_core.Signal<number | null>;
2423
2489
  protected readonly hoverPt: _angular_core.Signal<Pt | null>;
2424
2490
  protected readonly hoverValue: _angular_core.Signal<number | "">;
2491
+ /** The hovered slot exists but holds a gap (single-series). */
2492
+ protected readonly hoverGap: _angular_core.Signal<boolean>;
2425
2493
  /** hoverValue run through valueFormat (unit / precision), else the raw value. */
2426
2494
  protected readonly hoverValueText: _angular_core.Signal<string>;
2427
2495
  /** Delta magnitude, formatted the same way so its unit matches the value. */
2428
2496
  protected readonly absDeltaText: _angular_core.Signal<string>;
2429
2497
  protected readonly hoverLabel: _angular_core.Signal<string>;
2430
- /** Change from the previous point (single-series; null at the first point). */
2498
+ /** Change from the previous point (single-series; null at the first point or across a gap). */
2431
2499
  protected readonly hoverDelta: _angular_core.Signal<number | null>;
2432
2500
  protected readonly absDelta: _angular_core.Signal<number>;
2433
2501
  /** Second tooltip line: "Xs ago" while live, else the x label. */
2434
2502
  protected readonly hoverMeta: _angular_core.Signal<string>;
2435
- /** Per-series value at the hovered index (multi-series tooltip). */
2503
+ /** Per-series value at the hovered index (multi-series tooltip; bands as `avg (min–max)`). */
2436
2504
  protected readonly hoverRows: _angular_core.Signal<{
2437
2505
  label: string;
2438
2506
  color: string;
@@ -2445,17 +2513,53 @@ declare class StrctChart {
2445
2513
  y: number;
2446
2514
  color: string;
2447
2515
  }[]>;
2516
+ protected readonly annotationLines: _angular_core.Signal<{
2517
+ x: number;
2518
+ color: string;
2519
+ dashed: boolean;
2520
+ label: string;
2521
+ index: number;
2522
+ }[]>;
2523
+ /** The annotation sitting exactly under the crosshair, if any. */
2524
+ protected readonly annAt: _angular_core.Signal<{
2525
+ x: number;
2526
+ color: string;
2527
+ dashed: boolean;
2528
+ label: string;
2529
+ index: number;
2530
+ } | null>;
2531
+ protected readonly brushRect: _angular_core.Signal<{
2532
+ x: number;
2533
+ w: number;
2534
+ } | null>;
2535
+ /** Zoom back out to the full data window (also emits `brushChange` null). */
2536
+ resetZoom(): void;
2448
2537
  /** Screen-reader summary of the whole chart (role="img" name). */
2449
2538
  protected readonly chartAria: _angular_core.Signal<string>;
2450
2539
  /** aria-live text announcing the hovered / keyboard-selected point. */
2451
2540
  protected readonly srText: _angular_core.Signal<string>;
2452
- /** Pixel x of a data index (shared by the plot and the x-axis labels). */
2541
+ /** Pixel x of a data index (shared by the plot, labels and annotations). */
2453
2542
  protected xOf(i: number): number;
2454
- /** Keyboard access to the crosshair: arrows walk the points. */
2543
+ /** Set the local hover index, emitting `hoverIndex` on change. */
2544
+ private setHover;
2545
+ protected onLeave(): void;
2546
+ /** Keyboard access: arrows walk the points; Escape unwinds brush → zoom → crosshair. */
2455
2547
  protected onKey(event: KeyboardEvent): void;
2548
+ /** Data index under the pointer, clamped to the visible window. */
2549
+ private idxAt;
2550
+ protected onDown(event: PointerEvent): void;
2456
2551
  protected onMove(event: PointerEvent): void;
2552
+ protected onUp(): void;
2553
+ protected onDblClick(): void;
2554
+ /**
2555
+ * The rendered chart as a standalone SVG string — theme colors resolved to
2556
+ * literals, background baked in, y-tick / x-label text included.
2557
+ */
2558
+ toSVG(): string;
2559
+ /** The chart as a PNG data URL at the given scale (default 2×). */
2560
+ toPNG(scale?: number): Promise<string>;
2457
2561
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<StrctChart, never>;
2458
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctChart, "strct-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "series": { "alias": "series"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "area": { "alias": "area"; "required": false; "isSignal": true; }; "glow": { "alias": "glow"; "required": false; "isSignal": true; }; "live": { "alias": "live"; "required": false; "isSignal": true; }; "interval": { "alias": "interval"; "required": false; "isSignal": true; }; "interactive": { "alias": "interactive"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "grid": { "alias": "grid"; "required": false; "isSignal": true; }; "dots": { "alias": "dots"; "required": false; "isSignal": true; }; "legend": { "alias": "legend"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "xTicks": { "alias": "xTicks"; "required": false; "isSignal": true; }; "xFormat": { "alias": "xFormat"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "yAxis": { "alias": "yAxis"; "required": false; "isSignal": true; }; "yTicks": { "alias": "yTicks"; "required": false; "isSignal": true; }; "axisFormat": { "alias": "axisFormat"; "required": false; "isSignal": true; }; "thresholds": { "alias": "thresholds"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "agoFormat": { "alias": "agoFormat"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
2562
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<StrctChart, "strct-chart", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "series": { "alias": "series"; "required": false; "isSignal": true; }; "type": { "alias": "type"; "required": false; "isSignal": true; }; "curve": { "alias": "curve"; "required": false; "isSignal": true; }; "area": { "alias": "area"; "required": false; "isSignal": true; }; "glow": { "alias": "glow"; "required": false; "isSignal": true; }; "live": { "alias": "live"; "required": false; "isSignal": true; }; "interval": { "alias": "interval"; "required": false; "isSignal": true; }; "interactive": { "alias": "interactive"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; "grid": { "alias": "grid"; "required": false; "isSignal": true; }; "dots": { "alias": "dots"; "required": false; "isSignal": true; }; "legend": { "alias": "legend"; "required": false; "isSignal": true; }; "labels": { "alias": "labels"; "required": false; "isSignal": true; }; "xTicks": { "alias": "xTicks"; "required": false; "isSignal": true; }; "xFormat": { "alias": "xFormat"; "required": false; "isSignal": true; }; "status": { "alias": "status"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "max": { "alias": "max"; "required": false; "isSignal": true; }; "min": { "alias": "min"; "required": false; "isSignal": true; }; "yAxis": { "alias": "yAxis"; "required": false; "isSignal": true; }; "yTicks": { "alias": "yTicks"; "required": false; "isSignal": true; }; "axisFormat": { "alias": "axisFormat"; "required": false; "isSignal": true; }; "thresholds": { "alias": "thresholds"; "required": false; "isSignal": true; }; "emptyText": { "alias": "emptyText"; "required": false; "isSignal": true; }; "agoFormat": { "alias": "agoFormat"; "required": false; "isSignal": true; }; "valueFormat": { "alias": "valueFormat"; "required": false; "isSignal": true; }; "annotations": { "alias": "annotations"; "required": false; "isSignal": true; }; "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "brush": { "alias": "brush"; "required": false; "isSignal": true; }; "zoom": { "alias": "zoom"; "required": false; "isSignal": true; }; "gapText": { "alias": "gapText"; "required": false; "isSignal": true; }; "resetLabel": { "alias": "resetLabel"; "required": false; "isSignal": true; }; }, { "hoverIndex": "hoverIndex"; "brushChange": "brushChange"; }, never, never, true, never>;
2459
2563
  }
2460
2564
 
2461
2565
  /** A single weighted slice of a donut chart. */
@@ -2811,4 +2915,4 @@ declare class StrctEmptyState {
2811
2915
  }
2812
2916
 
2813
2917
  export { STRCT_ICONS, STRCT_ICON_GROUPS, STRCT_MASKS, STRCT_PALETTES, STRCT_RAW_ICONS, StrctAccordion, StrctAccordionPanel, StrctAlert, StrctAvatar, StrctBadge, StrctBreadcrumb, StrctBreadcrumbItem, StrctButton, StrctButtonGroup, StrctCard, StrctCardBlock, StrctCardFooter, StrctCardHeader, StrctCascadeHost, StrctCascadeNode, StrctCascadeSelect, StrctCellDef, StrctCellStatus, StrctChart, StrctCheckbox, StrctChips, StrctColorPicker, StrctCombobox, StrctCommandPalette, StrctContextMenu, StrctContextMenuTrigger, StrctDatagrid, StrctDatagridActionBar, StrctDatepicker, StrctDesc, StrctDescriptionList, StrctDivider, StrctDonut, StrctDrawer, StrctDrawerFooter, StrctDropdown, StrctDropdownDivider, StrctDropdownItem, StrctEmptyState, StrctField, StrctFile, StrctFlow, StrctFooter, StrctGauge, StrctHeader, StrctHero, StrctIcon, StrctInput, StrctInputMask, StrctInputOtp, StrctKbd, StrctKnob, StrctLogin, StrctMenuPanel, StrctMenuService, StrctMetricTile, StrctModal, StrctNav, StrctNavItem, StrctOverlay, StrctPagination, StrctPassword, StrctProgress, StrctRadio, StrctRadioGroup, StrctRail, StrctRange, StrctRating, StrctRowDetailDef, StrctSectionMenu, StrctSegmented, StrctShell, StrctShellService, StrctSignpost, StrctSkeleton, StrctSparkline, StrctSpeedDial, StrctSpinner, StrctStack, StrctStackItem, StrctStep, StrctSubmenu, StrctTab, StrctTable, StrctTabs, StrctTag, StrctThemeService, StrctThemeSwitcher, StrctTimeline, StrctTimelineItem, StrctToastOutlet, StrctToastService, StrctToggle, StrctTooltip, StrctTree, StrctTreeNode, StrctVerticalNav, StrctWizard, registerStrctIcon, strctValidationIcon, strctValidationTone };
2814
- export type { StrctAlertType, StrctAvatarSize, StrctAvatarStatus, StrctBadgeStatus, StrctButtonSize, StrctButtonVariant, StrctCascadeOption, StrctCellContext, StrctChartCurve, StrctChartSeries, StrctChartStatus, StrctChartThreshold, StrctChartType, StrctColumn, StrctCommandItem, StrctDatagridColumn, StrctDatagridLabels, StrctDescAlign, StrctDescItem, StrctDonutSegment, StrctDrawerSide, StrctDrawerSize, StrctEmptyVariant, StrctFlowDirection, StrctFlowNode, StrctFlowOrientation, StrctIconBadge, StrctKnobStatus, StrctMenuItem, StrctMenuLink, StrctMenuOpenOptions, StrctMenuSection, StrctMetricStatus, StrctModalSize, StrctMode, StrctOption, StrctOverlayPlacement, StrctPalette, StrctPaletteInfo, StrctProgressStatus, StrctRailItem, StrctRailStatus, StrctRow, StrctRowId, StrctSegmentedOption, StrctSegmentedSize, StrctSignpostPosition, StrctSpeedDialDirection, StrctSpinnerSize, StrctStatus, StrctTagStatus, StrctThresholds, StrctTimelineState, StrctToast, StrctToastOptions, StrctToastType, StrctTooltipPosition, StrctTreeMenuEvent, StrctTreeNodeData, StrctTreeNodeMenuFn, StrctValidationState, StrctValidationStatus };
2918
+ export type { StrctAlertType, StrctAvatarSize, StrctAvatarStatus, StrctBadgeStatus, StrctButtonSize, StrctButtonVariant, StrctCascadeOption, StrctCellContext, StrctChartAnnotation, StrctChartCurve, StrctChartSeries, StrctChartStatus, StrctChartThreshold, StrctChartType, StrctColumn, StrctCommandItem, StrctDatagridColumn, StrctDatagridLabels, StrctDescAlign, StrctDescItem, StrctDonutSegment, StrctDrawerSide, StrctDrawerSize, StrctEmptyVariant, StrctFlowDirection, StrctFlowNode, StrctFlowOrientation, StrctIconBadge, StrctKnobStatus, StrctMenuItem, StrctMenuLink, StrctMenuOpenOptions, StrctMenuSection, StrctMetricStatus, StrctModalSize, StrctMode, StrctOption, StrctOverlayPlacement, StrctPalette, StrctPaletteInfo, StrctProgressStatus, StrctRailItem, StrctRailStatus, StrctRow, StrctRowId, StrctSegmentedOption, StrctSegmentedSize, StrctSignpostPosition, StrctSpeedDialDirection, StrctSpinnerSize, StrctStatus, StrctTagStatus, StrctThresholds, StrctTimelineState, StrctToast, StrctToastOptions, StrctToastType, StrctTooltipPosition, StrctTreeMenuEvent, StrctTreeNodeData, StrctTreeNodeMenuFn, StrctValidationState, StrctValidationStatus };