@supernal/interface-nextjs 1.0.30 → 1.0.32

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/index.js CHANGED
@@ -1175,9 +1175,8 @@ var import_remark_directive = __toESM(require("remark-directive"));
1175
1175
  var import_rehype_katex = __toESM(require("rehype-katex"));
1176
1176
 
1177
1177
  // src/components/CodeBlock.tsx
1178
- var import_react6 = __toESM(require("react"));
1179
- var import_react_syntax_highlighter = require("react-syntax-highlighter");
1180
- var import_prism = require("react-syntax-highlighter/dist/cjs/styles/prism");
1178
+ var import_react6 = require("react");
1179
+ var import_prism_react_renderer = require("prism-react-renderer");
1181
1180
  var import_jsx_runtime6 = require("react/jsx-runtime");
1182
1181
  function CodeBlock({ children, className, inline, theme = "dark" }) {
1183
1182
  const [copied, setCopied] = (0, import_react6.useState)(false);
@@ -1196,7 +1195,7 @@ function CodeBlock({ children, className, inline, theme = "dark" }) {
1196
1195
  "button",
1197
1196
  {
1198
1197
  onClick: handleCopy,
1199
- className: `absolute top-2 right-2 px-3 py-1.5 text-xs font-medium rounded transition-all ${theme === "dark" ? "bg-gray-700 hover:bg-gray-600 text-gray-200" : "bg-gray-200 hover:bg-gray-300 text-gray-700"} ${copied ? "opacity-100" : "opacity-0 group-hover:opacity-100"}`,
1198
+ className: `absolute top-2 right-2 px-3 py-1.5 text-xs font-medium rounded transition-all z-10 ${theme === "dark" ? "bg-gray-700 hover:bg-gray-600 text-gray-200" : "bg-gray-200 hover:bg-gray-300 text-gray-700"} ${copied ? "opacity-100" : "opacity-0 group-hover:opacity-100"}`,
1200
1199
  "aria-label": "Copy code",
1201
1200
  children: copied ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "flex items-center gap-1", children: [
1202
1201
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
@@ -1207,19 +1206,44 @@ function CodeBlock({ children, className, inline, theme = "dark" }) {
1207
1206
  ] })
1208
1207
  }
1209
1208
  ),
1210
- import_react6.default.createElement(import_react_syntax_highlighter.Prism, {
1211
- language,
1212
- style: theme === "dark" ? import_prism.vscDarkPlus : import_prism.vs,
1213
- customStyle: {
1214
- margin: 0,
1215
- borderRadius: "0.5rem",
1216
- fontSize: "0.875rem",
1217
- padding: "1rem"
1218
- },
1219
- showLineNumbers: true,
1220
- wrapLines: true,
1221
- children
1222
- })
1209
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1210
+ import_prism_react_renderer.Highlight,
1211
+ {
1212
+ theme: theme === "dark" ? import_prism_react_renderer.themes.vsDark : import_prism_react_renderer.themes.vsLight,
1213
+ code: children.trim(),
1214
+ language,
1215
+ children: ({ className: highlightClassName, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1216
+ "pre",
1217
+ {
1218
+ className: highlightClassName,
1219
+ style: {
1220
+ ...style,
1221
+ margin: 0,
1222
+ borderRadius: "0.5rem",
1223
+ fontSize: "0.875rem",
1224
+ padding: "1rem",
1225
+ overflow: "auto"
1226
+ },
1227
+ children: tokens.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { ...getLineProps({ line }), style: { display: "table-row" }, children: [
1228
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1229
+ "span",
1230
+ {
1231
+ style: {
1232
+ display: "table-cell",
1233
+ textAlign: "right",
1234
+ paddingRight: "1em",
1235
+ userSelect: "none",
1236
+ opacity: 0.5
1237
+ },
1238
+ children: i + 1
1239
+ }
1240
+ ),
1241
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: { display: "table-cell" }, children: line.map((token, key) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { ...getTokenProps({ token }) }, key)) })
1242
+ ] }, i))
1243
+ }
1244
+ )
1245
+ }
1246
+ )
1223
1247
  ] });
1224
1248
  }
1225
1249
 
package/dist/index.mjs CHANGED
@@ -1113,9 +1113,8 @@ import remarkDirective from "remark-directive";
1113
1113
  import rehypeKatex from "rehype-katex";
1114
1114
 
1115
1115
  // src/components/CodeBlock.tsx
