@tecof/theme-editor 0.0.7 → 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/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
  }
@@ -282,6 +284,12 @@ interface LanguageFieldProps {
282
284
  readOnly?: boolean;
283
285
  }
284
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;
285
293
  /** Whether to render as textarea instead of input */
286
294
  isTextarea?: boolean;
287
295
  /** Number of rows for textarea mode */
@@ -292,11 +300,11 @@ interface LanguageFieldOptions {
292
300
  isHtml?: boolean;
293
301
  }
294
302
  declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
295
- declare const createLanguageField: (options?: LanguageFieldOptions & {
296
- label?: string;
297
- }) => {
303
+ declare const createLanguageField: (options?: LanguageFieldOptions) => {
298
304
  type: "custom";
299
305
  label: string | undefined;
306
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
307
+ visible: boolean | undefined;
300
308
  render: ({ value, onChange, readOnly, field, name, id }: LanguageFieldProps) => react_jsx_runtime.JSX.Element;
301
309
  };
302
310
 
@@ -309,6 +317,12 @@ interface EditorFieldProps {
309
317
  readOnly?: boolean;
310
318
  }
311
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;
312
326
  /** Placeholder text for empty editor */
313
327
  placeholder?: string;
314
328
  }
@@ -342,11 +356,11 @@ declare const EditorField: ({ value, onChange, readOnly, }: EditorFieldProps & E
342
356
  * };
343
357
  * ```
344
358
  */
345
- declare const createEditorField: (options?: EditorFieldOptions & {
346
- label?: string;
347
- }) => {
359
+ declare const createEditorField: (options?: EditorFieldOptions) => {
348
360
  type: "custom";
349
361
  label: string | undefined;
362
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
363
+ visible: boolean | undefined;
350
364
  render: ({ value, onChange, readOnly, field, name, id }: EditorFieldProps) => react_jsx_runtime.JSX.Element;
351
365
  };
352
366
 
@@ -359,13 +373,18 @@ interface UploadFieldProps {
359
373
  readOnly?: boolean;
360
374
  }
361
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;
362
382
  allowMultiple?: boolean;
363
383
  maxFiles?: number;
364
384
  acceptedTypes?: string[];
365
385
  maxFileSize?: string;
366
386
  maxTotalFileSize?: string;
367
387
  folder?: string;
368
- label?: string;
369
388
  /** Show uploaded files list with view/download buttons */
370
389
  showUploadedFiles?: boolean;
371
390
  /** Preview height for images in FilePond */
@@ -389,6 +408,8 @@ declare const UploadField: {
389
408
  declare const createUploadField: (options?: UploadFieldOptions) => {
390
409
  type: "custom";
391
410
  label: string | undefined;
411
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
412
+ visible: boolean | undefined;
392
413
  render: ({ value, onChange, readOnly, field, name, id }: UploadFieldProps) => react_jsx_runtime.JSX.Element;
393
414
  };
394
415
 
@@ -401,7 +422,12 @@ interface CodeEditorFieldProps {
401
422
  readOnly?: boolean;
402
423
  }
403
424
  interface CodeEditorFieldOptions {
425
+ /** Field label displayed in the Puck sidebar */
404
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;
405
431
  defaultLanguage?: string;
406
432
  height?: string;
407
433
  theme?: string;
@@ -438,6 +464,8 @@ declare const CodeEditorField: react__default.ForwardRefExoticComponent<CodeEdit
438
464
  declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
439
465
  type: "custom";
440
466
  label: string | undefined;
467
+ labelIcon: ReactElement<unknown, string | react__default.JSXElementConstructor<any>> | undefined;
468
+ visible: boolean | undefined;
441
469
  render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
442
470
  };
443
471
 
@@ -450,7 +478,12 @@ interface LinkFieldProps {
450
478
  readOnly?: boolean;
451
479
  }
452
480
  interface LinkFieldOptions {
481
+ /** Field label displayed in the Puck sidebar */
453
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;
454
487
  /** Show target selector (_self / _blank) */
455
488
  showTarget?: boolean;
456
489
  /** Placeholder for URL input */
@@ -463,9 +496,68 @@ declare const LinkField: {
463
496
  declare const createLinkField: (options?: LinkFieldOptions) => {
464
497
  type: "custom";
465
498
  label: string | undefined;
499
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
500
+ visible: boolean | undefined;
466
501
  render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
467
502
  };
468
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
+
469
561
  declare function hexToHsl(hex: string): HSL;
470
562
  declare function hslToHex(h: number, s: number, l: number): string;
471
563
  declare function lighten(hex: string, amount: number): string;
@@ -474,4 +566,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
474
566
  declare function getDefaultTheme(): ThemeConfig;
475
567
  declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
476
568
 
477
- export { type ApiResponse, CodeEditorField, 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, createEditorField, createLanguageField, createLinkField, 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
  }
@@ -282,6 +284,12 @@ interface LanguageFieldProps {
282
284
  readOnly?: boolean;
283
285
  }
284
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;
285
293
  /** Whether to render as textarea instead of input */
286
294
  isTextarea?: boolean;
287
295
  /** Number of rows for textarea mode */
@@ -292,11 +300,11 @@ interface LanguageFieldOptions {
292
300
  isHtml?: boolean;
293
301
  }
294
302
  declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
295
- declare const createLanguageField: (options?: LanguageFieldOptions & {
296
- label?: string;
297
- }) => {
303
+ declare const createLanguageField: (options?: LanguageFieldOptions) => {
298
304
  type: "custom";
299
305
  label: string | undefined;
306
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
307
+ visible: boolean | undefined;
300
308
  render: ({ value, onChange, readOnly, field, name, id }: LanguageFieldProps) => react_jsx_runtime.JSX.Element;
301
309
  };
302
310
 
@@ -309,6 +317,12 @@ interface EditorFieldProps {
309
317
  readOnly?: boolean;
310
318
  }
311
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;
312
326
  /** Placeholder text for empty editor */
313
327
  placeholder?: string;
314
328
  }
@@ -342,11 +356,11 @@ declare const EditorField: ({ value, onChange, readOnly, }: EditorFieldProps & E
342
356
  * };
343
357
  * ```
