@typlog/ui 0.13.1 → 0.15.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/base.css CHANGED
@@ -5197,13 +5197,9 @@
5197
5197
  }
5198
5198
 
5199
5199
  /* * * * * * * * * * * * * * * * * * * */
5200
-
5201
5200
  /* */
5202
-
5203
5201
  /* Semantic colors */
5204
-
5205
5202
  /* */
5206
-
5207
5203
  /* * * * * * * * * * * * * * * * * * * */
5208
5204
 
5209
5205
  :where(.ui-root) {
@@ -5213,7 +5209,6 @@
5213
5209
  --color-panel-translucent: rgba(255, 255, 255, 0.7);
5214
5210
  --color-surface: rgba(255, 255, 255, 0.85);
5215
5211
  }
5216
-
5217
5212
  :is(.dark, .dark-theme) :where(.ui-root) {
5218
5213
  --color-background: var(--gray-1);
5219
5214
  --color-overlay: var(--black-a8);
@@ -5223,23 +5218,16 @@
5223
5218
  }
5224
5219
 
5225
5220
  /* * * * * * * * * * * * * * * * * * * */
5226
-
5227
5221
  /* */
5228
-
5229
5222
  /* Transparency */
5230
-
5231
5223
  /* */
5232
-
5233
5224
  /* * * * * * * * * * * * * * * * * * * */
5234
5225
 
5235
5226
  /* Because Chrome is buggy with box-shadow transitions from "transparent" keyword and/or RGB color into P3 colors. */
5236
-
5237
5227
  /* Note: using `:where` here to guarantee that the P3 color will take over regardless of the output rule order. */
5238
-
5239
5228
  :where(.ui-root) {
5240
5229
  --color-transparent: rgb(0 0 0 / 0);
5241
5230
  }
