@measured/puck 0.19.0-canary.de23f9d → 0.19.0-canary.e52d3b85

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/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
- ._InputWrapper_g5w3n_1 + ._InputWrapper_g5w3n_1 {
232
+ ._InputWrapper_4xor1_1 + ._InputWrapper_4xor1_1 {
229
233
  margin-top: 12px;
230
234
  }
231
- ._Input-label_g5w3n_5 {
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-labelIcon_g5w3n_14 {
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-disabledIcon_g5w3n_21 {
249
+ ._Input-disabledIcon_4xor1_21 {
246
250
  color: var(--puck-color-grey-05);
247
251
  margin-inline-start: auto;
248
252
  }
249
- ._Input-input_g5w3n_26 {
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-input_g5w3n_26 {
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-input_g5w3n_26:dir(rtl) {
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
- ._Input_g5w3n_1:has(> input):hover ._Input-input_g5w3n_26:not([readonly]),
275
- ._Input_g5w3n_1:has(> textarea):hover ._Input-input_g5w3n_26:not([readonly]) {
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
- ._Input_g5w3n_1:has(> select):hover ._Input-input_g5w3n_26:not([disabled]) {
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-input_g5w3n_26:focus {
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--readOnly_g5w3n_74 > ._Input-input_g5w3n_26,
292
- ._Input--readOnly_g5w3n_74 > select._Input-input_g5w3n_26 {
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-radioGroupItems_g5w3n_85 {
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-radio_g5w3n_85 {
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-radio_g5w3n_85:first-of-type {
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-radio_g5w3n_85:first-of-type ._Input-radioInner_g5w3n_102 {
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-radio_g5w3n_85:last-of-type {
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-radio_g5w3n_85:last-of-type ._Input-radioInner_g5w3n_102 {
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-radioInner_g5w3n_102 {
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-radio_g5w3n_85:has(:focus-visible) {
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-radioInner_g5w3n_102:hover {
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--readOnly_g5w3n_74 ._Input-radioInner_g5w3n_102 {
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-radio_g5w3n_85 ._Input-radioInput_g5w3n_147:checked ~ ._Input-radioInner_g5w3n_102 {
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--readOnly_g5w3n_74 ._Input-radioInput_g5w3n_147:checked ~ ._Input-radioInner_g5w3n_102 {
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-radio_g5w3n_85 ._Input-radioInput_g5w3n_147 {
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-input_g5w3n_26 {
376
+ textarea._Input-input_4xor1_26 {
372
377
  margin-bottom: -4px;
373
378
  }
374
379
 
@@ -612,6 +617,19 @@ textarea._Input-input_g5w3n_26 {
612
617
  }
613
618
  }
614
619
 
620
+ /* components/Sortable/styles.css */
621
+ [data-dnd-placeholder] * {
622
+ opacity: 0 !important;
623
+ }
624
+ [data-dnd-placeholder] {
625
+ background: var(--puck-color-azure-09) !important;
626
+ border: none !important;
627
+ color: #00000000 !important;
628
+ opacity: 0.3 !important;
629
+ outline: none !important;
630
+ transition: none !important;
631
+ }
632
+
615
633
  /* css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css/#css-module-data */
616
634
  ._ExternalInput-actions_91ls0_1 {
617
635
  display: flex;
@@ -1133,12 +1151,12 @@ textarea._Input-input_g5w3n_26 {
1133
1151
  }
1134
1152
 
1135
1153
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DraggableComponent/styles.module.css/#css-module-data */
1136
- ._DraggableComponent_1ukn8_1 {
1154
+ ._DraggableComponent_qzbgx_1 {
1137
1155
  position: absolute;
1138
1156
  pointer-events: none;
1139
1157
  --overlay-background: color-mix( in srgb, var(--puck-color-azure-08) 30%, transparent );
1140
1158
  }
1141
- ._DraggableComponent-overlay_1ukn8_12 {
1159
+ ._DraggableComponent-overlay_qzbgx_12 {
1142
1160
  cursor: pointer;
1143
1161
  height: 100%;
1144
1162
  width: 100%;
@@ -1150,10 +1168,10 @@ textarea._Input-input_g5w3n_26 {
1150
1168
  box-sizing: border-box;
1151
1169
  z-index: 1;
1152
1170
  }
1153
- ._DraggableComponent_1ukn8_1:focus-visible > ._DraggableComponent-overlay_1ukn8_12 {
1171
+ ._DraggableComponent_qzbgx_1:focus-visible > ._DraggableComponent-overlay_qzbgx_12 {
1154
1172
  outline: 1px solid var(--puck-color-azure-05);
1155
1173
  }
1156
- ._DraggableComponent-loadingOverlay_1ukn8_29 {
1174
+ ._DraggableComponent-loadingOverlay_qzbgx_29 {
1157
1175
  background: var(--puck-color-white);
1158
1176
  color: var(--puck-color-grey-03);
1159
1177
  border-radius: 4px;
@@ -1168,35 +1186,36 @@ textarea._Input-input_g5w3n_26 {
1168
1186
  opacity: 0.8;
1169
1187
  z-index: 1;
1170
1188
  }
1171
- ._DraggableComponent--hover_1ukn8_45:not(._DraggableComponent--isLocked_1ukn8_45) > ._DraggableComponent-overlay_1ukn8_12 {
1189
+ ._DraggableComponent--hover_qzbgx_45:not(._DraggableComponent--isLocked_qzbgx_45) > ._DraggableComponent-overlay_qzbgx_12 {
1172
1190
  background: var(--overlay-background);
1173
1191
  }
1174
- ._DraggableComponent--hover_1ukn8_45 > ._DraggableComponent-overlay_1ukn8_12 {
1192
+ ._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12 {
1175
1193
  outline: 2px var(--puck-color-azure-09) solid;
1176
1194
  }
1177
- ._DraggableComponent--isSelected_1ukn8_54 > ._DraggableComponent-overlay_1ukn8_12 {
1195
+ ._DraggableComponent--isSelected_qzbgx_54 > ._DraggableComponent-overlay_qzbgx_12 {
1178
1196
  outline-color: var(--puck-color-azure-07);
1179
1197
  }
1180
- ._DraggableComponent_1ukn8_1:has(._DraggableComponent--hover_1ukn8_45 > ._DraggableComponent-overlay_1ukn8_12) > ._DraggableComponent-overlay_1ukn8_12 {
1198
+ ._DraggableComponent_qzbgx_1:has(._DraggableComponent--hover_qzbgx_45 > ._DraggableComponent-overlay_qzbgx_12) > ._DraggableComponent-overlay_qzbgx_12 {
1181
1199
  display: none;
1182
1200
  }
1183
- ._DraggableComponent-actionsOverlay_1ukn8_66 {
1201
+ ._DraggableComponent-actionsOverlay_qzbgx_66 {
1184
1202
  position: sticky;
1185
1203
  opacity: 0;
1186
1204
  pointer-events: none;
1187
1205
  z-index: 2;
1188
1206
  }
1189
- ._DraggableComponent--isSelected_1ukn8_54 ._DraggableComponent-actionsOverlay_1ukn8_66 {
1207
+ ._DraggableComponent--isSelected_qzbgx_54 ._DraggableComponent-actionsOverlay_qzbgx_66 {
1190
1208
  opacity: 1;
1191
1209
  pointer-events: auto;
1192
1210
  }
1193
- ._DraggableComponent-actions_1ukn8_66 {
1211
+ ._DraggableComponent-actions_qzbgx_66 {
1194
1212
  position: absolute;
1195
1213
  width: auto;
1196
1214
  cursor: grab;
1197
1215
  display: flex;
1198
1216
  box-sizing: border-box;
1199
1217
  transform-origin: right top;
1218
+ min-height: 36px;
1200
1219
  }
1201
1220
 
1202
1221
  /* components/DraggableComponent/styles.css */
@@ -1237,57 +1256,55 @@ textarea._Input-input_g5w3n_26 {
1237
1256
  }
1238
1257
 
1239
1258
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css/#css-module-data */
1240
- ._DropZone_kmkdc_1 {
1259
+ ._DropZone_3dmev_1 {
1241
1260
  --resize-animation-ms: 150ms;
1242
1261
  position: relative;
1243
1262
  height: 100%;
1263
+ min-height: var(--min-empty-height);
1244
1264
  outline-offset: -2px;
1245
1265
  width: 100%;
1246
1266
  }
1247
- ._DropZone--isActive_kmkdc_10 {
1248
- min-height: var(--min-empty-height);
1249
- }
1250
- ._DropZone--hasChildren_kmkdc_14 {
1267
+ ._DropZone--hasChildren_3dmev_11 {
1251
1268
  min-height: 0;
1252
1269
  }
1253
- ._DropZone--isActive_kmkdc_10._DropZone_kmkdc_1:empty {
1270
+ ._DropZone_3dmev_1:empty {
1254
1271
  min-height: var(--min-empty-height);
1255
1272
  }
1256
- ._DropZone_kmkdc_1:not(._DropZone--userIsDragging_kmkdc_22) {
1273
+ ._DropZone_3dmev_1:not(._DropZone--userIsDragging_3dmev_19) {
1257
1274
  transition: min-height var(--resize-animation-ms) ease-in;
1258
1275
  }
1259
- ._DropZone--isAreaSelected_kmkdc_26,
1260
- ._DropZone--hoveringOverArea_kmkdc_27:not(._DropZone--isRootZone_kmkdc_27) {
1276
+ ._DropZone--isAreaSelected_3dmev_23,
1277
+ ._DropZone--hoveringOverArea_3dmev_24:not(._DropZone--isRootZone_3dmev_24) {
1261
1278
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
1262
1279
  outline: 2px dashed var(--puck-color-azure-08);
1263
1280
  }
1264
- ._DropZone_kmkdc_1:empty {
1281
+ ._DropZone_3dmev_1:empty {
1265
1282
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
1266
1283
  outline: 2px dashed var(--puck-color-azure-08);
1267
1284
  }
1268
- ._DropZone--isDestination_kmkdc_37 {
1285
+ ._DropZone--isDestination_3dmev_34 {
1269
1286
  outline: 2px dashed var(--puck-color-azure-04) !important;
1270
1287
  }
1271
- ._DropZone--isDestination_kmkdc_37:not(._DropZone--isRootZone_kmkdc_27) {
1288
+ ._DropZone--isDestination_3dmev_34:not(._DropZone--isRootZone_3dmev_24) {
1272
1289
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent) !important;
1273
1290
  }
1274
- ._DropZone-item_kmkdc_49 {
1291
+ ._DropZone-item_3dmev_46 {
1275
1292
  position: relative;
1276
1293
  }
1277
- ._DropZone-hitbox_kmkdc_53 {
1294
+ ._DropZone-hitbox_3dmev_50 {
1278
1295
  position: absolute;
1279
1296
  bottom: -12px;
1280
1297
  height: 24px;
1281
1298
  width: 100%;
1282
1299
  z-index: 1;
1283
1300
  }
1284
- ._DropZone--isEnabled_kmkdc_61._DropZone--userIsDragging_kmkdc_22 {
1301
+ ._DropZone--isEnabled_3dmev_58._DropZone--userIsDragging_3dmev_19 {
1285
1302
  outline: 2px dashed var(--puck-color-azure-06);
1286
1303
  }
1287
- ._DropZone_kmkdc_1 > *:not([data-puck-component]) {
1304
+ ._DropZone_3dmev_1 > *:not([data-puck-component]) {
1288
1305
  opacity: 0;
1289
1306
  }
1290
- body:has(._DropZone--isAnimating_kmkdc_70:empty) [data-puck-overlay] {
1307
+ body:has(._DropZone--isAnimating_3dmev_67:empty) [data-puck-overlay] {
1291
1308
  opacity: 0 !important;
1292
1309
  }
1293
1310
 
package/dist/index.d.mts CHANGED
@@ -1,9 +1,109 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-wwgDuTnC.mjs';
2
- export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-wwgDuTnC.mjs';
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,119 +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 PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
152
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
153
- [key: string]: any;
154
- }) => Props[ComponentName];
155
- } & {
156
- root: (props: RootProps & {
157
- [key: string]: any;
158
- }) => RootProps;
159
- }>;
160
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
161
-
162
- type HistorySlice<D = any> = {
163
- index: number;
164
- hasPast: () => boolean;
165
- hasFuture: () => boolean;
166
- histories: History<D>[];
167
- record: (data: D) => void;
168
- back: VoidFunction;
169
- forward: VoidFunction;
170
- currentHistory: () => History;
171
- nextHistory: () => History<D> | null;
172
- prevHistory: () => History<D> | null;
173
- setHistories: (histories: History[]) => void;
174
- setHistoryIndex: (index: number) => void;
175
- initialAppState: D;
176
- };
177
-
178
- type NodeMethods = {
179
- sync: () => void;
180
- };
181
- type PuckNode = {
182
- id: string;
183
- methods: NodeMethods;
184
- data: ComponentData;
185
- parentId: string | null;
186
- zone: string;
187
- path: string[];
188
- index: number;
189
- element: HTMLElement | null;
190
- };
191
- type NodesSlice = {
192
- nodes: Record<string, PuckNode | undefined>;
193
- registerNode: (id: string, node: Partial<PuckNode>) => void;
194
- unregisterNode: (id: string, node?: Partial<PuckNode>) => void;
195
- };
196
-
197
- type PermissionsArgs<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
198
- item?: G["UserComponentData"] | null;
199
- type?: keyof G["UserProps"];
200
- root?: boolean;
201
- };
202
- type GetPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>) => Permissions;
203
- type ResolvePermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
204
- type RefreshPermissions<UserConfig extends Config = Config> = (params?: PermissionsArgs<UserConfig>, force?: boolean) => void;
205
- type Cache = Record<string, {
206
- lastPermissions: Partial<Permissions>;
207
- lastData: ComponentData | null;
208
- }>;
209
- type PermissionsSlice = {
210
- cache: Cache;
211
- globalPermissions: Permissions;
212
- resolvedPermissions: Record<string, Partial<Permissions> | undefined>;
213
- getPermissions: GetPermissions<Config>;
214
- resolvePermissions: ResolvePermissions<Config>;
215
- refreshPermissions: RefreshPermissions<Config>;
216
- };
217
-
218
- type ComponentOrRootData = Omit<ComponentData<any>, "type">;
219
- type FieldsSlice = {
220
- fields: Fields | Partial<Fields>;
221
- loading: boolean;
222
- lastResolvedData: Partial<ComponentOrRootData>;
223
- };
224
-
225
- type Status = "LOADING" | "MOUNTED" | "READY";
226
- type ZoomConfig = {
227
- autoZoom: number;
228
- rootHeight: number;
229
- zoom: number;
230
- };
231
- type ComponentState = Record<string, {
232
- loadingCount: number;
233
- }>;
234
- type AppStore<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
235
- state: G["UserAppState"];
236
- dispatch: (action: PuckAction) => void;
237
- config: UserConfig;
238
- componentState: ComponentState;
239
- setComponentState: (componentState: ComponentState) => void;
240
- setComponentLoading: (id: string) => void;
241
- unsetComponentLoading: (id: string) => void;
242
- resolveDataRuns: number;
243
- resolveData: (newAppState: AppState) => void;
244
- plugins: Plugin[];
245
- overrides: Partial<Overrides>;
246
- viewports: Viewports;
247
- zoomConfig: ZoomConfig;
248
- setZoomConfig: (zoomConfig: ZoomConfig) => void;
249
- status: Status;
250
- setStatus: (status: Status) => void;
251
- iframe: IframeConfig;
252
- selectedItem?: G["UserData"]["content"][0] | null;
253
- setUi: (ui: Partial<UiState>, recordHistory?: boolean) => void;
254
- getComponentConfig: (type?: string) => ComponentConfig | null | undefined;
255
- onAction?: (action: PuckAction, newState: AppState, state: AppState) => void;
256
- metadata: Metadata;
257
- fields: FieldsSlice;
258
- history: HistorySlice;
259
- nodes: NodesSlice;
260
- permissions: PermissionsSlice;
251
+ type MapSlotOptions = {
252
+ parentId: string;
253
+ propName: string;
261
254
  };
255
+ declare function mapSlotsPublic<T extends ComponentData | RootData>(item: T, config: Config, map: (data: Content, options: MapSlotOptions) => Content): T;
262
256
 
263
257
  type WithGet<T> = T & {
264
258
  get: () => T;
@@ -270,6 +264,9 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
270
264
  getPermissions: GetPermissions<UserConfig>;
271
265
  refreshPermissions: RefreshPermissions<UserConfig>;
272
266
  selectedItem: G["UserComponentData"] | null;
267
+ getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
268
+ getItemById: (id: string) => ComponentData | undefined;
269
+ getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
273
270
  history: {
274
271
  back: HistorySlice["back"];
275
272
  forward: HistorySlice["forward"];
@@ -281,7 +278,8 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
281
278
  hasFuture: boolean;
282
279
  };
283
280
  };
284
- type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<UserConfig>>;
281
+ type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
282
+ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
285
283
  /**
286
284
  * createUsePuck
287
285
  *
@@ -291,7 +289,7 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
291
289
  *
292
290
  * @returns a typed usePuck function
293
291
  */
294
- declare function createUsePuck<UserConfig extends Config = Config>(): <T = UsePuckData<UserConfig, UserGenerics<UserConfig>>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
292
+ declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
295
293
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
296
294
 
297
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, 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, transformProps, 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 };