@flesler/cursor-canvas-web 1.2.0 → 1.3.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 +265 -266
- 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 +3 -2
- package/src/superset/chart-extra.d.ts +12 -12
- package/src/superset/index.d.ts +13 -13
- package/src/vendor/canvas/SKILL.md +1 -1
- package/src/vendor/canvas-sdk/index.d.ts +32 -29
- package/src/vendor/canvas-sdk/manifest.json +2 -2
- 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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesler/cursor-canvas-web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"repository": "github:flesler/cursor-canvas-web",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Deploy your Cursor canvases to the web.",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"test": "vitest run",
|
|
57
57
|
"test:watch": "vitest",
|
|
58
58
|
"sync:sdk": "bash scripts/sync-cursor-sdk-snapshot.sh",
|
|
59
|
+
"patch:vendor-paths": "tsx scripts/patch-vendor-paths.ts",
|
|
59
60
|
"check:sdk-exports": "tsx scripts/diff-sdk-exports.ts --strict",
|
|
60
61
|
"generate:contract-consumer": "tsx scripts/generate-contract-consumer.ts && npm run eslint -- --fix src/contract/consumer.ts",
|
|
61
62
|
"test:contract": "npm run check:sdk-exports && npm run generate:contract-consumer && tsc --noEmit && npm run build:lib",
|
|
@@ -68,7 +69,7 @@
|
|
|
68
69
|
"test:demo-screenshots": "bash scripts/test-demo-screenshots.sh",
|
|
69
70
|
"test:demo-screenshots:update": "bash scripts/test-demo-screenshots.sh --update",
|
|
70
71
|
"test:render-compat": "bash scripts/test-render-compat.sh",
|
|
71
|
-
"ci:local": "npm run typecheck && npm run lint && npm test && npm run test:contract:ci",
|
|
72
|
+
"ci:local": "npm run typecheck && npm run lint:fix && npm test && npm run test:contract:ci",
|
|
72
73
|
"prepare": "[ \"$CI\" != \"true\" ] && [ -d node_modules/husky ] && husky || true",
|
|
73
74
|
"prepublishOnly": "npm run typecheck && npm test && npm run check:sdk-exports && npm run build:lib"
|
|
74
75
|
},
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
* Superset chart options, passed through the `extra` prop. The Cursor IDE
|
|
3
3
|
* ignores `extra`, so the same canvas renders there with SDK defaults.
|
|
4
4
|
*/
|
|
5
|
-
import type { YAxisProps } from 'recharts'
|
|
5
|
+
import type { YAxisProps } from 'recharts'
|
|
6
6
|
|
|
7
7
|
/** Recharts `scale` shortcuts (`auto` + d3 scale names). */
|
|
8
|
-
export type CanvasChartScale = NonNullable<YAxisProps['scale']
|
|
8
|
+
export type CanvasChartScale = NonNullable<YAxisProps['scale']>
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Recharts props forwarded to the value axis: Y on column and line charts, X on
|
|
12
12
|
* horizontal bar charts. Non-linear scales default `domain` to `[1, 'dataMax']`.
|
|
13
13
|
*/
|
|
14
14
|
export type CanvasChartValueAxisExtra = Pick<
|
|
15
|
-
|
|
15
|
+
Omit<YAxisProps, 'ref'>,
|
|
16
16
|
| 'scale'
|
|
17
17
|
| 'domain'
|
|
18
18
|
| 'type'
|
|
@@ -23,17 +23,17 @@ export type CanvasChartValueAxisExtra = Pick<
|
|
|
23
23
|
| 'padding'
|
|
24
24
|
| 'unit'
|
|
25
25
|
| 'name'
|
|
26
|
-
|
|
26
|
+
>
|
|
27
27
|
|
|
28
28
|
export type CanvasChartExtra = {
|
|
29
|
-
|
|
30
|
-
}
|
|
29
|
+
valueAxis?: CanvasChartValueAxisExtra
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
export type CanvasBarChartExtra = CanvasChartExtra
|
|
32
|
+
export type CanvasBarChartExtra = CanvasChartExtra
|
|
33
33
|
|
|
34
34
|
export type CanvasLineChartExtra = CanvasChartExtra & {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
35
|
+
/** Curved (`monotone`) segments; the IDE draws straight segments. */
|
|
36
|
+
smooth?: boolean;
|
|
37
|
+
/** Stack the filled areas. Requires `fill`. */
|
|
38
|
+
stacked?: boolean
|
|
39
|
+
}
|
package/src/superset/index.d.ts
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Superset props on SDK components go under `extra`, which the IDE ignores.
|
|
6
6
|
*/
|
|
7
|
-
import type { JSX } from 'react'
|
|
8
|
-
import type { BarChartProps as SdkBarChartProps, LineChartProps as SdkLineChartProps } from '../vendor/canvas-sdk/index.js'
|
|
9
|
-
import type { CanvasBarChartExtra, CanvasLineChartExtra } from './chart-extra.js'
|
|
7
|
+
import type { JSX } from 'react'
|
|
8
|
+
import type { BarChartProps as SdkBarChartProps, LineChartProps as SdkLineChartProps } from '../vendor/canvas-sdk/index.js'
|
|
9
|
+
import type { CanvasBarChartExtra, CanvasLineChartExtra } from './chart-extra.js'
|
|
10
10
|
|
|
11
|
-
export * from '../vendor/canvas-sdk/index.js'
|
|
12
|
-
export type * from './chart-extra.js'
|
|
11
|
+
export * from '../vendor/canvas-sdk/index.js'
|
|
12
|
+
export type * from './chart-extra.js'
|
|
13
13
|
|
|
14
14
|
export type BarChartProps = SdkBarChartProps & {
|
|
15
|
-
|
|
16
|
-
}
|
|
15
|
+
extra?: CanvasBarChartExtra
|
|
16
|
+
}
|
|
17
17
|
|
|
18
18
|
export type LineChartProps = SdkLineChartProps & {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
19
|
+
extra?: CanvasLineChartExtra;
|
|
20
|
+
/** @deprecated Use `extra.smooth`. */
|
|
21
|
+
smooth?: boolean
|
|
22
|
+
}
|
|
23
23
|
|
|
24
|
-
export declare function BarChart(props: BarChartProps): JSX.Element
|
|
25
|
-
export declare function LineChart(props: LineChartProps): JSX.Element
|
|
24
|
+
export declare function BarChart(props: BarChartProps): JSX.Element
|
|
25
|
+
export declare function LineChart(props: LineChartProps): JSX.Element
|
|
@@ -64,7 +64,7 @@ The trigger is **user intent**, not response shape. Ask: would the user benefit
|
|
|
64
64
|
- A **legend** when more than one series is shown, with the exact series names from the source data.
|
|
65
65
|
- The **source and time range** in a small caption (e.g. "Source: Datadog · last 7 days"). If a value is a transformation (mean, p95, normalized, smoothed), say so in the label.
|
|
66
66
|
|
|
67
|
-
**Component discovery:** prefer built-in `cursor/canvas` components over hand-rolled markup. The full public surface (components, hooks, prop types, tokens) is declared in
|
|
67
|
+
**Component discovery:** prefer built-in `cursor/canvas` components over hand-rolled markup. The full public surface (components, hooks, prop types, tokens) is declared in `../canvas-sdk/index.d.ts` and its sibling `.d.ts` files — read them when you need exact exports, prop shapes, or hook signatures rather than guessing. Referencing an export that does not exist is the most common runtime error.
|
|
68
68
|
|
|
69
69
|
Apply the Design guidance below as you write, and complete its Pre-delivery self-check before returning the canvas.
|
|
70
70
|
|