@measured/puck 0.19.0-canary.e829bea0 → 0.19.0-canary.eda38b34

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.
@@ -0,0 +1,566 @@
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/data/walk-tree.ts
88
+ init_react_import();
89
+
90
+ // lib/data/is-slot.ts
91
+ init_react_import();
92
+ var isSlot = (prop) => {
93
+ var _a, _b;
94
+ return Array.isArray(prop) && typeof ((_a = prop[0]) == null ? void 0 : _a.type) === "string" && typeof ((_b = prop[0]) == null ? void 0 : _b.props) === "object";
95
+ };
96
+ var createIsSlotConfig = (config) => (itemType, propName, propValue) => {
97
+ var _a, _b;
98
+ const configForComponent = itemType === "root" ? config == null ? void 0 : config.root : config == null ? void 0 : config.components[itemType];
99
+ if (!configForComponent) return isSlot(propValue);
100
+ return ((_b = (_a = configForComponent.fields) == null ? void 0 : _a[propName]) == null ? void 0 : _b.type) === "slot";
101
+ };
102
+
103
+ // lib/data/map-slots.ts
104
+ init_react_import();
105
+ function mapSlotsAsync(_0, _1) {
106
+ return __async(this, arguments, function* (item, map, recursive = true, isSlot2 = isSlot) {
107
+ const props = __spreadValues({}, item.props);
108
+ const propKeys = Object.keys(props);
109
+ for (let i = 0; i < propKeys.length; i++) {
110
+ const propKey = propKeys[i];
111
+ const itemType = "type" in item ? item.type : "root";
112
+ if (isSlot2(itemType, propKey, props[propKey])) {
113
+ const content = props[propKey];
114
+ const mappedContent = recursive ? yield Promise.all(
115
+ content.map((item2) => __async(this, null, function* () {
116
+ return yield mapSlotsAsync(item2, map, recursive, isSlot2);
117
+ }))
118
+ ) : content;
119
+ props[propKey] = yield map(mappedContent, propKey);
120
+ }
121
+ }
122
+ return __spreadProps(__spreadValues({}, item), { props });
123
+ });
124
+ }
125
+ function mapSlotsSync(item, map, isSlot2 = isSlot) {
126
+ var _a, _b;
127
+ const props = __spreadValues({}, item.props);
128
+ const propKeys = Object.keys(props);
129
+ for (let i = 0; i < propKeys.length; i++) {
130
+ const propKey = propKeys[i];
131
+ const itemType = "type" in item ? item.type : "root";
132
+ if (isSlot2(itemType, propKey, props[propKey])) {
133
+ const content = props[propKey];
134
+ const mappedContent = content.map((item2) => {
135
+ return mapSlotsSync(item2, map, isSlot2);
136
+ });
137
+ props[propKey] = (_b = map(mappedContent, (_a = props.id) != null ? _a : "root", propKey)) != null ? _b : mappedContent;
138
+ }
139
+ }
140
+ return __spreadProps(__spreadValues({}, item), { props });
141
+ }
142
+
143
+ // lib/data/walk-tree.ts
144
+ function walkTree(data, config, callbackFn) {
145
+ var _a, _b;
146
+ const isSlot2 = createIsSlotConfig(config);
147
+ const walkItem = (item) => {
148
+ return mapSlotsSync(
149
+ item,
150
+ (content, parentId, propName) => callbackFn(content, { parentId, propName }),
151
+ isSlot2
152
+ );
153
+ };
154
+ if ("props" in data) {
155
+ return walkItem(data);
156
+ }
157
+ const _data = data;
158
+ const zones = (_a = _data.zones) != null ? _a : {};
159
+ const mappedContent = _data.content.map(walkItem);
160
+ return {
161
+ root: walkItem(_data.root),
162
+ content: (_b = callbackFn(mappedContent, {
163
+ parentId: "root",
164
+ propName: "default-zone"
165
+ })) != null ? _b : mappedContent,
166
+ zones: Object.keys(zones).reduce(
167
+ (acc, zoneCompound) => __spreadProps(__spreadValues({}, acc), {
168
+ [zoneCompound]: zones[zoneCompound].map(walkItem)
169
+ }),
170
+ {}
171
+ )
172
+ };
173
+ }
174
+
175
+ // components/ServerRender/index.tsx
176
+ init_react_import();
177
+
178
+ // lib/root-droppable-id.ts
179
+ init_react_import();
180
+ var rootAreaId = "root";
181
+ var rootZone = "default-zone";
182
+ var rootDroppableId = `${rootAreaId}:${rootZone}`;
183
+
184
+ // lib/data/setup-zone.ts
185
+ init_react_import();
186
+ var setupZone = (data, zoneKey) => {
187
+ if (zoneKey === rootDroppableId) {
188
+ return data;
189
+ }
190
+ const newData = __spreadProps(__spreadValues({}, data), {
191
+ zones: data.zones ? __spreadValues({}, data.zones) : {}
192
+ });
193
+ newData.zones[zoneKey] = newData.zones[zoneKey] || [];
194
+ return newData;
195
+ };
196
+
197
+ // lib/use-slots.tsx
198
+ init_react_import();
199
+ import { useMemo } from "react";
200
+ function useSlots(config, props, renderSlotEdit, renderSlotRender = renderSlotEdit, readOnly, forceReadOnly) {
201
+ const slotProps = useMemo(() => {
202
+ if (!(config == null ? void 0 : config.fields)) return props;
203
+ const slotProps2 = {};
204
+ const fieldKeys = Object.keys(config.fields);
205
+ for (let i = 0; i < fieldKeys.length; i++) {
206
+ const fieldKey = fieldKeys[i];
207
+ const field = config.fields[fieldKey];
208
+ if ((field == null ? void 0 : field.type) === "slot") {
209
+ const content = props[fieldKey] || [];
210
+ const render = (readOnly == null ? void 0 : readOnly[fieldKey]) || forceReadOnly ? renderSlotRender : renderSlotEdit;
211
+ const Slot = (dzProps) => render(__spreadProps(__spreadValues({
212
+ allow: field.allow,
213
+ disallow: field.disallow
214
+ }, dzProps), {
215
+ zone: fieldKey,
216
+ content
217
+ }));
218
+ slotProps2[fieldKey] = Slot;
219
+ }
220
+ }
221
+ return slotProps2;
222
+ }, [config, readOnly, forceReadOnly]);
223
+ return __spreadValues(__spreadValues({}, props), slotProps);
224
+ }
225
+
226
+ // components/SlotRender/server.tsx
227
+ init_react_import();
228
+ import { forwardRef } from "react";
229
+ import { jsx } from "react/jsx-runtime";
230
+ var SlotRenderPure = (props) => /* @__PURE__ */ jsx(SlotRender, __spreadValues({}, props));
231
+ var Item = ({
232
+ config,
233
+ item,
234
+ metadata
235
+ }) => {
236
+ const Component = config.components[item.type];
237
+ const props = useSlots(Component, item.props, (slotProps) => /* @__PURE__ */ jsx(SlotRenderPure, __spreadProps(__spreadValues({}, slotProps), { config, metadata })));
238
+ return /* @__PURE__ */ jsx(
239
+ Component.render,
240
+ __spreadProps(__spreadValues({}, props), {
241
+ puck: __spreadProps(__spreadValues({}, props.puck), {
242
+ renderDropZone: DropZoneRender,
243
+ metadata: metadata || {}
244
+ })
245
+ })
246
+ );
247
+ };
248
+ var SlotRender = forwardRef(
249
+ function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
250
+ return /* @__PURE__ */ jsx("div", { className, style, ref, children: content.map((item) => {
251
+ if (!config.components[item.type]) {
252
+ return null;
253
+ }
254
+ return /* @__PURE__ */ jsx(
255
+ Item,
256
+ {
257
+ config,
258
+ item,
259
+ metadata
260
+ },
261
+ item.props.id
262
+ );
263
+ }) });
264
+ }
265
+ );
266
+
267
+ // components/ServerRender/index.tsx
268
+ import { Fragment, jsx as jsx2 } from "react/jsx-runtime";
269
+ function DropZoneRender({
270
+ zone,
271
+ data,
272
+ areaId = "root",
273
+ config,
274
+ metadata = {}
275
+ }) {
276
+ let zoneCompound = rootDroppableId;
277
+ let content = (data == null ? void 0 : data.content) || [];
278
+ if (!data || !config) {
279
+ return null;
280
+ }
281
+ if (areaId !== rootAreaId && zone !== rootZone) {
282
+ zoneCompound = `${areaId}:${zone}`;
283
+ content = setupZone(data, zoneCompound).zones[zoneCompound];
284
+ }
285
+ return /* @__PURE__ */ jsx2(Fragment, { children: content.map((item) => {
286
+ const Component = config.components[item.type];
287
+ const props = __spreadProps(__spreadValues({}, item.props), {
288
+ puck: {
289
+ renderDropZone: ({ zone: zone2 }) => /* @__PURE__ */ jsx2(
290
+ DropZoneRender,
291
+ {
292
+ zone: zone2,
293
+ data,
294
+ areaId: item.props.id,
295
+ config,
296
+ metadata
297
+ }
298
+ ),
299
+ metadata
300
+ }
301
+ });
302
+ const propsWithSlots = useSlots(Component, props, (props2) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
303
+ if (Component) {
304
+ return /* @__PURE__ */ jsx2(Component.render, __spreadValues({}, propsWithSlots), item.props.id);
305
+ }
306
+ return null;
307
+ }) });
308
+ }
309
+ function Render({
310
+ config,
311
+ data,
312
+ metadata = {}
313
+ }) {
314
+ var _a;
315
+ const rootProps = data.root.props || data.root;
316
+ const title = rootProps.title || "";
317
+ const props = __spreadProps(__spreadValues({}, rootProps), {
318
+ puck: {
319
+ renderDropZone: ({ zone }) => /* @__PURE__ */ jsx2(
320
+ DropZoneRender,
321
+ {
322
+ zone,
323
+ data,
324
+ config,
325
+ metadata
326
+ }
327
+ ),
328
+ isEditing: false,
329
+ dragRef: null,
330
+ metadata
331
+ },
332
+ title,
333
+ editMode: false,
334
+ id: "puck-root"
335
+ });
336
+ const propsWithSlots = useSlots(config.root, props, (props2) => /* @__PURE__ */ jsx2(SlotRenderPure, __spreadProps(__spreadValues({}, props2), { config, metadata })));
337
+ if ((_a = config.root) == null ? void 0 : _a.render) {
338
+ return /* @__PURE__ */ jsx2(config.root.render, __spreadProps(__spreadValues({}, propsWithSlots), { children: /* @__PURE__ */ jsx2(
339
+ DropZoneRender,
340
+ {
341
+ config,
342
+ data,
343
+ zone: rootZone,
344
+ metadata
345
+ }
346
+ ) }));
347
+ }
348
+ return /* @__PURE__ */ jsx2(
349
+ DropZoneRender,
350
+ {
351
+ config,
352
+ data,
353
+ zone: rootZone,
354
+ metadata
355
+ }
356
+ );
357
+ }
358
+
359
+ // lib/transform-props.ts
360
+ init_react_import();
361
+
362
+ // lib/data/default-data.ts
363
+ init_react_import();
364
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
365
+ root: data.root || {},
366
+ content: data.content || []
367
+ });
368
+
369
+ // lib/transform-props.ts
370
+ function transformProps(data, propTransforms) {
371
+ const mapItem = (item) => {
372
+ if (propTransforms[item.type]) {
373
+ return __spreadProps(__spreadValues({}, item), {
374
+ props: propTransforms[item.type](item.props)
375
+ });
376
+ }
377
+ return item;
378
+ };
379
+ const defaultedData = defaultData(data);
380
+ const rootProps = defaultedData.root.props || defaultedData.root;
381
+ let newRoot = __spreadValues({}, defaultedData.root);
382
+ if (propTransforms["root"]) {
383
+ if (defaultedData.root.props) {
384
+ newRoot.props = propTransforms["root"](rootProps);
385
+ } else {
386
+ newRoot = propTransforms["root"](rootProps);
387
+ }
388
+ }
389
+ const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
390
+ root: newRoot,
391
+ content: defaultedData.content.map(mapItem),
392
+ zones: Object.keys(data.zones || {}).reduce(
393
+ (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
394
+ [zoneKey]: data.zones[zoneKey].map(mapItem)
395
+ }),
396
+ {}
397
+ )
398
+ });
399
+ return afterPropTransforms;
400
+ }
401
+
402
+ // lib/resolve-all-data.ts
403
+ init_react_import();
404
+
405
+ // lib/resolve-component-data.ts
406
+ init_react_import();
407
+
408
+ // lib/get-changed.ts
409
+ init_react_import();
410
+ var getChanged = (newItem, oldItem) => {
411
+ return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
412
+ const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
413
+ const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
414
+ return __spreadProps(__spreadValues({}, acc), {
415
+ [item]: oldItemProps[item] !== newItemProps[item]
416
+ });
417
+ }, {}) : {};
418
+ };
419
+
420
+ // lib/resolve-component-data.ts
421
+ import fdeq from "fast-deep-equal";
422
+ var cache = { lastChange: {} };
423
+ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace", recursive = true) {
424
+ const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
425
+ if ((configForItem == null ? void 0 : configForItem.resolveData) && item.props) {
426
+ const id = "id" in item.props ? item.props.id : "root";
427
+ const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
428
+ if (item && fdeq(item, oldItem)) {
429
+ return { node: resolved, didChange: false };
430
+ }
431
+ const changed = getChanged(item, oldItem);
432
+ if (onResolveStart) {
433
+ onResolveStart(item);
434
+ }
435
+ const { props: resolvedProps, readOnly = {} } = yield configForItem.resolveData(item, {
436
+ changed,
437
+ lastData: oldItem,
438
+ metadata: __spreadValues(__spreadValues({}, metadata), configForItem.metadata),
439
+ trigger
440
+ });
441
+ let resolvedItem = __spreadProps(__spreadValues({}, item), {
442
+ props: __spreadValues(__spreadValues({}, item.props), resolvedProps)
443
+ });
444
+ if (recursive) {
445
+ resolvedItem = yield mapSlotsAsync(
446
+ resolvedItem,
447
+ (content) => __async(void 0, null, function* () {
448
+ return Promise.all(
449
+ content.map(
450
+ (childItem) => __async(void 0, null, function* () {
451
+ return (yield resolveComponentData(
452
+ childItem,
453
+ config,
454
+ metadata,
455
+ onResolveStart,
456
+ onResolveEnd,
457
+ trigger,
458
+ false
459
+ )).node;
460
+ })
461
+ )
462
+ );
463
+ }),
464
+ false,
465
+ createIsSlotConfig(config)
466
+ );
467
+ }
468
+ if (Object.keys(readOnly).length) {
469
+ resolvedItem.readOnly = readOnly;
470
+ }
471
+ cache.lastChange[id] = {
472
+ item,
473
+ resolved: resolvedItem
474
+ };
475
+ if (onResolveEnd) {
476
+ onResolveEnd(resolvedItem);
477
+ }
478
+ return { node: resolvedItem, didChange: !fdeq(item, resolvedItem) };
479
+ }
480
+ return { node: item, didChange: false };
481
+ });
482
+
483
+ // lib/data/to-component.ts
484
+ init_react_import();
485
+ var toComponent = (item) => {
486
+ return "type" in item ? item : __spreadProps(__spreadValues({}, item), {
487
+ props: __spreadProps(__spreadValues({}, item.props), { id: "root" }),
488
+ type: "root"
489
+ });
490
+ };
491
+
492
+ // lib/resolve-all-data.ts
493
+ function resolveAllData(_0, _1) {
494
+ return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
495
+ var _a;
496
+ const defaultedData = defaultData(data);
497
+ const resolveNode = (_node) => __async(this, null, function* () {
498
+ const node = toComponent(_node);
499
+ onResolveStart == null ? void 0 : onResolveStart(node);
500
+ const resolved = (yield resolveComponentData(
501
+ node,
502
+ config,
503
+ metadata,
504
+ () => {
505
+ },
506
+ () => {
507
+ },
508
+ "force",
509
+ false
510
+ )).node;
511
+ const resolvedDeep = yield mapSlotsAsync(
512
+ resolved,
513
+ processContent,
514
+ false
515
+ );
516
+ onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
517
+ return resolvedDeep;
518
+ });
519
+ const processContent = (content) => __async(this, null, function* () {
520
+ return Promise.all(content.map(resolveNode));
521
+ });
522
+ const processZones = () => __async(this, null, function* () {
523
+ var _a2;
524
+ const zones = (_a2 = data.zones) != null ? _a2 : {};
525
+ Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
526
+ zones[zoneKey] = yield Promise.all(content.map(resolveNode));
527
+ }));
528
+ return zones;
529
+ });
530
+ const dynamic = {
531
+ root: yield resolveNode(defaultedData.root),
532
+ content: yield processContent(defaultedData.content),
533
+ zones: yield processZones()
534
+ };
535
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
536
+ const content = defaultedData.zones[zoneKey];
537
+ dynamic.zones[zoneKey] = yield processContent(content);
538
+ }), {});
539
+ return dynamic;
540
+ });
541
+ }
542
+
543
+ export {
544
+ __spreadValues,
545
+ __spreadProps,
546
+ __objRest,
547
+ __commonJS,
548
+ __toESM,
549
+ __async,
550
+ init_react_import,
551
+ isSlot,
552
+ createIsSlotConfig,
553
+ rootAreaId,
554
+ rootZone,
555
+ rootDroppableId,
556
+ walkTree,
557
+ setupZone,
558
+ getChanged,
559
+ resolveComponentData,
560
+ useSlots,
561
+ Render,
562
+ SlotRenderPure,
563
+ SlotRender,
564
+ transformProps,
565
+ resolveAllData
566
+ };
package/dist/index.css CHANGED
@@ -1092,27 +1092,25 @@ textarea._Input-input_4xor1_26 {
1092
1092
  }
