@measured/puck-plugin-heading-analyzer 0.15.0-canary.47a27ed → 0.15.0-canary.91dff22

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 (3) hide show
  1. package/dist/index.d.ts +47 -43
  2. package/dist/index.js +2574 -2543
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -13,6 +13,36 @@ type Viewport = {
13
13
  icon?: iconTypes | ReactNode;
14
14
  };
15
15
 
16
+ type ItemWithId = {
17
+ _arrayId: string;
18
+ _originalIndex: number;
19
+ };
20
+ type ArrayState = {
21
+ items: ItemWithId[];
22
+ openId: string;
23
+ };
24
+ type UiState = {
25
+ leftSideBarVisible: boolean;
26
+ rightSideBarVisible: boolean;
27
+ itemSelector: ItemSelector | null;
28
+ arrayState: Record<string, ArrayState | undefined>;
29
+ componentList: Record<string, {
30
+ components?: string[];
31
+ title?: string;
32
+ visible?: boolean;
33
+ expanded?: boolean;
34
+ }>;
35
+ isDragging: boolean;
36
+ viewports: {
37
+ current: {
38
+ width: number;
39
+ height: number | "auto";
40
+ };
41
+ controlsVisible: boolean;
42
+ options: Viewport[];
43
+ };
44
+ };
45
+
16
46
  type FieldOption = {
17
47
  label: string;
18
48
  value: string | number | boolean;
@@ -103,56 +133,28 @@ type CustomField<Props extends any = {}> = BaseField & {
103
133
  type: "custom";
104
134
  render: (props: {
105
135
  field: CustomField<Props>;
106
- name: string;
136
+ name?: string;
137
+ id: string;
107
138
  value: Props;
108
139
  onChange: (value: Props) => void;
109
140
  readOnly?: boolean;
110
141
  }) => ReactElement;
111
142
  };
112
- type Field<Props extends {
143
+ type Field<Props extends any = any> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props extends {
113
144
  [key: string]: any;
114
- } = {
145
+ } ? Props : any> | ObjectField<Props extends {
115
146
  [key: string]: any;
116
- }> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<Props> | ObjectField<Props> | ExternalField<Props> | ExternalFieldWithAdaptor<Props> | CustomField<Props>;
117
- type ItemWithId = {
118
- _arrayId: string;
119
- _originalIndex: number;
120
- };
121
- type ArrayState = {
122
- items: ItemWithId[];
123
- openId: string;
124
- };
125
- type UiState = {
126
- leftSideBarVisible: boolean;
127
- rightSideBarVisible: boolean;
128
- itemSelector: ItemSelector | null;
129
- arrayState: Record<string, ArrayState | undefined>;
130
- componentList: Record<string, {
131
- components?: string[];
132
- title?: string;
133
- visible?: boolean;
134
- expanded?: boolean;
135
- }>;
136
- isDragging: boolean;
137
- viewports: {
138
- current: {
139
- width: number;
140
- height: number | "auto";
141
- };
142
- controlsVisible: boolean;
143
- options: Viewport[];
144
- };
145
- };
146
-
147
- type InputProps<F = Field<any>> = {
148
- name: string;
147
+ } ? Props : any> | ExternalField<Props extends {
148
+ [key: string]: any;
149
+ } ? Props : any> | ExternalFieldWithAdaptor<Props extends {
150
+ [key: string]: any;
151
+ } ? Props : any> | CustomField<Props>;
152
+ type FieldProps<ValueType = any, F = Field<any>> = {
149
153
  field: F;
150
- value: any;
151
- id: string;
152
- label?: string;
153
- onChange: (value: any, uiState?: Partial<UiState>) => void;
154
+ value: ValueType;
155
+ id?: string;
156
+ onChange: (value: ValueType, uiState?: Partial<UiState>) => void;
154
157
  readOnly?: boolean;
155
- readOnlyFields?: Record<string, boolean | undefined>;
156
158
  };
157
159
 
158
160
  type RenderFunc<Props extends {
@@ -197,14 +199,16 @@ type Overrides = OverridesGeneric<{
197
199
  puck: RenderFunc;
198
200
  }>;
199
201
  type FieldRenderFunctions = Omit<{
200
- [Type in Field["type"]]: React.FunctionComponent<InputProps<Extract<Field, {
202
+ [Type in Field["type"]]: React.FunctionComponent<FieldProps<Extract<Field, {
201
203
  type: Type;
202
204
  }>> & {
203
205
  children: ReactNode;
206
+ name: string;
204
207
  }>;
205
208
  }, "custom"> & {
206
- [key: string]: React.FunctionComponent<InputProps<any> & {
209
+ [key: string]: React.FunctionComponent<FieldProps<any> & {
207
210
  children: ReactNode;
211
+ name: string;
208
212
  }>;
209
213
  };
210
214