@flesler/cursor-canvas-web 1.1.2 → 1.2.1
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/README.md +16 -17
- package/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +504 -485
- package/package.json +34 -20
- package/src/superset/chart-extra.d.ts +39 -0
- package/src/superset/index.d.ts +25 -0
- 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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flesler/cursor-canvas-web",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.1
|
|
4
|
+
"version": "1.2.1",
|
|
5
5
|
"repository": "github:flesler/cursor-canvas-web",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Deploy your Cursor canvases to the web.",
|
|
@@ -13,27 +13,31 @@
|
|
|
13
13
|
"react",
|
|
14
14
|
"shim"
|
|
15
15
|
],
|
|
16
|
-
"packageManager": "pnpm@11.5.2",
|
|
17
16
|
"engines": {
|
|
18
|
-
"node": ">=22"
|
|
17
|
+
"node": ">=22.12.0",
|
|
18
|
+
"npm": ">=10.0.0"
|
|
19
19
|
},
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"src/vendor"
|
|
23
|
+
"src/vendor",
|
|
24
|
+
"src/superset"
|
|
24
25
|
],
|
|
25
26
|
"main": "./dist/cursor-canvas.cjs",
|
|
26
27
|
"module": "./dist/cursor-canvas.js",
|
|
27
|
-
"types": "./src/
|
|
28
|
+
"types": "./src/superset/index.d.ts",
|
|
28
29
|
"exports": {
|
|
29
30
|
".": {
|
|
30
|
-
"types": "./src/
|
|
31
|
+
"types": "./src/superset/index.d.ts",
|
|
31
32
|
"import": "./dist/cursor-canvas.js",
|
|
32
33
|
"require": "./dist/cursor-canvas.cjs"
|
|
33
34
|
},
|
|
34
35
|
"./canvas-sdk": {
|
|
35
36
|
"types": "./src/vendor/canvas-sdk/index.d.ts"
|
|
36
37
|
},
|
|
38
|
+
"./superset": {
|
|
39
|
+
"types": "./src/superset/index.d.ts"
|
|
40
|
+
},
|
|
37
41
|
"./runtime": {
|
|
38
42
|
"types": "./dist/runtime/index.d.ts",
|
|
39
43
|
"import": "./dist/runtime.js",
|
|
@@ -46,26 +50,32 @@
|
|
|
46
50
|
"build:lib": "vite build --config vite.lib.config.ts",
|
|
47
51
|
"preview": "vite preview",
|
|
48
52
|
"typecheck": "tsc --noEmit",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
53
|
+
"eslint": "eslint --cache --cache-strategy content",
|
|
54
|
+
"lint": "npm run eslint -- 'src/**/*.{ts,tsx}' 'scripts/**/*.ts' 'vite.config.ts' 'vite.lib.config.ts'",
|
|
55
|
+
"lint:fix": "npm run lint -- --fix",
|
|
52
56
|
"test": "vitest run",
|
|
53
57
|
"test:watch": "vitest",
|
|
54
58
|
"sync:sdk": "bash scripts/sync-cursor-sdk-snapshot.sh",
|
|
59
|
+
"patch:vendor-paths": "tsx scripts/patch-vendor-paths.ts",
|
|
55
60
|
"check:sdk-exports": "tsx scripts/diff-sdk-exports.ts --strict",
|
|
56
|
-
"
|
|
57
|
-
"test:contract
|
|
61
|
+
"generate:contract-consumer": "tsx scripts/generate-contract-consumer.ts && npm run eslint -- --fix src/contract/consumer.ts",
|
|
62
|
+
"test:contract": "npm run check:sdk-exports && npm run generate:contract-consumer && tsc --noEmit && npm run build:lib",
|
|
63
|
+
"test:contract:fast": "npm run check:sdk-exports && npm run generate:contract-consumer && tsc --noEmit",
|
|
58
64
|
"check:sdk-live": "tsx scripts/diff-sdk-exports.ts --strict \"${HOME}/.cursor/skills-cursor/canvas/sdk/index.d.ts\"",
|
|
59
|
-
"test:contract:strict": "
|
|
60
|
-
"test:contract:ci": "
|
|
65
|
+
"test:contract:strict": "npm run test:contract",
|
|
66
|
+
"test:contract:ci": "npm run test:contract",
|
|
61
67
|
"sync:demo": "bash scripts/sync-demo-canvas.sh",
|
|
62
68
|
"demo:screenshot": "bash scripts/readme-screenshot.sh",
|
|
63
69
|
"test:demo-screenshots": "bash scripts/test-demo-screenshots.sh",
|
|
64
70
|
"test:demo-screenshots:update": "bash scripts/test-demo-screenshots.sh --update",
|
|
65
71
|
"test:render-compat": "bash scripts/test-render-compat.sh",
|
|
66
|
-
"ci:local": "
|
|
72
|
+
"ci:local": "npm run typecheck && npm run lint:fix && npm test && npm run test:contract:ci",
|
|
67
73
|
"prepare": "[ \"$CI\" != \"true\" ] && [ -d node_modules/husky ] && husky || true",
|
|
68
|
-
"prepublishOnly": "
|
|
74
|
+
"prepublishOnly": "npm run typecheck && npm test && npm run check:sdk-exports && npm run build:lib"
|
|
75
|
+
},
|
|
76
|
+
"overrides": {
|
|
77
|
+
"vitest": "^4.1.11",
|
|
78
|
+
"@vitest/mocker": "^4.1.11"
|
|
69
79
|
},
|
|
70
80
|
"peerDependencies": {
|
|
71
81
|
"@mantine/charts": "^8.3.0",
|
|
@@ -75,29 +85,33 @@
|
|
|
75
85
|
"recharts": "^2.15.0 || ^3.0.0"
|
|
76
86
|
},
|
|
77
87
|
"devDependencies": {
|
|
78
|
-
"@eslint/js": "^
|
|
88
|
+
"@eslint/js": "^10.0.1",
|
|
79
89
|
"@mantine/charts": "^8.3.18",
|
|
80
90
|
"@mantine/core": "^8.3.18",
|
|
81
91
|
"@mantine/hooks": "^8.3.18",
|
|
92
|
+
"@stylistic/eslint-plugin": "^5.10.0",
|
|
82
93
|
"@testing-library/jest-dom": "^6.6.3",
|
|
83
94
|
"@testing-library/react": "^16.2.0",
|
|
84
95
|
"@types/node": "^22.13.1",
|
|
85
96
|
"@types/react": "^18.3.18",
|
|
86
97
|
"@types/react-dom": "^18.3.5",
|
|
98
|
+
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
99
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
87
100
|
"@vitejs/plugin-react": "^4.3.4",
|
|
88
|
-
"eslint": "^9.
|
|
89
|
-
"eslint-plugin-
|
|
101
|
+
"eslint": "^10.9.1",
|
|
102
|
+
"eslint-plugin-import-newlines": "^2.0.0",
|
|
103
|
+
"eslint-plugin-react-hooks": "^7.1.1",
|
|
90
104
|
"eslint-plugin-react-refresh": "^0.4.18",
|
|
105
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
91
106
|
"globals": "^15.14.0",
|
|
92
107
|
"husky": "^9.1.7",
|
|
108
|
+
"jiti": "^2.7.0",
|
|
93
109
|
"jsdom": "^26.0.0",
|
|
94
|
-
"prettier": "^3.5.1",
|
|
95
110
|
"react": "^18.3.1",
|
|
96
111
|
"react-dom": "^18.3.1",
|
|
97
112
|
"recharts": "^3.10.1",
|
|
98
113
|
"tsx": "^4.21.0",
|
|
99
114
|
"typescript": "^5.7.3",
|
|
100
|
-
"typescript-eslint": "^8.24.0",
|
|
101
115
|
"vite": "^6.1.0",
|
|
102
116
|
"vite-plugin-dts": "^5.0.2",
|
|
103
117
|
"vitest": "^4.1.11"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Superset chart options, passed through the `extra` prop. The Cursor IDE
|
|
3
|
+
* ignores `extra`, so the same canvas renders there with SDK defaults.
|
|
4
|
+
*/
|
|
5
|
+
import type { YAxisProps } from 'recharts'
|
|
6
|
+
|
|
7
|
+
/** Recharts `scale` shortcuts (`auto` + d3 scale names). */
|
|
8
|
+
export type CanvasChartScale = NonNullable<YAxisProps['scale']>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Recharts props forwarded to the value axis: Y on column and line charts, X on
|
|
12
|
+
* horizontal bar charts. Non-linear scales default `domain` to `[1, 'dataMax']`.
|
|
13
|
+
*/
|
|
14
|
+
export type CanvasChartValueAxisExtra = Pick<
|
|
15
|
+
Omit<YAxisProps, 'ref'>,
|
|
16
|
+
| 'scale'
|
|
17
|
+
| 'domain'
|
|
18
|
+
| 'type'
|
|
19
|
+
| 'allowDataOverflow'
|
|
20
|
+
| 'allowDecimals'
|
|
21
|
+
| 'tickCount'
|
|
22
|
+
| 'interval'
|
|
23
|
+
| 'padding'
|
|
24
|
+
| 'unit'
|
|
25
|
+
| 'name'
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
export type CanvasChartExtra = {
|
|
29
|
+
valueAxis?: CanvasChartValueAxisExtra
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type CanvasBarChartExtra = CanvasChartExtra
|
|
33
|
+
|
|
34
|
+
export type CanvasLineChartExtra = CanvasChartExtra & {
|
|
35
|
+
/** Curved (`monotone`) segments; the IDE draws straight segments. */
|
|
36
|
+
smooth?: boolean;
|
|
37
|
+
/** Stack the filled areas. Requires `fill`. */
|
|
38
|
+
stacked?: boolean
|
|
39
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cursor/canvas` typings for this shim: the vendored Cursor SDK plus superset
|
|
3
|
+
* features. Local exports below override the SDK's same-named exports.
|
|
4
|
+
*
|
|
5
|
+
* Superset props on SDK components go under `extra`, which the IDE ignores.
|
|
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'
|
|
10
|
+
|
|
11
|
+
export * from '../vendor/canvas-sdk/index.js'
|
|
12
|
+
export type * from './chart-extra.js'
|
|
13
|
+
|
|
14
|
+
export type BarChartProps = SdkBarChartProps & {
|
|
15
|
+
extra?: CanvasBarChartExtra
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type LineChartProps = SdkLineChartProps & {
|
|
19
|
+
extra?: CanvasLineChartExtra;
|
|
20
|
+
/** @deprecated Use `extra.smooth`. */
|
|
21
|
+
smooth?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
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
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Be creative with layout — use Grid, Row, cards, charts, tables, and raw SVG
|
|
5
5
|
* in whatever combination serves the content. Read
|
|
6
|
-
*
|
|
6
|
+
* `../canvas/SKILL.md` for full design guidance. Key
|
|
7
7
|
* constraints:
|
|
8
8
|
*
|
|
9
9
|
* - Colors from `useHostTheme()` tokens (`theme.bg.editor`, not
|
|
@@ -15,51 +15,54 @@
|
|
|
15
15
|
* - Run that skill's Pre-delivery self-check before returning code.
|
|
16
16
|
*/
|
|
17
17
|
/** React authoring utilities re-exported so canvases need one public import. */
|
|
18
|
-
export
|
|
19
|
-
export {
|
|
18
|
+
export { useEffect, useMemo, useRef, useState } from "react"
|
|
19
|
+
export type { CSSProperties, RefObject } from "react"
|
|
20
20
|
/** Shared category color palette used by `Swatch`, `UsageBar`, etc. */
|
|
21
|
-
export
|
|
22
|
-
export {
|
|
21
|
+
export { categoryPaletteDark, categoryPaletteLight, colorPalette, usageColorSequence } from "./canvas-tokens.js"
|
|
22
|
+
export type { CanvasHostThemeBrand, CategoryPalette, ChartPalette, Color } from "./canvas-tokens.js"
|
|
23
23
|
/** Charts. */
|
|
24
|
-
export
|
|
25
|
-
export {
|
|
24
|
+
export { BarChart, LineChart, PieChart } from "./chart-primitives.js"
|
|
25
|
+
export type { BarChartProps, ChartDataPoint, ChartReferenceLine, ChartSeries, ChartTone, LineChartProps, PieChartProps } from "./chart-primitives.js"
|
|
26
26
|
/** Borderless collapsible disclosure row with a structured header. */
|
|
27
|
-
export
|
|
28
|
-
export {
|
|
27
|
+
export { CollapsibleSection } from "./collapsible-section.js"
|
|
28
|
+
export type { CollapsibleSectionProps } from "./collapsible-section.js"
|
|
29
29
|
/** DAG layout. */
|
|
30
|
-
export
|
|
31
|
-
export {
|
|
30
|
+
export { computeDAGLayout } from "./dag-layout.js"
|
|
31
|
+
export type { DAGLayoutEdge, DAGLayoutNode, DAGLayoutOptions, DAGLayoutRank, DAGLayoutResult } from "./dag-layout.js"
|
|
32
32
|
/**
|
|
33
33
|
* Diff rendering. Compose with the generic `Card` family for file-level
|
|
34
34
|
* chrome: use `DiffView` inside a `CardBody` (with `padding: 0`) and put
|
|
35
35
|
* `DiffStats` in the enclosing `CardHeader`'s `trailing` slot.
|
|
36
36
|
*/
|
|
37
|
-
export
|
|
38
|
-
export {
|
|
37
|
+
export { DiffStats, DiffView } from "./diff-view.js"
|
|
38
|
+
export type { DiffLineData, DiffLineType, DiffStatsProps, DiffViewProps } from "./diff-view.js"
|
|
39
39
|
/** Form controls. */
|
|
40
|
-
export
|
|
41
|
-
export {
|
|
40
|
+
export { Checkbox, IconButton, Select, TextArea, TextInput, Toggle } from "./form-primitives.js"
|
|
41
|
+
export type { CheckboxProps, IconButtonProps, SelectOption, SelectProps, TextAreaProps, TextInputProps, ToggleProps } from "./form-primitives.js"
|
|
42
42
|
/** Host state hooks. */
|
|
43
|
-
export
|
|
44
|
-
export {
|
|
43
|
+
export { useCanvasAction, useCanvasState, useHostTheme } from "./hooks.js"
|
|
44
|
+
export type { CanvasAction, CanvasHostTheme, SetCanvasState } from "./hooks.js"
|
|
45
45
|
/** Colored category swatch (uses the shared `Color` palette). */
|
|
46
|
-
export
|
|
47
|
-
export {
|
|
46
|
+
export { Swatch } from "./swatch.js"
|
|
47
|
+
export type { SwatchProps } from "./swatch.js"
|
|
48
48
|
/** Semantic design tokens for custom styling. */
|
|
49
|
-
export
|
|
50
|
-
export {
|
|
51
|
-
export
|
|
52
|
-
export {
|
|
49
|
+
export { canvasPaletteDark, canvasPaletteGrokDark, canvasPaletteGrokLight, canvasPaletteLight, canvasTokens, canvasTokensLight } from "./theme.js"
|
|
50
|
+
export type { CanvasPalette, CanvasTokens } from "./theme.js"
|
|
51
|
+
export { TodoList, TodoListCard } from "./todo-list.js"
|
|
52
|
+
export type { TodoItem, TodoListCardProps, TodoListProps, TodoStatus } from "./todo-list.js"
|
|
53
53
|
/** Component props types. */
|
|
54
|
-
export type { ButtonProps, CalloutProps, CalloutTone, CardBodyProps, CardHeaderProps, CardProps, CardSize, CardVariant, CodeProps, DividerProps, GridProps, H1Props, H2Props, H3Props, LinkProps, PillProps, PillSize, PillTone, RowProps, StackProps, StatProps, StatTone, TableColumnAlign, TableProps, TableRowTone, TextProps, TextWeight
|
|
54
|
+
export type { ButtonProps, CalloutProps, CalloutTone, CardBodyProps, CardHeaderProps, CardProps, CardSize, CardVariant, CodeProps, DividerProps, GridProps, H1Props, H2Props, H3Props, LinkProps, PillProps, PillSize, PillTone, RowProps, StackProps, StatProps, StatTone, TableColumnAlign, TableProps, TableRowTone, TextProps, TextWeight } from "./ui-primitives.js"
|
|
55
55
|
/** Layout. */
|
|
56
56
|
/** Typography. */
|
|
57
57
|
/** Surfaces. */
|
|
58
58
|
/** Actions. */
|
|
59
59
|
/** Feedback. */
|
|
60
|
-
export {
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
export {
|
|
61
|
+
Button, Callout, Card, CardBody, CardHeader, Code, Divider, Grid, H1, H2, H3, Link,
|
|
62
|
+
/** Shallow-merge two style objects. Useful for combining tokens with overrides. */
|
|
63
|
+
mergeStyle, Pill, Row, Spacer, Stack, Stat, Table, Text
|
|
64
|
+
} from "./ui-primitives.js"
|
|
63
65
|
/** Usage bar — segmented progress meter with optional labels above. */
|
|
64
|
-
export
|
|
65
|
-
export {
|
|
66
|
+
export { UsageBar } from "./usage-bar.js"
|
|
67
|
+
export type { UsageBarProps, UsageBarSegment } from "./usage-bar.js"
|
|
68
|
+
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"syncedAt": "2026-10-
|
|
2
|
+
"syncedAt": "2026-10-28",
|
|
3
3
|
"sdkSource": "~/.cursor/skills-cursor/canvas/sdk",
|
|
4
|
-
"contentHash": "
|
|
4
|
+
"contentHash": "1f789dcd66ab671526d584b5d5e0270f5eaf2d8a503828d3b6982ff796ee0bd6"
|
|
5
5
|
}
|