@lobehub/ui 2.16.1 → 2.16.3

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.
@@ -26,8 +26,8 @@ export var useStyles = createStyles(function (_ref, _ref2) {
26
26
  resizeHandleHighlight: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n &:hover {\n &::after {\n width: 3px;\n background: ", ";\n box-shadow: 0 0 8px ", "40;\n }\n }\n\n &:active {\n &::after {\n background: ", ";\n }\n }\n "])), token.colorPrimary, token.colorPrimary, token.colorPrimaryActive),
27
27
  resizeHandleLeft: css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n inset-inline-end: -4px;\n "]))),
28
28
  resizeHandleRight: css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n inset-inline-start: -4px;\n "]))),
29
- toggleLeft: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n inset-inline-end: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n border-inline-start-width: 0;\n border-radius: 0 ", "px ", "px 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2, token.borderRadiusLG, token.borderRadiusLG),
30
- toggleRight: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n inset-inline-start: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n border-inline-end-width: 0;\n border-radius: ", "px 0 0 ", "px; /* \u53F3\u4FA7\u9762\u677F\uFF0Chandle \u5728\u5DE6\u8FB9\uFF0C\u5DE6\u4FA7\u5706\u89D2 */\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2, token.borderRadiusLG, token.borderRadiusLG),
29
+ toggleLeft: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n inset-inline-end: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n margin-inline-start: -1px;\n border-inline-start-width: 0;\n border-radius: 0 ", "px ", "px 0;\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2, token.borderRadiusLG, token.borderRadiusLG),
30
+ toggleRight: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n inset-inline-start: -", "px;\n width: ", "px;\n height: 100%;\n\n > div {\n inset-block-start: 50%;\n\n width: ", "px;\n height: ", "px;\n margin-block-start: -", "px;\n margin-inline-end: -1px;\n border-inline-end-width: 0;\n border-radius: ", "px 0 0 ", "px; /* \u53F3\u4FA7\u9762\u677F\uFF0Chandle \u5728\u5DE6\u8FB9\uFF0C\u5DE6\u4FA7\u5706\u89D2 */\n }\n "])), LAYOUT.offset, LAYOUT.toggleShort, LAYOUT.toggleShort, LAYOUT.toggleLength, LAYOUT.toggleLength / 2, token.borderRadiusLG, token.borderRadiusLG),
31
31
  toggleRoot: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n pointer-events: none;\n position: absolute;\n z-index: 50;\n\n /* Smooth transitions for all states */\n transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1);\n\n &:has(> div) {\n pointer-events: all;\n }\n\n > div {\n pointer-events: all;\n cursor: pointer;\n\n position: absolute;\n\n border: 1px solid ", ";\n\n color: ", ";\n\n background: ", ";\n backdrop-filter: blur(8px);\n\n /* Enhanced transitions with backdrop blur */\n transition:\n color 0.2s ", ",\n transform 0.2s ", ",\n box-shadow 0.2s ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n transform: scale(0.95);\n color: ", ";\n }\n }\n "])), token.colorBorder, token.colorTextTertiary, backgroundColor || token.colorBgLayout, token.motionEaseOut, token.motionEaseOut, token.motionEaseOut, token.colorTextSecondary, token.colorText)
32
32
  };
33
33
  });
@@ -2,44 +2,12 @@ import type { NumberSize } from 're-resizable';
2
2
  import type { CSSProperties, ReactNode } from 'react';
3
3
  import type { DivProps } from "../types";
