@dust-tt/sparkle 0.5.2 → 0.5.3

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.
@@ -41,12 +41,12 @@ declare const animation: {
41
41
  to: number[];
42
42
  ti: number[];
43
43
  } | {
44
+ i?: undefined;
45
+ o?: undefined;
44
46
  to?: undefined;
45
47
  ti?: undefined;
46
48
  t: number;
47
49
  s: number[];
48
- i?: undefined;
49
- o?: undefined;
50
50
  })[];
51
51
  ix: number;
52
52
  l: number;
@@ -68,6 +68,19 @@ declare const animation: {
68
68
  shapes: {
69
69
  ty: string;
70
70
  it: ({
71
+ o?: undefined;
72
+ c?: undefined;
73
+ bm?: undefined;
74
+ p?: undefined;
75
+ a?: undefined;
76
+ s?: undefined;
77
+ sk?: undefined;
78
+ sa?: undefined;
79
+ r?: undefined;
80
+ w?: undefined;
81
+ lc?: undefined;
82
+ lj?: undefined;
83
+ ml?: undefined;
71
84
  ind: number;
72
85
  ty: string;
73
86
  ix: number;
@@ -90,6 +103,8 @@ declare const animation: {
90
103
  c: boolean;
91
104
  }[];
92
105
  } | {
106
+ i?: undefined;
107
+ o?: undefined;
93
108
  t: number;
94
109
  s: {
95
110
  i: number[][];
@@ -97,28 +112,22 @@ declare const animation: {
97
112
  v: number[][];
98
113
  c: boolean;
99
114
  }[];
100
- i?: undefined;
101
- o?: undefined;
102
115
  })[];
103
116
  ix: number;
104
117
  };
105
118
  nm: string;
106
119
  mn: string;
107
120
  hd: boolean;
108
- o?: undefined;
109
- c?: undefined;
110
- w?: undefined;
111
- lc?: undefined;
112
- lj?: undefined;
113
- ml?: undefined;
114
- bm?: undefined;
121
+ } | {
115
122
  p?: undefined;
116
123
  a?: undefined;
117
124
  s?: undefined;
118
- r?: undefined;
119
125
  sk?: undefined;
120
126
  sa?: undefined;
121
- } | {
127
+ ix?: undefined;
128
+ r?: undefined;
129
+ ind?: undefined;
130
+ ks?: undefined;
122
131
  ty: string;
123
132
  c: {
124
133
  a: number;
@@ -142,16 +151,19 @@ declare const animation: {
142
151
  nm: string;
143
152
  mn: string;
144
153
  hd: boolean;
145
- ind?: undefined;
146
- ix?: undefined;
147
- ks?: undefined;
154
+ } | {
148
155
  p?: undefined;
149
156
  a?: undefined;
150
157
  s?: undefined;
151
- r?: undefined;
152
158
  sk?: undefined;
153
159
  sa?: undefined;
154
- } | {
160
+ ix?: undefined;
161
+ ind?: undefined;
162
+ ks?: undefined;
163
+ w?: undefined;
164
+ lc?: undefined;
165
+ lj?: undefined;
166
+ ml?: undefined;
155
167
  ty: string;
156
168
  c: {
157
169
  a: number;
@@ -172,10 +184,10 @@ declare const animation: {
172
184
  t: number;
173
185
  s: number[];
174
186
  } | {
175
- t: number;
176
- s: number[];
177
187
  i?: undefined;
178
188
  o?: undefined;
189
+ t: number;
190
+ s: number[];
179
191
  })[];
180
192
  ix: number;
181
193
  };
@@ -184,19 +196,18 @@ declare const animation: {
184
196
  nm: string;
185
197
  mn: string;
186
198
  hd: boolean;
187
- ind?: undefined;
199
+ } | {
200
+ c?: undefined;
201
+ bm?: undefined;
202
+ mn?: undefined;
203
+ hd?: undefined;
188
204
  ix?: undefined;
205
+ ind?: undefined;
189
206
  ks?: undefined;
190
207
  w?: undefined;
191
208
  lc?: undefined;
192
209
  lj?: undefined;
193
210
  ml?: undefined;
194
- p?: undefined;
195
- a?: undefined;
196
- s?: undefined;
197
- sk?: undefined;
198
- sa?: undefined;
199
- } | {
200
211
  ty: string;
201
212
  p: {
202
213
  a: number;
@@ -234,17 +245,6 @@ declare const animation: {
234
245
  ix: number;
235
246
  };
236
247
  nm: string;
237
- ind?: undefined;
238
- ix?: undefined;
239
- ks?: undefined;
240
- c?: undefined;
241
- w?: undefined;
242
- lc?: undefined;
243
- lj?: undefined;
244
- ml?: undefined;
245
- bm?: undefined;
246
- mn?: undefined;
247
- hd?: undefined;
248
248
  })[];
249
249
  nm: string;
250
250
  np: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dust-tt/sparkle",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "scripts": {
5
5
  "build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
6
6
  "tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
@@ -16,6 +16,24 @@
16
16
  "main": "dist/cjs/index.js",
17
17
  "types": "dist/esm/index.d.ts",
18
18
  "module": "dist/esm/index.js",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/esm/index.d.ts",
22
+ "import": "./dist/esm/index.js",
23
+ "require": "./dist/cjs/index.js",
24
+ "default": "./dist/esm/index.js"
25
+ },
26
+ "./dist/esm/*": {
27
+ "types": "./dist/esm/*.d.ts",
28
+ "import": "./dist/esm/*.js",
29
+ "default": "./dist/esm/*.js"
30
+ },
31
+ "./dist/cjs/*": {
32
+ "types": "./dist/esm/*.d.ts",
33
+ "require": "./dist/cjs/*.js"
34
+ },
35
+ "./dist/sparkle.css": "./dist/sparkle.css"
36
+ },
19
37
  "files": [
20
38
  "dist/",
21
39
  "src/"
@@ -1,4 +1,3 @@
1
- import mermaid from "mermaid";
2
1
  import React, { useContext, useEffect, useRef, useState } from "react";
3
2
  import {
4
3
  amber,
@@ -176,7 +175,13 @@ const MermaidGraph: React.FC<{ chart: string }> = ({ chart }) => {
176
175
  const graphRef = useRef<HTMLDivElement | null>(null);
177
176
 
178
177
  useEffect(() => {
179
- if (graphRef.current) {
178
+ const renderMermaid = async () => {
179
+ if (!graphRef.current) {
180
+ return;
181
+ }
182
+
183
+ const mermaid = (await import("mermaid")).default;
184
+
180
185
  mermaid.initialize({
181
186
  startOnLoad: false,
182
187
  theme: "base",
@@ -278,8 +283,10 @@ const MermaidGraph: React.FC<{ chart: string }> = ({ chart }) => {
278
283
  });
279
284
 
280
285
  graphRef.current.textContent = chart;
281
- void mermaid.run(undefined);
282
- }
286
+ await mermaid.run(undefined);
287
+ };
288
+
289
+ void renderMermaid();
283
290
  }, [chart]);
284
291
 
285
292
  return (
@@ -352,6 +359,7 @@ export function CodeBlockWithExtendedSupport({
352
359
  if (language === "mermaid") {
353
360
  const checkValidMermaid = async () => {
354
361
  try {
362
+ const mermaid = (await import("mermaid")).default;
355
363
  await mermaid.parse(validChildrenContent);
356
364
  setIsValidMermaid(true);
357
365
  setShowMermaid(true);