@surrealdb/ui 1.0.4 → 1.0.5

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.
Files changed (4) hide show
  1. package/dist/ui.d.ts +124 -145
  2. package/dist/ui.js +15770 -8633
  3. package/dist/ui.js.map +1 -1
  4. package/package.json +18 -4
package/dist/ui.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AlertProps } from '@mantine/core';
1
2
  import { BoxProps } from '@mantine/core';
2
3
  import { FC } from 'react';
3
4
  import { Highlighter } from '@lezer/highlight';
@@ -5,11 +6,11 @@ import { HighlightStyle } from '@codemirror/language';
5
6
  import { HTMLAttributes } from 'react';
6
7
  import { MantineColor } from '@mantine/core';
7
8
  import { MantineColorScheme } from '@mantine/core';
8
- import { MantineColorShade } from '@mantine/core';
9
- import { MantineColorsTuple } from '@mantine/core';
10
9
  import { MantineFontSize } from '@mantine/core';
11
- import { MantineRadius } from '@mantine/core';
12
- import { VariantColorsResolver } from '@mantine/core';
10
+ import { MantineThemeOverride } from '@mantine/core';
11
+ import type * as React_2 from 'react';
12
+ import { ReactNode } from 'react';
13
+ import { Root } from 'mdast';
13
14
 
14
15
  declare type AnyFn = (...rest: any[]) => any;
15
16
 
@@ -86,6 +87,17 @@ export declare const brandYouTube: string;
86
87
 
87
88
  export declare function clsx(...args: unknown[]): string;
88
89
 
90
+ /**
91
+ * Enhanced code block component with copy button, title, and highlight regions
92
+ */
93
+ export declare const CodeBlock: FC<CodeBlockProps>;
94
+
95
+ export declare interface CodeBlockProps extends Omit<BoxProps, "children"> {
96
+ title?: string;
97
+ value: string;
98
+ lang?: string;
99
+ }
100
+
89
101
  export declare type ColorScheme = keyof ThemeConfig;
90
102
 
91
103
  /**
@@ -93,16 +105,39 @@ export declare type ColorScheme = keyof ThemeConfig;
93
105
  */
94
106
  export declare function createHighlighter(colorScheme: ColorScheme): Highlighter;
95
107
 
108
+ /**
109
+ * Create markdown components for use with hast-util-to-jsx-runtime
110
+ * Props come directly from HAST (hProperties are merged into props)
111
+ */
112
+ export declare function createMarkdownComponents(): Record<string, React_2.ComponentType<Record<string, unknown>>>;
113
+
96
114
  export declare type DefaultSort = {
97
115
  [key: string]: unknown;
98
116
  };
99
117
 
118
+ export declare interface ExtractedCode {
119
+ test?: string;
120
+ code: string;
121
+ }
122
+
123
+ /**
124
+ * Extract test code from block comments at the start.
125
+ * Pattern: block comment (slash-star-star ... star-slash) followed by code
126
+ */
127
+ export declare function extractTest(input: string): ExtractedCode;
128
+
100
129
  export declare const Highlighting: FC<HighlightingProps>;
101
130
 
102
131
  export declare interface HighlightingProps extends BoxProps {
103
132
  value: string;
104
133
  language: string;
105
134
  colorScheme?: MantineColorScheme;
135
+ highlightRegions?: HighlightRegion[];
136
+ }
137
+
138
+ export declare interface HighlightRegion {
139
+ start: number;
140
+ end: number;
106
141
  }
107
142
 
108
143
  export declare const Icon: FC<IconProps>;
@@ -412,147 +447,49 @@ export declare const iconXml: string;
412
447
  /**
413
448
  * The Mantine theme configurtation
414
449
  */
