@texturehq/edges 2.4.3 → 2.4.5

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/server.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ActionItem, a as ActionMenuProps, b as AppShellProps, c as AvatarProps, B as BadgeProps, d as BaseDataPoint, C as ChartMargin, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, E as ENTITY_CONFIG, h as EntityConfig, i as EntityType, H as Heading, I as InteractiveMapProps, L as Loader, j as Logo, M as MapPoint, k as MeterProps, S as SegmentOption, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, p as StaticMapProps, T as TextLink, q as TooltipData, r as TooltipSeries, s as TopNav, t as TopNavProps, Y as YFormatSettings, u as YFormatType, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, R as isLightColor } from './colors-AT5gFqGB.cjs';
1
+ export { A as ActionItem, a as ActionMenuProps, b as AppShellProps, c as AvatarProps, B as BadgeProps, d as BaseDataPoint, C as ChartMargin, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, E as ENTITY_CONFIG, h as EntityConfig, i as EntityType, H as Heading, I as InteractiveMapProps, L as Loader, j as Logo, M as MapPoint, k as MeterProps, S as SegmentOption, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, p as StaticMapProps, T as TextLink, q as TooltipData, r as TooltipSeries, s as TopNav, t as TopNavProps, Y as YFormatSettings, u as YFormatType, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, R as isLightColor } from './colors-Z6qVFuKf.cjs';
2
2
  export { BreadcrumbProps, BreadcrumbsProps } from 'react-aria-components';
3
3
  export { D as DateFieldProps, F as FileUploadProps, R as RichTextEditorProps } from './RichTextEditor-BNXNpG4s.cjs';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
package/dist/server.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ActionItem, a as ActionMenuProps, b as AppShellProps, c as AvatarProps, B as BadgeProps, d as BaseDataPoint, C as ChartMargin, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, E as ENTITY_CONFIG, h as EntityConfig, i as EntityType, H as Heading, I as InteractiveMapProps, L as Loader, j as Logo, M as MapPoint, k as MeterProps, S as SegmentOption, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, p as StaticMapProps, T as TextLink, q as TooltipData, r as TooltipSeries, s as TopNav, t as TopNavProps, Y as YFormatSettings, u as YFormatType, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, R as isLightColor } from './colors-DOYgrvZw.js';
1
+ export { A as ActionItem, a as ActionMenuProps, b as AppShellProps, c as AvatarProps, B as BadgeProps, d as BaseDataPoint, C as ChartMargin, e as CodeEditorProps, f as CodeLanguage, g as CodeTheme, E as ENTITY_CONFIG, h as EntityConfig, i as EntityType, H as Heading, I as InteractiveMapProps, L as Loader, j as Logo, M as MapPoint, k as MeterProps, S as SegmentOption, l as SegmentedControlProps, m as SideNav, n as SideNavItem, o as SideNavProps, p as StaticMapProps, T as TextLink, q as TooltipData, r as TooltipSeries, s as TopNav, t as TopNavProps, Y as YFormatSettings, u as YFormatType, v as clearColorCache, w as createCategoryColorMap, x as createXScale, y as createYScale, z as defaultMargin, D as getContrastingTextColor, F as getDefaultChartColor, G as getDefaultColors, J as getEntityConfig, K as getEntityIcon, N as getEntityLabel, O as getResolvedColor, P as getThemeCategoricalColors, Q as getYFormatSettings, R as isLightColor } from './colors-B85aftHP.js';
2
2
  export { BreadcrumbProps, BreadcrumbsProps } from 'react-aria-components';
3
3
  export { D as DateFieldProps, F as FileUploadProps, R as RichTextEditorProps } from './RichTextEditor-BNXNpG4s.js';
4
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@texturehq/edges",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "author": "Nicholas Brown <nick@texturehq.com>",
5
5
  "description": "A shared component library for Texture",
6
6
  "type": "module",
@@ -103,6 +103,7 @@
103
103
  "@tiptap/react": "^3.4.5",
104
104
  "@tiptap/starter-kit": "^3.4.5",
105
105
  "@types/d3-scale": "^4.0.9",
106
+ "@types/d3-time": "^3.0.4",
106
107
  "@visx/axis": "^3.10.1",
