@01.software/sdk 0.2.9-dev.260305.4f1735b → 0.2.9-dev.260306.4e16dd4

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.
@@ -1,31 +1,115 @@
1
- import React, { CSSProperties } from 'react';
1
+ import React, { CSSProperties, JSX } from 'react';
2
2
  import { SerializedLinkNode, SerializedBlockNode } from '@payloadcms/richtext-lexical';
3
3
  import { SerializedEditorState, SerializedLexicalNode } from '@payloadcms/richtext-lexical/lexical';
4
- import { JSXConverter } from '@payloadcms/richtext-lexical/react';
5
- import { F as Form } from './payload-types-Bpi16SHO.js';
4
+ import { JSXConverters, JSXConverter } from '@payloadcms/richtext-lexical/react';
5
+ import { F as Form } from './payload-types-p9NaGmQA.js';
6
6
  import { I as ImageData } from './image-TT8lTsk5.js';
7
+ import { BundledTheme } from 'shiki';
8
+ export { BundledTheme } from 'shiki';
9
+
10
+ interface HeadingSlotProps {
11
+ tag: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
12
+ children: React.ReactNode;
13
+ node: any;
14
+ }
15
+ interface ParagraphSlotProps {
16
+ children: React.ReactNode;
17
+ isEmpty: boolean;
18
+ node: any;
19
+ }
20
+ interface BlockquoteSlotProps {
21
+ children: React.ReactNode;
22
+ node: any;
23
+ }
24
+ interface ListSlotProps {
25
+ tag: 'ul' | 'ol';
26
+ listType: string;
27
+ children: React.ReactNode;
28
+ node: any;
29
+ }
30
+ interface ListItemSlotProps {
31
+ children: React.ReactNode;
32
+ hasSubLists: boolean;
33
+ checked?: boolean;
34
+ value?: number;
35
+ node: any;
36
+ }
37
+ interface LinkSlotProps {
38
+ href: string;
39
+ target?: string;
40
+ rel?: string;
41
+ children: React.ReactNode;
42
+ node: any;
43
+ }
44
+ interface HorizontalRuleSlotProps {
45
+ node?: any;
46
+ }
47
+ interface UploadSlotProps {
48
+ src: string;
49
+ alt: string;
50
+ width?: number;
51
+ height?: number;
52
+ mimeType: string;
53
+ filename: string;
54
+ sizes?: Record<string, any>;
55
+ node: any;
56
+ }
57
+ interface TableSlotProps {
58
+ children: React.ReactNode;
59
+ node: any;
60
+ }
61
+ interface TableRowSlotProps {
62
+ children: React.ReactNode;
63
+ node: any;
64
+ }
65
+ interface TableCellSlotProps {
66
+ tag: 'th' | 'td';
67
+ children: React.ReactNode;
68
+ colSpan?: number;
69
+ rowSpan?: number;
70
+ backgroundColor?: string;
71
+ node: any;
72
+ }
73
+ interface RichTextComponents {
74
+ Heading?: React.ComponentType<HeadingSlotProps>;
75
+ Paragraph?: React.ComponentType<ParagraphSlotProps>;
76
+ Blockquote?: React.ComponentType<BlockquoteSlotProps>;
77
+ List?: React.ComponentType<ListSlotProps>;
78
+ ListItem?: React.ComponentType<ListItemSlotProps>;
79
+ Link?: React.ComponentType<LinkSlotProps>;
80
+ HorizontalRule?: React.ComponentType<HorizontalRuleSlotProps>;
81
+ Upload?: React.ComponentType<UploadSlotProps>;
82
+ Table?: React.ComponentType<TableSlotProps>;
83
+ TableRow?: React.ComponentType<TableRowSlotProps>;
84
+ TableCell?: React.ComponentType<TableCellSlotProps>;
85
+ }
86
+ interface StyledRichTextContentProps extends Omit<RichTextContentProps, 'converters' | 'disableDefaultConverters'> {
87
+ components?: RichTextComponents;
88
+ }
89
+ declare function StyledRichTextContent({ components, internalDocToHref, blocks, textState, ...props }: StyledRichTextContentProps): React.JSX.Element;
7
90
 
8
91
  type RichTextData = SerializedEditorState<SerializedLexicalNode>;
