@flesler/cursor-canvas-web 1.1.0 → 1.1.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/dist/cursor-canvas.cjs +1 -1
- package/dist/cursor-canvas.js +579 -430
- package/dist/runtime.cjs +5 -1
- package/dist/runtime.js +35 -27
- package/package.json +2 -1
package/dist/runtime.cjs
CHANGED
|
@@ -1 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),r=require("react"),
|
|
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-Cjzmp0z_.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
|
+
[data-cursor-canvas-host] svg[viewBox][width='100%'] {
|
|
3
|
+
max-height: unset !important;
|
|
4
|
+
}
|
|
5
|
+
`}),t]})})}const v=m;function x(t,e,n={}){const{defaultColorScheme:o="auto",strict:s=!0}=n,a=typeof t=="string"?document.getElementById(t):t;if(!a)throw new Error(`mountCanvas: container ${typeof t=="string"?`#${t}`:""} not found`);const c=u.createRoot(a),h=i.jsx(m,{defaultColorScheme:o,children:e});return c.render(s?i.jsx(r.StrictMode,{children:h}):h),c}exports.CanvasRoot=v;exports.mountCanvas=x;
|
package/dist/runtime.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { createRoot as
|
|
4
|
-
import { MantineProvider as
|
|
5
|
-
import { r as
|
|
6
|
-
function
|
|
1
|
+
import { jsx as i, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as c, useSyncExternalStore as l, StrictMode as g } from "react";
|
|
3
|
+
import { createRoot as d } from "react-dom/client";
|
|
4
|
+
import { MantineProvider as u, createTheme as y } from "@mantine/core";
|
|
5
|
+
import { r as p } from "./host-tokens-Dh2BFFjv.js";
|
|
6
|
+
function S(t) {
|
|
7
7
|
return [t, t, t, t, t, t, t, t, t, t];
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function v(t) {
|
|
10
10
|
const { typography: e, radius: n } = t;
|
|
11
|
-
return
|
|
11
|
+
return y({
|
|
12
12
|
primaryColor: "accent",
|
|
13
13
|
colors: {
|
|
14
|
-
accent:
|
|
14
|
+
accent: S(t.palette.accent)
|
|
15
15
|
},
|
|
16
16
|
fontFamily: e.fontFamily,
|
|
17
17
|
defaultRadius: `${n.md}`,
|
|
@@ -50,61 +50,69 @@ function S(t) {
|
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function H(t) {
|
|
54
54
|
const e = window.matchMedia("(prefers-color-scheme: dark)");
|
|
55
55
|
return e.addEventListener("change", t), () => e.removeEventListener("change", t);
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function W() {
|
|
58
58
|
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const e =
|
|
62
|
-
v,
|
|
60
|
+
function z(t) {
|
|
61
|
+
const e = l(
|
|
63
62
|
H,
|
|
63
|
+
W,
|
|
64
64
|
() => "light"
|
|
65
65
|
);
|
|
66
66
|
return t === "dark" ? "dark" : t === "light" ? "light" : e;
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function m({
|
|
69
69
|
children: t,
|
|
70
70
|
defaultColorScheme: e = "auto"
|
|
71
71
|
}) {
|
|
72
|
-
const n =
|
|
73
|
-
() =>
|
|
72
|
+
const n = z(e), o = c(
|
|
73
|
+
() => p(n),
|
|
74
74
|
[n]
|
|
75
|
-
), r =
|
|
75
|
+
), r = c(() => v(o), [o]);
|
|
76
76
|
return /* @__PURE__ */ i(
|
|
77
|
-
|
|
77
|
+
u,
|
|
78
78
|
{
|
|
79
79
|
theme: r,
|
|
80
80
|
defaultColorScheme: e,
|
|
81
81
|
forceColorScheme: n,
|
|
82
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ f(
|
|
83
83
|
"div",
|
|
84
84
|
{
|
|
85
|
+
"data-cursor-canvas-host": !0,
|
|
85
86
|
style: {
|
|
86
87
|
minHeight: "inherit",
|
|
87
88
|
background: o.bg.editor,
|
|
88
89
|
color: o.text.primary,
|
|
89
90
|
fontFamily: o.typography.fontFamily
|
|
90
91
|
},
|
|
91
|
-
children:
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ i("style", { children: `
|
|
94
|
+
[data-cursor-canvas-host] svg[viewBox][width='100%'] {
|
|
95
|
+
max-height: unset !important;
|
|
96
|
+
}
|
|
97
|
+
` }),
|
|
98
|
+
t
|
|
99
|
+
]
|
|
92
100
|
}
|
|
93
101
|
)
|
|
94
102
|
}
|
|
95
103
|
);
|
|
96
104
|
}
|
|
97
|
-
const
|
|
98
|
-
function
|
|
105
|
+
const M = m;
|
|
106
|
+
function k(t, e, n = {}) {
|
|
99
107
|
const { defaultColorScheme: o = "auto", strict: r = !0 } = n, s = typeof t == "string" ? document.getElementById(t) : t;
|
|
100
108
|
if (!s)
|
|
101
109
|
throw new Error(
|
|
102
110
|
`mountCanvas: container ${typeof t == "string" ? `#${t}` : ""} not found`
|
|
103
111
|
);
|
|
104
|
-
const a =
|
|
105
|
-
return a.render(r ? /* @__PURE__ */ i(
|
|
112
|
+
const a = d(s), h = /* @__PURE__ */ i(m, { defaultColorScheme: o, children: e });
|
|
113
|
+
return a.render(r ? /* @__PURE__ */ i(g, { children: h }) : h), a;
|
|
106
114
|
}
|
|
107
115
|
export {
|
|
108
|
-
|
|
109
|
-
|
|
116
|
+
M as CanvasRoot,
|
|
117
|
+
k as mountCanvas
|
|
110
118
|
};
|
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.1.1",
|
|
5
5
|
"repository": "github:flesler/cursor-canvas-web",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"description": "Deploy your Cursor canvases to the web.",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"sync:sdk": "bash scripts/sync-cursor-sdk-snapshot.sh",
|
|
55
55
|
"check:sdk-exports": "tsx scripts/diff-sdk-exports.ts --strict",
|
|
56
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",
|
|
57
58
|
"check:sdk-live": "tsx scripts/diff-sdk-exports.ts --strict \"${HOME}/.cursor/skills-cursor/canvas/sdk/index.d.ts\"",
|
|
58
59
|
"test:contract:strict": "pnpm run test:contract",
|
|
59
60
|
"test:contract:ci": "pnpm run test:contract",
|