@measured/puck 0.19.0-canary.46835fd → 0.19.0-canary.4b545576
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 +1 -0
- package/dist/chunk-AK3WVOWA.mjs +5415 -0
- package/dist/index.css +63 -59
- package/dist/index.d.mts +115 -106
- package/dist/index.d.ts +115 -106
- package/dist/index.js +2160 -1703
- package/dist/index.mjs +1911 -6450
- package/dist/{resolve-all-data-3XjIPfNh.d.mts → resolve-all-data-BFRAghCj.d.mts} +58 -12
- package/dist/{resolve-all-data-3XjIPfNh.d.ts → resolve-all-data-BFRAghCj.d.ts} +58 -12
- package/dist/rsc.css +339 -0
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +3894 -238
- package/dist/rsc.mjs +52 -53
- package/package.json +7 -5
- package/dist/chunk-7N5DRY4G.mjs +0 -308
package/dist/index.css
CHANGED
@@ -139,6 +139,10 @@
|
|
139
139
|
height: 1px;
|
140
140
|
min-height: 100vh;
|
141
141
|
}
|
142
|
+
[data-puck-entry] {
|
143
|
+
position: relative;
|
144
|
+
z-index: 0;
|
145
|
+
}
|
142
146
|
|
143
147
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/ActionBar/styles.module.css/#css-module-data */
|
144
148
|
._ActionBar_rvadt_1 {
|
@@ -225,10 +229,10 @@
|
|
225
229
|
}
|
226
230
|
|
227
231
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/AutoField/styles.module.css/#css-module-data */
|
228
|
-
.
|
232
|
+
._InputWrapper_4xor1_1 + ._InputWrapper_4xor1_1 {
|
229
233
|
margin-top: 12px;
|
230
234
|
}
|
231
|
-
._Input-
|
235
|
+
._Input-label_4xor1_5 {
|
232
236
|
align-items: center;
|
233
237
|
color: var(--puck-color-grey-04);
|
234
238
|
display: flex;
|
@@ -236,29 +240,30 @@
|
|
236
240
|
font-size: var(--puck-font-size-xxs);
|
237
241
|
font-weight: 600;
|
238
242
|
}
|
239
|
-
._Input-
|
243
|
+
._Input-labelIcon_4xor1_14 {
|
240
244
|
color: var(--puck-color-grey-07);
|
241
245
|
display: flex;
|
242
246
|
margin-inline-end: 4px;
|
243
247
|
padding-inline-start: 4px;
|
244
248
|
}
|
245
|
-
._Input-
|
249
|
+
._Input-disabledIcon_4xor1_21 {
|
246
250
|
color: var(--puck-color-grey-05);
|
247
251
|
margin-inline-start: auto;
|
248
252
|
}
|
249
|
-
._Input-
|
253
|
+
._Input-input_4xor1_26 {
|
250
254
|
background: var(--puck-color-white);
|
251
255
|
border-width: 1px;
|
252
256
|
border-style: solid;
|
253
257
|
border-color: var(--puck-color-grey-09);
|
254
258
|
border-radius: 4px;
|
259
|
+
box-sizing: border-box;
|
255
260
|
font-family: inherit;
|
256
261
|
font-size: 14px;
|
257
262
|
padding: 12px 15px;
|
258
263
|
transition: border-color 50ms ease-in;
|
259
264
|
width: 100%;
|
260
265
|
}
|
261
|
-
select._Input-
|
266
|
+
select._Input-input_4xor1_26 {
|
262
267
|
appearance: none;
|
263
268
|
background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%23c3c3c3'><polygon points='0,0 100,0 50,50'/></svg>") no-repeat;
|
264
269
|
background-size: 12px;
|
@@ -267,29 +272,29 @@ select._Input-input_g5w3n_26 {
|
|
267
272
|
background-color: var(--puck-color-white);
|
268
273
|
cursor: pointer;
|
269
274
|
}
|
270
|
-
select._Input-
|
275
|
+
select._Input-input_4xor1_26:dir(rtl) {
|
271
276
|
background-position: 12px calc(50% + 3px);
|
272
277
|
}
|
273
278
|
@media (hover: hover) and (pointer: fine) {
|
274
|
-
.
|
275
|
-
.
|
279
|
+
._Input_4xor1_1:has(> input):hover ._Input-input_4xor1_26:not([readonly]),
|
280
|
+
._Input_4xor1_1:has(> textarea):hover ._Input-input_4xor1_26:not([readonly]) {
|
276
281
|
border-color: var(--puck-color-grey-05);
|
277
282
|
transition: none;
|
278
283
|
}
|
279
|
-
.
|
284
|
+
._Input_4xor1_1:has(> select):hover ._Input-input_4xor1_26:not([disabled]) {
|
280
285
|
background-color: var(--puck-color-azure-12);
|
281
286
|
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' fill='%235a5a5a'><polygon points='0,0 100,0 50,50'/></svg>");
|
282
287
|
border-color: var(--puck-color-grey-05);
|
283
288
|
transition: none;
|
284
289
|
}
|
285
290
|
}
|
286
|
-
._Input-
|
291
|
+
._Input-input_4xor1_26:focus {
|
287
292
|
border-color: var(--puck-color-grey-05);
|
288
293
|
outline: 2px solid var(--puck-color-azure-05);
|
289
294
|
transition: none;
|
290
295
|
}
|
291
|
-
._Input--
|
292
|
-
._Input--
|
296
|
+
._Input--readOnly_4xor1_75 > ._Input-input_4xor1_26,
|
297
|
+
._Input--readOnly_4xor1_75 > select._Input-input_4xor1_26 {
|
293
298
|
background-color: var(--puck-color-grey-11);
|
294
299
|
border-color: var(--puck-color-grey-09);
|
295
300
|
color: var(--puck-color-grey-04);
|
@@ -298,34 +303,34 @@ select._Input-input_g5w3n_26:dir(rtl) {
|
|
298
303
|
outline: 0;
|
299
304
|
transition: none;
|
300
305
|
}
|
301
|
-
._Input-
|
306
|
+
._Input-radioGroupItems_4xor1_86 {
|
302
307
|
display: flex;
|
303
308
|
border: 1px solid var(--puck-color-grey-09);
|
304
309
|
border-radius: 4px;
|
305
310
|
flex-wrap: wrap;
|
306
311
|
}
|
307
|
-
._Input-
|
312
|
+
._Input-radio_4xor1_86 {
|
308
313
|
border-inline-end: 1px solid var(--puck-color-grey-09);
|
309
314
|
flex-grow: 1;
|
310
315
|
}
|
311
|
-
._Input-
|
316
|
+
._Input-radio_4xor1_86:first-of-type {
|
312
317
|
border-bottom-left-radius: 4px;
|
313
318
|
border-top-left-radius: 4px;
|
314
319
|
}
|
315
|
-
._Input-
|
320
|
+
._Input-radio_4xor1_86:first-of-type ._Input-radioInner_4xor1_103 {
|
316
321
|
border-bottom-left-radius: 3px;
|
317
322
|
border-top-left-radius: 3px;
|
318
323
|
}
|
319
|
-
._Input-
|
324
|
+
._Input-radio_4xor1_86:last-of-type {
|
320
325
|
border-bottom-right-radius: 4px;
|
321
326
|
border-inline-end: 0;
|
322
327
|
border-top-right-radius: 4px;
|
323
328
|
}
|
324
|
-
._Input-
|
329
|
+
._Input-radio_4xor1_86:last-of-type ._Input-radioInner_4xor1_103 {
|
325
330
|
border-bottom-right-radius: 3px;
|
326
331
|
border-top-right-radius: 3px;
|
327
332
|
}
|
328
|
-
._Input-
|
333
|
+
._Input-radioInner_4xor1_103 {
|
329
334
|
background-color: var(--puck-color-white);
|
330
335
|
color: var(--puck-color-grey-04);
|
331
336
|
cursor: pointer;
|
@@ -334,32 +339,32 @@ select._Input-input_g5w3n_26:dir(rtl) {
|
|
334
339
|
text-align: center;
|
335
340
|
transition: background-color 50ms ease-in;
|
336
341
|
}
|
337
|
-
._Input-
|
342
|
+
._Input-radio_4xor1_86:has(:focus-visible) {
|
338
343
|
outline: 2px solid var(--puck-color-azure-05);
|
339
344
|
outline-offset: 2px;
|
340
345
|
position: relative;
|
341
346
|
}
|
342
347
|
@media (hover: hover) and (pointer: fine) {
|
343
|
-
._Input-
|
348
|
+
._Input-radioInner_4xor1_103:hover {
|
344
349
|
background-color: var(--puck-color-azure-12);
|
345
350
|
transition: none;
|
346
351
|
}
|
347
352
|
}
|
348
|
-
._Input--
|
353
|
+
._Input--readOnly_4xor1_75 ._Input-radioInner_4xor1_103 {
|
349
354
|
background-color: var(--puck-color-white);
|
350
355
|
color: var(--puck-color-grey-04);
|
351
356
|
cursor: default;
|
352
357
|
}
|
353
|
-
._Input-
|
358
|
+
._Input-radio_4xor1_86 ._Input-radioInput_4xor1_148:checked ~ ._Input-radioInner_4xor1_103 {
|
354
359
|
background-color: var(--puck-color-azure-11);
|
355
360
|
color: var(--puck-color-azure-04);
|
356
361
|
font-weight: 500;
|
357
362
|
}
|
358
|
-
._Input--
|
363
|
+
._Input--readOnly_4xor1_75 ._Input-radioInput_4xor1_148:checked ~ ._Input-radioInner_4xor1_103 {
|
359
364
|
background-color: var(--puck-color-grey-11);
|
360
365
|
color: var(--puck-color-grey-04);
|
361
366
|
}
|
362
|
-
._Input-
|
367
|
+
._Input-radio_4xor1_86 ._Input-radioInput_4xor1_148 {
|
363
368
|
clip: rect(0 0 0 0);
|
364
369
|
clip-path: inset(100%);
|
365
370
|
height: 1px;
|
@@ -368,7 +373,7 @@ select._Input-input_g5w3n_26:dir(rtl) {
|
|
368
373
|
white-space: nowrap;
|
369
374
|
width: 1px;
|
370
375
|
}
|
371
|
-
textarea._Input-
|
376
|
+
textarea._Input-input_4xor1_26 {
|
372
377
|
margin-bottom: -4px;
|
373
378
|
}
|
374
379
|
|
@@ -1146,12 +1151,12 @@ textarea._Input-input_g5w3n_26 {
|
|
1146
1151
|
}
|
1147
1152
|
|
1148
1153
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css/#css-module-data */
|
1149
|
-
.
|
1154
|
+
._DraggableComponent_qzbgx_1 {
|
1150
1155
|
position: absolute;
|
1151
1156
|
pointer-events: none;
|
1152
1157
|
--overlay-background: color-mix( in srgb, var(--puck-color-azure-08) 30%, transparent );
|
1153
1158
|
}
|
1154
|
-
._DraggableComponent-
|
1159
|
+
._DraggableComponent-overlay_qzbgx_12 {
|
1155
1160
|
cursor: pointer;
|
1156
1161
|
height: 100%;
|
1157
1162
|
width: 100%;
|
@@ -1163,10 +1168,10 @@ textarea._Input-input_g5w3n_26 {
|
|
1163
1168
|
box-sizing: border-box;
|
1164
1169
|
z-index: 1;
|
1165
1170
|
}
|
1166
|
-
.
|
1171
|
+
._DraggableComponent_qzbgx_1:focus-visible > ._DraggableComponent-overlay_qzbgx_12 {
|
1167
1172
|
outline: 1px solid var(--puck-color-azure-05);
|
1168
1173
|
}
|
1169
|
-
._DraggableComponent-
|
1174
|
+
._DraggableComponent-loadingOverlay_qzbgx_29 {
|
1170
1175
|
background: var(--puck-color-white);
|
1171
1176
|
color: var(--puck-color-grey-03);
|
1172
1177
|
border-radius: 4px;
|
@@ -1181,35 +1186,36 @@ textarea._Input-input_g5w3n_26 {
|
|
1181
1186
|
opacity: 0.8;
|
1182
1187
|
z-index: 1;
|
1183
1188
|
}
|
1184
|
-
._DraggableComponent--
|
1189
|
+
._DraggableComponent--hover_qzbgx_45:not(._DraggableComponent--isLocked_qzbgx_45) > ._DraggableComponent-overlay_qzbgx_12 {
|
1185
1190
|
background: var(--overlay-background);
|
1186
1191
|
}
|
1187
|
-
._DraggableComponent--
|
1192
|
+
._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12 {
|
1188
1193
|
outline: 2px var(--puck-color-azure-09) solid;
|
1189
1194
|
}
|
1190
|
-
._DraggableComponent--
|
1195
|
+
._DraggableComponent--isSelected_qzbgx_54 > ._DraggableComponent-overlay_qzbgx_12 {
|
1191
1196
|
outline-color: var(--puck-color-azure-07);
|
1192
1197
|
}
|
1193
|
-
.
|
1198
|
+
._DraggableComponent_qzbgx_1:has(._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12) > ._DraggableComponent-overlay_qzbgx_12 {
|
1194
1199
|
display: none;
|
1195
1200
|
}
|
1196
|
-
._DraggableComponent-
|
1201
|
+
._DraggableComponent-actionsOverlay_qzbgx_66 {
|
1197
1202
|
position: sticky;
|
1198
1203
|
opacity: 0;
|
1199
1204
|
pointer-events: none;
|
1200
1205
|
z-index: 2;
|
1201
1206
|
}
|
1202
|
-
._DraggableComponent--
|
1207
|
+
._DraggableComponent--isSelected_qzbgx_54 ._DraggableComponent-actionsOverlay_qzbgx_66 {
|
1203
1208
|
opacity: 1;
|
1204
1209
|
pointer-events: auto;
|
1205
1210
|
}
|
1206
|
-
._DraggableComponent-
|
1211
|
+
._DraggableComponent-actions_qzbgx_66 {
|
1207
1212
|
position: absolute;
|
1208
1213
|
width: auto;
|
1209
1214
|
cursor: grab;
|
1210
1215
|
display: flex;
|
1211
1216
|
box-sizing: border-box;
|
1212
1217
|
transform-origin: right top;
|
1218
|
+
min-height: 36px;
|
1213
1219
|
}
|
1214
1220
|
|
1215
1221
|
/* components/DraggableComponent/styles.css */
|
@@ -1230,7 +1236,7 @@ textarea._Input-input_g5w3n_26 {
|
|
1230
1236
|
[data-puck-disabled] {
|
1231
1237
|
cursor: pointer;
|
1232
1238
|
}
|
1233
|
-
[data-
|
1239
|
+
[data-dnd-placeholder] {
|
1234
1240
|
background: var(--puck-color-azure-06) !important;
|
1235
1241
|
border: none !important;
|
1236
1242
|
color: #00000000 !important;
|
@@ -1238,9 +1244,9 @@ textarea._Input-input_g5w3n_26 {
|
|
1238
1244
|
outline: none !important;
|
1239
1245
|
transition: none !important;
|
1240
1246
|
}
|
1241
|
-
[data-
|
1242
|
-
[data-
|
1243
|
-
[data-
|
1247
|
+
[data-dnd-placeholder] *,
|
1248
|
+
[data-dnd-placeholder]::after,
|
1249
|
+
[data-dnd-placeholder]::before {
|
1244
1250
|
opacity: 0 !important;
|
1245
1251
|
}
|
1246
1252
|
[data-dnd-dragging][data-puck-component] {
|
@@ -1250,57 +1256,55 @@ textarea._Input-input_g5w3n_26 {
|
|
1250
1256
|
}
|
1251
1257
|
|
1252
1258
|
/* css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css/#css-module-data */
|
1253
|
-
.
|
1259
|
+
._DropZone_3dmev_1 {
|
1254
1260
|
--resize-animation-ms: 150ms;
|
1255
1261
|
position: relative;
|
1256
1262
|
height: 100%;
|
1263
|
+
min-height: var(--min-empty-height);
|
1257
1264
|
outline-offset: -2px;
|
1258
1265
|
width: 100%;
|
1259
1266
|
}
|
1260
|
-
._DropZone--
|
1261
|
-
min-height: var(--min-empty-height);
|
1262
|
-
}
|
1263
|
-
._DropZone--hasChildren_kmkdc_14 {
|
1267
|
+
._DropZone--hasChildren_3dmev_11 {
|
1264
1268
|
min-height: 0;
|
1265
1269
|
}
|
1266
|
-
.
|
1270
|
+
._DropZone_3dmev_1:empty {
|
1267
1271
|
min-height: var(--min-empty-height);
|
1268
1272
|
}
|
1269
|
-
.
|
1273
|
+
._DropZone_3dmev_1:not(._DropZone--userIsDragging_3dmev_19) {
|
1270
1274
|
transition: min-height var(--resize-animation-ms) ease-in;
|
1271
1275
|
}
|
1272
|
-
._DropZone--
|
1273
|
-
._DropZone--
|
1276
|
+
._DropZone--isAreaSelected_3dmev_23,
|
1277
|
+
._DropZone--hoveringOverArea_3dmev_24:not(._DropZone--isRootZone_3dmev_24) {
|
1274
1278
|
background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
|
1275
1279
|
outline: 2px dashed var(--puck-color-azure-08);
|
1276
1280
|
}
|
1277
|
-
.
|
1281
|
+
._DropZone_3dmev_1:empty {
|
1278
1282
|
background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
|
1279
1283
|
outline: 2px dashed var(--puck-color-azure-08);
|
1280
1284
|
}
|
1281
|
-
._DropZone--
|
1285
|
+
._DropZone--isDestination_3dmev_34 {
|
1282
1286
|
outline: 2px dashed var(--puck-color-azure-04) !important;
|
1283
1287
|
}
|
1284
|
-
._DropZone--
|
1288
|
+
._DropZone--isDestination_3dmev_34:not(._DropZone--isRootZone_3dmev_24) {
|
1285
1289
|
background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent) !important;
|
1286
1290
|
}
|
1287
|
-
._DropZone-
|
1291
|
+
._DropZone-item_3dmev_46 {
|
1288
1292
|
position: relative;
|
1289
1293
|
}
|
1290
|
-
._DropZone-
|
1294
|
+
._DropZone-hitbox_3dmev_50 {
|
1291
1295
|
position: absolute;
|
1292
1296
|
bottom: -12px;
|
1293
1297
|
height: 24px;
|
1294
1298
|
width: 100%;
|
1295
1299
|
z-index: 1;
|
1296
1300
|
}
|
1297
|
-
._DropZone--
|
1301
|
+
._DropZone--isEnabled_3dmev_58._DropZone--userIsDragging_3dmev_19 {
|
1298
1302
|
outline: 2px dashed var(--puck-color-azure-06);
|
1299
1303
|
}
|
1300
|
-
.
|
1304
|
+
._DropZone_3dmev_1 > *:not([data-puck-component]) {
|
1301
1305
|
opacity: 0;
|
1302
1306
|
}
|
1303
|
-
body:has(._DropZone--
|
1307
|
+
body:has(._DropZone--isAnimating_3dmev_67:empty) [data-puck-overlay] {
|
1304
1308
|
opacity: 0 !important;
|
1305
1309
|
}
|
1306
1310
|
|
package/dist/index.d.mts
CHANGED
@@ -1,9 +1,109 @@
|
|
1
|
-
import {
|
2
|
-
export {
|
1
|
+
import { H as History, P as Permissions, C as ComponentData, a as Config, U as UserGenerics, F as Fields, b as PuckAction, R as RootDataWithProps, c as ResolveDataTrigger, d as Plugin, O as Overrides, V as Viewports, I as IframeConfig, e as UiState, f as ComponentConfig, A as AppState, M as Metadata, g as Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as RootData, m as Content, n as ItemSelector } from './resolve-all-data-BFRAghCj.mjs';
|
2
|
+
export { X as Adaptor, Q as ArrayField, v as ArrayState, a7 as AsFieldProps, B as BaseData, G as BaseField, E as ComponentDataMap, _ as CustomField, a4 as DefaultComponentProps, a1 as DefaultRootFieldProps, a3 as DefaultRootProps, a2 as DefaultRootRenderProps, o as Direction, p as DragAxis, Z as ExternalField, Y as ExternalFieldWithAdaptor, a9 as ExtractPropsFromConfig, aa as ExtractRootPropsFromConfig, t as FieldRenderFunctions, u as ItemWithId, z as MappedItem, N as NumberField, W as ObjectField, s as OverrideKey, w as PuckComponent, a0 as PuckContext, L as RadioField, x as RootConfig, y as RootDataWithoutProps, K as SelectField, S as Slot, $ as SlotField, T as TextField, J as TextareaField, q as Viewport, a8 as WithChildren, a5 as WithId, a6 as WithPuckProps, r as overrideKeys, ac as resolveAllData, ab as transformProps } from './resolve-all-data-BFRAghCj.mjs';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import react__default, { ReactNode, SyntheticEvent, ReactElement } from 'react';
|
6
6
|
|
7
|
+
type HistorySlice<D = any> = {
|
8
|
+
index: number;
|
9
|
+
hasPast: () => boolean;
|
10
|
+
hasFuture: () => boolean;
|
11
|
+
histories: History<D>[];
|
12
|
+
record: (data: D) => void;
|
13
|
+
back: VoidFunction;
|
14
|
+
forward: VoidFunction;
|
15
|
+
currentHistory: () => History;
|
16
|
+
nextHistory: () => History<D> | null;
|
17
|
+
prevHistory: () => History<D> | null;
|
18
|
+
setHistories: (histories: History[]) => void;
|
19
|
+
setHistoryIndex: (index: number) => void;
|
20
|
+
initialAppState: D;
|
21
|
+
};
|
22
|
+
|
23
|
+
type NodeMethods = {
|
24
|
+
sync: () => void;
|
25
|
+
};
|
26
|
+
type PuckNodeInstance = {
|
27
|
+
id: string;
|
28
|
+
methods: NodeMethods;
|
29
|
+
element: HTMLElement | null;
|
30
|
+
};
|
31
|
+
type NodesSlice = {
|
32
|
+
nodes: Record<string, PuckNodeInstance | undefined>;
|
33
|
+
registerNode: (id: string, node: Partial<PuckNodeInstance>) => void;
|
34
|
+
unregisterNode: (id: string, node?: Partial<PuckNodeInstance>) => void;
|
35
|
+
};
|
36
|
+
|
37
|
+
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
38
|
+
item?: G["UserComponentData"] | null;
|
39
|
+
type?: keyof G["UserProps"];
|
40
|
+
root?: boolean;
|
41
|
+
};
|
42
|
+
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
43
|
+
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
44
|
+
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
45
|
+
type Cache = Record<string, {
|
46
|
+
lastPermissions: Partial<Permissions>;
|
47
|
+
lastData: ComponentData | null;
|
48
|
+
}>;
|
49
|
+
type PermissionsSlice = {
|
50
|
+
cache: Cache;
|
51
|
+
globalPermissions: Permissions;
|
52
|
+
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
53
|
+
getPermissions: GetPermissions<Config>;
|
54
|
+
resolvePermissions: ResolvePermissions<Config>;
|
55
|
+
refreshPermissions: RefreshPermissions<Config>;
|
56
|
+
};
|
57
|
+
|
58
|
+
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
59
|
+
type FieldsSlice = {
|
60
|
+
fields: Fields | Partial<Fields>;
|
61
|
+
loading: boolean;
|
62
|
+
lastResolvedData: Partial<ComponentOrRootData>;
|
63
|
+
};
|
64
|
+
|
65
|
+
type Status = "LOADING" | "MOUNTED" | "READY";
|
66
|
+
type ZoomConfig = {
|
67
|
+
autoZoom: number;
|
68
|
+
rootHeight: number;
|
69
|
+
zoom: number;
|
70
|
+
};
|
71
|
+
type ComponentState = Record<string, {
|
72
|
+
loadingCount: number;
|
73
|
+
}>;
|
74
|
+
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
75
|
+
state: G["UserAppState"];
|
76
|
+
dispatch: (action: PuckAction) => void;
|
77
|
+
config: UserConfig;
|
78
|
+
componentState: ComponentState;
|
79
|
+
setComponentState: (componentState: ComponentState) => void;
|
80
|
+
setComponentLoading: (id: string, loading?: boolean, defer?: number) => () => void;
|
81
|
+
unsetComponentLoading: (id: string) => void;
|
82
|
+
pendingLoadTimeouts: Record<string, NodeJS.Timeout>;
|
83
|
+
resolveComponentData: <T extends ComponentData | RootDataWithProps>(componentData: T, trigger: ResolveDataTrigger) => Promise<{
|
84
|
+
node: T;
|
85
|
+
didChange: boolean;
|
86
|
+
}>;
|
87
|
+
resolveAndCommitData: () => void;
|
88
|
+
plugins: Plugin[];
|
89
|
+
overrides: Partial<Overrides>;
|
90
|
+
viewports: Viewports;
|
91
|
+
zoomConfig: ZoomConfig;
|
92
|
+
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
93
|
+
status: Status;
|
94
|
+
setStatus: (status: Status) => void;
|
95
|
+
iframe: IframeConfig;
|
96
|
+
selectedItem?: G["UserData"]["content"][0] | null;
|
97
|
+
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
98
|
+
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
99
|
+
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
100
|
+
metadata: Metadata;
|
101
|
+
fields: FieldsSlice;
|
102
|
+
history: HistorySlice;
|
103
|
+
nodes: NodesSlice;
|
104
|
+
permissions: PermissionsSlice;
|
105
|
+
};
|
106
|
+
|
7
107
|
declare const ActionBar: {
|
8
108
|
({ label, children, }: {
|
9
109
|
label?: string;
|
@@ -42,7 +142,7 @@ declare const FieldLabel: ({ children, icon, label, el, readOnly, className, }:
|
|
42
142
|
className?: string;
|
43
143
|
}) => react_jsx_runtime.JSX.Element;
|
44
144
|
type FieldNoLabel<Props extends any = any> = Omit<Field<Props>, "label">;
|
45
|
-
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType>): react_jsx_runtime.JSX.Element;
|
145
|
+
declare function AutoField<ValueType = any, FieldType extends FieldNoLabel<ValueType> = FieldNoLabel<ValueType>>(props: FieldProps<FieldType, ValueType>): react_jsx_runtime.JSX.Element | null;
|
46
146
|
|
47
147
|
declare const Button: ({ children, href, onClick, variant, type, disabled, tabIndex, newTab, fullWidth, icon, size, loading: loadingProp, ...props }: {
|
48
148
|
children: ReactNode;
|
@@ -146,108 +246,13 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
146
246
|
metadata?: Metadata;
|
147
247
|
}): react_jsx_runtime.JSX.Element;
|
148
248
|
|
149
|
-
declare function migrate(data: Data): Data;
|
249
|
+
declare function migrate(data: Data, config?: Config): Data;
|
150
250
|
|
151
|
-
type
|
152
|
-
|
153
|
-
|
154
|
-
hasFuture: () => boolean;
|
155
|
-
histories: History<D>[];
|
156
|
-
record: (data: D) => void;
|
157
|
-
back: VoidFunction;
|
158
|
-
forward: VoidFunction;
|
159
|
-
currentHistory: () => History;
|
160
|
-
nextHistory: () => History<D> | null;
|
161
|
-
prevHistory: () => History<D> | null;
|
162
|
-
setHistories: (histories: History[]) => void;
|
163
|
-
setHistoryIndex: (index: number) => void;
|
164
|
-
initialAppState: D;
|
165
|
-
};
|
166
|
-
|
167
|
-
type NodeMethods = {
|
168
|
-
sync: () => void;
|
169
|
-
};
|
170
|
-
type PuckNode = {
|
171
|
-
id: string;
|
172
|
-
methods: NodeMethods;
|
173
|
-
data: ComponentData;
|
174
|
-
parentId: string | null;
|
175
|
-
zone: string;
|
176
|
-
path: string[];
|
177
|
-
index: number;
|
178
|
-
element: HTMLElement | null;
|
179
|
-
};
|
180
|
-
type NodesSlice = {
|
181
|
-
nodes: Record<string, PuckNode | undefined>;
|
182
|
-
registerNode: (id: string, node: Partial<PuckNode>) => void;
|
183
|
-
unregisterNode: (id: string, node?: Partial<PuckNode>) => void;
|
184
|
-
};
|
185
|
-
|
186
|
-
type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
187
|
-
item?: G["UserComponentData"] | null;
|
188
|
-
type?: keyof G["UserProps"];
|
189
|
-
root?: boolean;
|
190
|
-
};
|
191
|
-
type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
|
192
|
-
type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
193
|
-
type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
|
194
|
-
type Cache = Record<string, {
|
195
|
-
lastPermissions: Partial<Permissions>;
|
196
|
-
lastData: ComponentData | null;
|
197
|
-
}>;
|
198
|
-
type PermissionsSlice = {
|
199
|
-
cache: Cache;
|
200
|
-
globalPermissions: Permissions;
|
201
|
-
resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
|
202
|
-
getPermissions: GetPermissions<Config>;
|
203
|
-
resolvePermissions: ResolvePermissions<Config>;
|
204
|
-
refreshPermissions: RefreshPermissions<Config>;
|
205
|
-
};
|
206
|
-
|
207
|
-
type ComponentOrRootData = Omit<ComponentData<any>, "type">;
|
208
|
-
type FieldsSlice = {
|
209
|
-
fields: Fields | Partial<Fields>;
|
210
|
-
loading: boolean;
|
211
|
-
lastResolvedData: Partial<ComponentOrRootData>;
|
212
|
-
};
|
213
|
-
|
214
|
-
type Status = "LOADING" | "MOUNTED" | "READY";
|
215
|
-
type ZoomConfig = {
|
216
|
-
autoZoom: number;
|
217
|
-
rootHeight: number;
|
218
|
-
zoom: number;
|
219
|
-
};
|
220
|
-
type ComponentState = Record<string, {
|
221
|
-
loadingCount: number;
|
222
|
-
}>;
|
223
|
-
type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
224
|
-
state: G["UserAppState"];
|
225
|
-
dispatch: (action: PuckAction) => void;
|
226
|
-
config: UserConfig;
|
227
|
-
componentState: ComponentState;
|
228
|
-
setComponentState: (componentState: ComponentState) => void;
|
229
|
-
setComponentLoading: (id: string) => void;
|
230
|
-
unsetComponentLoading: (id: string) => void;
|
231
|
-
resolveDataRuns: number;
|
232
|
-
resolveData: (newAppState: AppState) => void;
|
233
|
-
plugins: Plugin[];
|
234
|
-
overrides: Partial<Overrides>;
|
235
|
-
viewports: Viewports;
|
236
|
-
zoomConfig: ZoomConfig;
|
237
|
-
setZoomConfig: (zoomConfig: ZoomConfig) => void;
|
238
|
-
status: Status;
|
239
|
-
setStatus: (status: Status) => void;
|
240
|
-
iframe: IframeConfig;
|
241
|
-
selectedItem?: G["UserData"]["content"][0] | null;
|
242
|
-
setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
|
243
|
-
getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
|
244
|
-
onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
|
245
|
-
metadata: Metadata;
|
246
|
-
fields: FieldsSlice;
|
247
|
-
history: HistorySlice;
|
248
|
-
nodes: NodesSlice;
|
249
|
-
permissions: PermissionsSlice;
|
251
|
+
type MapSlotOptions = {
|
252
|
+
parentId: string;
|
253
|
+
propName: string;
|
250
254
|
};
|
255
|
+
declare function mapSlotsPublic<T extends ComponentData | RootData>(item: T, config: Config, map: (data: Content, options: MapSlotOptions) => Content): T;
|
251
256
|
|
252
257
|
type WithGet<T> = T & {
|
253
258
|
get: () => T;
|
@@ -259,6 +264,9 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
259
264
|
getPermissions: GetPermissions<UserConfig>;
|
260
265
|
refreshPermissions: RefreshPermissions<UserConfig>;
|
261
266
|
selectedItem: G["UserComponentData"] | null;
|
267
|
+
getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
|
268
|
+
getItemById: (id: string) => ComponentData | undefined;
|
269
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
262
270
|
history: {
|
263
271
|
back: HistorySlice["back"];
|
264
272
|
forward: HistorySlice["forward"];
|
@@ -270,7 +278,8 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
270
278
|
hasFuture: boolean;
|
271
279
|
};
|
272
280
|
};
|
273
|
-
type
|
281
|
+
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
282
|
+
type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
|
274
283
|
/**
|
275
284
|
* createUsePuck
|
276
285
|
*
|
@@ -280,7 +289,7 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
|
|
280
289
|
*
|
281
290
|
* @returns a typed usePuck function
|
282
291
|
*/
|
283
|
-
declare function createUsePuck<UserConfig extends Config = Config>(): <T =
|
292
|
+
declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
|
284
293
|
declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
|
285
294
|
|
286
|
-
export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, usePuck };
|
295
|
+
export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Content, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootData, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, mapSlotsPublic as mapSlots, migrate, renderContext, usePuck };
|