chesai-ui 0.16.2 → 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
@@ -1,6 +1,6 @@
1
1
  import { jsx as I } from "react/jsx-runtime";
2
- import { useMotionValueEvent as q, useTransform as g, cubicBezier as b, motion as G } from "framer-motion";
3
- import H, { useState as K } from "react";
2
+ import { useMotionValueEvent as G, useTransform as g, cubicBezier as b, motion as H } from "framer-motion";
3
+ import K, { useState as Q } from "react";
4
4
  const P = 2e3, o = 200, z = (e) => {
5
5
  const t = [...e];
6
6
  for (let s = 1; s < t.length; s++)
@@ -71,31 +71,40 @@ const P = 2e3, o = 200, z = (e) => {
71
71
  default:
72
72
  return { opacity: 0 };
73
73
  }
74
- }, f = (e) => e, Q = b(0.05, 0.7, 0.1, 1), W = b(0.3, 0, 0.8, 0.15), Z = b(0, 0, 0.2, 1), V = b(0.4, 0, 1, 1), v = [
75
- f,
76
- Q,
74
+ }, f = (e) => e, W = b(0.05, 0.7, 0.1, 1), Z = b(0.3, 0, 0.8, 0.15), V = b(0, 0, 0.2, 1), v = b(0.4, 0, 1, 1), tt = [
77
75
  f,
78
76
  W,
79
- f
80
- ], tt = [
81
77
  f,
82
78
  Z,
79
+ f
80
+ ], et = [
83
81
  f,
84
82
  V,
83
+ f,
84
+ v,
85
85
  f
86
- ], et = H.memo(
87
- ({ item: e, playhead: t, components: s, isTimelinePlaying: n }) => {
86
+ ], ot = K.memo(
87
+ ({
88
+ item: e,
89
+ playhead: t,
90
+ components: s,
91
+ isTimelinePlaying: n,
92
+ isSeeking: $
93
+ }) => {
88
94
  const w = s[e.type];
89
95
  if (!w)
90
96
  return console.warn(
91
97
  `[PlaylistPlayer] Element type "${e.type}" is not registered.`
92
98
  ), null;
93
- const { startTime: u, duration: $, layout: i, transitions: r } = e, m = u + $, [x, A] = K(!1);
94
- q(t, "change", (c) => {
95
- const a = c >= u && c < m;
96
- a !== x && A(a);
99
+ const { startTime: r, duration: k, layout: c, transitions: a } = e, l = r + k, [x, A] = Q(() => {
100
+ const i = t.get();
101
+ return i >= r && i < l;
97
102
  });
98
- const O = u, N = u + (r?.in?.duration || 0), R = m - (r?.out?.duration || 0), T = m, E = z([
103
+ G(t, "change", (i) => {
104
+ const u = i >= r && i < l;
105
+ u !== x && A(u);
106
+ });
107
+ const O = r, N = r + (a?.in?.duration || 0), R = l - (a?.out?.duration || 0), T = l, S = z([
99
108
  O - 1,
100
109
  O,
101
110
  N,
@@ -105,24 +114,24 @@ const P = 2e3, o = 200, z = (e) => {
105
114
  ]), X = g(
106
115
  t,
107
116
  z([
108
- u - P - 1,
109
- u - P,
110
- m,
111
- m + 1
117
+ r - P - 1,
118
+ r - P,
119
+ l,
120
+ l + 1
112
121
  ]),
113
122
  ["none", "block", "block", "none"]
114
- ), d = i.opacity ?? 1, l = F(
115
- r?.in?.type || "none",
123
+ ), d = c.opacity ?? 1, y = F(
124
+ a?.in?.type || "none",
116
125
  "in",
117
126
  d
118
- ), y = F(
119
- r?.out?.type || "none",
127
+ ), p = F(
128
+ a?.out?.type || "none",
120
129
  "out",
121
130
  d
122
- ), p = (c, a, S) => g(t, E, [c, c, S, S, a, a], {
131
+ ), m = (i, u, E) => g(t, S, [i, i, E, E, u, u], {
123
132
  clamp: !0,
124
- ease: v
125
- }), Y = r?.in && r.in.type !== "none", M = r?.out && r.out.type !== "none", _ = g(t, E, [
133
+ ease: tt
134
+ }), Y = a?.in && a.in.type !== "none", M = a?.out && a.out.type !== "none", _ = g(t, S, [
126
135
  0,
127
136
  Y ? 0 : d,
128
137
  d,
@@ -131,61 +140,63 @@ const P = 2e3, o = 200, z = (e) => {
131
140
  0
132
141
  ], {
133
142
  clamp: !0,
134
- ease: tt
135
- }), k = p(l.x ?? 0, y.x ?? 0, 0), J = p(l.y ?? 0, y.y ?? 0, 0), L = p(l.scale ?? 1, y.scale ?? 1, 1), j = p(
136
- l.rotate ?? 0,
143
+ ease: et
144
+ }), J = m(y.x ?? 0, p.x ?? 0, 0), L = m(y.y ?? 0, p.y ?? 0, 0), j = m(y.scale ?? 1, p.scale ?? 1, 1), B = m(
137
145
  y.rotate ?? 0,
146
+ p.rotate ?? 0,
138
147
  0
139
- ), B = p(
140
- l.rotateX ?? 0,
148
+ ), C = m(
141
149
  y.rotateX ?? 0,
150
+ p.rotateX ?? 0,
142
151
  0
143
- ), C = p(
144
- l.rotateY ?? 0,
152
+ ), D = m(
145
153
  y.rotateY ?? 0,
154
+ p.rotateY ?? 0,
146
155
  0
147
- ), D = p(l.blur ?? 0, y.blur ?? 0, 0), U = g(D, (c) => {
148
- const a = i.style?.filter || "";
149
- return c > 0 ? `${a} blur(${c}px)`.trim() : a || "none";
156
+ ), U = m(y.blur ?? 0, p.blur ?? 0, 0), q = g(U, (i) => {
157
+ const u = c.style?.filter || "";
158
+ return i > 0 ? `${u} blur(${i}px)`.trim() : u || "none";
150
159
  });
151
160
  return /* @__PURE__ */ I(
152
- G.div,
161
+ H.div,
153
162
  {
154
163
  className: "absolute origin-center will-change-[transform,opacity,filter]",
155
164
  style: {
156
165
  display: X,
157
166
  opacity: _,
158
- x: k,
159
- y: J,
160
- scale: L,
161
- rotate: j,
162
- rotateX: B,
163
- rotateY: C,
164
- filter: U,
165
- left: h(i.x),
166
- top: h(i.y),
167
- width: h(i.width),
168
- height: h(i.height),
169
- zIndex: i.zIndex || 1,
170
- ...i.style
167
+ x: J,
168
+ y: L,
169
+ scale: j,
170
+ rotate: B,
171
+ rotateX: C,
172
+ rotateY: D,
173
+ filter: q,
174
+ left: h(c.x),
175
+ top: h(c.y),
176
+ width: h(c.width),
177
+ height: h(c.height),
178
+ zIndex: c.zIndex || 1,
179
+ ...c.style
171
180
  },
172
181
  children: /* @__PURE__ */ I(
173
182
  w,
174
183
  {
184
+ id: e.id,
175
185
  data: e.props,
176
186
  playhead: t,
177
187
  isActive: x,
178
- startTime: u,
179
- endTime: m,
180
- isTimelinePlaying: n
188
+ startTime: r,
189
+ endTime: l,
190
+ isTimelinePlaying: n,
191
+ isSeeking: $
181
192
  }
182
193
  )
183
194
  }
184
195
  );
185
196
  },
186
- (e, t) => e.isTimelinePlaying === t.isTimelinePlaying && e.item.id === t.item.id && e.item.startTime === t.item.startTime && e.item.duration === t.item.duration && e.item.layout.x === t.item.layout.x && e.item.layout.y === t.item.layout.y && e.item.layout.width === t.item.layout.width && e.item.layout.height === t.item.layout.height && JSON.stringify(e.item.layout.style) === JSON.stringify(t.item.layout.style)
197
+ (e, t) => e.isTimelinePlaying === t.isTimelinePlaying && e.isSeeking === t.isSeeking && e.item.id === t.item.id && e.item.startTime === t.item.startTime && e.item.duration === t.item.duration && e.item.layout.x === t.item.layout.x && e.item.layout.y === t.item.layout.y && e.item.layout.width === t.item.layout.width && e.item.layout.height === t.item.layout.height && JSON.stringify(e.item.layout.style) === JSON.stringify(t.item.layout.style)
187
198
  );
188
- et.displayName = "ItemRenderer";
199
+ ot.displayName = "ItemRenderer";
189
200
  export {
190
- et as ItemRenderer
201
+ ot as ItemRenderer
191
202
  };
@@ -1,9 +1,11 @@
1
1
  import { default as React } from 'react';
2
2
  import { PlaylistSchema, PlaylistComponentRegistry } from './types';
3
3
  export interface PlaylistPlayerProps {
4
- schema: PlaylistSchema;
4
+ schema?: PlaylistSchema;
5
+ schemas?: PlaylistSchema | PlaylistSchema[];
5
6
  components?: PlaylistComponentRegistry;
6
7
  playing?: boolean;
8
+ showControls?: boolean;
7
9
  className?: string;
8
10
  onLoop?: () => void;
9
11
  outerBackgroundColor?: string;