@yamlresume/playground 0.11.0
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/LICENSE +21 -0
- package/README.md +172 -0
- package/dist/index.d.ts +693 -0
- package/dist/index.js +289 -0
- package/dist/index.js.map +1 -0
- package/package.json +71 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,693 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { OnMount } from '@monaco-editor/react';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ReactNode, PropsWithChildren } from 'react';
|
|
5
|
+
import { Resume, LayoutEngine } from '@yamlresume/core';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Props for the Editor component.
|
|
9
|
+
*/
|
|
10
|
+
interface EditorProps {
|
|
11
|
+
/** The content of the editor. */
|
|
12
|
+
value: string;
|
|
13
|
+
/** Callback triggered when content changes. */
|
|
14
|
+
onChange?: (value: string | undefined) => void;
|
|
15
|
+
/** The language of the content. */
|
|
16
|
+
language: string;
|
|
17
|
+
/** Whether the editor is read-only. Defaults to false. */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
/** Whether to show line numbers. Defaults to true. */
|
|
20
|
+
lineNumbers?: boolean;
|
|
21
|
+
/** Whether to show the minimap. Defaults to true. */
|
|
22
|
+
/** Whether to show the minimap. Defaults to true. */
|
|
23
|
+
minimap?: boolean;
|
|
24
|
+
/** Callback triggered when the editor is mounted. */
|
|
25
|
+
onMount?: OnMount;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A shared editor component based on Monaco Editor.
|
|
29
|
+
* Encapsulates theme handling, common configuration, and LaTeX support.
|
|
30
|
+
*
|
|
31
|
+
* @param props - The component props.
|
|
32
|
+
* @returns The rendered Editor component.
|
|
33
|
+
*/
|
|
34
|
+
declare function Editor({ value, onChange, language, readOnly, lineNumbers, minimap, onMount, }: EditorProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* MIT License
|
|
38
|
+
*
|
|
39
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
40
|
+
*
|
|
41
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
* of this software and associated documentation files (the "Software"), to
|
|
43
|
+
* deal in the Software without restriction, including without limitation the
|
|
44
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
45
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
* furnished to do so, subject to the following conditions:
|
|
47
|
+
*
|
|
48
|
+
* The above copyright notice and this permission notice shall be included in
|
|
49
|
+
* all copies or substantial portions of the Software.
|
|
50
|
+
*
|
|
51
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
56
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
57
|
+
* IN THE SOFTWARE.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Props for the EditorPanel component.
|
|
61
|
+
*/
|
|
62
|
+
interface EditorPanelProps {
|
|
63
|
+
/** The current YAML content of the editor. */
|
|
64
|
+
value: string;
|
|
65
|
+
/** Callback triggered when the content changes. */
|
|
66
|
+
onChange: (value: string) => void;
|
|
67
|
+
/** The name of the file being edited. */
|
|
68
|
+
filename?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A panel component containing the resume editor.
|
|
72
|
+
*
|
|
73
|
+
* @param props - The component props.
|
|
74
|
+
* @returns The rendered editor panel.
|
|
75
|
+
*/
|
|
76
|
+
declare function EditorPanel({ value, onChange, filename }: EditorPanelProps): react_jsx_runtime.JSX.Element;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Props for the ResumeEditor component.
|
|
80
|
+
*/
|
|
81
|
+
interface ResumeEditorProps {
|
|
82
|
+
/**
|
|
83
|
+
* The current value of the YAML resume.
|
|
84
|
+
*/
|
|
85
|
+
value: string;
|
|
86
|
+
/**
|
|
87
|
+
* Callback triggered when the editor content changes.
|
|
88
|
+
* @param value - The new value of the editor content.
|
|
89
|
+
*/
|
|
90
|
+
onChange: (value: string | undefined) => void;
|
|
91
|
+
/** Callback triggered when the editor is mounted. */
|
|
92
|
+
onMount?: OnMount;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A specialized editor component for editing the resume YAML content.
|
|
96
|
+
*
|
|
97
|
+
* This component wraps the shared {@link Editor} component, pre-configured
|
|
98
|
+
* for YAML editing.
|
|
99
|
+
*
|
|
100
|
+
* @param props - The component props.
|
|
101
|
+
* @param props.value - The string content to display in the editor.
|
|
102
|
+
* @param props.onChange - Handler called when content is modified.
|
|
103
|
+
* @returns The rendered editor component.
|
|
104
|
+
*/
|
|
105
|
+
declare function ResumeEditor({ value, onChange, onMount }: ResumeEditorProps): react_jsx_runtime.JSX.Element;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* MIT License
|
|
109
|
+
*
|
|
110
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
111
|
+
*
|
|
112
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
113
|
+
* of this software and associated documentation files (the "Software"), to
|
|
114
|
+
* deal in the Software without restriction, including without limitation the
|
|
115
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
116
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
117
|
+
* furnished to do so, subject to the following conditions:
|
|
118
|
+
*
|
|
119
|
+
* The above copyright notice and this permission notice shall be included in
|
|
120
|
+
* all copies or substantial portions of the Software.
|
|
121
|
+
*
|
|
122
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
123
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
124
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
125
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
126
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
127
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
128
|
+
* IN THE SOFTWARE.
|
|
129
|
+
*/
|
|
130
|
+
/**
|
|
131
|
+
* Props for the Playground component.
|
|
132
|
+
*/
|
|
133
|
+
interface PlaygroundProps {
|
|
134
|
+
/** YAML content for the playground editor. Defaults to DEFAULT_YAML. */
|
|
135
|
+
yaml?: string;
|
|
136
|
+
/** Callback triggered when the content changes. */
|
|
137
|
+
onChange?: (value: string) => void;
|
|
138
|
+
/** The name of the file being edited. */
|
|
139
|
+
filename?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Main Playground component providing a split-view interface for editing and
|
|
143
|
+
* previewing resumes.
|
|
144
|
+
*
|
|
145
|
+
* On desktop (md+), shows side-by-side resizable panels.
|
|
146
|
+
* On mobile, shows a tab-based interface to switch between Editor and Preview.
|
|
147
|
+
*
|
|
148
|
+
* @param props - The component props.
|
|
149
|
+
* @returns The rendered Playground component.
|
|
150
|
+
*/
|
|
151
|
+
declare function Playground({ yaml: yamlStr, onChange, filename, }: PlaygroundProps): react_jsx_runtime.JSX.Element;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Props for the PlaygroundDesktop component.
|
|
155
|
+
*/
|
|
156
|
+
interface PlaygroundDesktopProps {
|
|
157
|
+
/** The editor panel content to render. */
|
|
158
|
+
editorPanel: ReactNode;
|
|
159
|
+
/** The preview panel content to render. */
|
|
160
|
+
previewPanel: ReactNode;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* The desktop layout component for the playground.
|
|
164
|
+
* Shows a side-by-side resizable panel layout.
|
|
165
|
+
* This component is only visible on medium and larger screens (hidden on mobile).
|
|
166
|
+
*
|
|
167
|
+
* @param props - The component props.
|
|
168
|
+
* @returns The rendered desktop layout.
|
|
169
|
+
*/
|
|
170
|
+
declare function PlaygroundDesktop({ editorPanel, previewPanel, }: PlaygroundDesktopProps): react_jsx_runtime.JSX.Element;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Props for the PlaygroundMobile component.
|
|
174
|
+
*/
|
|
175
|
+
interface PlaygroundMobileProps {
|
|
176
|
+
/** The editor panel content to render. */
|
|
177
|
+
editorPanel: ReactNode;
|
|
178
|
+
/** The preview panel content to render. */
|
|
179
|
+
previewPanel: ReactNode;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The mobile layout component for the playground.
|
|
183
|
+
* Shows either the editor or preview panel based on the active tab.
|
|
184
|
+
* This component is only visible on small screens (hidden on md+).
|
|
185
|
+
*
|
|
186
|
+
* @param props - The component props.
|
|
187
|
+
* @returns The rendered mobile layout.
|
|
188
|
+
*/
|
|
189
|
+
declare function PlaygroundMobile({ editorPanel, previewPanel, }: PlaygroundMobileProps): react_jsx_runtime.JSX.Element;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* MIT License
|
|
193
|
+
*
|
|
194
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
195
|
+
*
|
|
196
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
197
|
+
* of this software and associated documentation files (the "Software"), to
|
|
198
|
+
* deal in the Software without restriction, including without limitation the
|
|
199
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
200
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
201
|
+
* furnished to do so, subject to the following conditions:
|
|
202
|
+
*
|
|
203
|
+
* The above copyright notice and this permission notice shall be included in
|
|
204
|
+
* all copies or substantial portions of the Software.
|
|
205
|
+
*
|
|
206
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
207
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
208
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
209
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
210
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
211
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
212
|
+
* IN THE SOFTWARE.
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* Props for the CodeViewer component.
|
|
216
|
+
*/
|
|
217
|
+
interface CodeViewerProps {
|
|
218
|
+
/** The code content to display. */
|
|
219
|
+
content: string;
|
|
220
|
+
/** The language of the code (markdown or latex). */
|
|
221
|
+
language: 'markdown' | 'latex' | 'yaml';
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Component to preview code (Markdown or LaTeX) using Monaco Editor.
|
|
225
|
+
*
|
|
226
|
+
* @param props - The props for the CodePreview component.
|
|
227
|
+
* @returns The rendered Monaco Editor.
|
|
228
|
+
*/
|
|
229
|
+
declare function CodeViewer({ content, language }: CodeViewerProps): react_jsx_runtime.JSX.Element;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* MIT License
|
|
233
|
+
*
|
|
234
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
235
|
+
*
|
|
236
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
237
|
+
* of this software and associated documentation files (the "Software"), to
|
|
238
|
+
* deal in the Software without restriction, including without limitation the
|
|
239
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
240
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
241
|
+
* furnished to do so, subject to the following conditions:
|
|
242
|
+
*
|
|
243
|
+
* The above copyright notice and this permission notice shall be included in
|
|
244
|
+
* all copies or substantial portions of the Software.
|
|
245
|
+
*
|
|
246
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
247
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
248
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
249
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
250
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
251
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
252
|
+
* IN THE SOFTWARE.
|
|
253
|
+
*/
|
|
254
|
+
/**
|
|
255
|
+
* Props for the HtmlViewer component.
|
|
256
|
+
*/
|
|
257
|
+
interface HtmlViewerProps {
|
|
258
|
+
/** The HTML content to render. */
|
|
259
|
+
content: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Component to preview HTML content in an iframe.
|
|
263
|
+
*
|
|
264
|
+
* @param props - The props for the HtmlPreview component.
|
|
265
|
+
* @returns The rendered iframe element.
|
|
266
|
+
*/
|
|
267
|
+
declare function HtmlViewer({ content }: HtmlViewerProps): react_jsx_runtime.JSX.Element;
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Props for the PreviewPanel component.
|
|
271
|
+
*/
|
|
272
|
+
interface PreviewPanelProps {
|
|
273
|
+
/** The index of the currently active layout. */
|
|
274
|
+
activeLayoutIndex: number;
|
|
275
|
+
/** The name of the file being edited. */
|
|
276
|
+
filename?: string;
|
|
277
|
+
/** The parsed resume object. */
|
|
278
|
+
resume: Resume | null;
|
|
279
|
+
/** Callback to change the active layout index. */
|
|
280
|
+
setActiveLayoutIndex: (index: number) => void;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* A panel component containing the resume preview, layout selector tabs, and actions.
|
|
284
|
+
*
|
|
285
|
+
* @param props - The component props.
|
|
286
|
+
* @returns The rendered preview panel.
|
|
287
|
+
*/
|
|
288
|
+
declare function PreviewPanel({ activeLayoutIndex, filename, resume, setActiveLayoutIndex, }: PreviewPanelProps): react_jsx_runtime.JSX.Element;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Props for the ResumeViewer component.
|
|
292
|
+
*/
|
|
293
|
+
interface ResumeViewerProps {
|
|
294
|
+
/** The pre-parsed resume object. */
|
|
295
|
+
resume: Resume | null;
|
|
296
|
+
/** The index of the layout to use for rendering. */
|
|
297
|
+
layoutIndex: number;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* ResumeViewer component responsible for rendering the appropriate preview
|
|
301
|
+
* (HTML, Markdown, or LaTeX) based on the selected layout.
|
|
302
|
+
*
|
|
303
|
+
* @param props - The props for the ResumeViewer component.
|
|
304
|
+
* @returns The rendered ResumeViewer component.
|
|
305
|
+
*/
|
|
306
|
+
declare function ResumeViewer({ resume, layoutIndex }: ResumeViewerProps): react_jsx_runtime.JSX.Element;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* A styled panel container component for the Playground.
|
|
310
|
+
*
|
|
311
|
+
* Provides consistent styling including:
|
|
312
|
+
* - Flexbox layout for content organization
|
|
313
|
+
* - Shadow effect for visual depth
|
|
314
|
+
* - Border styling for clear boundaries
|
|
315
|
+
*
|
|
316
|
+
* @param props - The component props.
|
|
317
|
+
* @returns The rendered panel container.
|
|
318
|
+
*/
|
|
319
|
+
declare function Panel({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* A shared container for panel content.
|
|
323
|
+
* Provides a flexible layout for the main content area of a panel.
|
|
324
|
+
*
|
|
325
|
+
* @param props - The component props.
|
|
326
|
+
* @returns The rendered content container.
|
|
327
|
+
*/
|
|
328
|
+
declare function PanelContent({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* MIT License
|
|
332
|
+
*
|
|
333
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
334
|
+
*
|
|
335
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
336
|
+
* of this software and associated documentation files (the "Software"), to
|
|
337
|
+
* deal in the Software without restriction, including without limitation the
|
|
338
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
339
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
340
|
+
* furnished to do so, subject to the following conditions:
|
|
341
|
+
*
|
|
342
|
+
* The above copyright notice and this permission notice shall be included in
|
|
343
|
+
* all copies or substantial portions of the Software.
|
|
344
|
+
*
|
|
345
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
346
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
347
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
348
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
349
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
350
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
351
|
+
* IN THE SOFTWARE.
|
|
352
|
+
*/
|
|
353
|
+
/**
|
|
354
|
+
* A separator component for the Playground.
|
|
355
|
+
*
|
|
356
|
+
* @returns The rendered separator.
|
|
357
|
+
*/
|
|
358
|
+
declare function PanelSeparator(): react_jsx_runtime.JSX.Element;
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* A shared toolbar component for panels.
|
|
362
|
+
*
|
|
363
|
+
* @param props - The component props.
|
|
364
|
+
* @returns The rendered toolbar.
|
|
365
|
+
*/
|
|
366
|
+
declare function PanelToolbar({ children }: PropsWithChildren): react_jsx_runtime.JSX.Element;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Props for the ToolbarButton component.
|
|
370
|
+
*/
|
|
371
|
+
interface ToolbarButtonProps {
|
|
372
|
+
/** Callback triggered when the button is clicked. */
|
|
373
|
+
onClick: () => void;
|
|
374
|
+
/** The content to be rendered inside the button, typically an icon. */
|
|
375
|
+
children: ReactNode;
|
|
376
|
+
/** The tooltip text displayed when hovering over the button. */
|
|
377
|
+
title: string;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* A generic button component used in the playground toolbar.
|
|
381
|
+
*
|
|
382
|
+
* It provides consistent styling and behavior for all toolbar actions.
|
|
383
|
+
*
|
|
384
|
+
* @param props - The component props.
|
|
385
|
+
* @returns The rendered toolbar button.
|
|
386
|
+
*/
|
|
387
|
+
declare function ToolbarButton({ onClick, children, title, }: ToolbarButtonProps): react_jsx_runtime.JSX.Element;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* MIT License
|
|
391
|
+
*
|
|
392
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
393
|
+
*
|
|
394
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
395
|
+
* of this software and associated documentation files (the "Software"), to
|
|
396
|
+
* deal in the Software without restriction, including without limitation the
|
|
397
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
398
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
399
|
+
* furnished to do so, subject to the following conditions:
|
|
400
|
+
*
|
|
401
|
+
* The above copyright notice and this permission notice shall be included in
|
|
402
|
+
* all copies or substantial portions of the Software.
|
|
403
|
+
*
|
|
404
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
405
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
406
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
407
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
408
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
409
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
410
|
+
* IN THE SOFTWARE.
|
|
411
|
+
*/
|
|
412
|
+
/**
|
|
413
|
+
* Props for the ToolbarCopyButton component.
|
|
414
|
+
*/
|
|
415
|
+
interface ToolbarCopyButtonProps {
|
|
416
|
+
/** Callback triggered to perform the copy action. Can be async. */
|
|
417
|
+
onClick: () => Promise<void> | void;
|
|
418
|
+
/** The tooltip text. Defaults to 'Copy'. */
|
|
419
|
+
title?: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* A toolbar button for copying content to the clipboard.
|
|
423
|
+
* It temporarily changes the icon to a checkmark upon successful copy.
|
|
424
|
+
*
|
|
425
|
+
* @param props - The component props.
|
|
426
|
+
* @returns The rendered copy button.
|
|
427
|
+
*/
|
|
428
|
+
declare function ToolbarCopyButton({ onClick, title, }: ToolbarCopyButtonProps): react_jsx_runtime.JSX.Element;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* MIT License
|
|
432
|
+
*
|
|
433
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
434
|
+
*
|
|
435
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
436
|
+
* of this software and associated documentation files (the "Software"), to
|
|
437
|
+
* deal in the Software without restriction, including without limitation the
|
|
438
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
439
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
440
|
+
* furnished to do so, subject to the following conditions:
|
|
441
|
+
*
|
|
442
|
+
* The above copyright notice and this permission notice shall be included in
|
|
443
|
+
* all copies or substantial portions of the Software.
|
|
444
|
+
*
|
|
445
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
446
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
447
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
448
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
449
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
450
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
451
|
+
* IN THE SOFTWARE.
|
|
452
|
+
*/
|
|
453
|
+
/**
|
|
454
|
+
* A toolbar separator component.
|
|
455
|
+
*
|
|
456
|
+
* @returns The rendered separator.
|
|
457
|
+
*/
|
|
458
|
+
declare function ToolbarSeparator(): react_jsx_runtime.JSX.Element;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* MIT License
|
|
462
|
+
*
|
|
463
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
464
|
+
*
|
|
465
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
466
|
+
* of this software and associated documentation files (the "Software"), to
|
|
467
|
+
* deal in the Software without restriction, including without limitation the
|
|
468
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
469
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
470
|
+
* furnished to do so, subject to the following conditions:
|
|
471
|
+
*
|
|
472
|
+
* The above copyright notice and this permission notice shall be included in
|
|
473
|
+
* all copies or substantial portions of the Software.
|
|
474
|
+
*
|
|
475
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
476
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
477
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
478
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
479
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
480
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
481
|
+
* IN THE SOFTWARE.
|
|
482
|
+
*/
|
|
483
|
+
declare const ICON_SIZES: {
|
|
484
|
+
xs: number;
|
|
485
|
+
sm: number;
|
|
486
|
+
md: number;
|
|
487
|
+
lg: number;
|
|
488
|
+
xl: number;
|
|
489
|
+
};
|
|
490
|
+
declare const ICON_STROKES: {
|
|
491
|
+
xs: number;
|
|
492
|
+
sm: number;
|
|
493
|
+
md: number;
|
|
494
|
+
lg: number;
|
|
495
|
+
xl: number;
|
|
496
|
+
};
|
|
497
|
+
declare const EDITOR_BG_COLOR = "#1e1e1e";
|
|
498
|
+
declare const EDITOR_FONT_SIZE = 14;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* MIT License
|
|
502
|
+
*
|
|
503
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
504
|
+
*
|
|
505
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
506
|
+
* of this software and associated documentation files (the "Software"), to
|
|
507
|
+
* deal in the Software without restriction, including without limitation the
|
|
508
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
509
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
510
|
+
* furnished to do so, subject to the following conditions:
|
|
511
|
+
*
|
|
512
|
+
* The above copyright notice and this permission notice shall be included in
|
|
513
|
+
* all copies or substantial portions of the Software.
|
|
514
|
+
*
|
|
515
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
516
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
517
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
518
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
519
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
520
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
521
|
+
* IN THE SOFTWARE.
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Props for the `useResumeRenderer` hook.
|
|
526
|
+
*
|
|
527
|
+
* @property {Resume | null} resume - The pre-parsed resume object to render.
|
|
528
|
+
* Pass `null` when the resume is not yet available or parsing failed.
|
|
529
|
+
* @property {number} layoutIndex - The index of the layout to use for rendering.
|
|
530
|
+
* Must be a valid index within the `resume.layouts` array.
|
|
531
|
+
*/
|
|
532
|
+
interface UseResumeRendererProps {
|
|
533
|
+
resume: Resume | null;
|
|
534
|
+
layoutIndex: number;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* A React hook for rendering a resume using a specified layout.
|
|
538
|
+
*
|
|
539
|
+
* @description
|
|
540
|
+
* This hook encapsulates the logic for:
|
|
541
|
+
* - Selecting the appropriate layout from the resume's layouts array
|
|
542
|
+
* - Determining the rendering engine (html, markdown, or latex)
|
|
543
|
+
* - Generating the rendered output content
|
|
544
|
+
* - Handling errors gracefully during rendering
|
|
545
|
+
*
|
|
546
|
+
* The hook re-renders when either the `resume` object or `layoutIndex` changes.
|
|
547
|
+
* If `resume` is `null`, no rendering is performed.
|
|
548
|
+
*
|
|
549
|
+
* @param {UseResumeRendererProps} props - Configuration options for the hook.
|
|
550
|
+
* @returns An object containing:
|
|
551
|
+
* - `renderedContent` - The rendered resume content as a string
|
|
552
|
+
* - `engine` - The rendering engine used ('html', 'markdown', or 'latex')
|
|
553
|
+
* - `error` - Error message if rendering failed, or `null` if successful
|
|
554
|
+
*
|
|
555
|
+
* @example
|
|
556
|
+
* const { renderedContent, engine, error } = useResumeRenderer({
|
|
557
|
+
* resume: parsedResume,
|
|
558
|
+
* layoutIndex: 0,
|
|
559
|
+
* })
|
|
560
|
+
*
|
|
561
|
+
* if (error) {
|
|
562
|
+
* return <ErrorDisplay message={error} />
|
|
563
|
+
* }
|
|
564
|
+
*
|
|
565
|
+
* return engine === 'html'
|
|
566
|
+
* ? <HtmlViewer content={renderedContent} />
|
|
567
|
+
* : <CodeViewer content={renderedContent} language={engine} />
|
|
568
|
+
*/
|
|
569
|
+
declare function useResumeRenderer({ resume, layoutIndex, }: UseResumeRendererProps): {
|
|
570
|
+
renderedContent: string;
|
|
571
|
+
engine: LayoutEngine;
|
|
572
|
+
error: string;
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Props for the `useResumeState` hook.
|
|
577
|
+
*
|
|
578
|
+
* @property {string} [yaml] - The YAML content for the resume editor.
|
|
579
|
+
* Defaults to `DEFAULT_YAML` if not provided. Parent component should
|
|
580
|
+
* manage this state and update it via the `onChange` callback.
|
|
581
|
+
* @property {(value: string) => void} [onChange] - Callback invoked when
|
|
582
|
+
* the YAML content changes. The parent should update its state accordingly.
|
|
583
|
+
*/
|
|
584
|
+
interface UseResumeStateProps {
|
|
585
|
+
yaml?: string;
|
|
586
|
+
onChange?: (value: string) => void;
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* A React hook for managing resume state derived from YAML content.
|
|
590
|
+
*
|
|
591
|
+
* @description
|
|
592
|
+
* This hook encapsulates the logic for:
|
|
593
|
+
* - Parsing YAML into a `Resume` object with memoization
|
|
594
|
+
* - Tracking the active layout index with bounds checking
|
|
595
|
+
* - Providing a change handler that notifies the parent
|
|
596
|
+
*
|
|
597
|
+
* The parent component is responsible for managing the YAML state.
|
|
598
|
+
* This hook simply derives state (parsed resume, layout index) from the
|
|
599
|
+
* provided YAML and exposes utilities for updates.
|
|
600
|
+
*
|
|
601
|
+
* @param {UseResumeStateProps} props - Configuration options for the hook.
|
|
602
|
+
* @returns An object containing:
|
|
603
|
+
* - `yaml` - The current YAML string content
|
|
604
|
+
* - `handleYamlChange` - Function to notify parent of YAML changes
|
|
605
|
+
* - `activeLayoutIndex` - The currently selected layout index
|
|
606
|
+
* - `setActiveLayoutIndex` - Function to change the active layout
|
|
607
|
+
* - `resume` - The parsed `Resume` object (or `null` if parsing fails)
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* // Parent manages state, hook derives resume object
|
|
611
|
+
* const [yaml, setYaml] = useState(defaultYaml)
|
|
612
|
+
* const { resume, activeLayoutIndex } = useResumeState({
|
|
613
|
+
* yaml,
|
|
614
|
+
* onChange: setYaml,
|
|
615
|
+
* })
|
|
616
|
+
*/
|
|
617
|
+
declare function useResumeState({ yaml, onChange, }: UseResumeStateProps): {
|
|
618
|
+
yaml: string;
|
|
619
|
+
handleYamlChange: (v: string) => void;
|
|
620
|
+
activeLayoutIndex: number;
|
|
621
|
+
setActiveLayoutIndex: react.Dispatch<react.SetStateAction<number>>;
|
|
622
|
+
resume: Resume;
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* MIT License
|
|
627
|
+
*
|
|
628
|
+
* Copyright (c) 2023–Present PPResume (https://ppresume.com)
|
|
629
|
+
*
|
|
630
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
631
|
+
* of this software and associated documentation files (the "Software"), to
|
|
632
|
+
* deal in the Software without restriction, including without limitation the
|
|
633
|
+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
634
|
+
* sell copies of the Software, and to permit persons to whom the Software is
|
|
635
|
+
* furnished to do so, subject to the following conditions:
|
|
636
|
+
*
|
|
637
|
+
* The above copyright notice and this permission notice shall be included in
|
|
638
|
+
* all copies or substantial portions of the Software.
|
|
639
|
+
*
|
|
640
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
641
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
642
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
643
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
644
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
645
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
646
|
+
* IN THE SOFTWARE.
|
|
647
|
+
*/
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Gets the basename from a filepath.
|
|
651
|
+
*
|
|
652
|
+
* @param filepath - The file path (e.g. "path/to/resume.yaml").
|
|
653
|
+
* @param removeExtension - Whether to remove the file extension.
|
|
654
|
+
* @returns The basename of the file.
|
|
655
|
+
*/
|
|
656
|
+
declare const getBasename: (filepath?: string, removeExtension?: boolean) => string;
|
|
657
|
+
/**
|
|
658
|
+
* Gets the file extension for a given rendering engine.
|
|
659
|
+
*
|
|
660
|
+
* @param engine - The rendering engine (html, latex, markdown).
|
|
661
|
+
* @returns The associated file extension.
|
|
662
|
+
*/
|
|
663
|
+
declare const getExtension: (engine: LayoutEngine) => string;
|
|
664
|
+
/**
|
|
665
|
+
* Downloads the resume for a specific layout index.
|
|
666
|
+
*
|
|
667
|
+
* @param resume - The resume object.
|
|
668
|
+
* @param layoutIndex - The index of the layout to download.
|
|
669
|
+
*/
|
|
670
|
+
declare const downloadResume: (resume: Resume | null, layoutIndex: number) => void;
|
|
671
|
+
/**
|
|
672
|
+
* Copies the resume content to the clipboard for a specific layout index.
|
|
673
|
+
*
|
|
674
|
+
* @param resume - The resume object.
|
|
675
|
+
* @param layoutIndex - The index of the layout to copy.
|
|
676
|
+
*/
|
|
677
|
+
declare const copyResumeToClipboard: (resume: Resume | null, layoutIndex: number) => Promise<void>;
|
|
678
|
+
/**
|
|
679
|
+
* Prints the resume content (only for HTML layouts).
|
|
680
|
+
*
|
|
681
|
+
* @param resume - The resume object.
|
|
682
|
+
* @param layoutIndex - The index of the layout to print.
|
|
683
|
+
*/
|
|
684
|
+
declare const printResume: (resume: Resume | null, layoutIndex: number) => void;
|
|
685
|
+
/**
|
|
686
|
+
* Opens the resume content in a new tab (only for HTML layouts).
|
|
687
|
+
*
|
|
688
|
+
* @param resume - The resume object.
|
|
689
|
+
* @param layoutIndex - The index of the layout to open.
|
|
690
|
+
*/
|
|
691
|
+
declare const openResumeInNewTab: (resume: Resume | null, layoutIndex: number) => void;
|
|
692
|
+
|
|
693
|
+
export { CodeViewer, type CodeViewerProps, EDITOR_BG_COLOR, EDITOR_FONT_SIZE, Editor, EditorPanel, type EditorPanelProps, type EditorProps, HtmlViewer, type HtmlViewerProps, ICON_SIZES, ICON_STROKES, Panel, PanelContent, PanelSeparator, PanelToolbar, Playground, PlaygroundDesktop, type PlaygroundDesktopProps, PlaygroundMobile, type PlaygroundMobileProps, type PlaygroundProps, PreviewPanel, type PreviewPanelProps, ResumeEditor, type ResumeEditorProps, ResumeViewer, type ResumeViewerProps, ToolbarButton, ToolbarCopyButton, ToolbarSeparator, type UseResumeRendererProps, type UseResumeStateProps, copyResumeToClipboard, downloadResume, getBasename, getExtension, openResumeInNewTab, printResume, useResumeRenderer, useResumeState };
|