chesai-ui 0.16.3 → 0.16.4

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 (28) hide show
  1. package/dist/chesai-ui.css +1 -1
  2. package/dist/components/charts/bar-chart.d.ts +3 -1
  3. package/dist/components/charts/bar-chart.mjs +87 -74
  4. package/dist/components/charts/chart-utils.d.ts +7 -0
  5. package/dist/components/charts/chart-utils.mjs +24 -7
  6. package/dist/components/charts/heatmap-chart.d.ts +25 -0
  7. package/dist/components/playlist-studio/elements.d.ts +10 -2
  8. package/dist/components/playlist-studio/elements.mjs +289 -120
  9. package/dist/components/playlist-studio/index.d.ts +1 -0
  10. package/dist/components/playlist-studio/item-renderer.d.ts +2 -1
  11. package/dist/components/playlist-studio/item-renderer.mjs +66 -55
  12. package/dist/components/playlist-studio/player.d.ts +3 -1
  13. package/dist/components/playlist-studio/player.mjs +438 -71
  14. package/dist/components/playlist-studio/preload-context.d.ts +8 -0
  15. package/dist/components/playlist-studio/preload-context.mjs +6 -0
  16. package/dist/components/playlist-studio/types.d.ts +3 -0
  17. package/dist/components/textarea/textarea-styles.mjs +4 -4
  18. package/dist/components/textarea/use-textarea.d.ts +2 -2
  19. package/dist/components/textarea/use-textarea.mjs +72 -69
  20. package/dist/context/ChesaiProvider.d.ts +5 -1
  21. package/dist/context/ChesaiProvider.mjs +28 -24
  22. package/dist/context/ThemeProvider.d.ts +5 -1
  23. package/dist/context/ThemeProvider.mjs +130 -112
  24. package/dist/context/heatmap-chart.d.ts +25 -0
  25. package/dist/index.mjs +67 -63
  26. package/dist/utils/theme-generator.d.ts +1 -1
  27. package/dist/utils/theme-generator.mjs +39 -39
  28. package/package.json +1 -1
@@ -10,5 +10,7 @@ export interface BarChartProps extends ChartProps {
10
10
  highlightShape?: ShapeType;
11
11
  /** Custom overlay icon centered in the badge. Defaults to a checkmark. */
12
12
  highlightIcon?: React.ReactNode;
13
+ /** Show a distinctive baseline reference line at y = 0 */
14
+ showBaseline?: boolean;
13
15
  }