415
- export declare const MANTINE_THEME: {
416
- focusRing?: "auto" | "always" | "never" | undefined;
417
- scale?: number | undefined;
418
- fontSmoothing?: boolean | undefined;
419
- white?: string | undefined;
420
- black?: string | undefined;
421
- colors?: {
422
- [x: string & {}]: MantineColorsTuple | undefined;
423
- dark?: MantineColorsTuple | undefined;
424
- gray?: MantineColorsTuple | undefined;
425
- red?: MantineColorsTuple | undefined;
426
- pink?: MantineColorsTuple | undefined;
427
- grape?: MantineColorsTuple | undefined;
428
- violet?: MantineColorsTuple | undefined;
429
- indigo?: MantineColorsTuple | undefined;
430
- blue?: MantineColorsTuple | undefined;
431
- cyan?: MantineColorsTuple | undefined;
432
- green?: MantineColorsTuple | undefined;
433
- lime?: MantineColorsTuple | undefined;
434
- yellow?: MantineColorsTuple | undefined;
435
- orange?: MantineColorsTuple | undefined;
436
- teal?: MantineColorsTuple | undefined;
437
- } | undefined;
438
- primaryShade?: MantineColorShade | {
439
- light?: MantineColorShade | undefined;
440
- dark?: MantineColorShade | undefined;
441
- } | undefined;
442
- primaryColor?: string | undefined;
443
- variantColorResolver?: VariantColorsResolver | undefined;
444
- autoContrast?: boolean | undefined;
445
- luminanceThreshold?: number | undefined;
446
- fontFamily?: string | undefined;
447
- fontFamilyMonospace?: string | undefined;
448
- headings?: {
449
- fontFamily?: string | undefined;
450
- fontWeight?: string | undefined;
451
- textWrap?: "balance" | "nowrap" | "wrap" | "stable" | "pretty" | undefined;
452
- sizes?: {
453
- h1?: {
454
- fontSize?: string | undefined;
455
- fontWeight?: string | undefined;
456
- lineHeight?: string | undefined;
457
- } | undefined;
458
- h2?: {
459
- fontSize?: string | undefined;
460
- fontWeight?: string | undefined;
461
- lineHeight?: string | undefined;
462
- } | undefined;
463
- h3?: {
464
- fontSize?: string | undefined;
465
- fontWeight?: string | undefined;
466
- lineHeight?: string | undefined;
467
- } | undefined;
468
- h4?: {
469
- fontSize?: string | undefined;
470
- fontWeight?: string | undefined;
471
- lineHeight?: string | undefined;
472
- } | undefined;
473
- h5?: {
474
- fontSize?: string | undefined;
475
- fontWeight?: string | undefined;
476
- lineHeight?: string | undefined;
477
- } | undefined;
478
- h6?: {
479
- fontSize?: string | undefined;
480
- fontWeight?: string | undefined;
481
- lineHeight?: string | undefined;
482
- } | undefined;
483
- } | undefined;
484
- } | undefined;
485
- radius?: {
486
- [x: string & {}]: string | undefined;
487
- xs?: string | undefined;
488
- sm?: string | undefined;
489
- md?: string | undefined;
490
- lg?: string | undefined;
491
- xl?: string | undefined;
492
- } | undefined;
493
- defaultRadius?: MantineRadius | undefined;
494
- spacing?: {
495
- [x: number]: string | undefined;
496
- [x: string & {}]: string | undefined;
497
- xs?: string | undefined;
498
- sm?: string | undefined;
499
- md?: string | undefined;
500
- lg?: string | undefined;
501
- xl?: string | undefined;
502
- } | undefined;
503
- fontSizes?: {
504
- [x: string & {}]: string | undefined;
505
- xs?: string | undefined;
506
- sm?: string | undefined;
507
- md?: string | undefined;
508
- lg?: string | undefined;
509
- xl?: string | undefined;
510
- } | undefined;
511
- lineHeights?: {
512
- [x: string & {}]: string | undefined;
513
- xs?: string | undefined;
514
- sm?: string | undefined;
515
- md?: string | undefined;
516
- lg?: string | undefined;
517
- xl?: string | undefined;
518
- } | undefined;
519
- breakpoints?: {
520
- [x: string & {}]: string | undefined;
521
- xs?: string | undefined;
522
- sm?: string | undefined;
523
- md?: string | undefined;
524
- lg?: string | undefined;
525
- xl?: string | undefined;
526
- } | undefined;
527
- shadows?: {
528
- [x: string & {}]: string | undefined;
529
- xs?: string | undefined;
530
- sm?: string | undefined;
531
- md?: string | undefined;
532
- lg?: string | undefined;
533
- xl?: string | undefined;
534
- } | undefined;
535
- respectReducedMotion?: boolean | undefined;
536
- cursorType?: "default" | "pointer" | undefined;
537
- defaultGradient?: {
538
- from?: string | undefined;
539
- to?: string | undefined;
540
- deg?: number | undefined;
541
- } | undefined;
542
- activeClassName?: string | undefined;
543
- focusClassName?: string | undefined;
544
- components?: {
545
- [x: string]: {
546
- classNames?: any;
547
- styles?: any;
548
- vars?: any;
549
- defaultProps?: any;
550
- } | undefined;
551
- } | undefined;
552
- other?: {
553
- [x: string]: any;
554
- } | undefined;
555
- };
450
+ export declare const MANTINE_THEME: MantineThemeOverride;
451
+
452
+ /**
453
+ * Main Markdown component that parses markdown and renders it
454
+ * Applies stylesheet and spacing
455
+ */
456
+ export declare function Markdown({ content, components }: MarkdownProps): React_2.ReactElement;
457
+
458
+ /**
459
+ * Default markdown components
460
+ */
461
+ export declare const markdownComponents: Record<string, React_2.ComponentType<Record<string, unknown>>>;
462
+
463
+ export declare interface MarkdownProps {
464
+ /**
465
+ * Markdown content to render
466
+ */
467
+ content: string;
468
+ /**
469
+ * Optional custom component overrides
470
+ */
471
+ components?: Partial<Record<string, React_2.ComponentType<unknown>>>;
472
+ }
473
+
474
+ /**
475
+ * Note/Callout component with variants: note, important, warning, caution
476
+ */
477
+ export declare const Note: FC<NoteProps>;
478
+
479
+ export declare const NOTE_KINDS: readonly ["note", "tip", "important", "warning", "caution"];
480
+
481
+ export declare type NoteKind = (typeof NOTE_KINDS)[number];
482
+
483
+ export declare interface NoteProps extends Omit<AlertProps, "title" | "children"> {
484
+ kind: NoteKind;
485
+ title?: string;
486
+ children: ReactNode;
487
+ }
488
+
489
+ /**
490
+ * Parse markdown string to mdast (Markdown AST)
491
+ */
492
+ export declare function parseMarkdownAST(markdown: string): Root;
556
493
 
