@netlisian/softconfig 0.1.2 → 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.
- package/README.md +50 -0
- package/dist/puck/index.css +69 -39
- package/dist/puck/index.d.mts +132 -85
- package/dist/puck/index.d.ts +132 -85
- package/dist/puck/index.js +347 -203
- package/dist/puck/index.mjs +361 -217
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -61,6 +61,56 @@ import "@netlisian/softconfig/styles.css";
|
|
|
61
61
|
|
|
62
62
|
You can supply custom overrides (action bar, headers, map UI, etc.) through the `overrides` prop. See `src/puck/types/Overrides.ts` for the full surface.
|
|
63
63
|
|
|
64
|
+
## Action Lifecycle Events
|
|
65
|
+
|
|
66
|
+
`SoftConfigProvider` supports `onActions` for lifecycle callbacks:
|
|
67
|
+
|
|
68
|
+
- `build` → when build mode starts
|
|
69
|
+
- `remodel` → when remodel mode starts
|
|
70
|
+
- `complete` → when a build/remodel is finalized
|
|
71
|
+
- `inspect` → when inspect is requested
|
|
72
|
+
- `demolish` → when a soft component is deleted
|
|
73
|
+
- `setDefaultVersion`, `decompose`, `cancel`, `publish`
|
|
74
|
+
|
|
75
|
+
Version-aware payloads are included for build finalization and inspection flows:
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
type ActionEventPayload =
|
|
79
|
+
| {
|
|
80
|
+
type: "remodel";
|
|
81
|
+
payload: {
|
|
82
|
+
id: string;
|
|
83
|
+
version?: string;
|
|
84
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
| {
|
|
88
|
+
type: "complete";
|
|
89
|
+
payload: {
|
|
90
|
+
id: string;
|
|
91
|
+
version: string;
|
|
92
|
+
componentData: Record<string, any>;
|
|
93
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
type: "inspect";
|
|
98
|
+
payload: {
|
|
99
|
+
id: string;
|
|
100
|
+
version?: string;
|
|
101
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
| {
|
|
105
|
+
type: "demolish";
|
|
106
|
+
payload: {
|
|
107
|
+
id: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This contract allows downstream consumers (for example, save/sync bridges) to persist using exact version metadata without relying on inferred/default versions.
|
|
113
|
+
|
|
64
114
|
## Development
|
|
65
115
|
|
|
66
116
|
- Build: `pnpm --filter @netlisian/softconfig build`
|
package/dist/puck/index.css
CHANGED
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/DrawerItem.module.css/#css-module-data */
|
|
123
|
-
.
|
|
123
|
+
._DrawerItem_182aj_1 {
|
|
124
124
|
background: var(--puck-color-white);
|
|
125
125
|
cursor: grab;
|
|
126
126
|
border: 1px solid var(--puck-color-grey-09);
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
transition: background-color 50ms ease-in, color 50ms ease-in;
|
|
133
133
|
display: flex;
|
|
134
134
|
}
|
|
135
|
-
._DrawerItem--
|
|
135
|
+
._DrawerItem--insertDisabled_182aj_14 {
|
|
136
136
|
cursor: not-allowed;
|
|
137
137
|
color: var(--puck-color-grey-5);
|
|
138
138
|
background: var(--puck-color-grey-11);
|
|
139
139
|
pointer-events: none;
|
|
140
140
|
}
|
|
141
|
-
._DrawerItem-
|
|
141
|
+
._DrawerItem-content_182aj_21 {
|
|
142
142
|
flex: 1;
|
|
143
143
|
display: flex;
|
|
144
144
|
flex-direction: column;
|
|
@@ -147,82 +147,85 @@
|
|
|
147
147
|
white-space: nowrap;
|
|
148
148
|
overflow-x: hidden;
|
|
149
149
|
}
|
|
150
|
-
._DrawerItem-
|
|
150
|
+
._DrawerItem-name_182aj_31 {
|
|
151
151
|
font-weight: 400;
|
|
152
152
|
}
|
|
153
|
-
._DrawerItem-
|
|
153
|
+
._DrawerItem-version_182aj_35 {
|
|
154
154
|
font-size: 10px;
|
|
155
155
|
color: var(--puck-color-grey-05);
|
|
156
156
|
}
|
|
157
|
-
._DrawerItem-
|
|
157
|
+
._DrawerItem-actions_182aj_40 {
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: center;
|
|
160
160
|
gap: 8px;
|
|
161
161
|
}
|
|
162
|
-
._DrawerItem-
|
|
162
|
+
._DrawerItem-settingsButton_182aj_46 {
|
|
163
163
|
opacity: 0;
|
|
164
164
|
transition: opacity 120ms ease;
|
|
165
165
|
color: var(--puck-color-grey-05);
|
|
166
166
|
}
|
|
167
|
-
.
|
|
167
|
+
._DrawerItem_182aj_1:hover ._DrawerItem-settingsButton_182aj_46 {
|
|
168
168
|
opacity: 1;
|
|
169
169
|
}
|
|
170
|
-
._DrawerItem-
|
|
170
|
+
._DrawerItem-grip_182aj_56 {
|
|
171
171
|
color: var(--puck-color-grey-05);
|
|
172
172
|
display: flex;
|
|
173
173
|
align-items: center;
|
|
174
174
|
}
|
|
175
|
-
._DrawerItem-
|
|
175
|
+
._DrawerItem-modal_182aj_63 {
|
|
176
176
|
background: var(--puck-color-white);
|
|
177
177
|
display: flex;
|
|
178
178
|
flex-direction: column;
|
|
179
|
-
height: 100
|
|
179
|
+
height: min(90dvh, 100%);
|
|
180
|
+
min-height: 0;
|
|
180
181
|
}
|
|
181
|
-
._DrawerItem-
|
|
182
|
+
._DrawerItem-modalHeader_182aj_71 {
|
|
182
183
|
padding: 24px 32px;
|
|
183
184
|
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
185
|
+
flex-shrink: 0;
|
|
184
186
|
}
|
|
185
|
-
._DrawerItem-
|
|
187
|
+
._DrawerItem-modalTitle_182aj_77 {
|
|
186
188
|
margin: 0 0 4px 0;
|
|
187
189
|
font-size: 24px;
|
|
188
190
|
font-weight: 600;
|
|
189
191
|
color: var(--puck-color-black);
|
|
190
192
|
}
|
|
191
|
-
._DrawerItem-
|
|
193
|
+
._DrawerItem-modalSubtitle_182aj_84 {
|
|
192
194
|
margin: 0;
|
|
193
195
|
font-size: 14px;
|
|
194
196
|
color: var(--puck-color-grey-04);
|
|
195
197
|
}
|
|
196
|
-
._DrawerItem-
|
|
198
|
+
._DrawerItem-modalBody_182aj_90 {
|
|
197
199
|
flex: 1;
|
|
200
|
+
min-height: 0;
|
|
198
201
|
padding: 32px;
|
|
199
202
|
overflow-y: auto;
|
|
200
203
|
display: flex;
|
|
201
204
|
flex-direction: column;
|
|
202
205
|
gap: 32px;
|
|
203
206
|
}
|
|
204
|
-
._DrawerItem-
|
|
207
|
+
._DrawerItem-section_182aj_100 {
|
|
205
208
|
display: flex;
|
|
206
209
|
flex-direction: column;
|
|
207
210
|
gap: 16px;
|
|
208
211
|
}
|
|
209
|
-
._DrawerItem-
|
|
212
|
+
._DrawerItem-sectionTitle_182aj_106 {
|
|
210
213
|
margin: 0;
|
|
211
214
|
font-size: 16px;
|
|
212
215
|
font-weight: 600;
|
|
213
216
|
color: var(--puck-color-black);
|
|
214
217
|
}
|
|
215
|
-
._DrawerItem-
|
|
218
|
+
._DrawerItem-sectionDescription_182aj_113 {
|
|
216
219
|
margin: 0;
|
|
217
220
|
font-size: 14px;
|
|
218
221
|
color: var(--puck-color-grey-04);
|
|
219
222
|
}
|
|
220
|
-
._DrawerItem-
|
|
223
|
+
._DrawerItem-versionList_182aj_119 {
|
|
221
224
|
display: flex;
|
|
222
225
|
flex-direction: column;
|
|
223
226
|
gap: 8px;
|
|
224
227
|
}
|
|
225
|
-
._DrawerItem-
|
|
228
|
+
._DrawerItem-versionRow_182aj_125 {
|
|
226
229
|
display: flex;
|
|
227
230
|
justify-content: space-between;
|
|
228
231
|
align-items: center;
|
|
@@ -232,26 +235,26 @@
|
|
|
232
235
|
background: var(--puck-color-white);
|
|
233
236
|
transition: all 150ms ease;
|
|
234
237
|
}
|
|
235
|
-
._DrawerItem-versionRow--
|
|
238
|
+
._DrawerItem-versionRow--isDefault_182aj_136 {
|
|
236
239
|
border-color: var(--puck-color-azure-07);
|
|
237
240
|
background: var(--puck-color-azure-10);
|
|
238
241
|
}
|
|
239
|
-
._DrawerItem-versionRow--
|
|
242
|
+
._DrawerItem-versionRow--isMarkedForDeletion_182aj_141 {
|
|
240
243
|
opacity: 0.6;
|
|
241
244
|
background: var(--puck-color-grey-11);
|
|
242
245
|
}
|
|
243
|
-
._DrawerItem-
|
|
246
|
+
._DrawerItem-versionInfo_182aj_146 {
|
|
244
247
|
display: flex;
|
|
245
248
|
align-items: center;
|
|
246
249
|
gap: 12px;
|
|
247
250
|
flex: 1;
|
|
248
251
|
}
|
|
249
|
-
._DrawerItem-
|
|
252
|
+
._DrawerItem-versionNumber_182aj_153 {
|
|
250
253
|
font-size: 14px;
|
|
251
254
|
font-weight: 500;
|
|
252
255
|
color: var(--puck-color-black);
|
|
253
256
|
}
|
|
254
|
-
._DrawerItem-
|
|
257
|
+
._DrawerItem-defaultBadge_182aj_159 {
|
|
255
258
|
font-size: 11px;
|
|
256
259
|
padding: 3px 8px;
|
|
257
260
|
border-radius: 4px;
|
|
@@ -261,7 +264,7 @@
|
|
|
261
264
|
text-transform: uppercase;
|
|
262
265
|
letter-spacing: 0.5px;
|
|
263
266
|
}
|
|
264
|
-
._DrawerItem-
|
|
267
|
+
._DrawerItem-deleteBadge_182aj_170 {
|
|
265
268
|
font-size: 11px;
|
|
266
269
|
padding: 3px 8px;
|
|
267
270
|
border-radius: 4px;
|
|
@@ -271,15 +274,26 @@
|
|
|
271
274
|
text-transform: uppercase;
|
|
272
275
|
letter-spacing: 0.5px;
|
|
273
276
|
}
|
|
274
|
-
._DrawerItem-
|
|
277
|
+
._DrawerItem-versionActions_182aj_181 {
|
|
275
278
|
display: flex;
|
|
276
279
|
gap: 8px;
|
|
277
280
|
align-items: center;
|
|
278
281
|
}
|
|
279
|
-
._DrawerItem-
|
|
282
|
+
._DrawerItem-migrationOptions_182aj_187 {
|
|
280
283
|
width: 100%;
|
|
281
284
|
}
|
|
282
|
-
._DrawerItem-
|
|
285
|
+
._DrawerItem-migrationList_182aj_191 {
|
|
286
|
+
display: flex;
|
|
287
|
+
flex-direction: column;
|
|
288
|
+
gap: 8px;
|
|
289
|
+
max-height: 180px;
|
|
290
|
+
overflow-y: auto;
|
|
291
|
+
padding: 8px;
|
|
292
|
+
border: 1px solid var(--puck-color-grey-09);
|
|
293
|
+
border-radius: 6px;
|
|
294
|
+
background: var(--puck-color-white);
|
|
295
|
+
}
|
|
296
|
+
._DrawerItem-migrationOption_182aj_187 {
|
|
283
297
|
width: 100%;
|
|
284
298
|
padding: 10px 12px;
|
|
285
299
|
border: 1px solid var(--puck-color-grey-09);
|
|
@@ -289,33 +303,48 @@
|
|
|
289
303
|
color: var(--puck-color-black);
|
|
290
304
|
cursor: pointer;
|
|
291
305
|
transition: border-color 150ms ease;
|
|
306
|
+
display: flex;
|
|
307
|
+
align-items: center;
|
|
308
|
+
justify-content: space-between;
|
|
309
|
+
gap: 8px;
|
|
310
|
+
text-align: start;
|
|
292
311
|
}
|
|
293
|
-
._DrawerItem-
|
|
312
|
+
._DrawerItem-migrationOption_182aj_187:hover {
|
|
294
313
|
border-color: var(--puck-color-grey-07);
|
|
295
314
|
}
|
|
296
|
-
._DrawerItem-
|
|
315
|
+
._DrawerItem-migrationOption_182aj_187:focus {
|
|
297
316
|
outline: none;
|
|
298
317
|
border-color: var(--puck-color-azure-07);
|
|
299
318
|
}
|
|
300
|
-
._DrawerItem-
|
|
319
|
+
._DrawerItem-migrationOption--isSelected_182aj_229 {
|
|
320
|
+
border-color: var(--puck-color-azure-07);
|
|
321
|
+
background: var(--puck-color-azure-10);
|
|
322
|
+
}
|
|
323
|
+
._DrawerItem-migrationOptionLabel_182aj_234 {
|
|
324
|
+
white-space: nowrap;
|
|
325
|
+
overflow: hidden;
|
|
326
|
+
text-overflow: ellipsis;
|
|
327
|
+
}
|
|
328
|
+
._DrawerItem-modalFooter_182aj_240 {
|
|
301
329
|
padding: 20px 32px;
|
|
302
330
|
border-top: 1px solid var(--puck-color-grey-09);
|
|
303
331
|
display: flex;
|
|
304
332
|
justify-content: space-between;
|
|
305
333
|
align-items: center;
|
|
306
334
|
background: var(--puck-color-grey-11);
|
|
335
|
+
flex-shrink: 0;
|
|
307
336
|
}
|
|
308
|
-
._DrawerItem-
|
|
337
|
+
._DrawerItem-footerLeft_182aj_250 {
|
|
309
338
|
display: flex;
|
|
310
339
|
gap: 12px;
|
|
311
340
|
}
|
|
312
|
-
._DrawerItem-
|
|
341
|
+
._DrawerItem-footerRight_182aj_255 {
|
|
313
342
|
display: flex;
|
|
314
343
|
gap: 12px;
|
|
315
344
|
}
|
|
316
345
|
|
|
317
346
|
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/components/modal/styles.module.css/#css-module-data */
|
|
318
|
-
.
|
|
347
|
+
._Modal_1t9ot_1 {
|
|
319
348
|
background: color-mix(in srgb, var(--puck-color-black) 75%, transparent);
|
|
320
349
|
display: none;
|
|
321
350
|
justify-content: center;
|
|
@@ -325,21 +354,22 @@
|
|
|
325
354
|
left: 0;
|
|
326
355
|
bottom: 0;
|
|
327
356
|
right: 0;
|
|
328
|
-
z-index:
|
|
357
|
+
z-index: 1000;
|
|
329
358
|
padding: 32px;
|
|
330
359
|
}
|
|
331
|
-
._Modal--
|
|
360
|
+
._Modal--isOpen_1t9ot_29 {
|
|
332
361
|
display: flex;
|
|
333
362
|
}
|
|
334
|
-
._Modal-
|
|
363
|
+
._Modal-inner_1t9ot_37 {
|
|
335
364
|
width: 100%;
|
|
336
365
|
max-width: 1024px;
|
|
337
366
|
border-radius: 8px;
|
|
338
|
-
overflow:
|
|
367
|
+
overflow: visible;
|
|
339
368
|
background: var(--puck-color-white);
|
|
340
369
|
display: flex;
|
|
341
370
|
flex-direction: column;
|
|
342
371
|
max-height: 90dvh;
|
|
372
|
+
min-height: 0;
|
|
343
373
|
}
|
|
344
374
|
|
|
345
375
|
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/Drawer.module.css/#css-module-data */
|
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,10 +1,94 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
|
-
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';
|
|
4
5
|
import * as React$1 from 'react';
|
|
5
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
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
type BuilderComponentConfig = {
|
|
24
|
+
_slot?: {
|
|
25
|
+
slot: string;
|
|
26
|
+
}[];
|
|
27
|
+
_map?: {
|
|
28
|
+
to: string | string[];
|
|
29
|
+
from: string | string[];
|
|
30
|
+
transform?: (inputs: any[], props: DefaultComponentProps) => any;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}[];
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
};
|
|
35
|
+
type BuilderConfig = Config<any, BuilderRootConfig>;
|
|
36
|
+
|
|
37
|
+
type SoftSubComponent = {
|
|
38
|
+
type: string;
|
|
39
|
+
map: BuilderComponentConfig['_map'];
|
|
40
|
+
components: {
|
|
41
|
+
[slot: string]: SoftSubComponent;
|
|
42
|
+
};
|
|
43
|
+
fixedProps?: DefaultComponentProps;
|
|
44
|
+
enabledSlots: {
|
|
45
|
+
slot: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
}[];
|
|
48
|
+
}[];
|
|
49
|
+
type SoftComponent = {
|
|
50
|
+
name: string;
|
|
51
|
+
category?: string;
|
|
52
|
+
fields: Fields;
|
|
53
|
+
fieldSettings?: Record<string, any>;
|
|
54
|
+
defaultProps: DefaultComponentProps;
|
|
55
|
+
rootProps?: Record<string, any>;
|
|
56
|
+
components: SoftSubComponent;
|
|
57
|
+
slots: {
|
|
58
|
+
[slot: string]: DefaultComponentProps;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
type VersionedSoftComponent = {
|
|
62
|
+
defaultVersion: string;
|
|
63
|
+
name: string;
|
|
64
|
+
category?: string;
|
|
65
|
+
versions: {
|
|
66
|
+
[version: string]: {
|
|
67
|
+
fields: Fields;
|
|
68
|
+
fieldSettings?: Record<string, any>;
|
|
69
|
+
defaultProps: DefaultComponentProps;
|
|
70
|
+
rootProps?: Record<string, any>;
|
|
71
|
+
components: SoftSubComponent;
|
|
72
|
+
slots: {
|
|
73
|
+
[slot: string]: DefaultComponentProps;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Dependencies map: version -> Set of component names this component depends on
|
|
79
|
+
* Automatically inferred from component structure but can be overridden
|
|
80
|
+
*/
|
|
81
|
+
dependencies?: {
|
|
82
|
+
[version: string]: Set<string>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
type SoftComponents = Record<string, VersionedSoftComponent>;
|
|
86
|
+
|
|
87
|
+
type CompletedComponentResult = {
|
|
88
|
+
id: string;
|
|
89
|
+
version: string;
|
|
90
|
+
softComponent: VersionedSoftComponent["versions"][string];
|
|
91
|
+
};
|
|
8
92
|
type BuildersSlice = {
|
|
9
93
|
/**
|
|
10
94
|
* Build a new soft component based on the selected item in history.
|
|
@@ -61,7 +145,7 @@ type BuildersSlice = {
|
|
|
61
145
|
* - Strip the build settings fields
|
|
62
146
|
* - Apply modified history to puck data.
|
|
63
147
|
*/
|
|
64
|
-
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) =>
|
|
148
|
+
complete: (appState: AppState<any>, setHistories: PuckApi["history"]["setHistories"], getItemBySelector: PuckApi["getItemBySelector"]) => CompletedComponentResult;
|
|
65
149
|
demolish: (componentName: string, data: AppState["data"], puckDispatch: PuckApi["dispatch"]) => void;
|
|
66
150
|
inspect: (componentName: string, puckDispatch: PuckApi["dispatch"]) => void;
|
|
67
151
|
/**
|
|
@@ -86,81 +170,6 @@ type BuildersSlice = {
|
|
|
86
170
|
decompose: (componentData: ComponentData) => ComponentData[];
|
|
87
171
|
};
|
|
88
172
|
|
|
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
173
|
type ActionEventPayload = {
|
|
165
174
|
type: "build";
|
|
166
175
|
payload: {
|
|
@@ -170,11 +179,14 @@ type ActionEventPayload = {
|
|
|
170
179
|
type: "remodel";
|
|
171
180
|
payload: {
|
|
172
181
|
id: string;
|
|
182
|
+
version?: string;
|
|
183
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
173
184
|
};
|
|
174
185
|
} | {
|
|
175
186
|
type: "complete";
|
|
176
187
|
payload: {
|
|
177
188
|
id: string;
|
|
189
|
+
version: string;
|
|
178
190
|
componentData: Record<string, any>;
|
|
179
191
|
softComponent: VersionedSoftComponent["versions"][string];
|
|
180
192
|
};
|
|
@@ -192,10 +204,19 @@ type ActionEventPayload = {
|
|
|
192
204
|
id: string;
|
|
193
205
|
version: string;
|
|
194
206
|
};
|
|
207
|
+
} | {
|
|
208
|
+
type: "deleteVersion";
|
|
209
|
+
payload: {
|
|
210
|
+
id: string;
|
|
211
|
+
version: string;
|
|
212
|
+
migrateToVersion?: string;
|
|
213
|
+
};
|
|
195
214
|
} | {
|
|
196
215
|
type: "inspect";
|
|
197
216
|
payload: {
|
|
198
217
|
id: string;
|
|
218
|
+
version?: string;
|
|
219
|
+
softComponent?: VersionedSoftComponent["versions"][string];
|
|
199
220
|
};
|
|
200
221
|
} | {
|
|
201
222
|
type: "decompose";
|
|
@@ -217,10 +238,13 @@ type RenderFunc<Props extends {
|
|
|
217
238
|
children: ReactNode;
|
|
218
239
|
}> = (props: Props) => ReactElement;
|
|
219
240
|
type Overrides = {
|
|
220
|
-
componentNameToKey?: (displayName: string, context: {
|
|
241
|
+
componentNameToKey?: (displayName: string, context: Partial<BuilderRootConfig> & {
|
|
221
242
|
existingKeys: string[];
|
|
222
243
|
state: "building" | "remodeling" | "ready" | "inspecting";
|
|
223
244
|
}) => string;
|
|
245
|
+
componentKeyToName?: (key: string) => string;
|
|
246
|
+
onRemodel?: (key: string) => Record<string, any>;
|
|
247
|
+
additionalRootFields?: Record<string, Field>;
|
|
224
248
|
map?: RenderFunc<{
|
|
225
249
|
rootProps: BuilderRootConfig;
|
|
226
250
|
toOptions: {
|
|
@@ -247,14 +271,19 @@ type Overrides = {
|
|
|
247
271
|
onActions?: OnActionsCallback;
|
|
248
272
|
name?: Field<string>;
|
|
249
273
|
categories?: Field<string | undefined>;
|
|
250
|
-
|
|
274
|
+
resolveRootData?: (props: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>>, params: {
|
|
251
275
|
changed: Partial<Record<keyof BuilderRootConfig, boolean> & {
|
|
252
276
|
id: string;
|
|
253
277
|
}>;
|
|
254
278
|
lastData: RootData<AsFieldProps<WithChildren<BuilderRootConfig>>> | null;
|
|
255
279
|
metadata: Metadata;
|
|
256
280
|
trigger: ResolveDataTrigger;
|
|
257
|
-
}
|
|
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
|
+
};
|
|
258
287
|
};
|
|
259
288
|
|
|
260
289
|
type Status = "building" | "remodeling" | "ready" | "inspecting";
|
|
@@ -295,6 +324,7 @@ type AppStore = {
|
|
|
295
324
|
hydrateTransforms: () => void;
|
|
296
325
|
setSoftComponentDefaultVersion: (key: string, version: string) => void;
|
|
297
326
|
removeSoftComponent: (key: string) => void;
|
|
327
|
+
editingComponent: string | null;
|
|
298
328
|
editingComponentId: string | null;
|
|
299
329
|
editableComponentIds: Set<string>;
|
|
300
330
|
setEditableComponentIds: (ids: Set<string>) => void;
|
|
@@ -367,15 +397,32 @@ declare const useBuild: (name?: string) => {
|
|
|
367
397
|
};
|
|
368
398
|
|
|
369
399
|
declare const useRemodel: () => {
|
|
370
|
-
handleRemodel: (componentName?: string) =>
|
|
400
|
+
handleRemodel: (componentName?: string) => {
|
|
401
|
+
id: string;
|
|
402
|
+
version: string;
|
|
403
|
+
softComponent: {
|
|
404
|
+
fields: _measured_puck.Fields;
|
|
405
|
+
fieldSettings?: Record<string, any>;
|
|
406
|
+
defaultProps: DefaultComponentProps;
|
|
407
|
+
rootProps?: Record<string, any>;
|
|
408
|
+
components: SoftSubComponent;
|
|
409
|
+
slots: {
|
|
410
|
+
[slot: string]: DefaultComponentProps;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
} | {
|
|
414
|
+
id: string;
|
|
415
|
+
version: string;
|
|
416
|
+
softComponent?: undefined;
|
|
417
|
+
} | null;
|
|
371
418
|
canRemodel: (componentName?: string) => boolean;
|
|
372
419
|
};
|
|
373
420
|
|
|
374
421
|
declare const useComplete: () => {
|
|
375
|
-
handleComplete: () =>
|
|
422
|
+
handleComplete: () => CompletedComponentResult | null;
|
|
376
423
|
canComplete: boolean;
|
|
377
|
-
newComponent:
|
|
378
|
-
setNewComponent: React$1.Dispatch<React$1.SetStateAction<
|
|
424
|
+
newComponent: CompletedComponentResult | null;
|
|
425
|
+
setNewComponent: React$1.Dispatch<React$1.SetStateAction<CompletedComponentResult | null>>;
|
|
379
426
|
};
|
|
380
427
|
|
|
381
428
|
declare const useCancel: () => {
|
|
@@ -383,7 +430,7 @@ declare const useCancel: () => {
|
|
|
383
430
|
canCancel: boolean;
|
|
384
431
|
};
|
|
385
432
|
|
|
386
|
-
declare const useInspect: (
|
|
433
|
+
declare const useInspect: (component: CompletedComponentResult | null) => void;
|
|
387
434
|
|
|
388
435
|
declare const useDecompose: () => {
|
|
389
436
|
handleDecompose: (componentData?: ComponentData) => void;
|