@measured/puck 0.19.0-canary.5bf4fccf → 0.19.0-canary.6dc5101e

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.
@@ -8,9 +8,6 @@ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
8
  var __getProtoOf = Object.getPrototypeOf;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
10
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __typeError = (msg) => {
12
- throw TypeError(msg);
13
- };
14
11
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
15
12
  var __spreadValues = (a, b) => {
16
13
  for (var prop in b || (b = {}))
@@ -58,10 +55,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
58
55
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
59
56
  mod
60
57
  ));
61
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
62
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
63
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
64
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
65
58
  var __async = (__this, __arguments, generator) => {
66
59
  return new Promise((resolve, reject) => {
67
60
  var fulfilled = (value) => {
@@ -363,6 +356,316 @@ function Render({
363
356
  );
364
357
  }
365
358
 
359
+ // lib/migrate.ts
360
+ init_react_import();
361
+
362
+ // store/default-app-state.ts
363
+ init_react_import();
364
+
365
+ // components/ViewportControls/default-viewports.ts
366
+ init_react_import();
367
+ var defaultViewports = [
368
+ { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
369
+ { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
370
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
371
+ ];
372
+
373
+ // store/default-app-state.ts
374
+ var defaultAppState = {
375
+ data: { content: [], root: {}, zones: {} },
376
+ ui: {
377
+ leftSideBarVisible: true,
378
+ rightSideBarVisible: true,
379
+ arrayState: {},
380
+ itemSelector: null,
381
+ componentList: {},
382
+ isDragging: false,
383
+ previewMode: "edit",
384
+ viewports: {
385
+ current: {
386
+ width: defaultViewports[0].width,
387
+ height: defaultViewports[0].height || "auto"
388
+ },
389
+ options: [],
390
+ controlsVisible: true
391
+ },
392
+ field: { focus: null }
393
+ },
394
+ indexes: {
395
+ nodes: {},
396
+ zones: {}
397
+ }
398
+ };
399
+
400
+ // lib/data/walk-app-state.ts
401
+ init_react_import();
402
+
403
+ // lib/data/for-each-slot.ts
404
+ init_react_import();
405
+ var forEachSlot = (item, cb, recursive = false, isSlot2 = isSlot) => {
406
+ const props = item.props || {};
407
+ const propKeys = Object.keys(props);
408
+ for (let i = 0; i < propKeys.length; i++) {
409
+ const propKey = propKeys[i];
410
+ const itemType = "type" in item ? item.type : "root";
411
+ if (isSlot2(itemType, propKey, props[propKey])) {
412
+ const content = props[propKey];
413
+ cb(props.id, propKey, content);
414
+ if (recursive) {
415
+ content.forEach(
416
+ (childItem) => __async(void 0, null, function* () {
417
+ return forEachSlot(childItem, cb, true, isSlot2);
418
+ })
419
+ );
420
+ }
421
+ }
422
+ }
423
+ };
424
+
425
+ // lib/data/for-related-zones.ts
426
+ init_react_import();
427
+
428
+ // lib/get-zone-id.ts
429
+ init_react_import();
430
+ var getZoneId = (zoneCompound) => {
431
+ if (!zoneCompound) {
432
+ return [];
433
+ }
434
+ if (zoneCompound && zoneCompound.indexOf(":") > -1) {
435
+ return zoneCompound.split(":");
436
+ }
437
+ return [rootDroppableId, zoneCompound];
438
+ };
439
+
440
+ // lib/data/for-related-zones.ts
441
+ function forRelatedZones(item, data, cb, path = []) {
442
+ Object.entries(data.zones || {}).forEach(([zoneCompound, content]) => {
443
+ const [parentId] = getZoneId(zoneCompound);
444
+ if (parentId === item.props.id) {
445
+ cb(path, zoneCompound, content);
446
+ }
447
+ });
448
+ }
449
+
450
+ // lib/data/strip-slots.ts
451
+ init_react_import();
452
+ var stripSlots = (data) => {
453
+ return __spreadProps(__spreadValues({}, data), {
454
+ props: Object.entries(data.props).reduce(
455
+ (acc, [propKey, propVal]) => {
456
+ if (isSlot(propVal)) {
457
+ return acc;
458
+ }
459
+ return __spreadProps(__spreadValues({}, acc), { [propKey]: propVal });
460
+ },
461
+ { id: data.props.id }
462
+ )
463
+ });
464
+ };
465
+
466
+ // lib/data/walk-app-state.ts
467
+ function walkAppState(state, config, mapContent = (content) => content, mapNodeOrSkip = (item) => item) {
468
+ var _a;
469
+ let newZones = {};
470
+ const newZoneIndex = {};
471
+ const newNodeIndex = {};
472
+ const processContent = (path, zoneCompound, content, zoneType, newId) => {
473
+ var _a2;
474
+ const [parentId] = zoneCompound.split(":");
475
+ const mappedContent = ((_a2 = mapContent(content, zoneCompound, zoneType)) != null ? _a2 : content) || [];
476
+ const [_2, zone] = zoneCompound.split(":");
477
+ const newZoneCompound = `${newId || parentId}:${zone}`;
478
+ const newContent2 = mappedContent.map(
479
+ (zoneChild, index) => processItem(zoneChild, [...path, newZoneCompound], index)
480
+ );
481
+ newZoneIndex[newZoneCompound] = {
482
+ contentIds: newContent2.map((item) => item.props.id),
483
+ type: zoneType
484
+ };
485
+ return [newZoneCompound, newContent2];
486
+ };
487
+ const processRelatedZones = (item, newId, initialPath) => {
488
+ forRelatedZones(
489
+ item,
490
+ state.data,
491
+ (relatedPath, relatedZoneCompound, relatedContent) => {
492
+ const [zoneCompound, newContent2] = processContent(
493
+ relatedPath,
494
+ relatedZoneCompound,
495
+ relatedContent,
496
+ "dropzone",
497
+ newId
498
+ );
499
+ newZones[zoneCompound] = newContent2;
500
+ },
501
+ initialPath
502
+ );
503
+ };
504
+ const processItem = (item, path, index) => {
505
+ const mappedItem = mapNodeOrSkip(item, path, index);
506
+ if (!mappedItem) return item;
507
+ const id = mappedItem.props.id;
508
+ const newProps = __spreadValues({}, mappedItem.props);
509
+ forEachSlot(
510
+ mappedItem,
511
+ (parentId2, slotId, content) => {
512
+ const zoneCompound = `${parentId2}:${slotId}`;
513
+ const [_2, newContent2] = processContent(
514
+ path,
515
+ zoneCompound,
516
+ content,
517
+ "slot",
518
+ parentId2
519
+ );
520
+ newProps[slotId] = newContent2;
521
+ },
522
+ false,
523
+ createIsSlotConfig(config)
524
+ );
525
+ processRelatedZones(item, id, path);
526
+ const newItem = __spreadProps(__spreadValues({}, item), { props: newProps });
527
+ const thisZoneCompound = path[path.length - 1];
528
+ const [parentId, zone] = thisZoneCompound ? thisZoneCompound.split(":") : [null, ""];
529
+ newNodeIndex[id] = {
530
+ data: newItem,
531
+ flatData: stripSlots(newItem),
532
+ path,
533
+ parentId,
534
+ zone
535
+ };
536
+ const finalData = __spreadProps(__spreadValues({}, newItem), { props: __spreadValues({}, newItem.props) });
537
+ if (newProps.id === "root") {
538
+ delete finalData["type"];
539
+ delete finalData.props["id"];
540
+ }
541
+ return finalData;
542
+ };
543
+ const zones = state.data.zones || {};
544
+ const [_, newContent] = processContent(
545
+ [],
546
+ rootDroppableId,
547
+ state.data.content,
548
+ "root"
549
+ );
550
+ const processedContent = newContent;
551
+ const zonesAlreadyProcessed = Object.keys(newZones);
552
+ Object.keys(zones || {}).forEach((zoneCompound) => {
553
+ const [parentId] = zoneCompound.split(":");
554
+ if (zonesAlreadyProcessed.includes(zoneCompound)) {
555
+ return;
556
+ }
557
+ const [_2, newContent2] = processContent(
558
+ [rootDroppableId],
559
+ zoneCompound,
560
+ zones[zoneCompound],
561
+ "dropzone",
562
+ parentId
563
+ );
564
+ newZones[zoneCompound] = newContent2;
565
+ }, newZones);
566
+ const processedRoot = processItem(
567
+ {
568
+ type: "root",
569
+ props: __spreadProps(__spreadValues({}, (_a = state.data.root.props) != null ? _a : state.data.root), { id: "root" })
570
+ },
571
+ [],
572
+ -1
573
+ );
574
+ const root = __spreadProps(__spreadValues({}, state.data.root), {
575
+ props: processedRoot.props
576
+ });
577
+ return __spreadProps(__spreadValues({}, state), {
578
+ data: {
579
+ root,
580
+ content: processedContent,
581
+ zones: __spreadValues(__spreadValues({}, state.data.zones), newZones)
582
+ },
583
+ indexes: {
584
+ nodes: __spreadValues(__spreadValues({}, state.indexes.nodes), newNodeIndex),
585
+ zones: __spreadValues(__spreadValues({}, state.indexes.zones), newZoneIndex)
586
+ }
587
+ });
588
+ }
589
+
590
+ // lib/migrate.ts
591
+ var migrations = [
592
+ // Migrate root to root.props
593
+ (data) => {
594
+ const rootProps = data.root.props || data.root;
595
+ if (Object.keys(data.root).length > 0 && !data.root.props) {
596
+ console.warn(
597
+ "Migration applied: Root props moved from `root` to `root.props`."
598
+ );
599
+ return __spreadProps(__spreadValues({}, data), {
600
+ root: {
601
+ props: __spreadValues({}, rootProps)
602
+ }
603
+ });
604
+ }
605
+ return data;
606
+ },
607
+ // Migrate zones to slots
608
+ (data, config) => {
609
+ var _a;
610
+ if (!config) return data;
611
+ console.log("Migrating DropZones to slots...");
612
+ const updatedItems = {};
613
+ const appState = __spreadProps(__spreadValues({}, defaultAppState), { data });
614
+ const { indexes } = walkAppState(appState, config);
615
+ const deletedCompounds = [];
616
+ walkAppState(appState, config, (content, zoneCompound, zoneType) => {
617
+ var _a2, _b;
618
+ if (zoneType === "dropzone") {
619
+ const [id, slotName] = zoneCompound.split(":");
620
+ const nodeData = indexes.nodes[id].data;
621
+ const componentType = nodeData.type;
622
+ const configForComponent = id === "root" ? config.root : config.components[componentType];
623
+ if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
624
+ updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
625
+ props: __spreadProps(__spreadValues({}, nodeData.props), {
626
+ [slotName]: content
627
+ })
628
+ });
629
+ deletedCompounds.push(zoneCompound);
630
+ }
631
+ return content;
632
+ }
633
+ return content;
634
+ });
635
+ const updated = walkAppState(
636
+ appState,
637
+ config,
638
+ (content) => content,
639
+ (item) => {
640
+ var _a2;
641
+ return (_a2 = updatedItems[item.props.id]) != null ? _a2 : item;
642
+ }
643
+ );
644
+ deletedCompounds.forEach((zoneCompound) => {
645
+ var _a2;
646
+ const [_, propName] = zoneCompound.split(":");
647
+ console.log(
648
+ `\u2713 Success: Migrated "${zoneCompound}" from DropZone to slot field "${propName}"`
649
+ );
650
+ (_a2 = updated.data.zones) == null ? true : delete _a2[zoneCompound];
651
+ });
652
+ Object.keys((_a = updated.data.zones) != null ? _a : {}).forEach((zoneCompound) => {
653
+ const [_, propName] = zoneCompound.split(":");
654
+ throw new Error(
655
+ `Could not migrate DropZone "${zoneCompound}" to slot field. No slot exists with the name "${propName}".`
656
+ );
657
+ });
658
+ delete updated.data.zones;
659
+ return updated.data;
660
+ }
661
+ ];
662
+ function migrate(data, config) {
663
+ return migrations == null ? void 0 : migrations.reduce(
664
+ (acc, migration) => migration(acc, config),
665
+ data
666
+ );
667
+ }
668
+
366
669
  // lib/transform-props.ts
367
670
  init_react_import();
368
671
 
@@ -374,11 +677,13 @@ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
374
677
  });
375
678
 
376
679
  // lib/transform-props.ts
377
- function transformProps(data, propTransforms) {
680
+ function transformProps(data, propTransforms, config = { components: {} }) {
378
681
  const mapItem = (item) => {
379
682
  if (propTransforms[item.type]) {
380
683
  return __spreadProps(__spreadValues({}, item), {
381
- props: propTransforms[item.type](item.props)
684
+ props: __spreadValues({
685
+ id: item.props.id
686
+ }, propTransforms[item.type](item.props))
382
687
  });
383
688
  }
384
689
  return item;
@@ -387,23 +692,18 @@ function transformProps(data, propTransforms) {
387
692
  const rootProps = defaultedData.root.props || defaultedData.root;
388
693
  let newRoot = __spreadValues({}, defaultedData.root);
389
694
  if (propTransforms["root"]) {
390
- if (defaultedData.root.props) {
391
- newRoot.props = propTransforms["root"](rootProps);
392
- } else {
393
- newRoot = propTransforms["root"](rootProps);
394
- }
695
+ newRoot.props = propTransforms["root"](rootProps);
395
696
  }
396
- const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
397
- root: newRoot,
398
- content: defaultedData.content.map(mapItem),
399
- zones: Object.keys(data.zones || {}).reduce(
400
- (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
401
- [zoneKey]: data.zones[zoneKey].map(mapItem)
402
- }),
403
- {}
404
- )
405
- });
406
- return afterPropTransforms;
697
+ const dataWithUpdatedRoot = __spreadProps(__spreadValues({}, defaultedData), { root: newRoot });
698
+ const updatedData = walkTree(
699
+ dataWithUpdatedRoot,
700
+ config,
701
+ (content) => content.map(mapItem)
702
+ );
703
+ if (!defaultedData.root.props) {
704
+ updatedData.root = updatedData.root.props;
705
+ }
706
+ return updatedData;
407
707
  }
408
708
 
409
709
  // lib/resolve-all-data.ts
@@ -553,24 +853,23 @@ export {
553
853
  __objRest,
554
854
  __commonJS,
555
855
  __toESM,
556
- __privateGet,
557
- __privateAdd,
558
- __privateSet,
559
856
  __async,
560
857
  init_react_import,
561
- isSlot,
562
- createIsSlotConfig,
563
858
  rootAreaId,
564
859
  rootZone,
565
860
  rootDroppableId,
861
+ walkAppState,
566
862
  walkTree,
567
863
  setupZone,
864
+ defaultViewports,
568
865
  getChanged,
569
866
  resolveComponentData,
867
+ defaultAppState,
570
868
  useSlots,
571
869
  Render,
572
870
  SlotRenderPure,
573
871
  SlotRender,
872
+ migrate,
574
873
  transformProps,
575
874
  resolveAllData
576
875
  };
package/dist/index.css CHANGED
@@ -1234,7 +1234,7 @@ textarea._Input-input_4xor1_26 {
1234
1234
  [data-puck-disabled] {
1235
1235
  cursor: pointer;
1236
1236
  }
1237
- [data-puck-dragging]:not([data-dnd-dragging]) {
1237
+ [data-dnd-placeholder] {
1238
1238
  background: var(--puck-color-azure-06) !important;
1239
1239
  border: none !important;
1240
1240
  color: #00000000 !important;
@@ -1242,9 +1242,9 @@ textarea._Input-input_4xor1_26 {
1242
1242
  outline: none !important;
1243
1243
  transition: none !important;
1244
1244
  }
1245
- [data-puck-dragging]:not([data-dnd-dragging]) *,
1246
- [data-puck-dragging]:not([data-dnd-dragging])::after,
1247
- [data-puck-dragging]:not([data-dnd-dragging])::before {
1245
+ [data-dnd-placeholder] *,
1246
+ [data-dnd-placeholder]::after,
1247
+ [data-dnd-placeholder]::before {
1248
1248
  opacity: 0 !important;
1249
1249
  }
1250
1250
  [data-dnd-dragging][data-puck-component] {
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
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 ItemSelector } from './walk-tree-CM-cu7GU.mjs';
2
- export { Z as Adaptor, X as ArrayField, t as ArrayState, aa as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a1 as CustomField, a0 as CustomFieldRender, a7 as DefaultComponentProps, a4 as DefaultRootFieldProps, a6 as DefaultRootProps, a5 as DefaultRootRenderProps, m as Direction, n as DragAxis, $ as ExternalField, _ as ExternalFieldWithAdaptor, ac as ExtractPropsFromConfig, ad as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Y as ObjectField, q as OverrideKey, u as PuckComponent, a3 as PuckContext, W as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a2 as SlotField, T as TextField, L as TextareaField, o as Viewport, ab as WithChildren, a8 as WithId, a9 as WithPuckProps, p as overrideKeys, af as resolveAllData, ae as transformProps, w as walkTree } from './walk-tree-CM-cu7GU.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 ItemSelector } from './walk-tree-DOB5QZVq.mjs';
2
+ export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DOB5QZVq.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';
@@ -247,8 +247,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
247
247
  metadata?: Metadata;
248
248
  }): react_jsx_runtime.JSX.Element;
249
249
 
250
- declare function migrate(data: Data, config?: Config): Data;
251
-
252
250
  type WithGet<T> = T & {
253
251
  get: () => T;
254
252
  };
@@ -286,5 +284,11 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConf
286
284
  */
287
285
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
288
286
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
287
+ /**
288
+ * Get the latest state without relying on a render
289
+ *
290
+ * @returns PuckApi
291
+ */
292
+ declare function useGetPuck(): () => UsePuckStore<Config>;
289
293
 
290
- 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, usePuck };
294
+ 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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 ItemSelector } from './walk-tree-CM-cu7GU.js';
2
- export { Z as Adaptor, X as ArrayField, t as ArrayState, aa as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a1 as CustomField, a0 as CustomFieldRender, a7 as DefaultComponentProps, a4 as DefaultRootFieldProps, a6 as DefaultRootProps, a5 as DefaultRootRenderProps, m as Direction, n as DragAxis, $ as ExternalField, _ as ExternalFieldWithAdaptor, ac as ExtractPropsFromConfig, ad as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Y as ObjectField, q as OverrideKey, u as PuckComponent, a3 as PuckContext, W as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a2 as SlotField, T as TextField, L as TextareaField, o as Viewport, ab as WithChildren, a8 as WithId, a9 as WithPuckProps, p as overrideKeys, af as resolveAllData, ae as transformProps, w as walkTree } from './walk-tree-CM-cu7GU.js';
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 ItemSelector } from './walk-tree-DOB5QZVq.js';
2
+ export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DOB5QZVq.js';
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';
@@ -247,8 +247,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
247
247
  metadata?: Metadata;
248
248
  }): react_jsx_runtime.JSX.Element;
249
249
 
250
- declare function migrate(data: Data, config?: Config): Data;
251
-
252
250
  type WithGet<T> = T & {
253
251
  get: () => T;
254
252
  };
@@ -286,5 +284,11 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConf
286
284
  */
287
285
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
288
286
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
287
+ /**
288
+ * Get the latest state without relying on a render
289
+ *
290
+ * @returns PuckApi
291
+ */
292
+ declare function useGetPuck(): () => UsePuckStore<Config>;
289
293
 
290
- 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, usePuck };
294
+ 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };