@netlisian/softconfig 0.1.7 → 0.1.9

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.
@@ -153,87 +153,169 @@ type VersionedSoftComponent = {
153
153
  type SoftComponents = Record<string, VersionedSoftComponent>;
154
154
 
155
155
  type CompletedComponentResult = {
156
+ /**
157
+ * The generated unique registry key/identifier of the completed soft component.
158
+ */
156
159
  id: string;
160
+ /**
161
+ * The resolved semantic version string of the completed soft component version.
162
+ */
157
163
  version: string;
164
+ /**
165
+ * The compiled underlying JSON definition representing the soft component structure.
166
+ */
158
167
  softComponent: VersionedSoftComponent["versions"][string];
159
168
  };
160
169
  type BuildersSlice = {
161
170
  /**
162
- * Build a new soft component based on the selected item in history.
171
+ * Initializes the "build" mode to package standard component tree elements into a
172
+ * brand-new, unified, and reusable soft component.
173
+ *
174
+ * @param history - The current Puck workspace history timeline stack. Used to store
175
+ * the undo/redo states so they can be restored if the session is canceled.
176
+ * @param selectedItem - The component instance selected in the workspace that will
177
+ * serve as the seed/root of the building sandbox.
178
+ * @param itemSelector - Placement and index metadata of the selected item in the editor.
179
+ * @param puckDispatch - The Puck API dispatch function to apply state modifications.
180
+ * @param name - Optional initial user-facing label/display name for the new soft component.
181
+ *
182
+ * @throws {Error} If no item is selected or the item selector is null.
163
183
  *
164
- * Steps:
165
- * 1. Data Modifications:
166
- * - Store History
167
- * - Set currently selected item to the root
168
- * 2. Soft Config Modifications:
169
- * - Update root to include: name, fields, fieldSettings, for soft component
170
- * - Update each component config to map the soft fields to component fields
171
- * - Update each component for slot settings (Dropzone enable/disable)
184
+ * Lifecycle & Side Effects:
185
+ * 1. Clones and caches the current core soft configuration and history to the store.
186
+ * 2. Scans the workspace sub-tree to collect all descendent element IDs.
187
+ * 3. Schedules edit visibility highlights to visual-lock edits within the builder boundaries.
188
+ * 4. Transitions the builder workflow state to "building".
172
189
  */
173
190
  build: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
174
191
  index: number;
175
192
  zone?: string;
176
193
  } | null, puckDispatch: PuckApi["dispatch"], name?: string) => void | null;
177
194
  /**
178
- * Remodel the selected soft component by decomposing it and resetting as root.
195
+ * Enters "remodel" mode for an existing soft component, decomposing its compiled structure back
196
+ * into constituent discrete components inside the builder workspace.
179
197
  *
180
- * Steps:
181
- * 1. Data Modifications:
182
- * - Store History
183
- * - Decompose and set selected soft component to root
184
- * 2. Soft Config Modifications:
185
- * - Update root with name, fields, fieldSettings for soft component
186
- * - Update each component config to map soft fields to component fields
187
- * - Update each component for slot settings (Dropzone enable/disable)
188
- * - Remove selected component or dependencies to avoid circular dependencies
198
+ * @param history - The current Puck history list to cache for later restoration.
199
+ * @param selectedItem - The compiled soft component instance selected in the editor.
200
+ * @param itemSelector - Workspace index and droppable zone metadata of the selected component.
201
+ * @param puckDispatch - The Puck API dispatch function.
202
+ * @param refreshPermission - Callback function to refresh access permissions (currently unused).
203
+ *
204
+ * @throws {Error} If the selection parameters are missing, or if the target soft component
205
+ * definition cannot be resolved from the cache.
206
+ *
207
+ * Lifecycle & Side Effects:
208
+ * 1. Fetches the soft component version schema from the Zustand store.
209
+ * 2. Evaluates the reverse dependency graph to identify components depending on this soft component.
210
+ * This locks editing on dependent elements to avoid creating circular dependencies.
211
+ * 3. Explodes the soft component into its constituent raw components in-place within the document data.
212
+ * 4. Updates visual iframe overlays to confine editing to the decomposed sub-tree.
213
+ * 5. Transitions the builder workspace state to "remodeling".
189
214
  */
190
215
  remodel: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
191
216
  index: number;
192
217
  zone?: string;
193
218
  } | null, puckDispatch: PuckApi["dispatch"], refreshPermission: () => void) => void;