5242
-
5243
5231
  @supports (color: color(display-p3 1 1 1)) {
5244
5232
  @media (color-gamut: p3) {
5245
5233
  .ui-root {
@@ -5249,36 +5237,26 @@
5249
5237
  }
5250
5238
 
5251
5239
  /* * * * * * * * * * * * * * * * * * * */
5252
-
5253
5240
  /* */
5254
-
5255
5241
  /* Color scheme */
5256
-
5257
5242
  /* */
5258
-
5259
5243
  /* * * * * * * * * * * * * * * * * * * */
5260
5244
 
5261
5245
  /*
5262
5246
  * Make sure that forced light/dark appearance also sets corresponding browser colors,
5263
5247
  * like input autofill color and body scrollbar
5264
5248
  */
5265
-
5266
5249
  :is(.light, .light-theme) :where(.ui-root) {
5267
5250
  color-scheme: light;
5268
5251
  }
5269
-
5270
5252
  :is(.dark, .dark-theme) :where(.ui-root) {
5271
5253
  color-scheme: dark;
5272
5254
  }
5273
5255
 
5274
5256
  /* * * * * * * * * * * * * * * * * * * */
5275
-
5276
5257
  /* */
5277
-
5278
5258
  /* Focus, selection, and autofill */
5279
-
5280
5259
  /* */
5281
-
5282
5260
  /* * * * * * * * * * * * * * * * * * * */
5283
5261
 
5284
5262
  .ui-root,
@@ -5319,13 +5297,9 @@
5319
5297
  }
5320
5298
 
5321
5299
  /* * * * * * * * * * * * * * * * * * * */
5322
-
5323
5300
  /* */
5324
-
5325
5301
  /* Background and text */
5326
-
5327
5302
  /* */
5328
-
5329
5303
  /* * * * * * * * * * * * * * * * * * * */
5330
5304
 
5331
5305
  .ui-root {
@@ -5337,13 +5311,9 @@
5337
5311
  }
5338
5312
 
5339
5313
  /* * * * * * * * * * * * * * * * * * * */
5340
-
5341
5314
  /* */
5342
-
5343
5315
  /* Panel background */
5344
-
5345
5316
  /* */
5346
-
5347
5317
  /* * * * * * * * * * * * * * * * * * * */
5348
5318
 
5349
5319
  .ui-root:where([data-panel-background='solid']) {
@@ -5357,13 +5327,9 @@
5357
5327
  }
5358
5328
 
5359
5329
  /* * * * * * * * * * * * * * * * * * * */
5360
-
5361
5330
  /* */
5362
-
5363
5331
  /* Accent color */
5364
-
5365
5332
  /* */
5366
-
5367
5333
  /* * * * * * * * * * * * * * * * * * * */
5368
5334
 
5369
5335
  [data-accent-color='amber'] {
@@ -6225,13 +6191,9 @@
6225
6191
  }
6226
6192
 
6227
6193
  /* * * * * * * * * * * * * * * * * * * */
6228
-
6229
6194
  /* */
6230
-
6231
6195
  /* Gray color */
6232
-
6233
6196
  /* */
6234
-
6235
6197
  /* * * * * * * * * * * * * * * * * * * */
6236
6198
 
6237
6199
  .ui-root :where([data-gray-color='mauve']) {
@@ -6469,15 +6431,12 @@
6469
6431
  .r-resize-vertical {
6470
6432
  resize: vertical;
6471
6433
  }
6472
-
6473
6434
  .r-resize-horizontal {
6474
6435
  resize: horizontal;
6475
6436
  }
6476
-
6477
6437
  .r-resize-both {
6478
6438
  resize: both;
6479
6439
  }
6480
-
6481
6440
  .ui-root {
6482
6441
  --shadow-1:
6483
6442
  inset 0 0 0 1px var(--gray-a5),
package/charts.css ADDED
@@ -0,0 +1,161 @@
1
+ @layer components {
2
+ .ui-ChartRoot {
3
+ --vis-font-family: var(--font-family-sans);
4
+ --vis-axis-tick-color: var(--gray-a7);
5
+ --vis-axis-domain-color: var(--gray-a7);
6
+ --vis-axis-grid-color: var(--gray-a3);
7
+ --vis-axis-label-color: var(--gray-11);
8
+ --vis-axis-tick-label-color: var(--gray-11);
9
+ --vis-tooltip-padding: var(--space-3);
10
+ --vis-tooltip-background-color: var(--color-panel-solid);
11
+ --vis-tooltip-border-color: transparent;
12
+ --vis-tooltip-text-color: var(--gray-12);
13
+ --vis-tooltip-box-shadow: var(--shadow-3);
14
+ --vis-tooltip-shadow-color: var(--gray-a5);
15
+ --vis-tooltip-backdrop-filter: blur(8px);
16
+ --vis-color-main: var(--chart-1);
17
+ --vis-color0: var(--chart-1);
18
+ --vis-color1: var(--chart-2);
19
+ --vis-color2: var(--chart-3);
20
+ --vis-color3: var(--chart-4);
21
+ --vis-color4: var(--chart-5);
22
+ --vis-color5: var(--chart-6);
23
+
24
+ display: block;
25
+ box-sizing: border-box;
26
+ width: 100%;
27
+ min-width: 0;
28
+ color: var(--gray-12);
29
+ }
30
+
31
+ .ui-ChartLegend {
32
+ display: flex;
33
+ flex-wrap: wrap;
34
+ gap: var(--space-3) var(--space-5);
35
+ color: var(--gray-11);
36
+ font-size: var(--font-size-2);
37
+ line-height: var(--line-height-2);
38
+ }
39
+
40
+ .ui-ChartLegend:where(.r-orientation-vertical) {
41
+ flex-direction: column;
42
+ gap: var(--space-2);
43
+ }
44
+
45
+ .ui-ChartLegend:where(.r-orientation-horizontal.r-align-center) {
46
+ justify-content: center;
47
+ }
48
+
49
+ .ui-ChartLegend:where(.r-orientation-horizontal.r-align-end) {
50
+ justify-content: flex-end;
51
+ }
52
+
53
+ .ui-ChartLegend:where(.r-orientation-vertical.r-align-center) {
54
+ align-items: center;
55
+ }
56
+
57
+ .ui-ChartLegend:where(.r-orientation-vertical.r-align-end) {
58
+ align-items: flex-end;
59
+ }
60
+
61
+ .ui-ChartLegendItem {
62
+ display: inline-flex;
63
+ align-items: center;
64
+ min-width: 0;
65
+ gap: var(--space-2);
66
+ }
67
+
68
+ .ui-ChartLegendMarker,
69
+ .ui-ChartTooltipIndicator {
70
+ flex: 0 0 auto;
71
+ width: 0.625rem;
72
+ height: 0.625rem;
73
+ border-radius: var(--radius-full);
74
+ }
75
+
76
+ .ui-ChartLegendLabel {
77
+ overflow: hidden;
78
+ text-overflow: ellipsis;
79
+ white-space: nowrap;
80
+ }
81
+
82
+ .ui-ChartTooltip {
83
+ max-width: min(20rem, calc(100vw - var(--space-4)));
84
+ font-size: var(--font-size-2);
85
+ line-height: var(--line-height-2);
86
+ }
87
+
88
+ .ui-ChartTooltipContent {
89
+ display: grid;
90
+ min-width: 8rem;
91
+ gap: var(--space-2);
92
+ }
93
+
94
+ .ui-ChartTooltipLabel {
95
+ color: var(--gray-12);
96
+ font-weight: var(--font-weight-medium);
97
+ }
98
+
99
+ .ui-ChartTooltipItems {
100
+ display: grid;
101
+ gap: var(--space-2);
102
+ }
103
+
104
+ .ui-ChartTooltipItem {
105
+ display: flex;
106
+ align-items: center;
107
+ gap: var(--space-2);
108
+ }
109
+
110
+ .ui-ChartTooltipIcon {
111
+ width: 0.75rem;
112
+ height: 0.75rem;
113
+ color: var(--gray-11);
114
+ }
115
+
116
+ .ui-ChartTooltipIndicator {
117
+ width: 0.625rem;
118
+ height: 0.625rem;
119
+ border: 1px solid var(--chart-tooltip-color);
120
+ border-radius: var(--radius-full);
121
+ background: var(--chart-tooltip-color);
122
+ }
123
+
124
+ .ui-ChartTooltipIndicator:where(.r-indicator-line) {
125
+ align-self: stretch;
126
+ width: 0.1875rem;
127
+ height: auto;
128
+ border-radius: var(--radius-1);
129
+ }
130
+
131
+ .ui-ChartTooltipIndicator:where(.r-indicator-dashed) {
132
+ align-self: stretch;
133
+ width: 0;
134
+ height: auto;
135
+ border-width: 0 0 0 2px;
136
+ border-style: dashed;
137
+ border-radius: 0;
138
+ background: transparent;
139
+ }
140
+
141
+ .ui-ChartTooltipSeries {
142
+ flex: 1 1 auto;
143
+ min-width: 0;
144
+ }
145
+
146
+ .ui-ChartTooltipSeriesLabel {
147
+ overflow: hidden;
148
+ color: var(--gray-11);
149
+ text-overflow: ellipsis;
150
+ white-space: nowrap;
151
+ }
152
+
153
+ .ui-ChartTooltipValue {
154
+ flex: none;
155
+ margin-left: auto;
156
+ color: var(--gray-12);
157
+ font-family: var(--font-family-mono);
158
+ font-weight: var(--font-weight-medium);
159
+ font-variant-numeric: tabular-nums;
160
+ }
161
+ }
package/charts.d.ts ADDED
@@ -0,0 +1,233 @@
1
+ import { AsTag } from 'reka-ui';
2
+ import { Component } from 'vue';
3
+ import { ComponentOptionsMixin } from 'vue';
4
+ import { ComponentProvideOptions } from 'vue';
5
+ import { CrosshairConfigInterface } from '@unovis/ts';
6
+ import { DefineComponent } from 'vue';
7
+ import { Donut } from '@unovis/ts';
8
+ import { GroupedBar } from '@unovis/ts';
9
+ import { IconifyIconBuildResult } from '@iconify/vue';
10
+ import { PrimitiveProps } from 'reka-ui';
11
+ import { PublicProps } from 'vue';
12
+ import { StackedBar } from '@unovis/ts';
13
+ import { TooltipConfigInterface } from '@unovis/ts';
14
+ import { VNode } from 'vue';
15
+
16
+ declare const __VLS_export: __VLS_WithSlots< DefineComponent<ChartRootProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ChartRootProps> & Readonly<{}>, {
17
+ as: AsTag | Component;
18
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
19
+ default?: (props: {
20
+ mounted: boolean;
21
+ }) => any;
22
+ }>;
23
+
24
+ declare const __VLS_export_2: <Datum = unknown>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
25
+ props: PublicProps & __VLS_PrettifyLocal<ChartCrosshairProps<Datum>> & (typeof globalThis extends {
26
+ __VLS_PROPS_FALLBACK: infer P;
27
+ } ? P : {});
28
+ expose: (exposed: {}) => void;
29
+ attrs: any;
30
+ slots: {};
31
+ emit: {};
32
+ }>) => VNode & {
33
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
34
+ };
35
+
36
+ declare const __VLS_export_3: DefineComponent<ChartTooltipProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ChartTooltipProps> & Readonly<{}>, {
37
+ contentComponent: Component;
38
+ contentProps: Record<string, unknown>;
39
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
40
+
41
+ declare const __VLS_export_4: __VLS_WithSlots_2< DefineComponent<{}, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>, {
42
+ default: (props: ChartAreaGradientSlotProps) => any;
43
+ }>;
44
+
45
+ declare const __VLS_export_5: __VLS_WithSlots_3< DefineComponent<ChartTooltipContentProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ChartTooltipContentProps> & Readonly<{}>, {
46
+ indicator: ChartTooltipIndicator;
47
+ config: ChartConfig;
48
+ payload: Record<string, unknown>;
49
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
50
+ default?: (props: {
51
+ items: {
52
+ index: number;
53
+ icon: IconifyIconBuildResult | undefined;
54
+ key: string;
55
+ value: unknown;
56
+ series: ChartSeries;
57
+ }[];
58
+ label: string | undefined;
59
+ }) => any;
60
+ }>;
61
+
62
+ declare const __VLS_export_6: __VLS_WithSlots_4< DefineComponent<ChartLegendProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ChartLegendProps> & Readonly<{}>, {
63
+ as: AsTag | Component;
64
+ orientation: "horizontal" | "vertical";
65
+ align: "start" | "center" | "end";
66
+ ariaLabel: string;
67
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
68
+ item?: (props: {
69
+ key: string;
70
+ series: ChartSeries;
71
+ index: number;
72
+ }) => any;
73
+ } & {
74
+ marker?: (props: {
75
+ key: string;
76
+ series: ChartSeries;
77
+ index: number;
78
+ }) => any;
79
+ }>;
80
+
81
+ declare type __VLS_PrettifyLocal<T> = (T extends any ? {
82
+ [K in keyof T]: T[K];
83
+ } : {
84
+ [K in keyof T as K]: T[K];
85
+ }) & {};
86
+
87
+ declare type __VLS_WithSlots<T, S> = T & {
88
+ new (): {
89
+ $slots: S;
90
+ };
91
+ };
92
+
93
+ declare type __VLS_WithSlots_2<T, S> = T & {
94
+ new (): {
95
+ $slots: S;
96
+ };
97
+ };
98
+
99
+ declare type __VLS_WithSlots_3<T, S> = T & {
100
+ new (): {
101
+ $slots: S;
102
+ };
103
+ };
104
+
105
+ declare type __VLS_WithSlots_4<T, S> = T & {
106
+ new (): {
107
+ $slots: S;
108
+ };
109
+ };
110
+
111
+ export declare const ChartAreaGradient: typeof __VLS_export_4;
112
+
113
+ export declare type ChartAreaGradientColor = (_data: unknown, index: number) => string;
114
+
115
+ export declare interface ChartAreaGradientSlotProps {
116
+ /** SVG definitions to pass to the Unovis container's `svgDefs` prop. */
117
+ svgDefs: string;
118
+ /** Unovis color accessor that resolves each area series to its gradient. */
119
+ color: ChartAreaGradientColor;
120
+ }
121
+
122
+ /** Configuration keyed by the series identifier used by a chart primitive. */
123
+ export declare type ChartConfig = Record<string, ChartSeries>;
124
+
125
+ export declare const ChartCrosshair: typeof __VLS_export_2;
126
+
127
+ /** A Typlog-themed adapter for Unovis' crosshair and its tooltip template. */
128
+ export declare interface ChartCrosshairProps<Datum = unknown> extends /* @vue-ignore */ Omit<CrosshairConfigInterface<Datum>, 'template'> {
129
+ /** Vue component rendered as the crosshair tooltip content. @default ChartTooltipContent */
130
+ contentComponent?: Component;
131
+ /** Props passed to `contentComponent` in addition to payload, config, and x. */
132
+ contentProps?: Record<string, unknown>;
133
+ }
134
+
135
+ export declare const ChartLegend: typeof __VLS_export_6;
136
+
137
+ export declare interface ChartLegendItemSlotProps {
138
+ key: string;
139
+ series: ChartSeries;
140
+ index: number;
141
+ }
142
+
143
+ export declare interface ChartLegendProps extends PrimitiveProps {
144
+ /** Layout direction for legend entries. @default "horizontal" */
145
+ orientation?: 'horizontal' | 'vertical';
146
+ /** Alignment of legend entries within the legend. @default "start" */
147
+ align?: 'start' | 'center' | 'end';
148
+ /** Accessible name for the legend list. @default "Chart legend" */
149
+ ariaLabel?: string;
150
+ }
151
+
152
+ export declare const ChartRoot: typeof __VLS_export;
153
+
154
+ export declare interface ChartRootProps extends PrimitiveProps {
155
+ /** Series metadata used by ChartLegend and ChartTooltip. */
156
+ config: ChartConfig;
157
+ }
158
+
159
+ /** A chart field and its presentation metadata. */
160
+ export declare interface ChartSeries {
161
+ /** Human-readable series name. */
162
+ label: string;
163
+ /** Identifies an x-axis/domain field. Entries default to `series`. */
164
+ role?: ChartSeriesRole;
165
+ /** Optional CSS color. Defaults to the chart palette. */
166
+ color?: string;
167
+ /** Optional Iconify icon name rendered before the series label. */
168
+ icon?: string;
169
+ }
170
+
171
+ /** Determines whether a configured field is the x-axis domain or a data series. */
172
+ export declare type ChartSeriesRole = 'x' | 'series';
173
+
174
+ export declare const ChartTooltip: typeof __VLS_export_3;
175
+
176
+ export declare const ChartTooltipContent: typeof __VLS_export_5;
177
+
178
+ export declare interface ChartTooltipContentProps {
179
+ /** Values keyed by the matching ChartConfig series key. */
180
+ payload?: Record<string, unknown>;
181
+ /** Series metadata. Passed automatically by createChartTooltipTemplate. */
182
+ config?: ChartConfig;
183
+ /** Domain value displayed as the tooltip label. */
184
+ x?: string | number | Date;
185
+ /** Indicator displayed beside each series. @default "dot" */
186
+ indicator?: ChartTooltipIndicator;
187
+ /** Hides the tooltip label. */
188
+ hideLabel?: boolean;
189
+ /** Hides series indicators without removing icons. */
190
+ hideIndicator?: boolean;
191
+ /** Uses a payload or config key instead of the role-x value or crosshair x. */
192
+ labelKey?: string;
193
+ /** Formats the final tooltip label. Priority: hideLabel, labelKey, role-x field, crosshair x. */
194
+ labelFormatter?: (value: string | number | Date) => string;
195
+ /** Formats a series value. */
196
+ valueFormatter?: (value: unknown, key: string) => string;
197
+ }
198
+
199
+ export declare type ChartTooltipIndicator = 'dot' | 'line' | 'dashed' | 'none';
200
+
201
+ export declare type ChartTooltipPrimitive = typeof Donut | typeof GroupedBar | typeof StackedBar;
202
+
203
+ /** A Typlog-themed adapter for Unovis' interactive tooltip. */
204
+ export declare interface ChartTooltipProps extends /* @vue-ignore */ TooltipConfigInterface {
205
+ /** Unovis primitives that should automatically trigger the themed tooltip. */
206
+ targets?: ChartTooltipTarget[];
207
+ /** Vue component rendered as the tooltip content. @default ChartTooltipContent */
208
+ contentComponent?: Component;
209
+ /** Props passed to `contentComponent` in addition to payload, config, and x. */
210
+ contentProps?: Record<string, unknown>;
211
+ }
212
+
213
+ export declare type ChartTooltipTarget = ChartTooltipPrimitive | ChartTooltipTargetDescriptor;
214
+
215
+ /** A supported Unovis primitive that can provide automatic tooltip triggers. */
216
+ export declare interface ChartTooltipTargetDescriptor {
217
+ primitive: ChartTooltipPrimitive;
218
+ /** Maps the primitive's event datum to values keyed by ChartConfig. */
219
+ payload?: (data: any, index: number) => Record<string, unknown>;
220
+ }
221
+
222
+ /** Creates a synchronous Unovis template callback from a Vue tooltip component. */
223
+ export declare function createChartTooltipTemplate(config: ChartConfig, component: Component, props?: Record<string, unknown>): (rawPayload: unknown, x?: string | number | Date) => string;
224
+
225
+ export { }
226
+
227
+
228
+ declare global {
229
+ interface Window {
230
+ turnstile: any;
231
+ [turnstileLoadFunction]: any;
232
+ }
233
+ }