@measured/puck 0.16.1-canary.ed282b9 → 0.16.2-canary.36d53b4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,248 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __objRest = (source, exclude) => {
25
+ var target = {};
26
+ for (var prop in source)
27
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
+ target[prop] = source[prop];
29
+ if (source != null && __getOwnPropSymbols)
30
+ for (var prop of __getOwnPropSymbols(source)) {
31
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
+ target[prop] = source[prop];
33
+ }
34
+ return target;
35
+ };
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS = (cb, mod) => function __require() {
40
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
+ mod
57
+ ));
58
+ var __async = (__this, __arguments, generator) => {
59
+ return new Promise((resolve, reject) => {
60
+ var fulfilled = (value) => {
61
+ try {
62
+ step(generator.next(value));
63
+ } catch (e) {
64
+ reject(e);
65
+ }
66
+ };
67
+ var rejected = (value) => {
68
+ try {
69
+ step(generator.throw(value));
70
+ } catch (e) {
71
+ reject(e);
72
+ }
73
+ };
74
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
+ step((generator = generator.apply(__this, __arguments)).next());
76
+ });
77
+ };
78
+
79
+ // ../tsup-config/react-import.js
80
+ import React from "react";
81
+ var init_react_import = __esm({
82
+ "../tsup-config/react-import.js"() {
83
+ "use strict";
84
+ }
85
+ });
86
+
87
+ // lib/resolve-all-data.ts
88
+ init_react_import();
89
+
90
+ // lib/resolve-component-data.ts
91
+ init_react_import();
92
+
93
+ // lib/get-changed.ts
94
+ init_react_import();
95
+ var getChanged = (newItem, oldItem) => {
96
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
97
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
98
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
99
+ return __spreadProps(__spreadValues({}, acc), {
100
+ [item]: oldItemProps[item] !== newItemProps[item]
101
+ });
102
+ }, {}) : {};
103
+ };
104
+
105
+ // lib/resolve-component-data.ts
106
+ var cache = { lastChange: {} };
107
+ var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
108
+ return yield Promise.all(
109
+ content.map((item) => __async(void 0, null, function* () {
110
+ return yield resolveComponentData(
111
+ item,
112
+ config,
113
+ onResolveStart,
114
+ onResolveEnd
115
+ );
116
+ }))
117
+ );
118
+ });
119
+ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
120
+ const configForItem = config.components[item.type];
121
+ if (configForItem.resolveData) {
122
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
123
+ if (item && item === oldItem) {
124
+ return resolved;
125
+ }
126
+ const changed = getChanged(item, oldItem);
127
+ if (onResolveStart) {
128
+ onResolveStart(item);
129
+ }
130
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
131
+ const { readOnly: existingReadOnly = {} } = item || {};
132
+ const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
133
+ const resolvedItem = __spreadProps(__spreadValues({}, item), {
134
+ props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
135
+ });
136
+ if (Object.keys(newReadOnly).length) {
137
+ resolvedItem.readOnly = newReadOnly;
138
+ }
139
+ cache.lastChange[item.props.id] = {
140
+ item,
141
+ resolved: resolvedItem
142
+ };
143
+ if (onResolveEnd) {
144
+ onResolveEnd(resolvedItem);
145
+ }
146
+ return resolvedItem;
147
+ }
148
+ return item;
149
+ });
150
+
151
+ // lib/resolve-root-data.ts
152
+ init_react_import();
153
+ var cache2 = {};
154
+ function resolveRootData(data, config) {
155
+ return __async(this, null, function* () {
156
+ var _a, _b, _c, _d, _e;
157
+ if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
158
+ if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
159
+ return cache2.lastChange.resolved;
160
+ }
161
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
162
+ const rootWithProps = data.root;
163
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
164
+ changed,
165
+ lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
166
+ });
167
+ cache2.lastChange = {
168
+ original: data.root,
169
+ resolved: resolvedRoot
170
+ };
171
+ return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
172
+ props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
173
+ });
174
+ }
175
+ return data.root;
176
+ });
177
+ }
178
+
179
+ // lib/default-data.ts
180
+ init_react_import();
181
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
182
+ root: data.root || {},
183
+ content: data.content || []
184
+ });
185
+
186
+ // lib/resolve-all-data.ts
187
+ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
188
+ return __async(this, null, function* () {
189
+ const defaultedData = defaultData(data);
190
+ const dynamicRoot = yield resolveRootData(defaultedData, config);
191
+ const { zones = {} } = data;
192
+ const zoneKeys = Object.keys(zones);
193
+ const resolvedZones = {};
194
+ for (let i = 0; i < zoneKeys.length; i++) {
195
+ const zoneKey = zoneKeys[i];
196
+ resolvedZones[zoneKey] = yield resolveAllComponentData(
197
+ zones[zoneKey],
198
+ config,
199
+ onResolveStart,
200
+ onResolveEnd
201
+ );
202
+ }
203
+ return __spreadProps(__spreadValues({}, defaultedData), {
204
+ root: dynamicRoot,
205
+ content: yield resolveAllComponentData(
206
+ defaultedData.content,
207
+ config,
208
+ onResolveStart,
209
+ onResolveEnd
210
+ ),
211
+ zones: resolvedZones
212
+ });
213
+ });
214
+ }
215
+
216
+ // lib/root-droppable-id.ts
217
+ init_react_import();
218
+ var rootDroppableId = "default-zone";
219
+
220
+ // lib/setup-zone.ts
221
+ init_react_import();
222
+ var setupZone = (data, zoneKey) => {
223
+ if (zoneKey === rootDroppableId) {
224
+ return data;
225
+ }
226
+ const newData = __spreadProps(__spreadValues({}, data), {
227
+ zones: data.zones || {}
228
+ });
229
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
230
+ return newData;
231
+ };
232
+
233
+ export {
234
+ __spreadValues,
235
+ __spreadProps,
236
+ __objRest,
237
+ __commonJS,
238
+ __toESM,
239
+ __async,
240
+ init_react_import,
241
+ rootDroppableId,
242
+ setupZone,
243
+ getChanged,
244
+ resolveComponentData,
245
+ resolveRootData,
246
+ defaultData,
247
+ resolveAllData
248
+ };
package/dist/index.css CHANGED
@@ -1741,7 +1741,7 @@ textarea._Input-input_3pq3z_47 {
1741
1741
  }
1742
1742
 