194
219
  /**
195
- * Switch to a different version of the soft component being remodeled.
220
+ * Switches the active soft component inside the remodeling session to a different
221
+ * registered semantic version.
222
+ *
223
+ * @param componentName - The unique registry key of the soft component.
224
+ * @param newVersion - The target version to activate.
225
+ * @param currentProps - The current top-level properties configured for this element instance.
226
+ * @param puckDispatch - The Puck API dispatch function.
227
+ *
228
+ * @throws {Error} If the store is not currently in the 'remodeling' state, or if the
229
+ * requested version is missing.
196
230
  *
197
- * Steps:
198
- * 1. Get the soft component for the selected version
199
- * 2. Convert it back to AppState format
200
- * 3. Update the puck data with the new version's content
231
+ * Lifecycle & Side Effects:
232
+ * 1. Resolves the target version's raw layout structure from the store.
233
+ * 2. Re-runs soft component-to-AppState conversions for the target version.
234
+ * 3. Replaces the active remodeling workspace content in-place with the selected version's elements.
201
235
  */
202
236
  setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"]) => void;
203
237
  /**
204
- * Mark the current build/remodel as complete.
238
+ * Finalizes the current build or remodel session, packaging all active workspace components
239
+ * into a compiled, versioned, reusable soft component configuration.
205
240
  *
206
- * Steps:
207
- * 1. Config Modifications:
208
- * - Compose the build settings into soft component
209
- * - Set the component to the config
210
- * - Restore permissions, resolve fields and resolve data of all components
211
- * 2. Data Modifications:
212
- * - Transform the last item of history to replace the source components into composed soft component
213
- * - Strip the build settings fields
214
- * - Apply modified history to puck data.
241
+ * @param appState - The current state of the builder editor workspace containing the composed elements.
242
+ * @param setHistories - Puck API callback to restore the original builder history timeline.
243
+ * @param getItemBySelector - Puck API utility to resolve a workspace item using its selector.
244
+ * @returns An object containing the generated component ID, version, and compiled soft component structure.
245
+ *
246
+ * @throws {Error} If the store is not in building/remodeling state, the root component is unnamed,
247
+ * or if the selected item cannot be resolved in the workspace.
248
+ *
249
+ * Lifecycle & Side Effects:
250
+ * 1. Converts display labels into safe, unique PascalCase configuration registration keys.
251
+ * 2. Packages workspace child items into a JSON-serializable versioned schema.
252
+ * 3. Re-registers the component with the core configuration components registry.
253
+ * 4. Categorizes the component within layout groups.
254
+ * 5. Restores original history timelines and transitions store state to "inspecting".
255
+ * 6. Rebuilds all other registered soft components that depend on this updated component.
215
256
  */
216
257
  complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) => CompletedComponentResult;
258
+ /**
259
+ * Permanently deletes a soft component registration and purges all of its active
260
+ * occurrences/instances from the active workspace document data.
261
+ *
262
+ * @param componentName - The unique registry name of the soft component to delete.
263
+ * @param data - The active workspace document data to scan and clean.
264
+ * @param puckDispatch - The Puck API dispatch function to apply document cleanups.
265
+ *
266
+ * @throws {Error} If the store is not currently in the stable 'ready' state.
267
+ */
217
268
  demolish: (componentName: string, data: AppState["data"], puckDispatch: PuckApi["dispatch"]) => void;
269
+ /**
270
+ * Concludes the inspection workflow, replacing the temporary seed item within the
271
+ * editor workspace document with the newly compiled soft component instance.
272
+ *
273
+ * @param componentName - The final compiled component registry name.
274
+ * @param puckDispatch - The Puck API dispatch function.
275
+ *
276
+ * @throws {Error} If the store is not currently in the 'inspecting' state.
277
+ *
278
+ * Lifecycle & Side Effects:
279
+ * 1. Walk the workspace tree to locate the temporary component being built/remodeled.
280
+ * 2. Replace it with the compiled component type and default versioned props.
281
+ * 3. Flushes layout restriction overlays on the iframe.
282
+ * 4. Resets active builder metadata and transitions state back to "ready".
283
+ */
218
284
  inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]) => void;
219
285
  /**
220
- * Mark the current build/remodel as complete.
286
+ * Discards all modifications made during the current build or remodel session,
287
+ * reverting the editor config, workspace elements, and histories back to their original state.
288
+ *
289
+ * @param setHistories - Puck API callback to restore the original history list.
221
290
  *
222
- * Steps:
223
- * 1. Config Modifications:
224
- * - Restore permissions, resolve fields and resolve data of all components
225
- * 2. Data Modifications:
226
- * - Restore history to puck data.
291
+ * Lifecycle & Side Effects:
292
+ * 1. Transitions store state to "cancelling" to suppress conflicting updates.
293
+ * 2. Re-applies the original workspace config and timeline histories.
294
+ * 3. Clears visual iframe constraints and resets active builder metadata back to normal.
227
295
  */
228
296
  cancel: (setHistories: PuckApi["history"]["setHistories"]) => void;
229
- /** Compose multiple components into a soft component.
230
- * 1. SoftComponent: Get soft fields + default values from the appState.root + sub-component maps + fixedProps
297
+ /**
298
+ * Internal compiler hook that converts builder editor workspace states (root props, children)
299
+ * into a unified `SoftComponent` schema and creates a versioned config.
300
+ *
301
+ * @param appState - The current builder editor state.
302
+ * @param componentName - The unique registry key for the soft component.
303
+ * @param editedItem - The original seed component that initiated the build session.
304
+ * @param displayName - The user-facing display name of the soft component.
305
+ * @param category - Optional layout category placement inside the component toolbox.
306
+ * @returns A tuple containing the `ComponentConfig` and its resolved version string, or undefined if failed.
307
+ *
308
+ * @throws {Error} If the component name is empty or collides with existing configs during a new build.
231
309
  */
232
310
  compose: (appState: AppState, componentName: string, editedItem: ComponentData, displayName: string, category?: string) => [ComponentConfig, string] | undefined;
233
- /** Break down a composed component into its parts.
234
- * 1. Get softComponentProps
235
- * 2. Create a virtual component with all the props from soft-component.
236
- * 3. Replace the softComponent with hardComponent
311
+ /**
312
+ * Utility to break down a composed soft component's props and children back into
313
+ * their discrete, uncompiled constituent elements.
314
+ *
315
+ * @param componentData - The compiled component data instance.
316
+ * @returns An array of unpacked standard child component data objects.
317
+ *
318
+ * @throws {Error} If the input component data lacks type or ID.
237
319
  */
238
320
  decompose: (componentData: ComponentData) => ComponentData[];
239
321
  };
@@ -306,7 +388,7 @@ type RenderFunc<Props extends Record<string, unknown> = {
306
388
  type Overrides = {
307
389
  componentLabelToName?: (label: string, context: Partial<BuilderRootConfig> & {
308
390
  existingKeys: string[];
309
- state: "building" | "remodeling" | "ready" | "inspecting";
391
+ state: Status;
310
392
  }) => string;
311
393
  componentNameToLabel?: (name: string) => string;
312
394
  onRemodel?: (name: string) => Record<string, unknown>;
@@ -346,7 +428,7 @@ type Overrides = {
346
428
  };
347
429
 
348
430
  /** Represents the current editing mode of the Puck editor. */
349
- type Status = "building" | "remodeling" | "ready" | "inspecting";
431
+ type Status = "building" | "remodeling" | "ready" | "cancelling" | "inspecting";
350
432
  type AppStore = {
351
433
  /** The current merged Puck config (hard + soft components). Rebuilt on soft component changes. */
352
434
  softConfig: Config;
@@ -530,7 +612,7 @@ declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: Soft
530
612
  * @param props.useVersioning - Flag to enable or disable versioning (defaults to false).
531
613
  */
532
614
  declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, }: {
533
- children: (softConfig: Config, softComponents: SoftComponents, actionGuard: (action: PuckAction) => void) => ReactNode;
615
+ children: (softConfig: Config) => ReactNode;
534
616
  hardConfig: Config;
535
617
  softComponents?: SoftComponents;
536
618
  customFields?: CustomFields;
@@ -542,6 +624,10 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, custo
542
624
 
543
625
  declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
544
626
  declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
627
+ /**
628
+ * Access the soft config store instance without subscribing to state changes.
629
+ */
630
+ declare const useSoftConfigStore: () => StoreApi<AppStore>;
545
631
 
546
632
  declare const useBuild: (name?: string) => {
547
633
  handleBuild: () => void;
@@ -742,4 +828,4 @@ declare const isArrayMappingPath: (path: string) => boolean;
742
828
  declare const getArrayBasePath: (arrayPath: string) => string | null;
743
829
  declare const getArrayItemSubPath: (arrayPath: string) => string | null;
744
830
 
745
- export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type VersionedSoftComponent, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
831
+ export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type Status, type VersionedSoftComponent, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig, useSoftConfigStore };
@@ -153,87 +153,169 @@ type VersionedSoftComponent = {
153
153
  type SoftComponents = Record<string, VersionedSoftComponent>;
154
154
 
155
155
  type CompletedComponentResult = {
156
+ /**
157
+ * The generated unique registry key/identifier of the completed soft component.
158
+ */
156
159
  id: string;
160
+ /**
161
+ * The resolved semantic version string of the completed soft component version.
162
+ */
157
163
  version: string;
164
+ /**
165
+ * The compiled underlying JSON definition representing the soft component structure.
166
+ */
158
167
  softComponent: VersionedSoftComponent["versions"][string];
159
168
  };
160
169
  type BuildersSlice = {
161
170
  /**
162
- * Build a new soft component based on the selected item in history.
171
+ * Initializes the "build" mode to package standard component tree elements into a
172
+ * brand-new, unified, and reusable soft component.
173
+ *
174
+ * @param history - The current Puck workspace history timeline stack. Used to store
175
+ * the undo/redo states so they can be restored if the session is canceled.
176
+ * @param selectedItem - The component instance selected in the workspace that will
177
+ * serve as the seed/root of the building sandbox.
178
+ * @param itemSelector - Placement and index metadata of the selected item in the editor.
179
+ * @param puckDispatch - The Puck API dispatch function to apply state modifications.
180
+ * @param name - Optional initial user-facing label/display name for the new soft component.
181
+ *
182
+ * @throws {Error} If no item is selected or the item selector is null.
163
183
  *
164
- * Steps:
165
- * 1. Data Modifications:
166
- * - Store History
167
- * - Set currently selected item to the root
168
- * 2. Soft Config Modifications:
169
- * - Update root to include: name, fields, fieldSettings, for soft component
170
- * - Update each component config to map the soft fields to component fields
171
- * - Update each component for slot settings (Dropzone enable/disable)
184
+ * Lifecycle & Side Effects:
185
+ * 1. Clones and caches the current core soft configuration and history to the store.
186
+ * 2. Scans the workspace sub-tree to collect all descendent element IDs.
187
+ * 3. Schedules edit visibility highlights to visual-lock edits within the builder boundaries.
188
+ * 4. Transitions the builder workflow state to "building".
172
189
  */
173
190
  build: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
174
191
  index: number;
175
192
  zone?: string;
176
193
  } | null, puckDispatch: PuckApi["dispatch"], name?: string) => void | null;
177
194
  /**
178
- * Remodel the selected soft component by decomposing it and resetting as root.
195
+ * Enters "remodel" mode for an existing soft component, decomposing its compiled structure back
196
+ * into constituent discrete components inside the builder workspace.
179
197
  *
180
- * Steps:
181
- * 1. Data Modifications:
182
- * - Store History
183
- * - Decompose and set selected soft component to root
184
- * 2. Soft Config Modifications:
185
- * - Update root with name, fields, fieldSettings for soft component
186
- * - Update each component config to map soft fields to component fields
187
- * - Update each component for slot settings (Dropzone enable/disable)
188
- * - Remove selected component or dependencies to avoid circular dependencies
198
+ * @param history - The current Puck history list to cache for later restoration.
199
+ * @param selectedItem - The compiled soft component instance selected in the editor.
200
+ * @param itemSelector - Workspace index and droppable zone metadata of the selected component.
201
+ * @param puckDispatch - The Puck API dispatch function.
202
+ * @param refreshPermission - Callback function to refresh access permissions (currently unused).
203
+ *
204
+ * @throws {Error} If the selection parameters are missing, or if the target soft component
205
+ * definition cannot be resolved from the cache.
206
+ *
207
+ * Lifecycle & Side Effects:
208
+ * 1. Fetches the soft component version schema from the Zustand store.
209
+ * 2. Evaluates the reverse dependency graph to identify components depending on this soft component.
210
+ * This locks editing on dependent elements to avoid creating circular dependencies.
211
+ * 3. Explodes the soft component into its constituent raw components in-place within the document data.
212
+ * 4. Updates visual iframe overlays to confine editing to the decomposed sub-tree.
213
+ * 5. Transitions the builder workspace state to "remodeling".
189
214
  */
190
215
  remodel: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
191
216
  index: number;
192
217
  zone?: string;
193
218
  } | null, puckDispatch: PuckApi["dispatch"], refreshPermission: () => void) => void;
194
219
  /**
195
- * Switch to a different version of the soft component being remodeled.
220
+ * Switches the active soft component inside the remodeling session to a different
221
+ * registered semantic version.
222
+ *
223
+ * @param componentName - The unique registry key of the soft component.
224
+ * @param newVersion - The target version to activate.
225
+ * @param currentProps - The current top-level properties configured for this element instance.
226
+ * @param puckDispatch - The Puck API dispatch function.
227
+ *
228
+ * @throws {Error} If the store is not currently in the 'remodeling' state, or if the
229
+ * requested version is missing.
196
230
  *
197
- * Steps:
198
- * 1. Get the soft component for the selected version
199
- * 2. Convert it back to AppState format
200
- * 3. Update the puck data with the new version's content
231
+ * Lifecycle & Side Effects:
232
+ * 1. Resolves the target version's raw layout structure from the store.
233
+ * 2. Re-runs soft component-to-AppState conversions for the target version.
234
+ * 3. Replaces the active remodeling workspace content in-place with the selected version's elements.
201
235
  */
202
236
  setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"]) => void;
203
237
  /**
204
- * Mark the current build/remodel as complete.
238
+ * Finalizes the current build or remodel session, packaging all active workspace components
239
+ * into a compiled, versioned, reusable soft component configuration.
205
240
  *
206
- * Steps:
207
- * 1. Config Modifications:
208
- * - Compose the build settings into soft component
209
- * - Set the component to the config
210
- * - Restore permissions, resolve fields and resolve data of all components
211
- * 2. Data Modifications:
212
- * - Transform the last item of history to replace the source components into composed soft component
213
- * - Strip the build settings fields
214
- * - Apply modified history to puck data.
241
+ * @param appState - The current state of the builder editor workspace containing the composed elements.
242
+ * @param setHistories - Puck API callback to restore the original builder history timeline.
243
+ * @param getItemBySelector - Puck API utility to resolve a workspace item using its selector.
244
+ * @returns An object containing the generated component ID, version, and compiled soft component structure.
245
+ *
246
+ * @throws {Error} If the store is not in building/remodeling state, the root component is unnamed,
247
+ * or if the selected item cannot be resolved in the workspace.
248
+ *
249
+ * Lifecycle & Side Effects:
250
+ * 1. Converts display labels into safe, unique PascalCase configuration registration keys.
251
+ * 2. Packages workspace child items into a JSON-serializable versioned schema.
252
+ * 3. Re-registers the component with the core configuration components registry.
253
+ * 4. Categorizes the component within layout groups.
254
+ * 5. Restores original history timelines and transitions store state to "inspecting".
255
+ * 6. Rebuilds all other registered soft components that depend on this updated component.
215
256
  */
216
257
  complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) => CompletedComponentResult;
