@tecof/theme-editor 0.0.6 → 0.0.8
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/README.md +343 -128
- package/dist/index.d.mts +207 -11
- package/dist/index.d.ts +207 -11
- package/dist/index.js +12346 -2685
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12347 -2691
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1512 -0
- package/package.json +9 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
3
|
+
import react__default, { ReactElement } from 'react';
|
|
4
4
|
|
|
5
5
|
interface ThemeColors {
|
|
6
6
|
primary: string;
|
|
@@ -81,6 +81,8 @@ interface TecofProviderProps {
|
|
|
81
81
|
apiUrl: string;
|
|
82
82
|
/** Merchant secret key */
|
|
83
83
|
secretKey: string;
|
|
84
|
+
/** CDN base URL for media files (defaults to apiUrl if not provided) */
|
|
85
|
+
cdnUrl?: string;
|
|
84
86
|
/** React children */
|
|
85
87
|
children: React.ReactNode;
|
|
86
88
|
}
|
|
@@ -136,6 +138,12 @@ interface UploadedFile {
|
|
|
136
138
|
[key: string]: any;
|
|
137
139
|
};
|
|
138
140
|
}
|
|
141
|
+
interface LinkFieldValue {
|
|
142
|
+
url: string;
|
|
143
|
+
label?: string;
|
|
144
|
+
target?: '_self' | '_blank';
|
|
145
|
+
type?: 'page' | 'custom';
|
|
146
|
+
}
|
|
139
147
|
|
|
140
148
|
/**
|
|
141
149
|
* Tecof API Client — handles communication with the Tecof backend
|
|
@@ -176,6 +184,19 @@ declare class TecofApiClient {
|
|
|
176
184
|
* Fetch previously uploaded files (for media library selector)
|
|
177
185
|
*/
|
|
178
186
|
getUploads(page?: number, limit?: number): Promise<ApiResponse<any[]>>;
|
|
187
|
+
/**
|
|
188
|
+
* Fetch merchant pages list (for LinkField page selector)
|
|
189
|
+
* Returns pages with: _id, slug, title, status, metaTitle
|
|
190
|
+
*/
|
|
191
|
+
getPages(): Promise<ApiResponse<any[]>>;
|
|
192
|
+
/**
|
|
193
|
+
* Translate text to multiple languages (for LanguageField)
|
|
194
|
+
* Returns [{code, value}] for each locale
|
|
195
|
+
*/
|
|
196
|
+
translate(text: string, sourceLang: string, locales: string[], isHtml?: boolean): Promise<ApiResponse<{
|
|
197
|
+
code: string;
|
|
198
|
+
value: string;
|
|
199
|
+
}[]>>;
|
|
179
200
|
/** CDN base URL (derived from apiUrl) */
|
|
180
201
|
get cdnUrl(): string;
|
|
181
202
|
}
|
|
@@ -215,6 +236,45 @@ declare const TecofEditor: ({ pageId, config, accessToken, onSave, onChange, ove
|
|
|
215
236
|
*/
|
|
216
237
|
declare const TecofRender: ({ data, config, className }: TecofRenderProps) => react_jsx_runtime.JSX.Element | null;
|
|
217
238
|
|
|
239
|
+
type PictureSize = 'thumbnail' | 'medium' | 'large' | 'full';
|
|
240
|
+
interface TecofPictureProps {
|
|
241
|
+
/** The uploaded file data from UploadField */
|
|
242
|
+
data: UploadedFile | null | undefined;
|
|
243
|
+
/** Alt text for accessibility */
|
|
244
|
+
alt?: string | null;
|
|
245
|
+
/** Image size variant */
|
|
246
|
+
size?: PictureSize;
|
|
247
|
+
/** Loading strategy */
|
|
248
|
+
loading?: 'lazy' | 'eager';
|
|
249
|
+
/** Fill the parent container (position: absolute, 100%) */
|
|
250
|
+
fill?: boolean;
|
|
251
|
+
/** Container style overrides */
|
|
252
|
+
style?: React.CSSProperties;
|
|
253
|
+
/** Image style overrides */
|
|
254
|
+
imgStyle?: React.CSSProperties;
|
|
255
|
+
/** Container className */
|
|
256
|
+
className?: string;
|
|
257
|
+
/** Image className */
|
|
258
|
+
imgClassName?: string;
|
|
259
|
+
/** Image width (auto-detected from meta if available) */
|
|
260
|
+
width?: number;
|
|
261
|
+
/** Image height (auto-detected from meta if available) */
|
|
262
|
+
height?: number;
|
|
263
|
+
/** Whether to use a blur placeholder while loading */
|
|
264
|
+
usePlaceholder?: boolean;
|
|
265
|
+
/** Custom blur data URL */
|
|
266
|
+
blurDataURL?: string;
|
|
267
|
+
/** Fancybox lightbox support */
|
|
268
|
+
fancybox?: boolean;
|
|
269
|
+
/** Fancybox group name */
|
|
270
|
+
fancyboxName?: string;
|
|
271
|
+
/** Custom Image component (e.g. Next.js Image). If not provided, uses standard <img> */
|
|
272
|
+
ImageComponent?: React.ComponentType<any>;
|
|
273
|
+
/** Extra props to pass to the Image component (e.g. quality, priority, placeholder) */
|
|
274
|
+
imageProps?: Record<string, any>;
|
|
275
|
+
}
|
|
276
|
+
declare const TecofPicture: react.MemoExoticComponent<({ data, alt, size, loading, fill, style, imgStyle, className, imgClassName, width, height, usePlaceholder, blurDataURL, fancybox, fancyboxName, ImageComponent, imageProps, }: TecofPictureProps) => react_jsx_runtime.JSX.Element | null>;
|
|
277
|
+
|
|
218
278
|
interface LanguageFieldProps {
|
|
219
279
|
field: any;
|
|
220
280
|
name: string;
|
|
@@ -224,19 +284,27 @@ interface LanguageFieldProps {
|
|
|
224
284
|
readOnly?: boolean;
|
|
225
285
|
}
|
|
226
286
|
interface LanguageFieldOptions {
|
|
287
|
+
/** Field label displayed in the Puck sidebar */
|
|
288
|
+
label?: string;
|
|
289
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
290
|
+
labelIcon?: ReactElement;
|
|
291
|
+
/** Whether this field is visible in the sidebar */
|
|
292
|
+
visible?: boolean;
|
|
227
293
|
/** Whether to render as textarea instead of input */
|
|
228
294
|
isTextarea?: boolean;
|
|
229
295
|
/** Number of rows for textarea mode */
|
|
230
296
|
textareaRows?: number;
|
|
231
297
|
/** Placeholder text */
|
|
232
298
|
placeholder?: string;
|
|
299
|
+
/** Whether the content is HTML (for translation) */
|
|
300
|
+
isHtml?: boolean;
|
|
233
301
|
}
|
|
234
|
-
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
235
|
-
declare const createLanguageField: (options?: LanguageFieldOptions
|
|
236
|
-
label?: string;
|
|
237
|
-
}) => {
|
|
302
|
+
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
303
|
+
declare const createLanguageField: (options?: LanguageFieldOptions) => {
|
|
238
304
|
type: "custom";
|
|
239
305
|
label: string | undefined;
|
|
306
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
307
|
+
visible: boolean | undefined;
|
|
240
308
|
render: ({ value, onChange, readOnly, field, name, id }: LanguageFieldProps) => react_jsx_runtime.JSX.Element;
|
|
241
309
|
};
|
|
242
310
|
|
|
@@ -249,6 +317,12 @@ interface EditorFieldProps {
|
|
|
249
317
|
readOnly?: boolean;
|
|
250
318
|
}
|
|
251
319
|
interface EditorFieldOptions {
|
|
320
|
+
/** Field label displayed in the Puck sidebar */
|
|
321
|
+
label?: string;
|
|
322
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
323
|
+
labelIcon?: ReactElement;
|
|
324
|
+
/** Whether this field is visible in the sidebar */
|
|
325
|
+
visible?: boolean;
|
|
252
326
|
/** Placeholder text for empty editor */
|
|
253
327
|
placeholder?: string;
|
|
254
328
|
}
|
|
@@ -282,11 +356,11 @@ declare const EditorField: ({ value, onChange, readOnly, }: EditorFieldProps & E
|
|
|
282
356
|
* };
|
|
283
357
|
* ```
|
|
284
358
|
*/
|
|
285
|
-
declare const createEditorField: (options?: EditorFieldOptions
|
|
286
|
-
label?: string;
|
|
287
|
-
}) => {
|
|
359
|
+
declare const createEditorField: (options?: EditorFieldOptions) => {
|
|
288
360
|
type: "custom";
|
|
289
361
|
label: string | undefined;
|
|
362
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
363
|
+
visible: boolean | undefined;
|
|
290
364
|
render: ({ value, onChange, readOnly, field, name, id }: EditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
291
365
|
};
|
|
292
366
|
|
|
@@ -299,17 +373,43 @@ interface UploadFieldProps {
|
|
|
299
373
|
readOnly?: boolean;
|
|
300
374
|
}
|
|
301
375
|
interface UploadFieldOptions {
|
|
376
|
+
/** Field label displayed in the Puck sidebar */
|
|
377
|
+
label?: string;
|
|
378
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
379
|
+
labelIcon?: ReactElement;
|
|
380
|
+
/** Whether this field is visible in the sidebar */
|
|
381
|
+
visible?: boolean;
|
|
302
382
|
allowMultiple?: boolean;
|
|
303
383
|
maxFiles?: number;
|
|
304
384
|
acceptedTypes?: string[];
|
|
305
385
|
maxFileSize?: string;
|
|
386
|
+
maxTotalFileSize?: string;
|
|
306
387
|
folder?: string;
|
|
307
|
-
|
|
388
|
+
/** Show uploaded files list with view/download buttons */
|
|
389
|
+
showUploadedFiles?: boolean;
|
|
390
|
+
/** Preview height for images in FilePond */
|
|
391
|
+
imagePreviewHeight?: number;
|
|
392
|
+
/** Allow reorder in FilePond */
|
|
393
|
+
allowReorder?: boolean;
|
|
394
|
+
/** Enable image compression before upload */
|
|
395
|
+
imageCompressionEnabled?: boolean;
|
|
396
|
+
/** Image compression options */
|
|
397
|
+
imageCompressionOptions?: {
|
|
398
|
+
maxSizeMB?: number;
|
|
399
|
+
maxWidthOrHeight?: number;
|
|
400
|
+
useWebWorker?: boolean;
|
|
401
|
+
fileType?: string;
|
|
402
|
+
};
|
|
308
403
|
}
|
|
309
|
-
declare const UploadField:
|
|
404
|
+
declare const UploadField: {
|
|
405
|
+
({ value: rawValue, onChange, allowMultiple, maxFiles, acceptedTypes, maxFileSize, maxTotalFileSize, folder, readOnly, showUploadedFiles, imagePreviewHeight, allowReorder, imageCompressionEnabled, imageCompressionOptions, }: UploadFieldProps & UploadFieldOptions): react_jsx_runtime.JSX.Element;
|
|
406
|
+
displayName: string;
|
|
407
|
+
};
|
|
310
408
|
declare const createUploadField: (options?: UploadFieldOptions) => {
|
|
311
409
|
type: "custom";
|
|
312
410
|
label: string | undefined;
|
|
411
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
412
|
+
visible: boolean | undefined;
|
|
313
413
|
render: ({ value, onChange, readOnly, field, name, id }: UploadFieldProps) => react_jsx_runtime.JSX.Element;
|
|
314
414
|
};
|
|
315
415
|
|
|
@@ -322,7 +422,12 @@ interface CodeEditorFieldProps {
|
|
|
322
422
|
readOnly?: boolean;
|
|
323
423
|
}
|
|
324
424
|
interface CodeEditorFieldOptions {
|
|
425
|
+
/** Field label displayed in the Puck sidebar */
|
|
325
426
|
label?: string;
|
|
427
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
428
|
+
labelIcon?: ReactElement;
|
|
429
|
+
/** Whether this field is visible in the sidebar */
|
|
430
|
+
visible?: boolean;
|
|
326
431
|
defaultLanguage?: string;
|
|
327
432
|
height?: string;
|
|
328
433
|
theme?: string;
|
|
@@ -359,9 +464,100 @@ declare const CodeEditorField: react__default.ForwardRefExoticComponent<CodeEdit
|
|
|
359
464
|
declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
|
|
360
465
|
type: "custom";
|
|
361
466
|
label: string | undefined;
|
|
467
|
+
labelIcon: ReactElement<unknown, string | react__default.JSXElementConstructor<any>> | undefined;
|
|
468
|
+
visible: boolean | undefined;
|
|
362
469
|
render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
363
470
|
};
|
|
364
471
|
|
|
472
|
+
interface LinkFieldProps {
|
|
473
|
+
field: any;
|
|
474
|
+
name: string;
|
|
475
|
+
id: string;
|
|
476
|
+
value: LinkFieldValue | null;
|
|
477
|
+
onChange: (value: LinkFieldValue | null) => void;
|
|
478
|
+
readOnly?: boolean;
|
|
479
|
+
}
|
|
480
|
+
interface LinkFieldOptions {
|
|
481
|
+
/** Field label displayed in the Puck sidebar */
|
|
482
|
+
label?: string;
|
|
483
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
484
|
+
labelIcon?: ReactElement;
|
|
485
|
+
/** Whether this field is visible in the sidebar */
|
|
486
|
+
visible?: boolean;
|
|
487
|
+
/** Show target selector (_self / _blank) */
|
|
488
|
+
showTarget?: boolean;
|
|
489
|
+
/** Placeholder for URL input */
|
|
490
|
+
placeholder?: string;
|
|
491
|
+
}
|
|
492
|
+
declare const LinkField: {
|
|
493
|
+
({ value, onChange, readOnly, showTarget, placeholder, }: LinkFieldProps & LinkFieldOptions): react_jsx_runtime.JSX.Element;
|
|
494
|
+
displayName: string;
|
|
495
|
+
};
|
|
496
|
+
declare const createLinkField: (options?: LinkFieldOptions) => {
|
|
497
|
+
type: "custom";
|
|
498
|
+
label: string | undefined;
|
|
499
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
500
|
+
visible: boolean | undefined;
|
|
501
|
+
render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
interface ColorFieldProps {
|
|
505
|
+
field: any;
|
|
506
|
+
name: string;
|
|
507
|
+
id: string;
|
|
508
|
+
value: string;
|
|
509
|
+
onChange: (value: string) => void;
|
|
510
|
+
readOnly?: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface ColorFieldOptions {
|
|
513
|
+
/** Field label displayed in the Puck sidebar */
|
|
514
|
+
label?: string;
|
|
515
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
516
|
+
labelIcon?: ReactElement;
|
|
517
|
+
/** Whether this field is visible in the sidebar */
|
|
518
|
+
visible?: boolean;
|
|
519
|
+
/** Show opacity/alpha slider */
|
|
520
|
+
showOpacity?: boolean;
|
|
521
|
+
/** Show preset color palette */
|
|
522
|
+
showPresets?: boolean;
|
|
523
|
+
/** Custom preset colors (array of hex strings) */
|
|
524
|
+
presetColors?: string[];
|
|
525
|
+
/** Default/fallback color */
|
|
526
|
+
defaultColor?: string;
|
|
527
|
+
/** Placeholder text for hex input */
|
|
528
|
+
placeholder?: string;
|
|
529
|
+
/** Show reset button */
|
|
530
|
+
showReset?: boolean;
|
|
531
|
+
}
|
|
532
|
+
declare const ColorField: {
|
|
533
|
+
({ value, onChange, readOnly, showOpacity, showPresets, presetColors, defaultColor, placeholder, showReset, }: ColorFieldProps & ColorFieldOptions): react_jsx_runtime.JSX.Element;
|
|
534
|
+
displayName: string;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Creates a Puck custom field definition for color picking.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```ts
|
|
541
|
+
* import { createColorField } from '@tecof/theme-editor';
|
|
542
|
+
*
|
|
543
|
+
* fields: {
|
|
544
|
+
* bgColor: createColorField({ label: 'Arka Plan Rengi' }),
|
|
545
|
+
* textColor: createColorField({
|
|
546
|
+
* label: 'Metin Rengi',
|
|
547
|
+
* showOpacity: true,
|
|
548
|
+
* defaultColor: '#18181b',
|
|
549
|
+
* }),
|
|
550
|
+
* }
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
declare const createColorField: (options?: ColorFieldOptions) => {
|
|
554
|
+
type: "custom";
|
|
555
|
+
label: string | undefined;
|
|
556
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
557
|
+
visible: boolean | undefined;
|
|
558
|
+
render: ({ value, onChange, readOnly, field, name, id }: ColorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
559
|
+
};
|
|
560
|
+
|
|
365
561
|
declare function hexToHsl(hex: string): HSL;
|
|
366
562
|
declare function hslToHex(h: number, s: number, l: number): string;
|
|
367
563
|
declare function lighten(hex: string, amount: number): string;
|
|
@@ -370,4 +566,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
|
|
|
370
566
|
declare function getDefaultTheme(): ThemeConfig;
|
|
371
567
|
declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
372
568
|
|
|
373
|
-
export { type ApiResponse, CodeEditorField, EditorField, type HSL, LanguageField, type LanguageFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, TecofApiClient, TecofEditor, type TecofEditorProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCodeEditorField, createEditorField, createLanguageField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
569
|
+
export { type ApiResponse, CodeEditorField, ColorField, EditorField, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, TecofApiClient, TecofEditor, type TecofEditorProps, TecofPicture, type TecofPictureProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import react__default from 'react';
|
|
3
|
+
import react__default, { ReactElement } from 'react';
|
|
4
4
|
|
|
5
5
|
interface ThemeColors {
|
|
6
6
|
primary: string;
|
|
@@ -81,6 +81,8 @@ interface TecofProviderProps {
|
|
|
81
81
|
apiUrl: string;
|
|
82
82
|
/** Merchant secret key */
|
|
83
83
|
secretKey: string;
|
|
84
|
+
/** CDN base URL for media files (defaults to apiUrl if not provided) */
|
|
85
|
+
cdnUrl?: string;
|
|
84
86
|
/** React children */
|
|
85
87
|
children: React.ReactNode;
|
|
86
88
|
}
|
|
@@ -136,6 +138,12 @@ interface UploadedFile {
|
|
|
136
138
|
[key: string]: any;
|
|
137
139
|
};
|
|
138
140
|
}
|
|
141
|
+
interface LinkFieldValue {
|
|
142
|
+
url: string;
|
|
143
|
+
label?: string;
|
|
144
|
+
target?: '_self' | '_blank';
|
|
145
|
+
type?: 'page' | 'custom';
|
|
146
|
+
}
|
|
139
147
|
|
|
140
148
|
/**
|
|
141
149
|
* Tecof API Client — handles communication with the Tecof backend
|
|
@@ -176,6 +184,19 @@ declare class TecofApiClient {
|
|
|
176
184
|
* Fetch previously uploaded files (for media library selector)
|
|
177
185
|
*/
|
|
178
186
|
getUploads(page?: number, limit?: number): Promise<ApiResponse<any[]>>;
|
|
187
|
+
/**
|
|
188
|
+
* Fetch merchant pages list (for LinkField page selector)
|
|
189
|
+
* Returns pages with: _id, slug, title, status, metaTitle
|
|
190
|
+
*/
|
|
191
|
+
getPages(): Promise<ApiResponse<any[]>>;
|
|
192
|
+
/**
|
|
193
|
+
* Translate text to multiple languages (for LanguageField)
|
|
194
|
+
* Returns [{code, value}] for each locale
|
|
195
|
+
*/
|
|
196
|
+
translate(text: string, sourceLang: string, locales: string[], isHtml?: boolean): Promise<ApiResponse<{
|
|
197
|
+
code: string;
|
|
198
|
+
value: string;
|
|
199
|
+
}[]>>;
|
|
179
200
|
/** CDN base URL (derived from apiUrl) */
|
|
180
201
|
get cdnUrl(): string;
|
|
181
202
|
}
|
|
@@ -215,6 +236,45 @@ declare const TecofEditor: ({ pageId, config, accessToken, onSave, onChange, ove
|
|
|
215
236
|
*/
|
|
216
237
|
declare const TecofRender: ({ data, config, className }: TecofRenderProps) => react_jsx_runtime.JSX.Element | null;
|
|
217
238
|
|
|
239
|
+
type PictureSize = 'thumbnail' | 'medium' | 'large' | 'full';
|
|
240
|
+
interface TecofPictureProps {
|
|
241
|
+
/** The uploaded file data from UploadField */
|
|
242
|
+
data: UploadedFile | null | undefined;
|
|
243
|
+
/** Alt text for accessibility */
|
|
244
|
+
alt?: string | null;
|
|
245
|
+
/** Image size variant */
|
|
246
|
+
size?: PictureSize;
|
|
247
|
+
/** Loading strategy */
|
|
248
|
+
loading?: 'lazy' | 'eager';
|
|
249
|
+
/** Fill the parent container (position: absolute, 100%) */
|
|
250
|
+
fill?: boolean;
|
|
251
|
+
/** Container style overrides */
|
|
252
|
+
style?: React.CSSProperties;
|
|
253
|
+
/** Image style overrides */
|
|
254
|
+
imgStyle?: React.CSSProperties;
|
|
255
|
+
/** Container className */
|
|
256
|
+
className?: string;
|
|
257
|
+
/** Image className */
|
|
258
|
+
imgClassName?: string;
|
|
259
|
+
/** Image width (auto-detected from meta if available) */
|
|
260
|
+
width?: number;
|
|
261
|
+
/** Image height (auto-detected from meta if available) */
|
|
262
|
+
height?: number;
|
|
263
|
+
/** Whether to use a blur placeholder while loading */
|
|
264
|
+
usePlaceholder?: boolean;
|
|
265
|
+
/** Custom blur data URL */
|
|
266
|
+
blurDataURL?: string;
|
|
267
|
+
/** Fancybox lightbox support */
|
|
268
|
+
fancybox?: boolean;
|
|
269
|
+
/** Fancybox group name */
|
|
270
|
+
fancyboxName?: string;
|
|
271
|
+
/** Custom Image component (e.g. Next.js Image). If not provided, uses standard <img> */
|
|
272
|
+
ImageComponent?: React.ComponentType<any>;
|
|
273
|
+
/** Extra props to pass to the Image component (e.g. quality, priority, placeholder) */
|
|
274
|
+
imageProps?: Record<string, any>;
|
|
275
|
+
}
|
|
276
|
+
declare const TecofPicture: react.MemoExoticComponent<({ data, alt, size, loading, fill, style, imgStyle, className, imgClassName, width, height, usePlaceholder, blurDataURL, fancybox, fancyboxName, ImageComponent, imageProps, }: TecofPictureProps) => react_jsx_runtime.JSX.Element | null>;
|
|
277
|
+
|
|
218
278
|
interface LanguageFieldProps {
|
|
219
279
|
field: any;
|
|
220
280
|
name: string;
|
|
@@ -224,19 +284,27 @@ interface LanguageFieldProps {
|
|
|
224
284
|
readOnly?: boolean;
|
|
225
285
|
}
|
|
226
286
|
interface LanguageFieldOptions {
|
|
287
|
+
/** Field label displayed in the Puck sidebar */
|
|
288
|
+
label?: string;
|
|
289
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
290
|
+
labelIcon?: ReactElement;
|
|
291
|
+
/** Whether this field is visible in the sidebar */
|
|
292
|
+
visible?: boolean;
|
|
227
293
|
/** Whether to render as textarea instead of input */
|
|
228
294
|
isTextarea?: boolean;
|
|
229
295
|
/** Number of rows for textarea mode */
|
|
230
296
|
textareaRows?: number;
|
|
231
297
|
/** Placeholder text */
|
|
232
298
|
placeholder?: string;
|
|
299
|
+
/** Whether the content is HTML (for translation) */
|
|
300
|
+
isHtml?: boolean;
|
|
233
301
|
}
|
|
234
|
-
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
235
|
-
declare const createLanguageField: (options?: LanguageFieldOptions
|
|
236
|
-
label?: string;
|
|
237
|
-
}) => {
|
|
302
|
+
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
303
|
+
declare const createLanguageField: (options?: LanguageFieldOptions) => {
|
|
238
304
|
type: "custom";
|
|
239
305
|
label: string | undefined;
|
|
306
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
307
|
+
visible: boolean | undefined;
|
|
240
308
|
render: ({ value, onChange, readOnly, field, name, id }: LanguageFieldProps) => react_jsx_runtime.JSX.Element;
|
|
241
309
|
};
|
|
242
310
|
|
|
@@ -249,6 +317,12 @@ interface EditorFieldProps {
|
|
|
249
317
|
readOnly?: boolean;
|
|
250
318
|
}
|
|
251
319
|
interface EditorFieldOptions {
|
|
320
|
+
/** Field label displayed in the Puck sidebar */
|
|
321
|
+
label?: string;
|
|
322
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
323
|
+
labelIcon?: ReactElement;
|
|
324
|
+
/** Whether this field is visible in the sidebar */
|
|
325
|
+
visible?: boolean;
|
|
252
326
|
/** Placeholder text for empty editor */
|
|
253
327
|
placeholder?: string;
|
|
254
328
|
}
|
|
@@ -282,11 +356,11 @@ declare const EditorField: ({ value, onChange, readOnly, }: EditorFieldProps & E
|
|
|
282
356
|
* };
|
|
283
357
|
* ```
|
|
284
358
|
*/
|
|
285
|
-
declare const createEditorField: (options?: EditorFieldOptions
|
|
286
|
-
label?: string;
|
|
287
|
-
}) => {
|
|
359
|
+
declare const createEditorField: (options?: EditorFieldOptions) => {
|
|
288
360
|
type: "custom";
|
|
289
361
|
label: string | undefined;
|
|
362
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
363
|
+
visible: boolean | undefined;
|
|
290
364
|
render: ({ value, onChange, readOnly, field, name, id }: EditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
291
365
|
};
|
|
292
366
|
|
|
@@ -299,17 +373,43 @@ interface UploadFieldProps {
|
|
|
299
373
|
readOnly?: boolean;
|
|
300
374
|
}
|
|
301
375
|
interface UploadFieldOptions {
|
|
376
|
+
/** Field label displayed in the Puck sidebar */
|
|
377
|
+
label?: string;
|
|
378
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
379
|
+
labelIcon?: ReactElement;
|
|
380
|
+
/** Whether this field is visible in the sidebar */
|
|
381
|
+
visible?: boolean;
|
|
302
382
|
allowMultiple?: boolean;
|
|
303
383
|
maxFiles?: number;
|
|
304
384
|
acceptedTypes?: string[];
|
|
305
385
|
maxFileSize?: string;
|
|
386
|
+
maxTotalFileSize?: string;
|
|
306
387
|
folder?: string;
|
|
307
|
-
|
|
388
|
+
/** Show uploaded files list with view/download buttons */
|
|
389
|
+
showUploadedFiles?: boolean;
|
|
390
|
+
/** Preview height for images in FilePond */
|
|
391
|
+
imagePreviewHeight?: number;
|
|
392
|
+
/** Allow reorder in FilePond */
|
|
393
|
+
allowReorder?: boolean;
|
|
394
|
+
/** Enable image compression before upload */
|
|
395
|
+
imageCompressionEnabled?: boolean;
|
|
396
|
+
/** Image compression options */
|
|
397
|
+
imageCompressionOptions?: {
|
|
398
|
+
maxSizeMB?: number;
|
|
399
|
+
maxWidthOrHeight?: number;
|
|
400
|
+
useWebWorker?: boolean;
|
|
401
|
+
fileType?: string;
|
|
402
|
+
};
|
|
308
403
|
}
|
|
309
|
-
declare const UploadField:
|
|
404
|
+
declare const UploadField: {
|
|
405
|
+
({ value: rawValue, onChange, allowMultiple, maxFiles, acceptedTypes, maxFileSize, maxTotalFileSize, folder, readOnly, showUploadedFiles, imagePreviewHeight, allowReorder, imageCompressionEnabled, imageCompressionOptions, }: UploadFieldProps & UploadFieldOptions): react_jsx_runtime.JSX.Element;
|
|
406
|
+
displayName: string;
|
|
407
|
+
};
|
|
310
408
|
declare const createUploadField: (options?: UploadFieldOptions) => {
|
|
311
409
|
type: "custom";
|
|
312
410
|
label: string | undefined;
|
|
411
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
412
|
+
visible: boolean | undefined;
|
|
313
413
|
render: ({ value, onChange, readOnly, field, name, id }: UploadFieldProps) => react_jsx_runtime.JSX.Element;
|
|
314
414
|
};
|
|
315
415
|
|
|
@@ -322,7 +422,12 @@ interface CodeEditorFieldProps {
|
|
|
322
422
|
readOnly?: boolean;
|
|
323
423
|
}
|
|
324
424
|
interface CodeEditorFieldOptions {
|
|
425
|
+
/** Field label displayed in the Puck sidebar */
|
|
325
426
|
label?: string;
|
|
427
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
428
|
+
labelIcon?: ReactElement;
|
|
429
|
+
/** Whether this field is visible in the sidebar */
|
|
430
|
+
visible?: boolean;
|
|
326
431
|
defaultLanguage?: string;
|
|
327
432
|
height?: string;
|
|
328
433
|
theme?: string;
|
|
@@ -359,9 +464,100 @@ declare const CodeEditorField: react__default.ForwardRefExoticComponent<CodeEdit
|
|
|
359
464
|
declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
|
|
360
465
|
type: "custom";
|
|
361
466
|
label: string | undefined;
|
|
467
|
+
labelIcon: ReactElement<unknown, string | react__default.JSXElementConstructor<any>> | undefined;
|
|
468
|
+
visible: boolean | undefined;
|
|
362
469
|
render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
363
470
|
};
|
|
364
471
|
|
|
472
|
+
interface LinkFieldProps {
|
|
473
|
+
field: any;
|
|
474
|
+
name: string;
|
|
475
|
+
id: string;
|
|
476
|
+
value: LinkFieldValue | null;
|
|
477
|
+
onChange: (value: LinkFieldValue | null) => void;
|
|
478
|
+
readOnly?: boolean;
|
|
479
|
+
}
|
|
480
|
+
interface LinkFieldOptions {
|
|
481
|
+
/** Field label displayed in the Puck sidebar */
|
|
482
|
+
label?: string;
|
|
483
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
484
|
+
labelIcon?: ReactElement;
|
|
485
|
+
/** Whether this field is visible in the sidebar */
|
|
486
|
+
visible?: boolean;
|
|
487
|
+
/** Show target selector (_self / _blank) */
|
|
488
|
+
showTarget?: boolean;
|
|
489
|
+
/** Placeholder for URL input */
|
|
490
|
+
placeholder?: string;
|
|
491
|
+
}
|
|
492
|
+
declare const LinkField: {
|
|
493
|
+
({ value, onChange, readOnly, showTarget, placeholder, }: LinkFieldProps & LinkFieldOptions): react_jsx_runtime.JSX.Element;
|
|
494
|
+
displayName: string;
|
|
495
|
+
};
|
|
496
|
+
declare const createLinkField: (options?: LinkFieldOptions) => {
|
|
497
|
+
type: "custom";
|
|
498
|
+
label: string | undefined;
|
|
499
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
500
|
+
visible: boolean | undefined;
|
|
501
|
+
render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
interface ColorFieldProps {
|
|
505
|
+
field: any;
|
|
506
|
+
name: string;
|
|
507
|
+
id: string;
|
|
508
|
+
value: string;
|
|
509
|
+
onChange: (value: string) => void;
|
|
510
|
+
readOnly?: boolean;
|
|
511
|
+
}
|
|
512
|
+
interface ColorFieldOptions {
|
|
513
|
+
/** Field label displayed in the Puck sidebar */
|
|
514
|
+
label?: string;
|
|
515
|
+
/** Icon displayed next to the label (React element, e.g. Lucide icon) */
|
|
516
|
+
labelIcon?: ReactElement;
|
|
517
|
+
/** Whether this field is visible in the sidebar */
|
|
518
|
+
visible?: boolean;
|
|
519
|
+
/** Show opacity/alpha slider */
|
|
520
|
+
showOpacity?: boolean;
|
|
521
|
+
/** Show preset color palette */
|
|
522
|
+
showPresets?: boolean;
|
|
523
|
+
/** Custom preset colors (array of hex strings) */
|
|
524
|
+
presetColors?: string[];
|
|
525
|
+
/** Default/fallback color */
|
|
526
|
+
defaultColor?: string;
|
|
527
|
+
/** Placeholder text for hex input */
|
|
528
|
+
placeholder?: string;
|
|
529
|
+
/** Show reset button */
|
|
530
|
+
showReset?: boolean;
|
|
531
|
+
}
|
|
532
|
+
declare const ColorField: {
|
|
533
|
+
({ value, onChange, readOnly, showOpacity, showPresets, presetColors, defaultColor, placeholder, showReset, }: ColorFieldProps & ColorFieldOptions): react_jsx_runtime.JSX.Element;
|
|
534
|
+
displayName: string;
|
|
535
|
+
};
|
|
536
|
+
/**
|
|
537
|
+
* Creates a Puck custom field definition for color picking.
|
|
538
|
+
*
|
|
539
|
+
* @example
|
|
540
|
+
* ```ts
|
|
541
|
+
* import { createColorField } from '@tecof/theme-editor';
|
|
542
|
+
*
|
|
543
|
+
* fields: {
|
|
544
|
+
* bgColor: createColorField({ label: 'Arka Plan Rengi' }),
|
|
545
|
+
* textColor: createColorField({
|
|
546
|
+
* label: 'Metin Rengi',
|
|
547
|
+
* showOpacity: true,
|
|
548
|
+
* defaultColor: '#18181b',
|
|
549
|
+
* }),
|
|
550
|
+
* }
|
|
551
|
+
* ```
|
|
552
|
+
*/
|
|
553
|
+
declare const createColorField: (options?: ColorFieldOptions) => {
|
|
554
|
+
type: "custom";
|
|
555
|
+
label: string | undefined;
|
|
556
|
+
labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
|
|
557
|
+
visible: boolean | undefined;
|
|
558
|
+
render: ({ value, onChange, readOnly, field, name, id }: ColorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
559
|
+
};
|
|
560
|
+
|
|
365
561
|
declare function hexToHsl(hex: string): HSL;
|
|
366
562
|
declare function hslToHex(h: number, s: number, l: number): string;
|
|
367
563
|
declare function lighten(hex: string, amount: number): string;
|
|
@@ -370,4 +566,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
|
|
|
370
566
|
declare function getDefaultTheme(): ThemeConfig;
|
|
371
567
|
declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
372
568
|
|
|
373
|
-
export { type ApiResponse, CodeEditorField, EditorField, type HSL, LanguageField, type LanguageFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, TecofApiClient, TecofEditor, type TecofEditorProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCodeEditorField, createEditorField, createLanguageField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
569
|
+
export { type ApiResponse, CodeEditorField, ColorField, EditorField, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, TecofApiClient, TecofEditor, type TecofEditorProps, TecofPicture, type TecofPictureProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|