@kubex/zinc 1.1.179 → 1.1.181

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.
Files changed (31) hide show
  1. package/dist/custom-elements.json +697 -454
  2. package/dist/vscode.html-custom-data.json +102 -64
  3. package/dist/web-types.json +243 -163
  4. package/dist/zn.d.ts +115 -11
  5. package/dist/zn.min.js +331 -322
  6. package/docs/pages/components/chart.md +49 -0
  7. package/docs/pages/components/stat.md +74 -0
  8. package/docs/pages/components/tile.md +16 -0
  9. package/package.json +1 -1
  10. package/src/components/chart/builders.ts +15 -0
  11. package/src/components/chart/chart-live.test.ts +82 -0
  12. package/src/components/chart/chart.component.ts +111 -14
  13. package/src/components/chart/live.test.ts +96 -0
  14. package/src/components/chart/live.ts +164 -0
  15. package/src/components/cols/cols.scss +16 -0
  16. package/src/components/data-table/data-table.component.ts +3 -2
  17. package/src/components/data-table-filter/data-table-filter.component.ts +2 -2
  18. package/src/components/data-table-search/data-table-search.component.ts +2 -2
  19. package/src/components/defined-label/defined-label.component.ts +1 -1
  20. package/src/components/filter-container/filter-container.component.ts +1 -1
  21. package/src/components/filter-wrapper/filter-wrapper.component.ts +2 -0
  22. package/src/components/filter-wrapper/filter-wrapper.test.ts +46 -0
  23. package/src/components/icon-picker/icon-picker.component.ts +1 -1
  24. package/src/components/input/input.component.ts +10 -0
  25. package/src/components/remarkd-editor/remarkd-editor.component.ts +1 -1
  26. package/src/components/select/select.component.ts +1 -1
  27. package/src/components/stat/stat.component.ts +81 -12
  28. package/src/components/stat/stat.scss +64 -0
  29. package/src/components/tile/tile.component.ts +3 -0
  30. package/src/components/tile/tile.scss +30 -0
  31. package/src/internal/form.ts +18 -3
