@gofreego/tsutils 0.1.9 → 0.1.11
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.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +50 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { AlertColor, IconButtonProps } from '@mui/material';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import { Highlighter } from 'shiki';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -193,6 +194,18 @@ declare const NotificationProvider: React.FC<NotificationProviderProps>;
|
|
|
193
194
|
*/
|
|
194
195
|
declare const useNotification: () => NotificationContextType;
|
|
195
196
|
|
|
197
|
+
interface ConfirmDialogProps {
|
|
198
|
+
open: boolean;
|
|
199
|
+
title: string;
|
|
200
|
+
message: string;
|
|
201
|
+
confirmText?: string;
|
|
202
|
+
cancelText?: string;
|
|
203
|
+
confirmColor?: 'primary' | 'error' | 'warning' | 'success';
|
|
204
|
+
onConfirm: () => void;
|
|
205
|
+
onCancel: () => void;
|
|
206
|
+
}
|
|
207
|
+
declare const ConfirmDialog: ({ open, title, message, confirmText, cancelText, confirmColor, onConfirm, onCancel, }: ConfirmDialogProps) => react_jsx_runtime.JSX.Element;
|
|
208
|
+
|
|
196
209
|
/**
|
|
197
210
|
* Theme mode options
|
|
198
211
|
* - 'light': Always use light theme
|
|
@@ -637,4 +650,4 @@ declare class PermissionManager {
|
|
|
637
650
|
static hasPermission(permission: string): boolean;
|
|
638
651
|
}
|
|
639
652
|
|
|
640
|
-
export { type AuthContextType, AuthProvider, type AuthProviderProps, HttpClient, type HttpClientConfig, type HttpResponse, LocalStorage, type MenuItem, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, PermissionManager, ReadmeViewer, type RequestConfig, type ResolvedThemeMode, SidebarLayout, type SidebarLayoutProps, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, borderRadius, cn, darkTheme, debounce, elevation, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useAuth, useNotification, useTheme, zIndex };
|
|
653
|
+
export { type AuthContextType, AuthProvider, type AuthProviderProps, ConfirmDialog, type ConfirmDialogProps, HttpClient, type HttpClientConfig, type HttpResponse, LocalStorage, type MenuItem, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, PermissionManager, ReadmeViewer, type RequestConfig, type ResolvedThemeMode, SidebarLayout, type SidebarLayoutProps, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, borderRadius, cn, darkTheme, debounce, elevation, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useAuth, useNotification, useTheme, zIndex };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode, CSSProperties } from 'react';
|
|
2
2
|
import { AlertColor, IconButtonProps } from '@mui/material';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import { Highlighter } from 'shiki';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -193,6 +194,18 @@ declare const NotificationProvider: React.FC<NotificationProviderProps>;
|
|
|
193
194
|
*/
|
|
194
195
|
declare const useNotification: () => NotificationContextType;
|
|
195
196
|
|
|
197
|
+
interface ConfirmDialogProps {
|
|
198
|
+
open: boolean;
|
|
199
|
+
title: string;
|
|
200
|
+
message: string;
|
|
201
|
+
confirmText?: string;
|
|
202
|
+
cancelText?: string;
|
|
203
|
+
confirmColor?: 'primary' | 'error' | 'warning' | 'success';
|
|
204
|
+
onConfirm: () => void;
|
|
205
|
+
onCancel: () => void;
|
|
206
|
+
}
|
|
207
|
+
declare const ConfirmDialog: ({ open, title, message, confirmText, cancelText, confirmColor, onConfirm, onCancel, }: ConfirmDialogProps) => react_jsx_runtime.JSX.Element;
|
|
208
|
+
|
|
196
209
|
/**
|
|
197
210
|
* Theme mode options
|
|
198
211
|
* - 'light': Always use light theme
|
|
@@ -637,4 +650,4 @@ declare class PermissionManager {
|
|
|
637
650
|
static hasPermission(permission: string): boolean;
|
|
638
651
|
}
|
|
639
652
|
|
|
640
|
-
export { type AuthContextType, AuthProvider, type AuthProviderProps, HttpClient, type HttpClientConfig, type HttpResponse, LocalStorage, type MenuItem, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, PermissionManager, ReadmeViewer, type RequestConfig, type ResolvedThemeMode, SidebarLayout, type SidebarLayoutProps, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, borderRadius, cn, darkTheme, debounce, elevation, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useAuth, useNotification, useTheme, zIndex };
|
|
653
|
+
export { type AuthContextType, AuthProvider, type AuthProviderProps, ConfirmDialog, type ConfirmDialogProps, HttpClient, type HttpClientConfig, type HttpResponse, LocalStorage, type MenuItem, type Notification, type NotificationContextType, NotificationProvider, type NotificationProviderProps, PermissionManager, ReadmeViewer, type RequestConfig, type ResolvedThemeMode, SidebarLayout, type SidebarLayoutProps, type Theme, type ThemeContextValue, type ThemeMode, ThemeProvider, ThemeToggle, borderRadius, cn, darkTheme, debounce, elevation, fontSize, fontWeight, formatDate, getHighlighter, lightTheme, lineHeight, spacing, throttle, tokens, transition, useAuth, useNotification, useTheme, zIndex };
|
package/dist/index.js
CHANGED
|
@@ -7,16 +7,23 @@ var reactRouterDom = require('react-router-dom');
|
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
var ReactMarkdown = require('react-markdown');
|
|
9
9
|
var remarkGfm = require('remark-gfm');
|
|
10
|
+
var remarkMath = require('remark-math');
|
|
11
|
+
var rehypeKatex = require('rehype-katex');
|
|
12
|
+
require('katex/dist/katex.min.css');
|
|
10
13
|
var ContentCopyIcon = require('@mui/icons-material/ContentCopy');
|
|
11
14
|
var CheckIcon = require('@mui/icons-material/Check');
|
|
12
15
|
var shiki = require('shiki');
|
|
16
|
+
var WarningAmberIcon = require('@mui/icons-material/WarningAmber');
|
|
13
17
|
|
|
14
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
19
|
|
|
16
20
|
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
17
21
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
22
|
+
var remarkMath__default = /*#__PURE__*/_interopDefault(remarkMath);
|
|
23
|
+
var rehypeKatex__default = /*#__PURE__*/_interopDefault(rehypeKatex);
|
|
18
24
|
var ContentCopyIcon__default = /*#__PURE__*/_interopDefault(ContentCopyIcon);
|
|
19
25
|
var CheckIcon__default = /*#__PURE__*/_interopDefault(CheckIcon);
|
|
26
|
+
var WarningAmberIcon__default = /*#__PURE__*/_interopDefault(WarningAmberIcon);
|
|
20
27
|
|
|
21
28
|
var __defProp = Object.defineProperty;
|
|
22
29
|
var __export = (target, all) => {
|
|
@@ -398,7 +405,7 @@ var getHighlighter = async () => {
|
|
|
398
405
|
}
|
|
399
406
|
highlighterPromise = shiki.createHighlighter({
|
|
400
407
|
themes: ["github-light", "github-dark"],
|
|
401
|
-
langs: ["js", "ts", "go", "json", "bash", "yaml", "md", "python", "java", "cpp", "c", "html", "css", "sql"]
|
|
408
|
+
langs: ["js", "ts", "go", "json", "bash", "yaml", "md", "python", "java", "cpp", "c", "html", "css", "sql", "http", "text"]
|
|
402
409
|
}).then((highlighter) => {
|
|
403
410
|
highlighterInstance = highlighter;
|
|
404
411
|
return highlighter;
|
|
@@ -433,28 +440,32 @@ var ReadmeViewer = ({
|
|
|
433
440
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `readme-viewer markdown-body ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
434
441
|
ReactMarkdown__default.default,
|
|
435
442
|
{
|
|
436
|
-
remarkPlugins: [remarkGfm__default.default],
|
|
443
|
+
remarkPlugins: [remarkGfm__default.default, remarkMath__default.default],
|
|
444
|
+
rehypePlugins: [rehypeKatex__default.default],
|
|
437
445
|
components: {
|
|
438
446
|
code({ className: className2, children, ...props }) {
|
|
439
447
|
const match = /language-(\w+)/.exec(className2 || "");
|
|
440
448
|
if (match && highlighter) {
|
|
441
449
|
const codeText = String(children).replace(/\n$/, "");
|
|
442
450
|
const blockId = `code-${Math.random().toString(36).substr(2, 9)}`;
|
|
451
|
+
let highlightedHtml = "";
|
|
452
|
+
try {
|
|
453
|
+
highlightedHtml = highlighter.codeToHtml(codeText, {
|
|
454
|
+
lang: match[1],
|
|
455
|
+
theme: isDark ? "github-dark" : "github-light"
|
|
456
|
+
});
|
|
457
|
+
} catch (e) {
|
|
458
|
+
try {
|
|
459
|
+
highlightedHtml = highlighter.codeToHtml(codeText, {
|
|
460
|
+
lang: "text",
|
|
461
|
+
theme: isDark ? "github-dark" : "github-light"
|
|
462
|
+
});
|
|
463
|
+
} catch (fallbackError) {
|
|
464
|
+
highlightedHtml = `<pre><code>${codeText}</code></pre>`;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
443
467
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { position: "relative" }, children: [
|
|
444
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
445
|
-
"div",
|
|
446
|
-
{
|
|
447
|
-
dangerouslySetInnerHTML: {
|
|
448
|
-
__html: highlighter.codeToHtml(
|
|
449
|
-
codeText,
|
|
450
|
-
{
|
|
451
|
-
lang: match[1],
|
|
452
|
-
theme: isDark ? "github-dark" : "github-light"
|
|
453
|
-
}
|
|
454
|
-
)
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
),
|
|
468
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: highlightedHtml } }),
|
|
458
469
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
459
470
|
"button",
|
|
460
471
|
{
|
|
@@ -572,6 +583,28 @@ var useNotification = () => {
|
|
|
572
583
|
}
|
|
573
584
|
return context;
|
|
574
585
|
};
|
|
586
|
+
var ConfirmDialog = ({
|
|
587
|
+
open,
|
|
588
|
+
title,
|
|
589
|
+
message,
|
|
590
|
+
confirmText = "Confirm",
|
|
591
|
+
cancelText = "Cancel",
|
|
592
|
+
confirmColor = "primary",
|
|
593
|
+
onConfirm,
|
|
594
|
+
onCancel
|
|
595
|
+
}) => {
|
|
596
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(material.Dialog, { open, onClose: onCancel, maxWidth: "xs", fullWidth: true, slotProps: { paper: { sx: { borderRadius: 4 } } }, children: [
|
|
597
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogTitle, { children: /* @__PURE__ */ jsxRuntime.jsxs(material.Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
598
|
+
/* @__PURE__ */ jsxRuntime.jsx(WarningAmberIcon__default.default, { color: confirmColor }),
|
|
599
|
+
title
|
|
600
|
+
] }) }),
|
|
601
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.DialogContent, { children: /* @__PURE__ */ jsxRuntime.jsx(material.Typography, { variant: "body1", children: message }) }),
|
|
602
|
+
/* @__PURE__ */ jsxRuntime.jsxs(material.DialogActions, { sx: { px: 3, pb: 2 }, children: [
|
|
603
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: onCancel, variant: "outlined", children: cancelText }),
|
|
604
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Button, { onClick: onConfirm, variant: "contained", color: confirmColor, autoFocus: true, children: confirmText })
|
|
605
|
+
] })
|
|
606
|
+
] });
|
|
607
|
+
};
|
|
575
608
|
|
|
576
609
|
// src/theme/tokens.ts
|
|
577
610
|
var tokens_exports = {};
|
|
@@ -1373,6 +1406,7 @@ var PermissionManager = class {
|
|
|
1373
1406
|
PermissionManager.cachedPermissions = null;
|
|
1374
1407
|
|
|
1375
1408
|
exports.AuthProvider = AuthProvider;
|
|
1409
|
+
exports.ConfirmDialog = ConfirmDialog;
|
|
1376
1410
|
exports.HttpClient = HttpClient;
|
|
1377
1411
|
exports.LocalStorage = LocalStorage;
|
|
1378
1412
|
exports.NotificationProvider = NotificationProvider;
|