@measured/puck-plugin-heading-analyzer 0.21.0-canary.a5160e5d → 0.21.0-canary.af48a401
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 +54 -43
- package/dist/index.d.ts +54 -43
- package/dist/index.js +47 -73
- package/dist/index.mjs +44 -70
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties,
|
|
1
|
+
import { ReactElement, ReactNode, CSSProperties, ElementType, JSX } from 'react';
|
|
2
2
|
|
|
3
3
|
type ItemSelector = {
|
|
4
4
|
index: number;
|
|
@@ -10,63 +10,63 @@ type FieldOption = {
|
|
|
10
10
|
value: string | number | boolean | undefined | null | object;
|
|
11
11
|
};
|
|
12
12
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
13
|
-
|
|
13
|
+
interface BaseField {
|
|
14
14
|
label?: string;
|
|
15
15
|
labelIcon?: ReactElement;
|
|
16
|
-
metadata?:
|
|
16
|
+
metadata?: FieldMetadata;
|
|
17
17
|
visible?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
interface TextField extends BaseField {
|
|
20
20
|
type: "text";
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
contentEditable?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
interface NumberField extends BaseField {
|
|
25
25
|
type: "number";
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
min?: number;
|
|
28
28
|
max?: number;
|
|
29
29
|
step?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
30
|
+
}
|
|
31
|
+
interface TextareaField extends BaseField {
|
|
32
32
|
type: "textarea";
|
|
33
33
|
placeholder?: string;
|
|
34
34
|
contentEditable?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
35
|
+
}
|
|
36
|
+
interface SelectField extends BaseField {
|
|
37
37
|
type: "select";
|
|
38
38
|
options: FieldOptions;
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
interface RadioField extends BaseField {
|
|
41
41
|
type: "radio";
|
|
42
42
|
options: FieldOptions;
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
}
|
|
44
|
+
interface ArrayField<Props extends {
|
|
45
45
|
[key: string]: any;
|
|
46
46
|
}[] = {
|
|
47
47
|
[key: string]: any;
|
|
48
|
-
}[], UserField extends {} = {}>
|
|
48
|
+
}[], UserField extends {} = {}> extends BaseField {
|
|
49
49
|
type: "array";
|
|
50
50
|
arrayFields: {
|
|
51
51
|
[SubPropName in keyof Props[0]]: UserField extends {
|
|
52
52
|
type: PropertyKey;
|
|
53
53
|
} ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
|
|
54
54
|
};
|
|
55
|
-
defaultItemProps?: Props[0];
|
|
56
|
-
getItemSummary?: (item: Props[0], index?: number) =>
|
|
55
|
+
defaultItemProps?: Props[0] | ((index: number) => Props[0]);
|
|
56
|
+
getItemSummary?: (item: Props[0], index?: number) => ReactNode;
|
|
57
57
|
max?: number;
|
|
58
58
|
min?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
}
|
|
60
|
+
interface ObjectField<Props extends any = {
|
|
61
61
|
[key: string]: any;
|
|
62
|
-
}, UserField extends {} = {}>
|
|
62
|
+
}, UserField extends {} = {}> extends BaseField {
|
|
63
63
|
type: "object";
|
|
64
64
|
objectFields: {
|
|
65
65
|
[SubPropName in keyof Props]: UserField extends {
|
|
66
66
|
type: PropertyKey;
|
|
67
67
|
} ? Field<Props[SubPropName]> | UserField : Field<Props[SubPropName]>;
|
|
68
68
|
};
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
|
71
71
|
name: string;
|
|
72
72
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
@@ -80,14 +80,14 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
|
80
80
|
placeholder?: string;
|
|
81
81
|
adaptor: Adaptor<any, any, Props>;
|
|
82
82
|
adaptorParams?: object;
|
|
83
|
-
getItemSummary: (item: NotUndefined<Props>, index?: number) =>
|
|
83
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
84
84
|
};
|
|
85
85
|
type CacheOpts = {
|
|
86
86
|
enabled?: boolean;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
interface ExternalField<Props extends any = {
|
|
89
89
|
[key: string]: any;
|
|
90
|
-
}>
|
|
90
|
+
}> extends BaseField {
|
|
91
91
|
type: "external";
|
|
92
92
|
cache?: CacheOpts;
|
|
93
93
|
placeholder?: string;
|
|
@@ -97,7 +97,7 @@ type ExternalField<Props extends any = {
|
|
|
97
97
|
}) => Promise<any[] | null>;
|
|
98
98
|
mapProp?: (value: any) => Props;
|
|
99
99
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
|
100
|
-
getItemSummary?: (item: NotUndefined<Props>, index?: number) =>
|
|
100
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
101
101
|
showSearch?: boolean;
|
|
102
102
|
renderFooter?: (props: {
|
|
103
103
|
items: any[];
|
|
@@ -105,7 +105,7 @@ type ExternalField<Props extends any = {
|
|
|
105
105
|
initialQuery?: string;
|
|
106
106
|
filterFields?: Record<string, Field>;
|
|
107
107
|
initialFilters?: Record<string, any>;
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
type CustomFieldRender<Value extends any> = (props: {
|
|
110
110
|
field: CustomField<Value>;
|
|
111
111
|
name: string;
|
|
@@ -114,16 +114,17 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
|
114
114
|
onChange: (value: Value) => void;
|
|
115
115
|
readOnly?: boolean;
|
|
116
116
|
}) => ReactElement;
|
|
117
|
-
|
|
117
|
+
interface CustomField<Value extends any> extends BaseField {
|
|
118
118
|
type: "custom";
|
|
119
119
|
render: CustomFieldRender<Value>;
|
|
120
120
|
contentEditable?: boolean;
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
key?: string;
|
|
122
|
+
}
|
|
123
|
+
interface SlotField extends BaseField {
|
|
123
124
|
type: "slot";
|
|
124
125
|
allow?: string[];
|
|
125
126
|
disallow?: string[];
|
|
126
|
-
}
|
|
127
|
+
}
|
|
127
128
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
128
129
|
[key: string]: any;
|
|
129
130
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
@@ -145,13 +146,14 @@ type DropZoneProps = {
|
|
|
145
146
|
allow?: string[];
|
|
146
147
|
disallow?: string[];
|
|
147
148
|
style?: CSSProperties;
|
|
148
|
-
minEmptyHeight?: number;
|
|
149
|
+
minEmptyHeight?: CSSProperties["minHeight"] | number;
|
|
149
150
|
className?: string;
|
|
150
151
|
collisionAxis?: DragAxis;
|
|
152
|
+
as?: ElementType;
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
type PuckContext = {
|
|
154
|
-
renderDropZone: React.
|
|
156
|
+
renderDropZone: (props: DropZoneProps) => React.ReactNode;
|
|
155
157
|
metadata: Metadata;
|
|
156
158
|
isEditing: boolean;
|
|
157
159
|
dragRef: ((element: Element | null) => void) | null;
|
|
@@ -199,6 +201,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
|
|
199
201
|
type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
|
|
200
202
|
props?: Partial<Props>;
|
|
201
203
|
};
|
|
204
|
+
interface ComponentConfigExtensions {
|
|
205
|
+
}
|
|
202
206
|
type ComponentConfigInternal<RenderProps extends DefaultComponentProps, FieldProps extends DefaultComponentProps, DataShape = Omit<ComponentData<FieldProps>, "type">, // NB this doesn't include AllProps, so types will not contain deep slot types. To fix, we require a breaking change.
|
|
203
207
|
UserField extends BaseField = {}> = {
|
|
204
208
|
render: PuckComponent<RenderProps>;
|
|
@@ -214,7 +218,7 @@ UserField extends BaseField = {}> = {
|
|
|
214
218
|
fields: Fields<FieldProps>;
|
|
215
219
|
lastFields: Fields<FieldProps>;
|
|
216
220
|
lastData: DataShape | null;
|
|
217
|
-
metadata:
|
|
221
|
+
metadata: ComponentMetadata;
|
|
218
222
|
appState: AppState;
|
|
219
223
|
parent: ComponentData | null;
|
|
220
224
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -223,7 +227,7 @@ UserField extends BaseField = {}> = {
|
|
|
223
227
|
id: string;
|
|
224
228
|
}>;
|
|
225
229
|
lastData: DataShape | null;
|
|
226
|
-
metadata:
|
|
230
|
+
metadata: ComponentMetadata;
|
|
227
231
|
trigger: ResolveDataTrigger;
|
|
228
232
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
229
233
|
resolvePermissions?: (data: DataShape, params: {
|
|
@@ -234,9 +238,10 @@ UserField extends BaseField = {}> = {
|
|
|
234
238
|
permissions: Partial<Permissions>;
|
|
235
239
|
appState: AppState;
|
|
236
240
|
lastData: DataShape | null;
|
|
241
|
+
parent: ComponentData | null;
|
|
237
242
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
|
238
|
-
metadata?:
|
|
239
|
-
};
|
|
243
|
+
metadata?: ComponentMetadata;
|
|
244
|
+
} & ComponentConfigExtensions;
|
|
240
245
|
type RootConfigInternal<RootProps extends DefaultComponentProps = DefaultComponentProps, UserField extends BaseField = {}> = Partial<ComponentConfigInternal<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>, UserField>>;
|
|
241
246
|
type Category<ComponentName> = {
|
|
242
247
|
components?: ComponentName[];
|
|
@@ -263,6 +268,12 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
|
|
|
263
268
|
type: string;
|
|
264
269
|
} ? UserField : Field;
|
|
265
270
|
} : never;
|
|
271
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
272
|
+
components?: Components;
|
|
273
|
+
root?: RootProps;
|
|
274
|
+
categories?: CategoryNames;
|
|
275
|
+
fields?: AssertHasValue<UserFields>;
|
|
276
|
+
};
|
|
266
277
|
|
|
267
278
|
type BaseData<Props extends {
|
|
268
279
|
[key: string]: any;
|
|
@@ -302,6 +313,12 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
|
|
|
302
313
|
type Metadata = {
|
|
303
314
|
[key: string]: any;
|
|
304
315
|
};
|
|
316
|
+
interface PuckMetadata extends Metadata {
|
|
317
|
+
}
|
|
318
|
+
interface ComponentMetadata extends PuckMetadata {
|
|
319
|
+
}
|
|
320
|
+
interface FieldMetadata extends Metadata {
|
|
321
|
+
}
|
|
305
322
|
|
|
306
323
|
type ItemWithId = {
|
|
307
324
|
_arrayId: string;
|
|
@@ -370,12 +387,6 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
370
387
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
371
388
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
372
389
|
} : T;
|
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
374
|
-
components?: Components;
|
|
375
|
-
root?: RootProps;
|
|
376
|
-
categories?: CategoryNames;
|
|
377
|
-
fields?: AssertHasValue<UserFields>;
|
|
378
|
-
};
|
|
379
390
|
type FieldsExtension = {
|
|
380
391
|
[Type in string]: {
|
|
381
392
|
type: Type;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReactElement, CSSProperties,
|
|
1
|
+
import { ReactElement, ReactNode, CSSProperties, ElementType, JSX } from 'react';
|
|
2
2
|
|
|
3
3
|
type ItemSelector = {
|
|
4
4
|
index: number;
|
|
@@ -10,63 +10,63 @@ type FieldOption = {
|
|
|
10
10
|
value: string | number | boolean | undefined | null | object;
|
|
11
11
|
};
|
|
12
12
|
type FieldOptions = Array<FieldOption> | ReadonlyArray<FieldOption>;
|
|
13
|
-
|
|
13
|
+
interface BaseField {
|
|
14
14
|
label?: string;
|
|
15
15
|
labelIcon?: ReactElement;
|
|
16
|
-
metadata?:
|
|
16
|
+
metadata?: FieldMetadata;
|
|
17
17
|
visible?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
18
|
+
}
|
|
19
|
+
interface TextField extends BaseField {
|
|
20
20
|
type: "text";
|
|
21
21
|
placeholder?: string;
|
|
22
22
|
contentEditable?: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
23
|
+
}
|
|
24
|
+
interface NumberField extends BaseField {
|
|
25
25
|
type: "number";
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
min?: number;
|
|
28
28
|
max?: number;
|
|
29
29
|
step?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
30
|
+
}
|
|
31
|
+
interface TextareaField extends BaseField {
|
|
32
32
|
type: "textarea";
|
|
33
33
|
placeholder?: string;
|
|
34
34
|
contentEditable?: boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
35
|
+
}
|
|
36
|
+
interface SelectField extends BaseField {
|
|
37
37
|
type: "select";
|
|
38
38
|
options: FieldOptions;
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
interface RadioField extends BaseField {
|
|
41
41
|
type: "radio";
|
|
42
42
|
options: FieldOptions;
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
}
|
|
44
|
+
interface ArrayField<Props extends {
|
|
45
45
|
[key: string]: any;
|
|
46
46
|
}[] = {
|
|
47
47
|
[key: string]: any;
|
|
48
|
-
}[], UserField extends {} = {}>
|
|
48
|
+
}[], UserField extends {} = {}> extends BaseField {
|
|
49
49
|
type: "array";
|
|
50
50
|
arrayFields: {
|
|
51
51
|
[SubPropName in keyof Props[0]]: UserField extends {
|
|
52
52
|
type: PropertyKey;
|
|
53
53
|
} ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
|
|
54
54
|
};
|
|
55
|
-
defaultItemProps?: Props[0];
|
|
56
|
-
getItemSummary?: (item: Props[0], index?: number) =>
|
|
55
|
+
defaultItemProps?: Props[0] | ((index: number) => Props[0]);
|
|
56
|
+
getItemSummary?: (item: Props[0], index?: number) => ReactNode;
|
|
57
57
|
max?: number;
|
|
58
58
|
min?: number;
|
|
59
|
-
}
|
|
60
|
-
|
|
59
|
+
}
|
|
60
|
+
interface ObjectField<Props extends any = {
|
|
61
61
|
[key: string]: any;
|
|
62
|
-
}, UserField extends {} = {}>
|
|
62
|
+
}, UserField extends {} = {}> extends BaseField {
|
|
63
63
|
type: "object";
|
|
64
64
|
objectFields: {
|
|
65
65
|
[SubPropName in keyof Props]: UserField extends {
|
|
66
66
|
type: PropertyKey;
|
|
67
67
|
} ? Field<Props[SubPropName]> | UserField : Field<Props[SubPropName]>;
|
|
68
68
|
};
|
|
69
|
-
}
|
|
69
|
+
}
|
|
70
70
|
type Adaptor<AdaptorParams = {}, TableShape extends Record<string, any> = {}, PropShape = TableShape> = {
|
|
71
71
|
name: string;
|
|
72
72
|
fetchList: (adaptorParams?: AdaptorParams) => Promise<TableShape[] | null>;
|
|
@@ -80,14 +80,14 @@ type ExternalFieldWithAdaptor<Props extends any = {
|
|
|
80
80
|
placeholder?: string;
|
|
81
81
|
adaptor: Adaptor<any, any, Props>;
|
|
82
82
|
adaptorParams?: object;
|
|
83
|
-
getItemSummary: (item: NotUndefined<Props>, index?: number) =>
|
|
83
|
+
getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
84
84
|
};
|
|
85
85
|
type CacheOpts = {
|
|
86
86
|
enabled?: boolean;
|
|
87
87
|
};
|
|
88
|
-
|
|
88
|
+
interface ExternalField<Props extends any = {
|
|
89
89
|
[key: string]: any;
|
|
90
|
-
}>
|
|
90
|
+
}> extends BaseField {
|
|
91
91
|
type: "external";
|
|
92
92
|
cache?: CacheOpts;
|
|
93
93
|
placeholder?: string;
|
|
@@ -97,7 +97,7 @@ type ExternalField<Props extends any = {
|
|
|
97
97
|
}) => Promise<any[] | null>;
|
|
98
98
|
mapProp?: (value: any) => Props;
|
|
99
99
|
mapRow?: (value: any) => Record<string, string | number | ReactElement>;
|
|
100
|
-
getItemSummary?: (item: NotUndefined<Props>, index?: number) =>
|
|
100
|
+
getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
|
|
101
101
|
showSearch?: boolean;
|
|
102
102
|
renderFooter?: (props: {
|
|
103
103
|
items: any[];
|
|
@@ -105,7 +105,7 @@ type ExternalField<Props extends any = {
|
|
|
105
105
|
initialQuery?: string;
|
|
106
106
|
filterFields?: Record<string, Field>;
|
|
107
107
|
initialFilters?: Record<string, any>;
|
|
108
|
-
}
|
|
108
|
+
}
|
|
109
109
|
type CustomFieldRender<Value extends any> = (props: {
|
|
110
110
|
field: CustomField<Value>;
|
|
111
111
|
name: string;
|
|
@@ -114,16 +114,17 @@ type CustomFieldRender<Value extends any> = (props: {
|
|
|
114
114
|
onChange: (value: Value) => void;
|
|
115
115
|
readOnly?: boolean;
|
|
116
116
|
}) => ReactElement;
|
|
117
|
-
|
|
117
|
+
interface CustomField<Value extends any> extends BaseField {
|
|
118
118
|
type: "custom";
|
|
119
119
|
render: CustomFieldRender<Value>;
|
|
120
120
|
contentEditable?: boolean;
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
key?: string;
|
|
122
|
+
}
|
|
123
|
+
interface SlotField extends BaseField {
|
|
123
124
|
type: "slot";
|
|
124
125
|
allow?: string[];
|
|
125
126
|
disallow?: string[];
|
|
126
|
-
}
|
|
127
|
+
}
|
|
127
128
|
type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
|
|
128
129
|
[key: string]: any;
|
|
129
130
|
}[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
|
|
@@ -145,13 +146,14 @@ type DropZoneProps = {
|
|
|
145
146
|
allow?: string[];
|
|
146
147
|
disallow?: string[];
|
|
147
148
|
style?: CSSProperties;
|
|
148
|
-
minEmptyHeight?: number;
|
|
149
|
+
minEmptyHeight?: CSSProperties["minHeight"] | number;
|
|
149
150
|
className?: string;
|
|
150
151
|
collisionAxis?: DragAxis;
|
|
152
|
+
as?: ElementType;
|
|
151
153
|
};
|
|
152
154
|
|
|
153
155
|
type PuckContext = {
|
|
154
|
-
renderDropZone: React.
|
|
156
|
+
renderDropZone: (props: DropZoneProps) => React.ReactNode;
|
|
155
157
|
metadata: Metadata;
|
|
156
158
|
isEditing: boolean;
|
|
157
159
|
dragRef: ((element: Element | null) => void) | null;
|
|
@@ -199,6 +201,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
|
|
|
199
201
|
type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
|
|
200
202
|
props?: Partial<Props>;
|
|
201
203
|
};
|
|
204
|
+
interface ComponentConfigExtensions {
|
|
205
|
+
}
|
|
202
206
|
type ComponentConfigInternal<RenderProps extends DefaultComponentProps, FieldProps extends DefaultComponentProps, DataShape = Omit<ComponentData<FieldProps>, "type">, // NB this doesn't include AllProps, so types will not contain deep slot types. To fix, we require a breaking change.
|
|
203
207
|
UserField extends BaseField = {}> = {
|
|
204
208
|
render: PuckComponent<RenderProps>;
|
|
@@ -214,7 +218,7 @@ UserField extends BaseField = {}> = {
|
|
|
214
218
|
fields: Fields<FieldProps>;
|
|
215
219
|
lastFields: Fields<FieldProps>;
|
|
216
220
|
lastData: DataShape | null;
|
|
217
|
-
metadata:
|
|
221
|
+
metadata: ComponentMetadata;
|
|
218
222
|
appState: AppState;
|
|
219
223
|
parent: ComponentData | null;
|
|
220
224
|
}) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
|
|
@@ -223,7 +227,7 @@ UserField extends BaseField = {}> = {
|
|
|
223
227
|
id: string;
|
|
224
228
|
}>;
|
|
225
229
|
lastData: DataShape | null;
|
|
226
|
-
metadata:
|
|
230
|
+
metadata: ComponentMetadata;
|
|
227
231
|
trigger: ResolveDataTrigger;
|
|
228
232
|
}) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
|
|
229
233
|
resolvePermissions?: (data: DataShape, params: {
|
|
@@ -234,9 +238,10 @@ UserField extends BaseField = {}> = {
|
|
|
234
238
|
permissions: Partial<Permissions>;
|
|
235
239
|
appState: AppState;
|
|
236
240
|
lastData: DataShape | null;
|
|
241
|
+
parent: ComponentData | null;
|
|
237
242
|
}) => Promise<Partial<Permissions>> | Partial<Permissions>;
|
|
238
|
-
metadata?:
|
|
239
|
-
};
|
|
243
|
+
metadata?: ComponentMetadata;
|
|
244
|
+
} & ComponentConfigExtensions;
|
|
240
245
|
type RootConfigInternal<RootProps extends DefaultComponentProps = DefaultComponentProps, UserField extends BaseField = {}> = Partial<ComponentConfigInternal<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>, UserField>>;
|
|
241
246
|
type Category<ComponentName> = {
|
|
242
247
|
components?: ComponentName[];
|
|
@@ -263,6 +268,12 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
|
|
|
263
268
|
type: string;
|
|
264
269
|
} ? UserField : Field;
|
|
265
270
|
} : never;
|
|
271
|
+
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
272
|
+
components?: Components;
|
|
273
|
+
root?: RootProps;
|
|
274
|
+
categories?: CategoryNames;
|
|
275
|
+
fields?: AssertHasValue<UserFields>;
|
|
276
|
+
};
|
|
266
277
|
|
|
267
278
|
type BaseData<Props extends {
|
|
268
279
|
[key: string]: any;
|
|
@@ -302,6 +313,12 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
|
|
|
302
313
|
type Metadata = {
|
|
303
314
|
[key: string]: any;
|
|
304
315
|
};
|
|
316
|
+
interface PuckMetadata extends Metadata {
|
|
317
|
+
}
|
|
318
|
+
interface ComponentMetadata extends PuckMetadata {
|
|
319
|
+
}
|
|
320
|
+
interface FieldMetadata extends Metadata {
|
|
321
|
+
}
|
|
305
322
|
|
|
306
323
|
type ItemWithId = {
|
|
307
324
|
_arrayId: string;
|
|
@@ -370,12 +387,6 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
|
|
|
370
387
|
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
|
371
388
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
|
372
389
|
} : T;
|
|
373
|
-
type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
|
|
374
|
-
components?: Components;
|
|
375
|
-
root?: RootProps;
|
|
376
|
-
categories?: CategoryNames;
|
|
377
|
-
fields?: AssertHasValue<UserFields>;
|
|
378
|
-
};
|
|
379
390
|
type FieldsExtension = {
|
|
380
391
|
[Type in string]: {
|
|
381
392
|
type: Type;
|
package/dist/index.js
CHANGED
|
@@ -268,11 +268,11 @@ var require_flat = __commonJS({
|
|
|
268
268
|
});
|
|
269
269
|
|
|
270
270
|
// index.ts
|
|
271
|
-
var
|
|
272
|
-
__export(
|
|
271
|
+
var index_exports = {};
|
|
272
|
+
__export(index_exports, {
|
|
273
273
|
default: () => HeadingAnalyzer_default
|
|
274
274
|
});
|
|
275
|
-
module.exports = __toCommonJS(
|
|
275
|
+
module.exports = __toCommonJS(index_exports);
|
|
276
276
|
init_react_import();
|
|
277
277
|
|
|
278
278
|
// src/HeadingAnalyzer.tsx
|
|
@@ -818,10 +818,10 @@ var insert = (list, index, item) => {
|
|
|
818
818
|
// ../core/lib/generate-id.ts
|
|
819
819
|
init_react_import();
|
|
820
820
|
|
|
821
|
-
//
|
|
821
|
+
// ../core/node_modules/uuid/dist/esm-node/index.js
|
|
822
822
|
init_react_import();
|
|
823
823
|
|
|
824
|
-
//
|
|
824
|
+
// ../core/node_modules/uuid/dist/esm-node/rng.js
|
|
825
825
|
init_react_import();
|
|
826
826
|
var import_crypto = __toESM(require("crypto"));
|
|
827
827
|
var rnds8Pool = new Uint8Array(256);
|
|
@@ -834,7 +834,7 @@ function rng() {
|
|
|
834
834
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
835
835
|
}
|
|
836
836
|
|
|
837
|
-
//
|
|
837
|
+
// ../core/node_modules/uuid/dist/esm-node/stringify.js
|
|
838
838
|
init_react_import();
|
|
839
839
|
var byteToHex = [];
|
|
840
840
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -844,17 +844,17 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
844
844
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
845
845
|
}
|
|
846
846
|
|
|
847
|
-
//
|
|
847
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
848
848
|
init_react_import();
|
|
849
849
|
|
|
850
|
-
//
|
|
850
|
+
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
851
851
|
init_react_import();
|
|
852
852
|
var import_crypto2 = __toESM(require("crypto"));
|
|
853
853
|
var native_default = {
|
|
854
854
|
randomUUID: import_crypto2.default.randomUUID
|
|
855
855
|
};
|
|
856
856
|
|
|
857
|
-
//
|
|
857
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
858
858
|
function v4(options, buf, offset) {
|
|
859
859
|
if (native_default.randomUUID && !buf && !options) {
|
|
860
860
|
return native_default.randomUUID();
|
|
@@ -1434,7 +1434,7 @@ var createStoreImpl = (createState) => {
|
|
|
1434
1434
|
const initialState = state = createState(setState, getState, api);
|
|
1435
1435
|
return api;
|
|
1436
1436
|
};
|
|
1437
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
1437
|
+
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1438
1438
|
|
|
1439
1439
|
// ../../node_modules/zustand/esm/react.mjs
|
|
1440
1440
|
init_react_import();
|
|
@@ -1443,8 +1443,8 @@ var identity = (arg) => arg;
|
|
|
1443
1443
|
function useStore(api, selector = identity) {
|
|
1444
1444
|
const slice = import_react4.default.useSyncExternalStore(
|
|
1445
1445
|
api.subscribe,
|
|
1446
|
-
() => selector(api.getState()),
|
|
1447
|
-
() => selector(api.getInitialState())
|
|
1446
|
+
import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
|
|
1447
|
+
import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
1448
1448
|
);
|
|
1449
1449
|
import_react4.default.useDebugValue(slice);
|
|
1450
1450
|
return slice;
|
|
@@ -1455,13 +1455,13 @@ var createImpl = (createState) => {
|
|
|
1455
1455
|
Object.assign(useBoundStore, api);
|
|
1456
1456
|
return useBoundStore;
|
|
1457
1457
|
};
|
|
1458
|
-
var create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
1458
|
+
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
1459
1459
|
|
|
1460
1460
|
// ../../node_modules/zustand/esm/middleware.mjs
|
|
1461
1461
|
init_react_import();
|
|
1462
1462
|
var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1463
1463
|
const origSubscribe = api.subscribe;
|
|
1464
|
-
api.subscribe = (selector, optListener, options) => {
|
|
1464
|
+
api.subscribe = ((selector, optListener, options) => {
|
|
1465
1465
|
let listener = selector;
|
|
1466
1466
|
if (optListener) {
|
|
1467
1467
|
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
|
@@ -1478,7 +1478,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
}
|
|
1480
1480
|
return origSubscribe(listener);
|
|
1481
|
-
};
|
|
1481
|
+
});
|
|
1482
1482
|
const initialState = fn(set, get, api);
|
|
1483
1483
|
return initialState;
|
|
1484
1484
|
};
|
|
@@ -1695,9 +1695,9 @@ function createIsCircular(areItemsEqual) {
|
|
|
1695
1695
|
function getStrictProperties(object) {
|
|
1696
1696
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1697
1697
|
}
|
|
1698
|
-
var hasOwn = Object.hasOwn || function(object, property) {
|
|
1698
|
+
var hasOwn = Object.hasOwn || (function(object, property) {
|
|
1699
1699
|
return hasOwnProperty.call(object, property);
|
|
1700
|
-
};
|
|
1700
|
+
});
|
|
1701
1701
|
function sameValueZeroEqual(a, b) {
|
|
1702
1702
|
return a === b || !a && !b && a !== a && b !== b;
|
|
1703
1703
|
}
|
|
@@ -2087,29 +2087,37 @@ var getChanged = (newItem, oldItem) => {
|
|
|
2087
2087
|
|
|
2088
2088
|
// ../core/store/slices/permissions.ts
|
|
2089
2089
|
var createPermissionsSlice = (set, get) => {
|
|
2090
|
-
const resolvePermissions = (..._0) => __async(
|
|
2090
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
2091
2091
|
const { state, permissions, config } = get();
|
|
2092
2092
|
const { cache: cache2, globalPermissions } = permissions;
|
|
2093
|
-
const
|
|
2094
|
-
var _a, _b
|
|
2093
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
2094
|
+
var _a, _b;
|
|
2095
2095
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
2096
|
+
const itemCache = cache2[item2.props.id];
|
|
2097
|
+
const nodes = appState.indexes.nodes;
|
|
2098
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
2099
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
2100
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
2096
2101
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
2097
2102
|
if (!componentConfig) {
|
|
2098
2103
|
return;
|
|
2099
2104
|
}
|
|
2100
2105
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
2101
2106
|
if (componentConfig.resolvePermissions) {
|
|
2102
|
-
const changed = getChanged(item2,
|
|
2103
|
-
|
|
2107
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
2108
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
2109
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
2110
|
+
if (propsChanged || parentChanged || force2) {
|
|
2104
2111
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
2105
2112
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
2106
2113
|
item2,
|
|
2107
2114
|
{
|
|
2108
2115
|
changed,
|
|
2109
|
-
lastPermissions: (
|
|
2116
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
2110
2117
|
permissions: initialPermissions,
|
|
2111
2118
|
appState: makeStatePublic(appState),
|
|
2112
|
-
lastData: (
|
|
2119
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2120
|
+
parent: parentData
|
|
2113
2121
|
}
|
|
2114
2122
|
);
|
|
2115
2123
|
const latest = get().permissions;
|
|
@@ -2117,6 +2125,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2117
2125
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
2118
2126
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
2119
2127
|
[item2.props.id]: {
|
|
2128
|
+
lastParentId: parentId,
|
|
2120
2129
|
lastData: item2,
|
|
2121
2130
|
lastPermissions: resolvedPermissions
|
|
2122
2131
|
}
|
|
@@ -2130,9 +2139,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2130
2139
|
}
|
|
2131
2140
|
}
|
|
2132
2141
|
});
|
|
2133
|
-
const
|
|
2142
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
2134
2143
|
const { state: appState } = get();
|
|
2135
|
-
|
|
2144
|
+
resolvePermissionsForItem(
|
|
2136
2145
|
// Shim the root data in by conforming to component data shape
|
|
2137
2146
|
{
|
|
2138
2147
|
type: "root",
|
|
@@ -2143,16 +2152,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2143
2152
|
};
|
|
2144
2153
|
const { item, type, root } = params;
|
|
2145
2154
|
if (item) {
|
|
2146
|
-
yield
|
|
2155
|
+
yield resolvePermissionsForItem(item, force);
|
|
2147
2156
|
} else if (type) {
|
|
2148
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
2149
|
-
yield
|
|
2157
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2158
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2150
2159
|
}));
|
|
2151
2160
|
} else if (root) {
|
|
2152
|
-
|
|
2161
|
+
resolvePermissionsForRoot(force);
|
|
2153
2162
|
} else {
|
|
2154
|
-
flattenData(state, config).map((item2) => __async(
|
|
2155
|
-
yield
|
|
2163
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2164
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2156
2165
|
}));
|
|
2157
2166
|
}
|
|
2158
2167
|
});
|
|
@@ -2206,7 +2215,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2206
2215
|
// ../core/lib/resolve-component-data.ts
|
|
2207
2216
|
init_react_import();
|
|
2208
2217
|
var cache = { lastChange: {} };
|
|
2209
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
2218
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2210
2219
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2211
2220
|
const resolvedItem = __spreadValues({}, item);
|
|
2212
2221
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2234,11 +2243,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2234
2243
|
let itemWithResolvedChildren = yield mapFields(
|
|
2235
2244
|
resolvedItem,
|
|
2236
2245
|
{
|
|
2237
|
-
slot: (_02) => __async(
|
|
2246
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
2238
2247
|
const content = value;
|
|
2239
2248
|
return yield Promise.all(
|
|
2240
2249
|
content.map(
|
|
2241
|
-
(childItem) => __async(
|
|
2250
|
+
(childItem) => __async(null, null, function* () {
|
|
2242
2251
|
return (yield resolveComponentData(
|
|
2243
2252
|
childItem,
|
|
2244
2253
|
config,
|
|
@@ -2428,7 +2437,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2428
2437
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
2429
2438
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2430
2439
|
}),
|
|
2431
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
2440
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2432
2441
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
2433
2442
|
const timeouts = {};
|
|
2434
2443
|
return yield resolveComponentData(
|
|
@@ -2439,7 +2448,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2439
2448
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2440
2449
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
2441
2450
|
},
|
|
2442
|
-
(item) => __async(
|
|
2451
|
+
(item) => __async(null, null, function* () {
|
|
2443
2452
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2444
2453
|
if ("type" in item) {
|
|
2445
2454
|
yield permissions.refreshPermissions({ item });
|
|
@@ -2451,7 +2460,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2451
2460
|
trigger
|
|
2452
2461
|
);
|
|
2453
2462
|
}),
|
|
2454
|
-
resolveAndCommitData: () => __async(
|
|
2463
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
2455
2464
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
2456
2465
|
walkAppState(
|
|
2457
2466
|
state,
|
|
@@ -2875,45 +2884,10 @@ classnames/index.js:
|
|
|
2875
2884
|
*)
|
|
2876
2885
|
|
|
2877
2886
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
2878
|
-
(**
|
|
2879
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2880
|
-
*
|
|
2881
|
-
* This source code is licensed under the ISC license.
|
|
2882
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2883
|
-
*)
|
|
2884
|
-
|
|
2885
2887
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2886
|
-
(**
|
|
2887
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2888
|
-
*
|
|
2889
|
-
* This source code is licensed under the ISC license.
|
|
2890
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2891
|
-
*)
|
|
2892
|
-
|
|
2893
2888
|
lucide-react/dist/esm/Icon.js:
|
|
2894
|
-
(**
|
|
2895
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2896
|
-
*
|
|
2897
|
-
* This source code is licensed under the ISC license.
|
|
2898
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2899
|
-
*)
|
|
2900
|
-
|
|
2901
2889
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2902
|
-
(**
|
|
2903
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2904
|
-
*
|
|
2905
|
-
* This source code is licensed under the ISC license.
|
|
2906
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2907
|
-
*)
|
|
2908
|
-
|
|
2909
2890
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2910
|
-
(**
|
|
2911
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2912
|
-
*
|
|
2913
|
-
* This source code is licensed under the ISC license.
|
|
2914
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2915
|
-
*)
|
|
2916
|
-
|
|
2917
2891
|
lucide-react/dist/esm/lucide-react.js:
|
|
2918
2892
|
(**
|
|
2919
2893
|
* @license lucide-react v0.468.0 - ISC
|
package/dist/index.mjs
CHANGED
|
@@ -806,10 +806,10 @@ var insert = (list, index, item) => {
|
|
|
806
806
|
// ../core/lib/generate-id.ts
|
|
807
807
|
init_react_import();
|
|
808
808
|
|
|
809
|
-
//
|
|
809
|
+
// ../core/node_modules/uuid/dist/esm-node/index.js
|
|
810
810
|
init_react_import();
|
|
811
811
|
|
|
812
|
-
//
|
|
812
|
+
// ../core/node_modules/uuid/dist/esm-node/rng.js
|
|
813
813
|
init_react_import();
|
|
814
814
|
import crypto from "crypto";
|
|
815
815
|
var rnds8Pool = new Uint8Array(256);
|
|
@@ -822,7 +822,7 @@ function rng() {
|
|
|
822
822
|
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
823
823
|
}
|
|
824
824
|
|
|
825
|
-
//
|
|
825
|
+
// ../core/node_modules/uuid/dist/esm-node/stringify.js
|
|
826
826
|
init_react_import();
|
|
827
827
|
var byteToHex = [];
|
|
828
828
|
for (let i = 0; i < 256; ++i) {
|
|
@@ -832,17 +832,17 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
832
832
|
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
//
|
|
835
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
836
836
|
init_react_import();
|
|
837
837
|
|
|
838
|
-
//
|
|
838
|
+
// ../core/node_modules/uuid/dist/esm-node/native.js
|
|
839
839
|
init_react_import();
|
|
840
840
|
import crypto2 from "crypto";
|
|
841
841
|
var native_default = {
|
|
842
842
|
randomUUID: crypto2.randomUUID
|
|
843
843
|
};
|
|
844
844
|
|
|
845
|
-
//
|
|
845
|
+
// ../core/node_modules/uuid/dist/esm-node/v4.js
|
|
846
846
|
function v4(options, buf, offset) {
|
|
847
847
|
if (native_default.randomUUID && !buf && !options) {
|
|
848
848
|
return native_default.randomUUID();
|
|
@@ -1422,7 +1422,7 @@ var createStoreImpl = (createState) => {
|
|
|
1422
1422
|
const initialState = state = createState(setState, getState, api);
|
|
1423
1423
|
return api;
|
|
1424
1424
|
};
|
|
1425
|
-
var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
1425
|
+
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
1426
1426
|
|
|
1427
1427
|
// ../../node_modules/zustand/esm/react.mjs
|
|
1428
1428
|
init_react_import();
|
|
@@ -1431,8 +1431,8 @@ var identity = (arg) => arg;
|
|
|
1431
1431
|
function useStore(api, selector = identity) {
|
|
1432
1432
|
const slice = React2.useSyncExternalStore(
|
|
1433
1433
|
api.subscribe,
|
|
1434
|
-
() => selector(api.getState()),
|
|
1435
|
-
() => selector(api.getInitialState())
|
|
1434
|
+
React2.useCallback(() => selector(api.getState()), [api, selector]),
|
|
1435
|
+
React2.useCallback(() => selector(api.getInitialState()), [api, selector])
|
|
1436
1436
|
);
|
|
1437
1437
|
React2.useDebugValue(slice);
|
|
1438
1438
|
return slice;
|
|
@@ -1443,13 +1443,13 @@ var createImpl = (createState) => {
|
|
|
1443
1443
|
Object.assign(useBoundStore, api);
|
|
1444
1444
|
return useBoundStore;
|
|
1445
1445
|
};
|
|
1446
|
-
var create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
1446
|
+
var create = ((createState) => createState ? createImpl(createState) : createImpl);
|
|
1447
1447
|
|
|
1448
1448
|
// ../../node_modules/zustand/esm/middleware.mjs
|
|
1449
1449
|
init_react_import();
|
|
1450
1450
|
var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
1451
1451
|
const origSubscribe = api.subscribe;
|
|
1452
|
-
api.subscribe = (selector, optListener, options) => {
|
|
1452
|
+
api.subscribe = ((selector, optListener, options) => {
|
|
1453
1453
|
let listener = selector;
|
|
1454
1454
|
if (optListener) {
|
|
1455
1455
|
const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
|
|
@@ -1466,7 +1466,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
|
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
1468
|
return origSubscribe(listener);
|
|
1469
|
-
};
|
|
1469
|
+
});
|
|
1470
1470
|
const initialState = fn(set, get, api);
|
|
1471
1471
|
return initialState;
|
|
1472
1472
|
};
|
|
@@ -1683,9 +1683,9 @@ function createIsCircular(areItemsEqual) {
|
|
|
1683
1683
|
function getStrictProperties(object) {
|
|
1684
1684
|
return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
|
|
1685
1685
|
}
|
|
1686
|
-
var hasOwn = Object.hasOwn || function(object, property) {
|
|
1686
|
+
var hasOwn = Object.hasOwn || (function(object, property) {
|
|
1687
1687
|
return hasOwnProperty.call(object, property);
|
|
1688
|
-
};
|
|
1688
|
+
});
|
|
1689
1689
|
function sameValueZeroEqual(a, b) {
|
|
1690
1690
|
return a === b || !a && !b && a !== a && b !== b;
|
|
1691
1691
|
}
|
|
@@ -2075,29 +2075,37 @@ var getChanged = (newItem, oldItem) => {
|
|
|
2075
2075
|
|
|
2076
2076
|
// ../core/store/slices/permissions.ts
|
|
2077
2077
|
var createPermissionsSlice = (set, get) => {
|
|
2078
|
-
const resolvePermissions = (..._0) => __async(
|
|
2078
|
+
const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
|
|
2079
2079
|
const { state, permissions, config } = get();
|
|
2080
2080
|
const { cache: cache2, globalPermissions } = permissions;
|
|
2081
|
-
const
|
|
2082
|
-
var _a, _b
|
|
2081
|
+
const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
|
|
2082
|
+
var _a, _b;
|
|
2083
2083
|
const { config: config2, state: appState, setComponentLoading } = get();
|
|
2084
|
+
const itemCache = cache2[item2.props.id];
|
|
2085
|
+
const nodes = appState.indexes.nodes;
|
|
2086
|
+
const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
|
|
2087
|
+
const parentNode = parentId ? nodes[parentId] : null;
|
|
2088
|
+
const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
|
|
2084
2089
|
const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
|
|
2085
2090
|
if (!componentConfig) {
|
|
2086
2091
|
return;
|
|
2087
2092
|
}
|
|
2088
2093
|
const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
|
|
2089
2094
|
if (componentConfig.resolvePermissions) {
|
|
2090
|
-
const changed = getChanged(item2,
|
|
2091
|
-
|
|
2095
|
+
const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
|
|
2096
|
+
const propsChanged = Object.values(changed).some((el) => el === true);
|
|
2097
|
+
const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
|
|
2098
|
+
if (propsChanged || parentChanged || force2) {
|
|
2092
2099
|
const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
|
|
2093
2100
|
const resolvedPermissions = yield componentConfig.resolvePermissions(
|
|
2094
2101
|
item2,
|
|
2095
2102
|
{
|
|
2096
2103
|
changed,
|
|
2097
|
-
lastPermissions: (
|
|
2104
|
+
lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
|
|
2098
2105
|
permissions: initialPermissions,
|
|
2099
2106
|
appState: makeStatePublic(appState),
|
|
2100
|
-
lastData: (
|
|
2107
|
+
lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
|
|
2108
|
+
parent: parentData
|
|
2101
2109
|
}
|
|
2102
2110
|
);
|
|
2103
2111
|
const latest = get().permissions;
|
|
@@ -2105,6 +2113,7 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2105
2113
|
permissions: __spreadProps(__spreadValues({}, latest), {
|
|
2106
2114
|
cache: __spreadProps(__spreadValues({}, latest.cache), {
|
|
2107
2115
|
[item2.props.id]: {
|
|
2116
|
+
lastParentId: parentId,
|
|
2108
2117
|
lastData: item2,
|
|
2109
2118
|
lastPermissions: resolvedPermissions
|
|
2110
2119
|
}
|
|
@@ -2118,9 +2127,9 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2118
2127
|
}
|
|
2119
2128
|
}
|
|
2120
2129
|
});
|
|
2121
|
-
const
|
|
2130
|
+
const resolvePermissionsForRoot = (force2 = false) => {
|
|
2122
2131
|
const { state: appState } = get();
|
|
2123
|
-
|
|
2132
|
+
resolvePermissionsForItem(
|
|
2124
2133
|
// Shim the root data in by conforming to component data shape
|
|
2125
2134
|
{
|
|
2126
2135
|
type: "root",
|
|
@@ -2131,16 +2140,16 @@ var createPermissionsSlice = (set, get) => {
|
|
|
2131
2140
|
};
|
|
2132
2141
|
const { item, type, root } = params;
|
|
2133
2142
|
if (item) {
|
|
2134
|
-
yield
|
|
2143
|
+
yield resolvePermissionsForItem(item, force);
|
|
2135
2144
|
} else if (type) {
|
|
2136
|
-
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(
|
|
2137
|
-
yield
|
|
2145
|
+
flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
|
|
2146
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2138
2147
|
}));
|
|
2139
2148
|
} else if (root) {
|
|
2140
|
-
|
|
2149
|
+
resolvePermissionsForRoot(force);
|
|
2141
2150
|
} else {
|
|
2142
|
-
flattenData(state, config).map((item2) => __async(
|
|
2143
|
-
yield
|
|
2151
|
+
flattenData(state, config).map((item2) => __async(null, null, function* () {
|
|
2152
|
+
yield resolvePermissionsForItem(item2, force);
|
|
2144
2153
|
}));
|
|
2145
2154
|
}
|
|
2146
2155
|
});
|
|
@@ -2194,7 +2203,7 @@ var createFieldsSlice = (_set, _get) => {
|
|
|
2194
2203
|
// ../core/lib/resolve-component-data.ts
|
|
2195
2204
|
init_react_import();
|
|
2196
2205
|
var cache = { lastChange: {} };
|
|
2197
|
-
var resolveComponentData = (_0, _1, ..._2) => __async(
|
|
2206
|
+
var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
|
|
2198
2207
|
const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
|
|
2199
2208
|
const resolvedItem = __spreadValues({}, item);
|
|
2200
2209
|
const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
|
|
@@ -2222,11 +2231,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
|
|
|
2222
2231
|
let itemWithResolvedChildren = yield mapFields(
|
|
2223
2232
|
resolvedItem,
|
|
2224
2233
|
{
|
|
2225
|
-
slot: (_02) => __async(
|
|
2234
|
+
slot: (_02) => __async(null, [_02], function* ({ value }) {
|
|
2226
2235
|
const content = value;
|
|
2227
2236
|
return yield Promise.all(
|
|
2228
2237
|
content.map(
|
|
2229
|
-
(childItem) => __async(
|
|
2238
|
+
(childItem) => __async(null, null, function* () {
|
|
2230
2239
|
return (yield resolveComponentData(
|
|
2231
2240
|
childItem,
|
|
2232
2241
|
config,
|
|
@@ -2416,7 +2425,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2416
2425
|
const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
|
|
2417
2426
|
return __spreadProps(__spreadValues({}, s), { state, selectedItem });
|
|
2418
2427
|
}),
|
|
2419
|
-
resolveComponentData: (componentData, trigger) => __async(
|
|
2428
|
+
resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
|
|
2420
2429
|
const { config, metadata, setComponentLoading, permissions } = get();
|
|
2421
2430
|
const timeouts = {};
|
|
2422
2431
|
return yield resolveComponentData(
|
|
@@ -2427,7 +2436,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2427
2436
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2428
2437
|
timeouts[id] = setComponentLoading(id, true, 50);
|
|
2429
2438
|
},
|
|
2430
|
-
(item) => __async(
|
|
2439
|
+
(item) => __async(null, null, function* () {
|
|
2431
2440
|
const id = "id" in item.props ? item.props.id : "root";
|
|
2432
2441
|
if ("type" in item) {
|
|
2433
2442
|
yield permissions.refreshPermissions({ item });
|
|
@@ -2439,7 +2448,7 @@ var createAppStore = (initialAppStore) => create()(
|
|
|
2439
2448
|
trigger
|
|
2440
2449
|
);
|
|
2441
2450
|
}),
|
|
2442
|
-
resolveAndCommitData: () => __async(
|
|
2451
|
+
resolveAndCommitData: () => __async(null, null, function* () {
|
|
2443
2452
|
const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
|
|
2444
2453
|
walkAppState(
|
|
2445
2454
|
state,
|
|
@@ -2866,45 +2875,10 @@ classnames/index.js:
|
|
|
2866
2875
|
*)
|
|
2867
2876
|
|
|
2868
2877
|
lucide-react/dist/esm/shared/src/utils.js:
|
|
2869
|
-
(**
|
|
2870
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2871
|
-
*
|
|
2872
|
-
* This source code is licensed under the ISC license.
|
|
2873
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2874
|
-
*)
|
|
2875
|
-
|
|
2876
2878
|
lucide-react/dist/esm/defaultAttributes.js:
|
|
2877
|
-
(**
|
|
2878
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2879
|
-
*
|
|
2880
|
-
* This source code is licensed under the ISC license.
|
|
2881
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2882
|
-
*)
|
|
2883
|
-
|
|
2884
2879
|
lucide-react/dist/esm/Icon.js:
|
|
2885
|
-
(**
|
|
2886
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2887
|
-
*
|
|
2888
|
-
* This source code is licensed under the ISC license.
|
|
2889
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2890
|
-
*)
|
|
2891
|
-
|
|
2892
2880
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
2893
|
-
(**
|
|
2894
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2895
|
-
*
|
|
2896
|
-
* This source code is licensed under the ISC license.
|
|
2897
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2898
|
-
*)
|
|
2899
|
-
|
|
2900
2881
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
2901
|
-
(**
|
|
2902
|
-
* @license lucide-react v0.468.0 - ISC
|
|
2903
|
-
*
|
|
2904
|
-
* This source code is licensed under the ISC license.
|
|
2905
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
2906
|
-
*)
|
|
2907
|
-
|
|
2908
2882
|
lucide-react/dist/esm/lucide-react.js:
|
|
2909
2883
|
(**
|
|
2910
2884
|
* @license lucide-react v0.468.0 - ISC
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@measured/puck-plugin-heading-analyzer",
|
|
3
|
-
"version": "0.21.0-canary.
|
|
3
|
+
"version": "0.21.0-canary.af48a401",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "measuredco/puck",
|
|
6
6
|
"bugs": "https://github.com/measuredco/puck/issues",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"dist"
|
|
26
26
|
],
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@measured/puck": "^0.21.0-canary.
|
|
28
|
+
"@measured/puck": "^0.21.0-canary.af48a401",
|
|
29
|
+
"@types/minimatch": "3.0.5",
|
|
29
30
|
"@types/react": "^19.0.1",
|
|
30
31
|
"@types/react-dom": "^19.0.2",
|
|
31
32
|
"eslint": "^7.32.0",
|