344
358
  */
345
- declare const createEditorField: (options?: EditorFieldOptions & {
346
- label?: string;
347
- }) => {
359
+ declare const createEditorField: (options?: EditorFieldOptions) => {
348
360
  type: "custom";
349
361
  label: string | undefined;
362
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
363
+ visible: boolean | undefined;
350
364
  render: ({ value, onChange, readOnly, field, name, id }: EditorFieldProps) => react_jsx_runtime.JSX.Element;
351
365
  };
352
366
 
@@ -359,13 +373,18 @@ interface UploadFieldProps {
359
373
  readOnly?: boolean;
360
374
  }
361
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;
362
382
  allowMultiple?: boolean;
363
383
  maxFiles?: number;
364
384
  acceptedTypes?: string[];
365
385
  maxFileSize?: string;
366
386
  maxTotalFileSize?: string;
367
387
  folder?: string;
368
- label?: string;
369
388
  /** Show uploaded files list with view/download buttons */
370
389
  showUploadedFiles?: boolean;
371
390
  /** Preview height for images in FilePond */
@@ -389,6 +408,8 @@ declare const UploadField: {
389
408
  declare const createUploadField: (options?: UploadFieldOptions) => {
390
409
  type: "custom";
391
410
  label: string | undefined;
411
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
412
+ visible: boolean | undefined;
392
413
  render: ({ value, onChange, readOnly, field, name, id }: UploadFieldProps) => react_jsx_runtime.JSX.Element;
393
414
  };
394
415
 
@@ -401,7 +422,12 @@ interface CodeEditorFieldProps {
401
422
  readOnly?: boolean;
402
423
  }
403
424
  interface CodeEditorFieldOptions {
425
+ /** Field label displayed in the Puck sidebar */
404
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;
405
431
  defaultLanguage?: string;
406
432
  height?: string;
407
433
  theme?: string;
@@ -438,6 +464,8 @@ declare const CodeEditorField: react__default.ForwardRefExoticComponent<CodeEdit
438
464
  declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
439
465
  type: "custom";
440
466
  label: string | undefined;
467
+ labelIcon: ReactElement<unknown, string | react__default.JSXElementConstructor<any>> | undefined;
468
+ visible: boolean | undefined;
441
469
  render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
442
470
  };
443
471
 
@@ -450,7 +478,12 @@ interface LinkFieldProps {
450
478
  readOnly?: boolean;
451
479
  }
452
480
  interface LinkFieldOptions {
481
+ /** Field label displayed in the Puck sidebar */
453
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;
454
487
  /** Show target selector (_self / _blank) */
455
488
  showTarget?: boolean;
456
489
  /** Placeholder for URL input */
@@ -463,9 +496,68 @@ declare const LinkField: {
463
496
  declare const createLinkField: (options?: LinkFieldOptions) => {
464
497
  type: "custom";
465
498
  label: string | undefined;
499
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
500
+ visible: boolean | undefined;
466
501
  render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
467
502
  };
468
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
+
469
561
  declare function hexToHsl(hex: string): HSL;
470
562
  declare function hslToHex(h: number, s: number, l: number): string;
471
563
  declare function lighten(hex: string, amount: number): string;
@@ -474,4 +566,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
474
566
  declare function getDefaultTheme(): ThemeConfig;
475
567
  declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
476
568
 
477
- export { type ApiResponse, CodeEditorField, 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, createEditorField, createLanguageField, createLinkField, 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 };