@tecof/theme-editor 0.0.5 → 0.0.7
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 +107 -3
- package/dist/index.d.ts +107 -3
- package/dist/index.js +12433 -2357
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12433 -2360
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +73 -0
- package/package.json +27 -3
package/dist/index.d.mts
CHANGED
|
@@ -136,6 +136,12 @@ interface UploadedFile {
|
|
|
136
136
|
[key: string]: any;
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
+
interface LinkFieldValue {
|
|
140
|
+
url: string;
|
|
141
|
+
label?: string;
|
|
142
|
+
target?: '_self' | '_blank';
|
|
143
|
+
type?: 'page' | 'custom';
|
|
144
|
+
}
|
|
139
145
|
|
|
140
146
|
/**
|
|
141
147
|
* Tecof API Client — handles communication with the Tecof backend
|
|
@@ -176,6 +182,19 @@ declare class TecofApiClient {
|
|
|
176
182
|
* Fetch previously uploaded files (for media library selector)
|
|
177
183
|
*/
|
|
178
184
|
getUploads(page?: number, limit?: number): Promise<ApiResponse<any[]>>;
|
|
185
|
+
/**
|
|
186
|
+
* Fetch merchant pages list (for LinkField page selector)
|
|
187
|
+
* Returns pages with: _id, slug, title, status, metaTitle
|
|
188
|
+
*/
|
|
189
|
+
getPages(): Promise<ApiResponse<any[]>>;
|
|
190
|
+
/**
|
|
191
|
+
* Translate text to multiple languages (for LanguageField)
|
|
192
|
+
* Returns [{code, value}] for each locale
|
|
193
|
+
*/
|
|
194
|
+
translate(text: string, sourceLang: string, locales: string[], isHtml?: boolean): Promise<ApiResponse<{
|
|
195
|
+
code: string;
|
|
196
|
+
value: string;
|
|
197
|
+
}[]>>;
|
|
179
198
|
/** CDN base URL (derived from apiUrl) */
|
|
180
199
|
get cdnUrl(): string;
|
|
181
200
|
}
|
|
@@ -215,6 +234,45 @@ declare const TecofEditor: ({ pageId, config, accessToken, onSave, onChange, ove
|
|
|
215
234
|
*/
|
|
216
235
|
declare const TecofRender: ({ data, config, className }: TecofRenderProps) => react_jsx_runtime.JSX.Element | null;
|
|
217
236
|
|
|
237
|
+
type PictureSize = 'thumbnail' | 'medium' | 'large' | 'full';
|
|
238
|
+
interface TecofPictureProps {
|
|
239
|
+
/** The uploaded file data from UploadField */
|
|
240
|
+
data: UploadedFile | null | undefined;
|
|
241
|
+
/** Alt text for accessibility */
|
|
242
|
+
alt?: string | null;
|
|
243
|
+
/** Image size variant */
|
|
244
|
+
size?: PictureSize;
|
|
245
|
+
/** Loading strategy */
|
|
246
|
+
loading?: 'lazy' | 'eager';
|
|
247
|
+
/** Fill the parent container (position: absolute, 100%) */
|
|
248
|
+
fill?: boolean;
|
|
249
|
+
/** Container style overrides */
|
|
250
|
+
style?: React.CSSProperties;
|
|
251
|
+
/** Image style overrides */
|
|
252
|
+
imgStyle?: React.CSSProperties;
|
|
253
|
+
/** Container className */
|
|
254
|
+
className?: string;
|
|
255
|
+
/** Image className */
|
|
256
|
+
imgClassName?: string;
|
|
257
|
+
/** Image width (auto-detected from meta if available) */
|
|
258
|
+
width?: number;
|
|
259
|
+
/** Image height (auto-detected from meta if available) */
|
|
260
|
+
height?: number;
|
|
261
|
+
/** Whether to use a blur placeholder while loading */
|
|
262
|
+
usePlaceholder?: boolean;
|
|
263
|
+
/** Custom blur data URL */
|
|
264
|
+
blurDataURL?: string;
|
|
265
|
+
/** Fancybox lightbox support */
|
|
266
|
+
fancybox?: boolean;
|
|
267
|
+
/** Fancybox group name */
|
|
268
|
+
fancyboxName?: string;
|
|
269
|
+
/** Custom Image component (e.g. Next.js Image). If not provided, uses standard <img> */
|
|
270
|
+
ImageComponent?: React.ComponentType<any>;
|
|
271
|
+
/** Extra props to pass to the Image component (e.g. quality, priority, placeholder) */
|
|
272
|
+
imageProps?: Record<string, any>;
|
|
273
|
+
}
|
|
274
|
+
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>;
|
|
275
|
+
|
|
218
276
|
interface LanguageFieldProps {
|
|
219
277
|
field: any;
|
|
220
278
|
name: string;
|
|
@@ -230,8 +288,10 @@ interface LanguageFieldOptions {
|
|
|
230
288
|
textareaRows?: number;
|
|
231
289
|
/** Placeholder text */
|
|
232
290
|
placeholder?: string;
|
|
291
|
+
/** Whether the content is HTML (for translation) */
|
|
292
|
+
isHtml?: boolean;
|
|
233
293
|
}
|
|
234
|
-
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
294
|
+
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
235
295
|
declare const createLanguageField: (options?: LanguageFieldOptions & {
|
|
236
296
|
label?: string;
|
|
237
297
|
}) => {
|
|
@@ -303,10 +363,29 @@ interface UploadFieldOptions {
|
|
|
303
363
|
maxFiles?: number;
|
|
304
364
|
acceptedTypes?: string[];
|
|
305
365
|
maxFileSize?: string;
|
|
366
|
+
maxTotalFileSize?: string;
|
|
306
367
|
folder?: string;
|
|
307
368
|
label?: string;
|
|
369
|
+
/** Show uploaded files list with view/download buttons */
|
|
370
|
+
showUploadedFiles?: boolean;
|
|
371
|
+
/** Preview height for images in FilePond */
|
|
372
|
+
imagePreviewHeight?: number;
|
|
373
|
+
/** Allow reorder in FilePond */
|
|
374
|
+
allowReorder?: boolean;
|
|
375
|
+
/** Enable image compression before upload */
|
|
376
|
+
imageCompressionEnabled?: boolean;
|
|
377
|
+
/** Image compression options */
|
|
378
|
+
imageCompressionOptions?: {
|
|
379
|
+
maxSizeMB?: number;
|
|
380
|
+
maxWidthOrHeight?: number;
|
|
381
|
+
useWebWorker?: boolean;
|
|
382
|
+
fileType?: string;
|
|
383
|
+
};
|
|
308
384
|
}
|
|
309
|
-
declare const UploadField:
|
|
385
|
+
declare const UploadField: {
|
|
386
|
+
({ value: rawValue, onChange, allowMultiple, maxFiles, acceptedTypes, maxFileSize, maxTotalFileSize, folder, readOnly, showUploadedFiles, imagePreviewHeight, allowReorder, imageCompressionEnabled, imageCompressionOptions, }: UploadFieldProps & UploadFieldOptions): react_jsx_runtime.JSX.Element;
|
|
387
|
+
displayName: string;
|
|
388
|
+
};
|
|
310
389
|
declare const createUploadField: (options?: UploadFieldOptions) => {
|
|
311
390
|
type: "custom";
|
|
312
391
|
label: string | undefined;
|
|
@@ -362,6 +441,31 @@ declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
|
|
|
362
441
|
render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
363
442
|
};
|
|
364
443
|
|
|
444
|
+
interface LinkFieldProps {
|
|
445
|
+
field: any;
|
|
446
|
+
name: string;
|
|
447
|
+
id: string;
|
|
448
|
+
value: LinkFieldValue | null;
|
|
449
|
+
onChange: (value: LinkFieldValue | null) => void;
|
|
450
|
+
readOnly?: boolean;
|
|
451
|
+
}
|
|
452
|
+
interface LinkFieldOptions {
|
|
453
|
+
label?: string;
|
|
454
|
+
/** Show target selector (_self / _blank) */
|
|
455
|
+
showTarget?: boolean;
|
|
456
|
+
/** Placeholder for URL input */
|
|
457
|
+
placeholder?: string;
|
|
458
|
+
}
|
|
459
|
+
declare const LinkField: {
|
|
460
|
+
({ value, onChange, readOnly, showTarget, placeholder, }: LinkFieldProps & LinkFieldOptions): react_jsx_runtime.JSX.Element;
|
|
461
|
+
displayName: string;
|
|
462
|
+
};
|
|
463
|
+
declare const createLinkField: (options?: LinkFieldOptions) => {
|
|
464
|
+
type: "custom";
|
|
465
|
+
label: string | undefined;
|
|
466
|
+
render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
|
|
467
|
+
};
|
|
468
|
+
|
|
365
469
|
declare function hexToHsl(hex: string): HSL;
|
|
366
470
|
declare function hslToHex(h: number, s: number, l: number): string;
|
|
367
471
|
declare function lighten(hex: string, amount: number): string;
|
|
@@ -370,4 +474,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
|
|
|
370
474
|
declare function getDefaultTheme(): ThemeConfig;
|
|
371
475
|
declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
372
476
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -136,6 +136,12 @@ interface UploadedFile {
|
|
|
136
136
|
[key: string]: any;
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
|
+
interface LinkFieldValue {
|
|
140
|
+
url: string;
|
|
141
|
+
label?: string;
|
|
142
|
+
target?: '_self' | '_blank';
|
|
143
|
+
type?: 'page' | 'custom';
|
|
144
|
+
}
|
|
139
145
|
|
|
140
146
|
/**
|
|
141
147
|
* Tecof API Client — handles communication with the Tecof backend
|
|
@@ -176,6 +182,19 @@ declare class TecofApiClient {
|
|
|
176
182
|
* Fetch previously uploaded files (for media library selector)
|
|
177
183
|
*/
|
|
178
184
|
getUploads(page?: number, limit?: number): Promise<ApiResponse<any[]>>;
|
|
185
|
+
/**
|
|
186
|
+
* Fetch merchant pages list (for LinkField page selector)
|
|
187
|
+
* Returns pages with: _id, slug, title, status, metaTitle
|
|
188
|
+
*/
|
|
189
|
+
getPages(): Promise<ApiResponse<any[]>>;
|
|
190
|
+
/**
|
|
191
|
+
* Translate text to multiple languages (for LanguageField)
|
|
192
|
+
* Returns [{code, value}] for each locale
|
|
193
|
+
*/
|
|
194
|
+
translate(text: string, sourceLang: string, locales: string[], isHtml?: boolean): Promise<ApiResponse<{
|
|
195
|
+
code: string;
|
|
196
|
+
value: string;
|
|
197
|
+
}[]>>;
|
|
179
198
|
/** CDN base URL (derived from apiUrl) */
|
|
180
199
|
get cdnUrl(): string;
|
|
181
200
|
}
|
|
@@ -215,6 +234,45 @@ declare const TecofEditor: ({ pageId, config, accessToken, onSave, onChange, ove
|
|
|
215
234
|
*/
|
|
216
235
|
declare const TecofRender: ({ data, config, className }: TecofRenderProps) => react_jsx_runtime.JSX.Element | null;
|
|
217
236
|
|
|
237
|
+
type PictureSize = 'thumbnail' | 'medium' | 'large' | 'full';
|
|
238
|
+
interface TecofPictureProps {
|
|
239
|
+
/** The uploaded file data from UploadField */
|
|
240
|
+
data: UploadedFile | null | undefined;
|
|
241
|
+
/** Alt text for accessibility */
|
|
242
|
+
alt?: string | null;
|
|
243
|
+
/** Image size variant */
|
|
244
|
+
size?: PictureSize;
|
|
245
|
+
/** Loading strategy */
|
|
246
|
+
loading?: 'lazy' | 'eager';
|
|
247
|
+
/** Fill the parent container (position: absolute, 100%) */
|
|
248
|
+
fill?: boolean;
|
|
249
|
+
/** Container style overrides */
|
|
250
|
+
style?: React.CSSProperties;
|
|
251
|
+
/** Image style overrides */
|
|
252
|
+
imgStyle?: React.CSSProperties;
|
|
253
|
+
/** Container className */
|
|
254
|
+
className?: string;
|
|
255
|
+
/** Image className */
|
|
256
|
+
imgClassName?: string;
|
|
257
|
+
/** Image width (auto-detected from meta if available) */
|
|
258
|
+
width?: number;
|
|
259
|
+
/** Image height (auto-detected from meta if available) */
|
|
260
|
+
height?: number;
|
|
261
|
+
/** Whether to use a blur placeholder while loading */
|
|
262
|
+
usePlaceholder?: boolean;
|
|
263
|
+
/** Custom blur data URL */
|
|
264
|
+
blurDataURL?: string;
|
|
265
|
+
/** Fancybox lightbox support */
|
|
266
|
+
fancybox?: boolean;
|
|
267
|
+
/** Fancybox group name */
|
|
268
|
+
fancyboxName?: string;
|
|
269
|
+
/** Custom Image component (e.g. Next.js Image). If not provided, uses standard <img> */
|
|
270
|
+
ImageComponent?: React.ComponentType<any>;
|
|
271
|
+
/** Extra props to pass to the Image component (e.g. quality, priority, placeholder) */
|
|
272
|
+
imageProps?: Record<string, any>;
|
|
273
|
+
}
|
|
274
|
+
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>;
|
|
275
|
+
|
|
218
276
|
interface LanguageFieldProps {
|
|
219
277
|
field: any;
|
|
220
278
|
name: string;
|
|
@@ -230,8 +288,10 @@ interface LanguageFieldOptions {
|
|
|
230
288
|
textareaRows?: number;
|
|
231
289
|
/** Placeholder text */
|
|
232
290
|
placeholder?: string;
|
|
291
|
+
/** Whether the content is HTML (for translation) */
|
|
292
|
+
isHtml?: boolean;
|
|
233
293
|
}
|
|
234
|
-
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
294
|
+
declare const LanguageField: ({ value, onChange, readOnly, isTextarea, textareaRows, placeholder, isHtml, }: LanguageFieldProps & LanguageFieldOptions) => react_jsx_runtime.JSX.Element | null;
|
|
235
295
|
declare const createLanguageField: (options?: LanguageFieldOptions & {
|
|
236
296
|
label?: string;
|
|
237
297
|
}) => {
|
|
@@ -303,10 +363,29 @@ interface UploadFieldOptions {
|
|
|
303
363
|
maxFiles?: number;
|
|
304
364
|
acceptedTypes?: string[];
|
|
305
365
|
maxFileSize?: string;
|
|
366
|
+
maxTotalFileSize?: string;
|
|
306
367
|
folder?: string;
|
|
307
368
|
label?: string;
|
|
369
|
+
/** Show uploaded files list with view/download buttons */
|
|
370
|
+
showUploadedFiles?: boolean;
|
|
371
|
+
/** Preview height for images in FilePond */
|
|
372
|
+
imagePreviewHeight?: number;
|
|
373
|
+
/** Allow reorder in FilePond */
|
|
374
|
+
allowReorder?: boolean;
|
|
375
|
+
/** Enable image compression before upload */
|
|
376
|
+
imageCompressionEnabled?: boolean;
|
|
377
|
+
/** Image compression options */
|
|
378
|
+
imageCompressionOptions?: {
|
|
379
|
+
maxSizeMB?: number;
|
|
380
|
+
maxWidthOrHeight?: number;
|
|
381
|
+
useWebWorker?: boolean;
|
|
382
|
+
fileType?: string;
|
|
383
|
+
};
|
|
308
384
|
}
|
|
309
|
-
declare const UploadField:
|
|
385
|
+
declare const UploadField: {
|
|
386
|
+
({ value: rawValue, onChange, allowMultiple, maxFiles, acceptedTypes, maxFileSize, maxTotalFileSize, folder, readOnly, showUploadedFiles, imagePreviewHeight, allowReorder, imageCompressionEnabled, imageCompressionOptions, }: UploadFieldProps & UploadFieldOptions): react_jsx_runtime.JSX.Element;
|
|
387
|
+
displayName: string;
|
|
388
|
+
};
|
|
310
389
|
declare const createUploadField: (options?: UploadFieldOptions) => {
|
|
311
390
|
type: "custom";
|
|
312
391
|
label: string | undefined;
|
|
@@ -362,6 +441,31 @@ declare const createCodeEditorField: (options?: CodeEditorFieldOptions) => {
|
|
|
362
441
|
render: ({ value, onChange, readOnly, field, name, id }: CodeEditorFieldProps) => react_jsx_runtime.JSX.Element;
|
|
363
442
|
};
|
|
364
443
|
|
|
444
|
+
interface LinkFieldProps {
|
|
445
|
+
field: any;
|
|
446
|
+
name: string;
|
|
447
|
+
id: string;
|
|
448
|
+
value: LinkFieldValue | null;
|
|
449
|
+
onChange: (value: LinkFieldValue | null) => void;
|
|
450
|
+
readOnly?: boolean;
|
|
451
|
+
}
|
|
452
|
+
interface LinkFieldOptions {
|
|
453
|
+
label?: string;
|
|
454
|
+
/** Show target selector (_self / _blank) */
|
|
455
|
+
showTarget?: boolean;
|
|
456
|
+
/** Placeholder for URL input */
|
|
457
|
+
placeholder?: string;
|
|
458
|
+
}
|
|
459
|
+
declare const LinkField: {
|
|
460
|
+
({ value, onChange, readOnly, showTarget, placeholder, }: LinkFieldProps & LinkFieldOptions): react_jsx_runtime.JSX.Element;
|
|
461
|
+
displayName: string;
|
|
462
|
+
};
|
|
463
|
+
declare const createLinkField: (options?: LinkFieldOptions) => {
|
|
464
|
+
type: "custom";
|
|
465
|
+
label: string | undefined;
|
|
466
|
+
render: ({ value, onChange, readOnly, field, name, id }: LinkFieldProps) => react_jsx_runtime.JSX.Element;
|
|
467
|
+
};
|
|
468
|
+
|
|
365
469
|
declare function hexToHsl(hex: string): HSL;
|
|
366
470
|
declare function hslToHex(h: number, s: number, l: number): string;
|
|
367
471
|
declare function lighten(hex: string, amount: number): string;
|
|
@@ -370,4 +474,4 @@ declare function generateCSSVariables(theme: ThemeConfig): string;
|
|
|
370
474
|
declare function getDefaultTheme(): ThemeConfig;
|
|
371
475
|
declare function mergeTheme(base: ThemeConfig, overrides: Partial<ThemeConfig>): ThemeConfig;
|
|
372
476
|
|
|
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 };
|
|
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 };
|