14
- export declare const BarChart: ({ data, categories, index, variant, shape, colors, height, className, valueFormatter, scrollable, minWidth, highlightKey, highlightColor, highlightShape, highlightIcon, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const BarChart: ({ data, categories, index, variant, shape, colors, height, className, valueFormatter, scrollable, minWidth, highlightKey, highlightColor, highlightShape, highlightIcon, showBaseline, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,33 +1,37 @@
1
- import { jsx as r, jsxs as b } from "react/jsx-runtime";
2
- import { ResponsiveContainer as E, BarChart as P, CartesianGrid as T, XAxis as D, YAxis as F, Tooltip as M, Bar as O, Cell as R } from "recharts";
3
- import { ChartTooltip as W } from "./chart-tooltip.mjs";
4
- import { chartGridConfig as _, chartAxisConfig as y, getColorForIndex as I } from "./chart-utils.mjs";
5
- import { clsx as X } from "clsx";
6
- import { motion as Y } from "framer-motion";
7
- import { SHAPE_PATHS as v } from "../shape/paths.mjs";
8
- const rr = ({
9
- data: l,
10
- categories: w,
11
- index: k,
12
- variant: d = "primary",
13
- shape: m = "minimal",
14
- colors: A,
15
- height: B = 300,
1
+ import { jsx as t, jsxs as b } from "react/jsx-runtime";
2
+ import { ResponsiveContainer as R, BarChart as z, CartesianGrid as M, XAxis as W, YAxis as O, Tooltip as X, ReferenceLine as U, Bar as V, Cell as Y } from "recharts";
3
+ import { ChartTooltip as Z } from "./chart-tooltip.mjs";
4
+ import { chartGridConfig as q, chartAxisConfig as C, getColorForIndex as J, EASE_EXPRESSIVE_DEFAULT_SPATIAL as Q, EASE_EMPHASIZED as K } from "./chart-utils.mjs";
5
+ import { clsx as tt } from "clsx";
6
+ import { motion as rt } from "framer-motion";
7
+ import { SHAPE_PATHS as E } from "../shape/paths.mjs";
8
+ import { useTheme as et } from "../../context/ThemeProvider.mjs";
9
+ const ft = ({
10
+ data: d,
11
+ categories: A,
12
+ index: S,
13
+ variant: m = "primary",
14
+ shape: h = "minimal",
15
+ colors: w,
16
+ height: k = 300,
16
17
  className: H,
17
- valueFormatter: $ = (t) => `${t}`,
18
- scrollable: h = !1,
19
- minWidth: L = 500,
20
- highlightKey: o,
21
- highlightColor: j = "var(--md-sys-color-tertiary, #4ADE80)",
22
- highlightShape: f = "flower",
23
- highlightIcon: p
18
+ valueFormatter: L = (r) => `${r}`,
19
+ scrollable: f = !1,
20
+ minWidth: N = 500,
21
+ highlightKey: i,
22
+ highlightColor: B = "var(--md-sys-color-tertiary, #4ADE80)",
23
+ highlightShape: u = "flower",
24
+ highlightIcon: p,
25
+ showBaseline: P = !1
24
26
  }) => {
25
- const t = d === "ghost", u = d === "secondary", G = () => m === "sharp" ? [0, 0, 0, 0] : m === "full" ? [999, 999, 999, 999] : [4, 4, 4, 4], N = (n) => {
26
- const { x: e, y: c, width: i, index: a } = n, x = l[a];
27
- if (!(o ? !!x[o] : !1) || t) return null;
28
- const s = Math.min(i * 0.75, 32), S = e + i / 2 - s / 2, C = c + 6, z = f ? v[f] : v.flower;
29
- return /* @__PURE__ */ r(
30
- Y.g,
27
+ const r = m === "ghost", g = m === "secondary", { animationStyle: T } = et(), x = T === "expressive", _ = x ? Q : K, $ = x ? 1e3 : 550, j = () => h === "sharp" ? [0, 0, 0, 0] : h === "full" ? [999, 999, 999, 999] : [4, 4, 4, 4], D = (a) => {
28
+ const { x: o, y: l, width: n, height: s, value: v, index: c } = a, F = d[c];
29
+ if (!(i ? !!F[i] : !1) || r || s === 0) return null;
30
+ const e = Math.min(n * 0.75, 32), G = o + n / 2 - e / 2, y = v < 0 ? l + s - e - 6 : l + 6;
31
+ if (s < e + 12) return null;
32
+ const I = u ? E[u] : E.flower;
33
+ return /* @__PURE__ */ t(
34
+ rt.g,
31
35
  {
32
36
  className: "pointer-events-none",
33
37
  initial: { opacity: 0, scale: 0.3 },
@@ -38,19 +42,19 @@ const rr = ({
38
42
  // Elegant spring-like elastic ease-out
39
43
  },
40
44
  style: {
41
- transformOrigin: `${e + i / 2}px ${C + s / 2}px`
45
+ transformOrigin: `${o + n / 2}px ${y + e / 2}px`
42
46
  },
43
47
  children: /* @__PURE__ */ b(
44
48
  "svg",
45
49
  {
46
- x: S,
47
- y: C,
48
- width: s,
49
- height: s,
50
+ x: G,
51
+ y,
52
+ width: e,
53
+ height: e,
50
54
  viewBox: "0 0 380 380",
51
55
  children: [
52
- /* @__PURE__ */ r("path", { d: z, fill: "rgba(255, 255, 255, 0.6)" }),
53
- p ? /* @__PURE__ */ r("g", { transform: "translate(95, 95) scale(0.5)", children: /* @__PURE__ */ r("foreignObject", { width: "380", height: "380", children: p }) }) : /* @__PURE__ */ r(
56
+ /* @__PURE__ */ t("path", { d: I, fill: "rgba(255, 255, 255, 0.6)" }),
57
+ p ? /* @__PURE__ */ t("g", { transform: "translate(95, 95) scale(0.5)", children: /* @__PURE__ */ t("foreignObject", { width: "380", height: "380", children: p }) }) : /* @__PURE__ */ t(
54
58
  "path",
55
59
  {
56
60
  d: "M130 195L170 235L250 155",
@@ -66,77 +70,86 @@ const rr = ({
66
70
  }
67
71
  )
68
72
  },
69
- `badge-${a}`
73
+ `badge-${c}`
70
74
  );
71
75
  };
72
- return /* @__PURE__ */ r(
76
+ return /* @__PURE__ */ t(
73
77
  "div",
74
78
  {
75
- className: X(
79
+ className: tt(
76
80
  "outline-none [&_.recharts-surface]:outline-none",
77
- h && "overflow-x-auto scrollbar-thin",
81
+ f && "overflow-x-auto scrollbar-thin",
78
82
  H
79
83
  ),
80
- style: { height: B },
81
- children: /* @__PURE__ */ r(
84
+ style: { height: k },
85
+ children: /* @__PURE__ */ t(
82
86
  "div",
83
87
  {
84
88
  style: {
85
- minWidth: h ? L : void 0,
89
+ minWidth: f ? N : void 0,
86
90
  height: "100%"
87
91
  },
88
- children: /* @__PURE__ */ r(E, { width: "100%", height: "100%", children: /* @__PURE__ */ b(
89
- P,
92
+ children: /* @__PURE__ */ t(R, { width: "100%", height: "100%", children: /* @__PURE__ */ b(
93
+ z,
90
94
  {
91
- data: l,
92
- margin: t ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 20, right: 10, bottom: 0, left: 0 },
95
+ data: d,
96
+ margin: r ? { top: 0, right: 0, bottom: 0, left: 0 } : { top: 20, right: 10, bottom: 5, left: 0 },
93
97
  barGap: 2,
94
98
  children: [
95
- !t && /* @__PURE__ */ r(T, { ..._, horizontal: !u }),
96
- !t && /* @__PURE__ */ r(D, { dataKey: k, ...y }),
97
- !t && /* @__PURE__ */ r(
98
- F,
99
+ !r && /* @__PURE__ */ t(M, { ...q, horizontal: !g }),
100
+ !r && /* @__PURE__ */ t(W, { dataKey: S, ...C }),
101
+ !r && /* @__PURE__ */ t(
102
+ O,
99
103
  {
100
- ...y,
101
- tickFormatter: $,
102
- hide: u,
104
+ ...C,
105
+ tickFormatter: L,
106
+ hide: g,
103
107
  width: 45
104
108
  }
105
109
  ),
106
- !t && /* @__PURE__ */ r(
107
- M,
110
+ !r && /* @__PURE__ */ t(
111
+ X,
108
112
  {
109
- content: /* @__PURE__ */ r(W, {}),
113
+ content: /* @__PURE__ */ t(Z, {}),
110
114
  cursor: {
111
115
  fill: "var(--md-sys-color-surface-container-highest)",
112
116
  opacity: 0.25
113
117
  }
114
118
  }
115
119
  ),
116
- w.map((n, e) => {
117
- const c = A?.[e] || I(e);
118
- return /* @__PURE__ */ r(
119
- O,
120
+ P && !r && /* @__PURE__ */ t(
121
+ U,
122
+ {
123
+ y: 0,
124
+ stroke: "var(--md-sys-color-outline-variant)",
125
+ strokeWidth: 1.5,
126
+ className: "opacity-80"
127
+ }
128
+ ),
129
+ A.map((a, o) => {
130
+ const l = w?.[o] || J(o);
131
+ return /* @__PURE__ */ t(
132
+ V,
120
133
  {
121
- dataKey: n,
122
- radius: G(),
123
- animationDuration: 1500,
124
- animationEasing: "ease-out",
125
- maxBarSize: t ? void 0 : 60,
126
- label: o ? N : void 0,
127
- children: l.map((i, a) => {
128
- const g = (o ? !!i[o] : !1) ? j : c;
129
- return /* @__PURE__ */ r(
130
- R,
134
+ dataKey: a,
135
+ radius: j(),
136
+ animationDuration: $,
137
+ animationEasing: _,
138
+ maxBarSize: r ? void 0 : 60,
139
+ label: i ? D : void 0,
140
+ children: d.map((n, s) => {
141
+ const c = (i ? !!n[i] : !1) ? B : l;
142
+ return /* @__PURE__ */ t(
143
+ Y,
131
144
  {
132
- fill: g,
145
+ fill: c,
133
146
  className: "transition-colors duration-300"
134
147
  },
135
- `cell-${a}`
148
+ `cell-${s}`
136
149
  );
137
150
  })
138
151
  },
139
- n
152
+ a
140
153
  );
141
154
  })
142
155
  ]
@@ -148,5 +161,5 @@ const rr = ({
148
161
  );
149
162
  };
150
163
  export {
151
- rr as BarChart
164
+ ft as BarChart
152
165
  };
@@ -16,3 +16,10 @@ export declare const chartAxisConfig: {
16
16
  tickLine: boolean;
17
17
  tickMargin: number;
18
18
  };
19
+ /**
20
+ * Generates a cubic-bezier solver function mapping normalized time progress
21
+ * t [0, 1] to physical visual progress. Highly robust and performs Newton-Raphson approximation.
22
+ */
23
+ export declare function cubicBezier(x1: number, y1: number, x2: number, y2: number): (t: number) => number;
24
+ export declare const EASE_EMPHASIZED: (t: number) => number;
25
+ export declare const EASE_EXPRESSIVE_DEFAULT_SPATIAL: (t: number) => number;
@@ -1,25 +1,42 @@
1
- const r = [
1
+ const i = [
2
2
  "var(--md-sys-color-primary)",
3
3
  "var(--md-sys-color-secondary)",
4
4
  "var(--md-sys-color-tertiary)",
5
5
  "var(--md-sys-color-error)",
6
6
  "var(--md-sys-color-outline)",
7
7
  "var(--md-sys-color-inverse-primary)"
8
- ], s = (o) => r[o % r.length], a = {
8
+ ], v = (o) => i[o % i.length], d = {
9
9
  stroke: "var(--md-sys-color-outline-variant)",
10
10
  strokeDasharray: "4 4",
11
11
  vertical: !1,
12
12
  opacity: 0.4
13
- }, t = {
13
+ }, f = {
14
14
  stroke: "var(--md-sys-color-outline-variant)",
15
15
  tick: { fill: "var(--md-sys-color-on-surface-variant)", fontSize: 12 },
16
16
  axisLine: !1,
17
17
  tickLine: !1,
18
18
  tickMargin: 10
19
19
  };
20
+ function n(o, c, t, l) {
21
+ return (s) => {
22
+ if (s <= 0) return 0;
23
+ if (s >= 1) return 1;
24
+ let r = s;
25
+ for (let a = 0; a < 8; a++) {
26
+ const y = 3 * r * (1 - r) * (1 - r) * o + 3 * r * r * (1 - r) * t + r * r * r, e = 3 * (1 - r) * (1 - r) * o + 6 * r * (1 - r) * (t - o) + 3 * r * r * (1 - t);
27
+ if (Math.abs(e) < 1e-6) break;
28
+ r -= (y - s) / e;
29
+ }
30
+ return 3 * r * (1 - r) * (1 - r) * c + 3 * r * r * (1 - r) * l + r * r * r;
31
+ };
32
+ }
33
+ const u = n(0.2, 0, 0, 1), m = n(0.38, 1.5, 0.22, 1);
20
34
  export {
21
- r as CHART_COLORS,
22
- t as chartAxisConfig,
23
- a as chartGridConfig,
24
- s as getColorForIndex
35
+ i as CHART_COLORS,
36
+ u as EASE_EMPHASIZED,
37
+ m as EASE_EXPRESSIVE_DEFAULT_SPATIAL,
38
+ f as chartAxisConfig,
39
+ d as chartGridConfig,
40
+ n as cubicBezier,
41
+ v as getColorForIndex
25
42
  };
@@ -0,0 +1,25 @@
1
+ export interface HeatmapDataPoint {
2
+ x: string;
3
+ y: string;
4
+ value: number;
5
+ label?: string;
6
+ }
7
+ export interface HeatmapChartProps {
8
+ data: HeatmapDataPoint[];
9
+ /** Explicit sequence of columns along the X-axis */
10
+ xLabels: string[];
11
+ /** Explicit sequence of rows along the Y-axis */
12
+ yLabels: string[];
13
+ /** Theme palette coloring (maps to container colors) */
14
+ variant?: "primary" | "secondary" | "tertiary" | "error";
15
+ /** Cell corner rounding */
16
+ shape?: "full" | "minimal" | "sharp";
17
+ height?: number | string;
18
+ className?: string;
19
+ /** Custom formatter function for values displayed inside tooltips */
20
+ valueFormatter?: (value: number) => string;
21
+ /** Color overrides. If empty, dynamically binds to MD3 color theme variables. */
22
+ colorScale?: string[];
23
+ showLabels?: boolean;
24
+ }
25
+ export declare const HeatmapChart: ({ data, xLabels, yLabels, variant, shape, height, className, valueFormatter, showLabels, }: HeatmapChartProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,13 +6,21 @@ import { PlaylistComponentProps } from './types';
6
6
  */
7
7
  export declare const PlaylistVideo: React.FC<PlaylistComponentProps>;
8
8
  /**
9
- * Invisible Audio Engine.
10
- * Supports standard audio formats (mp3, wav, aac) and synchronizes with timeline.
9
+ * Invisible Programmatic Audio Engine.
10
+ * Handled via a direct in-memory HTMLAudioElement instance.
11
+ * Completely eliminates layout-rendering thread blocks, keeping media pipelines open.
11
12
  */
12
13
  export declare const PlaylistAudio: React.FC<PlaylistComponentProps>;
13
14
  export declare const PlaylistImage: React.FC<PlaylistComponentProps>;
15
+ /**
16
+ * Flexible HTML Element Renderer.
17
+ * Supports rendering custom tags (whitelisted for safety), custom React children,
18
+ * or raw HTML safely integrated with transitions and coordinates.
19
+ */
20
+ export declare const PlaylistHtml: React.FC<PlaylistComponentProps>;
14
21
  export declare const defaultPlaylistRegistry: {
15
22
  Video: React.FC<PlaylistComponentProps>;
16
23
  Audio: React.FC<PlaylistComponentProps>;
17
24
  Image: React.FC<PlaylistComponentProps>;
25
+ Html: React.FC<PlaylistComponentProps>;
18
26
  };