1116
- import React5, { useState as useState3 } from "react";
1117
- import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
1118
- import { vscDarkPlus, vs } from "react-syntax-highlighter/dist/cjs/styles/prism";
1116
+ import { useState as useState3 } from "react";
1117
+ import { Highlight, themes } from "prism-react-renderer";
1119
1118
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
1120
1119
  function CodeBlock({ children, className, inline, theme = "dark" }) {
1121
1120
  const [copied, setCopied] = useState3(false);
@@ -1134,7 +1133,7 @@ function CodeBlock({ children, className, inline, theme = "dark" }) {
1134
1133
  "button",
1135
1134
  {
1136
1135
  onClick: handleCopy,
1137
- className: `absolute top-2 right-2 px-3 py-1.5 text-xs font-medium rounded transition-all ${theme === "dark" ? "bg-gray-700 hover:bg-gray-600 text-gray-200" : "bg-gray-200 hover:bg-gray-300 text-gray-700"} ${copied ? "opacity-100" : "opacity-0 group-hover:opacity-100"}`,
1136
+ className: `absolute top-2 right-2 px-3 py-1.5 text-xs font-medium rounded transition-all z-10 ${theme === "dark" ? "bg-gray-700 hover:bg-gray-600 text-gray-200" : "bg-gray-200 hover:bg-gray-300 text-gray-700"} ${copied ? "opacity-100" : "opacity-0 group-hover:opacity-100"}`,
1138
1137
  "aria-label": "Copy code",
1139
1138
  children: copied ? /* @__PURE__ */ jsxs2("span", { className: "flex items-center gap-1", children: [
1140
1139
  /* @__PURE__ */ jsx6("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx6("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M5 13l4 4L19 7" }) }),
@@ -1145,19 +1144,44 @@ function CodeBlock({ children, className, inline, theme = "dark" }) {
1145
1144
  ] })
1146
1145
  }
1147
1146
  ),
1148
- React5.createElement(SyntaxHighlighter, {
1149
- language,
1150
- style: theme === "dark" ? vscDarkPlus : vs,
1151
- customStyle: {
1152
- margin: 0,
1153
- borderRadius: "0.5rem",
1154
- fontSize: "0.875rem",
1155
- padding: "1rem"
1156
- },
1157
- showLineNumbers: true,
1158
- wrapLines: true,
1159
- children
1160
- })
1147
+ /* @__PURE__ */ jsx6(
1148
+ Highlight,
1149
+ {
1150
+ theme: theme === "dark" ? themes.vsDark : themes.vsLight,
1151
+ code: children.trim(),
1152
+ language,
1153
+ children: ({ className: highlightClassName, style, tokens, getLineProps, getTokenProps }) => /* @__PURE__ */ jsx6(
1154
+ "pre",
1155
+ {
1156
+ className: highlightClassName,
1157
+ style: {
1158
+ ...style,
1159
+ margin: 0,
1160
+ borderRadius: "0.5rem",
1161
+ fontSize: "0.875rem",
1162
+ padding: "1rem",
1163
+ overflow: "auto"
1164
+ },
1165
+ children: tokens.map((line, i) => /* @__PURE__ */ jsxs2("div", { ...getLineProps({ line }), style: { display: "table-row" }, children: [
1166
+ /* @__PURE__ */ jsx6(
1167
+ "span",
1168
+ {
1169
+ style: {
1170
+ display: "table-cell",
1171
+ textAlign: "right",
1172
+ paddingRight: "1em",
1173
+ userSelect: "none",
1174
+ opacity: 0.5
1175
+ },
1176
+ children: i + 1
1177
+ }
1178
+ ),
1179
+ /* @__PURE__ */ jsx6("span", { style: { display: "table-cell" }, children: line.map((token, key) => /* @__PURE__ */ jsx6("span", { ...getTokenProps({ token }) }, key)) })
1180
+ ] }, i))
1181
+ }
1182
+ )
1183
+ }
1184
+ )
1161
1185
  ] });
1162
1186
  }
1163
1187
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernal/interface-nextjs",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Next.js integration for Supernal Intelligence Interface - enables agentic UX with one line of code",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -25,16 +25,13 @@
25
25
  "@supernal/interface": "*",
26
26
  "next": "^14.0.0 || ^15.0.0",
27
27
  "react": "^18.0.0 || ^19.0.0",
28
- "react-dom": "^18.0.0 || ^19.0.0",
29
- "react-syntax-highlighter": "^15.5.0"
28
+ "react-dom": "^18.0.0 || ^19.0.0"
30
29
  },
31
30
  "devDependencies": {
32
31
  "@supernal/interface": "file:../",
33
32
  "@types/node": "^20.0.0",
34
33
  "@types/react": "^18.0.0",
35
34
  "@types/react-dom": "^18.0.0",
36
- "@types/react-syntax-highlighter": "^15.5.13",
37
- "react-syntax-highlighter": "^15.5.0",
38
35
  "tsup": "^8.0.0",
39
36
  "typescript": "^5.0.0"
40
37
  },
@@ -63,12 +60,13 @@
63
60
  },
64
61
  "dependencies": {
65
62
  "cac": "^6.7.14",
63
+ "katex": "^0.16.11",
64
+ "mermaid": "^11.4.1",
65
+ "prism-react-renderer": "^2.4.1",
66
66
  "react-markdown": "^9.0.1",
67
- "remark-gfm": "^4.0.0",
68
- "remark-math": "^6.0.0",
69
- "remark-directive": "^3.0.0",
70
67
  "rehype-katex": "^7.0.0",
71
- "mermaid": "^11.4.1",
72
- "katex": "^0.16.11"
68
+ "remark-directive": "^3.0.0",
69
+ "remark-gfm": "^4.0.0",
70
+ "remark-math": "^6.0.0"
73
71
  }
74
72
  }