mtxuilib 0.1.449 → 0.1.451

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.
@@ -0,0 +1 @@
1
+ export default function useHighlighter(code: string): string;
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ import { useCallback, useEffect, useMemo } from "react";
3
+ import { createHighlighter } from "shiki";
4
+ const highlighterOptions = {
5
+ langs: ['shell'],
6
+ themes: ['light-plus', 'dark-plus'],
7
+ };
8
+ let globalSikiInstance = undefined;
9
+ export default function useHighlighter(code) {
10
+ const init_siki = useCallback(async () => {
11
+ if (typeof window === "undefined" || globalSikiInstance) {
12
+ return;
13
+ }
14
+ globalSikiInstance = await createHighlighter(highlighterOptions);
15
+ }, []);
16
+ useEffect(() => {
17
+ init_siki();
18
+ }, []);
19
+ const html = useMemo(() => {
20
+ if (!globalSikiInstance) {
21
+ return code;
22
+ }
23
+ return globalSikiInstance.codeToHtml(code, {
24
+ lang: "shell",
25
+ theme: "dark-plus",
26
+ });
27
+ }, [code, globalSikiInstance]);
28
+ return html;
29
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mtxuilib",
3
3
  "private": false,
4
- "version": "0.1.449",
4
+ "version": "0.1.451",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -84,7 +84,6 @@
84
84
  },
85
85
  "dependencies": {
86
86
  "@ai-sdk/openai": "^0.0.66",
87
- "@headlessui/react": "^2.1.2",
88
87
  "@hookform/resolvers": "^3.9.0",
89
88
  "@radix-ui/react-accessible-icon": "^1.1.0",
90
89
  "@radix-ui/react-accordion": "^1.2.0",
@@ -124,7 +123,6 @@
124
123
  "clsx": "^2.1.1",
125
124
  "cmdk": "0.2.1",
126
125
  "compression": "^1.7.4",
127
- "d3-scale": "^4.0.2",
128
126
  "date-fns": "^3.6.0",
129
127
  "embla-carousel-autoplay": "^8.1.8",
130
128
  "embla-carousel-react": "^8.1.8",
@@ -142,7 +140,6 @@
142
140
  "markdown-wasm": "^1.2.0",
143
141
  "nanoid": "^5.0.7",
144
142
  "next": "^15.0.0-rc.0",
145
- "next-contentlayer": "0.3.4",
146
143
  "next-nprogress-bar": "^2.3.13",
147
144
  "next-themes": "^0.3.0",
148
145
  "node-html-parser": "^6.1.13",
@@ -170,15 +167,17 @@
170
167
  "remark-gfm": "^4.0.0",
171
168
  "remark-math": "^6.0.0",
172
169
  "sonner": "^1.5.0",
173
- "superjson": "^2.2.1",
174
170
  "tippy.js": "^6.3.7",
175
171
  "use-debounce": "^10.0.2",
176
172
  "use-resize-observer": "^9.1.0",
177
173
  "usehooks-ts": "^3.1.0",
178
- "vaul": "^0.9.1",
179
- "zod": "^3.23.8"
174
+ "zod": "^3.23.8",
175
+ "shiki": "^1.12.1"
180
176
  },
181
177
  "devDependencies": {
178
+ "vaul": "^0.9.1",
179
+ "superjson": "^2.2.1",
180
+ "d3-scale": "^4.0.2",
182
181
  "@vercel/kv": "^2.0.0",
183
182
  "@types/jquery": "^3.5.30",
184
183
  "@changesets/get-github-info": "^0.6.0",
@@ -198,20 +197,20 @@
198
197
  "@types/nprogress": "^0.2.3",
199
198
  "@types/react": "^18.3.3",
200
199
  "@types/react-dom": "^18.3.0",
201
- "@types/react-syntax-highlighter": "^15.5.13",
202
200
  "autoprefixer": "^10.4.20",
203
201
  "css-loader": "^6.11.0",
204
202
  "postcss": "^8.4.41",
205
203
  "postcss-loader": "^6.2.1",
206
204
  "postcss-preset-env": "^9.6.0",
207
- "shiki": "^1.12.1",
208
- "sirv": "^2.0.4",
209
205
  "tailwind-merge": "^2.5.2",
210
206
  "tailwindcss": "^3.4.9",
211
207
  "tailwindcss-animate": "^1.0.7",
212
208
  "typescript": "^5.5.4"
213
209
  },
214
210
  "other": {
211
+ "next-contentlayer": "0.3.4",
212
+ "sirv": "^2.0.4",
213
+ "@types/react-syntax-highlighter": "^15.5.13",
215
214
  "ts-morph": "^22.0.0",
216
215
  "mjml-react": "^2.0.8",
217
216
  "@changesets/cli": "^2.27.7",
@@ -227,6 +226,7 @@
227
226
  "@types/prismjs": "^1.26.4",
228
227
  "@types/webpack-env": "^1.18.5",
229
228
  "puppeteer": "^22.15.0",
229
+ "@headlessui/react": "^2.1.2",
230
230
  "playwright": "^1.46.0",
231
231
  "@playwright/test": "^1.46.0",
232
232
  "@netlify/plugin-nextjs": "^4.41.3",