@netlisian/softconfig 0.1.3 → 0.1.4

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.
@@ -18,6 +18,7 @@ type BuilderRootConfig = {
18
18
  _fieldSettings?: {
19
19
  [key: string]: any;
20
20
  };
21
+ [key: string]: any;
21
22
  };
22
23
  type BuilderComponentConfig = {
23
24
  _slot?: {
@@ -51,6 +52,7 @@ type SoftComponent = {
51
52
  fields: Fields;
52
53
  fieldSettings?: Record<string, any>;
53
54
  defaultProps: DefaultComponentProps;
55
+ rootProps?: Record<string, any>;
54
56
  components: SoftSubComponent;
55
57
  slots: {
56
58
  [slot: string]: DefaultComponentProps;
@@ -65,6 +67,7 @@ type VersionedSoftComponent = {
65
67
  fields: Fields;
66
68
  fieldSettings?: Record<string, any>;
67
69
  defaultProps: DefaultComponentProps;
70
+ rootProps?: Record<string, any>;
68
71
  components: SoftSubComponent;
69
72
  slots: {
70
73
  [slot: string]: DefaultComponentProps;
@@ -235,10 +238,13 @@ type RenderFunc<Props extends {
235
238
  children: ReactNode;
236
239
  }> = (props: Props) => ReactElement;
237
240
  type Overrides = {
238
- componentNameToKey?: (displayName: string, context: {
241
+ componentNameToKey?: (displayName: string, context: Partial<BuilderRootConfig> & {
239
242
  existingKeys: string[];
240
243
  state: "building" | "remodeling" | "ready" | "inspecting";
241
244
  }) => string;
245
+ componentKeyToName?: (key: string) => string;
246
+ onRemodel?: (key: string) => Record<string, any>;
247
+ additionalRootFields?: Record<string, Field>;
242
248
  map?: RenderFunc<{
243
249
  rootProps: BuilderRootConfig;
244
250
  toOptions: {
@@ -265,14 +271,19 @@ type Overrides = {
265
271
  onActions?: OnActionsCallback;
266
272
  name?: Field<string>;
267
273
  categories?: Field<string | undefined>;
268
- onRootsDataChange?: (data: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
274
+ resolveRootData?: (props: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
269
275
  changed: Partial<Record<keyof BuilderRootConfig, boolean> & {
270
276
  id: string;
271
277
  }>;
272
278
  lastData: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | null;
273
279
  metadata: Metadata;
274
280
  trigger: ResolveDataTrigger;
275
- }) => void;
281
+ }, context: {
282
+ editingComponent?: string;
283
+ }) => {
284
+ props: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | Promise<RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>>;
285
+ readOnly: Readonly<Record<string, boolean>> | undefined;
286
+ };
276
287
  };
277
288
 
278
289
  type Status = "building" | "remodeling" | "ready" | "inspecting";
@@ -313,6 +324,7 @@ type AppStore = {
313
324
  hydrateTransforms: () => void;
314
325
  setSoftComponentDefaultVersion: (key: string, version: string) => void;
315
326
  removeSoftComponent: (key: string) => void;
327
+ editingComponent: string | null;
316
328
  editingComponentId: string | null;
317
329
  editableComponentIds: Set<string>;
318
330
  setEditableComponentIds: (ids: Set<string>) => void;
@@ -392,6 +404,7 @@ declare const useRemodel: () => {
392
404
  fields: _measured_puck.Fields;
393
405
  fieldSettings?: Record<string, any>;
394
406
  defaultProps: DefaultComponentProps;
407
+ rootProps?: Record<string, any>;
395
408
  components: SoftSubComponent;
396
409
  slots: {
397
410
  [slot: string]: DefaultComponentProps;
@@ -18,6 +18,7 @@ type BuilderRootConfig = {
18
18
  _fieldSettings?: {
19
19
  [key: string]: any;
20
20
  };
21
+ [key: string]: any;
21
22
  };
22
23
  type BuilderComponentConfig = {
23
24
  _slot?: {
@@ -51,6 +52,7 @@ type SoftComponent = {
51
52
  fields: Fields;
52
53
  fieldSettings?: Record<string, any>;
53
54
  defaultProps: DefaultComponentProps;
55
+ rootProps?: Record<string, any>;
54
56
  components: SoftSubComponent;
55
57
  slots: {
56
58
  [slot: string]: DefaultComponentProps;
@@ -65,6 +67,7 @@ type VersionedSoftComponent = {
65
67
  fields: Fields;
66
68
  fieldSettings?: Record<string, any>;
67
69
  defaultProps: DefaultComponentProps;
70
+ rootProps?: Record<string, any>;
68
71
  components: SoftSubComponent;
69
72
  slots: {
70
73
  [slot: string]: DefaultComponentProps;
@@ -235,10 +238,13 @@ type RenderFunc<Props extends {
235
238
  children: ReactNode;
236
239
  }> = (props: Props) => ReactElement;
237
240
  type Overrides = {
238
- componentNameToKey?: (displayName: string, context: {
241
+ componentNameToKey?: (displayName: string, context: Partial<BuilderRootConfig> & {
239
242
  existingKeys: string[];
240
243
  state: "building" | "remodeling" | "ready" | "inspecting";
241
244
  }) => string;
245
+ componentKeyToName?: (key: string) => string;
246
+ onRemodel?: (key: string) => Record<string, any>;
247
+ additionalRootFields?: Record<string, Field>;
242
248
  map?: RenderFunc<{
243
249
  rootProps: BuilderRootConfig;
244
250
  toOptions: {
@@ -265,14 +271,19 @@ type Overrides = {
265
271
  onActions?: OnActionsCallback;
266
272
  name?: Field<string>;
267
273
  categories?: Field<string | undefined>;
268
- onRootsDataChange?: (data: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
274
+ resolveRootData?: (props: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
269
275
  changed: Partial<Record<keyof BuilderRootConfig, boolean> & {
270
276
  id: string;
271
277
  }>;
272
278
  lastData: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | null;
273
279
  metadata: Metadata;
274
280
  trigger: ResolveDataTrigger;
275
- }) => void;
281
+ }, context: {
282
+ editingComponent?: string;
283
+ }) => {
284
+ props: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | Promise<RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>>;
285
+ readOnly: Readonly<Record<string, boolean>> | undefined;
286
+ };
276
287
  };
277
288
 
278
289
  type Status = "building" | "remodeling" | "ready" | "inspecting";
@@ -313,6 +324,7 @@ type AppStore = {
313
324
  hydrateTransforms: () => void;
314
325
  setSoftComponentDefaultVersion: (key: string, version: string) => void;
315
326
  removeSoftComponent: (key: string) => void;
327
+ editingComponent: string | null;
316
328
  editingComponentId: string | null;
317
329
  editableComponentIds: Set<string>;
318
330
  setEditableComponentIds: (ids: Set<string>) => void;
@@ -392,6 +404,7 @@ declare const useRemodel: () => {
392
404
  fields: _measured_puck.Fields;
393
405
  fieldSettings?: Record<string, any>;
394
406
  defaultProps: DefaultComponentProps;
407
+ rootProps?: Record<string, any>;
395
408
  components: SoftSubComponent;
396
409
  slots: {
397
410
  [slot: string]: DefaultComponentProps;