@measured/puck-plugin-heading-analyzer 0.21.0-canary.bd7b613d → 0.21.0-canary.c0db75c1

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
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
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
- type BaseField = {
13
+ interface BaseField {
14
14
  label?: string;
15
15
  labelIcon?: ReactElement;
16
- metadata?: Metadata;
16
+ metadata?: FieldMetadata;
17
17
  visible?: boolean;
18
- };
19
- type TextField = BaseField & {
18
+ }
19
+ interface TextField extends BaseField {
20
20
  type: "text";
21
21
  placeholder?: string;
22
22
  contentEditable?: boolean;
23
- };
24
- type NumberField = BaseField & {
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
- type TextareaField = BaseField & {
30
+ }
31
+ interface TextareaField extends BaseField {
32
32
  type: "textarea";
33
33
  placeholder?: string;
34
34
  contentEditable?: boolean;
35
- };
36
- type SelectField = BaseField & {
35
+ }
36
+ interface SelectField extends BaseField {
37
37
  type: "select";
38
38
  options: FieldOptions;
39
- };
40
- type RadioField = BaseField & {
39
+ }
40
+ interface RadioField extends BaseField {
41
41
  type: "radio";
42
42
  options: FieldOptions;
43
- };
44
- type ArrayField<Props extends {
43
+ }
44
+ interface ArrayField<Props extends {
45
45
  [key: string]: any;
46
46
  }[] = {
47
47
  [key: string]: any;
48
- }[], UserField extends {} = {}> = BaseField & {
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) => string;
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
- type ObjectField<Props extends any = {
59
+ }
60
+ interface ObjectField<Props extends any = {
61
61
  [key: string]: any;
62
- }, UserField extends {} = {}> = BaseField & {
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,12 +80,16 @@ 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) => string;
83
+ getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
84
+ };
85
+ type CacheOpts = {
86
+ enabled?: boolean;
84
87
  };
85
- type ExternalField<Props extends any = {
88
+ interface ExternalField<Props extends any = {
86
89
  [key: string]: any;
87
- }> = BaseField & {
90
+ }> extends BaseField {
88
91
  type: "external";
92
+ cache?: CacheOpts;
89
93
  placeholder?: string;
90
94
  fetchList: (params: {
91
95
  query: string;
@@ -93,7 +97,7 @@ type ExternalField<Props extends any = {
93
97
  }) => Promise<any[] | null>;
94
98
  mapProp?: (value: any) => Props;
95
99
  mapRow?: (value: any) => Record<string, string | number | ReactElement>;
96
- getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
100
+ getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
97
101
  showSearch?: boolean;
98
102
  renderFooter?: (props: {
99
103
  items: any[];
@@ -101,7 +105,7 @@ type ExternalField<Props extends any = {
101
105
  initialQuery?: string;
102
106
  filterFields?: Record<string, Field>;
103
107
  initialFilters?: Record<string, any>;
104
- };
108
+ }
105
109
  type CustomFieldRender<Value extends any> = (props: {
106
110
  field: CustomField<Value>;
107
111
  name: string;
@@ -110,16 +114,17 @@ type CustomFieldRender<Value extends any> = (props: {
110
114
  onChange: (value: Value) => void;
111
115
  readOnly?: boolean;
112
116
  }) => ReactElement;
113
- type CustomField<Value extends any> = BaseField & {
117
+ interface CustomField<Value extends any> extends BaseField {
114
118
  type: "custom";
115
119
  render: CustomFieldRender<Value>;
116
120
  contentEditable?: boolean;
117
- };
118
- type SlotField = BaseField & {
121
+ key?: string;
122
+ }
123
+ interface SlotField extends BaseField {
119
124
  type: "slot";
120
125
  allow?: string[];
121
126
  disallow?: string[];
122
- };
127
+ }
123
128
  type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
124
129
  [key: string]: any;
125
130
  }[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
@@ -141,13 +146,14 @@ type DropZoneProps = {
141
146
  allow?: string[];
142
147
  disallow?: string[];
143
148
  style?: CSSProperties;
144
- minEmptyHeight?: number;
149
+ minEmptyHeight?: CSSProperties["minHeight"] | number;
145
150
  className?: string;
146
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
147
153
  };
148
154
 
149
155
  type PuckContext = {
150
- renderDropZone: React.FC<DropZoneProps>;
156
+ renderDropZone: (props: DropZoneProps) => React.ReactNode;
151
157
  metadata: Metadata;
152
158
  isEditing: boolean;
153
159
  dragRef: ((element: Element | null) => void) | null;
@@ -195,6 +201,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
195
201
  type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
196
202
  props?: Partial<Props>;
197
203
  };
204
+ interface ComponentConfigExtensions {
205
+ }
198
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.
199
207
  UserField extends BaseField = {}> = {
200
208
  render: PuckComponent<RenderProps>;
@@ -210,7 +218,7 @@ UserField extends BaseField = {}> = {
210
218
  fields: Fields<FieldProps>;
211
219
  lastFields: Fields<FieldProps>;
212
220
  lastData: DataShape | null;
213
- metadata: Metadata;
221
+ metadata: ComponentMetadata;
214
222
  appState: AppState;
215
223
  parent: ComponentData | null;
216
224
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
@@ -219,7 +227,7 @@ UserField extends BaseField = {}> = {
219
227
  id: string;
220
228
  }>;
221
229
  lastData: DataShape | null;
222
- metadata: Metadata;
230
+ metadata: ComponentMetadata;
223
231
  trigger: ResolveDataTrigger;
224
232
  }) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
225
233
  resolvePermissions?: (data: DataShape, params: {
@@ -230,9 +238,10 @@ UserField extends BaseField = {}> = {
230
238
  permissions: Partial<Permissions>;
231
239
  appState: AppState;
232
240
  lastData: DataShape | null;
241
+ parent: ComponentData | null;
233
242
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
234
- metadata?: Metadata;
235
- };
243
+ metadata?: ComponentMetadata;
244
+ } & ComponentConfigExtensions;
236
245
  type RootConfigInternal<RootProps extends DefaultComponentProps = DefaultComponentProps, UserField extends BaseField = {}> = Partial<ComponentConfigInternal<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>, UserField>>;
237
246
  type Category<ComponentName> = {
238
247
  components?: ComponentName[];
@@ -259,6 +268,12 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
259
268
  type: string;
260
269
  } ? UserField : Field;
261
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
+ };
262
277
 
263
278
  type BaseData<Props extends {
264
279
  [key: string]: any;
@@ -298,6 +313,12 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
298
313
  type Metadata = {
299
314
  [key: string]: any;
300
315
  };
316
+ interface PuckMetadata extends Metadata {
317
+ }
318
+ interface ComponentMetadata extends PuckMetadata {
319
+ }
320
+ interface FieldMetadata extends Metadata {
321
+ }
301
322
 
302
323
  type ItemWithId = {
303
324
  _arrayId: string;
@@ -371,12 +392,6 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
371
392
  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 ? {
372
393
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
373
394
  } : T;
374
- type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
375
- components?: Components;
376
- root?: RootProps;
377
- categories?: CategoryNames;
378
- fields?: AssertHasValue<UserFields>;
379
- };
380
395
  type FieldsExtension = {
381
396
  [Type in string]: {
382
397
  type: Type;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
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
- type BaseField = {
13
+ interface BaseField {
14
14
  label?: string;
15
15
  labelIcon?: ReactElement;
16
- metadata?: Metadata;
16
+ metadata?: FieldMetadata;
17
17
  visible?: boolean;
18
- };
19
- type TextField = BaseField & {
18
+ }
19
+ interface TextField extends BaseField {
20
20
  type: "text";
21
21
  placeholder?: string;
22
22
  contentEditable?: boolean;
23
- };
24
- type NumberField = BaseField & {
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
- type TextareaField = BaseField & {
30
+ }
31
+ interface TextareaField extends BaseField {
32
32
  type: "textarea";
33
33
  placeholder?: string;
34
34
  contentEditable?: boolean;
35
- };
36
- type SelectField = BaseField & {
35
+ }
36
+ interface SelectField extends BaseField {
37
37
  type: "select";
38
38
  options: FieldOptions;
39
- };
40
- type RadioField = BaseField & {
39
+ }
40
+ interface RadioField extends BaseField {
41
41
  type: "radio";
42
42
  options: FieldOptions;
43
- };
44
- type ArrayField<Props extends {
43
+ }
44
+ interface ArrayField<Props extends {
45
45
  [key: string]: any;
46
46
  }[] = {
47
47
  [key: string]: any;
48
- }[], UserField extends {} = {}> = BaseField & {
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) => string;
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
- type ObjectField<Props extends any = {
59
+ }
60
+ interface ObjectField<Props extends any = {
61
61
  [key: string]: any;
62
- }, UserField extends {} = {}> = BaseField & {
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,12 +80,16 @@ 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) => string;
83
+ getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
84
+ };
85
+ type CacheOpts = {
86
+ enabled?: boolean;
84
87
  };
85
- type ExternalField<Props extends any = {
88
+ interface ExternalField<Props extends any = {
86
89
  [key: string]: any;
87
- }> = BaseField & {
90
+ }> extends BaseField {
88
91
  type: "external";
92
+ cache?: CacheOpts;
89
93
  placeholder?: string;
90
94
  fetchList: (params: {
91
95
  query: string;
@@ -93,7 +97,7 @@ type ExternalField<Props extends any = {
93
97
  }) => Promise<any[] | null>;
94
98
  mapProp?: (value: any) => Props;
95
99
  mapRow?: (value: any) => Record<string, string | number | ReactElement>;
96
- getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
100
+ getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
97
101
  showSearch?: boolean;
98
102
  renderFooter?: (props: {
99
103
  items: any[];
@@ -101,7 +105,7 @@ type ExternalField<Props extends any = {
101
105
  initialQuery?: string;
102
106
  filterFields?: Record<string, Field>;
103
107
  initialFilters?: Record<string, any>;
104
- };
108
+ }
105
109
  type CustomFieldRender<Value extends any> = (props: {
106
110
  field: CustomField<Value>;
107
111
  name: string;
@@ -110,16 +114,17 @@ type CustomFieldRender<Value extends any> = (props: {
110
114
  onChange: (value: Value) => void;
111
115
  readOnly?: boolean;
112
116
  }) => ReactElement;
113
- type CustomField<Value extends any> = BaseField & {
117
+ interface CustomField<Value extends any> extends BaseField {
114
118
  type: "custom";
115
119
  render: CustomFieldRender<Value>;
116
120
  contentEditable?: boolean;
117
- };
118
- type SlotField = BaseField & {
121
+ key?: string;
122
+ }
123
+ interface SlotField extends BaseField {
119
124
  type: "slot";
120
125
  allow?: string[];
121
126
  disallow?: string[];
122
- };
127
+ }
123
128
  type Field<ValueType = any, UserField extends {} = {}> = TextField | NumberField | TextareaField | SelectField | RadioField | ArrayField<ValueType extends {
124
129
  [key: string]: any;
125
130
  }[] ? ValueType : never, UserField> | ObjectField<ValueType, UserField> | ExternalField<ValueType> | ExternalFieldWithAdaptor<ValueType> | CustomField<ValueType> | SlotField;
@@ -141,13 +146,14 @@ type DropZoneProps = {
141
146
  allow?: string[];
142
147
  disallow?: string[];
143
148
  style?: CSSProperties;
144
- minEmptyHeight?: number;
149
+ minEmptyHeight?: CSSProperties["minHeight"] | number;
145
150
  className?: string;
146
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
147
153
  };
148
154
 
149
155
  type PuckContext = {
150
- renderDropZone: React.FC<DropZoneProps>;
156
+ renderDropZone: (props: DropZoneProps) => React.ReactNode;
151
157
  metadata: Metadata;
152
158
  isEditing: boolean;
153
159
  dragRef: ((element: Element | null) => void) | null;
@@ -195,6 +201,8 @@ type ResolveDataTrigger = "insert" | "replace" | "load" | "force";
195
201
  type WithPartialProps<T, Props extends DefaultComponentProps> = Omit<T, "props"> & {
196
202
  props?: Partial<Props>;
197
203
  };
204
+ interface ComponentConfigExtensions {
205
+ }
198
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.
199
207
  UserField extends BaseField = {}> = {
200
208
  render: PuckComponent<RenderProps>;
@@ -210,7 +218,7 @@ UserField extends BaseField = {}> = {
210
218
  fields: Fields<FieldProps>;
211
219
  lastFields: Fields<FieldProps>;
212
220
  lastData: DataShape | null;
213
- metadata: Metadata;
221
+ metadata: ComponentMetadata;
214
222
  appState: AppState;
215
223
  parent: ComponentData | null;
216
224
  }) => Promise<Fields<FieldProps>> | Fields<FieldProps>;
@@ -219,7 +227,7 @@ UserField extends BaseField = {}> = {
219
227
  id: string;
220
228
  }>;
221
229
  lastData: DataShape | null;
222
- metadata: Metadata;
230
+ metadata: ComponentMetadata;
223
231
  trigger: ResolveDataTrigger;
224
232
  }) => Promise<WithPartialProps<DataShape, FieldProps>> | WithPartialProps<DataShape, FieldProps>;
225
233
  resolvePermissions?: (data: DataShape, params: {
@@ -230,9 +238,10 @@ UserField extends BaseField = {}> = {
230
238
  permissions: Partial<Permissions>;
231
239
  appState: AppState;
232
240
  lastData: DataShape | null;
241
+ parent: ComponentData | null;
233
242
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
234
- metadata?: Metadata;
235
- };
243
+ metadata?: ComponentMetadata;
244
+ } & ComponentConfigExtensions;
236
245
  type RootConfigInternal<RootProps extends DefaultComponentProps = DefaultComponentProps, UserField extends BaseField = {}> = Partial<ComponentConfigInternal<WithChildren<RootProps>, AsFieldProps<RootProps>, RootData<AsFieldProps<RootProps>>, UserField>>;
237
246
  type Category<ComponentName> = {
238
247
  components?: ComponentName[];
@@ -259,6 +268,12 @@ type ExtractConfigParams<UserConfig extends ConfigInternal> = UserConfig extends
259
268
  type: string;
260
269
  } ? UserField : Field;
261
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
+ };
262
277
 
263
278
  type BaseData<Props extends {
264
279
  [key: string]: any;
@@ -298,6 +313,12 @@ type Data<Components extends DefaultComponents = DefaultComponents, RootProps ex
298
313
  type Metadata = {
299
314
  [key: string]: any;
300
315
  };
316
+ interface PuckMetadata extends Metadata {
317
+ }
318
+ interface ComponentMetadata extends PuckMetadata {
319
+ }
320
+ interface FieldMetadata extends Metadata {
321
+ }
301
322
 
302
323
  type ItemWithId = {
303
324
  _arrayId: string;
@@ -371,12 +392,6 @@ type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined
371
392
  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 ? {
372
393
  [K in keyof T]: WithDeepSlots<T[K], SlotType>;
373
394
  } : T;
374
- type ConfigParams<Components extends DefaultComponents = DefaultComponents, RootProps extends DefaultComponentProps = any, CategoryNames extends string[] = string[], UserFields extends FieldsExtension = FieldsExtension> = {
375
- components?: Components;
376
- root?: RootProps;
377
- categories?: CategoryNames;
378
- fields?: AssertHasValue<UserFields>;
379
- };
380
395
  type FieldsExtension = {
381
396
  [Type in string]: {
382
397
  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 plugin_heading_analyzer_exports = {};
272
- __export(plugin_heading_analyzer_exports, {
271
+ var index_exports = {};
272
+ __export(index_exports, {
273
273
  default: () => HeadingAnalyzer_default
274
274
  });
275
- module.exports = __toCommonJS(plugin_heading_analyzer_exports);
275
+ module.exports = __toCommonJS(index_exports);
276
276
  init_react_import();
277
277
 
278
278
  // src/HeadingAnalyzer.tsx
@@ -544,32 +544,27 @@ var walkField = ({
544
544
  config,
545
545
  recurseSlots = false
546
546
  }) => {
547
- var _a, _b, _c, _d;
547
+ var _a, _b, _c;
548
548
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
549
549
  const map = mappers[fieldType];
550
550
  if (map && fieldType === "slot") {
551
551
  const content = value || [];
552
- let mappedContent = content;
553
- if (recurseSlots) {
554
- for (let i = 0; i < content.length; i++) {
555
- const el = content[i];
556
- const componentConfig = config.components[el.type];
557
- if (!componentConfig) {
558
- continue;
559
- }
560
- const fields2 = (_b = componentConfig.fields) != null ? _b : {};
561
- mappedContent.push(
562
- walkField({
563
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
564
- fields: fields2,
565
- mappers,
566
- id: el.props.id,
567
- config,
568
- recurseSlots
569
- })
570
- );
552
+ const mappedContent = recurseSlots ? content.map((el) => {
553
+ var _a2;
554
+ const componentConfig = config.components[el.type];
555
+ if (!componentConfig) {
556
+ throw new Error(`Could not find component config for ${el.type}`);
571
557
  }
572
- }
558
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
559
+ return walkField({
560
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
561
+ fields: fields2,
562
+ mappers,
563
+ id: el.props.id,
564
+ config,
565
+ recurseSlots
566
+ });
567
+ }) : content;
573
568
  if (containsPromise(mappedContent)) {
574
569
  return Promise.all(mappedContent);
575
570
  }
@@ -591,7 +586,7 @@ var walkField = ({
591
586
  }
592
587
  if (value && typeof value === "object") {
593
588
  if (Array.isArray(value)) {
594
- const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
589
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
595
590
  if (!arrayFields) return value;
596
591
  const newValue = value.map(
597
592
  (el, idx) => walkField({
@@ -612,7 +607,7 @@ var walkField = ({
612
607
  } else if ("$$typeof" in value) {
613
608
  return value;
614
609
  } else {
615
- const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
610
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
616
611
  return walkObject({
617
612
  value,
618
613
  fields: objectFields,
@@ -858,10 +853,10 @@ var insert = (list, index, item) => {
858
853
  // ../core/lib/generate-id.ts
859
854
  init_react_import();
860
855
 
861
- // ../../node_modules/uuid/dist/esm-node/index.js
856
+ // ../core/node_modules/uuid/dist/esm-node/index.js
862
857
  init_react_import();
863
858
 
864
- // ../../node_modules/uuid/dist/esm-node/rng.js
859
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
865
860
  init_react_import();
866
861
  var import_crypto = __toESM(require("crypto"));
867
862
  var rnds8Pool = new Uint8Array(256);
@@ -874,7 +869,7 @@ function rng() {
874
869
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
875
870
  }
876
871
 
877
- // ../../node_modules/uuid/dist/esm-node/stringify.js
872
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
878
873
  init_react_import();
879
874
  var byteToHex = [];
880
875
  for (let i = 0; i < 256; ++i) {
@@ -884,17 +879,17 @@ function unsafeStringify(arr, offset = 0) {
884
879
  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]];
885
880
  }
886
881
 
887
- // ../../node_modules/uuid/dist/esm-node/v4.js
882
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
888
883
  init_react_import();
889
884
 
890
- // ../../node_modules/uuid/dist/esm-node/native.js
885
+ // ../core/node_modules/uuid/dist/esm-node/native.js
891
886
  init_react_import();
892
887
  var import_crypto2 = __toESM(require("crypto"));
893
888
  var native_default = {
894
889
  randomUUID: import_crypto2.default.randomUUID
895
890
  };
896
891
 
897
- // ../../node_modules/uuid/dist/esm-node/v4.js
892
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
898
893
  function v4(options, buf, offset) {
899
894
  if (native_default.randomUUID && !buf && !options) {
900
895
  return native_default.randomUUID();
@@ -1475,7 +1470,7 @@ var createStoreImpl = (createState) => {
1475
1470
  const initialState = state = createState(setState, getState, api);
1476
1471
  return api;
1477
1472
  };
1478
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1473
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1479
1474
 
1480
1475
  // ../../node_modules/zustand/esm/react.mjs
1481
1476
  init_react_import();
@@ -1484,8 +1479,8 @@ var identity = (arg) => arg;
1484
1479
  function useStore(api, selector = identity) {
1485
1480
  const slice = import_react4.default.useSyncExternalStore(
1486
1481
  api.subscribe,
1487
- () => selector(api.getState()),
1488
- () => selector(api.getInitialState())
1482
+ import_react4.default.useCallback(() => selector(api.getState()), [api, selector]),
1483
+ import_react4.default.useCallback(() => selector(api.getInitialState()), [api, selector])
1489
1484
  );
1490
1485
  import_react4.default.useDebugValue(slice);
1491
1486
  return slice;
@@ -1496,13 +1491,13 @@ var createImpl = (createState) => {
1496
1491
  Object.assign(useBoundStore, api);
1497
1492
  return useBoundStore;
1498
1493
  };
1499
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1494
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1500
1495
 
1501
1496
  // ../../node_modules/zustand/esm/middleware.mjs
1502
1497
  init_react_import();
1503
1498
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1504
1499
  const origSubscribe = api.subscribe;
1505
- api.subscribe = (selector, optListener, options) => {
1500
+ api.subscribe = ((selector, optListener, options) => {
1506
1501
  let listener = selector;
1507
1502
  if (optListener) {
1508
1503
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1519,7 +1514,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1519
1514
  }
1520
1515
  }
1521
1516
  return origSubscribe(listener);
1522
- };
1517
+ });
1523
1518
  const initialState = fn(set, get, api);
1524
1519
  return initialState;
1525
1520
  };
@@ -1736,9 +1731,9 @@ function createIsCircular(areItemsEqual) {
1736
1731
  function getStrictProperties(object) {
1737
1732
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1738
1733
  }
1739
- var hasOwn = Object.hasOwn || function(object, property) {
1734
+ var hasOwn = Object.hasOwn || (function(object, property) {
1740
1735
  return hasOwnProperty.call(object, property);
1741
- };
1736
+ });
1742
1737
  function sameValueZeroEqual(a, b) {
1743
1738
  return a === b || !a && !b && a !== a && b !== b;
1744
1739
  }
@@ -2128,29 +2123,37 @@ var getChanged = (newItem, oldItem) => {
2128
2123
 
2129
2124
  // ../core/store/slices/permissions.ts
2130
2125
  var createPermissionsSlice = (set, get) => {
2131
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2126
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2132
2127
  const { state, permissions, config } = get();
2133
2128
  const { cache: cache2, globalPermissions } = permissions;
2134
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2135
- var _a, _b, _c;
2129
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2130
+ var _a, _b;
2136
2131
  const { config: config2, state: appState, setComponentLoading } = get();
2132
+ const itemCache = cache2[item2.props.id];
2133
+ const nodes = appState.indexes.nodes;
2134
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2135
+ const parentNode = parentId ? nodes[parentId] : null;
2136
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2137
2137
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2138
2138
  if (!componentConfig) {
2139
2139
  return;
2140
2140
  }
2141
2141
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2142
2142
  if (componentConfig.resolvePermissions) {
2143
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2144
- if (Object.values(changed).some((el) => el === true) || force2) {
2143
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2144
+ const propsChanged = Object.values(changed).some((el) => el === true);
2145
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2146
+ if (propsChanged || parentChanged || force2) {
2145
2147
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2146
2148
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2147
2149
  item2,
2148
2150
  {
2149
2151
  changed,
2150
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2152
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2151
2153
  permissions: initialPermissions,
2152
2154
  appState: makeStatePublic(appState),
2153
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2155
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2156
+ parent: parentData
2154
2157
  }
2155
2158
  );
2156
2159
  const latest = get().permissions;
@@ -2158,6 +2161,7 @@ var createPermissionsSlice = (set, get) => {
2158
2161
  permissions: __spreadProps(__spreadValues({}, latest), {
2159
2162
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2160
2163
  [item2.props.id]: {
2164
+ lastParentId: parentId,
2161
2165
  lastData: item2,
2162
2166
  lastPermissions: resolvedPermissions
2163
2167
  }
@@ -2171,9 +2175,9 @@ var createPermissionsSlice = (set, get) => {
2171
2175
  }
2172
2176
  }
2173
2177
  });
2174
- const resolveDataForRoot = (force2 = false) => {
2178
+ const resolvePermissionsForRoot = (force2 = false) => {
2175
2179
  const { state: appState } = get();
2176
- resolveDataForItem(
2180
+ resolvePermissionsForItem(
2177
2181
  // Shim the root data in by conforming to component data shape
2178
2182
  {
2179
2183
  type: "root",
@@ -2184,16 +2188,16 @@ var createPermissionsSlice = (set, get) => {
2184
2188
  };
2185
2189
  const { item, type, root } = params;
2186
2190
  if (item) {
2187
- yield resolveDataForItem(item, force);
2191
+ yield resolvePermissionsForItem(item, force);
2188
2192
  } else if (type) {
2189
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2190
- yield resolveDataForItem(item2, force);
2193
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2194
+ yield resolvePermissionsForItem(item2, force);
2191
2195
  }));
2192
2196
  } else if (root) {
2193
- resolveDataForRoot(force);
2197
+ resolvePermissionsForRoot(force);
2194
2198
  } else {
2195
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2196
- yield resolveDataForItem(item2, force);
2199
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2200
+ yield resolvePermissionsForItem(item2, force);
2197
2201
  }));
2198
2202
  }
2199
2203
  });
@@ -2247,7 +2251,7 @@ var createFieldsSlice = (_set, _get) => {
2247
2251
  // ../core/lib/resolve-component-data.ts
2248
2252
  init_react_import();
2249
2253
  var cache = { lastChange: {} };
2250
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2254
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2251
2255
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2252
2256
  const resolvedItem = __spreadValues({}, item);
2253
2257
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2275,11 +2279,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2275
2279
  let itemWithResolvedChildren = yield mapFields(
2276
2280
  resolvedItem,
2277
2281
  {
2278
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2282
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2279
2283
  const content = value;
2280
2284
  return yield Promise.all(
2281
2285
  content.map(
2282
- (childItem) => __async(void 0, null, function* () {
2286
+ (childItem) => __async(null, null, function* () {
2283
2287
  return (yield resolveComponentData(
2284
2288
  childItem,
2285
2289
  config,
@@ -2471,7 +2475,7 @@ var createAppStore = (initialAppStore) => create()(
2471
2475
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2472
2476
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2473
2477
  }),
2474
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2478
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2475
2479
  const { config, metadata, setComponentLoading, permissions } = get();
2476
2480
  const timeouts = {};
2477
2481
  return yield resolveComponentData(
@@ -2482,7 +2486,7 @@ var createAppStore = (initialAppStore) => create()(
2482
2486
  const id = "id" in item.props ? item.props.id : "root";
2483
2487
  timeouts[id] = setComponentLoading(id, true, 50);
2484
2488
  },
2485
- (item) => __async(void 0, null, function* () {
2489
+ (item) => __async(null, null, function* () {
2486
2490
  const id = "id" in item.props ? item.props.id : "root";
2487
2491
  if ("type" in item) {
2488
2492
  yield permissions.refreshPermissions({ item });
@@ -2494,7 +2498,7 @@ var createAppStore = (initialAppStore) => create()(
2494
2498
  trigger
2495
2499
  );
2496
2500
  }),
2497
- resolveAndCommitData: () => __async(void 0, null, function* () {
2501
+ resolveAndCommitData: () => __async(null, null, function* () {
2498
2502
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2499
2503
  walkAppState(
2500
2504
  state,
@@ -2727,45 +2731,10 @@ classnames/index.js:
2727
2731
  *)
2728
2732
 
2729
2733
  lucide-react/dist/esm/shared/src/utils.js:
2730
- (**
2731
- * @license lucide-react v0.468.0 - ISC
2732
- *
2733
- * This source code is licensed under the ISC license.
2734
- * See the LICENSE file in the root directory of this source tree.
2735
- *)
2736
-
2737
2734
  lucide-react/dist/esm/defaultAttributes.js:
2738
- (**
2739
- * @license lucide-react v0.468.0 - ISC
2740
- *
2741
- * This source code is licensed under the ISC license.
2742
- * See the LICENSE file in the root directory of this source tree.
2743
- *)
2744
-
2745
2735
  lucide-react/dist/esm/Icon.js:
2746
- (**
2747
- * @license lucide-react v0.468.0 - ISC
2748
- *
2749
- * This source code is licensed under the ISC license.
2750
- * See the LICENSE file in the root directory of this source tree.
2751
- *)
2752
-
2753
2736
  lucide-react/dist/esm/createLucideIcon.js:
2754
- (**
2755
- * @license lucide-react v0.468.0 - ISC
2756
- *
2757
- * This source code is licensed under the ISC license.
2758
- * See the LICENSE file in the root directory of this source tree.
2759
- *)
2760
-
2761
2737
  lucide-react/dist/esm/icons/heading-1.js:
2762
- (**
2763
- * @license lucide-react v0.468.0 - ISC
2764
- *
2765
- * This source code is licensed under the ISC license.
2766
- * See the LICENSE file in the root directory of this source tree.
2767
- *)
2768
-
2769
2738
  lucide-react/dist/esm/lucide-react.js:
2770
2739
  (**
2771
2740
  * @license lucide-react v0.468.0 - ISC
package/dist/index.mjs CHANGED
@@ -532,32 +532,27 @@ var walkField = ({
532
532
  config,
533
533
  recurseSlots = false
534
534
  }) => {
535
- var _a, _b, _c, _d;
535
+ var _a, _b, _c;
536
536
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
537
537
  const map = mappers[fieldType];
538
538
  if (map && fieldType === "slot") {
539
539
  const content = value || [];
540
- let mappedContent = content;
541
- if (recurseSlots) {
542
- for (let i = 0; i < content.length; i++) {
543
- const el = content[i];
544
- const componentConfig = config.components[el.type];
545
- if (!componentConfig) {
546
- continue;
547
- }
548
- const fields2 = (_b = componentConfig.fields) != null ? _b : {};
549
- mappedContent.push(
550
- walkField({
551
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
552
- fields: fields2,
553
- mappers,
554
- id: el.props.id,
555
- config,
556
- recurseSlots
557
- })
558
- );
540
+ const mappedContent = recurseSlots ? content.map((el) => {
541
+ var _a2;
542
+ const componentConfig = config.components[el.type];
543
+ if (!componentConfig) {
544
+ throw new Error(`Could not find component config for ${el.type}`);
559
545
  }
560
- }
546
+ const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
547
+ return walkField({
548
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
549
+ fields: fields2,
550
+ mappers,
551
+ id: el.props.id,
552
+ config,
553
+ recurseSlots
554
+ });
555
+ }) : content;
561
556
  if (containsPromise(mappedContent)) {
562
557
  return Promise.all(mappedContent);
563
558
  }
@@ -579,7 +574,7 @@ var walkField = ({
579
574
  }
580
575
  if (value && typeof value === "object") {
581
576
  if (Array.isArray(value)) {
582
- const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
577
+ const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
583
578
  if (!arrayFields) return value;
584
579
  const newValue = value.map(
585
580
  (el, idx) => walkField({
@@ -600,7 +595,7 @@ var walkField = ({
600
595
  } else if ("$$typeof" in value) {
601
596
  return value;
602
597
  } else {
603
- const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
598
+ const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
604
599
  return walkObject({
605
600
  value,
606
601
  fields: objectFields,
@@ -846,10 +841,10 @@ var insert = (list, index, item) => {
846
841
  // ../core/lib/generate-id.ts
847
842
  init_react_import();
848
843
 
849
- // ../../node_modules/uuid/dist/esm-node/index.js
844
+ // ../core/node_modules/uuid/dist/esm-node/index.js
850
845
  init_react_import();
851
846
 
852
- // ../../node_modules/uuid/dist/esm-node/rng.js
847
+ // ../core/node_modules/uuid/dist/esm-node/rng.js
853
848
  init_react_import();
854
849
  import crypto from "crypto";
855
850
  var rnds8Pool = new Uint8Array(256);
@@ -862,7 +857,7 @@ function rng() {
862
857
  return rnds8Pool.slice(poolPtr, poolPtr += 16);
863
858
  }
864
859
 
865
- // ../../node_modules/uuid/dist/esm-node/stringify.js
860
+ // ../core/node_modules/uuid/dist/esm-node/stringify.js
866
861
  init_react_import();
867
862
  var byteToHex = [];
868
863
  for (let i = 0; i < 256; ++i) {
@@ -872,17 +867,17 @@ function unsafeStringify(arr, offset = 0) {
872
867
  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]];
873
868
  }
874
869
 
875
- // ../../node_modules/uuid/dist/esm-node/v4.js
870
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
876
871
  init_react_import();
877
872
 
878
- // ../../node_modules/uuid/dist/esm-node/native.js
873
+ // ../core/node_modules/uuid/dist/esm-node/native.js
879
874
  init_react_import();
880
875
  import crypto2 from "crypto";
881
876
  var native_default = {
882
877
  randomUUID: crypto2.randomUUID
883
878
  };
884
879
 
885
- // ../../node_modules/uuid/dist/esm-node/v4.js
880
+ // ../core/node_modules/uuid/dist/esm-node/v4.js
886
881
  function v4(options, buf, offset) {
887
882
  if (native_default.randomUUID && !buf && !options) {
888
883
  return native_default.randomUUID();
@@ -1463,7 +1458,7 @@ var createStoreImpl = (createState) => {
1463
1458
  const initialState = state = createState(setState, getState, api);
1464
1459
  return api;
1465
1460
  };
1466
- var createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
1461
+ var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
1467
1462
 
1468
1463
  // ../../node_modules/zustand/esm/react.mjs
1469
1464
  init_react_import();
@@ -1472,8 +1467,8 @@ var identity = (arg) => arg;
1472
1467
  function useStore(api, selector = identity) {
1473
1468
  const slice = React2.useSyncExternalStore(
1474
1469
  api.subscribe,
1475
- () => selector(api.getState()),
1476
- () => selector(api.getInitialState())
1470
+ React2.useCallback(() => selector(api.getState()), [api, selector]),
1471
+ React2.useCallback(() => selector(api.getInitialState()), [api, selector])
1477
1472
  );
1478
1473
  React2.useDebugValue(slice);
1479
1474
  return slice;
@@ -1484,13 +1479,13 @@ var createImpl = (createState) => {
1484
1479
  Object.assign(useBoundStore, api);
1485
1480
  return useBoundStore;
1486
1481
  };
1487
- var create = (createState) => createState ? createImpl(createState) : createImpl;
1482
+ var create = ((createState) => createState ? createImpl(createState) : createImpl);
1488
1483
 
1489
1484
  // ../../node_modules/zustand/esm/middleware.mjs
1490
1485
  init_react_import();
1491
1486
  var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1492
1487
  const origSubscribe = api.subscribe;
1493
- api.subscribe = (selector, optListener, options) => {
1488
+ api.subscribe = ((selector, optListener, options) => {
1494
1489
  let listener = selector;
1495
1490
  if (optListener) {
1496
1491
  const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;
@@ -1507,7 +1502,7 @@ var subscribeWithSelectorImpl = (fn) => (set, get, api) => {
1507
1502
  }
1508
1503
  }
1509
1504
  return origSubscribe(listener);
1510
- };
1505
+ });
1511
1506
  const initialState = fn(set, get, api);
1512
1507
  return initialState;
1513
1508
  };
@@ -1724,9 +1719,9 @@ function createIsCircular(areItemsEqual) {
1724
1719
  function getStrictProperties(object) {
1725
1720
  return getOwnPropertyNames(object).concat(getOwnPropertySymbols(object));
1726
1721
  }
1727
- var hasOwn = Object.hasOwn || function(object, property) {
1722
+ var hasOwn = Object.hasOwn || (function(object, property) {
1728
1723
  return hasOwnProperty.call(object, property);
1729
- };
1724
+ });
1730
1725
  function sameValueZeroEqual(a, b) {
1731
1726
  return a === b || !a && !b && a !== a && b !== b;
1732
1727
  }
@@ -2116,29 +2111,37 @@ var getChanged = (newItem, oldItem) => {
2116
2111
 
2117
2112
  // ../core/store/slices/permissions.ts
2118
2113
  var createPermissionsSlice = (set, get) => {
2119
- const resolvePermissions = (..._0) => __async(void 0, [..._0], function* (params = {}, force) {
2114
+ const resolvePermissions = (..._0) => __async(null, [..._0], function* (params = {}, force) {
2120
2115
  const { state, permissions, config } = get();
2121
2116
  const { cache: cache2, globalPermissions } = permissions;
2122
- const resolveDataForItem = (item2, force2 = false) => __async(void 0, null, function* () {
2123
- var _a, _b, _c;
2117
+ const resolvePermissionsForItem = (item2, force2 = false) => __async(null, null, function* () {
2118
+ var _a, _b;
2124
2119
  const { config: config2, state: appState, setComponentLoading } = get();
2120
+ const itemCache = cache2[item2.props.id];
2121
+ const nodes = appState.indexes.nodes;
2122
+ const parentId = (_a = nodes[item2.props.id]) == null ? void 0 : _a.parentId;
2123
+ const parentNode = parentId ? nodes[parentId] : null;
2124
+ const parentData = (_b = parentNode == null ? void 0 : parentNode.data) != null ? _b : null;
2125
2125
  const componentConfig = item2.type === "root" ? config2.root : config2.components[item2.type];
2126
2126
  if (!componentConfig) {
2127
2127
  return;
2128
2128
  }
2129
2129
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
2130
2130
  if (componentConfig.resolvePermissions) {
2131
- const changed = getChanged(item2, (_a = cache2[item2.props.id]) == null ? void 0 : _a.lastData);
2132
- if (Object.values(changed).some((el) => el === true) || force2) {
2131
+ const changed = getChanged(item2, itemCache == null ? void 0 : itemCache.lastData);
2132
+ const propsChanged = Object.values(changed).some((el) => el === true);
2133
+ const parentChanged = (itemCache == null ? void 0 : itemCache.lastParentId) !== parentId;
2134
+ if (propsChanged || parentChanged || force2) {
2133
2135
  const clearTimeout2 = setComponentLoading(item2.props.id, true, 50);
2134
2136
  const resolvedPermissions = yield componentConfig.resolvePermissions(
2135
2137
  item2,
2136
2138
  {
2137
2139
  changed,
2138
- lastPermissions: ((_b = cache2[item2.props.id]) == null ? void 0 : _b.lastPermissions) || null,
2140
+ lastPermissions: (itemCache == null ? void 0 : itemCache.lastPermissions) || null,
2139
2141
  permissions: initialPermissions,
2140
2142
  appState: makeStatePublic(appState),
2141
- lastData: ((_c = cache2[item2.props.id]) == null ? void 0 : _c.lastData) || null
2143
+ lastData: (itemCache == null ? void 0 : itemCache.lastData) || null,
2144
+ parent: parentData
2142
2145
  }
2143
2146
  );
2144
2147
  const latest = get().permissions;
@@ -2146,6 +2149,7 @@ var createPermissionsSlice = (set, get) => {
2146
2149
  permissions: __spreadProps(__spreadValues({}, latest), {
2147
2150
  cache: __spreadProps(__spreadValues({}, latest.cache), {
2148
2151
  [item2.props.id]: {
2152
+ lastParentId: parentId,
2149
2153
  lastData: item2,
2150
2154
  lastPermissions: resolvedPermissions
2151
2155
  }
@@ -2159,9 +2163,9 @@ var createPermissionsSlice = (set, get) => {
2159
2163
  }
2160
2164
  }
2161
2165
  });
2162
- const resolveDataForRoot = (force2 = false) => {
2166
+ const resolvePermissionsForRoot = (force2 = false) => {
2163
2167
  const { state: appState } = get();
2164
- resolveDataForItem(
2168
+ resolvePermissionsForItem(
2165
2169
  // Shim the root data in by conforming to component data shape
2166
2170
  {
2167
2171
  type: "root",
@@ -2172,16 +2176,16 @@ var createPermissionsSlice = (set, get) => {
2172
2176
  };
2173
2177
  const { item, type, root } = params;
2174
2178
  if (item) {
2175
- yield resolveDataForItem(item, force);
2179
+ yield resolvePermissionsForItem(item, force);
2176
2180
  } else if (type) {
2177
- flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(void 0, null, function* () {
2178
- yield resolveDataForItem(item2, force);
2181
+ flattenData(state, config).filter((item2) => item2.type === type).map((item2) => __async(null, null, function* () {
2182
+ yield resolvePermissionsForItem(item2, force);
2179
2183
  }));
2180
2184
  } else if (root) {
2181
- resolveDataForRoot(force);
2185
+ resolvePermissionsForRoot(force);
2182
2186
  } else {
2183
- flattenData(state, config).map((item2) => __async(void 0, null, function* () {
2184
- yield resolveDataForItem(item2, force);
2187
+ flattenData(state, config).map((item2) => __async(null, null, function* () {
2188
+ yield resolvePermissionsForItem(item2, force);
2185
2189
  }));
2186
2190
  }
2187
2191
  });
@@ -2235,7 +2239,7 @@ var createFieldsSlice = (_set, _get) => {
2235
2239
  // ../core/lib/resolve-component-data.ts
2236
2240
  init_react_import();
2237
2241
  var cache = { lastChange: {} };
2238
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2242
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
2239
2243
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
2240
2244
  const resolvedItem = __spreadValues({}, item);
2241
2245
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -2263,11 +2267,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
2263
2267
  let itemWithResolvedChildren = yield mapFields(
2264
2268
  resolvedItem,
2265
2269
  {
2266
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
2270
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
2267
2271
  const content = value;
2268
2272
  return yield Promise.all(
2269
2273
  content.map(
2270
- (childItem) => __async(void 0, null, function* () {
2274
+ (childItem) => __async(null, null, function* () {
2271
2275
  return (yield resolveComponentData(
2272
2276
  childItem,
2273
2277
  config,
@@ -2459,7 +2463,7 @@ var createAppStore = (initialAppStore) => create()(
2459
2463
  const selectedItem = state.ui.itemSelector ? getItem(state.ui.itemSelector, state) : null;
2460
2464
  return __spreadProps(__spreadValues({}, s), { state, selectedItem });
2461
2465
  }),
2462
- resolveComponentData: (componentData, trigger) => __async(void 0, null, function* () {
2466
+ resolveComponentData: (componentData, trigger) => __async(null, null, function* () {
2463
2467
  const { config, metadata, setComponentLoading, permissions } = get();
2464
2468
  const timeouts = {};
2465
2469
  return yield resolveComponentData(
@@ -2470,7 +2474,7 @@ var createAppStore = (initialAppStore) => create()(
2470
2474
  const id = "id" in item.props ? item.props.id : "root";
2471
2475
  timeouts[id] = setComponentLoading(id, true, 50);
2472
2476
  },
2473
- (item) => __async(void 0, null, function* () {
2477
+ (item) => __async(null, null, function* () {
2474
2478
  const id = "id" in item.props ? item.props.id : "root";
2475
2479
  if ("type" in item) {
2476
2480
  yield permissions.refreshPermissions({ item });
@@ -2482,7 +2486,7 @@ var createAppStore = (initialAppStore) => create()(
2482
2486
  trigger
2483
2487
  );
2484
2488
  }),
2485
- resolveAndCommitData: () => __async(void 0, null, function* () {
2489
+ resolveAndCommitData: () => __async(null, null, function* () {
2486
2490
  const { config, state, dispatch, resolveComponentData: resolveComponentData2 } = get();
2487
2491
  walkAppState(
2488
2492
  state,
@@ -2718,45 +2722,10 @@ classnames/index.js:
2718
2722
  *)
2719
2723
 
2720
2724
  lucide-react/dist/esm/shared/src/utils.js:
2721
- (**
2722
- * @license lucide-react v0.468.0 - ISC
2723
- *
2724
- * This source code is licensed under the ISC license.
2725
- * See the LICENSE file in the root directory of this source tree.
2726
- *)
2727
-
2728
2725
  lucide-react/dist/esm/defaultAttributes.js:
2729
- (**
2730
- * @license lucide-react v0.468.0 - ISC
2731
- *
2732
- * This source code is licensed under the ISC license.
2733
- * See the LICENSE file in the root directory of this source tree.
2734
- *)
2735
-
2736
2726
  lucide-react/dist/esm/Icon.js:
2737
- (**
2738
- * @license lucide-react v0.468.0 - ISC
2739
- *
2740
- * This source code is licensed under the ISC license.
2741
- * See the LICENSE file in the root directory of this source tree.
2742
- *)
2743
-
2744
2727
  lucide-react/dist/esm/createLucideIcon.js:
2745
- (**
2746
- * @license lucide-react v0.468.0 - ISC
2747
- *
2748
- * This source code is licensed under the ISC license.
2749
- * See the LICENSE file in the root directory of this source tree.
2750
- *)
2751
-
2752
2728
  lucide-react/dist/esm/icons/heading-1.js:
2753
- (**
2754
- * @license lucide-react v0.468.0 - ISC
2755
- *
2756
- * This source code is licensed under the ISC license.
2757
- * See the LICENSE file in the root directory of this source tree.
2758
- *)
2759
-
2760
2729
  lucide-react/dist/esm/lucide-react.js:
2761
2730
  (**
2762
2731
  * @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.bd7b613d",
3
+ "version": "0.21.0-canary.c0db75c1",
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.bd7b613d",
28
+ "@measured/puck": "^0.21.0-canary.c0db75c1",
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",