107
108
  "@visx/brush": "^3.12.0",
108
109
  "@visx/curve": "^3.3.0",
@@ -117,6 +118,7 @@
117
118
  "ace-builds": "^1.43.3",
118
119
  "d3-array": "^3.2.4",
119
120
  "d3-scale": "^4.0.2",
121
+ "d3-time": "^3.1.0",
120
122
  "date-fns": "^4.1.0",
121
123
  "file-saver": "^2.0.5",
122
124
  "framer-motion": "^12.23.24",
@@ -8,193 +8,6 @@ import * as react_map_gl from 'react-map-gl';
8
8
  import { ViewState, MapRef } from 'react-map-gl';
9
9
  import { MeterProps as MeterProps$1 } from 'react-aria-components';
10
10
 
11
- /**
12
- * Core types for the formatting system
13
- */
14
- type FieldValue = string | number | boolean | Date | null | undefined;
15
- type FormattedValue = string | null;
16
- type FormatterFunction = (value: FieldValue, ...args: unknown[]) => FormattedValue;
17
- interface BaseFormat {
18
- nullText?: string;
19
- emptyText?: string;
20
- hideWhenNull?: boolean;
21
- hideWhenZero?: boolean;
22
- }
23
- type TextTransform = "uppercase" | "lowercase" | "capitalize" | "titleCase" | "sentenceCase";
24
- type TextTruncatePosition = "start" | "middle" | "end";
25
- interface TextFormat extends BaseFormat {
26
- type: "text";
27
- transform?: TextTransform | TextTransform[];
28
- truncate?: {
29
- length: number;
30
- position: TextTruncatePosition;
31
- ellipsis?: string;
32
- };
33
- wrap?: "normal" | "nowrap" | "pre" | "pre-wrap";
34
- highlight?: {
35
- pattern: string | RegExp;
36
- className?: string;
37
- };
38
- }
39
- interface NumberFormat extends BaseFormat {
40
- type: "number";
41
- decimals?: number;
42
- thousandsSeparator?: boolean;
43
- notation?: "standard" | "scientific" | "compact" | "engineering";
44
- compactDisplay?: "short" | "long";
45
- sign?: "auto" | "never" | "always" | "exceptZero";
46
- }
47
- interface PercentageFormat extends BaseFormat {
48
- type: "percentage";
49
- decimals?: number;
50
- }
51
- interface CurrencyFormat extends BaseFormat {
52
- type: "currency";
53
- currency?: string;
54
- currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
55
- minimumFractionDigits?: number;
56
- maximumFractionDigits?: number;
57
- thousandsSeparator?: boolean;
58
- }
59
- type DateFormatStyle = "short" | "medium" | "long" | "full";
60
- interface DateFormat extends BaseFormat {
61
- type: "date";
62
- format?: string;
63
- dateStyle?: DateFormatStyle;
64
- timeStyle?: DateFormatStyle;
65
- relative?: boolean;
66
- timezone?: string;
67
- }
68
- interface BooleanFormat extends BaseFormat {
69
- type: "boolean";
70
- trueText?: string;
71
- falseText?: string;
72
- trueIcon?: string;
73
- falseIcon?: string;
74
- }
75
- type EnergyUnit = "Wh" | "kWh" | "MWh" | "GWh";
76
- interface EnergyFormat extends BaseFormat {
77
- type: "energy";
78
- /** Display unit. If omitted, the formatter auto-scales (Wh → kWh → MWh → GWh). */
79
- unit?: EnergyUnit;
80
- /**
81
- * The unit the source value is already in. Defaults to "Wh" — the formatter's
82
- * historical assumption. Set this when feeding a value that's already in a
83
- * larger unit (e.g. `state.latestKwhUsage` is kWh) so auto-scale and the
84
- * `unit` switch interpret the magnitude correctly.
85
- */
86
- sourceUnit?: EnergyUnit;
87
- autoScale?: boolean;
88
- decimals?: number;
89
- }
90
- type PowerUnit = "W" | "kW" | "MW" | "GW";
91
- interface PowerFormat extends BaseFormat {
92
- type: "power";
93
- unit?: PowerUnit;
94
- autoScale?: boolean;
95
- decimals?: number;
96
- }
97
- type VoltageUnit = "mV" | "V" | "kV";
98
- interface VoltageFormat extends BaseFormat {
99
- type: "voltage";
100
- unit?: VoltageUnit;
101
- autoScale?: boolean;
102
- decimals?: number;
103
- }
104
- type CurrentUnit = "mA" | "A" | "kA";
105
- interface CurrentFormat extends BaseFormat {
106
- type: "current";
107
- unit?: CurrentUnit;
108
- autoScale?: boolean;
109
- decimals?: number;
110
- }
111
- type ResistanceUnit = "mΩ" | "Ω" | "kΩ" | "MΩ";
112
- interface ResistanceFormat extends BaseFormat {
113
- type: "resistance";
114
- unit?: ResistanceUnit;
115
- autoScale?: boolean;
116
- decimals?: number;
117
- }
118
- type TemperatureUnit = "C" | "F" | "K";
119
- type TemperatureUnitString = "CELSIUS" | "FAHRENHEIT" | "KELVIN";
120
- interface TemperatureFormat extends BaseFormat {
121
- type: "temperature";
122
- unit?: TemperatureUnit | TemperatureUnitString;
123
- decimals?: number;
124
- showUnit?: boolean;
125
- }
126
- type DistanceUnit = "m" | "km" | "ft" | "mi" | "yd";
127
- interface DistanceFormat extends BaseFormat {
128
- type: "distance";
129
- unit?: DistanceUnit;
130
- autoScale?: boolean;
131
- decimals?: number;
132
- }
133
- interface PhoneFormat extends BaseFormat {
134
- type: "phone";
135
- country?: string;
136
- international?: boolean;
137
- }
138
- interface CustomFormat extends BaseFormat {
139
- type: "custom";
140
- formatter: FormatterFunction;
141
- options?: Record<string, unknown>;
142
- }
143
- type FieldFormat = TextFormat | NumberFormat | PercentageFormat | CurrencyFormat | DateFormat | BooleanFormat | EnergyFormat | PowerFormat | VoltageFormat | CurrentFormat | ResistanceFormat | TemperatureFormat | DistanceFormat | PhoneFormat | CustomFormat;
144
-
145
- /**
146
- * Centralized formatting utility for UI components
147
- * Used by Kpi, StatList, and other data display components
148
- */
149
-
150
- /**
151
- * Common formatter type used by data display components
152
- * Can be either a custom function or a FieldFormat object
153
- */
154
- type ComponentFormatter = ((value: FieldValue) => React__default.ReactNode) | FieldFormat;
155
- /**
156
- * Options for formatting values in components
157
- */
158
- interface ComponentFormatOptions {
159
- /** The value to format */
160
- value: FieldValue;
161
- /** The formatter to apply */
162
- formatter?: ComponentFormatter;
163
- /** CSS class for null/empty values */
164
- emptyClassName?: string;
165
- /** Text to show for null/empty values */
166
- emptyText?: React__default.ReactNode;
167
- }
168
- /**
169
- * Format a value for display in a component
170
- * Centralizes the logic used by Kpi, StatList, and similar components
171
- *
172
- * @example
173
- * ```tsx
174
- * // In a component
175
- * const formatted = formatComponentValue({
176
- * value: 1500,
177
- * formatter: { type: "power" }
178
- * });
179
- * // Returns: "1.5 kW"
180
- * ```
181
- */
182
- declare function formatComponentValue({ value, formatter, emptyClassName, emptyText, }: ComponentFormatOptions): React__default.ReactNode;
183
- /**
184
- * Hook for using the component formatter
185
- * Provides memoization for better performance
186
- *
187
- * @example
188
- * ```tsx
189
- * function MyComponent({ value, formatter }) {
190
- * const format = useComponentFormatter(formatter);
191
- * const formatted = format(value);
192
- * return <span>{formatted}</span>;
193
- * }
194
- * ```
195
- */
196
- declare function useComponentFormatter(formatter?: ComponentFormatter, emptyClassName?: string, emptyText?: React__default.ReactNode): (value: FieldValue) => React__default.ReactNode;
197
-
198
11
  interface ActionItem {
199
12
  /**
200
13
  * Unique identifier for the action
@@ -835,6 +648,193 @@ interface CodeEditorProps {
835
648
  */
836
649
  declare function CodeEditor({ value, readOnly, onChange, language, theme, height, width, className, lineHeight, minLines, maxLines, showLineNumbers, showGutter, fontSize, wrapEnabled, }: CodeEditorProps): react_jsx_runtime.JSX.Element;
837
650
 
651
+ /**
652
+ * Core types for the formatting system
653
+ */
654
+ type FieldValue = string | number | boolean | Date | null | undefined;
655
+ type FormattedValue = string | null;
656
+ type FormatterFunction = (value: FieldValue, ...args: unknown[]) => FormattedValue;
657
+ interface BaseFormat {
658
+ nullText?: string;
659
+ emptyText?: string;
660
+ hideWhenNull?: boolean;
661
+ hideWhenZero?: boolean;
662
+ }
663
+ type TextTransform = "uppercase" | "lowercase" | "capitalize" | "titleCase" | "sentenceCase";
664
+ type TextTruncatePosition = "start" | "middle" | "end";
665
+ interface TextFormat extends BaseFormat {
666
+ type: "text";
667
+ transform?: TextTransform | TextTransform[];
668
+ truncate?: {
669
+ length: number;
670
+ position: TextTruncatePosition;
671
+ ellipsis?: string;
672
+ };
673
+ wrap?: "normal" | "nowrap" | "pre" | "pre-wrap";
674
+ highlight?: {
675
+ pattern: string | RegExp;
676
+ className?: string;
677
+ };
678
+ }
679
+ interface NumberFormat extends BaseFormat {
680
+ type: "number";
681
+ decimals?: number;
682
+ thousandsSeparator?: boolean;
683
+ notation?: "standard" | "scientific" | "compact" | "engineering";
684
+ compactDisplay?: "short" | "long";
685
+ sign?: "auto" | "never" | "always" | "exceptZero";
686
+ }
687
+ interface PercentageFormat extends BaseFormat {
688
+ type: "percentage";
689
+ decimals?: number;
690
+ }
691
+ interface CurrencyFormat extends BaseFormat {
692
+ type: "currency";
693
+ currency?: string;
694
+ currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
695
+ minimumFractionDigits?: number;
696
+ maximumFractionDigits?: number;
697
+ thousandsSeparator?: boolean;
698
+ }
699
+ type DateFormatStyle = "short" | "medium" | "long" | "full";
700
+ interface DateFormat extends BaseFormat {
701
+ type: "date";
702
+ format?: string;
703
+ dateStyle?: DateFormatStyle;
704
+ timeStyle?: DateFormatStyle;
705
+ relative?: boolean;
706
+ timezone?: string;
707
+ }
708
+ interface BooleanFormat extends BaseFormat {
709
+ type: "boolean";
710
+ trueText?: string;
711
+ falseText?: string;
712
+ trueIcon?: string;
713
+ falseIcon?: string;
714
+ }
715
+ type EnergyUnit = "Wh" | "kWh" | "MWh" | "GWh";
716
+ interface EnergyFormat extends BaseFormat {
717
+ type: "energy";
718
+ /** Display unit. If omitted, the formatter auto-scales (Wh → kWh → MWh → GWh). */
719
+ unit?: EnergyUnit;
720
+ /**
721
+ * The unit the source value is already in. Defaults to "Wh" — the formatter's
722
+ * historical assumption. Set this when feeding a value that's already in a
723
+ * larger unit (e.g. `state.latestKwhUsage` is kWh) so auto-scale and the
724
+ * `unit` switch interpret the magnitude correctly.
725
+ */
726
+ sourceUnit?: EnergyUnit;
727
+ autoScale?: boolean;
728
+ decimals?: number;
729
+ }
730
+ type PowerUnit = "W" | "kW" | "MW" | "GW";
731
+ interface PowerFormat extends BaseFormat {
732
+ type: "power";
733
+ unit?: PowerUnit;
734
+ autoScale?: boolean;
735
+ decimals?: number;
736
+ }
737
+ type VoltageUnit = "mV" | "V" | "kV";
738
+ interface VoltageFormat extends BaseFormat {
739
+ type: "voltage";
740
+ unit?: VoltageUnit;
741
+ autoScale?: boolean;
742
+ decimals?: number;
743
+ }
744
+ type CurrentUnit = "mA" | "A" | "kA";
745
+ interface CurrentFormat extends BaseFormat {
746
+ type: "current";
747
+ unit?: CurrentUnit;
748
+ autoScale?: boolean;
749
+ decimals?: number;
750
+ }
751
+ type ResistanceUnit = "mΩ" | "Ω" | "kΩ" | "MΩ";
752
+ interface ResistanceFormat extends BaseFormat {
753
+ type: "resistance";
754
+ unit?: ResistanceUnit;
755
+ autoScale?: boolean;
756
+ decimals?: number;
757
+ }
758
+ type TemperatureUnit = "C" | "F" | "K";
759
+ type TemperatureUnitString = "CELSIUS" | "FAHRENHEIT" | "KELVIN";
760
+ interface TemperatureFormat extends BaseFormat {
761
+ type: "temperature";
762
+ unit?: TemperatureUnit | TemperatureUnitString;
763
+ decimals?: number;
764
+ showUnit?: boolean;
765
+ }
766
+ type DistanceUnit = "m" | "km" | "ft" | "mi" | "yd";
767
+ interface DistanceFormat extends BaseFormat {
768
+ type: "distance";
769
+ unit?: DistanceUnit;
770
+ autoScale?: boolean;
771
+ decimals?: number;
772
+ }
773
+ interface PhoneFormat extends BaseFormat {
774
+ type: "phone";
775
+ country?: string;
776
+ international?: boolean;
777
+ }
778
+ interface CustomFormat extends BaseFormat {
779
+ type: "custom";
780
+ formatter: FormatterFunction;
781
+ options?: Record<string, unknown>;
782
+ }
783
+ type FieldFormat = TextFormat | NumberFormat | PercentageFormat | CurrencyFormat | DateFormat | BooleanFormat | EnergyFormat | PowerFormat | VoltageFormat | CurrentFormat | ResistanceFormat | TemperatureFormat | DistanceFormat | PhoneFormat | CustomFormat;
784
+
785
+ /**
786
+ * Centralized formatting utility for UI components
787
+ * Used by Kpi, StatList, and other data display components
788
+ */
789
+
790
+ /**
791
+ * Common formatter type used by data display components
792
+ * Can be either a custom function or a FieldFormat object
793
+ */
794
+ type ComponentFormatter = ((value: FieldValue) => React__default.ReactNode) | FieldFormat;
795
+ /**
796
+ * Options for formatting values in components
797
+ */
798
+ interface ComponentFormatOptions {
799
+ /** The value to format */
800
+ value: FieldValue;
801
+ /** The formatter to apply */
802
+ formatter?: ComponentFormatter;
803
+ /** CSS class for null/empty values */
804
+ emptyClassName?: string;
805
+ /** Text to show for null/empty values */
806
+ emptyText?: React__default.ReactNode;
807
+ }
808
+ /**
809
+ * Format a value for display in a component
810
+ * Centralizes the logic used by Kpi, StatList, and similar components
811
+ *
812
+ * @example
813
+ * ```tsx
814
+ * // In a component
815
+ * const formatted = formatComponentValue({
816
+ * value: 1500,
817
+ * formatter: { type: "power" }
818
+ * });
819
+ * // Returns: "1.5 kW"
820
+ * ```
821
+ */
822
+ declare function formatComponentValue({ value, formatter, emptyClassName, emptyText, }: ComponentFormatOptions): React__default.ReactNode;
823
+ /**
824
+ * Hook for using the component formatter
825
+ * Provides memoization for better performance
826
+ *
827
+ * @example
828
+ * ```tsx
829
+ * function MyComponent({ value, formatter }) {
830
+ * const format = useComponentFormatter(formatter);
831
+ * const formatted = format(value);
832
+ * return <span>{formatted}</span>;
833
+ * }
834
+ * ```
835
+ */
836
+ declare function useComponentFormatter(formatter?: ComponentFormatter, emptyClassName?: string, emptyText?: React__default.ReactNode): (value: FieldValue) => React__default.ReactNode;
837
+
838
838
  /**
839
839
  * Chart Y-axis formatter type
840
840
  * Uses the main formatting system for consistency with Kpi, StatList, and DataTable