@flesler/cursor-canvas-web 1.1.1 → 1.2.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flesler/cursor-canvas-web",
3
3
  "private": false,
4
- "version": "1.1.1",
4
+ "version": "1.2.0",
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/vendor/canvas-sdk/index.d.ts",
28
+ "types": "./src/superset/index.d.ts",
28
29
  "exports": {
29
30
  ".": {
30
- "types": "./src/vendor/canvas-sdk/index.d.ts",
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,31 @@
46
50
  "build:lib": "vite build --config vite.lib.config.ts",
47
51
  "preview": "vite preview",
48
52
  "typecheck": "tsc --noEmit",
49
- "lint": "eslint .",
50
- "format": "prettier --write .",
51
- "format:check": "prettier --check .",
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",
55
59
  "check:sdk-exports": "tsx scripts/diff-sdk-exports.ts --strict",
56
- "test:contract": "pnpm run check:sdk-exports && tsx scripts/generate-contract-consumer.ts && tsc --noEmit && pnpm run build:lib",
57
- "test:contract:fast": "pnpm run check:sdk-exports && tsx scripts/generate-contract-consumer.ts && tsc --noEmit",
60
+ "generate:contract-consumer": "tsx scripts/generate-contract-consumer.ts && npm run eslint -- --fix src/contract/consumer.ts",
61
+ "test:contract": "npm run check:sdk-exports && npm run generate:contract-consumer && tsc --noEmit && npm run build:lib",
62
+ "test:contract:fast": "npm run check:sdk-exports && npm run generate:contract-consumer && tsc --noEmit",
58
63
  "check:sdk-live": "tsx scripts/diff-sdk-exports.ts --strict \"${HOME}/.cursor/skills-cursor/canvas/sdk/index.d.ts\"",
59
- "test:contract:strict": "pnpm run test:contract",
60
- "test:contract:ci": "pnpm run test:contract",
64
+ "test:contract:strict": "npm run test:contract",
65
+ "test:contract:ci": "npm run test:contract",
61
66
  "sync:demo": "bash scripts/sync-demo-canvas.sh",
62
67
  "demo:screenshot": "bash scripts/readme-screenshot.sh",
63
68
  "test:demo-screenshots": "bash scripts/test-demo-screenshots.sh",
64
69
  "test:demo-screenshots:update": "bash scripts/test-demo-screenshots.sh --update",
65
70
  "test:render-compat": "bash scripts/test-render-compat.sh",
66
- "ci:local": "pnpm typecheck && pnpm lint && pnpm test && pnpm test:contract:ci",
71
+ "ci:local": "npm run typecheck && npm run lint && npm test && npm run test:contract:ci",
67
72
  "prepare": "[ \"$CI\" != \"true\" ] && [ -d node_modules/husky ] && husky || true",
68
- "prepublishOnly": "pnpm typecheck && pnpm test && pnpm run check:sdk-exports && pnpm build:lib"
73
+ "prepublishOnly": "npm run typecheck && npm test && npm run check:sdk-exports && npm run build:lib"
74
+ },
75
+ "overrides": {
76
+ "vitest": "^4.1.11",
77
+ "@vitest/mocker": "^4.1.11"
69
78
  },
70
79
  "peerDependencies": {
71
80
  "@mantine/charts": "^8.3.0",
@@ -75,29 +84,33 @@
75
84
  "recharts": "^2.15.0 || ^3.0.0"
76
85
  },
77
86
  "devDependencies": {
78
- "@eslint/js": "^9.20.0",
87
+ "@eslint/js": "^10.0.1",
79
88
  "@mantine/charts": "^8.3.18",
80
89
  "@mantine/core": "^8.3.18",
81
90
  "@mantine/hooks": "^8.3.18",
91
+ "@stylistic/eslint-plugin": "^5.10.0",
82
92
  "@testing-library/jest-dom": "^6.6.3",
83
93
  "@testing-library/react": "^16.2.0",
84
94
  "@types/node": "^22.13.1",
85
95
  "@types/react": "^18.3.18",
86
96
  "@types/react-dom": "^18.3.5",
97
+ "@typescript-eslint/eslint-plugin": "^8.68.0",
98
+ "@typescript-eslint/parser": "^8.68.0",
87
99
  "@vitejs/plugin-react": "^4.3.4",
88
- "eslint": "^9.20.0",
89
- "eslint-plugin-react-hooks": "^5.1.0",
100
+ "eslint": "^10.9.1",
101
+ "eslint-plugin-import-newlines": "^2.0.0",
102
+ "eslint-plugin-react-hooks": "^7.1.1",
90
103
  "eslint-plugin-react-refresh": "^0.4.18",
104
+ "eslint-plugin-unused-imports": "^4.4.1",
91
105
  "globals": "^15.14.0",
92
106
  "husky": "^9.1.7",
107
+ "jiti": "^2.7.0",
93
108
  "jsdom": "^26.0.0",
94
- "prettier": "^3.5.1",
95
109
  "react": "^18.3.1",
96
110
  "react-dom": "^18.3.1",
97
111
  "recharts": "^3.10.1",
98
112
  "tsx": "^4.21.0",
99
113
  "typescript": "^5.7.3",
100
- "typescript-eslint": "^8.24.0",
101
114
  "vite": "^6.1.0",
102
115
  "vite-plugin-dts": "^5.0.2",
103
116
  "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;