package/dist/zn.d.ts CHANGED
@@ -155,6 +155,12 @@ declare module "internal/form" {
155
155
  import type { ZincFormControl } from "internal/zinc-element";
156
156
  import type Button from "components/button/index";
157
157
  export const formCollections: WeakMap<HTMLFormElement, Set<ZincFormControl>>;
158
+ /** Trims a control's string value in place, so what's shown matches what's submitted. */
159
+ export function trimControlValue(control: Element & {
160
+ value?: unknown;
161
+ type?: string;
162
+ input?: unknown;
163
+ }): void;
158
164
  export function clearFormStoreValues(formOrStoreKey: HTMLFormElement | string): void;
159
165
  export interface FormControlControllerOptions {
160
166
  /** A function that returns the form containing the form control. */
@@ -2446,6 +2452,7 @@ declare module "components/input/input.component" {
2446
2452
  private handleFocus;
2447
2453
  private handleInput;
2448
2454
  private handleInvalid;
2455
+ private syncEmailDisplay;
2449
2456
  private handleKeyDown;
2450
2457
  private handlePasswordToggle;
2451
2458
  private handleColorSwatchClick;
@@ -4600,6 +4607,8 @@ declare module "components/tile/tile.component" {
4600
4607
  inline: boolean;
4601
4608
  /** Renders the caption in the normal table-content weight instead of bold. */
4602
4609
  plain: boolean;
4610
+ /** Moves the actions under the caption and description when the tile is narrower than 600px. */
4611
+ stackActions: boolean;
4603
4612
  /** Set by `zn-tile-group` to lay the tile out as a shared-column subgrid row. */
4604
4613
  grouped: boolean;
4605
4614
  private _isLink;
@@ -4799,11 +4808,19 @@ declare module "components/chart/builders" {
4799
4808
  import type { EChartsOption } from 'echarts';
4800
4809
  export type ChartType = 'area' | 'bar' | 'donut' | 'funnel' | 'gauge' | 'heatmap' | 'line' | 'pie' | 'radar' | 'sankey' | 'scatter' | 'sunburst' | 'treemap';
4801
4810
  export interface SeriesItem {
4811
+ /** Stable identity for incremental live updates. */
4812
+ id?: string;
4813
+ animation?: boolean;
4814
+ animationDuration?: number;
4815
+ animationDurationUpdate?: number;
4816
+ animationEasingUpdate?: 'linear';
4817
+ animationThreshold?: number;
4802
4818
  name: string;
4803
4819
  data: any[];
4804
4820
  color?: string;
4805
4821
  /** Series sharing a stack ID are stacked, overriding the chart-wide `stacked` setting. */
4806
4822
  stack?: string;
4823
+ stackStrategy?: 'all' | 'samesign' | 'positive' | 'negative';
4807
4824
  /** Fill below a line, for example `{ opacity: 0.15 }`; `{ opacity: 0 }` keeps a stacked base invisible. */
4808
4825
  areaStyle?: Record<string, unknown>;
4809
4826
  lineStyle?: Record<string, unknown>;
@@ -4870,6 +4887,70 @@ declare module "components/chart/echarts-loader" {
4870
4887
  export type EChartsModule = typeof echartsCore;
4871
4888
  export function loadECharts(): Promise<EChartsModule>;
4872
4889
  }
4890
+ declare module "components/chart/live" {
4891
+ import type { SeriesItem } from "components/chart/builders";
4892
+ export interface LivePoint {
4893
+ at: number;
4894
+ value: number | null;
4895
+ }
4896
+ export interface LivePrediction {
4897
+ status: string;
4898
+ average_rates?: boolean;
4899
+ points: {
4900
+ at: number;
4901
+ expected: number;
4902
+ lower: number;
4903
+ upper: number;
4904
+ available: boolean;
4905
+ }[];
4906
+ }
4907
+ export interface LiveFrame {
4908
+ from: number;
4909
+ until: number;
4910
+ server_time: number;
4911
+ expires_at: number;
4912
+ resolution_seconds: number;
4913
+ metric: string;
4914
+ points: LivePoint[];
4915
+ prediction?: LivePrediction;
4916
+ }
4917
+ export interface LiveGrant {
4918
+ stream_url: string;
4919
+ expires_at: number;
4920
+ server_time: number;
4921
+ }
4922
+ /** Authoritative bucket replacement, never increment counts on delivery/reconnect. */
4923
+ export class LiveWindow {
4924
+ frame?: LiveFrame;
4925
+ private points;
4926
+ private prediction?;
4927
+ apply(value: unknown, snapshot: boolean): LiveFrame;
4928
+ advance(serverTime: number): void;
4929
+ get predictionStatus(): string;
4930
+ series(hideZero?: boolean): SeriesItem[];
4931
+ }
4932
+ /** One transport per chart. Grants renew only through a same-origin login gate. */
4933
+ export class LiveTransport {
4934
+ private source?;
4935
+ private timer?;
4936
+ private expiryTimer?;
4937
+ private abort?;
4938
+ private stopped;
4939
+ private generation;
4940
+ private retry;
4941
+ private renewing;
4942
+ private readonly frame;
4943
+ private readonly status;
4944
+ private readonly heartbeat?;
4945
+ constructor(frame: (data: unknown, snapshot: boolean) => void, status: (status: string) => void, heartbeat?: (serverTime: number) => void);
4946
+ start(streamURL: string, renewURL: string): void;
4947
+ stop(): void;
4948
+ private active;
4949
+ private deadline;
4950
+ private connect;
4951
+ private renew;
4952
+ }
4953
+ }
4873
4954
  declare module "components/chart/chart.component" {
4874
4955
  import { type ChartType, type RadarIndicator, type SeriesItem } from "components/chart/builders";
4875
4956
  import { type CSSResultGroup, type PropertyValues } from 'lit';
@@ -4894,6 +4975,9 @@ declare module "components/chart/chart.component" {
4894
4975
  stacked: boolean;
4895
4976
  live: boolean;
4896
4977
  dataUrl: string;
4978
+ streamUrl: string;
4979
+ liveRenewUrl: string;
4980
+ hideZero: boolean;
4897
4981
  liveInterval: number;
4898
4982
  height: number;
4899
4983
  enableAnimations: boolean | number;
@@ -4911,6 +4995,16 @@ declare module "components/chart/chart.component" {
4911
4995
  private echarts?;
4912
4996
  private initPromise?;
4913
4997
  private liveTimer?;
4998
+ private pollAbort?;
4999
+ private liveStatus;
5000
+ private liveWindow;
5001
+ private replaceLiveSeries;
5002
+ private transport;
5003
+ private liveTransitionDuration;
5004
+ private liveSeries;
5005
+ private updateChart;
5006
+ protected updated(changed: PropertyValues): void;
5007
+ connectedCallback(): void;
4914
5008
  private readonly resizeObserver;
4915
5009
  protected firstUpdated(_changedProperties: PropertyValues): void;
4916
5010
  protected getUpdateComplete(): Promise<boolean>;
@@ -4919,6 +5013,7 @@ declare module "components/chart/chart.component" {
4919
5013
  private getBorderColor;
4920
5014
  private buildOption;
4921
5015
  private initChart;
5016
+ private stopLive;
4922
5017
  private startLive;
4923
5018
  private reinit;
4924
5019
  attributeChangedCallback(name: string, _old: string | null, value: string | null): void;
@@ -6199,22 +6294,14 @@ declare module "components/stepper/index" {
6199
6294
  declare module "components/stat/stat.component" {
6200
6295
  import { type CSSResultGroup } from 'lit';
6201
6296
  import ZincElement from "internal/zinc-element";
6297
+ import type { IconColor } from "components/icon/index";
6202
6298
  /**
6203
- * @summary Short summary of the component's intended use.
6299
+ * @summary Displays a key metric, optionally compared with a previous value.
6204
6300
  * @documentation https://zinc.style/components/stats-tile
6205
6301
  * @status experimental
6206
6302
  * @since 1.0
6207
6303
  *
6208
- * @dependency zn-example
6209
- *
6210
- * @event zn-event-name - Emitted as an example.
6211
- *
6212
- * @slot - The default slot.
6213
- * @slot example - An example slot.
6214
- *
6215
- * @csspart base - The component's base wrapper.
6216
- *
6217
- * @cssproperty --example - An example CSS custom property.
6304
+ * @dependency zn-icon
6218
6305
  */
6219
6306
  export default class ZnStatsTile extends ZincElement {
6220
6307
  static styles: CSSResultGroup;
@@ -6226,10 +6313,27 @@ declare module "components/stat/stat.component" {
6226
6313
  currency: string;
6227
6314
  showDelta: boolean;
6228
6315
  color: 'primary' | 'error' | 'info' | 'warning' | 'success' | 'neutral';
6316
+ /** `value-first` puts the amount under the caption with the description beneath it, and tints the amount rather
6317
+ * than the description with `color`. */
6318
+ layout: 'default' | 'value-first';
6319
+ /** How `show-delta` compares with `previous`: the relative change, or the difference in points. */
6320
+ deltaFormat: 'percent' | 'points';
6321
+ /** An icon shown beside the amount. */
6322
+ icon: string;
6323
+ /** The icon's color; without one it takes the amount's. */
6324
+ iconColor: IconColor;
6325
+ /** `large` gives the amount more weight, for a summary row of a few headline figures. */
6326
+ size: 'medium' | 'large';
6327
+ /** Pads the stat, for stats laid edge to edge in a flush container such as `zn-cols no-gap divide`. */
6328
+ padded: boolean;
6229
6329
  calcPercentageDifference(): number;
6230
6330
  getCurrentAmount(): string;
6231
6331
  private getDisplayAmount;
6232
6332
  diffText(): import("lit-html").TemplateResult<1> | null;
6333
+ private pointsDelta;
6334
+ private renderAmount;
6335
+ private renderValueFirst;
6336
+ private percentDelta;
6233
6337
  render(): import("lit-html").TemplateResult<1>;
6234
6338
  }
6235
6339
  }