@flesler/cursor-canvas-web 1.2.1 → 1.4.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/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +619 -598
- package/dist/{host-tokens-Dh2BFFjv.js → host-tokens-Bt6GPXN1.js} +134 -120
- package/dist/host-tokens-Lz69pkRj.cjs +1 -0
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.js +1 -1
- package/package.json +5 -2
- package/src/superset/chart-extra.d.ts +7 -1
- package/dist/host-tokens-Cjzmp0z_.cjs +0 -1
|
@@ -50,28 +50,27 @@ const s = {
|
|
|
50
50
|
diffRemovedLine: "#CF2D5614",
|
|
51
51
|
diffStripAdded: "#1F8A65CC",
|
|
52
52
|
diffStripRemoved: "#CF2D56CC"
|
|
53
|
-
},
|
|
53
|
+
}, v = {
|
|
54
54
|
accent: "#1084FE",
|
|
55
55
|
buttonBackground: "#1084FE",
|
|
56
56
|
buttonForeground: "#070707",
|
|
57
57
|
buttonHoverBackground: "#459FFE",
|
|
58
58
|
link: "#80BEFE",
|
|
59
59
|
strokeFocused: "#1084FE"
|
|
60
|
-
},
|
|
60
|
+
}, S = {
|
|
61
61
|
accent: "#0C64C1",
|
|
62
62
|
buttonBackground: "#0C64C1",
|
|
63
63
|
buttonForeground: "#FAFAFA",
|
|
64
64
|
buttonHoverBackground: "#1084FE",
|
|
65
65
|
link: "#0C64C1",
|
|
66
66
|
strokeFocused: "#0C64C1"
|
|
67
|
-
},
|
|
67
|
+
}, y = {
|
|
68
68
|
...s,
|
|
69
|
-
...
|
|
70
|
-
},
|
|
69
|
+
...v
|
|
70
|
+
}, m = {
|
|
71
71
|
...l,
|
|
72
|
-
...
|
|
72
|
+
...S
|
|
73
73
|
}, E = {
|
|
74
|
-
gray: "#8888A8E0",
|
|
75
74
|
purple: "#7B64B8F0",
|
|
76
75
|
green: "#1F8A65E8",
|
|
77
76
|
yellow: "#E8C030E0",
|
|
@@ -80,18 +79,11 @@ const s = {
|
|
|
80
79
|
blue: "#2E79B5E0",
|
|
81
80
|
orange: "#F0A040E0",
|
|
82
81
|
red: "#C04848E0"
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
purple: "#7B64B8F0",
|
|
86
|
-
green: "#1F8A65E8",
|
|
87
|
-
yellow: "#E8C030E0",
|
|
88
|
-
cyan: "#2A9A8AE0",
|
|
89
|
-
pink: "#C85898E0",
|
|
90
|
-
blue: "#2E79B5E0",
|
|
82
|
+
}, p = {
|
|
83
|
+
...E,
|
|
91
84
|
orange: "#F0A088E0",
|
|
92
85
|
red: "#CF2D56E0"
|
|
93
|
-
},
|
|
94
|
-
gray: "#777777E0",
|
|
86
|
+
}, f = {
|
|
95
87
|
purple: "#9159FEF0",
|
|
96
88
|
green: "#00C972E8",
|
|
97
89
|
yellow: "#FF9800E0",
|
|
@@ -100,9 +92,29 @@ const s = {
|
|
|
100
92
|
blue: "#1084FEE0",
|
|
101
93
|
orange: "#FF6700E0",
|
|
102
94
|
red: "#FF263CE0"
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
};
|
|
96
|
+
function g(e, r) {
|
|
97
|
+
return {
|
|
98
|
+
gray: r.foregroundTertiary,
|
|
99
|
+
...e
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const C = g(
|
|
103
|
+
E,
|
|
104
|
+
s
|
|
105
|
+
), P = g(
|
|
106
|
+
p,
|
|
107
|
+
l
|
|
108
|
+
);
|
|
109
|
+
g(
|
|
110
|
+
f,
|
|
111
|
+
y
|
|
112
|
+
);
|
|
113
|
+
g(
|
|
114
|
+
f,
|
|
115
|
+
m
|
|
116
|
+
);
|
|
117
|
+
const U = C, j = [
|
|
106
118
|
"blue",
|
|
107
119
|
"purple",
|
|
108
120
|
"green",
|
|
@@ -154,7 +166,7 @@ const s = {
|
|
|
154
166
|
vibrantTeal: "#00BCA6E0",
|
|
155
167
|
muted: "#777777E0",
|
|
156
168
|
neutralLine: "#777777D0"
|
|
157
|
-
},
|
|
169
|
+
}, T = [
|
|
158
170
|
i.green,
|
|
159
171
|
i.lightBlue,
|
|
160
172
|
i.indigo,
|
|
@@ -167,7 +179,7 @@ const s = {
|
|
|
167
179
|
i.mintGreen,
|
|
168
180
|
i.muted,
|
|
169
181
|
i.vibrantTeal
|
|
170
|
-
],
|
|
182
|
+
], x = [
|
|
171
183
|
a.green,
|
|
172
184
|
a.lightBlue,
|
|
173
185
|
a.indigo,
|
|
@@ -180,14 +192,14 @@ const s = {
|
|
|
180
192
|
a.mintGreen,
|
|
181
193
|
a.muted,
|
|
182
194
|
a.vibrantTeal
|
|
183
|
-
],
|
|
195
|
+
], B = {
|
|
184
196
|
fontFamily: "inherit",
|
|
185
197
|
h1: { fontSize: "24px", lineHeight: "30px", fontWeight: 590 },
|
|
186
198
|
h2: { fontSize: "18px", lineHeight: "24px", fontWeight: 590 },
|
|
187
199
|
h3: { fontSize: "16px", lineHeight: "22px", fontWeight: 590 },
|
|
188
200
|
body: { fontSize: "14px", lineHeight: "20px", fontWeight: 400 },
|
|
189
201
|
small: { fontSize: "12px", lineHeight: "16px", fontWeight: 400 }
|
|
190
|
-
},
|
|
202
|
+
}, D = 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif', L = {
|
|
191
203
|
"0.5": 2,
|
|
192
204
|
1: 4,
|
|
193
205
|
"1.5": 6,
|
|
@@ -203,7 +215,7 @@ const s = {
|
|
|
203
215
|
8: 32,
|
|
204
216
|
9: 36,
|
|
205
217
|
10: 40
|
|
206
|
-
},
|
|
218
|
+
}, b = {
|
|
207
219
|
none: 0,
|
|
208
220
|
xs: 2,
|
|
209
221
|
sm: 4,
|
|
@@ -211,16 +223,16 @@ const s = {
|
|
|
211
223
|
lg: 8,
|
|
212
224
|
xl: 12,
|
|
213
225
|
full: 9999
|
|
214
|
-
},
|
|
215
|
-
...
|
|
226
|
+
}, H = {
|
|
227
|
+
...b,
|
|
216
228
|
md: 8,
|
|
217
229
|
lg: 10,
|
|
218
230
|
xl: 14
|
|
219
|
-
},
|
|
220
|
-
...
|
|
221
|
-
fontFamily:
|
|
231
|
+
}, G = {
|
|
232
|
+
...B,
|
|
233
|
+
fontFamily: D
|
|
222
234
|
};
|
|
223
|
-
function
|
|
235
|
+
function h(e, r) {
|
|
224
236
|
return {
|
|
225
237
|
bg: {
|
|
226
238
|
editor: e.editor,
|
|
@@ -258,155 +270,157 @@ function F(e, n) {
|
|
|
258
270
|
stripAdded: e.diffStripAdded,
|
|
259
271
|
stripRemoved: e.diffStripRemoved
|
|
260
272
|
},
|
|
261
|
-
category:
|
|
273
|
+
category: r
|
|
262
274
|
};
|
|
263
275
|
}
|
|
264
|
-
const
|
|
276
|
+
const J = h(
|
|
265
277
|
s,
|
|
266
|
-
|
|
267
|
-
),
|
|
278
|
+
C
|
|
279
|
+
), V = h(
|
|
268
280
|
l,
|
|
269
|
-
|
|
281
|
+
P
|
|
270
282
|
);
|
|
271
|
-
function
|
|
272
|
-
const
|
|
283
|
+
function F(e) {
|
|
284
|
+
const r = e.trim(), o = /^#([0-9a-f]{3,8})$/i.exec(r);
|
|
273
285
|
if (!o)
|
|
274
286
|
return;
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
const t = (
|
|
278
|
-
return { r:
|
|
287
|
+
const n = o[1];
|
|
288
|
+
if (n.length === 3 || n.length === 4) {
|
|
289
|
+
const t = (k) => k + k, d = parseInt(t(n[0]), 16), c = parseInt(t(n[1]), 16), u = parseInt(t(n[2]), 16);
|
|
290
|
+
return { r: d, g: c, b: u };
|
|
279
291
|
}
|
|
280
|
-
if (
|
|
281
|
-
const t = parseInt(
|
|
282
|
-
return { r: t, g:
|
|
292
|
+
if (n.length === 6 || n.length === 8) {
|
|
293
|
+
const t = parseInt(n.slice(0, 2), 16), d = parseInt(n.slice(2, 4), 16), c = parseInt(n.slice(4, 6), 16);
|
|
294
|
+
return { r: t, g: d, b: c };
|
|
283
295
|
}
|
|
284
296
|
}
|
|
285
|
-
function
|
|
286
|
-
const
|
|
287
|
-
const
|
|
288
|
-
return
|
|
297
|
+
function I(e) {
|
|
298
|
+
const r = (o) => {
|
|
299
|
+
const n = o / 255;
|
|
300
|
+
return n <= 0.03928 ? n / 12.92 : ((n + 0.055) / 1.055) ** 2.4;
|
|
289
301
|
};
|
|
290
|
-
return 0.2126 *
|
|
302
|
+
return 0.2126 * r(e.r) + 0.7152 * r(e.g) + 0.0722 * r(e.b);
|
|
291
303
|
}
|
|
292
|
-
function
|
|
293
|
-
const
|
|
304
|
+
function R(e, r, o) {
|
|
305
|
+
const n = Math.min(1, Math.max(0, o));
|
|
294
306
|
return {
|
|
295
|
-
r: Math.round(e.r * (1 -
|
|
296
|
-
g: Math.round(e.g * (1 -
|
|
297
|
-
b: Math.round(e.b * (1 -
|
|
307
|
+
r: Math.round(e.r * (1 - n) + r.r * n),
|
|
308
|
+
g: Math.round(e.g * (1 - n) + r.g * n),
|
|
309
|
+
b: Math.round(e.b * (1 - n) + r.b * n)
|
|
298
310
|
};
|
|
299
311
|
}
|
|
300
|
-
function
|
|
301
|
-
const
|
|
302
|
-
return `#${
|
|
312
|
+
function M(e) {
|
|
313
|
+
const r = (o) => o.toString(16).padStart(2, "0");
|
|
314
|
+
return `#${r(e.r)}${r(e.g)}${r(e.b)}`;
|
|
303
315
|
}
|
|
304
|
-
function
|
|
316
|
+
function A(e) {
|
|
305
317
|
return e === "grok" ? "grok" : "cursor";
|
|
306
318
|
}
|
|
307
|
-
function
|
|
319
|
+
function O(e, r) {
|
|
308
320
|
let o = e;
|
|
309
|
-
if (typeof
|
|
310
|
-
const
|
|
321
|
+
if (typeof r.editorBackground == "string" && F(r.editorBackground)) {
|
|
322
|
+
const n = r.editorBackground;
|
|
311
323
|
o = {
|
|
312
324
|
...o,
|
|
313
|
-
editor:
|
|
314
|
-
chrome:
|
|
315
|
-
sidebar:
|
|
316
|
-
elevated:
|
|
325
|
+
editor: n,
|
|
326
|
+
chrome: n,
|
|
327
|
+
sidebar: n,
|
|
328
|
+
elevated: n
|
|
317
329
|
};
|
|
318
330
|
}
|
|
319
|
-
if (typeof
|
|
320
|
-
const
|
|
331
|
+
if (typeof r.editorForeground == "string" && F(r.editorForeground)) {
|
|
332
|
+
const n = r.editorForeground;
|
|
321
333
|
o = {
|
|
322
334
|
...o,
|
|
323
|
-
foreground:
|
|
324
|
-
foregroundSecondary:
|
|
325
|
-
foregroundTertiary:
|
|
326
|
-
foregroundQuaternary:
|
|
335
|
+
foreground: n,
|
|
336
|
+
foregroundSecondary: n,
|
|
337
|
+
foregroundTertiary: n,
|
|
338
|
+
foregroundQuaternary: n
|
|
327
339
|
};
|
|
328
340
|
}
|
|
329
341
|
return o;
|
|
330
342
|
}
|
|
331
|
-
function
|
|
332
|
-
const o =
|
|
343
|
+
function q(e, r) {
|
|
344
|
+
const o = F(r);
|
|
333
345
|
if (!o)
|
|
334
346
|
return e;
|
|
335
|
-
const
|
|
347
|
+
const n = R(o, { r: 255, g: 255, b: 255 }, 0.12), t = I(o) > 0.45 ? "#141414" : "#FAFAFA";
|
|
336
348
|
return {
|
|
337
349
|
...e,
|
|
338
|
-
accent:
|
|
339
|
-
buttonBackground:
|
|
340
|
-
buttonHoverBackground:
|
|
341
|
-
link:
|
|
342
|
-
strokeFocused:
|
|
350
|
+
accent: r,
|
|
351
|
+
buttonBackground: r,
|
|
352
|
+
buttonHoverBackground: M(n),
|
|
353
|
+
link: r,
|
|
354
|
+
strokeFocused: r,
|
|
343
355
|
buttonForeground: t
|
|
344
356
|
};
|
|
345
357
|
}
|
|
346
|
-
const
|
|
347
|
-
function
|
|
348
|
-
return
|
|
358
|
+
const Q = /* @__PURE__ */ new Set(["light", "hc-light"]);
|
|
359
|
+
function W(e) {
|
|
360
|
+
return Q.has(e);
|
|
349
361
|
}
|
|
350
|
-
function
|
|
351
|
-
const o =
|
|
352
|
-
let t
|
|
353
|
-
|
|
362
|
+
function z(e, r) {
|
|
363
|
+
const o = A(r == null ? void 0 : r.brand), n = W(e);
|
|
364
|
+
let t;
|
|
365
|
+
o === "grok" ? t = n ? m : y : t = n ? l : s, t = O(t, r ?? {}), o !== "grok" && typeof (r == null ? void 0 : r.primary) == "string" && (t = q(t, r.primary));
|
|
366
|
+
const c = g(o === "grok" ? f : n ? p : E, t);
|
|
367
|
+
return { tokens: h(t, c), palette: t, brand: o };
|
|
354
368
|
}
|
|
355
|
-
function
|
|
369
|
+
function Y(e) {
|
|
356
370
|
return e === "grok" ? {
|
|
357
371
|
palette: a,
|
|
358
|
-
sequence:
|
|
359
|
-
} : { palette: i, sequence:
|
|
372
|
+
sequence: x
|
|
373
|
+
} : { palette: i, sequence: T };
|
|
360
374
|
}
|
|
361
|
-
function
|
|
362
|
-
return e === "grok" ?
|
|
375
|
+
function $(e) {
|
|
376
|
+
return e === "grok" ? H : b;
|
|
363
377
|
}
|
|
364
|
-
function
|
|
365
|
-
return e === "grok" ?
|
|
378
|
+
function _(e) {
|
|
379
|
+
return e === "grok" ? G : B;
|
|
366
380
|
}
|
|
367
|
-
function
|
|
368
|
-
var
|
|
381
|
+
function K() {
|
|
382
|
+
var r;
|
|
369
383
|
if (typeof window > "u")
|
|
370
384
|
return;
|
|
371
385
|
const e = window.__cursorCanvas;
|
|
372
|
-
return (
|
|
386
|
+
return (r = e == null ? void 0 : e.state) == null ? void 0 : r.theme;
|
|
373
387
|
}
|
|
374
|
-
function
|
|
388
|
+
function N(e, r) {
|
|
375
389
|
let o = typeof (e == null ? void 0 : e.kind) == "string" && e.kind.length > 0 ? e.kind : void 0;
|
|
376
|
-
o || (
|
|
377
|
-
const
|
|
378
|
-
brand:
|
|
390
|
+
o || (r ? o = r : typeof window < "u" && window.matchMedia ? o = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : o = "dark");
|
|
391
|
+
const n = {
|
|
392
|
+
brand: A(e == null ? void 0 : e.brand),
|
|
379
393
|
primary: typeof (e == null ? void 0 : e.primary) == "string" ? e.primary : void 0,
|
|
380
394
|
editorBackground: typeof (e == null ? void 0 : e.editorBackground) == "string" ? e.editorBackground : void 0,
|
|
381
395
|
editorForeground: typeof (e == null ? void 0 : e.editorForeground) == "string" ? e.editorForeground : void 0
|
|
382
|
-
}, { tokens: t, palette:
|
|
396
|
+
}, { tokens: t, palette: d, brand: c } = z(o, n), u = Y(c);
|
|
383
397
|
return {
|
|
384
398
|
...t,
|
|
385
399
|
kind: o,
|
|
386
|
-
brand:
|
|
400
|
+
brand: c,
|
|
387
401
|
tokens: t,
|
|
388
|
-
palette:
|
|
402
|
+
palette: d,
|
|
389
403
|
category: t.category,
|
|
390
|
-
radius:
|
|
391
|
-
typography:
|
|
392
|
-
chart:
|
|
393
|
-
spacing:
|
|
404
|
+
radius: $(c),
|
|
405
|
+
typography: _(c),
|
|
406
|
+
chart: u,
|
|
407
|
+
spacing: L
|
|
394
408
|
};
|
|
395
409
|
}
|
|
396
|
-
function
|
|
397
|
-
const
|
|
398
|
-
return
|
|
410
|
+
function X(e) {
|
|
411
|
+
const r = K();
|
|
412
|
+
return N(r, e);
|
|
399
413
|
}
|
|
400
414
|
export {
|
|
401
|
-
|
|
402
|
-
b,
|
|
415
|
+
y as a,
|
|
416
|
+
m as b,
|
|
403
417
|
s as c,
|
|
404
418
|
l as d,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
419
|
+
J as e,
|
|
420
|
+
V as f,
|
|
421
|
+
C as g,
|
|
422
|
+
P as h,
|
|
423
|
+
U as i,
|
|
424
|
+
X as r,
|
|
425
|
+
j as u
|
|
412
426
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const g={foreground:"#E4E4E4EB",foregroundSecondary:"#E4E4E48D",foregroundTertiary:"#E4E4E45E",foregroundQuaternary:"#E4E4E442",editor:"#181818",chrome:"#141414",sidebar:"#141414",elevated:"#181818",fillPrimary:"#E4E4E430",fillSecondary:"#E4E4E41E",fillTertiary:"#E4E4E411",fillQuaternary:"#E4E4E40A",strokePrimary:"#E4E4E433",strokeSecondary:"#E4E4E41F",strokeTertiary:"#E4E4E414",strokeFocused:"#599CE7",accent:"#599CE7",buttonBackground:"#599CE7",buttonForeground:"#191c22",buttonHoverBackground:"#6AABE9",link:"#87c3ff",diffInsertedLine:"#3FA26633",diffRemovedLine:"#B8004933",diffStripAdded:"#3FA2668F",diffStripRemoved:"#FC6B838F"},u={foreground:"#141414F0",foregroundSecondary:"#141414BD",foregroundTertiary:"#1414148A",foregroundQuaternary:"#1414145C",editor:"#FCFCFC",chrome:"#F8F8F8",sidebar:"#F3F3F3",elevated:"#FCFCFC",fillPrimary:"#14141433",fillSecondary:"#14141424",fillTertiary:"#14141414",fillQuaternary:"#1414140F",strokePrimary:"#14141433",strokeSecondary:"#1414141F",strokeTertiary:"#14141414",strokeFocused:"#3685BF",accent:"#3685BF",buttonBackground:"#3685BF",buttonForeground:"#FCFCFC",buttonHoverBackground:"#2E76AB",link:"#3685BF",diffInsertedLine:"#1F8A651F",diffRemovedLine:"#CF2D5614",diffStripAdded:"#1F8A65CC",diffStripRemoved:"#CF2D56CC"},P={accent:"#1084FE",buttonBackground:"#1084FE",buttonForeground:"#070707",buttonHoverBackground:"#459FFE",link:"#80BEFE",strokeFocused:"#1084FE"},S={accent:"#0C64C1",buttonBackground:"#0C64C1",buttonForeground:"#FAFAFA",buttonHoverBackground:"#1084FE",link:"#0C64C1",strokeFocused:"#0C64C1"},E={...g,...P},f={...u,...S},h={purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A040E0",red:"#C04848E0"},p={...h,orange:"#F0A088E0",red:"#CF2D56E0"},k={purple:"#9159FEF0",green:"#00C972E8",yellow:"#FF9800E0",cyan:"#00BCA6E0",pink:"#FF309BE0",blue:"#1084FEE0",orange:"#FF6700E0",red:"#FF263CE0"};function s(e,r){return{gray:r.foregroundTertiary,...e}}const y=s(h,g),B=s(p,u);s(k,E);s(k,f);const T=y,L=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],i={green:"#1F8A65E8",darkGreen:"#0D855AE0",lightGreen:"#52B896E0",mintGreen:"#7DCAB0E0",blue:"#2E79B5E0",lightBlue:"#70B0D8E0",indigo:"#5A6CC0F0",lightIndigo:"#9AAADCE0",purple:"#7B64B8F0",lightPurple:"#AA98D8E0",warmPink:"#C85898E0",lightPink:"#E8A0C4E0",brightOrange:"#F0A040E0",deepOrange:"#C06028E0",goldenYellow:"#E8C030E0",darkAmber:"#C04848E0",warmPeach:"#F0A088E0",vibrantTeal:"#2A9A8AE0",muted:"#8888A8E0",neutralLine:"#888899D0"},a={green:"#00C972E8",darkGreen:"#009957E0",lightGreen:"#38D591E0",mintGreen:"#78E2B4E0",blue:"#1084FEE0",lightBlue:"#459FFEE0",indigo:"#0C64C1F0",lightIndigo:"#80BEFEE0",purple:"#9159FEF0",lightPurple:"#A97EFEE0",warmPink:"#FF309BE0",lightPink:"#FF5EB1E0",brightOrange:"#FF6700E0",deepOrange:"#C24E00E0",goldenYellow:"#FF9800E0",darkAmber:"#FF263CE0",warmPeach:"#FF8838E0",vibrantTeal:"#00BCA6E0",muted:"#777777E0",neutralLine:"#777777D0"},x=[i.green,i.lightBlue,i.indigo,i.brightOrange,i.deepOrange,i.goldenYellow,i.warmPink,i.warmPeach,i.purple,i.mintGreen,i.muted,i.vibrantTeal],D=[a.green,a.lightBlue,a.indigo,a.brightOrange,a.deepOrange,a.goldenYellow,a.warmPink,a.warmPeach,a.purple,a.mintGreen,a.muted,a.vibrantTeal],A={fontFamily:"inherit",h1:{fontSize:"24px",lineHeight:"30px",fontWeight:590},h2:{fontSize:"18px",lineHeight:"24px",fontWeight:590},h3:{fontSize:"16px",lineHeight:"22px",fontWeight:590},body:{fontSize:"14px",lineHeight:"20px",fontWeight:400},small:{fontSize:"12px",lineHeight:"16px",fontWeight:400}},G='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',H={"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,"4.5":18,5:20,6:24,7:28,8:32,9:36,10:40},b={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},I={...b,md:8,lg:10,xl:14},R={...A,fontFamily:G};function m(e,r){return{bg:{editor:e.editor,chrome:e.chrome,elevated:e.elevated},text:{primary:e.foreground,secondary:e.foregroundSecondary,tertiary:e.foregroundTertiary,quaternary:e.foregroundQuaternary,link:e.link,onAccent:e.buttonForeground},stroke:{primary:e.strokePrimary,secondary:e.strokeSecondary,tertiary:e.strokeTertiary,focused:e.strokeFocused},fill:{primary:e.fillPrimary,secondary:e.fillSecondary,tertiary:e.fillTertiary,quaternary:e.fillQuaternary},accent:{primary:e.accent,control:e.buttonBackground,controlHover:e.buttonHoverBackground},diff:{insertedLine:e.diffInsertedLine,removedLine:e.diffRemovedLine,stripAdded:e.diffStripAdded,stripRemoved:e.diffStripRemoved},category:r}}const q=m(g,y),M=m(u,B);function F(e){const r=e.trim(),o=/^#([0-9a-f]{3,8})$/i.exec(r);if(!o)return;const n=o[1];if(n.length===3||n.length===4){const t=C=>C+C,d=parseInt(t(n[0]),16),c=parseInt(t(n[1]),16),l=parseInt(t(n[2]),16);return{r:d,g:c,b:l}}if(n.length===6||n.length===8){const t=parseInt(n.slice(0,2),16),d=parseInt(n.slice(2,4),16),c=parseInt(n.slice(4,6),16);return{r:t,g:d,b:c}}}function O(e){const r=o=>{const n=o/255;return n<=.03928?n/12.92:((n+.055)/1.055)**2.4};return .2126*r(e.r)+.7152*r(e.g)+.0722*r(e.b)}function Q(e,r,o){const n=Math.min(1,Math.max(0,o));return{r:Math.round(e.r*(1-n)+r.r*n),g:Math.round(e.g*(1-n)+r.g*n),b:Math.round(e.b*(1-n)+r.b*n)}}function W(e){const r=o=>o.toString(16).padStart(2,"0");return`#${r(e.r)}${r(e.g)}${r(e.b)}`}function v(e){return e==="grok"?"grok":"cursor"}function z(e,r){let o=e;if(typeof r.editorBackground=="string"&&F(r.editorBackground)){const n=r.editorBackground;o={...o,editor:n,chrome:n,sidebar:n,elevated:n}}if(typeof r.editorForeground=="string"&&F(r.editorForeground)){const n=r.editorForeground;o={...o,foreground:n,foregroundSecondary:n,foregroundTertiary:n,foregroundQuaternary:n}}return o}function Y(e,r){const o=F(r);if(!o)return e;const n=Q(o,{r:255,g:255,b:255},.12),t=O(o)>.45?"#141414":"#FAFAFA";return{...e,accent:r,buttonBackground:r,buttonHoverBackground:W(n),link:r,strokeFocused:r,buttonForeground:t}}const $=new Set(["light","hc-light"]);function _(e){return $.has(e)}function K(e,r){const o=v(r==null?void 0:r.brand),n=_(e);let t;o==="grok"?t=n?f:E:t=n?u:g,t=z(t,r??{}),o!=="grok"&&typeof(r==null?void 0:r.primary)=="string"&&(t=Y(t,r.primary));const c=s(o==="grok"?k:n?p:h,t);return{tokens:m(t,c),palette:t,brand:o}}function N(e){return e==="grok"?{palette:a,sequence:D}:{palette:i,sequence:x}}function U(e){return e==="grok"?I:b}function j(e){return e==="grok"?R:A}function J(){var r;if(typeof window>"u")return;const e=window.__cursorCanvas;return(r=e==null?void 0:e.state)==null?void 0:r.theme}function V(e,r){let o=typeof(e==null?void 0:e.kind)=="string"&&e.kind.length>0?e.kind:void 0;o||(r?o=r:typeof window<"u"&&window.matchMedia?o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o="dark");const n={brand:v(e==null?void 0:e.brand),primary:typeof(e==null?void 0:e.primary)=="string"?e.primary:void 0,editorBackground:typeof(e==null?void 0:e.editorBackground)=="string"?e.editorBackground:void 0,editorForeground:typeof(e==null?void 0:e.editorForeground)=="string"?e.editorForeground:void 0},{tokens:t,palette:d,brand:c}=K(o,n),l=N(c);return{...t,kind:o,brand:c,tokens:t,palette:d,category:t.category,radius:U(c),typography:j(c),chart:l,spacing:H}}function X(e){const r=J();return V(r,e)}exports.canvasPaletteDark=g;exports.canvasPaletteGrokDark=E;exports.canvasPaletteGrokLight=f;exports.canvasPaletteLight=u;exports.canvasTokens=q;exports.canvasTokensLight=M;exports.categoryPaletteDark=y;exports.categoryPaletteLight=B;exports.colorPalette=T;exports.resolveThemeForColorScheme=X;exports.usageColorSequence=L;
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("react"),u=require("react-dom/client"),l=require("@mantine/core"),g=require("./host-tokens-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("react"),u=require("react-dom/client"),l=require("@mantine/core"),g=require("./host-tokens-Lz69pkRj.cjs");function d(t){return[t,t,t,t,t,t,t,t,t,t]}function f(t){const{typography:e,radius:n}=t;return l.createTheme({primaryColor:"accent",colors:{accent:d(t.palette.accent)},fontFamily:e.fontFamily,defaultRadius:`${n.md}`,radius:{xs:`${n.xs}px`,sm:`${n.sm}px`,md:`${n.md}px`,lg:`${n.lg}px`,xl:`${n.xl}px`},headings:{fontFamily:e.fontFamily,fontWeight:String(e.h1.fontWeight),sizes:{h1:{fontSize:e.h1.fontSize,lineHeight:e.h1.lineHeight,fontWeight:String(e.h1.fontWeight)},h2:{fontSize:e.h2.fontSize,lineHeight:e.h2.lineHeight,fontWeight:String(e.h2.fontWeight)},h3:{fontSize:e.h3.fontSize,lineHeight:e.h3.lineHeight,fontWeight:String(e.h3.fontWeight)},h4:{fontSize:e.body.fontSize,lineHeight:e.body.lineHeight,fontWeight:String(e.body.fontWeight)}}}})}function y(t){const e=window.matchMedia("(prefers-color-scheme: dark)");return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}function S(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function p(t){const e=r.useSyncExternalStore(y,S,()=>"light");return t==="dark"?"dark":t==="light"?"light":e}function m({children:t,defaultColorScheme:e="auto"}){const n=p(e),o=r.useMemo(()=>g.resolveThemeForColorScheme(n),[n]),s=r.useMemo(()=>f(o),[o]);return i.jsx(l.MantineProvider,{theme:s,defaultColorScheme:e,forceColorScheme:n,children:i.jsxs("div",{"data-cursor-canvas-host":!0,style:{minHeight:"inherit",background:o.bg.editor,color:o.text.primary,fontFamily:o.typography.fontFamily},children:[i.jsx("style",{children:`
|
|
2
2
|
[data-cursor-canvas-host] svg[viewBox][width='100%'] {
|
|
3
3
|
max-height: unset !important;
|
|
4
4
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo as c, useSyncExternalStore as l, StrictMode as g } from "react";
|
|
3
3
|
import { createRoot as d } from "react-dom/client";
|
|
4
4
|
import { MantineProvider as u, createTheme as y } from "@mantine/core";
|
|
5
|
-
import { r as p } from "./host-tokens-
|
|
5
|
+
import { r as p } from "./host-tokens-Bt6GPXN1.js";
|
|
6
6
|
function S(t) {
|
|
7
7
|
return [t, t, t, t, t, t, t, t, t, t];
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesler/cursor-canvas-web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
5
|
-
"repository":
|
|
4
|
+
"version": "1.4.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/flesler/cursor-canvas-web.git"
|
|
8
|
+
},
|
|
6
9
|
"type": "module",
|
|
7
10
|
"description": "Deploy your Cursor canvases to the web.",
|
|
8
11
|
"license": "MIT",
|
|
@@ -29,7 +29,13 @@ export type CanvasChartExtra = {
|
|
|
29
29
|
valueAxis?: CanvasChartValueAxisExtra
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export type CanvasBarChartExtra = CanvasChartExtra
|
|
32
|
+
export type CanvasBarChartExtra = CanvasChartExtra & {
|
|
33
|
+
/** Category (y) axis on `horizontal` bar charts. */
|
|
34
|
+
categoryAxis?: {
|
|
35
|
+
/** Label column width in px; labels truncate to fit. Default 96. */
|
|
36
|
+
width?: number
|
|
37
|
+
}
|
|
38
|
+
}
|
|
33
39
|
|
|
34
40
|
export type CanvasLineChartExtra = CanvasChartExtra & {
|
|
35
41
|
/** Curved (`monotone`) segments; the IDE draws straight segments. */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const g={foreground:"#E4E4E4EB",foregroundSecondary:"#E4E4E48D",foregroundTertiary:"#E4E4E45E",foregroundQuaternary:"#E4E4E442",editor:"#181818",chrome:"#141414",sidebar:"#141414",elevated:"#181818",fillPrimary:"#E4E4E430",fillSecondary:"#E4E4E41E",fillTertiary:"#E4E4E411",fillQuaternary:"#E4E4E40A",strokePrimary:"#E4E4E433",strokeSecondary:"#E4E4E41F",strokeTertiary:"#E4E4E414",strokeFocused:"#599CE7",accent:"#599CE7",buttonBackground:"#599CE7",buttonForeground:"#191c22",buttonHoverBackground:"#6AABE9",link:"#87c3ff",diffInsertedLine:"#3FA26633",diffRemovedLine:"#B8004933",diffStripAdded:"#3FA2668F",diffStripRemoved:"#FC6B838F"},u={foreground:"#141414F0",foregroundSecondary:"#141414BD",foregroundTertiary:"#1414148A",foregroundQuaternary:"#1414145C",editor:"#FCFCFC",chrome:"#F8F8F8",sidebar:"#F3F3F3",elevated:"#FCFCFC",fillPrimary:"#14141433",fillSecondary:"#14141424",fillTertiary:"#14141414",fillQuaternary:"#1414140F",strokePrimary:"#14141433",strokeSecondary:"#1414141F",strokeTertiary:"#14141414",strokeFocused:"#3685BF",accent:"#3685BF",buttonBackground:"#3685BF",buttonForeground:"#FCFCFC",buttonHoverBackground:"#2E76AB",link:"#3685BF",diffInsertedLine:"#1F8A651F",diffRemovedLine:"#CF2D5614",diffStripAdded:"#1F8A65CC",diffStripRemoved:"#CF2D56CC"},A={accent:"#1084FE",buttonBackground:"#1084FE",buttonForeground:"#070707",buttonHoverBackground:"#459FFE",link:"#80BEFE",strokeFocused:"#1084FE"},b={accent:"#0C64C1",buttonBackground:"#0C64C1",buttonForeground:"#FAFAFA",buttonHoverBackground:"#1084FE",link:"#0C64C1",strokeFocused:"#0C64C1"},h={...g,...A},y={...u,...b},s={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A040E0",red:"#C04848E0"},F={gray:"#8888A8E0",purple:"#7B64B8F0",green:"#1F8A65E8",yellow:"#E8C030E0",cyan:"#2A9A8AE0",pink:"#C85898E0",blue:"#2E79B5E0",orange:"#F0A088E0",red:"#CF2D56E0"},m={gray:"#777777E0",purple:"#9159FEF0",green:"#00C972E8",yellow:"#FF9800E0",cyan:"#00BCA6E0",pink:"#FF309BE0",blue:"#1084FEE0",orange:"#FF6700E0",red:"#FF263CE0"},v={...m},P=s,S=["blue","purple","green","yellow","cyan","pink","orange","red","gray"],i={green:"#1F8A65E8",darkGreen:"#0D855AE0",lightGreen:"#52B896E0",mintGreen:"#7DCAB0E0",blue:"#2E79B5E0",lightBlue:"#70B0D8E0",indigo:"#5A6CC0F0",lightIndigo:"#9AAADCE0",purple:"#7B64B8F0",lightPurple:"#AA98D8E0",warmPink:"#C85898E0",lightPink:"#E8A0C4E0",brightOrange:"#F0A040E0",deepOrange:"#C06028E0",goldenYellow:"#E8C030E0",darkAmber:"#C04848E0",warmPeach:"#F0A088E0",vibrantTeal:"#2A9A8AE0",muted:"#8888A8E0",neutralLine:"#888899D0"},a={green:"#00C972E8",darkGreen:"#009957E0",lightGreen:"#38D591E0",mintGreen:"#78E2B4E0",blue:"#1084FEE0",lightBlue:"#459FFEE0",indigo:"#0C64C1F0",lightIndigo:"#80BEFEE0",purple:"#9159FEF0",lightPurple:"#A97EFEE0",warmPink:"#FF309BE0",lightPink:"#FF5EB1E0",brightOrange:"#FF6700E0",deepOrange:"#C24E00E0",goldenYellow:"#FF9800E0",darkAmber:"#FF263CE0",warmPeach:"#FF8838E0",vibrantTeal:"#00BCA6E0",muted:"#777777E0",neutralLine:"#777777D0"},T=[i.green,i.lightBlue,i.indigo,i.brightOrange,i.deepOrange,i.goldenYellow,i.warmPink,i.warmPeach,i.purple,i.mintGreen,i.muted,i.vibrantTeal],L=[a.green,a.lightBlue,a.indigo,a.brightOrange,a.deepOrange,a.goldenYellow,a.warmPink,a.warmPeach,a.purple,a.mintGreen,a.muted,a.vibrantTeal],p={fontFamily:"inherit",h1:{fontSize:"24px",lineHeight:"30px",fontWeight:590},h2:{fontSize:"18px",lineHeight:"24px",fontWeight:590},h3:{fontSize:"16px",lineHeight:"22px",fontWeight:590},body:{fontSize:"14px",lineHeight:"20px",fontWeight:400},small:{fontSize:"12px",lineHeight:"16px",fontWeight:400}},x='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',D={"0.5":2,1:4,"1.5":6,2:8,"2.5":10,3:12,"3.5":14,4:16,"4.5":18,5:20,6:24,7:28,8:32,9:36,10:40},C={none:0,xs:2,sm:4,md:6,lg:8,xl:12,full:9999},G={...C,md:8,lg:10,xl:14},H={...p,fontFamily:x};function f(e,n){return{bg:{editor:e.editor,chrome:e.chrome,elevated:e.elevated},text:{primary:e.foreground,secondary:e.foregroundSecondary,tertiary:e.foregroundTertiary,quaternary:e.foregroundQuaternary,link:e.link,onAccent:e.buttonForeground},stroke:{primary:e.strokePrimary,secondary:e.strokeSecondary,tertiary:e.strokeTertiary,focused:e.strokeFocused},fill:{primary:e.fillPrimary,secondary:e.fillSecondary,tertiary:e.fillTertiary,quaternary:e.fillQuaternary},accent:{primary:e.accent,control:e.buttonBackground,controlHover:e.buttonHoverBackground},diff:{insertedLine:e.diffInsertedLine,removedLine:e.diffRemovedLine,stripAdded:e.diffStripAdded,stripRemoved:e.diffStripRemoved},category:n}}const I=f(g,s),R=f(u,F);function E(e){const n=e.trim(),o=/^#([0-9a-f]{3,8})$/i.exec(n);if(!o)return;const r=o[1];if(r.length===3||r.length===4){const t=k=>k+k,c=parseInt(t(r[0]),16),d=parseInt(t(r[1]),16),l=parseInt(t(r[2]),16);return{r:c,g:d,b:l}}if(r.length===6||r.length===8){const t=parseInt(r.slice(0,2),16),c=parseInt(r.slice(2,4),16),d=parseInt(r.slice(4,6),16);return{r:t,g:c,b:d}}}function q(e){const n=o=>{const r=o/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4};return .2126*n(e.r)+.7152*n(e.g)+.0722*n(e.b)}function M(e,n,o){const r=Math.min(1,Math.max(0,o));return{r:Math.round(e.r*(1-r)+n.r*r),g:Math.round(e.g*(1-r)+n.g*r),b:Math.round(e.b*(1-r)+n.b*r)}}function O(e){const n=o=>o.toString(16).padStart(2,"0");return`#${n(e.r)}${n(e.g)}${n(e.b)}`}function B(e){return e==="grok"?"grok":"cursor"}function Q(e,n){let o=e;if(typeof n.editorBackground=="string"&&E(n.editorBackground)){const r=n.editorBackground;o={...o,editor:r,chrome:r,sidebar:r,elevated:r}}if(typeof n.editorForeground=="string"&&E(n.editorForeground)){const r=n.editorForeground;o={...o,foreground:r,foregroundSecondary:r,foregroundTertiary:r,foregroundQuaternary:r}}return o}function W(e,n){const o=E(n);if(!o)return e;const r=M(o,{r:255,g:255,b:255},.12),t=q(o)>.45?"#141414":"#FAFAFA";return{...e,accent:n,buttonBackground:n,buttonHoverBackground:O(r),link:n,strokeFocused:n,buttonForeground:t}}const z=new Set(["light","hc-light"]);function Y(e){return z.has(e)}function $(e,n){const o=B(n==null?void 0:n.brand),r=Y(e);let t,c;return o==="grok"?(t=r?y:h,c=r?v:m):(t=r?u:g,c=r?F:s),t=Q(t,n??{}),o!=="grok"&&typeof(n==null?void 0:n.primary)=="string"&&(t=W(t,n.primary)),{tokens:f(t,c),palette:t,brand:o}}function _(e){return e==="grok"?{palette:a,sequence:L}:{palette:i,sequence:T}}function K(e){return e==="grok"?G:C}function N(e){return e==="grok"?H:p}function U(){var n;if(typeof window>"u")return;const e=window.__cursorCanvas;return(n=e==null?void 0:e.state)==null?void 0:n.theme}function j(e,n){let o=typeof(e==null?void 0:e.kind)=="string"&&e.kind.length>0?e.kind:void 0;o||(n?o=n:typeof window<"u"&&window.matchMedia?o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o="dark");const r={brand:B(e==null?void 0:e.brand),primary:typeof(e==null?void 0:e.primary)=="string"?e.primary:void 0,editorBackground:typeof(e==null?void 0:e.editorBackground)=="string"?e.editorBackground:void 0,editorForeground:typeof(e==null?void 0:e.editorForeground)=="string"?e.editorForeground:void 0},{tokens:t,palette:c,brand:d}=$(o,r),l=_(d);return{...t,kind:o,brand:d,tokens:t,palette:c,category:t.category,radius:K(d),typography:N(d),chart:l,spacing:D}}function w(e){const n=U();return j(n,e)}exports.canvasPaletteDark=g;exports.canvasPaletteGrokDark=h;exports.canvasPaletteGrokLight=y;exports.canvasPaletteLight=u;exports.canvasTokens=I;exports.canvasTokensLight=R;exports.categoryPaletteDark=s;exports.categoryPaletteLight=F;exports.colorPalette=P;exports.resolveThemeForColorScheme=w;exports.usageColorSequence=S;
|