@ozguraltan/strapi-content-input 1.0.21 → 1.0.22

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.
Files changed (24) hide show
  1. package/README.md +33 -7
  2. package/dist/admin/{AnalyticsHubPage-0p0Mx4AU.js → AnalyticsHubPage-B1_chQkG.js} +2 -2
  3. package/dist/admin/{AnalyticsHubPage-DsrcGI_Y.mjs → AnalyticsHubPage-DUj3D2kA.mjs} +2 -2
  4. package/dist/admin/{ContentInputField-CHXrzvE-.mjs → ContentInputField-BrtpTCDd.mjs} +365 -173
  5. package/dist/admin/{ContentInputField-7rWLSx_7.js → ContentInputField-CQFQxxgm.js} +365 -173
  6. package/dist/admin/{SurveyWidgetEditor-BmgYQaQS.js → SurveyWidgetEditor-C5Uvyf_h.js} +81 -31
  7. package/dist/admin/{SurveyWidgetEditor-BVN6X_3G.mjs → SurveyWidgetEditor-DGSwgTzR.mjs} +81 -31
  8. package/dist/admin/{index-hFIuYqu5.mjs → index-Dc7AFLOj.mjs} +2 -2
  9. package/dist/admin/{index-CZAwXCFH.js → index-i0NfSYto.js} +2 -2
  10. package/dist/admin/index.js +1 -1
  11. package/dist/admin/index.mjs +1 -1
  12. package/dist/admin/src/components/common/CIImageSettingsControl.d.ts +17 -0
  13. package/dist/admin/src/components/widgets/CustomCardWidgetEditor.d.ts +1 -0
  14. package/dist/admin/src/components/widgets/HeroSliderStage.d.ts +3 -0
  15. package/dist/admin/src/core/canvasClasses.d.ts +1 -0
  16. package/dist/admin/src/core/types.d.ts +12 -0
  17. package/dist/server/index.js +1176 -184
  18. package/dist/server/index.mjs +1176 -184
  19. package/dist/server/src/config/index.d.ts +4 -0
  20. package/dist/server/src/controllers/ci-image.d.ts +11 -2
  21. package/dist/server/src/controllers/index.d.ts +1 -0
  22. package/dist/server/src/index.d.ts +5 -0
  23. package/dist/server/src/utils/image-variants.d.ts +74 -0
  24. package/package.json +1 -1
@@ -1,6 +1,10 @@
1
1
  declare const _default: {
2
2
  default: {
3
3
  previewUrl: string;
4
+ imageVariantFolder: string;
5
+ imageVariantFormat: string;
6
+ imageVariantQuality: number;
7
+ redirectProxyToCdn: boolean;
4
8
  };
5
9
  validator(): void;
6
10
  };
