@netlisian/softconfig 0.1.1 → 0.1.2
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.css +91 -34
- package/dist/puck/index.d.mts +30 -8
- package/dist/puck/index.d.ts +30 -8
- package/dist/puck/index.js +150 -22
- package/dist/puck/index.mjs +147 -22
- package/package.json +1 -1
package/dist/puck/index.css
CHANGED
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
margin: 0;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/
|
|
123
|
-
.
|
|
122
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/DrawerItem.module.css/#css-module-data */
|
|
123
|
+
._DrawerItem_29z19_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
|
-
.
|
|
135
|
+
._DrawerItem--insertDisabled_29z19_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
|
-
.
|
|
141
|
+
._DrawerItem-content_29z19_21 {
|
|
142
142
|
flex: 1;
|
|
143
143
|
display: flex;
|
|
144
144
|
flex-direction: column;
|
|
@@ -147,53 +147,53 @@
|
|
|
147
147
|
white-space: nowrap;
|
|
148
148
|
overflow-x: hidden;
|
|
149
149
|
}
|
|
150
|
-
.
|
|
150
|
+
._DrawerItem-name_29z19_31 {
|
|
151
151
|
font-weight: 400;
|
|
152
152
|
}
|
|
153
|
-
.
|
|
153
|
+
._DrawerItem-version_29z19_35 {
|
|
154
154
|
font-size: 10px;
|
|
155
155
|
color: var(--puck-color-grey-05);
|
|
156
156
|
}
|
|
157
|
-
.
|
|
157
|
+
._DrawerItem-actions_29z19_40 {
|
|
158
158
|
display: flex;
|
|
159
159
|
align-items: center;
|
|
160
160
|
gap: 8px;
|
|
161
161
|
}
|
|
162
|
-
.
|
|
162
|
+
._DrawerItem-settingsButton_29z19_46 {
|
|
163
163
|
opacity: 0;
|
|
164
164
|
transition: opacity 120ms ease;
|
|
165
165
|
color: var(--puck-color-grey-05);
|
|
166
166
|
}
|
|
167
|
-
.
|
|
167
|
+
._DrawerItem_29z19_1:hover ._DrawerItem-settingsButton_29z19_46 {
|
|
168
168
|
opacity: 1;
|
|
169
169
|
}
|
|
170
|
-
.
|
|
170
|
+
._DrawerItem-grip_29z19_56 {
|
|
171
171
|
color: var(--puck-color-grey-05);
|
|
172
172
|
display: flex;
|
|
173
173
|
align-items: center;
|
|
174
174
|
}
|
|
175
|
-
.
|
|
175
|
+
._DrawerItem-modal_29z19_63 {
|
|
176
176
|
background: var(--puck-color-white);
|
|
177
177
|
display: flex;
|
|
178
178
|
flex-direction: column;
|
|
179
179
|
height: 100%;
|
|
180
180
|
}
|
|
181
|
-
.
|
|
181
|
+
._DrawerItem-modalHeader_29z19_70 {
|
|
182
182
|
padding: 24px 32px;
|
|
183
183
|
border-bottom: 1px solid var(--puck-color-grey-09);
|
|
184
184
|
}
|
|
185
|
-
.
|
|
185
|
+
._DrawerItem-modalTitle_29z19_75 {
|
|
186
186
|
margin: 0 0 4px 0;
|
|
187
187
|
font-size: 24px;
|
|
188
188
|
font-weight: 600;
|
|
189
189
|
color: var(--puck-color-black);
|
|
190
190
|
}
|
|
191
|
-
.
|
|
191
|
+
._DrawerItem-modalSubtitle_29z19_82 {
|
|
192
192
|
margin: 0;
|
|
193
193
|
font-size: 14px;
|
|
194
194
|
color: var(--puck-color-grey-04);
|
|
195
195
|
}
|
|
196
|
-
.
|
|
196
|
+
._DrawerItem-modalBody_29z19_88 {
|
|
197
197
|
flex: 1;
|
|
198
198
|
padding: 32px;
|
|
199
199
|
overflow-y: auto;
|
|
@@ -201,28 +201,28 @@
|
|
|
201
201
|
flex-direction: column;
|
|
202
202
|
gap: 32px;
|
|
203
203
|
}
|
|
204
|
-
.
|
|
204
|
+
._DrawerItem-section_29z19_97 {
|
|
205
205
|
display: flex;
|
|
206
206
|
flex-direction: column;
|
|
207
207
|
gap: 16px;
|
|
208
208
|
}
|
|
209
|
-
.
|
|
209
|
+
._DrawerItem-sectionTitle_29z19_103 {
|
|
210
210
|
margin: 0;
|
|
211
211
|
font-size: 16px;
|
|
212
212
|
font-weight: 600;
|
|
213
213
|
color: var(--puck-color-black);
|
|
214
214
|
}
|
|
215
|
-
.
|
|
215
|
+
._DrawerItem-sectionDescription_29z19_110 {
|
|
216
216
|
margin: 0;
|
|
217
217
|
font-size: 14px;
|
|
218
218
|
color: var(--puck-color-grey-04);
|
|
219
219
|
}
|
|
220
|
-
.
|
|
220
|
+
._DrawerItem-versionList_29z19_116 {
|
|
221
221
|
display: flex;
|
|
222
222
|
flex-direction: column;
|
|
223
223
|
gap: 8px;
|
|
224
224
|
}
|
|
225
|
-
.
|
|
225
|
+
._DrawerItem-versionRow_29z19_122 {
|
|
226
226
|
display: flex;
|
|
227
227
|
justify-content: space-between;
|
|
228
228
|
align-items: center;
|
|
@@ -232,26 +232,26 @@
|
|
|
232
232
|
background: var(--puck-color-white);
|
|
233
233
|
transition: all 150ms ease;
|
|
234
234
|
}
|
|
235
|
-
.
|
|
235
|
+
._DrawerItem-versionRow--isDefault_29z19_133 {
|
|
236
236
|
border-color: var(--puck-color-azure-07);
|
|
237
237
|
background: var(--puck-color-azure-10);
|
|
238
238
|
}
|
|
239
|
-
.
|
|
239
|
+
._DrawerItem-versionRow--isMarkedForDeletion_29z19_138 {
|
|
240
240
|
opacity: 0.6;
|
|
241
241
|
background: var(--puck-color-grey-11);
|
|
242
242
|
}
|
|
243
|
-
.
|
|
243
|
+
._DrawerItem-versionInfo_29z19_143 {
|
|
244
244
|
display: flex;
|
|
245
245
|
align-items: center;
|
|
246
246
|
gap: 12px;
|
|
247
247
|
flex: 1;
|
|
248
248
|
}
|
|
249
|
-
.
|
|
249
|
+
._DrawerItem-versionNumber_29z19_150 {
|
|
250
250
|
font-size: 14px;
|
|
251
251
|
font-weight: 500;
|
|
252
252
|
color: var(--puck-color-black);
|
|
253
253
|
}
|
|
254
|
-
.
|
|
254
|
+
._DrawerItem-defaultBadge_29z19_156 {
|
|
255
255
|
font-size: 11px;
|
|
256
256
|
padding: 3px 8px;
|
|
257
257
|
border-radius: 4px;
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
text-transform: uppercase;
|
|
262
262
|
letter-spacing: 0.5px;
|
|
263
263
|
}
|
|
264
|
-
.
|
|
264
|
+
._DrawerItem-deleteBadge_29z19_167 {
|
|
265
265
|
font-size: 11px;
|
|
266
266
|
padding: 3px 8px;
|
|
267
267
|
border-radius: 4px;
|
|
@@ -271,15 +271,15 @@
|
|
|
271
271
|
text-transform: uppercase;
|
|
272
272
|
letter-spacing: 0.5px;
|
|
273
273
|
}
|
|
274
|
-
.
|
|
274
|
+
._DrawerItem-versionActions_29z19_178 {
|
|
275
275
|
display: flex;
|
|
276
276
|
gap: 8px;
|
|
277
277
|
align-items: center;
|
|
278
278
|
}
|
|
279
|
-
.
|
|
279
|
+
._DrawerItem-migrationOptions_29z19_184 {
|
|
280
280
|
width: 100%;
|
|
281
281
|
}
|
|
282
|
-
.
|
|
282
|
+
._DrawerItem-select_29z19_188 {
|
|
283
283
|
width: 100%;
|
|
284
284
|
padding: 10px 12px;
|
|
285
285
|
border: 1px solid var(--puck-color-grey-09);
|
|
@@ -290,14 +290,14 @@
|
|
|
290
290
|
cursor: pointer;
|
|
291
291
|
transition: border-color 150ms ease;
|
|
292
292
|
}
|
|
293
|
-
.
|
|
293
|
+
._DrawerItem-select_29z19_188:hover {
|
|
294
294
|
border-color: var(--puck-color-grey-07);
|
|
295
295
|
}
|
|
296
|
-
.
|
|
296
|
+
._DrawerItem-select_29z19_188:focus {
|
|
297
297
|
outline: none;
|
|
298
298
|
border-color: var(--puck-color-azure-07);
|
|
299
299
|
}
|
|
300
|
-
.
|
|
300
|
+
._DrawerItem-modalFooter_29z19_209 {
|
|
301
301
|
padding: 20px 32px;
|
|
302
302
|
border-top: 1px solid var(--puck-color-grey-09);
|
|
303
303
|
display: flex;
|
|
@@ -305,11 +305,11 @@
|
|
|
305
305
|
align-items: center;
|
|
306
306
|
background: var(--puck-color-grey-11);
|
|
307
307
|
}
|
|
308
|
-
.
|
|
308
|
+
._DrawerItem-footerLeft_29z19_218 {
|
|
309
309
|
display: flex;
|
|
310
310
|
gap: 12px;
|
|
311
311
|
}
|
|
312
|
-
.
|
|
312
|
+
._DrawerItem-footerRight_29z19_223 {
|
|
313
313
|
display: flex;
|
|
314
314
|
gap: 12px;
|
|
315
315
|
}
|
|
@@ -341,3 +341,60 @@
|
|
|
341
341
|
flex-direction: column;
|
|
342
342
|
max-height: 90dvh;
|
|
343
343
|
}
|
|
344
|
+
|
|
345
|
+
/* css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/Drawer.module.css/#css-module-data */
|
|
346
|
+
._Drawer_12zq5_1 {
|
|
347
|
+
display: flex;
|
|
348
|
+
flex-direction: column;
|
|
349
|
+
gap: 0;
|
|
350
|
+
}
|
|
351
|
+
._Drawer-category_12zq5_7 {
|
|
352
|
+
max-width: 100%;
|
|
353
|
+
}
|
|
354
|
+
._Drawer-category_12zq5_7 + ._Drawer-category_12zq5_7 {
|
|
355
|
+
margin-top: 4px;
|
|
356
|
+
}
|
|
357
|
+
._Drawer-category--isExpanded_12zq5_15 + ._Drawer-category_12zq5_7 {
|
|
358
|
+
margin-top: 12px;
|
|
359
|
+
}
|
|
360
|
+
._Drawer-categoryContent_12zq5_19 {
|
|
361
|
+
display: none;
|
|
362
|
+
}
|
|
363
|
+
._Drawer-category--isExpanded_12zq5_15 > ._Drawer-categoryContent_12zq5_19 {
|
|
364
|
+
display: block;
|
|
365
|
+
}
|
|
366
|
+
._Drawer-categoryTitle_12zq5_27 {
|
|
367
|
+
background-color: transparent;
|
|
368
|
+
border: 0;
|
|
369
|
+
color: var(--puck-color-grey-05);
|
|
370
|
+
cursor: pointer;
|
|
371
|
+
display: flex;
|
|
372
|
+
font: inherit;
|
|
373
|
+
font-size: var(--puck-font-size-xxxs);
|
|
374
|
+
list-style: none;
|
|
375
|
+
margin-bottom: 6px;
|
|
376
|
+
padding: 8px;
|
|
377
|
+
text-transform: uppercase;
|
|
378
|
+
transition: background-color 50ms ease-in, color 50ms ease-in;
|
|
379
|
+
gap: 4px;
|
|
380
|
+
border-radius: 4px;
|
|
381
|
+
width: 100%;
|
|
382
|
+
}
|
|
383
|
+
._Drawer-categoryTitle_12zq5_27:focus-visible {
|
|
384
|
+
outline: 2px solid var(--puck-color-azure-05);
|
|
385
|
+
outline-offset: 2px;
|
|
386
|
+
}
|
|
387
|
+
@media (hover: hover) and (pointer: fine) {
|
|
388
|
+
._Drawer-categoryTitle_12zq5_27:hover {
|
|
389
|
+
background-color: var(--puck-color-azure-11);
|
|
390
|
+
color: var(--puck-color-azure-04);
|
|
391
|
+
transition: none;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
._Drawer-categoryTitle_12zq5_27:active {
|
|
395
|
+
background-color: var(--puck-color-azure-10);
|
|
396
|
+
transition: none;
|
|
397
|
+
}
|
|
398
|
+
._Drawer-categoryTitleIcon_12zq5_63 {
|
|
399
|
+
margin-inline-start: auto;
|
|
400
|
+
}
|
package/dist/puck/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
type BuildersSlice = {
|
|
@@ -361,7 +361,7 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, overr
|
|
|
361
361
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
362
362
|
declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
363
363
|
|
|
364
|
-
declare const useBuild: () => {
|
|
364
|
+
declare const useBuild: (name?: string) => {
|
|
365
365
|
handleBuild: () => void;
|
|
366
366
|
canBuild: boolean;
|
|
367
367
|
};
|
|
@@ -375,7 +375,7 @@ declare const useComplete: () => {
|
|
|
375
375
|
handleComplete: () => string | null;
|
|
376
376
|
canComplete: boolean;
|
|
377
377
|
newComponent: string | null;
|
|
378
|
-
setNewComponent:
|
|
378
|
+
setNewComponent: React$1.Dispatch<React$1.SetStateAction<string | null>>;
|
|
379
379
|
};
|
|
380
380
|
|
|
381
381
|
declare const useCancel: () => {
|
|
@@ -404,20 +404,42 @@ declare const useSetDefaultVersion: () => {
|
|
|
404
404
|
|
|
405
405
|
declare const Header: ({ onPublish, children, }: {
|
|
406
406
|
onPublish?: (data: Data, softComponents: SoftComponents) => void;
|
|
407
|
-
children:
|
|
407
|
+
children: React__default.ReactNode;
|
|
408
408
|
}) => react_jsx_runtime.JSX.Element;
|
|
409
409
|
|
|
410
410
|
declare const ActionBarOverride: (props: {
|
|
411
411
|
label?: string;
|
|
412
|
-
parentAction?:
|
|
413
|
-
children?:
|
|
412
|
+
parentAction?: React__default.ReactNode;
|
|
413
|
+
children?: React__default.ReactNode;
|
|
414
414
|
}) => react_jsx_runtime.JSX.Element;
|
|
415
415
|
|
|
416
|
+
declare const DrawerItem: (props: {
|
|
417
|
+
name: string;
|
|
418
|
+
children: React.ReactNode;
|
|
419
|
+
}) => React.ReactElement;
|
|
420
|
+
/** @deprecated Use DrawerItem instead */
|
|
416
421
|
declare const ComponentItem: (props: {
|
|
417
422
|
name: string;
|
|
418
423
|
children: React.ReactNode;
|
|
419
424
|
}) => React.ReactElement;
|
|
420
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Drawer — custom drawer override for the Puck editor.
|
|
428
|
+
*
|
|
429
|
+
* Reads config.categories from puck and renders a collapsible section per
|
|
430
|
+
* category, each containing a PuckDrawer with DrawerItem as the item
|
|
431
|
+
* renderer (soft-config versioning, demolish, and settings modal included).
|
|
432
|
+
* Components not assigned to any category render under "Other components".
|
|
433
|
+
*
|
|
434
|
+
* Falls back to a flat list when no categories are defined.
|
|
435
|
+
*
|
|
436
|
+
* Usage:
|
|
437
|
+
* overrides={{ drawer: Drawer }}
|
|
438
|
+
*/
|
|
439
|
+
declare const Drawer: (_props: {
|
|
440
|
+
children?: React__default.ReactNode;
|
|
441
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
442
|
+
|
|
421
443
|
type NotificationHandler = (message: string, type: "error" | "success") => void;
|
|
422
444
|
declare const setNotificationHandler: (handler: NotificationHandler) => void;
|
|
423
445
|
declare const notify: {
|
|
@@ -472,4 +494,4 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
472
494
|
isOpen: boolean;
|
|
473
495
|
}) => react_jsx_runtime.JSX.Element;
|
|
474
496
|
|
|
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 };
|
|
497
|
+
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,8 +1,8 @@
|
|
|
1
1
|
import * as zustand from 'zustand';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { History, AppState, PuckApi, ComponentData, ComponentConfig, DefaultComponentProps, Field, Config, Fields, RootData, AsFieldProps, WithChildren, Metadata, ResolveDataTrigger, PuckAction, Data } from '@measured/puck';
|
|
4
|
-
import * as
|
|
5
|
-
import
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default, { ReactNode, ReactElement } from 'react';
|
|
6
6
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
type BuildersSlice = {
|
|
@@ -361,7 +361,7 @@ declare const SoftConfigProvider: ({ children, hardConfig, softComponents, overr
|
|
|
361
361
|
declare const createUseSoftConfig: () => <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
362
362
|
declare const useSoftConfig: <T>(selector: (state: AppStore) => T, equalityFn?: (a: T, b: T) => boolean) => T;
|
|
363
363
|
|
|
364
|
-
declare const useBuild: () => {
|
|
364
|
+
declare const useBuild: (name?: string) => {
|
|
365
365
|
handleBuild: () => void;
|
|
366
366
|
canBuild: boolean;
|
|
367
367
|
};
|
|
@@ -375,7 +375,7 @@ declare const useComplete: () => {
|
|
|
375
375
|
handleComplete: () => string | null;
|
|
376
376
|
canComplete: boolean;
|
|
377
377
|
newComponent: string | null;
|
|
378
|
-
setNewComponent:
|
|
378
|
+
setNewComponent: React$1.Dispatch<React$1.SetStateAction<string | null>>;
|
|
379
379
|
};
|
|
380
380
|
|
|
381
381
|
declare const useCancel: () => {
|
|
@@ -404,20 +404,42 @@ declare const useSetDefaultVersion: () => {
|
|
|
404
404
|
|
|
405
405
|
declare const Header: ({ onPublish, children, }: {
|
|
406
406
|
onPublish?: (data: Data, softComponents: SoftComponents) => void;
|
|
407
|
-
children:
|
|
407
|
+
children: React__default.ReactNode;
|
|
408
408
|
}) => react_jsx_runtime.JSX.Element;
|
|
409
409
|
|
|
410
410
|
declare const ActionBarOverride: (props: {
|
|
411
411
|
label?: string;
|
|
412
|
-
parentAction?:
|
|
413
|
-
children?:
|
|
412
|
+
parentAction?: React__default.ReactNode;
|
|
413
|
+
children?: React__default.ReactNode;
|
|
414
414
|
}) => react_jsx_runtime.JSX.Element;
|
|
415
415
|
|
|
416
|
+
declare const DrawerItem: (props: {
|
|
417
|
+
name: string;
|
|
418
|
+
children: React.ReactNode;
|
|
419
|
+
}) => React.ReactElement;
|
|
420
|
+
/** @deprecated Use DrawerItem instead */
|
|
416
421
|
declare const ComponentItem: (props: {
|
|
417
422
|
name: string;
|
|
418
423
|
children: React.ReactNode;
|
|
419
424
|
}) => React.ReactElement;
|
|
420
425
|
|
|
426
|
+
/**
|
|
427
|
+
* Drawer — custom drawer override for the Puck editor.
|
|
428
|
+
*
|
|
429
|
+
* Reads config.categories from puck and renders a collapsible section per
|
|
430
|
+
* category, each containing a PuckDrawer with DrawerItem as the item
|
|
431
|
+
* renderer (soft-config versioning, demolish, and settings modal included).
|
|
432
|
+
* Components not assigned to any category render under "Other components".
|
|
433
|
+
*
|
|
434
|
+
* Falls back to a flat list when no categories are defined.
|
|
435
|
+
*
|
|
436
|
+
* Usage:
|
|
437
|
+
* overrides={{ drawer: Drawer }}
|
|
438
|
+
*/
|
|
439
|
+
declare const Drawer: (_props: {
|
|
440
|
+
children?: React__default.ReactNode;
|
|
441
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
442
|
+
|
|
421
443
|
type NotificationHandler = (message: string, type: "error" | "success") => void;
|
|
422
444
|
declare const setNotificationHandler: (handler: NotificationHandler) => void;
|
|
423
445
|
declare const notify: {
|
|
@@ -472,4 +494,4 @@ declare const Modal: ({ children, onClose, isOpen, }: {
|
|
|
472
494
|
isOpen: boolean;
|
|
473
495
|
}) => react_jsx_runtime.JSX.Element;
|
|
474
496
|
|
|
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 };
|
|
497
|
+
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.js
CHANGED
|
@@ -82,6 +82,9 @@ var puck_exports = {};
|
|
|
82
82
|
__export(puck_exports, {
|
|
83
83
|
ActionBar: () => ActionBarOverride,
|
|
84
84
|
ComponentItem: () => ComponentItem,
|
|
85
|
+
ComponentList: () => Drawer,
|
|
86
|
+
Drawer: () => Drawer,
|
|
87
|
+
DrawerItem: () => DrawerItem,
|
|
85
88
|
Header: () => Header,
|
|
86
89
|
Modal: () => Modal,
|
|
87
90
|
SoftConfigProvider: () => SoftConfigProvider,
|
|
@@ -1447,19 +1450,22 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
1447
1450
|
}
|
|
1448
1451
|
puckDispatch({
|
|
1449
1452
|
type: "set",
|
|
1450
|
-
state: (previous) =>
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1453
|
+
state: (previous) => {
|
|
1454
|
+
var _a;
|
|
1455
|
+
return {
|
|
1456
|
+
ui: __spreadProps(__spreadValues({}, previous.ui), {
|
|
1457
|
+
itemSelector: null
|
|
1458
|
+
}),
|
|
1459
|
+
data: __spreadProps(__spreadValues({}, previous.data), {
|
|
1460
|
+
root: __spreadProps(__spreadValues({}, previous.data.root), {
|
|
1461
|
+
props: __spreadProps(__spreadValues({}, (_a = previous.data.root) == null ? void 0 : _a.props), {
|
|
1462
|
+
_name: name || "New Soft Component"
|
|
1463
|
+
})
|
|
1464
|
+
})
|
|
1465
|
+
// content: [{ ...selectedItem }],
|
|
1466
|
+
})
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1463
1469
|
});
|
|
1464
1470
|
const config = __spreadValues({}, get().softConfig);
|
|
1465
1471
|
const overrides = get().overrides;
|
|
@@ -2572,7 +2578,7 @@ var useActionEvent = () => {
|
|
|
2572
2578
|
|
|
2573
2579
|
// src/puck/actions/useBuild.tsx
|
|
2574
2580
|
var useCustomPuck2 = (0, import_puck5.createUsePuck)();
|
|
2575
|
-
var useBuild = () => {
|
|
2581
|
+
var useBuild = (name) => {
|
|
2576
2582
|
const build = useSoftConfig((s) => s.builder.build);
|
|
2577
2583
|
const history = useCustomPuck2((s) => s.history.histories);
|
|
2578
2584
|
const selectedItem = useCustomPuck2((s) => s.selectedItem);
|
|
@@ -2586,7 +2592,7 @@ var useBuild = () => {
|
|
|
2586
2592
|
return;
|
|
2587
2593
|
}
|
|
2588
2594
|
try {
|
|
2589
|
-
build(history, selectedItem, itemSelector, dispatch);
|
|
2595
|
+
build(history, selectedItem, itemSelector, dispatch, name);
|
|
2590
2596
|
if (selectedItem == null ? void 0 : selectedItem.type) {
|
|
2591
2597
|
void triggerAction({
|
|
2592
2598
|
type: "build",
|
|
@@ -3009,7 +3015,7 @@ var getClassName3 = get_class_name_factory_default("ActionBar", ActionBar_module
|
|
|
3009
3015
|
var usePuck2 = (0, import_puck14.createUsePuck)();
|
|
3010
3016
|
var ActionBarOverride = (props) => {
|
|
3011
3017
|
var _a;
|
|
3012
|
-
const { handleBuild } = useBuild();
|
|
3018
|
+
const { handleBuild } = useBuild("Custom Name");
|
|
3013
3019
|
const { handleRemodel } = useRemodel();
|
|
3014
3020
|
const { handleDecompose } = useDecompose();
|
|
3015
3021
|
const overrides = useSoftConfig((s) => s.overrides);
|
|
@@ -3066,7 +3072,7 @@ var ActionBarOverride = (props) => {
|
|
|
3066
3072
|
] }) });
|
|
3067
3073
|
};
|
|
3068
3074
|
|
|
3069
|
-
// src/puck/overrides/
|
|
3075
|
+
// src/puck/overrides/DrawerItem.tsx
|
|
3070
3076
|
var import_react11 = require("react");
|
|
3071
3077
|
var import_puck15 = require("@measured/puck");
|
|
3072
3078
|
var import_lucide_react2 = require("lucide-react");
|
|
@@ -3088,8 +3094,8 @@ var confirm = (message) => __async(null, null, function* () {
|
|
|
3088
3094
|
}
|
|
3089
3095
|
});
|
|
3090
3096
|
|
|
3091
|
-
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/
|
|
3092
|
-
var
|
|
3097
|
+
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/DrawerItem.module.css#css-module
|
|
3098
|
+
var DrawerItem_module_default = { "DrawerItem": "_DrawerItem_29z19_1", "DrawerItem--insertDisabled": "_DrawerItem--insertDisabled_29z19_14", "DrawerItem-content": "_DrawerItem-content_29z19_21", "DrawerItem-name": "_DrawerItem-name_29z19_31", "DrawerItem-version": "_DrawerItem-version_29z19_35", "DrawerItem-actions": "_DrawerItem-actions_29z19_40", "DrawerItem-settingsButton": "_DrawerItem-settingsButton_29z19_46", "DrawerItem-grip": "_DrawerItem-grip_29z19_56", "DrawerItem-modal": "_DrawerItem-modal_29z19_63", "DrawerItem-modalHeader": "_DrawerItem-modalHeader_29z19_70", "DrawerItem-modalTitle": "_DrawerItem-modalTitle_29z19_75", "DrawerItem-modalSubtitle": "_DrawerItem-modalSubtitle_29z19_82", "DrawerItem-modalBody": "_DrawerItem-modalBody_29z19_88", "DrawerItem-section": "_DrawerItem-section_29z19_97", "DrawerItem-sectionTitle": "_DrawerItem-sectionTitle_29z19_103", "DrawerItem-sectionDescription": "_DrawerItem-sectionDescription_29z19_110", "DrawerItem-versionList": "_DrawerItem-versionList_29z19_116", "DrawerItem-versionRow": "_DrawerItem-versionRow_29z19_122", "DrawerItem-versionRow--isDefault": "_DrawerItem-versionRow--isDefault_29z19_133", "DrawerItem-versionRow--isMarkedForDeletion": "_DrawerItem-versionRow--isMarkedForDeletion_29z19_138", "DrawerItem-versionInfo": "_DrawerItem-versionInfo_29z19_143", "DrawerItem-versionNumber": "_DrawerItem-versionNumber_29z19_150", "DrawerItem-defaultBadge": "_DrawerItem-defaultBadge_29z19_156", "DrawerItem-deleteBadge": "_DrawerItem-deleteBadge_29z19_167", "DrawerItem-versionActions": "_DrawerItem-versionActions_29z19_178", "DrawerItem-migrationOptions": "_DrawerItem-migrationOptions_29z19_184", "DrawerItem-select": "_DrawerItem-select_29z19_188", "DrawerItem-modalFooter": "_DrawerItem-modalFooter_29z19_209", "DrawerItem-footerLeft": "_DrawerItem-footerLeft_29z19_218", "DrawerItem-footerRight": "_DrawerItem-footerRight_29z19_223" };
|
|
3093
3099
|
|
|
3094
3100
|
// src/puck/components/modal/index.tsx
|
|
3095
3101
|
var import_react10 = require("react");
|
|
@@ -3126,12 +3132,12 @@ var Modal = ({
|
|
|
3126
3132
|
);
|
|
3127
3133
|
};
|
|
3128
3134
|
|
|
3129
|
-
// src/puck/overrides/
|
|
3135
|
+
// src/puck/overrides/DrawerItem.tsx
|
|
3130
3136
|
var import_shallow2 = require("zustand/shallow");
|
|
3131
3137
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3132
|
-
var getClassName5 = get_class_name_factory_default("
|
|
3138
|
+
var getClassName5 = get_class_name_factory_default("DrawerItem", DrawerItem_module_default);
|
|
3133
3139
|
var usePuck3 = (0, import_puck15.createUsePuck)();
|
|
3134
|
-
var
|
|
3140
|
+
var DrawerItem = (props) => {
|
|
3135
3141
|
const componentMeta = useSoftConfig((s) => s.softComponents[props.name]);
|
|
3136
3142
|
const displayName = (componentMeta == null ? void 0 : componentMeta.name) || props.name;
|
|
3137
3143
|
const softComponents = new Set(
|
|
@@ -3280,6 +3286,7 @@ var ComponentItem = (props) => {
|
|
|
3280
3286
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getClassName5("migrationOptions"), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
3281
3287
|
"select",
|
|
3282
3288
|
{
|
|
3289
|
+
title: "Select migration version",
|
|
3283
3290
|
className: getClassName5("select"),
|
|
3284
3291
|
value: migrateVersionMap[Array.from(versionsToDelete)[0]] || "decompose",
|
|
3285
3292
|
onChange: (e) => {
|
|
@@ -3325,6 +3332,124 @@ var ComponentItem = (props) => {
|
|
|
3325
3332
|
}
|
|
3326
3333
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_jsx_runtime11.Fragment, { children: props.children });
|
|
3327
3334
|
};
|
|
3335
|
+
var ComponentItem = DrawerItem;
|
|
3336
|
+
|
|
3337
|
+
// src/puck/overrides/Drawer.tsx
|
|
3338
|
+
var import_react12 = require("react");
|
|
3339
|
+
var import_puck16 = require("@measured/puck");
|
|
3340
|
+
var import_lucide_react3 = require("lucide-react");
|
|
3341
|
+
|
|
3342
|
+
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/Drawer.module.css#css-module
|
|
3343
|
+
var Drawer_module_default = { "Drawer": "_Drawer_12zq5_1", "Drawer-category": "_Drawer-category_12zq5_7", "Drawer-category--isExpanded": "_Drawer-category--isExpanded_12zq5_15", "Drawer-categoryContent": "_Drawer-categoryContent_12zq5_19", "Drawer-categoryTitle": "_Drawer-categoryTitle_12zq5_27", "Drawer-categoryTitleIcon": "_Drawer-categoryTitleIcon_12zq5_63" };
|
|
3344
|
+
|
|
3345
|
+
// src/puck/overrides/Drawer.tsx
|
|
3346
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
3347
|
+
var getClassName6 = get_class_name_factory_default("Drawer", Drawer_module_default);
|
|
3348
|
+
var getCategoryClassName = get_class_name_factory_default("Drawer-category", Drawer_module_default);
|
|
3349
|
+
var usePuck4 = (0, import_puck16.createUsePuck)();
|
|
3350
|
+
var CategorySection = ({
|
|
3351
|
+
id,
|
|
3352
|
+
title,
|
|
3353
|
+
componentKeys,
|
|
3354
|
+
getPermissions,
|
|
3355
|
+
expanded,
|
|
3356
|
+
onToggle
|
|
3357
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getCategoryClassName({ isExpanded: expanded }), children: [
|
|
3358
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
3359
|
+
"button",
|
|
3360
|
+
{
|
|
3361
|
+
type: "button",
|
|
3362
|
+
className: getClassName6("categoryTitle"),
|
|
3363
|
+
onClick: () => onToggle(id),
|
|
3364
|
+
title: expanded ? `Collapse ${title}` : `Expand ${title}`,
|
|
3365
|
+
children: [
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { children: title }),
|
|
3367
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: getClassName6("categoryTitleIcon"), children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ChevronUp, { size: 12 }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react3.ChevronDown, { size: 12 }) })
|
|
3368
|
+
]
|
|
3369
|
+
}
|
|
3370
|
+
),
|
|
3371
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassName6("categoryContent"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_puck16.Drawer, { children: componentKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3372
|
+
import_puck16.Drawer.Item,
|
|
3373
|
+
{
|
|
3374
|
+
name: key,
|
|
3375
|
+
isDragDisabled: !getPermissions({ type: key }).insert,
|
|
3376
|
+
children: DrawerItem
|
|
3377
|
+
},
|
|
3378
|
+
key
|
|
3379
|
+
)) }) })
|
|
3380
|
+
] });
|
|
3381
|
+
var Drawer = (_props) => {
|
|
3382
|
+
var _a, _b;
|
|
3383
|
+
const config = usePuck4((s) => s.config);
|
|
3384
|
+
const getPermissions = usePuck4((s) => s.getPermissions);
|
|
3385
|
+
const categories = (_a = config.categories) != null ? _a : {};
|
|
3386
|
+
const categorised = new Set(
|
|
3387
|
+
Object.values(categories).flatMap((cat) => {
|
|
3388
|
+
var _a2;
|
|
3389
|
+
return (_a2 = cat.components) != null ? _a2 : [];
|
|
3390
|
+
})
|
|
3391
|
+
);
|
|
3392
|
+
const allKeys = Object.keys(config.components);
|
|
3393
|
+
const otherKeys = allKeys.filter((k) => !categorised.has(k));
|
|
3394
|
+
const categoryEntries = Object.entries(categories).filter(
|
|
3395
|
+
([, cat]) => cat.visible !== false
|
|
3396
|
+
);
|
|
3397
|
+
const [expanded, setExpanded] = (0, import_react12.useState)(() => {
|
|
3398
|
+
const init = {};
|
|
3399
|
+
categoryEntries.forEach(([id, cat]) => {
|
|
3400
|
+
init[id] = cat.defaultExpanded !== false;
|
|
3401
|
+
});
|
|
3402
|
+
if (otherKeys.length > 0) init["__other__"] = true;
|
|
3403
|
+
return init;
|
|
3404
|
+
});
|
|
3405
|
+
const toggle = (id) => setExpanded((prev) => __spreadProps(__spreadValues({}, prev), { [id]: !prev[id] }));
|
|
3406
|
+
if (categoryEntries.length === 0) {
|
|
3407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_puck16.Drawer, { children: allKeys.map((key) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3408
|
+
import_puck16.Drawer.Item,
|
|
3409
|
+
{
|
|
3410
|
+
name: key,
|
|
3411
|
+
isDragDisabled: !getPermissions({ type: key }).insert,
|
|
3412
|
+
children: DrawerItem
|
|
3413
|
+
},
|
|
3414
|
+
key
|
|
3415
|
+
)) });
|
|
3416
|
+
}
|
|
3417
|
+
console.log(
|
|
3418
|
+
getClassName6(),
|
|
3419
|
+
getCategoryClassName(),
|
|
3420
|
+
getCategoryClassName({ isExpanded: true })
|
|
3421
|
+
);
|
|
3422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: getClassName6(), children: [
|
|
3423
|
+
categoryEntries.map(([id, cat]) => {
|
|
3424
|
+
var _a2, _b2, _c;
|
|
3425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3426
|
+
CategorySection,
|
|
3427
|
+
{
|
|
3428
|
+
id,
|
|
3429
|
+
title: (_a2 = cat.title) != null ? _a2 : id,
|
|
3430
|
+
componentKeys: ((_b2 = cat.components) != null ? _b2 : []).filter(
|
|
3431
|
+
(k) => k in config.components
|
|
3432
|
+
),
|
|
3433
|
+
getPermissions,
|
|
3434
|
+
expanded: (_c = expanded[id]) != null ? _c : true,
|
|
3435
|
+
onToggle: toggle
|
|
3436
|
+
},
|
|
3437
|
+
id
|
|
3438
|
+
);
|
|
3439
|
+
}),
|
|
3440
|
+
otherKeys.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
3441
|
+
CategorySection,
|
|
3442
|
+
{
|
|
3443
|
+
id: "__other__",
|
|
3444
|
+
title: "Other components",
|
|
3445
|
+
componentKeys: otherKeys,
|
|
3446
|
+
getPermissions,
|
|
3447
|
+
expanded: (_b = expanded["__other__"]) != null ? _b : true,
|
|
3448
|
+
onToggle: toggle
|
|
3449
|
+
}
|
|
3450
|
+
)
|
|
3451
|
+
] });
|
|
3452
|
+
};
|
|
3328
3453
|
|
|
3329
3454
|
// src/puck/lib/action-callback.ts
|
|
3330
3455
|
var createActionCallback = (validateAction, undo) => {
|
|
@@ -3552,6 +3677,9 @@ var resolveSoftConfig = (data, softComponents, config) => {
|
|
|
3552
3677
|
0 && (module.exports = {
|
|
3553
3678
|
ActionBar,
|
|
3554
3679
|
ComponentItem,
|
|
3680
|
+
ComponentList,
|
|
3681
|
+
Drawer,
|
|
3682
|
+
DrawerItem,
|
|
3555
3683
|
Header,
|
|
3556
3684
|
Modal,
|
|
3557
3685
|
SoftConfigProvider,
|
package/dist/puck/index.mjs
CHANGED
|
@@ -1398,19 +1398,22 @@ var createBuildersSlice = (set, get, initialConfig) => ({
|
|
|
1398
1398
|
}
|
|
1399
1399
|
puckDispatch({
|
|
1400
1400
|
type: "set",
|
|
1401
|
-
state: (previous) =>
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1401
|
+
state: (previous) => {
|
|
1402
|
+
var _a;
|
|
1403
|
+
return {
|
|
1404
|
+
ui: __spreadProps(__spreadValues({}, previous.ui), {
|
|
1405
|
+
itemSelector: null
|
|
1406
|
+
}),
|
|
1407
|
+
data: __spreadProps(__spreadValues({}, previous.data), {
|
|
1408
|
+
root: __spreadProps(__spreadValues({}, previous.data.root), {
|
|
1409
|
+
props: __spreadProps(__spreadValues({}, (_a = previous.data.root) == null ? void 0 : _a.props), {
|
|
1410
|
+
_name: name || "New Soft Component"
|
|
1411
|
+
})
|
|
1412
|
+
})
|
|
1413
|
+
// content: [{ ...selectedItem }],
|
|
1414
|
+
})
|
|
1415
|
+
};
|
|
1416
|
+
}
|
|
1414
1417
|
});
|
|
1415
1418
|
const config = __spreadValues({}, get().softConfig);
|
|
1416
1419
|
const overrides = get().overrides;
|
|
@@ -2523,7 +2526,7 @@ var useActionEvent = () => {
|
|
|
2523
2526
|
|
|
2524
2527
|
// src/puck/actions/useBuild.tsx
|
|
2525
2528
|
var useCustomPuck2 = createUsePuck2();
|
|
2526
|
-
var useBuild = () => {
|
|
2529
|
+
var useBuild = (name) => {
|
|
2527
2530
|
const build = useSoftConfig((s) => s.builder.build);
|
|
2528
2531
|
const history = useCustomPuck2((s) => s.history.histories);
|
|
2529
2532
|
const selectedItem = useCustomPuck2((s) => s.selectedItem);
|
|
@@ -2537,7 +2540,7 @@ var useBuild = () => {
|
|
|
2537
2540
|
return;
|
|
2538
2541
|
}
|
|
2539
2542
|
try {
|
|
2540
|
-
build(history, selectedItem, itemSelector, dispatch);
|
|
2543
|
+
build(history, selectedItem, itemSelector, dispatch, name);
|
|
2541
2544
|
if (selectedItem == null ? void 0 : selectedItem.type) {
|
|
2542
2545
|
void triggerAction({
|
|
2543
2546
|
type: "build",
|
|
@@ -2960,7 +2963,7 @@ var getClassName3 = get_class_name_factory_default("ActionBar", ActionBar_module
|
|
|
2960
2963
|
var usePuck2 = createUsePuck11();
|
|
2961
2964
|
var ActionBarOverride = (props) => {
|
|
2962
2965
|
var _a;
|
|
2963
|
-
const { handleBuild } = useBuild();
|
|
2966
|
+
const { handleBuild } = useBuild("Custom Name");
|
|
2964
2967
|
const { handleRemodel } = useRemodel();
|
|
2965
2968
|
const { handleDecompose } = useDecompose();
|
|
2966
2969
|
const overrides = useSoftConfig((s) => s.overrides);
|
|
@@ -3017,7 +3020,7 @@ var ActionBarOverride = (props) => {
|
|
|
3017
3020
|
] }) });
|
|
3018
3021
|
};
|
|
3019
3022
|
|
|
3020
|
-
// src/puck/overrides/
|
|
3023
|
+
// src/puck/overrides/DrawerItem.tsx
|
|
3021
3024
|
import { useState as useState5 } from "react";
|
|
3022
3025
|
import { Button as Button2, IconButton, createUsePuck as createUsePuck12 } from "@measured/puck";
|
|
3023
3026
|
import { GripVertical, Check, X, Trash2, Cog } from "lucide-react";
|
|
@@ -3039,8 +3042,8 @@ var confirm = (message) => __async(null, null, function* () {
|
|
|
3039
3042
|
}
|
|
3040
3043
|
});
|
|
3041
3044
|
|
|
3042
|
-
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/
|
|
3043
|
-
var
|
|
3045
|
+
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/DrawerItem.module.css#css-module
|
|
3046
|
+
var DrawerItem_module_default = { "DrawerItem": "_DrawerItem_29z19_1", "DrawerItem--insertDisabled": "_DrawerItem--insertDisabled_29z19_14", "DrawerItem-content": "_DrawerItem-content_29z19_21", "DrawerItem-name": "_DrawerItem-name_29z19_31", "DrawerItem-version": "_DrawerItem-version_29z19_35", "DrawerItem-actions": "_DrawerItem-actions_29z19_40", "DrawerItem-settingsButton": "_DrawerItem-settingsButton_29z19_46", "DrawerItem-grip": "_DrawerItem-grip_29z19_56", "DrawerItem-modal": "_DrawerItem-modal_29z19_63", "DrawerItem-modalHeader": "_DrawerItem-modalHeader_29z19_70", "DrawerItem-modalTitle": "_DrawerItem-modalTitle_29z19_75", "DrawerItem-modalSubtitle": "_DrawerItem-modalSubtitle_29z19_82", "DrawerItem-modalBody": "_DrawerItem-modalBody_29z19_88", "DrawerItem-section": "_DrawerItem-section_29z19_97", "DrawerItem-sectionTitle": "_DrawerItem-sectionTitle_29z19_103", "DrawerItem-sectionDescription": "_DrawerItem-sectionDescription_29z19_110", "DrawerItem-versionList": "_DrawerItem-versionList_29z19_116", "DrawerItem-versionRow": "_DrawerItem-versionRow_29z19_122", "DrawerItem-versionRow--isDefault": "_DrawerItem-versionRow--isDefault_29z19_133", "DrawerItem-versionRow--isMarkedForDeletion": "_DrawerItem-versionRow--isMarkedForDeletion_29z19_138", "DrawerItem-versionInfo": "_DrawerItem-versionInfo_29z19_143", "DrawerItem-versionNumber": "_DrawerItem-versionNumber_29z19_150", "DrawerItem-defaultBadge": "_DrawerItem-defaultBadge_29z19_156", "DrawerItem-deleteBadge": "_DrawerItem-deleteBadge_29z19_167", "DrawerItem-versionActions": "_DrawerItem-versionActions_29z19_178", "DrawerItem-migrationOptions": "_DrawerItem-migrationOptions_29z19_184", "DrawerItem-select": "_DrawerItem-select_29z19_188", "DrawerItem-modalFooter": "_DrawerItem-modalFooter_29z19_209", "DrawerItem-footerLeft": "_DrawerItem-footerLeft_29z19_218", "DrawerItem-footerRight": "_DrawerItem-footerRight_29z19_223" };
|
|
3044
3047
|
|
|
3045
3048
|
// src/puck/components/modal/index.tsx
|
|
3046
3049
|
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
@@ -3077,12 +3080,12 @@ var Modal = ({
|
|
|
3077
3080
|
);
|
|
3078
3081
|
};
|
|
3079
3082
|
|
|
3080
|
-
// src/puck/overrides/
|
|
3083
|
+
// src/puck/overrides/DrawerItem.tsx
|
|
3081
3084
|
import { shallow as shallow2 } from "zustand/shallow";
|
|
3082
3085
|
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
3083
|
-
var getClassName5 = get_class_name_factory_default("
|
|
3086
|
+
var getClassName5 = get_class_name_factory_default("DrawerItem", DrawerItem_module_default);
|
|
3084
3087
|
var usePuck3 = createUsePuck12();
|
|
3085
|
-
var
|
|
3088
|
+
var DrawerItem = (props) => {
|
|
3086
3089
|
const componentMeta = useSoftConfig((s) => s.softComponents[props.name]);
|
|
3087
3090
|
const displayName = (componentMeta == null ? void 0 : componentMeta.name) || props.name;
|
|
3088
3091
|
const softComponents = new Set(
|
|
@@ -3231,6 +3234,7 @@ var ComponentItem = (props) => {
|
|
|
3231
3234
|
/* @__PURE__ */ jsx11("div", { className: getClassName5("migrationOptions"), children: /* @__PURE__ */ jsxs4(
|
|
3232
3235
|
"select",
|
|
3233
3236
|
{
|
|
3237
|
+
title: "Select migration version",
|
|
3234
3238
|
className: getClassName5("select"),
|
|
3235
3239
|
value: migrateVersionMap[Array.from(versionsToDelete)[0]] || "decompose",
|
|
3236
3240
|
onChange: (e) => {
|
|
@@ -3276,6 +3280,124 @@ var ComponentItem = (props) => {
|
|
|
3276
3280
|
}
|
|
3277
3281
|
return /* @__PURE__ */ jsx11(Fragment5, { children: props.children });
|
|
3278
3282
|
};
|
|
3283
|
+
var ComponentItem = DrawerItem;
|
|
3284
|
+
|
|
3285
|
+
// src/puck/overrides/Drawer.tsx
|
|
3286
|
+
import { useState as useState6 } from "react";
|
|
3287
|
+
import { createUsePuck as createUsePuck13, Drawer as PuckDrawer } from "@measured/puck";
|
|
3288
|
+
import { ChevronDown, ChevronUp } from "lucide-react";
|
|
3289
|
+
|
|
3290
|
+
// css-module:/media/manual_mount/osamuProjects/netlisian/packages/soft-config/src/puck/overrides/Drawer.module.css#css-module
|
|
3291
|
+
var Drawer_module_default = { "Drawer": "_Drawer_12zq5_1", "Drawer-category": "_Drawer-category_12zq5_7", "Drawer-category--isExpanded": "_Drawer-category--isExpanded_12zq5_15", "Drawer-categoryContent": "_Drawer-categoryContent_12zq5_19", "Drawer-categoryTitle": "_Drawer-categoryTitle_12zq5_27", "Drawer-categoryTitleIcon": "_Drawer-categoryTitleIcon_12zq5_63" };
|
|
3292
|
+
|
|
3293
|
+
// src/puck/overrides/Drawer.tsx
|
|
3294
|
+
import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3295
|
+
var getClassName6 = get_class_name_factory_default("Drawer", Drawer_module_default);
|
|
3296
|
+
var getCategoryClassName = get_class_name_factory_default("Drawer-category", Drawer_module_default);
|
|
3297
|
+
var usePuck4 = createUsePuck13();
|
|
3298
|
+
var CategorySection = ({
|
|
3299
|
+
id,
|
|
3300
|
+
title,
|
|
3301
|
+
componentKeys,
|
|
3302
|
+
getPermissions,
|
|
3303
|
+
expanded,
|
|
3304
|
+
onToggle
|
|
3305
|
+
}) => /* @__PURE__ */ jsxs5("div", { className: getCategoryClassName({ isExpanded: expanded }), children: [
|
|
3306
|
+
title && /* @__PURE__ */ jsxs5(
|
|
3307
|
+
"button",
|
|
3308
|
+
{
|
|
3309
|
+
type: "button",
|
|
3310
|
+
className: getClassName6("categoryTitle"),
|
|
3311
|
+
onClick: () => onToggle(id),
|
|
3312
|
+
title: expanded ? `Collapse ${title}` : `Expand ${title}`,
|
|
3313
|
+
children: [
|
|
3314
|
+
/* @__PURE__ */ jsx12("span", { children: title }),
|
|
3315
|
+
/* @__PURE__ */ jsx12("span", { className: getClassName6("categoryTitleIcon"), children: expanded ? /* @__PURE__ */ jsx12(ChevronUp, { size: 12 }) : /* @__PURE__ */ jsx12(ChevronDown, { size: 12 }) })
|
|
3316
|
+
]
|
|
3317
|
+
}
|
|
3318
|
+
),
|
|
3319
|
+
/* @__PURE__ */ jsx12("div", { className: getClassName6("categoryContent"), children: /* @__PURE__ */ jsx12(PuckDrawer, { children: componentKeys.map((key) => /* @__PURE__ */ jsx12(
|
|
3320
|
+
PuckDrawer.Item,
|
|
3321
|
+
{
|
|
3322
|
+
name: key,
|
|
3323
|
+
isDragDisabled: !getPermissions({ type: key }).insert,
|
|
3324
|
+
children: DrawerItem
|
|
3325
|
+
},
|
|
3326
|
+
key
|
|
3327
|
+
)) }) })
|
|
3328
|
+
] });
|
|
3329
|
+
var Drawer = (_props) => {
|
|
3330
|
+
var _a, _b;
|
|
3331
|
+
const config = usePuck4((s) => s.config);
|
|
3332
|
+
const getPermissions = usePuck4((s) => s.getPermissions);
|
|
3333
|
+
const categories = (_a = config.categories) != null ? _a : {};
|
|
3334
|
+
const categorised = new Set(
|
|
3335
|
+
Object.values(categories).flatMap((cat) => {
|
|
3336
|
+
var _a2;
|
|
3337
|
+
return (_a2 = cat.components) != null ? _a2 : [];
|
|
3338
|
+
})
|
|
3339
|
+
);
|
|
3340
|
+
const allKeys = Object.keys(config.components);
|
|
3341
|
+
const otherKeys = allKeys.filter((k) => !categorised.has(k));
|
|
3342
|
+
const categoryEntries = Object.entries(categories).filter(
|
|
3343
|
+
([, cat]) => cat.visible !== false
|
|
3344
|
+
);
|
|
3345
|
+
const [expanded, setExpanded] = useState6(() => {
|
|
3346
|
+
const init = {};
|
|
3347
|
+
categoryEntries.forEach(([id, cat]) => {
|
|
3348
|
+
init[id] = cat.defaultExpanded !== false;
|
|
3349
|
+
});
|
|
3350
|
+
if (otherKeys.length > 0) init["__other__"] = true;
|
|
3351
|
+
return init;
|
|
3352
|
+
});
|
|
3353
|
+
const toggle = (id) => setExpanded((prev) => __spreadProps(__spreadValues({}, prev), { [id]: !prev[id] }));
|
|
3354
|
+
if (categoryEntries.length === 0) {
|
|
3355
|
+
return /* @__PURE__ */ jsx12(PuckDrawer, { children: allKeys.map((key) => /* @__PURE__ */ jsx12(
|
|
3356
|
+
PuckDrawer.Item,
|
|
3357
|
+
{
|
|
3358
|
+
name: key,
|
|
3359
|
+
isDragDisabled: !getPermissions({ type: key }).insert,
|
|
3360
|
+
children: DrawerItem
|
|
3361
|
+
},
|
|
3362
|
+
key
|
|
3363
|
+
)) });
|
|
3364
|
+
}
|
|
3365
|
+
console.log(
|
|
3366
|
+
getClassName6(),
|
|
3367
|
+
getCategoryClassName(),
|
|
3368
|
+
getCategoryClassName({ isExpanded: true })
|
|
3369
|
+
);
|
|
3370
|
+
return /* @__PURE__ */ jsxs5("div", { className: getClassName6(), children: [
|
|
3371
|
+
categoryEntries.map(([id, cat]) => {
|
|
3372
|
+
var _a2, _b2, _c;
|
|
3373
|
+
return /* @__PURE__ */ jsx12(
|
|
3374
|
+
CategorySection,
|
|
3375
|
+
{
|
|
3376
|
+
id,
|
|
3377
|
+
title: (_a2 = cat.title) != null ? _a2 : id,
|
|
3378
|
+
componentKeys: ((_b2 = cat.components) != null ? _b2 : []).filter(
|
|
3379
|
+
(k) => k in config.components
|
|
3380
|
+
),
|
|
3381
|
+
getPermissions,
|
|
3382
|
+
expanded: (_c = expanded[id]) != null ? _c : true,
|
|
3383
|
+
onToggle: toggle
|
|
3384
|
+
},
|
|
3385
|
+
id
|
|
3386
|
+
);
|
|
3387
|
+
}),
|
|
3388
|
+
otherKeys.length > 0 && /* @__PURE__ */ jsx12(
|
|
3389
|
+
CategorySection,
|
|
3390
|
+
{
|
|
3391
|
+
id: "__other__",
|
|
3392
|
+
title: "Other components",
|
|
3393
|
+
componentKeys: otherKeys,
|
|
3394
|
+
getPermissions,
|
|
3395
|
+
expanded: (_b = expanded["__other__"]) != null ? _b : true,
|
|
3396
|
+
onToggle: toggle
|
|
3397
|
+
}
|
|
3398
|
+
)
|
|
3399
|
+
] });
|
|
3400
|
+
};
|
|
3279
3401
|
|
|
3280
3402
|
// src/puck/lib/action-callback.ts
|
|
3281
3403
|
var createActionCallback = (validateAction, undo) => {
|
|
@@ -3502,6 +3624,9 @@ var resolveSoftConfig = (data, softComponents, config) => {
|
|
|
3502
3624
|
export {
|
|
3503
3625
|
ActionBarOverride as ActionBar,
|
|
3504
3626
|
ComponentItem,
|
|
3627
|
+
Drawer as ComponentList,
|
|
3628
|
+
Drawer,
|
|
3629
|
+
DrawerItem,
|
|
3505
3630
|
Header,
|
|
3506
3631
|
Modal,
|
|
3507
3632
|
SoftConfigProvider,
|