557
494
  export declare const picto2106: string;
558
495
 
@@ -1002,6 +939,48 @@ export declare const pictoZed: string;
1002
939
 
1003
940
  export declare const pictoZoomIn: string;
1004
941
 
942
+ /**
943
+ * Process highlight regions in code
944
+ */
945
+ export declare function processHighlightRegions(code: string): {
946
+ regions: HighlightRegion[];
947
+ processedCode: string;
948
+ };
949
+
950
+ /**
951
+ * Remark plugin to parse title from code block meta
952
+ * Pattern: ```js title="file.js" or ```js {title="file.js"}
953
+ */
954
+ export declare function remarkCodeTitle(): (tree: Root) => void;
955
+
956
+ /**
957
+ * Remark plugin to detect and transform GitHub-style notes in blockquotes
958
+ * Pattern: > [!note], > [!warning], > [!note: Custom Title]
959
+ */
960
+ export declare function remarkNotes(): (tree: Root) => void;
961
+
962
+ /**
963
+ * Remark plugin to add slug IDs to headings
964
+ */
965
+ export declare function remarkSlug(): (tree: Root) => void;
966
+
967
+ /**
968
+ * Render parsed markdown AST to React elements
969
+ * Uses mdast-util-to-hast and hast-util-to-jsx-runtime for rendering
970
+ */
971
+ export declare function RenderMarkdown({ ast, components, }: RenderMarkdownProps): React_2.ReactElement | null;
972
+
973
+ export declare interface RenderMarkdownProps {
974
+ /**
975
+ * Parsed markdown AST to render
976
+ */
977
+ ast: Root;
978
+ /**
979
+ * Optional custom component overrides
980
+ */
981
+ components?: Partial<Record<string, React_2.ComponentType<Record<string, unknown>> | string>>;
982
+ }
983
+
1005
984
  export declare type SortDirection = "asc" | "desc" | undefined;
1006
985
 
1007
986
  export declare interface SortHandle<T = DefaultSort> {