@measured/puck-plugin-emotion-cache 0.20.0-canary.8c56aa8b → 0.20.0-canary.8f2f0f46

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
@@ -19,6 +19,7 @@ type BaseField = {
19
19
  type TextField = BaseField & {
20
20
  type: "text";
21
21
  placeholder?: string;
22
+ contentEditable?: boolean;
22
23
  };
23
24
  type NumberField = BaseField & {
24
25
  type: "number";
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
30
31
  type TextareaField = BaseField & {
31
32
  type: "textarea";
32
33
  placeholder?: string;
34
+ contentEditable?: boolean;
33
35
  };
34
36
  type SelectField = BaseField & {
35
37
  type: "select";
@@ -107,6 +109,7 @@ type CustomFieldRender<Value extends any> = (props: {
107
109
  type CustomField<Value extends any> = BaseField & {
108
110
  type: "custom";
109
111
  render: CustomFieldRender<Value>;
112
+ contentEditable?: boolean;
110
113
  };
111
114
  type SlotField = BaseField & {
112
115
  type: "slot";
@@ -122,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
122
125
  readOnly?: boolean;
123
126
  };
124
127
 
128
+ type ExtractField<T extends Field["type"]> = Extract<Field, {
129
+ type: T;
130
+ }>;
131
+
125
132
  type Metadata = {
126
133
  [key: string]: any;
127
134
  };
@@ -162,6 +169,23 @@ type UiState = {
162
169
  };
163
170
  };
164
171
 
172
+ type MapFnParams<ThisField = Field> = {
173
+ value: any;
174
+ parentId: string;
175
+ propName: string;
176
+ field: ThisField;
177
+ propPath: string;
178
+ };
179
+
180
+ type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
181
+ isReadOnly: boolean;
182
+ componentId: string;
183
+ };
184
+ type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
185
+ type FieldTransforms = Partial<{
186
+ [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
187
+ }>;
188
+
165
189
  type RenderFunc<Props extends {
166
190
  [key: string]: any;
167
191
  } = {
@@ -247,7 +271,8 @@ type Viewport = {
247
271
  };
248
272
 
249
273
  type Plugin = {
250
- overrides: Partial<Overrides>;
274
+ overrides?: Partial<Overrides>;
275
+ fieldTransforms?: FieldTransforms;
251
276
  };
252
277
 
253
278
  declare const createEmotionCachePlugin: (key: string) => Plugin;
package/dist/index.d.ts CHANGED
@@ -19,6 +19,7 @@ type BaseField = {
19
19
  type TextField = BaseField & {
20
20
  type: "text";
21
21
  placeholder?: string;
22
+ contentEditable?: boolean;
22
23
  };
23
24
  type NumberField = BaseField & {
24
25
  type: "number";
@@ -30,6 +31,7 @@ type NumberField = BaseField & {
30
31
  type TextareaField = BaseField & {
31
32
  type: "textarea";
32
33
  placeholder?: string;
34
+ contentEditable?: boolean;
33
35
  };
34
36
  type SelectField = BaseField & {
35
37
  type: "select";
@@ -107,6 +109,7 @@ type CustomFieldRender<Value extends any> = (props: {
107
109
  type CustomField<Value extends any> = BaseField & {
108
110
  type: "custom";
109
111
  render: CustomFieldRender<Value>;
112
+ contentEditable?: boolean;
110
113
  };
111
114
  type SlotField = BaseField & {
112
115
  type: "slot";
@@ -122,6 +125,10 @@ type FieldProps<F = Field<any>, ValueType = any> = {
122
125
  readOnly?: boolean;
123
126
  };
124
127
 
128
+ type ExtractField<T extends Field["type"]> = Extract<Field, {
129
+ type: T;
130
+ }>;
131
+
125
132
  type Metadata = {
126
133
  [key: string]: any;
127
134
  };
@@ -162,6 +169,23 @@ type UiState = {
162
169
  };
163
170
  };
164
171
 
172
+ type MapFnParams<ThisField = Field> = {
173
+ value: any;
174
+ parentId: string;
175
+ propName: string;
176
+ field: ThisField;
177
+ propPath: string;
178
+ };
179
+
180
+ type FieldTransformFnParams<T> = Omit<MapFnParams<T>, "parentId"> & {
181
+ isReadOnly: boolean;
182
+ componentId: string;
183
+ };
184
+ type FieldTransformFn<T = any> = (params: FieldTransformFnParams<T>) => any;
185
+ type FieldTransforms = Partial<{
186
+ [FieldType in Field["type"]]: FieldTransformFn<ExtractField<FieldType>>;
187
+ }>;
188
+
165
189
  type RenderFunc<Props extends {
166
190
  [key: string]: any;
167
191
  } = {
@@ -247,7 +271,8 @@ type Viewport = {
247
271
  };
248
272
 
249
273
  type Plugin = {
250
- overrides: Partial<Overrides>;
274
+ overrides?: Partial<Overrides>;
275
+ fieldTransforms?: FieldTransforms;
251
276
  };
252
277
 
253
278
  declare const createEmotionCachePlugin: (key: string) => Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck-plugin-emotion-cache",
3
- "version": "0.20.0-canary.8c56aa8b",
3
+ "version": "0.20.0-canary.8f2f0f46",
4
4
  "author": "Chris Villa <chris@puckeditor.com>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "devDependencies": {
25
25
  "@emotion/react": "^11.13.3",
26
- "@measured/puck": "^0.20.0-canary.8c56aa8b",
26
+ "@measured/puck": "^0.20.0-canary.8f2f0f46",
27
27
  "@types/react": "^19.0.1",
28
28
  "@types/react-dom": "^19.0.2",
29
29
  "eslint": "^7.32.0",