@@ -4,13 +4,22 @@ declare const ciImageController: ({ strapi }: {
4
4
  }) => {
5
5
  /**
6
6
  * GET /api/content-input/image & GET /content-input/image
7
- * On-the-fly image scaling & cropping powered by sharp with disk + CDN HTTP caching.
7
+ * Generates `ci-optimized` WebP variants via sharp, uploads to Strapi's Upload Provider (CDN),
8
+ * persists in `plugin::upload.file.formats`, and issues a 302 redirect when a remote CDN URL is available
9
+ * (with local byte-stream fallback in local-only environments).
8
10
  */
9
11
  processImage(ctx: any): Promise<any>;
12
+ /**
13
+ * POST /content-input/media/optimize
14
+ * Eagerly optimizes one or multiple selected/uploaded Media Library assets into `ci-optimized/*.webp`
15
+ * on the configured Upload Provider (CDN) and returns enriched CIMediaAsset object(s) with `formats` & `optimized_url`.
16
+ */
17
+ optimizeMedia(ctx: any): Promise<any>;
10
18
  /**
11
19
  * POST /content-input/media/crop
12
20
  * Interactive crop & rotate using sharp on the backend (works seamlessly with local disk AND remote CDNs).
13
- * Supports mode: 'replace' (crops original asset in Media Library) or 'duplicate' (saves as new asset).
21
+ * Supports mode: 'replace' (crops original asset in Media Library & refreshes ci-optimized variants)
22
+ * or 'duplicate' (saves as new asset).
14
23
  */
15
24
  cropMedia(ctx: any): Promise<any>;
16
25
  /**
@@ -20,6 +20,7 @@ declare const _default: {
20
20
  strapi: import('@strapi/types/dist/core/strapi.js').Strapi;
21
21
  }) => {
22
22
  processImage(ctx: any): Promise<any>;
23
+ optimizeMedia(ctx: any): Promise<any>;
23
24
  cropMedia(ctx: any): Promise<any>;
24
25
  updateMediaInfo(ctx: any): Promise<any>;
25
26
  deleteMedia(ctx: any): Promise<any>;
@@ -11,6 +11,10 @@ declare const _default: {
11
11
  config: {
12
12
  default: {
13
13
  previewUrl: string;
14
+ imageVariantFolder: string;
15
+ imageVariantFormat: string;
16
+ imageVariantQuality: number;
17
+ redirectProxyToCdn: boolean;
14
18
  };
15
19
  validator(): void;
16
20
  };
@@ -36,6 +40,7 @@ declare const _default: {
36
40
  strapi: import('@strapi/types/dist/core/strapi.js').Strapi;
37
41
  }) => {
38
42
  processImage(ctx: any): Promise<any>;
43
+ optimizeMedia(ctx: any): Promise<any>;
39
44
  cropMedia(ctx: any): Promise<any>;
40
45
  updateMediaInfo(ctx: any): Promise<any>;
41
46
  deleteMedia(ctx: any): Promise<any>;
@@ -0,0 +1,74 @@
1
+ import { Core } from '@strapi/strapi';
2
+ export interface VariantRuntimeConfig {
3
+ folder: string | null;
4
+ defaultFormat: 'webp' | 'auto';
5
+ redirectProxyToCdn: boolean;
6
+ defaultQuality: number;
7
+ }
8
+ export interface ImageProcessSpec {
9
+ processMode: 'fit' | 'widen' | 'auto' | 'none';
10
+ w: number;
11
+ h: number;
12
+ maxW: number;
13
+ q: number;
14
+ rotate: number;
15
+ requestedFormat?: string;
16
+ }
17
+ export declare function getSharp(): any;
18
+ export declare function getVariantConfig(strapi: Core.Strapi): VariantRuntimeConfig;
19
+ export declare function isAbsoluteHttpUrl(url?: string | null): boolean;
20
+ export declare function isOptimizableRasterImage(mime?: string | null, urlOrName?: string | null): boolean;
21
+ export declare function loadSourceBuffer(strapi: Core.Strapi, src: string): Promise<{
22
+ buffer: Buffer;
23
+ mime: string;
24
+ }>;
25
+ export declare function normalizeImageProcessSpec(imageSettings?: Record<string, any> | null, defaultAutoMaxW?: number): ImageProcessSpec;
26
+ export declare function computeCiFormatKey(processMode: 'fit' | 'widen' | 'auto', w: number, h: number, rotate?: number): string;
27
+ export declare function compactAssetFormats(formats?: Record<string, any> | null): Record<string, {
28
+ url: string;
29
+ width?: number;
30
+ height?: number;
31
+ mime?: string;
32
+ size?: number;
33
+ }> | undefined;
34
+ export declare function findUploadFileForAsset(strapi: Core.Strapi, assetOrUrl: any, cache?: Map<string, any>): Promise<any | null>;
35
+ export declare function renderSharpVariantBuffer(sourceBuffer: Buffer, sourceMime: string, opts: {
36
+ processMode: 'fit' | 'widen' | 'auto';
37
+ w: number;
38
+ h: number;
39
+ q: number;
40
+ rotate?: number;
41
+ cx?: number;
42
+ cy?: number;
43
+ cw?: number;
44
+ ch?: number;
45
+ requestedFormat?: string;
46
+ defaultFormat?: 'webp' | 'auto';
47
+ }): Promise<{
48
+ buffer: Buffer;
49
+ contentType: string;
50
+ ext: string;
51
+ width?: number;
52
+ height?: number;
53
+ }>;
54
+ export declare function ensureMediaVariant(strapi: Core.Strapi, existingFile: any, spec: {
55
+ processMode: 'fit' | 'widen' | 'auto';
56
+ w: number;
57
+ h: number;
58
+ q?: number;
59
+ rotate?: number;
60
+ requestedFormat?: string;
61
+ }): Promise<{
62
+ formatKey: string;
63
+ formatEntry: any | null;
64
+ updatedFile: any;
65
+ }>;
66
+ export declare function clearGeneratedCiVariantsForFile(strapi: Core.Strapi, fileRecord: any): Promise<void>;
67
+ export declare function enrichMediaAssetNode(strapi: Core.Strapi, asset: any, opts?: {
68
+ imageSettings?: Record<string, any> | null;
69
+ defaultAutoMaxW?: number;
70
+ alsoEnsureAutoMaxW?: number;
71
+ fileCache?: Map<string, any>;
72
+ }): Promise<any>;
73
+ export declare function syncContentInputTreeMedia(strapi: Core.Strapi, rawValue: any): Promise<any>;
74
+ export declare function syncSurveyQuestionsMedia(strapi: Core.Strapi, questions: any[]): Promise<any[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ozguraltan/strapi-content-input",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "Locomotive CMS ContentInput visual page/content builder ported to Strapi v5 as a native JSONB Custom Field plugin.",
5
5
  "license": "MIT",
6
6
  "author": "Ozgur Altan <ozguraltan05@gmail.com>",