@tecof/theme-editor 0.0.28 → 0.0.29

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
@@ -216,6 +216,21 @@ declare class TecofApiClient {
216
216
  */
217
217
  private previewBlobCache;
218
218
  getComponentPreview(domain: string, componentName: string): Promise<string | null>;
219
+ /**
220
+ * Fetch CMS collections list (for CmsCollectionField)
221
+ * Returns: [{ _id, name, slug, fields, ... }]
222
+ */
223
+ getCmsCollections(): Promise<ApiResponse<any[]>>;
224
+ /**
225
+ * Fetch items from a CMS collection by slug
226
+ * Returns: { items: [...], totalData: N }
227
+ */
228
+ getCmsCollectionItems(collectionSlug: string, options?: {
229
+ page?: number;
230
+ limit?: number;
231
+ sort?: 'newest' | 'oldest';
232
+ locale?: string;
233
+ }): Promise<ApiResponse<any>>;
219
234
  /** CDN base URL (defaults to apiUrl if not set) */
220
235
  get cdnUrl(): string;
221
236
  }
@@ -620,6 +635,66 @@ declare const createRepeaterField: (options: RepeaterFieldOptions) => {
620
635
  render: ({ value, onChange, readOnly, field, name, id }: RepeaterFieldProps) => react_jsx_runtime.JSX.Element;
621
636
  };
622
637
 