4
4
  export interface DraggableSideNavProps extends Omit<DivProps, 'children' | 'onSelect'> {
5
- /**
6
- * Animation configuration for content transitions
7
- * Set to false to disable all animations
8
- * @default undefined
9
- */
10
- animation?: false | {
11
- /**
12
- * Enable blur effect during transitions
13
- * @default false
14
- */
15
- blur?: boolean;
16
- /**
17
- * Enable animation for body section
18
- * @default false
19
- */
20
- body?: boolean;
21
- /**
22
- * Enable fade effect during transitions
23
- * @default true
24
- */
25
- fade?: boolean;
26
- /**
27
- * Enable animation for footer section
28
- * @default false
29
- */
30
- footer?: boolean;
31
- /**
32
- * Enable animation for header section
33
- * @default false
34
- */
35
- header?: boolean;
36
- };
37
5
  backgroundColor?: string;
38
6
  /**
39
7
  * Body content (main content area)
40
- * Can be a static element or a function that receives expand state
8
+ * Function that receives expand state
41
9
  */
42
- children: ReactNode | ((expand: boolean) => ReactNode);
10
+ body: (expand: boolean) => ReactNode;
43
11
  /**
44
12
  * Classnames for internal components
45
13
  */
@@ -84,7 +52,8 @@ export interface DraggableSideNavProps extends Omit<DivProps, 'children' | 'onSe
84
52
  */
85
53
  maxWidth?: number;
86
54
  /**
87
- * Minimum width (also the collapsed width)
55
+ * Minimum width when expanded (does not affect collapsed width which is always 64px)
56
+ * Only applies when the panel is in expanded state
88
57
  * @default 64
89
58
  */
90
59
  minWidth?: number;
@@ -45,18 +45,6 @@ export declare function escapeTextUnderscores(text: string): string;
45
45
  * @returns The string with currency dollar signs escaped
46
46
  */
47
47
  export declare function escapeCurrencyDollars(text: string): string;
48
- /**
49
- * Preprocesses LaTeX content by performing multiple operations:
50
- * 1. Protects code blocks from processing
51
- * 2. Protects existing LaTeX expressions
52
- * 3. Escapes dollar signs that likely represent currency
53
- * 4. Converts LaTeX delimiters
54
- * 5. Escapes mhchem commands and pipes
55
- *
56
- * @param content The input string containing LaTeX expressions
57
- * @returns The processed string with proper LaTeX formatting
58
- */
59
- export declare function preprocessLaTeX(str: string): string;
60
48
  /**
61
49
  * Checks if the last LaTeX formula in the text is renderable.
62
50
  * Only validates the formula after the last $$ if there's an odd number of $$.
@@ -65,3 +53,127 @@ export declare function preprocessLaTeX(str: string): string;
65
53
  * @returns True if the last formula is renderable or if there's no incomplete formula
66
54
  */
67
55
  export declare const isLastFormulaRenderable: (text: string) => boolean;
56
+ /**
57
+ * Fixes common LaTeX syntax errors automatically
58
+ * - Balances unmatched braces
59
+ * - Balances \left and \right delimiters
60
+ *
61
+ * @param text The input string containing LaTeX expressions
62
+ * @returns The string with fixed LaTeX expressions
63
+ */
64
+ export declare function fixCommonLaTeXErrors(text: string): string;
65
+ /**
66
+ * Normalizes whitespace in LaTeX expressions
67
+ * - Removes extra spaces around $ delimiters
68
+ * - Normalizes multiple spaces to single space inside formulas
69
+ *
70
+ * @param text The input string containing LaTeX expressions
71
+ * @returns The string with normalized whitespace
72
+ */
73
+ export declare function normalizeLatexSpacing(text: string): string;
74
+ /**
75
+ * Validates all LaTeX expressions in the text
76
+ * Returns detailed information about validation results
77
+ *
78
+ * @param text The input string containing LaTeX expressions
79
+ * @returns Validation results with errors if any
80
+ */
81
+ export declare function validateLatexExpressions(text: string): {
82
+ errors: Array<{
83
+ formula: string;
84
+ message: string;
85
+ position: number;
86
+ type: 'display' | 'inline';
87
+ }>;
88
+ totalExpressions: number;
89
+ valid: boolean;
90
+ };
91
+ /**
92
+ * Handles CJK (Chinese, Japanese, Korean) characters mixed with LaTeX
93
+ * Optionally adds spaces between CJK characters and LaTeX expressions for better rendering
94
+ *
95
+ * @param text The input string
96
+ * @param addSpaces Whether to add spaces between CJK and LaTeX (default: false)
97
+ * @returns The processed string
98
+ */
99
+ export declare function handleCJKWithLatex(text: string, addSpaces?: boolean): string;
100
+ export interface AdvancedPreprocessOptions {
101
+ /** Add spaces between CJK and LaTeX (default: false, requires handleCJK: true) */
102
+ addCJKSpaces?: boolean;
103
+ /** Convert bracket notation \[...\] to $$...$$ (default: true) */
104
+ convertBrackets?: boolean;
105
+ /** Enable currency escaping (default: true) */
106
+ escapeCurrency?: boolean;
107
+ /** Escape mhchem commands (default: true) */
108
+ escapeMhchem?: boolean;
109
+ /** Escape pipe symbols in LaTeX (default: true) */
110
+ escapePipes?: boolean;
111
+ /** Escape underscores in \text{} (default: true) */
112
+ escapeUnderscores?: boolean;
113
+ /** Automatically fix common LaTeX errors (default: false) */
114
+ fixErrors?: boolean;
115
+ /** Handle CJK characters (default: false) */
116
+ handleCJK?: boolean;
117
+ /** Normalize whitespace (default: false) */
118
+ normalizeSpacing?: boolean;
119
+ /** Throw error on validation failure (default: false, requires validate: true) */
120
+ throwOnValidationError?: boolean;
121
+ /** Validate LaTeX syntax (default: false) */
122
+ validate?: boolean;
123
+ }
124
+ /**
125
+ * Comprehensive LaTeX preprocessing with configurable options
126
+ *
127
+ * This is the main preprocessing function that handles:
128
+ * - Currency symbol escaping (e.g., $20 → \$20)
129
+ * - LaTeX delimiter conversion (\[...\] → $$...$$)
130
+ * - Special character escaping (pipes, underscores, mhchem)
131
+ * - Optional error fixing and validation
132
+ * - Optional CJK character handling
133
+ *
134
+ * @param text The input string containing LaTeX and Markdown
135
+ * @param options Configuration options for fine-grained control
136
+ * @returns The preprocessed string
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * // Default behavior (same as old preprocessLaTeX)
141
+ * preprocessLaTeX('向量$90^\\circ$,非 $0^\\circ$ 和 $180^\\circ$')
142
+ *
143
+ * // With custom options
144
+ * preprocessLaTeX(text, {
145
+ * fixErrors: true,
146
+ * validate: true,
147
+ * handleCJK: true
148
+ * })
149
+ * ```
150
+ */
151
+ export declare function preprocessLaTeX(text: string, options?: AdvancedPreprocessOptions): string;
152
+ /**
153
+ * Strict preprocessing mode - enables all safety features and validations
154
+ * Use this when you want maximum correctness and are willing to accept the performance cost
155
+ *
156
+ * @param text The input string
157
+ * @returns The preprocessed string with all features enabled
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * const processed = preprocessLaTeXStrict(userInput)
162
+ * // Enables: error fixing, validation, CJK handling, space normalization
163
+ * ```
164
+ */
165
+ export declare function preprocessLaTeXStrict(text: string): string;
166
+ /**
167
+ * Minimal preprocessing mode - only essential operations
168
+ * Use this for better performance when you control the input
169
+ *
170
+ * @param text The input string
171
+ * @returns The preprocessed string with minimal processing
172
+ *
173
+ * @example
174
+ * ```ts
175
+ * const processed = preprocessLaTeXMinimal(trustedInput)
176
+ * // Only escapes currency and converts brackets
177
+ * ```
178
+ */
179
+ export declare function preprocessLaTeXMinimal(text: string): string;