1093
1093
 
1094
1094
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css/#css-module-data */
1095
- ._Drawer_fkqfo_1 {
1095
+ ._Drawer_pl7z0_1 {
1096
1096
  display: flex;
1097
1097
  flex-direction: column;
1098
1098
  font-family: var(--puck-font-family);
1099
1099
  gap: 12px;
1100
1100
  }
1101
- ._Drawer-draggable_fkqfo_8 {
1101
+ ._Drawer-draggable_pl7z0_8 {
1102
1102
  position: relative;
1103
1103
  }
1104
- ._Drawer-draggableBg_fkqfo_12 {
1104
+ ._Drawer-draggableBg_pl7z0_12 {
1105
1105
  position: absolute;
1106
1106
  top: 0;
1107
1107
  right: 0;
1108
1108
  bottom: 0;
1109
1109
  left: 0;
1110
1110
  pointer-events: none;
1111
+ z-index: -1;
1111
1112
  }
1112
- ._Drawer-draggableFg_fkqfo_21 {
1113
- z-index: 1;
1114
- }
1115
- ._DrawerItem-draggable_fkqfo_25 {
1113
+ ._DrawerItem-draggable_pl7z0_22 {
1116
1114
  background: var(--puck-color-white);
1117
1115
  cursor: grab;
1118
1116
  padding: 12px;
@@ -1124,27 +1122,27 @@ textarea._Input-input_4xor1_26 {
1124
1122
  align-items: center;
1125
1123
  transition: background-color 50ms ease-in, color 50ms ease-in;
1126
1124
  }
1127
- ._DrawerItem--disabled_fkqfo_38 ._DrawerItem-draggable_fkqfo_25 {
1125
+ ._DrawerItem--disabled_pl7z0_35 ._DrawerItem-draggable_pl7z0_22 {
1128
1126
  background: var(--puck-color-grey-11);
1129
1127
  color: var(--puck-color-grey-05);
1130
1128
  cursor: not-allowed;
1131
1129
  }
1132
- ._DrawerItem_fkqfo_25:focus-visible {
1130
+ ._DrawerItem_pl7z0_22:focus-visible {
1133
1131
  outline: 0;
1134
1132
  }
1135
- ._Drawer_fkqfo_1:not(._Drawer--isDraggingFrom_fkqfo_48) ._DrawerItem_fkqfo_25:focus-visible ._DrawerItem-draggable_fkqfo_25 {
1133
+ ._Drawer_pl7z0_1:not(._Drawer--isDraggingFrom_pl7z0_45) ._DrawerItem_pl7z0_22:focus-visible ._DrawerItem-draggable_pl7z0_22 {
1136
1134
  border-radius: 4px;
1137
1135
  outline: 2px solid var(--puck-color-azure-05);
1138
1136
  outline-offset: 2px;
1139
1137
  }
1140
1138
  @media (hover: hover) and (pointer: fine) {
1141
- ._Drawer_fkqfo_1:not(._Drawer--isDraggingFrom_fkqfo_48) ._DrawerItem_fkqfo_25:not(._DrawerItem--disabled_fkqfo_38) ._DrawerItem-draggable_fkqfo_25:hover {
1139
+ ._Drawer_pl7z0_1:not(._Drawer--isDraggingFrom_pl7z0_45) ._DrawerItem_pl7z0_22:not(._DrawerItem--disabled_pl7z0_35) ._DrawerItem-draggable_pl7z0_22:hover {
1142
1140
  background-color: var(--puck-color-azure-12);
1143
1141
  color: var(--puck-color-azure-04);
1144
1142
  transition: none;
1145
1143
  }
1146
1144
  }
1147
- ._DrawerItem-name_fkqfo_66 {
1145
+ ._DrawerItem-name_pl7z0_63 {
1148
1146
  overflow-x: hidden;
1149
1147
  text-overflow: ellipsis;
1150
1148
  white-space: nowrap;
@@ -1236,7 +1234,7 @@ textarea._Input-input_4xor1_26 {
1236
1234
  [data-puck-disabled] {
1237
1235
  cursor: pointer;
1238
1236
  }
1239
- [data-puck-dragging]:not([data-dnd-dragging]) {
1237
+ [data-dnd-placeholder] {
1240
1238
  background: var(--puck-color-azure-06) !important;
1241
1239
  border: none !important;
1242
1240
  color: #00000000 !important;
@@ -1244,9 +1242,9 @@ textarea._Input-input_4xor1_26 {
1244
1242
  outline: none !important;
1245
1243
  transition: none !important;
1246
1244
  }
1247
- [data-puck-dragging]:not([data-dnd-dragging]) *,
1248
- [data-puck-dragging]:not([data-dnd-dragging])::after,
1249
- [data-puck-dragging]:not([data-dnd-dragging])::before {
1245
+ [data-dnd-placeholder] *,
1246
+ [data-dnd-placeholder]::after,
1247
+ [data-dnd-placeholder]::before {
1250
1248
  opacity: 0 !important;
1251
1249
  }
1252
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 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';
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';
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';
@@ -60,6 +60,7 @@ type FieldsSlice = {
60
60
  fields: Fields | Partial<Fields>;
61
61
  loading: boolean;
62
62
  lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
63
64
  };
64
65
 
65
66
  type Status = "LOADING" | "MOUNTED" | "READY";
@@ -248,18 +249,12 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
248
249
 
249
250
  declare function migrate(data: Data, config?: Config): Data;
250
251
 
251
- type MapSlotOptions = {
252
- parentId: string;
253
- propName: string;
254
- };
255
- declare function mapSlotsPublic<T extends ComponentData | RootData>(item: T, config: Config, map: (data: Content, options: MapSlotOptions) => Content): T;
256
-
257
252
  type WithGet<T> = T & {
258
253
  get: () => T;
259
254
  };
260
255
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
261
256
  appState: AppState;
262
- config: Config;
257
+ config: UserConfig;
263
258
  dispatch: AppStore["dispatch"];
264
259
  getPermissions: GetPermissions<UserConfig>;
265
260
  refreshPermissions: RefreshPermissions<UserConfig>;
@@ -292,4 +287,4 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConf
292
287
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
293
288
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
294
289
 
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 };
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 };