638
+ /** Slot definition: describes a data slot the component needs */
639
+ interface CmsSlotDefinition {
640
+ /** Label shown in the editor (e.g. "Başlık") */
641
+ label: string;
642
+ /** Optional: filter to specific CMS field types */
643
+ fieldTypes?: string[];
644
+ }
645
+ interface CmsCollectionFieldValue {
646
+ /** Selected collection slug */
647
+ collectionSlug: string;
648
+ /** Collection name (for display) */
649
+ collectionName?: string;
650
+ /** Max items to fetch */
651
+ limit?: number;
652
+ /** Sort order */
653
+ sort?: 'newest' | 'oldest';
654
+ /** Field mapping: slotKey → CMS field shortcode */
655
+ fieldMap?: Record<string, string>;
656
+ }
657
+ interface CmsCollectionFieldProps {
658
+ field: any;
659
+ name: string;
660
+ id: string;
661
+ value: CmsCollectionFieldValue | null;
662
+ onChange: (value: CmsCollectionFieldValue | null) => void;
663
+ readOnly?: boolean;
664
+ }
665
+ interface CmsCollectionFieldOptions {
666
+ /** Field label displayed in the Puck sidebar */
667
+ label?: string;
668
+ /** Icon displayed next to the label */
669
+ labelIcon?: ReactElement;
670
+ /** Whether this field is visible in the sidebar */
671
+ visible?: boolean;
672
+ /** Default limit for items */
673
+ defaultLimit?: number;
674
+ /** Show limit control */
675
+ showLimit?: boolean;
676
+ /** Show sort control */
677
+ showSort?: boolean;
678
+ /**
679
+ * Mappable slots: defines what data the component needs.
680
+ * Key = slot name used in code, Value = slot definition.
681
+ * Example: { title: { label: "Başlık" }, image: { label: "Görsel" } }
682
+ */
683
+ slots?: Record<string, CmsSlotDefinition>;
684
+ }
685
+ declare const CmsCollectionField: {
686
+ ({ value, onChange, readOnly, defaultLimit, showLimit, showSort, slots, }: CmsCollectionFieldProps & CmsCollectionFieldOptions): react_jsx_runtime.JSX.Element;
687
+ displayName: string;
688
+ };
689
+ declare const createCmsCollectionField: (options?: CmsCollectionFieldOptions) => {
690
+ type: "custom";
691
+ _fieldType: "cmsCollection";
692
+ label: string | undefined;
693
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
694
+ visible: boolean | undefined;
695
+ render: ({ value, onChange, readOnly, field, name, id }: CmsCollectionFieldProps) => react_jsx_runtime.JSX.Element;
696
+ };
697
+
623
698
  interface FieldErrorBoundaryProps {
624
699
  /** The field name (for error reporting) */
625
700
  fieldName?: string;
@@ -661,4 +736,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
661
736
  declare function getDefaultTheme(): ThemeConfig;
662
737
  declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
663
738
 
664
- export { type ApiResponse, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, RepeaterField, 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, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
739
+ export { type ApiResponse, CmsCollectionField, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, RepeaterField, TecofApiClient, TecofEditor, type TecofEditorProps, TecofPicture, type TecofPictureProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCmsCollectionField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
package/dist/index.d.ts CHANGED
@@ -216,6 +216,21 @@ declare class TecofApiClient {
216
216
  */
217
217
  private previewBlobCache;
218
218
  getComponentPreview(domain: string, componentName: string): Promise<string | null>;
219
+ /**
220
+ * Fetch CMS collections list (for CmsCollectionField)
221
+ * Returns: [{ _id, name, slug, fields, ... }]
222
+ */
223
+ getCmsCollections(): Promise<ApiResponse<any[]>>;
224
+ /**
225
+ * Fetch items from a CMS collection by slug
226
+ * Returns: { items: [...], totalData: N }
227
+ */
228
+ getCmsCollectionItems(collectionSlug: string, options?: {
229
+ page?: number;
230
+ limit?: number;
231
+ sort?: 'newest' | 'oldest';
232
+ locale?: string;
233
+ }): Promise<ApiResponse<any>>;
219
234
  /** CDN base URL (defaults to apiUrl if not set) */
220
235
  get cdnUrl(): string;
221
236
  }
@@ -620,6 +635,66 @@ declare const createRepeaterField: (options: RepeaterFieldOptions) => {
620
635
  render: ({ value, onChange, readOnly, field, name, id }: RepeaterFieldProps) => react_jsx_runtime.JSX.Element;
621
636
  };
622
637
 
638
+ /** Slot definition: describes a data slot the component needs */
639
+ interface CmsSlotDefinition {
640
+ /** Label shown in the editor (e.g. "Başlık") */
641
+ label: string;
642
+ /** Optional: filter to specific CMS field types */
643
+ fieldTypes?: string[];
644
+ }
645
+ interface CmsCollectionFieldValue {
646
+ /** Selected collection slug */
647
+ collectionSlug: string;
648
+ /** Collection name (for display) */
649
+ collectionName?: string;
650
+ /** Max items to fetch */
651
+ limit?: number;
652
+ /** Sort order */
653
+ sort?: 'newest' | 'oldest';
654
+ /** Field mapping: slotKey → CMS field shortcode */
655
+ fieldMap?: Record<string, string>;
656
+ }
657
+ interface CmsCollectionFieldProps {
658
+ field: any;
659
+ name: string;
660
+ id: string;
661
+ value: CmsCollectionFieldValue | null;
662
+ onChange: (value: CmsCollectionFieldValue | null) => void;
663
+ readOnly?: boolean;
664
+ }
665
+ interface CmsCollectionFieldOptions {
666
+ /** Field label displayed in the Puck sidebar */
667
+ label?: string;
668
+ /** Icon displayed next to the label */
669
+ labelIcon?: ReactElement;
670
+ /** Whether this field is visible in the sidebar */
671
+ visible?: boolean;
672
+ /** Default limit for items */
673
+ defaultLimit?: number;
674
+ /** Show limit control */
675
+ showLimit?: boolean;
676
+ /** Show sort control */
677
+ showSort?: boolean;
678
+ /**
679
+ * Mappable slots: defines what data the component needs.
680
+ * Key = slot name used in code, Value = slot definition.
681
+ * Example: { title: { label: "Başlık" }, image: { label: "Görsel" } }
682
+ */
683
+ slots?: Record<string, CmsSlotDefinition>;
684
+ }
685
+ declare const CmsCollectionField: {
686
+ ({ value, onChange, readOnly, defaultLimit, showLimit, showSort, slots, }: CmsCollectionFieldProps & CmsCollectionFieldOptions): react_jsx_runtime.JSX.Element;
687
+ displayName: string;
688
+ };
689
+ declare const createCmsCollectionField: (options?: CmsCollectionFieldOptions) => {
690
+ type: "custom";
691
+ _fieldType: "cmsCollection";
692
+ label: string | undefined;
693
+ labelIcon: ReactElement<unknown, string | react.JSXElementConstructor<any>> | undefined;
694
+ visible: boolean | undefined;
695
+ render: ({ value, onChange, readOnly, field, name, id }: CmsCollectionFieldProps) => react_jsx_runtime.JSX.Element;
696
+ };
697
+
623
698
  interface FieldErrorBoundaryProps {
624
699
  /** The field name (for error reporting) */
625
700
  fieldName?: string;
@@ -661,4 +736,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
661
736
  declare function getDefaultTheme(): ThemeConfig;
662
737
  declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
663
738
 
664
- export { type ApiResponse, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, RepeaterField, 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, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
739
+ export { type ApiResponse, CmsCollectionField, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, type HSL, LanguageField, type LanguageFieldValue, LinkField, type LinkFieldValue, type MerchantInfoData, type PageApiData, type PuckContentItem, type PuckPageData, RepeaterField, TecofApiClient, TecofEditor, type TecofEditorProps, TecofPicture, type TecofPictureProps, TecofProvider, type TecofProviderProps, TecofRender, type TecofRenderProps, type ThemeColors, type ThemeConfig, type ThemeSpacing, type ThemeTypography, UploadField, type UploadedFile, createCmsCollectionField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };