@netlisian/softconfig 0.1.9 → 0.2.0
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/puck/index.d.mts +55 -38
- package/dist/puck/index.d.ts +55 -38
- package/dist/puck/index.js +1080 -1480
- package/dist/puck/index.mjs +1034 -1436
- package/package.json +8 -5
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as _puckeditor_core from '@puckeditor/core';
|
|
2
|
+
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@puckeditor/core';
|
|
1
3
|
import * as zustand from 'zustand';
|
|
2
4
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import * as _measured_puck from '@measured/puck';
|
|
4
|
-
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data, Overrides as Overrides$1 } from '@measured/puck';
|
|
5
5
|
import * as React$1 from 'react';
|
|
6
6
|
import React__default, { ReactNode, ReactElement } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -215,7 +215,7 @@ type BuildersSlice = {
|
|
|
215
215
|
remodel: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
|
|
216
216
|
index: number;
|
|
217
217
|
zone?: string;
|
|
218
|
-
} | null, puckDispatch: PuckApi["dispatch"],
|
|
218
|
+
} | null, puckDispatch: PuckApi["dispatch"], refreshPermissions: () => void) => void;
|
|
219
219
|
/**
|
|
220
220
|
* Switches the active soft component inside the remodeling session to a different
|
|
221
221
|
* registered semantic version.
|
|
@@ -233,7 +233,7 @@ type BuildersSlice = {
|
|
|
233
233
|
* 2. Re-runs soft component-to-AppState conversions for the target version.
|
|
234
234
|
* 3. Replaces the active remodeling workspace content in-place with the selected version's elements.
|
|
235
235
|
*/
|
|
236
|
-
setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"]) => void;
|
|
236
|
+
setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"], getItemBySelector: PuckApi["getItemBySelector"], getSelectorForId: PuckApi["getSelectorForId"]) => void;
|
|
237
237
|
/**
|
|
238
238
|
* Finalizes the current build or remodel session, packaging all active workspace components
|
|
239
239
|
* into a compiled, versioned, reusable soft component configuration.
|
|
@@ -281,7 +281,10 @@ type BuildersSlice = {
|
|
|
281
281
|
* 3. Flushes layout restriction overlays on the iframe.
|
|
282
282
|
* 4. Resets active builder metadata and transitions state back to "ready".
|
|
283
283
|
*/
|
|
284
|
-
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]
|
|
284
|
+
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"], selectedItemSelector: {
|
|
285
|
+
index: number;
|
|
286
|
+
zone?: string;
|
|
287
|
+
} | null) => void;
|
|
285
288
|
/**
|
|
286
289
|
* Discards all modifications made during the current build or remodel session,
|
|
287
290
|
* reverting the editor config, workspace elements, and histories back to their original state.
|
|
@@ -293,7 +296,10 @@ type BuildersSlice = {
|
|
|
293
296
|
* 2. Re-applies the original workspace config and timeline histories.
|
|
294
297
|
* 3. Clears visual iframe constraints and resets active builder metadata back to normal.
|
|
295
298
|
*/
|
|
296
|
-
cancel: (setHistories: PuckApi["history"]["setHistories"]
|
|
299
|
+
cancel: (setHistories: PuckApi["history"]["setHistories"], puckDispatch: PuckApi["dispatch"], selectedItemSelector: {
|
|
300
|
+
index: number;
|
|
301
|
+
zone?: string;
|
|
302
|
+
} | null) => void;
|
|
297
303
|
/**
|
|
298
304
|
* Internal compiler hook that converts builder editor workspace states (root props, children)
|
|
299
305
|
* into a unified `SoftComponent` schema and creates a versioned config.
|
|
@@ -317,7 +323,7 @@ type BuildersSlice = {
|
|
|
317
323
|
*
|
|
318
324
|
* @throws {Error} If the input component data lacks type or ID.
|
|
319
325
|
*/
|
|
320
|
-
decompose: (componentData: ComponentData) => ComponentData[];
|
|
326
|
+
decompose: (componentData: ComponentData, keepMapField?: boolean) => ComponentData[];
|
|
321
327
|
};
|
|
322
328
|
|
|
323
329
|
type ActionEventPayload = {
|
|
@@ -421,14 +427,17 @@ type Overrides = {
|
|
|
421
427
|
}, context: {
|
|
422
428
|
editingComponent?: string;
|
|
423
429
|
}) => {
|
|
424
|
-
props
|
|
425
|
-
readOnly
|
|
426
|
-
}
|
|
430
|
+
props?: Partial<AsFieldProps<WithChildren<BuilderRootConfig>>>;
|
|
431
|
+
readOnly?: Readonly<Record<string, boolean>>;
|
|
432
|
+
} | Promise<{
|
|
433
|
+
props?: Partial<AsFieldProps<WithChildren<BuilderRootConfig>>>;
|
|
434
|
+
readOnly?: Readonly<Record<string, boolean>>;
|
|
435
|
+
}>;
|
|
427
436
|
mapComponentConfig?: (componentName: string, defaultConfig: ComponentConfig, rootProps: BuilderRootConfig & RootData) => ComponentConfig;
|
|
428
437
|
};
|
|
429
438
|
|
|
430
439
|
/** Represents the current editing mode of the Puck editor. */
|
|
431
|
-
type Status = "building" | "remodeling" | "ready" | "cancelling" | "inspecting";
|
|
440
|
+
type Status = "building" | "remodeling" | "ready" | "cancelling" | "assessing" | "inspecting";
|
|
432
441
|
type AppStore = {
|
|
433
442
|
/** The current merged Puck config (hard + soft components). Rebuilt on soft component changes. */
|
|
434
443
|
softConfig: Config;
|
|
@@ -582,9 +591,21 @@ type AppStore = {
|
|
|
582
591
|
* Always returns true when `state === "ready"` (no restrictions apply).
|
|
583
592
|
*/
|
|
584
593
|
validateAction: (action: PuckAction, previousAction?: PuckAction) => boolean;
|
|
594
|
+
/** Names of the content areas where soft components can be built. */
|
|
595
|
+
contentAreaNames?: string[];
|
|
596
|
+
/** Setter for the content area names */
|
|
597
|
+
setContentAreaNames: (names?: string[]) => void;
|
|
598
|
+
/** Access to the puck dispatch function, stored during edits. */
|
|
599
|
+
puckDispatch?: ((action: PuckAction) => void) | null;
|
|
600
|
+
/** Setter for the puck dispatch function */
|
|
601
|
+
setPuckDispatch: (dispatch: ((action: PuckAction) => void) | null) => void;
|
|
602
|
+
/**
|
|
603
|
+
* Optional root action handler injected via the store creation.
|
|
604
|
+
*/
|
|
605
|
+
rootActionHandler?: OnAction;
|
|
585
606
|
};
|
|
586
607
|
type AppStoreApi = StoreApi<AppStore>;
|
|
587
|
-
declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: SoftComponents, overrides?: Overrides, onActions?: OnActionsCallback, showVersionFields?: boolean, customFields?: CustomFields) => zustand.UseBoundStore<Omit<StoreApi<AppStore>, "subscribe"> & {
|
|
608
|
+
declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: SoftComponents, overrides?: Overrides, onActions?: OnActionsCallback, showVersionFields?: boolean, customFields?: CustomFields, contentAreaNames?: string[]) => zustand.UseBoundStore<Omit<StoreApi<AppStore>, "subscribe"> & {
|
|
588
609
|
subscribe: {
|
|
589
610
|
(listener: (selectedState: AppStore, previousSelectedState: AppStore) => void): () => void;
|
|
590
611
|
<U>(selector: (state: AppStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
@@ -610,8 +631,9 @@ declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: Soft
|
|
|
610
631
|
* @param props.value - Optional external store API.
|
|
611
632
|
* @param props.onActions - Callback triggered on Puck actions.
|
|
612
633
|
* @param props.useVersioning - Flag to enable or disable versioning (defaults to false).
|
|
634
|
+
* @param props.contentAreaNames - Optional list of data paths mapping where soft components can be built or remodeled.
|
|
613
635
|
*/
|
|
614
|
-
declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, }: {
|
|
636
|
+
declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, contentAreaNames, }: {
|
|
615
637
|
children: (softConfig: Config) => ReactNode;
|
|
616
638
|
hardConfig: Config;
|
|
617
639
|
softComponents?: SoftComponents;
|
|
@@ -620,6 +642,7 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, custo
|
|
|
620
642
|
value?: StoreApi<AppStore>;
|
|
621
643
|
onActions?: OnActionsCallback;
|
|
622
644
|
useVersioning?: boolean;
|
|
645
|
+
contentAreaNames?: string[];
|
|
623
646
|
}) => react_jsx_runtime.JSX.Element;
|
|
624
647
|
|
|
625
648
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
@@ -639,7 +662,7 @@ declare const useRemodel: () => {
|
|
|
639
662
|
id: string;
|
|
640
663
|
version: string;
|
|
641
664
|
softComponent: {
|
|
642
|
-
fields:
|
|
665
|
+
fields: _puckeditor_core.Fields;
|
|
643
666
|
fieldSettings?: SoftFieldSettings;
|
|
644
667
|
defaultProps: DefaultComponentProps;
|
|
645
668
|
rootProps?: Record<string, unknown>;
|
|
@@ -707,12 +730,6 @@ declare const DrawerItem: (props: {
|
|
|
707
730
|
label?: string;
|
|
708
731
|
children: React.ReactNode;
|
|
709
732
|
}) => React.ReactElement;
|
|
710
|
-
/** @deprecated Use DrawerItem instead */
|
|
711
|
-
declare const ComponentItem: (props: {
|
|
712
|
-
name: string;
|
|
713
|
-
label?: string;
|
|
714
|
-
children: React.ReactNode;
|
|
715
|
-
}) => React.ReactElement;
|
|
716
733
|
|
|
717
734
|
/**
|
|
718
735
|
* Drawer — custom drawer override for the Puck editor.
|
|
@@ -795,22 +812,7 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
795
812
|
*/
|
|
796
813
|
declare function filterToOptionsForFrom(fromPath: string | undefined, toOptions: MappingOption[]): MappingOption[];
|
|
797
814
|
|
|
798
|
-
|
|
799
|
-
* Shared helper: evaluates `_map` entries and applies mapped values to component props.
|
|
800
|
-
*
|
|
801
|
-
* Used by both the live builder effect (root-config.tsx) and the runtime
|
|
802
|
-
* resolver (resolve-soft-component-data.ts) so the logic stays in one place.
|
|
803
|
-
*
|
|
804
|
-
* Array construction order (for array targets like `items[].imageUrl`):
|
|
805
|
-
* 1. Start from `unmappedArrayItemDefaultValues` on the map entry (initially populated
|
|
806
|
-
* from the component's `defaultItemProps`). These are the single source of
|
|
807
|
-
* truth for the item "template".
|
|
808
|
-
* 2. Overlay the mapped value for each array index.
|
|
809
|
-
* The result is a freshly-constructed array whose length equals the mapped
|
|
810
|
-
* source array and whose unmapped props come from the defaults above.
|
|
811
|
-
*/
|
|
812
|
-
|
|
813
|
-
declare const resolveValueByPath: (source: any, path: string) => any;
|
|
815
|
+
declare const resolveValueByPath: (source: unknown, path: string) => unknown;
|
|
814
816
|
/**
|
|
815
817
|
* Evaluate every `_map` entry and apply the results to `props`.
|
|
816
818
|
*
|
|
@@ -822,10 +824,25 @@ declare const resolveValueByPath: (source: any, path: string) => any;
|
|
|
822
824
|
* - `"propsFirst"` (runtime): prefer live prop values, fall back
|
|
823
825
|
* to fieldSettings `defaultValue`.
|
|
824
826
|
*/
|
|
825
|
-
declare function applyMapping(props:
|
|
827
|
+
declare function applyMapping(props: DefaultComponentProps, fieldSettings: DefaultComponentProps, map: MapEntry[], resolveInput?: "fieldSettings" | "propsFirst", options?: ApplyMappingOptions): ApplyMappingResult;
|
|
826
828
|
|
|
827
829
|
declare const isArrayMappingPath: (path: string) => boolean;
|
|
828
830
|
declare const getArrayBasePath: (arrayPath: string) => string | null;
|
|
829
831
|
declare const getArrayItemSubPath: (arrayPath: string) => string | null;
|
|
830
832
|
|
|
831
|
-
|
|
833
|
+
type ZoneType = "root" | "dropzone" | "slot";
|
|
834
|
+
type PuckNodeData = {
|
|
835
|
+
data: ComponentData;
|
|
836
|
+
flatData: ComponentData;
|
|
837
|
+
parentId: string | null;
|
|
838
|
+
zone: string;
|
|
839
|
+
path: string[];
|
|
840
|
+
};
|
|
841
|
+
type PuckZoneData = {
|
|
842
|
+
contentIds: string[];
|
|
843
|
+
type: ZoneType;
|
|
844
|
+
};
|
|
845
|
+
type NodeIndex = Record<string, PuckNodeData>;
|
|
846
|
+
type ZoneIndex = Record<string, PuckZoneData>;
|
|
847
|
+
|
|
848
|
+
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type NodeIndex, type OnActionsCallback, type Overrides, type PuckNodeData, type PuckZoneData, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type Status, type VersionedSoftComponent, type ZoneIndex, type ZoneType, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig, useSoftConfigStore };
|
package/dist/puck/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as _puckeditor_core from '@puckeditor/core';
|
|
2
|
+
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, OnAction, Data, Overrides as Overrides$1 } from '@puckeditor/core';
|
|
1
3
|
import * as zustand from 'zustand';
|
|
2
4
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import * as _measured_puck from '@measured/puck';
|
|
4
|
-
import { Field, Fields, Config, DefaultComponentProps, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data, Overrides as Overrides$1 } from '@measured/puck';
|
|
5
5
|
import * as React$1 from 'react';
|
|
6
6
|
import React__default, { ReactNode, ReactElement } from 'react';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -215,7 +215,7 @@ type BuildersSlice = {
|
|
|
215
215
|
remodel: (history: History<AppState>[], selectedItem: PuckApi["selectedItem"], itemSelector: {
|
|
216
216
|
index: number;
|
|
217
217
|
zone?: string;
|
|
218
|
-
} | null, puckDispatch: PuckApi["dispatch"],
|
|
218
|
+
} | null, puckDispatch: PuckApi["dispatch"], refreshPermissions: () => void) => void;
|
|
219
219
|
/**
|
|
220
220
|
* Switches the active soft component inside the remodeling session to a different
|
|
221
221
|
* registered semantic version.
|
|
@@ -233,7 +233,7 @@ type BuildersSlice = {
|
|
|
233
233
|
* 2. Re-runs soft component-to-AppState conversions for the target version.
|
|
234
234
|
* 3. Replaces the active remodeling workspace content in-place with the selected version's elements.
|
|
235
235
|
*/
|
|
236
|
-
setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"]) => void;
|
|
236
|
+
setVersion: (componentName: string, newVersion: string, currentProps: Record<string, any>, puckDispatch: PuckApi["dispatch"], getItemBySelector: PuckApi["getItemBySelector"], getSelectorForId: PuckApi["getSelectorForId"]) => void;
|
|
237
237
|
/**
|
|
238
238
|
* Finalizes the current build or remodel session, packaging all active workspace components
|
|
239
239
|
* into a compiled, versioned, reusable soft component configuration.
|
|
@@ -281,7 +281,10 @@ type BuildersSlice = {
|
|
|
281
281
|
* 3. Flushes layout restriction overlays on the iframe.
|
|
282
282
|
* 4. Resets active builder metadata and transitions state back to "ready".
|
|
283
283
|
*/
|
|
284
|
-
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]
|
|
284
|
+
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"], selectedItemSelector: {
|
|
285
|
+
index: number;
|
|
286
|
+
zone?: string;
|
|
287
|
+
} | null) => void;
|
|
285
288
|
/**
|
|
286
289
|
* Discards all modifications made during the current build or remodel session,
|
|
287
290
|
* reverting the editor config, workspace elements, and histories back to their original state.
|
|
@@ -293,7 +296,10 @@ type BuildersSlice = {
|
|
|
293
296
|
* 2. Re-applies the original workspace config and timeline histories.
|
|
294
297
|
* 3. Clears visual iframe constraints and resets active builder metadata back to normal.
|
|
295
298
|
*/
|
|
296
|
-
cancel: (setHistories: PuckApi["history"]["setHistories"]
|
|
299
|
+
cancel: (setHistories: PuckApi["history"]["setHistories"], puckDispatch: PuckApi["dispatch"], selectedItemSelector: {
|
|
300
|
+
index: number;
|
|
301
|
+
zone?: string;
|
|
302
|
+
} | null) => void;
|
|
297
303
|
/**
|
|
298
304
|
* Internal compiler hook that converts builder editor workspace states (root props, children)
|
|
299
305
|
* into a unified `SoftComponent` schema and creates a versioned config.
|
|
@@ -317,7 +323,7 @@ type BuildersSlice = {
|
|
|
317
323
|
*
|
|
318
324
|
* @throws {Error} If the input component data lacks type or ID.
|
|
319
325
|
*/
|
|
320
|
-
decompose: (componentData: ComponentData) => ComponentData[];
|
|
326
|
+
decompose: (componentData: ComponentData, keepMapField?: boolean) => ComponentData[];
|
|
321
327
|
};
|
|
322
328
|
|
|
323
329
|
type ActionEventPayload = {
|
|
@@ -421,14 +427,17 @@ type Overrides = {
|
|
|
421
427
|
}, context: {
|
|
422
428
|
editingComponent?: string;
|
|
423
429
|
}) => {
|
|
424
|
-
props
|
|
425
|
-
readOnly
|
|
426
|
-
}
|
|
430
|
+
props?: Partial<AsFieldProps<WithChildren<BuilderRootConfig>>>;
|
|
431
|
+
readOnly?: Readonly<Record<string, boolean>>;
|
|
432
|
+
} | Promise<{
|
|
433
|
+
props?: Partial<AsFieldProps<WithChildren<BuilderRootConfig>>>;
|
|
434
|
+
readOnly?: Readonly<Record<string, boolean>>;
|
|
435
|
+
}>;
|
|
427
436
|
mapComponentConfig?: (componentName: string, defaultConfig: ComponentConfig, rootProps: BuilderRootConfig & RootData) => ComponentConfig;
|
|
428
437
|
};
|
|
429
438
|
|
|
430
439
|
/** Represents the current editing mode of the Puck editor. */
|
|
431
|
-
type Status = "building" | "remodeling" | "ready" | "cancelling" | "inspecting";
|
|
440
|
+
type Status = "building" | "remodeling" | "ready" | "cancelling" | "assessing" | "inspecting";
|
|
432
441
|
type AppStore = {
|
|
433
442
|
/** The current merged Puck config (hard + soft components). Rebuilt on soft component changes. */
|
|
434
443
|
softConfig: Config;
|
|
@@ -582,9 +591,21 @@ type AppStore = {
|
|
|
582
591
|
* Always returns true when `state === "ready"` (no restrictions apply).
|
|
583
592
|
*/
|
|
584
593
|
validateAction: (action: PuckAction, previousAction?: PuckAction) => boolean;
|
|
594
|
+
/** Names of the content areas where soft components can be built. */
|
|
595
|
+
contentAreaNames?: string[];
|
|
596
|
+
/** Setter for the content area names */
|
|
597
|
+
setContentAreaNames: (names?: string[]) => void;
|
|
598
|
+
/** Access to the puck dispatch function, stored during edits. */
|
|
599
|
+
puckDispatch?: ((action: PuckAction) => void) | null;
|
|
600
|
+
/** Setter for the puck dispatch function */
|
|
601
|
+
setPuckDispatch: (dispatch: ((action: PuckAction) => void) | null) => void;
|
|
602
|
+
/**
|
|
603
|
+
* Optional root action handler injected via the store creation.
|
|
604
|
+
*/
|
|
605
|
+
rootActionHandler?: OnAction;
|
|
585
606
|
};
|
|
586
607
|
type AppStoreApi = StoreApi<AppStore>;
|
|
587
|
-
declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: SoftComponents, overrides?: Overrides, onActions?: OnActionsCallback, showVersionFields?: boolean, customFields?: CustomFields) => zustand.UseBoundStore<Omit<StoreApi<AppStore>, "subscribe"> & {
|
|
608
|
+
declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: SoftComponents, overrides?: Overrides, onActions?: OnActionsCallback, showVersionFields?: boolean, customFields?: CustomFields, contentAreaNames?: string[]) => zustand.UseBoundStore<Omit<StoreApi<AppStore>, "subscribe"> & {
|
|
588
609
|
subscribe: {
|
|
589
610
|
(listener: (selectedState: AppStore, previousSelectedState: AppStore) => void): () => void;
|
|
590
611
|
<U>(selector: (state: AppStore) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
@@ -610,8 +631,9 @@ declare const createSoftConfigStore: (hardConfig?: Config, softComponents?: Soft
|
|
|
610
631
|
* @param props.value - Optional external store API.
|
|
611
632
|
* @param props.onActions - Callback triggered on Puck actions.
|
|
612
633
|
* @param props.useVersioning - Flag to enable or disable versioning (defaults to false).
|
|
634
|
+
* @param props.contentAreaNames - Optional list of data paths mapping where soft components can be built or remodeled.
|
|
613
635
|
*/
|
|
614
|
-
declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, }: {
|
|
636
|
+
declare const SoftConfigProvider: ({ children, hardConfig, softComponents, customFields, overrides, value, onActions, useVersioning, contentAreaNames, }: {
|
|
615
637
|
children: (softConfig: Config) => ReactNode;
|
|
616
638
|
hardConfig: Config;
|
|
617
639
|
softComponents?: SoftComponents;
|
|
@@ -620,6 +642,7 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, custo
|
|
|
620
642
|
value?: StoreApi<AppStore>;
|
|
621
643
|
onActions?: OnActionsCallback;
|
|
622
644
|
useVersioning?: boolean;
|
|
645
|
+
contentAreaNames?: string[];
|
|
623
646
|
}) => react_jsx_runtime.JSX.Element;
|
|
624
647
|
|
|
625
648
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
@@ -639,7 +662,7 @@ declare const useRemodel: () => {
|
|
|
639
662
|
id: string;
|
|
640
663
|
version: string;
|
|
641
664
|
softComponent: {
|
|
642
|
-
fields:
|
|
665
|
+
fields: _puckeditor_core.Fields;
|
|
643
666
|
fieldSettings?: SoftFieldSettings;
|
|
644
667
|
defaultProps: DefaultComponentProps;
|
|
645
668
|
rootProps?: Record<string, unknown>;
|
|
@@ -707,12 +730,6 @@ declare const DrawerItem: (props: {
|
|
|
707
730
|
label?: string;
|
|
708
731
|
children: React.ReactNode;
|
|
709
732
|
}) => React.ReactElement;
|
|
710
|
-
/** @deprecated Use DrawerItem instead */
|
|
711
|
-
declare const ComponentItem: (props: {
|
|
712
|
-
name: string;
|
|
713
|
-
label?: string;
|
|
714
|
-
children: React.ReactNode;
|
|
715
|
-
}) => React.ReactElement;
|
|
716
733
|
|
|
717
734
|
/**
|
|
718
735
|
* Drawer — custom drawer override for the Puck editor.
|
|
@@ -795,22 +812,7 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
795
812
|
*/
|
|
796
813
|
declare function filterToOptionsForFrom(fromPath: string | undefined, toOptions: MappingOption[]): MappingOption[];
|
|
797
814
|
|
|
798
|
-
|
|
799
|
-
* Shared helper: evaluates `_map` entries and applies mapped values to component props.
|
|
800
|
-
*
|
|
801
|
-
* Used by both the live builder effect (root-config.tsx) and the runtime
|
|
802
|
-
* resolver (resolve-soft-component-data.ts) so the logic stays in one place.
|
|
803
|
-
*
|
|
804
|
-
* Array construction order (for array targets like `items[].imageUrl`):
|
|
805
|
-
* 1. Start from `unmappedArrayItemDefaultValues` on the map entry (initially populated
|
|
806
|
-
* from the component's `defaultItemProps`). These are the single source of
|
|
807
|
-
* truth for the item "template".
|
|
808
|
-
* 2. Overlay the mapped value for each array index.
|
|
809
|
-
* The result is a freshly-constructed array whose length equals the mapped
|
|
810
|
-
* source array and whose unmapped props come from the defaults above.
|
|
811
|
-
*/
|
|
812
|
-
|
|
813
|
-
declare const resolveValueByPath: (source: any, path: string) => any;
|
|
815
|
+
declare const resolveValueByPath: (source: unknown, path: string) => unknown;
|
|
814
816
|
/**
|
|
815
817
|
* Evaluate every `_map` entry and apply the results to `props`.
|
|
816
818
|
*
|
|
@@ -822,10 +824,25 @@ declare const resolveValueByPath: (source: any, path: string) => any;
|
|
|
822
824
|
* - `"propsFirst"` (runtime): prefer live prop values, fall back
|
|
823
825
|
* to fieldSettings `defaultValue`.
|
|
824
826
|
*/
|
|
825
|
-
declare function applyMapping(props:
|
|
827
|
+
declare function applyMapping(props: DefaultComponentProps, fieldSettings: DefaultComponentProps, map: MapEntry[], resolveInput?: "fieldSettings" | "propsFirst", options?: ApplyMappingOptions): ApplyMappingResult;
|
|
826
828
|
|
|
827
829
|
declare const isArrayMappingPath: (path: string) => boolean;
|
|
828
830
|
declare const getArrayBasePath: (arrayPath: string) => string | null;
|
|
829
831
|
declare const getArrayItemSubPath: (arrayPath: string) => string | null;
|
|
830
832
|
|
|
831
|
-
|
|
833
|
+
type ZoneType = "root" | "dropzone" | "slot";
|
|
834
|
+
type PuckNodeData = {
|
|
835
|
+
data: ComponentData;
|
|
836
|
+
flatData: ComponentData;
|
|
837
|
+
parentId: string | null;
|
|
838
|
+
zone: string;
|
|
839
|
+
path: string[];
|
|
840
|
+
};
|
|
841
|
+
type PuckZoneData = {
|
|
842
|
+
contentIds: string[];
|
|
843
|
+
type: ZoneType;
|
|
844
|
+
};
|
|
845
|
+
type NodeIndex = Record<string, PuckNodeData>;
|
|
846
|
+
type ZoneIndex = Record<string, PuckZoneData>;
|
|
847
|
+
|
|
848
|
+
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type ApplyMappingOptions, type ApplyMappingResult, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, Drawer as ComponentList, type CustomFieldDefinition, type CustomFieldReturnType, type CustomFields, Drawer, DrawerItem, type FieldSettings, Header, HeaderActions, type MapEntry, Modal, type NodeIndex, type OnActionsCallback, type Overrides, type PuckNodeData, type PuckZoneData, type SoftComponent, type SoftComponents, SoftConfigProvider, type SoftFieldDefinition, type SoftFieldSettings, type Status, type VersionedSoftComponent, type ZoneIndex, type ZoneType, applyMapping, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, filterToOptionsForFrom, getArrayBasePath, getArrayItemSubPath, isArrayMappingPath, notify, resolveSoftConfig, resolveValueByPath, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig, useSoftConfigStore };
|