92
+ type TextStateConfig = {
93
+ [stateKey: string]: {
94
+ [stateValue: string]: {
95
+ css: Record<string, string>;
96
+ label: string;
97
+ };
98
+ };
99
+ };
9
100
  interface RichTextContentProps {
10
101
  data: RichTextData;
11
102
  className?: string;
12
103
  internalDocToHref?: (args: {
13
104
  linkNode: SerializedLinkNode;
14
105
  }) => string;
15
- blocks?: {
16
- Iframe?: JSXConverter<SerializedBlockNode<{
17
- blockName?: string | null;
18
- blockType: string;
19
- url: string;
20
- }>>;
21
- Player?: JSXConverter<SerializedBlockNode<{
22
- blockName?: string | null;
23
- blockType: string;
24
- url: string;
25
- }>>;
26
- };
106
+ converters?: Partial<JSXConverters>;
107
+ blocks?: Record<string, JSXConverter<SerializedBlockNode>>;
108
+ disableDefaultConverters?: boolean;
109
+ textState?: TextStateConfig;
27
110
  }
28
- declare function RichTextContent({ data, className, internalDocToHref, blocks, }: RichTextContentProps): React.JSX.Element;
111
+
112
+ declare function RichTextContent({ data, className, internalDocToHref, converters, blocks, disableDefaultConverters, textState, }: RichTextContentProps): React.JSX.Element;
29
113
 
30
114
  type FormField = NonNullable<Form['fields']>[number];
31
115
  type InputField = Exclude<FormField, {
@@ -96,4 +180,61 @@ interface ImageProps {
96
180
  */
97
181
  declare function Image({ image, width, dpr, placeholder: placeholderProp, className, style, imgClassName, imgStyle, sizes, loading: loadingProp, onLoad, objectFit, priority, fill, imageRendering, }: ImageProps): React.JSX.Element;
98
182
 
99
- export { type FieldRenderContext, type FormField, FormRenderer, type FormRendererProps, type FormValues, Image, type ImageProps, type InputField, RichTextContent, type RichTextContentProps, type RichTextData, type SubmissionData, toSubmissionData };
183
+ /**
184
+ * Highlight code to JSX using shiki.
185
+ * Works in both Server and Client components.
186
+ *
187
+ * @example Server Component
188
+ * ```tsx
189
+ * const highlighted = await highlight('const x = 1', 'typescript')
190
+ * return <div>{highlighted}</div>
191
+ * ```
192
+ */
193
+ declare function highlight(code: string, lang: string, theme?: BundledTheme): Promise<JSX.Element>;
194
+
195
+ interface CodeBlockProps {
196
+ /** Code string to highlight */
197
+ code: string;
198
+ /** Language identifier (e.g. 'typescript', 'js', 'python') */
199
+ language?: string;
200
+ /** Shiki theme name. Default: 'github-dark' */
201
+ theme?: BundledTheme;
202
+ /** CSS class for the wrapper */
203
+ className?: string;
204
+ /** Pre-rendered JSX from server component via `highlight()` */
205
+ initial?: JSX.Element;
206
+ /** Show line numbers. Default: false */
207
+ showLineNumbers?: boolean;
208
+ /** Show copy button. Default: true */
209
+ showCopyButton?: boolean;
210
+ }
211
+ /**
212
+ * Syntax-highlighted code block using shiki.
213
+ *
214
+ * @example Basic usage
215
+ * ```tsx
216
+ * <CodeBlock code="const x = 1" language="typescript" />
217
+ * ```
218
+ *
219
+ * @example With server pre-rendering (Next.js)
220
+ * ```tsx
221
+ * // Server Component
222
+ * const initial = await highlight(code, 'typescript')
223
+ * return <CodeBlock code={code} language="typescript" initial={initial} />
224
+ * ```
225
+ *
226
+ * @example As RichTextContent block renderer
227
+ * ```tsx
228
+ * <RichTextContent
229
+ * data={data}
230
+ * blocks={{
231
+ * Code: ({ node }) => (
232
+ * <CodeBlock code={node.fields.code} language={node.fields.language} />
233
+ * ),
234
+ * }}
235
+ * />
236
+ * ```
237
+ */
238
+ declare function CodeBlock({ code, language, theme, className, initial, showLineNumbers, showCopyButton, }: CodeBlockProps): JSX.Element;
239
+
240
+ export { type BlockquoteSlotProps, CodeBlock, type CodeBlockProps, type FieldRenderContext, type FormField, FormRenderer, type FormRendererProps, type FormValues, type HeadingSlotProps, type HorizontalRuleSlotProps, Image, type ImageProps, type InputField, type LinkSlotProps, type ListItemSlotProps, type ListSlotProps, type ParagraphSlotProps, type RichTextComponents, RichTextContent, type RichTextContentProps, type RichTextData, StyledRichTextContent, type StyledRichTextContentProps, type SubmissionData, type TableCellSlotProps, type TableRowSlotProps, type TableSlotProps, type TextStateConfig, type UploadSlotProps, highlight, toSubmissionData };