@netlisian/softconfig 0.1.1 → 0.1.3
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/README.md +50 -0
- package/dist/puck/index.css +127 -40
- package/dist/puck/index.d.mts +145 -89
- package/dist/puck/index.d.ts +145 -89
- package/dist/puck/index.js +271 -75
- package/dist/puck/index.mjs +268 -75
- package/package.json +1 -1
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,10 +1,91 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import * as _measured_puck from '@measured/puck';
|
|
4
|
+
import { DefaultComponentProps, Field, Config, Fields, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
5
|
+
import * as React$1 from 'react';
|
|
6
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
|
|
9
|
+
type BuilderRootConfig = {
|
|
10
|
+
_name: string;
|
|
11
|
+
_category?: string;
|
|
12
|
+
_version?: string;
|
|
13
|
+
_versions?: string[];
|
|
14
|
+
_fields?: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: Field["type"];
|
|
17
|
+
}[];
|
|
18
|
+
_fieldSettings?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type BuilderComponentConfig = {
|
|
23
|
+
_slot?: {
|
|
24
|
+
slot: string;
|
|
25
|
+
}[];
|
|
26
|
+
_map?: {
|
|
27
|
+
to: string | string[];
|
|
28
|
+
from: string | string[];
|
|
29
|
+
transform?: (inputs: any[], props: DefaultComponentProps) => any;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}[];
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
type BuilderConfig = Config<any, BuilderRootConfig>;
|
|
35
|
+
|
|
36
|
+
type SoftSubComponent = {
|
|
37
|
+
type: string;
|
|
38
|
+
map: BuilderComponentConfig['_map'];
|
|
39
|
+
components: {
|
|
40
|
+
[slot: string]: SoftSubComponent;
|
|
41
|
+
};
|
|
42
|
+
fixedProps?: DefaultComponentProps;
|
|
43
|
+
enabledSlots: {
|
|
44
|
+
slot: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
}[];
|
|
47
|
+
}[];
|
|
48
|
+
type SoftComponent = {
|
|
49
|
+
name: string;
|
|
50
|
+
category?: string;
|
|
51
|
+
fields: Fields;
|
|
52
|
+
fieldSettings?: Record<string, any>;
|
|
53
|
+
defaultProps: DefaultComponentProps;
|
|
54
|
+
components: SoftSubComponent;
|
|
55
|
+
slots: {
|
|
56
|
+
[slot: string]: DefaultComponentProps;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type VersionedSoftComponent = {
|
|
60
|
+
defaultVersion: string;
|
|
61
|
+
name: string;
|
|
62
|
+
category?: string;
|
|
63
|
+
versions: {
|
|
64
|
+
[version: string]: {
|
|
65
|
+
fields: Fields;
|
|
66
|
+
fieldSettings?: Record<string, any>;
|
|
67
|
+
defaultProps: DefaultComponentProps;
|
|
68
|
+
components: SoftSubComponent;
|
|
69
|
+
slots: {
|
|
70
|
+
[slot: string]: DefaultComponentProps;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Dependencies map: version -> Set of component names this component depends on
|
|
76
|
+
* Automatically inferred from component structure but can be overridden
|
|
77
|
+
*/
|
|
78
|
+
dependencies?: {
|
|
79
|
+
[version: string]: Set<string>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
type SoftComponents = Record<string, VersionedSoftComponent>;
|
|
83
|
+
|
|
84
|
+
type CompletedComponentResult = {
|
|
85
|
+
id: string;
|
|
86
|
+
version: string;
|
|
87
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
88
|
+
};
|
|
8
89
|
type BuildersSlice = {
|
|
9
90
|
/**
|
|
10
91
|
* Build a new soft component based on the selected item in history.
|
|
@@ -61,7 +142,7 @@ type BuildersSlice = {
|
|
|
61
142
|
* - Strip the build settings fields
|
|
62
143
|
* - Apply modified history to puck data.
|
|
63
144
|
*/
|
|
64
|
-
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) =>
|
|
145
|
+
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) => CompletedComponentResult;
|
|
65
146
|
demolish: (componentName: string, data: AppState["data"], puckDispatch: PuckApi["dispatch"]) => void;
|
|
66
147
|
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]) => void;
|
|
67
148
|
/**
|
|
@@ -86,81 +167,6 @@ type BuildersSlice = {
|
|
|
86
167
|
decompose: (componentData: ComponentData) => ComponentData[];
|
|
87
168
|
};
|
|
88
169
|
|
|
89
|
-
type BuilderRootConfig = {
|
|
90
|
-
_name: string;
|
|
91
|
-
_category?: string;
|
|
92
|
-
_version?: string;
|
|
93
|
-
_versions?: string[];
|
|
94
|
-
_fields?: {
|
|
95
|
-
name: string;
|
|
96
|
-
type: Field["type"];
|
|
97
|
-
}[];
|
|
98
|
-
_fieldSettings?: {
|
|
99
|
-
[key: string]: any;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
type BuilderComponentConfig = {
|
|
103
|
-
_slot?: {
|
|
104
|
-
slot: string;
|
|
105
|
-
}[];
|
|
106
|
-
_map?: {
|
|
107
|
-
to: string | string[];
|
|
108
|
-
from: string | string[];
|
|
109
|
-
transform?: (inputs: any[], props: DefaultComponentProps) => any;
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}[];
|
|
112
|
-
[key: string]: any;
|
|
113
|
-
};
|
|
114
|
-
type BuilderConfig = Config<any, BuilderRootConfig>;
|
|
115
|
-
|
|
116
|
-
type SoftSubComponent = {
|
|
117
|
-
type: string;
|
|
118
|
-
map: BuilderComponentConfig['_map'];
|
|
119
|
-
components: {
|
|
120
|
-
[slot: string]: SoftSubComponent;
|
|
121
|
-
};
|
|
122
|
-
fixedProps?: DefaultComponentProps;
|
|
123
|
-
enabledSlots: {
|
|
124
|
-
slot: string;
|
|
125
|
-
name?: string;
|
|
126
|
-
}[];
|
|
127
|
-
}[];
|
|
128
|
-
type SoftComponent = {
|
|
129
|
-
name: string;
|
|
130
|
-
category?: string;
|
|
131
|
-
fields: Fields;
|
|
132
|
-
fieldSettings?: Record<string, any>;
|
|
133
|
-
defaultProps: DefaultComponentProps;
|
|
134
|
-
components: SoftSubComponent;
|
|
135
|
-
slots: {
|
|
136
|
-
[slot: string]: DefaultComponentProps;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
type VersionedSoftComponent = {
|
|
140
|
-
defaultVersion: string;
|
|
141
|
-
name: string;
|
|
142
|
-
category?: string;
|
|
143
|
-
versions: {
|
|
144
|
-
[version: string]: {
|
|
145
|
-
fields: Fields;
|
|
146
|
-
fieldSettings?: Record<string, any>;
|
|
147
|
-
defaultProps: DefaultComponentProps;
|
|
148
|
-
components: SoftSubComponent;
|
|
149
|
-
slots: {
|
|
150
|
-
[slot: string]: DefaultComponentProps;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Dependencies map: version -> Set of component names this component depends on
|
|
156
|
-
* Automatically inferred from component structure but can be overridden
|
|
157
|
-
*/
|
|
158
|
-
dependencies?: {
|
|
159
|
-
[version: string]: Set<string>;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
type SoftComponents = Record<string, VersionedSoftComponent>;
|
|
163
|
-
|
|
164
170
|
type ActionEventPayload = {
|
|
165
171
|
type: "build";
|
|
166
172
|
payload: {
|
|
@@ -170,11 +176,14 @@ type ActionEventPayload = {
|
|
|
170
176
|
type: "remodel";
|
|
171
177
|
payload: {
|
|
172
178
|
id: string;
|
|
179
|
+
version?: string;
|
|
180
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
173
181
|
};
|
|
174
182
|
} | {
|
|
175
183
|
type: "complete";
|
|
176
184
|
payload: {
|
|
177
185
|
id: string;
|
|
186
|
+
version: string;
|
|
178
187
|
componentData: Record<string, any>;
|
|
179
188
|
softComponent: VersionedSoftComponent["versions"][string];
|
|
180
189
|
};
|
|
@@ -192,10 +201,19 @@ type ActionEventPayload = {
|
|
|
192
201
|
id: string;
|
|
193
202
|
version: string;
|
|
194
203
|
};
|
|
204
|
+
} | {
|
|
205
|
+
type: "deleteVersion";
|
|
206
|
+
payload: {
|
|
207
|
+
id: string;
|
|
208
|
+
version: string;
|
|
209
|
+
migrateToVersion?: string;
|
|
210
|
+
};
|
|
195
211
|
} | {
|
|
196
212
|
type: "inspect";
|
|
197
213
|
payload: {
|
|
198
214
|
id: string;
|
|
215
|
+
version?: string;
|
|
216
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
199
217
|
};
|
|
200
218
|
} | {
|
|
201
219
|
type: "decompose";
|
|
@@ -361,21 +379,37 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, overr
|
|
|
361
379
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
362
380
|
declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
363
381
|
|
|
364
|
-
declare const useBuild: () => {
|
|
382
|
+
declare const useBuild: (name?: string) => {
|
|
365
383
|
handleBuild: () => void;
|
|
366
384
|
canBuild: boolean;
|
|
367
385
|
};
|
|
368
386
|
|
|
369
387
|
declare const useRemodel: () => {
|
|
370
|
-
handleRemodel: (componentName?: string) =>
|
|
388
|
+
handleRemodel: (componentName?: string) => {
|
|
389
|
+
id: string;
|
|
390
|
+
version: string;
|
|
391
|
+
softComponent: {
|
|
392
|
+
fields: _measured_puck.Fields;
|
|
393
|
+
fieldSettings?: Record<string, any>;
|
|
394
|
+
defaultProps: DefaultComponentProps;
|
|
395
|
+
components: SoftSubComponent;
|
|
396
|
+
slots: {
|
|
397
|
+
[slot: string]: DefaultComponentProps;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
} | {
|
|
401
|
+
id: string;
|
|
402
|
+
version: string;
|
|
403
|
+
softComponent?: undefined;
|
|
404
|
+
} | null;
|
|
371
405
|
canRemodel: (componentName?: string) => boolean;
|
|
372
406
|
};
|
|
373
407
|
|
|
374
408
|
declare const useComplete: () => {
|
|
375
|
-
handleComplete: () =>
|
|
409
|
+
handleComplete: () => CompletedComponentResult | null;
|
|
376
410
|
canComplete: boolean;
|
|
377
|
-
newComponent:
|
|
378
|
-
setNewComponent:
|
|
411
|
+
newComponent: CompletedComponentResult | null;
|
|
412
|
+
setNewComponent: React$1.Dispatch<React$1.SetStateAction<CompletedComponentResult | null>>;
|
|
379
413
|
};
|
|
380
414
|
|
|
381
415
|
declare const useCancel: () => {
|
|
@@ -383,7 +417,7 @@ declare const useCancel: () => {
|
|
|
383
417
|
canCancel: boolean;
|
|
384
418
|
};
|
|
385
419
|
|
|
386
|
-
declare const useInspect: (
|
|
420
|
+
declare const useInspect: (component: CompletedComponentResult | null) => void;
|
|
387
421
|
|
|
388
422
|
declare const useDecompose: () => {
|
|
389
423
|
handleDecompose: (componentData?: ComponentData) => void;
|
|
@@ -404,20 +438,42 @@ declare const useSetDefaultVersion: () => {
|
|
|
404
438
|
|
|
405
439
|
declare const Header: ({ onPublish, children, }: {
|
|
406
440
|
onPublish?: (data: Data, softComponents: SoftComponents) => void;
|
|
407
|
-
children:
|
|
441
|
+
children: React__default.ReactNode;
|
|
408
442
|
}) => react_jsx_runtime.JSX.Element;
|
|
409
443
|
|
|
410
444
|
declare const ActionBarOverride: (props: {
|
|
411
445
|
label?: string;
|
|
412
|
-
parentAction?:
|
|
413
|
-
children?:
|
|
446
|
+
parentAction?: React__default.ReactNode;
|
|
447
|
+
children?: React__default.ReactNode;
|
|
414
448
|
}) => react_jsx_runtime.JSX.Element;
|
|
415
449
|
|
|
450
|
+
declare const DrawerItem: (props: {
|
|
451
|
+
name: string;
|
|
452
|
+
children: React.ReactNode;
|
|
453
|
+
}) => React.ReactElement;
|
|
454
|
+
/** @deprecated Use DrawerItem instead */
|
|
416
455
|
declare const ComponentItem: (props: {
|
|
417
456
|
name: string;
|
|
418
457
|
children: React.ReactNode;
|
|
419
458
|
}) => React.ReactElement;
|
|
420
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Drawer — custom drawer override for the Puck editor.
|
|
462
|
+
*
|
|
463
|
+
* Reads config.categories from puck and renders a collapsible section per
|
|
464
|
+
* category, each containing a PuckDrawer with DrawerItem as the item
|
|
465
|
+
* renderer (soft-config versioning, demolish, and settings modal included).
|
|
466
|
+
* Components not assigned to any category render under "Other components".
|
|
467
|
+
*
|
|
468
|
+
* Falls back to a flat list when no categories are defined.
|
|
469
|
+
*
|
|
470
|
+
* Usage:
|
|
471
|
+
* overrides={{ drawer: Drawer }}
|
|
472
|
+
*/
|
|
473
|
+
declare const Drawer: (_props: {
|
|
474
|
+
children?: React__default.ReactNode;
|
|
475
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
476
|
+
|
|
421
477
|
type NotificationHandler = (message: string, type: "error" | "success") => void;
|
|
422
478
|
declare const setNotificationHandler: (handler: NotificationHandler) => void;
|
|
423
479
|
declare const notify: {
|
|
@@ -472,4 +528,4 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
472
528
|
isOpen: boolean;
|
|
473
529
|
}) => react_jsx_runtime.JSX.Element;
|
|
474
530
|
|
|
475
|
-
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Header, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type VersionedSoftComponent, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, notify, resolveSoftConfig, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
|
|
531
|
+
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, Drawer, DrawerItem, Header, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type VersionedSoftComponent, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, notify, resolveSoftConfig, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
|
package/dist/puck/index.d.ts
CHANGED
|
@@ -1,10 +1,91 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import * as _measured_puck from '@measured/puck';
|
|
4
|
+
import { DefaultComponentProps, Field, Config, Fields, History, AppState, PuckApi, ComponentData, ComponentConfig, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
5
|
+
import * as React$1 from 'react';
|
|
6
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
6
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
8
|
|
|
9
|
+
type BuilderRootConfig = {
|
|
10
|
+
_name: string;
|
|
11
|
+
_category?: string;
|
|
12
|
+
_version?: string;
|
|
13
|
+
_versions?: string[];
|
|
14
|
+
_fields?: {
|
|
15
|
+
name: string;
|
|
16
|
+
type: Field["type"];
|
|
17
|
+
}[];
|
|
18
|
+
_fieldSettings?: {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type BuilderComponentConfig = {
|
|
23
|
+
_slot?: {
|
|
24
|
+
slot: string;
|
|
25
|
+
}[];
|
|
26
|
+
_map?: {
|
|
27
|
+
to: string | string[];
|
|
28
|
+
from: string | string[];
|
|
29
|
+
transform?: (inputs: any[], props: DefaultComponentProps) => any;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}[];
|
|
32
|
+
[key: string]: any;
|
|
33
|
+
};
|
|
34
|
+
type BuilderConfig = Config<any, BuilderRootConfig>;
|
|
35
|
+
|
|
36
|
+
type SoftSubComponent = {
|
|
37
|
+
type: string;
|
|
38
|
+
map: BuilderComponentConfig['_map'];
|
|
39
|
+
components: {
|
|
40
|
+
[slot: string]: SoftSubComponent;
|
|
41
|
+
};
|
|
42
|
+
fixedProps?: DefaultComponentProps;
|
|
43
|
+
enabledSlots: {
|
|
44
|
+
slot: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
}[];
|
|
47
|
+
}[];
|
|
48
|
+
type SoftComponent = {
|
|
49
|
+
name: string;
|
|
50
|
+
category?: string;
|
|
51
|
+
fields: Fields;
|
|
52
|
+
fieldSettings?: Record<string, any>;
|
|
53
|
+
defaultProps: DefaultComponentProps;
|
|
54
|
+
components: SoftSubComponent;
|
|
55
|
+
slots: {
|
|
56
|
+
[slot: string]: DefaultComponentProps;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
type VersionedSoftComponent = {
|
|
60
|
+
defaultVersion: string;
|
|
61
|
+
name: string;
|
|
62
|
+
category?: string;
|
|
63
|
+
versions: {
|
|
64
|
+
[version: string]: {
|
|
65
|
+
fields: Fields;
|
|
66
|
+
fieldSettings?: Record<string, any>;
|
|
67
|
+
defaultProps: DefaultComponentProps;
|
|
68
|
+
components: SoftSubComponent;
|
|
69
|
+
slots: {
|
|
70
|
+
[slot: string]: DefaultComponentProps;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Dependencies map: version -> Set of component names this component depends on
|
|
76
|
+
* Automatically inferred from component structure but can be overridden
|
|
77
|
+
*/
|
|
78
|
+
dependencies?: {
|
|
79
|
+
[version: string]: Set<string>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
type SoftComponents = Record<string, VersionedSoftComponent>;
|
|
83
|
+
|
|
84
|
+
type CompletedComponentResult = {
|
|
85
|
+
id: string;
|
|
86
|
+
version: string;
|
|
87
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
88
|
+
};
|
|
8
89
|
type BuildersSlice = {
|
|
9
90
|
/**
|
|
10
91
|
* Build a new soft component based on the selected item in history.
|
|
@@ -61,7 +142,7 @@ type BuildersSlice = {
|
|
|
61
142
|
* - Strip the build settings fields
|
|
62
143
|
* - Apply modified history to puck data.
|
|
63
144
|
*/
|
|
64
|
-
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) =>
|
|
145
|
+
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) => CompletedComponentResult;
|
|
65
146
|
demolish: (componentName: string, data: AppState["data"], puckDispatch: PuckApi["dispatch"]) => void;
|
|
66
147
|
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]) => void;
|
|
67
148
|
/**
|
|
@@ -86,81 +167,6 @@ type BuildersSlice = {
|
|
|
86
167
|
decompose: (componentData: ComponentData) => ComponentData[];
|
|
87
168
|
};
|
|
88
169
|
|
|
89
|
-
type BuilderRootConfig = {
|
|
90
|
-
_name: string;
|
|
91
|
-
_category?: string;
|
|
92
|
-
_version?: string;
|
|
93
|
-
_versions?: string[];
|
|
94
|
-
_fields?: {
|
|
95
|
-
name: string;
|
|
96
|
-
type: Field["type"];
|
|
97
|
-
}[];
|
|
98
|
-
_fieldSettings?: {
|
|
99
|
-
[key: string]: any;
|
|
100
|
-
};
|
|
101
|
-
};
|
|
102
|
-
type BuilderComponentConfig = {
|
|
103
|
-
_slot?: {
|
|
104
|
-
slot: string;
|
|
105
|
-
}[];
|
|
106
|
-
_map?: {
|
|
107
|
-
to: string | string[];
|
|
108
|
-
from: string | string[];
|
|
109
|
-
transform?: (inputs: any[], props: DefaultComponentProps) => any;
|
|
110
|
-
[key: string]: any;
|
|
111
|
-
}[];
|
|
112
|
-
[key: string]: any;
|
|
113
|
-
};
|
|
114
|
-
type BuilderConfig = Config<any, BuilderRootConfig>;
|
|
115
|
-
|
|
116
|
-
type SoftSubComponent = {
|
|
117
|
-
type: string;
|
|
118
|
-
map: BuilderComponentConfig['_map'];
|
|
119
|
-
components: {
|
|
120
|
-
[slot: string]: SoftSubComponent;
|
|
121
|
-
};
|
|
122
|
-
fixedProps?: DefaultComponentProps;
|
|
123
|
-
enabledSlots: {
|
|
124
|
-
slot: string;
|
|
125
|
-
name?: string;
|
|
126
|
-
}[];
|
|
127
|
-
}[];
|
|
128
|
-
type SoftComponent = {
|
|
129
|
-
name: string;
|
|
130
|
-
category?: string;
|
|
131
|
-
fields: Fields;
|
|
132
|
-
fieldSettings?: Record<string, any>;
|
|
133
|
-
defaultProps: DefaultComponentProps;
|
|
134
|
-
components: SoftSubComponent;
|
|
135
|
-
slots: {
|
|
136
|
-
[slot: string]: DefaultComponentProps;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
type VersionedSoftComponent = {
|
|
140
|
-
defaultVersion: string;
|
|
141
|
-
name: string;
|
|
142
|
-
category?: string;
|
|
143
|
-
versions: {
|
|
144
|
-
[version: string]: {
|
|
145
|
-
fields: Fields;
|
|
146
|
-
fieldSettings?: Record<string, any>;
|
|
147
|
-
defaultProps: DefaultComponentProps;
|
|
148
|
-
components: SoftSubComponent;
|
|
149
|
-
slots: {
|
|
150
|
-
[slot: string]: DefaultComponentProps;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
/**
|
|
155
|
-
* Dependencies map: version -> Set of component names this component depends on
|
|
156
|
-
* Automatically inferred from component structure but can be overridden
|
|
157
|
-
*/
|
|
158
|
-
dependencies?: {
|
|
159
|
-
[version: string]: Set<string>;
|
|
160
|
-
};
|
|
161
|
-
};
|
|
162
|
-
type SoftComponents = Record<string, VersionedSoftComponent>;
|
|
163
|
-
|
|
164
170
|
type ActionEventPayload = {
|
|
165
171
|
type: "build";
|
|
166
172
|
payload: {
|
|
@@ -170,11 +176,14 @@ type ActionEventPayload = {
|
|
|
170
176
|
type: "remodel";
|
|
171
177
|
payload: {
|
|
172
178
|
id: string;
|
|
179
|
+
version?: string;
|
|
180
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
173
181
|
};
|
|
174
182
|
} | {
|
|
175
183
|
type: "complete";
|
|
176
184
|
payload: {
|
|
177
185
|
id: string;
|
|
186
|
+
version: string;
|
|
178
187
|
componentData: Record<string, any>;
|
|
179
188
|
softComponent: VersionedSoftComponent["versions"][string];
|
|
180
189
|
};
|
|
@@ -192,10 +201,19 @@ type ActionEventPayload = {
|
|
|
192
201
|
id: string;
|
|
193
202
|
version: string;
|
|
194
203
|
};
|
|
204
|
+
} | {
|
|
205
|
+
type: "deleteVersion";
|
|
206
|
+
payload: {
|
|
207
|
+
id: string;
|
|
208
|
+
version: string;
|
|
209
|
+
migrateToVersion?: string;
|
|
210
|
+
};
|
|
195
211
|
} | {
|
|
196
212
|
type: "inspect";
|
|
197
213
|
payload: {
|
|
198
214
|
id: string;
|
|
215
|
+
version?: string;
|
|
216
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
199
217
|
};
|
|
200
218
|
} | {
|
|
201
219
|
type: "decompose";
|
|
@@ -361,21 +379,37 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, overr
|
|
|
361
379
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
362
380
|
declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
363
381
|
|
|
364
|
-
declare const useBuild: () => {
|
|
382
|
+
declare const useBuild: (name?: string) => {
|
|
365
383
|
handleBuild: () => void;
|
|
366
384
|
canBuild: boolean;
|
|
367
385
|
};
|
|
368
386
|
|
|
369
387
|
declare const useRemodel: () => {
|
|
370
|
-
handleRemodel: (componentName?: string) =>
|
|
388
|
+
handleRemodel: (componentName?: string) => {
|
|
389
|
+
id: string;
|
|
390
|
+
version: string;
|
|
391
|
+
softComponent: {
|
|
392
|
+
fields: _measured_puck.Fields;
|
|
393
|
+
fieldSettings?: Record<string, any>;
|
|
394
|
+
defaultProps: DefaultComponentProps;
|
|
395
|
+
components: SoftSubComponent;
|
|
396
|
+
slots: {
|
|
397
|
+
[slot: string]: DefaultComponentProps;
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
} | {
|
|
401
|
+
id: string;
|
|
402
|
+
version: string;
|
|
403
|
+
softComponent?: undefined;
|
|
404
|
+
} | null;
|
|
371
405
|
canRemodel: (componentName?: string) => boolean;
|
|
372
406
|
};
|
|
373
407
|
|
|
374
408
|
declare const useComplete: () => {
|
|
375
|
-
handleComplete: () =>
|
|
409
|
+
handleComplete: () => CompletedComponentResult | null;
|
|
376
410
|
canComplete: boolean;
|
|
377
|
-
newComponent:
|
|
378
|
-
setNewComponent:
|
|
411
|
+
newComponent: CompletedComponentResult | null;
|
|
412
|
+
setNewComponent: React$1.Dispatch<React$1.SetStateAction<CompletedComponentResult | null>>;
|
|
379
413
|
};
|
|
380
414
|
|
|
381
415
|
declare const useCancel: () => {
|
|
@@ -383,7 +417,7 @@ declare const useCancel: () => {
|
|
|
383
417
|
canCancel: boolean;
|
|
384
418
|
};
|
|
385
419
|
|
|
386
|
-
declare const useInspect: (
|
|
420
|
+
declare const useInspect: (component: CompletedComponentResult | null) => void;
|
|
387
421
|
|
|
388
422
|
declare const useDecompose: () => {
|
|
389
423
|
handleDecompose: (componentData?: ComponentData) => void;
|
|
@@ -404,20 +438,42 @@ declare const useSetDefaultVersion: () => {
|
|
|
404
438
|
|
|
405
439
|
declare const Header: ({ onPublish, children, }: {
|
|
406
440
|
onPublish?: (data: Data, softComponents: SoftComponents) => void;
|
|
407
|
-
children:
|
|
441
|
+
children: React__default.ReactNode;
|
|
408
442
|
}) => react_jsx_runtime.JSX.Element;
|
|
409
443
|
|
|
410
444
|
declare const ActionBarOverride: (props: {
|
|
411
445
|
label?: string;
|
|
412
|
-
parentAction?:
|
|
413
|
-
children?:
|
|
446
|
+
parentAction?: React__default.ReactNode;
|
|
447
|
+
children?: React__default.ReactNode;
|
|
414
448
|
}) => react_jsx_runtime.JSX.Element;
|
|
415
449
|
|
|
450
|
+
declare const DrawerItem: (props: {
|
|
451
|
+
name: string;
|
|
452
|
+
children: React.ReactNode;
|
|
453
|
+
}) => React.ReactElement;
|
|
454
|
+
/** @deprecated Use DrawerItem instead */
|
|
416
455
|
declare const ComponentItem: (props: {
|
|
417
456
|
name: string;
|
|
418
457
|
children: React.ReactNode;
|
|
419
458
|
}) => React.ReactElement;
|
|
420
459
|
|
|
460
|
+
/**
|
|
461
|
+
* Drawer — custom drawer override for the Puck editor.
|
|
462
|
+
*
|
|
463
|
+
* Reads config.categories from puck and renders a collapsible section per
|
|
464
|
+
* category, each containing a PuckDrawer with DrawerItem as the item
|
|
465
|
+
* renderer (soft-config versioning, demolish, and settings modal included).
|
|
466
|
+
* Components not assigned to any category render under "Other components".
|
|
467
|
+
*
|
|
468
|
+
* Falls back to a flat list when no categories are defined.
|
|
469
|
+
*
|
|
470
|
+
* Usage:
|
|
471
|
+
* overrides={{ drawer: Drawer }}
|
|
472
|
+
*/
|
|
473
|
+
declare const Drawer: (_props: {
|
|
474
|
+
children?: React__default.ReactNode;
|
|
475
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
476
|
+
|
|
421
477
|
type NotificationHandler = (message: string, type: "error" | "success") => void;
|
|
422
478
|
declare const setNotificationHandler: (handler: NotificationHandler) => void;
|
|
423
479
|
declare const notify: {
|
|
@@ -472,4 +528,4 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
472
528
|
isOpen: boolean;
|
|
473
529
|
}) => react_jsx_runtime.JSX.Element;
|
|
474
530
|
|
|
475
|
-
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Header, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type VersionedSoftComponent, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, notify, resolveSoftConfig, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
|
|
531
|
+
export { ActionBarOverride as ActionBar, type ActionEventPayload, type AppStore, type AppStoreApi, type BuilderComponentConfig, type BuilderConfig, type BuilderRootConfig, ComponentItem, Drawer as ComponentList, Drawer, DrawerItem, Header, Modal, type OnActionsCallback, type Overrides, type SoftComponent, type SoftComponents, SoftConfigProvider, type VersionedSoftComponent, confirm, createActionCallback, createSoftConfigStore, createUseSoftConfig, notify, resolveSoftConfig, setConfirmHandler, setNotificationHandler, useBuild, useCancel, useComplete, useDecompose, useDemolish, useInspect, useRemodel, useSetDefaultVersion, useSoftConfig };
|