258
+ /**
259
+ * Permanently deletes a soft component registration and purges all of its active
260
+ * occurrences/instances from the active workspace document data.
261
+ *
262
+ * @param componentName - The unique registry name of the soft component to delete.
263
+ * @param data - The active workspace document data to scan and clean.
264
+ * @param puckDispatch - The Puck API dispatch function to apply document cleanups.
265
+ *
266
+ * @throws {Error} If the store is not currently in the stable 'ready' state.
267
+ */
217
268
  demolish: (componentName: string, data: AppState["data"], puckDispatch: PuckApi["dispatch"]) => void;
269
+ /**
270
+ * Concludes the inspection workflow, replacing the temporary seed item within the
271
+ * editor workspace document with the newly compiled soft component instance.
272
+ *
273
+ * @param componentName - The final compiled component registry name.
274
+ * @param puckDispatch - The Puck API dispatch function.
275
+ *
276
+ * @throws {Error} If the store is not currently in the 'inspecting' state.
277
+ *
278
+ * Lifecycle & Side Effects:
279
+ * 1. Walk the workspace tree to locate the temporary component being built/remodeled.
280
+ * 2. Replace it with the compiled component type and default versioned props.
281
+ * 3. Flushes layout restriction overlays on the iframe.
282
+ * 4. Resets active builder metadata and transitions state back to "ready".
283
+ */
218
284
  inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]) => void;
219
285
  /**
220
- * Mark the current build/remodel as complete.
286
+ * Discards all modifications made during the current build or remodel session,
287
+ * reverting the editor config, workspace elements, and histories back to their original state.
288
+ *
289
+ * @param setHistories - Puck API callback to restore the original history list.
221
290
  *
222
- * Steps:
223
- * 1. Config Modifications:
224
- * - Restore permissions, resolve fields and resolve data of all components
225
- * 2. Data Modifications:
226
- * - Restore history to puck data.
291
+ * Lifecycle & Side Effects:
292
+ * 1. Transitions store state to "cancelling" to suppress conflicting updates.
293
+ * 2. Re-applies the original workspace config and timeline histories.
294
+ * 3. Clears visual iframe constraints and resets active builder metadata back to normal.
227
295
  */
228
296
  cancel: (setHistories: PuckApi["history"]["setHistories"]) => void;
229
- /** Compose multiple components into a soft component.
230
- * 1. SoftComponent: Get soft fields + default values from the appState.root + sub-component maps + fixedProps
297
+ /**
298
+ * Internal compiler hook that converts builder editor workspace states (root props, children)
299
+ * into a unified `SoftComponent` schema and creates a versioned config.
300
+ *
301
+ * @param appState - The current builder editor state.
302
+ * @param componentName - The unique registry key for the soft component.
303
+ * @param editedItem - The original seed component that initiated the build session.
304
+ * @param displayName - The user-facing display name of the soft component.
305
+ * @param category - Optional layout category placement inside the component toolbox.
306
+ * @returns A tuple containing the `ComponentConfig` and its resolved version string, or undefined if failed.
307
+ *
308
+ * @throws {Error} If the component name is empty or collides with existing configs during a new build.
231
309
  */
232
310
  compose: (appState: AppState, componentName: string, editedItem: ComponentData, displayName: string, category?: string) => [ComponentConfig, string] | undefined;
233
- /** Break down a composed component into its parts.
234
- * 1. Get softComponentProps
235
- * 2. Create a virtual component with all the props from soft-component.
236
- * 3. Replace the softComponent with hardComponent
311
+ /**
312
+ * Utility to break down a composed soft component's props and children back into
313
+ * their discrete, uncompiled constituent elements.
314
+ *
315
+ * @param componentData - The compiled component data instance.
316
+ * @returns An array of unpacked standard child component data objects.
317
+ *
318
+ * @throws {Error} If the input component data lacks type or ID.
237
319
  */
238
320
  decompose: (componentData: ComponentData) => ComponentData[];
239
321
  };
@@ -306,7 +388,7 @@ type RenderFunc<Props extends Record<string, unknown> = {
306
388
  type Overrides = {
307
389
  componentLabelToName?: (label: string, context: Partial<BuilderRootConfig> & {
308
390
  existingKeys: string[];
309
- state: "building" | "remodeling" | "ready" | "inspecting";
391
+ state: Status;
310
392
  }) => string;
311
393
  componentNameToLabel?: (name: string) => string;
312
394
  onRemodel?: (name: string) => Record<string, unknown>;
@@ -346,7 +428,7 @@ type Overrides = {
346
428
  };
347
429
 
348
430
  /** Represents the current editing mode of the Puck editor. */
349
- type Status = "building" | "remodeling" | "ready" | "inspecting";
431
+ type Status = "building" | "remodeling" | "ready" | "cancelling" | "inspecting";
350
432
  type AppStore = {
351
433
  /** The current merged Puck config (hard + soft components). Rebuilt on soft component changes. */
352
434
  softConfig: Config;
@@ -530,7 +612,7 @@ declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: Soft
530
612
  * @param props.useVersioning - Flag to enable or disable versioning (defaults to false).
531
613
  */
532
614
  declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, }: {
533
- children: (softConfig: Config, softComponents: SoftComponents, actionGuard: (action: PuckAction) => void) => ReactNode;
615
+ children: (softConfig: Config) => ReactNode;
534
616
  hardConfig: Config;
535
617
  softComponents?: SoftComponents;
536
618
  customFields?: CustomFields;
@@ -542,6 +624,10 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, custo
542
624
 
543
625
  declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
544
626
  declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
627
+ /**
628
+ * Access the soft config store instance without subscribing to state changes.
629
+ */
630
+ declare const useSoftConfigStore: () => StoreApi<AppStore>;
545
631
 
546
632
  declare const useBuild: (name?: string) => {
547
633
  handleBuild: () => void;
@@ -742,4 +828,4 @@ declare const isArrayMappingPath: (path: string) => boolean;
742
828
  declare const getArrayBasePath: (arrayPath: string) => string | null;
743
829
  declare const getArrayItemSubPath: (arrayPath: string) => string | null;
744
830
 
745
- export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type VersionedSoftComponent, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
831
+ export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type Status, type VersionedSoftComponent, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig, useSoftConfigStore };