1743
1743
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css/#css-module-data */
1744
- ._PuckCanvas_esbg1_1 {
1744
+ ._PuckCanvas_avf1c_1 {
1745
1745
  background: var(--puck-color-grey-11);
1746
1746
  display: flex;
1747
1747
  grid-area: editor;
@@ -1750,15 +1750,15 @@ textarea._Input-input_3pq3z_47 {
1750
1750
  overflow: auto;
1751
1751
  }
1752
1752
  @media (min-width: 1198px) {
1753
- ._PuckCanvas_esbg1_1 {
1753
+ ._PuckCanvas_avf1c_1 {
1754
1754
  padding: calc(var(--puck-space-px) * 1.5);
1755
1755
  padding-top: var(--puck-space-px);
1756
1756
  }
1757
- ._PuckCanvas_esbg1_1:not(._PuckCanvas_esbg1_1:has(._PuckCanvas-controls_esbg1_16)) {
1757
+ ._PuckCanvas_avf1c_1:not(._PuckCanvas_avf1c_1:has(._PuckCanvas-controls_avf1c_16)) {
1758
1758
  padding-top: calc(var(--puck-space-px) * 1.5);
1759
1759
  }
1760
1760
  }
1761
- ._PuckCanvas-inner_esbg1_21 {
1761
+ ._PuckCanvas-inner_avf1c_21 {
1762
1762
  box-sizing: border-box;
1763
1763
  display: flex;
1764
1764
  height: 100%;
@@ -1768,31 +1768,33 @@ textarea._Input-input_3pq3z_47 {
1768
1768
  position: relative;
1769
1769
  width: 100%;
1770
1770
  }
1771
- ._PuckCanvas-root_esbg1_32 {
1771
+ ._PuckCanvas-root_avf1c_32 {
1772
1772
  background: white;
1773
1773
  border: 1px solid var(--puck-color-grey-09);
1774
1774
  box-sizing: border-box;
1775
1775
  min-width: 321px;
1776
1776
  position: absolute;
1777
+ pointer-events: none;
1777
1778
  transform-origin: top;
1778
1779
  top: 0;
1779
1780
  bottom: 0;
1780
1781
  opacity: 0;
1781
1782
  }
1782
1783
  @media (min-width: 1198px) {
1783
- ._PuckCanvas-root_esbg1_32 {
1784
+ ._PuckCanvas-root_avf1c_32 {
1784
1785
  min-width: unset;
1785
1786
  }
1786
1787
  }
1787
1788
  @media (prefers-reduced-motion: reduce) {
1788
- ._PuckCanvas-root_esbg1_32 {
1789
+ ._PuckCanvas-root_avf1c_32 {
1789
1790
  transition: none !important;
1790
1791
  }
1791
1792
  }
1792
- ._PuckCanvas--ready_esbg1_56 ._PuckCanvas-root_esbg1_32 {
1793
+ ._PuckCanvas--ready_avf1c_57 ._PuckCanvas-root_avf1c_32 {
1794
+ pointer-events: unset;
1793
1795
  opacity: 1;
1794
1796
  }
1795
- ._PuckCanvas-loader_esbg1_60 {
1797
+ ._PuckCanvas-loader_avf1c_62 {
1796
1798
  align-items: center;
1797
1799
  color: var(--puck-color-grey-06);
1798
1800
  display: flex;
@@ -1801,10 +1803,10 @@ textarea._Input-input_3pq3z_47 {
1801
1803
  transition: opacity 250ms ease-out;
1802
1804
  opacity: 0;
1803
1805
  }
1804
- ._PuckCanvas--showLoader_esbg1_70 ._PuckCanvas-loader_esbg1_60 {
1806
+ ._PuckCanvas--showLoader_avf1c_72 ._PuckCanvas-loader_avf1c_62 {
1805
1807
  opacity: 1;
1806
1808
  }
1807
- ._PuckCanvas--showLoader_esbg1_70._PuckCanvas--ready_esbg1_56 ._PuckCanvas-loader_esbg1_60 {
1809
+ ._PuckCanvas--showLoader_avf1c_72._PuckCanvas--ready_avf1c_57 ._PuckCanvas-loader_avf1c_62 {
1808
1810
  opacity: 0;
1809
1811
  height: 0;
1810
1812
  transition: none;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, k as ComponentData, H as History, A as AppState, E as ExtractPropsFromConfig, l as ExtractRootPropsFromConfig, m as ComponentDataMap } from './actions-9pHbVtMU.mjs';
2
- export { L as Adaptor, J as ArrayField, s as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, u as ComponentConfig, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Y as Fields, r as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, p as OverrideKey, t as PuckComponent, Z as PuckContext, G as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, n as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys } from './actions-9pHbVtMU.mjs';
1
+ import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-CaDAfEAK.mjs';
2
+ export { L as Adaptor, J as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, t as ComponentConfig, w as ComponentData, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, p as FieldRenderFunctions, Y as Fields, q as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, n as OverrideKey, s as PuckComponent, Z as PuckContext, G as RadioField, v as RootData, R as RootDataWithProps, u as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a4 as resolveAllData } from './resolve-all-data-CaDAfEAK.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
@@ -202,8 +202,6 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
202
202
  }>;
203
203
  declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
204
204
 
205
- declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
206
-
207
205
  type HistoryStore<D = any> = {
208
206
  index: number;
209
207
  hasPast: boolean;
@@ -247,4 +245,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
247
245
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
248
246
  };
249
247
 
250
- export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
248
+ export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, k as ComponentData, H as History, A as AppState, E as ExtractPropsFromConfig, l as ExtractRootPropsFromConfig, m as ComponentDataMap } from './actions-9pHbVtMU.js';
2
- export { L as Adaptor, J as ArrayField, s as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, u as ComponentConfig, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Y as Fields, r as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, p as OverrideKey, t as PuckComponent, Z as PuckContext, G as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, n as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys } from './actions-9pHbVtMU.js';
1
+ import { F as Field, a as FieldProps, C as Config, D as Data, I as ItemSelector, P as PuckAction, b as DropZoneProps, U as UserGenerics, c as UiState, O as OnAction, d as Permissions, e as Plugin, f as Overrides, V as Viewports, g as IframeConfig, h as InitialHistory, i as DefaultComponentProps, j as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, k as ExtractRootPropsFromConfig, l as ComponentDataMap } from './resolve-all-data-CaDAfEAK.js';
2
+ export { L as Adaptor, J as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, t as ComponentConfig, w as ComponentData, x as Content, X as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, W as ExternalField, Q as ExternalFieldWithAdaptor, p as FieldRenderFunctions, Y as Fields, q as ItemWithId, M as MappedItem, N as NumberField, K as ObjectField, n as OverrideKey, s as PuckComponent, Z as PuckContext, G as RadioField, v as RootData, R as RootDataWithProps, u as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a4 as resolveAllData } from './resolve-all-data-CaDAfEAK.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';
@@ -202,8 +202,6 @@ type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps,
202
202
  }>;
203
203
  declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
204
204
 
205
- declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
206
-
207
205
  type HistoryStore<D = any> = {
208
206
  index: number;
209
207
  hasPast: boolean;
@@ -247,4 +245,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
247
245
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
248
246
  };
249
247
 
250
- export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentData, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
248
+ export { Action, ActionBar, AppState, AutoField, AutoFieldPrivate, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, DropZoneProvider, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldLabelInternal, FieldProps, type FieldPropsInternal, Group, History, IconButton, IframeConfig, InitialHistory, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, dropZoneContext, migrate, transformProps, usePuck };
package/dist/index.js CHANGED
@@ -764,16 +764,15 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
764
764
  const resolveDataForItem = (0, import_react4.useCallback)(
765
765
  (item, force = false) => __async(void 0, null, function* () {
766
766
  var _a, _b, _c;
767
- setComponentLoading == null ? void 0 : setComponentLoading(item.props.id);
768
767
  const componentConfig = item.type === "root" ? config.root : config.components[item.type];
769
768
  if (!componentConfig) {
770
- unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
771
769
  return;
772
770
  }
773
771
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
774
772
  if (componentConfig.resolvePermissions) {
775
773
  const changed = getChanged(item, (_a = cache3[item.props.id]) == null ? void 0 : _a.lastData);
776
774
  if (Object.values(changed).some((el) => el === true) || force) {
775
+ setComponentLoading == null ? void 0 : setComponentLoading(item.props.id);
777
776
  const resolvedPermissions2 = yield componentConfig.resolvePermissions(
778
777
  item,
779
778
  {
@@ -793,9 +792,9 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
793
792
  setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
794
793
  [item.props.id]: resolvedPermissions2
795
794
  }));
795
+ unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
796
796
  }
797
797
  }
798
- unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
799
798
  }),
800
799
  [config, globalPermissions, appState, cache3]
801
800
  );
@@ -2328,9 +2327,12 @@ function AutoFieldInternal(props) {
2328
2327
  const Render2 = render[field.type];
2329
2328
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
2330
2329
  }
2330
+ var RECENT_CHANGE_TIMEOUT = 200;
2331
2331
  function AutoFieldPrivate(props) {
2332
2332
  const { value, onChange } = props;
2333
2333
  const [localValue, setLocalValue] = (0, import_react13.useState)(value);
2334
+ const [recentlyChanged, setRecentlyChanged] = (0, import_react13.useState)(false);
2335
+ const timeoutRef = (0, import_react13.useRef)();
2334
2336
  const onChangeDb = (0, import_use_debounce.useDebouncedCallback)(
2335
2337
  (val, ui) => {
2336
2338
  onChange(val, ui);
@@ -2340,10 +2342,17 @@ function AutoFieldPrivate(props) {
2340
2342
  );
2341
2343
  const onChangeLocal = (0, import_react13.useCallback)((val, ui) => {
2342
2344
  setLocalValue(val);
2345
+ setRecentlyChanged(true);
2346
+ clearTimeout(timeoutRef.current);
2347
+ timeoutRef.current = setTimeout(() => {
2348
+ setRecentlyChanged(false);
2349
+ }, RECENT_CHANGE_TIMEOUT);
2343
2350
  onChangeDb(val, ui);
2344
2351
  }, []);
2345
2352
  (0, import_react13.useEffect)(() => {
2346
- setLocalValue(value);
2353
+ if (!recentlyChanged) {
2354
+ setLocalValue(value);
2355
+ }
2347
2356
  }, [value]);
2348
2357
  const localProps = {
2349
2358
  value: localValue,
@@ -2351,8 +2360,16 @@ function AutoFieldPrivate(props) {
2351
2360
  };
2352
2361
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2353
2362
  }
2354
- var DefaultLabel = (props) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", __spreadValues({}, props));
2355
2363
  function AutoField(props) {
2364
+ const DefaultLabel = (0, import_react13.useMemo)(() => {
2365
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2366
+ "div",
2367
+ __spreadProps(__spreadValues({}, labelProps), {
2368
+ className: getClassName15({ readOnly: props.readOnly })
2369
+ })
2370
+ );
2371
+ return DefaultLabel2;
2372
+ }, [props.readOnly]);
2356
2373
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2357
2374
  }
2358
2375
 
@@ -3677,7 +3694,7 @@ var DefaultFields = ({
3677
3694
  return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, { children });
3678
3695
  };
3679
3696
  var useResolvedFields = () => {
3680
- var _a;
3697
+ var _a, _b;
3681
3698
  const { selectedItem, state, config } = useAppContext();
3682
3699
  const { data } = state;
3683
3700
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
@@ -3689,14 +3706,17 @@ var useResolvedFields = () => {
3689
3706
  const [fieldsLoading, setFieldsLoading] = (0, import_react21.useState)(false);
3690
3707
  const defaultResolveFields = (_componentData, _params) => defaultFields;
3691
3708
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
3709
+ const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
3710
+ const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
3711
+ const hasResolver = hasComponentResolver || hasRootResolver;
3692
3712
  const resolveFields = (0, import_react21.useCallback)(
3693
3713
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
3694
- var _a2, _b, _c;
3714
+ var _a2;
3695
3715
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
3696
3716
  const changed = getChanged(componentData, lastData);
3697
3717
  setLastSelectedData(componentData);
3698
- if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields)) {
3699
- return yield componentConfig == null ? void 0 : componentConfig.resolveFields(
3718
+ if (hasComponentResolver) {
3719
+ return yield componentConfig.resolveFields(
3700
3720
  componentData,
3701
3721
  {
3702
3722
  changed,
@@ -3707,8 +3727,8 @@ var useResolvedFields = () => {
3707
3727
  }
3708
3728
  );
3709
3729
  }
3710
- if (!selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields)) {
3711
- return yield (_c = config.root) == null ? void 0 : _c.resolveFields(componentData, {
3730
+ if (hasRootResolver) {
3731
+ return yield config.root.resolveFields(componentData, {
3712
3732
  changed,
3713
3733
  fields,
3714
3734
  lastFields: resolvedFields,
@@ -3726,12 +3746,16 @@ var useResolvedFields = () => {
3726
3746
  [data, config, componentData, selectedItem, resolvedFields, state]
3727
3747
  );
3728
3748
  (0, import_react21.useEffect)(() => {
3729
- setFieldsLoading(true);
3730
- resolveFields(defaultFields).then((fields) => {
3731
- setResolvedFields(fields || {});
3732
- setFieldsLoading(false);
3733
- });
3734
- }, [data, defaultFields, state.ui.itemSelector]);
3749
+ if (hasResolver) {
3750
+ setFieldsLoading(true);
3751
+ resolveFields(defaultFields).then((fields) => {
3752
+ setResolvedFields(fields || {});
3753
+ setFieldsLoading(false);
3754
+ });
3755
+ } else {
3756
+ setResolvedFields(defaultFields);
3757
+ }
3758
+ }, [data, defaultFields, state.ui.itemSelector, hasResolver]);
3735
3759
  return [resolvedFields, fieldsLoading];
3736
3760
  };
3737
3761
  var Fields = () => {
@@ -4951,7 +4975,7 @@ var ViewportControls = ({
4951
4975
 
4952
4976
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
4953
4977
  init_react_import();
4954
- var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_esbg1_1", "PuckCanvas-controls": "_PuckCanvas-controls_esbg1_16", "PuckCanvas-inner": "_PuckCanvas-inner_esbg1_21", "PuckCanvas-root": "_PuckCanvas-root_esbg1_32", "PuckCanvas--ready": "_PuckCanvas--ready_esbg1_56", "PuckCanvas-loader": "_PuckCanvas-loader_esbg1_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_esbg1_70" };
4978
+ var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_avf1c_1", "PuckCanvas-controls": "_PuckCanvas-controls_avf1c_16", "PuckCanvas-inner": "_PuckCanvas-inner_avf1c_21", "PuckCanvas-root": "_PuckCanvas-root_avf1c_32", "PuckCanvas--ready": "_PuckCanvas--ready_avf1c_57", "PuckCanvas-loader": "_PuckCanvas-loader_avf1c_62", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_avf1c_72" };
4955
4979
 
4956
4980
  // lib/get-zoom-config.ts
4957
4981
  init_react_import();
package/dist/index.mjs CHANGED
@@ -5,10 +5,15 @@ import {
5
5
  __spreadProps,
6
6
  __spreadValues,
7
7
  __toESM,
8
+ defaultData,
9
+ getChanged,
8
10
  init_react_import,
11
+ resolveAllData,
12
+ resolveComponentData,
13
+ resolveRootData,
9
14
  rootDroppableId,
10
15
  setupZone
11
- } from "./chunk-LM7YWFFF.mjs";
16
+ } from "./chunk-YNVK2PUD.mjs";
12
17
 
13
18
  // ../../node_modules/classnames/index.js
14
19
  var require_classnames = __commonJS({
@@ -180,6 +185,7 @@ import {
180
185
  useCallback as useCallback5,
181
186
  useEffect as useEffect9,
182
187
  useMemo as useMemo2,
188
+ useRef as useRef2,
183
189
  useState as useState10
184
190
  } from "react";
185
191
 
@@ -633,43 +639,30 @@ var flattenData = (data) => {
633
639
  );
634
640
  };
635
641
 
636
- // lib/get-changed.ts
637
- init_react_import();
638
- var getChanged = (newItem, oldItem) => {
639
- return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
640
- const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
641
- const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
642
- return __spreadProps(__spreadValues({}, acc), {
643
- [item]: oldItemProps[item] !== newItemProps[item]
644
- });
645
- }, {}) : {};
646
- };
647
-
648
642
  // lib/use-resolved-permissions.ts
649
643
  var useResolvedPermissions = (config, appState, globalPermissions, setComponentLoading, unsetComponentLoading) => {
650
- const [cache3, setCache] = useState2({});
644
+ const [cache, setCache] = useState2({});
651
645
  const [resolvedPermissions, setResolvedPermissions] = useState2({});
652
646
  const resolveDataForItem = useCallback(
653
647
  (item, force = false) => __async(void 0, null, function* () {
654
648
  var _a, _b, _c;
655
- setComponentLoading == null ? void 0 : setComponentLoading(item.props.id);
656
649
  const componentConfig = item.type === "root" ? config.root : config.components[item.type];
657
650
  if (!componentConfig) {
658
- unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
659
651
  return;
660
652
  }
661
653
  const initialPermissions = __spreadValues(__spreadValues({}, globalPermissions), componentConfig.permissions);
662
654
  if (componentConfig.resolvePermissions) {
663
- const changed = getChanged(item, (_a = cache3[item.props.id]) == null ? void 0 : _a.lastData);
655
+ const changed = getChanged(item, (_a = cache[item.props.id]) == null ? void 0 : _a.lastData);
664
656
  if (Object.values(changed).some((el) => el === true) || force) {
657
+ setComponentLoading == null ? void 0 : setComponentLoading(item.props.id);
665
658
  const resolvedPermissions2 = yield componentConfig.resolvePermissions(
666
659
  item,
667
660
  {
668
661
  changed,
669
- lastPermissions: ((_b = cache3[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
662
+ lastPermissions: ((_b = cache[item.props.id]) == null ? void 0 : _b.lastPermissions) || null,
670
663
  permissions: initialPermissions,
671
664
  appState,
672
- lastData: ((_c = cache3[item.props.id]) == null ? void 0 : _c.lastData) || null
665
+ lastData: ((_c = cache[item.props.id]) == null ? void 0 : _c.lastData) || null
673
666
  }
674
667
  );
675
668
  setCache((_cache) => __spreadProps(__spreadValues({}, _cache), {
@@ -681,11 +674,11 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
681
674
  setResolvedPermissions((p) => __spreadProps(__spreadValues({}, p), {
682
675
  [item.props.id]: resolvedPermissions2
683
676
  }));
677
+ unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
684
678
  }
685
679
  }
686
- unsetComponentLoading == null ? void 0 : unsetComponentLoading(item.props.id);
687
680
  }),
688
- [config, globalPermissions, appState, cache3]
681
+ [config, globalPermissions, appState, cache]
689
682
  );
690
683
  const resolveDataForRoot = (force = false) => {
691
684
  resolveDataForItem(
@@ -755,53 +748,6 @@ var useResolvedPermissions = (config, appState, globalPermissions, setComponentL
755
748
  init_react_import();
756
749
  import { useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
757
750
 
758
- // lib/resolve-component-data.ts
759
- init_react_import();
760
- var cache = { lastChange: {} };
761
- var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
762
- return yield Promise.all(
763
- content.map((item) => __async(void 0, null, function* () {
764
- return yield resolveComponentData(
765
- item,
766
- config,
767
- onResolveStart,
768
- onResolveEnd
769
- );
770
- }))
771
- );
772
- });
773
- var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
774
- const configForItem = config.components[item.type];
775
- if (configForItem.resolveData) {
776
- const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
777
- if (item && item === oldItem) {
778
- return resolved;
779
- }
780
- const changed = getChanged(item, oldItem);
781
- if (onResolveStart) {
782
- onResolveStart(item);
783
- }
784
- const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
785
- const { readOnly: existingReadOnly = {} } = item || {};
786
- const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
787
- const resolvedItem = __spreadProps(__spreadValues({}, item), {
788
- props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
789
- });
790
- if (Object.keys(newReadOnly).length) {
791
- resolvedItem.readOnly = newReadOnly;
792
- }
793
- cache.lastChange[item.props.id] = {
794
- item,
795
- resolved: resolvedItem
796
- };
797
- if (onResolveEnd) {
798
- onResolveEnd(resolvedItem);
799
- }
800
- return resolvedItem;
801
- }
802
- return item;
803
- });
804
-
805
751
  // lib/apply-dynamic-props.ts
806
752
  init_react_import();
807
753
  var applyDynamicProps = (data, dynamicProps, rootData) => {
@@ -820,34 +766,6 @@ var applyDynamicProps = (data, dynamicProps, rootData) => {
820
766
  });
821
767
  };
822
768
 
823
- // lib/resolve-root-data.ts
824
- init_react_import();
825
- var cache2 = {};
826
- function resolveRootData(data, config) {
827
- return __async(this, null, function* () {
828
- var _a, _b, _c, _d, _e;
829
- if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
830
- if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
831
- return cache2.lastChange.resolved;
832
- }
833
- const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
834
- const rootWithProps = data.root;
835
- const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
836
- changed,
837
- lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
838
- });
839
- cache2.lastChange = {
840
- original: data.root,
841
- resolved: resolvedRoot
842
- };
843
- return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
844
- props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
845
- });
846
- }
847
- return data.root;
848
- });
849
- }
850
-
851
769
  // lib/use-resolved-data.ts
852
770
  var useResolvedData = (appState, config, dispatch, setComponentLoading, unsetComponentLoading, refreshPermissions) => {
853
771
  const [{ resolverKey, newAppState }, setResolverState] = useState3({
@@ -2220,9 +2138,12 @@ function AutoFieldInternal(props) {
2220
2138
  const Render2 = render[field.type];
2221
2139
  return /* @__PURE__ */ jsx20(Render2, __spreadProps(__spreadValues({}, mergedProps), { children }));
2222
2140
  }
2141
+ var RECENT_CHANGE_TIMEOUT = 200;
2223
2142
  function AutoFieldPrivate(props) {
2224
2143
  const { value, onChange } = props;
2225
2144
  const [localValue, setLocalValue] = useState10(value);
2145
+ const [recentlyChanged, setRecentlyChanged] = useState10(false);
2146
+ const timeoutRef = useRef2();
2226
2147
  const onChangeDb = useDebouncedCallback(
2227
2148
  (val, ui) => {
2228
2149
  onChange(val, ui);
@@ -2232,10 +2153,17 @@ function AutoFieldPrivate(props) {
2232
2153
  );
2233
2154
  const onChangeLocal = useCallback5((val, ui) => {
2234
2155
  setLocalValue(val);
2156
+ setRecentlyChanged(true);
2157
+ clearTimeout(timeoutRef.current);
2158
+ timeoutRef.current = setTimeout(() => {
2159
+ setRecentlyChanged(false);
2160
+ }, RECENT_CHANGE_TIMEOUT);
2235
2161
  onChangeDb(val, ui);
2236
2162
  }, []);
2237
2163
  useEffect9(() => {
2238
- setLocalValue(value);
2164
+ if (!recentlyChanged) {
2165
+ setLocalValue(value);
2166
+ }
2239
2167
  }, [value]);
2240
2168
  const localProps = {
2241
2169
  value: localValue,
@@ -2243,8 +2171,16 @@ function AutoFieldPrivate(props) {
2243
2171
  };
2244
2172
  return /* @__PURE__ */ jsx20(AutoFieldInternal, __spreadValues(__spreadValues({}, props), localProps));
2245
2173
  }
2246
- var DefaultLabel = (props) => /* @__PURE__ */ jsx20("div", __spreadValues({}, props));
2247
2174
  function AutoField(props) {
2175
+ const DefaultLabel = useMemo2(() => {
2176
+ const DefaultLabel2 = (labelProps) => /* @__PURE__ */ jsx20(
2177
+ "div",
2178
+ __spreadProps(__spreadValues({}, labelProps), {
2179
+ className: getClassName15({ readOnly: props.readOnly })
2180
+ })
2181
+ );
2182
+ return DefaultLabel2;
2183
+ }, [props.readOnly]);
2248
2184
  return /* @__PURE__ */ jsx20(AutoFieldInternal, __spreadProps(__spreadValues({}, props), { Label: DefaultLabel }));
2249
2185
  }
2250
2186
 
@@ -3587,7 +3523,7 @@ var DefaultFields = ({
3587
3523
  return /* @__PURE__ */ jsx27(Fragment12, { children });
3588
3524
  };
3589
3525
  var useResolvedFields = () => {
3590
- var _a;
3526
+ var _a, _b;
3591
3527
  const { selectedItem, state, config } = useAppContext();
3592
3528
  const { data } = state;
3593
3529
  const rootFields = ((_a = config.root) == null ? void 0 : _a.fields) || defaultPageFields;
@@ -3599,14 +3535,17 @@ var useResolvedFields = () => {
3599
3535
  const [fieldsLoading, setFieldsLoading] = useState15(false);
3600
3536
  const defaultResolveFields = (_componentData, _params) => defaultFields;
3601
3537
  const componentData = selectedItem ? selectedItem : { props: rootProps, readOnly: data.root.readOnly };
3538
+ const hasComponentResolver = selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields);
3539
+ const hasRootResolver = !selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields);
3540
+ const hasResolver = hasComponentResolver || hasRootResolver;
3602
3541
  const resolveFields = useCallback7(
3603
3542
  (..._0) => __async(void 0, [..._0], function* (fields = {}) {
3604
- var _a2, _b, _c;
3543
+ var _a2;
3605
3544
  const lastData = ((_a2 = lastSelectedData.props) == null ? void 0 : _a2.id) === componentData.props.id ? lastSelectedData : null;
3606
3545
  const changed = getChanged(componentData, lastData);
3607
3546
  setLastSelectedData(componentData);
3608
- if (selectedItem && (componentConfig == null ? void 0 : componentConfig.resolveFields)) {
3609
- return yield componentConfig == null ? void 0 : componentConfig.resolveFields(
3547
+ if (hasComponentResolver) {
3548
+ return yield componentConfig.resolveFields(
3610
3549
  componentData,
3611
3550
  {
3612
3551
  changed,
@@ -3617,8 +3556,8 @@ var useResolvedFields = () => {
3617
3556
  }
3618
3557
  );
3619
3558
  }
3620
- if (!selectedItem && ((_b = config.root) == null ? void 0 : _b.resolveFields)) {
3621
- return yield (_c = config.root) == null ? void 0 : _c.resolveFields(componentData, {
3559
+ if (hasRootResolver) {
3560
+ return yield config.root.resolveFields(componentData, {
3622
3561
  changed,
3623
3562
  fields,
3624
3563
  lastFields: resolvedFields,
@@ -3636,12 +3575,16 @@ var useResolvedFields = () => {
3636
3575
  [data, config, componentData, selectedItem, resolvedFields, state]
3637
3576
  );
3638
3577
  useEffect13(() => {
3639
- setFieldsLoading(true);
3640
- resolveFields(defaultFields).then((fields) => {
3641
- setResolvedFields(fields || {});
3642
- setFieldsLoading(false);
3643
- });
3644
- }, [data, defaultFields, state.ui.itemSelector]);
3578
+ if (hasResolver) {
3579
+ setFieldsLoading(true);
3580
+ resolveFields(defaultFields).then((fields) => {
3581
+ setResolvedFields(fields || {});
3582
+ setFieldsLoading(false);
3583
+ });
3584
+ } else {
3585
+ setResolvedFields(defaultFields);
3586
+ }
3587
+ }, [data, defaultFields, state.ui.itemSelector, hasResolver]);
3645
3588
  return [resolvedFields, fieldsLoading];
3646
3589
  };
3647
3590
  var Fields = () => {
@@ -3950,7 +3893,7 @@ import {
3950
3893
  createContext as createContext4,
3951
3894
  useContext as useContext5,
3952
3895
  useEffect as useEffect15,
3953
- useRef as useRef2,
3896
+ useRef as useRef3,
3954
3897
  useState as useState17
3955
3898
  } from "react";
3956
3899
  import hash from "object-hash";
@@ -4175,7 +4118,7 @@ function AutoFrame(_a) {
4175
4118
  ]);
4176
4119
  const [loaded, setLoaded] = useState17(false);
4177
4120
  const [ctx, setCtx] = useState17({});
4178
- const ref = useRef2(null);
4121
+ const ref = useRef3(null);
4179
4122
  const [mountTarget, setMountTarget] = useState17();
4180
4123
  useEffect15(() => {
4181
4124
  var _a2;
@@ -4724,7 +4667,7 @@ import {
4724
4667
  useCallback as useCallback10,
4725
4668
  useEffect as useEffect17,
4726
4669
  useMemo as useMemo11,
4727
- useRef as useRef3,
4670
+ useRef as useRef4,
4728
4671
  useState as useState20
4729
4672
  } from "react";
4730
4673
 
@@ -4873,7 +4816,7 @@ var ViewportControls = ({
4873
4816
 
4874
4817
  // css-module:/home/runner/work/puck/puck/packages/core/components/Puck/components/Canvas/styles.module.css#css-module
4875
4818
  init_react_import();
4876
- var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_esbg1_1", "PuckCanvas-controls": "_PuckCanvas-controls_esbg1_16", "PuckCanvas-inner": "_PuckCanvas-inner_esbg1_21", "PuckCanvas-root": "_PuckCanvas-root_esbg1_32", "PuckCanvas--ready": "_PuckCanvas--ready_esbg1_56", "PuckCanvas-loader": "_PuckCanvas-loader_esbg1_60", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_esbg1_70" };
4819
+ var styles_module_default21 = { "PuckCanvas": "_PuckCanvas_avf1c_1", "PuckCanvas-controls": "_PuckCanvas-controls_avf1c_16", "PuckCanvas-inner": "_PuckCanvas-inner_avf1c_21", "PuckCanvas-root": "_PuckCanvas-root_avf1c_32", "PuckCanvas--ready": "_PuckCanvas--ready_avf1c_57", "PuckCanvas-loader": "_PuckCanvas-loader_avf1c_62", "PuckCanvas--showLoader": "_PuckCanvas--showLoader_avf1c_72" };
4877
4820
 
4878
4821
  // lib/get-zoom-config.ts
4879
4822
  init_react_import();
@@ -4913,7 +4856,7 @@ var Canvas = () => {
4913
4856
  const { status, iframe } = useAppContext();
4914
4857
  const { dispatch, state, overrides, setUi, zoomConfig, setZoomConfig } = useAppContext();
4915
4858
  const { ui } = state;
4916
- const frameRef = useRef3(null);
4859
+ const frameRef = useRef4(null);
4917
4860
  const [showTransition, setShowTransition] = useState20(false);
4918
4861
  const defaultRender = useMemo11(() => {
4919
4862
  const PuckDefault = ({ children }) => /* @__PURE__ */ jsx36(Fragment17, { children });
@@ -5658,15 +5601,6 @@ function migrate(data) {
5658
5601
 
5659
5602
  // lib/transform-props.ts
5660
5603
  init_react_import();
5661
-
5662
- // lib/default-data.ts
5663
- init_react_import();
5664
- var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
5665
- root: data.root || {},
5666
- content: data.content || []
5667
- });
5668
-
5669
- // lib/transform-props.ts
5670
5604
  function transformProps(data, propTransforms) {
5671
5605
  const mapItem = (item) => {
5672
5606
  if (propTransforms[item.type]) {
@@ -5699,37 +5633,6 @@ function transformProps(data, propTransforms) {
5699
5633
  return afterPropTransforms;
5700
5634
  }
5701
5635
 
5702
- // lib/resolve-all-data.ts
5703
- init_react_import();
5704
- function resolveAllData(data, config, onResolveStart, onResolveEnd) {
5705
- return __async(this, null, function* () {
5706
- const defaultedData = defaultData(data);
5707
- const dynamicRoot = yield resolveRootData(defaultedData, config);
5708
- const { zones = {} } = data;
5709
- const zoneKeys = Object.keys(zones);
5710
- const resolvedZones = {};
5711
- for (let i = 0; i < zoneKeys.length; i++) {
5712
- const zoneKey = zoneKeys[i];
5713
- resolvedZones[zoneKey] = yield resolveAllComponentData(
5714
- zones[zoneKey],
5715
- config,
5716
- onResolveStart,
5717
- onResolveEnd
5718
- );
5719
- }
5720
- return __spreadProps(__spreadValues({}, defaultedData), {
5721
- root: dynamicRoot,
5722
- content: yield resolveAllComponentData(
5723
- defaultedData.content,
5724
- config,
5725
- onResolveStart,
5726
- onResolveEnd
5727
- ),
5728
- zones: resolvedZones
5729
- });
5730
- });
5731
- }
5732
-
5733
5636
  // lib/use-puck.ts
5734
5637
  init_react_import();
5735
5638
  var usePuck = () => {
@@ -440,4 +440,6 @@ type PuckAction = {
440
440
  recordHistory?: boolean;
441
441
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
442
442
 
443
- export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type Field as F, type RadioField as G, type History as H, type ItemSelector as I, type ArrayField as J, type ObjectField as K, type Adaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type PuckAction as P, type ExternalFieldWithAdaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalField as W, type CustomField as X, type Fields as Y, type PuckContext as Z, type DefaultRootRenderProps as _, type FieldProps as a, type WithId as a0, type WithPuckProps as a1, type AsFieldProps as a2, type WithChildren as a3, type DropZoneProps as b, type UiState as c, type Permissions as d, type Plugin as e, type Overrides as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ComponentData as k, type ExtractRootPropsFromConfig as l, type ComponentDataMap as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type Content as x, type BaseField as y, type TextareaField as z };
443
+ declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
444
+
445
+ export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type Field as F, type RadioField as G, type History as H, type ItemSelector as I, type ArrayField as J, type ObjectField as K, type Adaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type PuckAction as P, type ExternalFieldWithAdaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalField as W, type CustomField as X, type Fields as Y, type PuckContext as Z, type DefaultRootRenderProps as _, type FieldProps as a, type WithId as a0, type WithPuckProps as a1, type AsFieldProps as a2, type WithChildren as a3, resolveAllData as a4, type DropZoneProps as b, type UiState as c, type Permissions as d, type Plugin as e, type Overrides as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ExtractRootPropsFromConfig as k, type ComponentDataMap as l, type Viewport as m, type OverrideKey as n, overrideKeys as o, type FieldRenderFunctions as p, type ItemWithId as q, type ArrayState as r, type PuckComponent as s, type ComponentConfig as t, type RootDataWithoutProps as u, type RootData as v, type ComponentData as w, type Content as x, type BaseField as y, type TextareaField as z };
@@ -440,4 +440,6 @@ type PuckAction = {
440
440
  recordHistory?: boolean;
441
441
  } & (ReorderAction | InsertAction | MoveAction | ReplaceAction | RemoveAction | DuplicateAction | SetAction | SetDataAction | SetUiAction | RegisterZoneAction | UnregisterZoneAction);
442
442
 
443
- export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type Field as F, type RadioField as G, type History as H, type ItemSelector as I, type ArrayField as J, type ObjectField as K, type Adaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type PuckAction as P, type ExternalFieldWithAdaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalField as W, type CustomField as X, type Fields as Y, type PuckContext as Z, type DefaultRootRenderProps as _, type FieldProps as a, type WithId as a0, type WithPuckProps as a1, type AsFieldProps as a2, type WithChildren as a3, type DropZoneProps as b, type UiState as c, type Permissions as d, type Plugin as e, type Overrides as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ComponentData as k, type ExtractRootPropsFromConfig as l, type ComponentDataMap as m, type Viewport as n, overrideKeys as o, type OverrideKey as p, type FieldRenderFunctions as q, type ItemWithId as r, type ArrayState as s, type PuckComponent as t, type ComponentConfig as u, type RootDataWithoutProps as v, type RootData as w, type Content as x, type BaseField as y, type TextareaField as z };
443
+ declare function resolveAllData<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends Record<string, any> = DefaultRootFieldProps>(data: Partial<Data>, config: Config, onResolveStart?: (item: ComponentData) => void, onResolveEnd?: (item: ComponentData) => void): Promise<Data<Props, RootProps>>;
444
+
445
+ export { type DefaultRootProps as $, type AppState as A, type BaseData as B, type Config as C, type Data as D, type ExtractPropsFromConfig as E, type Field as F, type RadioField as G, type History as H, type ItemSelector as I, type ArrayField as J, type ObjectField as K, type Adaptor as L, type MappedItem as M, type NumberField as N, type OnAction as O, type PuckAction as P, type ExternalFieldWithAdaptor as Q, type RootDataWithProps as R, type SelectField as S, type TextField as T, type UserGenerics as U, type Viewports as V, type ExternalField as W, type CustomField as X, type Fields as Y, type PuckContext as Z, type DefaultRootRenderProps as _, type FieldProps as a, type WithId as a0, type WithPuckProps as a1, type AsFieldProps as a2, type WithChildren as a3, resolveAllData as a4, type DropZoneProps as b, type UiState as c, type Permissions as d, type Plugin as e, type Overrides as f, type IframeConfig as g, type InitialHistory as h, type DefaultComponentProps as i, type DefaultRootFieldProps as j, type ExtractRootPropsFromConfig as k, type ComponentDataMap as l, type Viewport as m, type OverrideKey as n, overrideKeys as o, type FieldRenderFunctions as p, type ItemWithId as q, type ArrayState as r, type PuckComponent as s, type ComponentConfig as t, type RootDataWithoutProps as u, type RootData as v, type ComponentData as w, type Content as x, type BaseField as y, type TextareaField as z };
package/dist/rsc.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './actions-9pHbVtMU.mjs';
2
+ import { C as Config, D as Data } from './resolve-all-data-CaDAfEAK.mjs';
3
+ export { a4 as resolveAllData } from './resolve-all-data-CaDAfEAK.mjs';
3
4
  import 'react';
4
5
 
5
6
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
package/dist/rsc.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, D as Data } from './actions-9pHbVtMU.js';
2
+ import { C as Config, D as Data } from './resolve-all-data-CaDAfEAK.js';
3
+ export { a4 as resolveAllData } from './resolve-all-data-CaDAfEAK.js';
3
4
  import 'react';
4
5
 
5
6
  declare function Render<UserConfig extends Config = Config>({ config, data, }: {
package/dist/rsc.js CHANGED
@@ -43,11 +43,32 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
43
43
  mod
44
44
  ));
45
45
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
+ var __async = (__this, __arguments, generator) => {
47
+ return new Promise((resolve, reject) => {
48
+ var fulfilled = (value) => {
49
+ try {
50
+ step(generator.next(value));
51
+ } catch (e) {
52
+ reject(e);
53
+ }
54
+ };
55
+ var rejected = (value) => {
56
+ try {
57
+ step(generator.throw(value));
58
+ } catch (e) {
59
+ reject(e);
60
+ }
61
+ };
62
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
+ step((generator = generator.apply(__this, __arguments)).next());
64
+ });
65
+ };
46
66
 
47
67
  // rsc.tsx
48
68
  var rsc_exports = {};
49
69
  __export(rsc_exports, {
50
- Render: () => Render
70
+ Render: () => Render,
71
+ resolveAllData: () => resolveAllData
51
72
  });
52
73
  module.exports = __toCommonJS(rsc_exports);
53
74
 
@@ -134,7 +155,128 @@ function Render({
134
155
  }
135
156
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DropZoneRender, { config, data, zone: rootDroppableId });
136
157
  }
158
+
159
+ // lib/get-changed.ts
160
+ var getChanged = (newItem, oldItem) => {
161
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
162
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
163
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
164
+ return __spreadProps(__spreadValues({}, acc), {
165
+ [item]: oldItemProps[item] !== newItemProps[item]
166
+ });
167
+ }, {}) : {};
168
+ };
169
+
170
+ // lib/resolve-component-data.ts
171
+ var cache = { lastChange: {} };
172
+ var resolveAllComponentData = (content, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
173
+ return yield Promise.all(
174
+ content.map((item) => __async(void 0, null, function* () {
175
+ return yield resolveComponentData(
176
+ item,
177
+ config,
178
+ onResolveStart,
179
+ onResolveEnd
180
+ );
181
+ }))
182
+ );
183
+ });
184
+ var resolveComponentData = (item, config, onResolveStart, onResolveEnd) => __async(void 0, null, function* () {
185
+ const configForItem = config.components[item.type];
186
+ if (configForItem.resolveData) {
187
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[item.props.id] || {};
188
+ if (item && item === oldItem) {
189
+ return resolved;
190
+ }
191
+ const changed = getChanged(item, oldItem);
192
+ if (onResolveStart) {
193
+ onResolveStart(item);
194
+ }
195
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, { changed, lastData: oldItem });
196
+ const { readOnly: existingReadOnly = {} } = item || {};
197
+ const newReadOnly = __spreadValues(__spreadValues({}, existingReadOnly), readOnly);
198
+ const resolvedItem = __spreadProps(__spreadValues({}, item), {
199
+ props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
200
+ });
201
+ if (Object.keys(newReadOnly).length) {
202
+ resolvedItem.readOnly = newReadOnly;
203
+ }
204
+ cache.lastChange[item.props.id] = {
205
+ item,
206
+ resolved: resolvedItem
207
+ };
208
+ if (onResolveEnd) {
209
+ onResolveEnd(resolvedItem);
210
+ }
211
+ return resolvedItem;
212
+ }
213
+ return item;
214
+ });
215
+
216
+ // lib/resolve-root-data.ts
217
+ var cache2 = {};
218
+ function resolveRootData(data, config) {
219
+ return __async(this, null, function* () {
220
+ var _a, _b, _c, _d, _e;
221
+ if (((_a = config.root) == null ? void 0 : _a.resolveData) && data.root.props) {
222
+ if (((_b = cache2.lastChange) == null ? void 0 : _b.original) === data.root) {
223
+ return cache2.lastChange.resolved;
224
+ }
225
+ const changed = getChanged(data.root, (_c = cache2.lastChange) == null ? void 0 : _c.original);
226
+ const rootWithProps = data.root;
227
+ const resolvedRoot = yield (_e = config.root) == null ? void 0 : _e.resolveData(rootWithProps, {
228
+ changed,
229
+ lastData: ((_d = cache2.lastChange) == null ? void 0 : _d.original) || {}
230
+ });
231
+ cache2.lastChange = {
232
+ original: data.root,
233
+ resolved: resolvedRoot
234
+ };
235
+ return __spreadProps(__spreadValues(__spreadValues({}, data.root), resolvedRoot), {
236
+ props: __spreadValues(__spreadValues({}, data.root.props), resolvedRoot.props)
237
+ });
238
+ }
239
+ return data.root;
240
+ });
241
+ }
242
+
243
+ // lib/default-data.ts
244
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
245
+ root: data.root || {},
246
+ content: data.content || []
247
+ });
248
+
249
+ // lib/resolve-all-data.ts
250
+ function resolveAllData(data, config, onResolveStart, onResolveEnd) {
251
+ return __async(this, null, function* () {
252
+ const defaultedData = defaultData(data);
253
+ const dynamicRoot = yield resolveRootData(defaultedData, config);
254
+ const { zones = {} } = data;
255
+ const zoneKeys = Object.keys(zones);
256
+ const resolvedZones = {};
257
+ for (let i = 0; i < zoneKeys.length; i++) {
258
+ const zoneKey = zoneKeys[i];
259
+ resolvedZones[zoneKey] = yield resolveAllComponentData(
260
+ zones[zoneKey],
261
+ config,
262
+ onResolveStart,
263
+ onResolveEnd
264
+ );
265
+ }
266
+ return __spreadProps(__spreadValues({}, defaultedData), {
267
+ root: dynamicRoot,
268
+ content: yield resolveAllComponentData(
269
+ defaultedData.content,
270
+ config,
271
+ onResolveStart,
272
+ onResolveEnd
273
+ ),
274
+ zones: resolvedZones
275
+ });
276
+ });
277
+ }
137
278
  // Annotate the CommonJS export names for ESM import in node:
138
279
  0 && (module.exports = {
139
- Render
280
+ Render,
281
+ resolveAllData
140
282
  });
package/dist/rsc.mjs CHANGED
@@ -2,9 +2,10 @@ import {
2
2
  __spreadProps,
3
3
  __spreadValues,
4
4
  init_react_import,
5
+ resolveAllData,
5
6
  rootDroppableId,
6
7
  setupZone
7
- } from "./chunk-LM7YWFFF.mjs";
8
+ } from "./chunk-YNVK2PUD.mjs";
8
9
 
9
10
  // rsc.tsx
10
11
  init_react_import();
@@ -76,5 +77,6 @@ function Render({
76
77
  return /* @__PURE__ */ jsx(DropZoneRender, { config, data, zone: rootDroppableId });
77
78
  }
78
79
  export {
79
- Render
80
+ Render,
81
+ resolveAllData
80
82
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.16.1-canary.ed282b9",
3
+ "version": "0.16.2-canary.36d53b4",
4
4
  "author": "Measured Corporation Ltd <hello@measured.co>",
5
5
  "repository": "measuredco/puck",
6
6
  "bugs": "https://github.com/measuredco/puck/issues",
@@ -1,114 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
- var __spreadValues = (a, b) => {
13
- for (var prop in b || (b = {}))
14
- if (__hasOwnProp.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- if (__getOwnPropSymbols)
17
- for (var prop of __getOwnPropSymbols(b)) {
18
- if (__propIsEnum.call(b, prop))
19
- __defNormalProp(a, prop, b[prop]);
20
- }
21
- return a;
22
- };
23
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
- var __objRest = (source, exclude) => {
25
- var target = {};
26
- for (var prop in source)
27
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
28
- target[prop] = source[prop];
29
- if (source != null && __getOwnPropSymbols)
30
- for (var prop of __getOwnPropSymbols(source)) {
31
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
32
- target[prop] = source[prop];
33
- }
34
- return target;
35
- };
36
- var __esm = (fn, res) => function __init() {
37
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
- };
39
- var __commonJS = (cb, mod) => function __require() {
40
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
- };
42
- var __copyProps = (to, from, except, desc) => {
43
- if (from && typeof from === "object" || typeof from === "function") {
44
- for (let key of __getOwnPropNames(from))
45
- if (!__hasOwnProp.call(to, key) && key !== except)
46
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
- }
48
- return to;
49
- };
50
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
51
- // If the importer is in node compatibility mode or this is not an ESM
52
- // file that has been converted to a CommonJS file using a Babel-
53
- // compatible transform (i.e. "__esModule" has not been set), then set
54
- // "default" to the CommonJS "module.exports" for node compatibility.
55
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
56
- mod
57
- ));
58
- var __async = (__this, __arguments, generator) => {
59
- return new Promise((resolve, reject) => {
60
- var fulfilled = (value) => {
61
- try {
62
- step(generator.next(value));
63
- } catch (e) {
64
- reject(e);
65
- }
66
- };
67
- var rejected = (value) => {
68
- try {
69
- step(generator.throw(value));
70
- } catch (e) {
71
- reject(e);
72
- }
73
- };
74
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
75
- step((generator = generator.apply(__this, __arguments)).next());
76
- });
77
- };
78
-
79
- // ../tsup-config/react-import.js
80
- import React from "react";
81
- var init_react_import = __esm({
82
- "../tsup-config/react-import.js"() {
83
- "use strict";
84
- }
85
- });
86
-
87
- // lib/root-droppable-id.ts
88
- init_react_import();
89
- var rootDroppableId = "default-zone";
90
-
91
- // lib/setup-zone.ts
92
- init_react_import();
93
- var setupZone = (data, zoneKey) => {
94
- if (zoneKey === rootDroppableId) {
95
- return data;
96
- }
97
- const newData = __spreadProps(__spreadValues({}, data), {
98
- zones: data.zones || {}
99
- });
100
- newData.zones[zoneKey] = newData.zones[zoneKey] || [];
101
- return newData;
102
- };
103
-
104
- export {
105
- __spreadValues,
106
- __spreadProps,
107
- __objRest,
108
- __commonJS,
109
- __toESM,
110
- __async,
111
- init_react_import,
112
- rootDroppableId,
113
- setupZone
114
- };