@measured/puck 0.21.0-canary.5c9698fb → 0.21.0-canary.8db6528d

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.
@@ -111,34 +111,39 @@ var walkField = ({
111
111
  config,
112
112
  recurseSlots = false
113
113
  }) => {
114
- var _a, _b, _c;
114
+ var _a, _b, _c, _d;
115
115
  const fieldType = (_a = fields[propKey]) == null ? void 0 : _a.type;
116
116
  const map = mappers[fieldType];
117
117
  if (map && fieldType === "slot") {
118
118
  const content = value || [];
119
- const mappedContent = recurseSlots ? content.map((el) => {
120
- var _a2;
121
- const componentConfig = config.components[el.type];
122
- if (!componentConfig) {
123
- throw new Error(`Could not find component config for ${el.type}`);
119
+ let mappedContent = content;
120
+ if (recurseSlots) {
121
+ for (let i = 0; i < content.length; i++) {
122
+ const el = content[i];
123
+ const componentConfig = config.components[el.type];
124
+ if (!componentConfig || !el.props) {
125
+ continue;
126
+ }
127
+ const fields2 = (_b = componentConfig.fields) != null ? _b : {};
128
+ mappedContent.push(
129
+ walkField({
130
+ value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
131
+ fields: fields2,
132
+ mappers,
133
+ id: el.props.id,
134
+ config,
135
+ recurseSlots
136
+ })
137
+ );
124
138
  }
125
- const fields2 = (_a2 = componentConfig.fields) != null ? _a2 : {};
126
- return walkField({
127
- value: __spreadProps(__spreadValues({}, el), { props: defaultSlots(el.props, fields2) }),
128
- fields: fields2,
129
- mappers,
130
- id: el.props.id,
131
- config,
132
- recurseSlots
133
- });
134
- }) : content;
139
+ }
135
140
  if (containsPromise(mappedContent)) {
136
141
  return Promise.all(mappedContent);
137
142
  }
138
143
  return map({
139
144
  value: mappedContent,
140
145
  parentId: id,
141
- propName: propKey,
146
+ propName: propPath,
142
147
  field: fields[propKey],
143
148
  propPath
144
149
  });
@@ -153,7 +158,7 @@ var walkField = ({
153
158
  }
154
159
  if (value && typeof value === "object") {
155
160
  if (Array.isArray(value)) {
156
- const arrayFields = ((_b = fields[propKey]) == null ? void 0 : _b.type) === "array" ? fields[propKey].arrayFields : null;
161
+ const arrayFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "array" ? fields[propKey].arrayFields : null;
157
162
  if (!arrayFields) return value;
158
163
  const newValue = value.map(
159
164
  (el, idx) => walkField({
@@ -174,7 +179,7 @@ var walkField = ({
174
179
  } else if ("$$typeof" in value) {
175
180
  return value;
176
181
  } else {
177
- const objectFields = ((_c = fields[propKey]) == null ? void 0 : _c.type) === "object" ? fields[propKey].objectFields : fields;
182
+ const objectFields = ((_d = fields[propKey]) == null ? void 0 : _d.type) === "object" ? fields[propKey].objectFields : fields;
178
183
  return walkObject({
179
184
  value,
180
185
  fields: objectFields,
@@ -683,19 +688,19 @@ init_react_import();
683
688
 
684
689
  // lib/get-changed.ts
685
690
  init_react_import();
686
- import fdeq from "fast-deep-equal";
691
+ import { deepEqual } from "fast-equals";
687
692
  var getChanged = (newItem, oldItem) => {
688
693
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
689
694
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
690
695
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
691
696
  return __spreadProps(__spreadValues({}, acc), {
692
- [item]: !fdeq(oldItemProps[item], newItemProps[item])
697
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
693
698
  });
694
699
  }, {}) : {};
695
700
  };
696
701
 
697
702
  // lib/resolve-component-data.ts
698
- import fdeq2 from "fast-deep-equal";
703
+ import { deepEqual as deepEqual2 } from "fast-equals";
699
704
  var cache = { lastChange: {} };
700
705
  var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
701
706
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
@@ -704,7 +709,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
704
709
  const id = "id" in item.props ? item.props.id : "root";
705
710
  if (shouldRunResolver) {
706
711
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
707
- if (item && fdeq2(item, oldItem)) {
712
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
708
713
  return { node: resolved, didChange: false };
709
714
  }
710
715
  const changed = getChanged(item, oldItem);
@@ -754,7 +759,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
754
759
  };
755
760
  return {
756
761
  node: itemWithResolvedChildren,
757
- didChange: !fdeq2(item, itemWithResolvedChildren)
762
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
758
763
  };
759
764
  });
760
765
 
package/dist/index.css CHANGED
@@ -1331,15 +1331,16 @@ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1331
1331
  }
1332
1332
 
1333
1333
  /* css-module:/home/runner/work/puck/puck/packages/core/components/InlineTextField/styles.module.css/#css-module-data */
1334
- ._InlineTextField_ilw2a_1 {
1334
+ ._InlineTextField_1xph6_1 {
1335
1335
  cursor: text;
1336
1336
  display: inline-block;
1337
+ white-space: pre-wrap;
1337
1338
  }
1338
- [data-dnd-dragging] ._InlineTextField_ilw2a_1 {
1339
+ [data-dnd-dragging] ._InlineTextField_1xph6_1 {
1339
1340
  cursor: none;
1340
1341
  caret-color: transparent;
1341
1342
  }
1342
- [data-dnd-dragging] ._InlineTextField_ilw2a_1::selection {
1343
+ [data-dnd-dragging] ._InlineTextField_1xph6_1::selection {
1343
1344
  display: none;
1344
1345
  }
1345
1346
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, a as ComponentData, C 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 FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-C0rGZzWO.mjs';
2
- export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-C0rGZzWO.mjs';
1
+ import { H as History, P as Permissions, a as ComponentData, C 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 FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-Cvtjzg9C.mjs';
2
+ export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Cvtjzg9C.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, CSSProperties } from 'react';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, a as ComponentData, C 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 FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-C0rGZzWO.js';
2
- export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-C0rGZzWO.js';
1
+ import { H as History, P as Permissions, a as ComponentData, C 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 FieldTransforms, h as Field, i as FieldProps, D as DropZoneProps, j as Data, k as OnAction, l as InitialHistory, n as ItemSelector, o as PluginInternal } from './walk-tree-Cvtjzg9C.js';
2
+ export { a8 as Adaptor, a6 as ArrayField, E as ArrayState, al as AsFieldProps, Q as BaseData, a0 as BaseField, _ as ComponentDataMap, Y as ComponentDataOptionalId, $ as Content, ac as CustomField, ab as CustomFieldRender, ai as DefaultComponentProps, L as DefaultComponents, af as DefaultRootFieldProps, ah as DefaultRootProps, ag as DefaultRootRenderProps, p as Direction, q as DragAxis, aa as ExternalField, a9 as ExternalFieldWithAdaptor, N as ExtractConfigParams, an as ExtractField, z as FieldRenderFunctions, v as FieldTransformFn, u as FieldTransformFnParams, B as ItemWithId, Z as MappedItem, a2 as NumberField, a7 as ObjectField, y as OverrideKey, J as PuckComponent, ae as PuckContext, a5 as RadioField, K as RootConfig, X as RootData, T as RootDataWithoutProps, a4 as SelectField, S as Slot, G as SlotComponent, ad as SlotField, a1 as TextField, a3 as TextareaField, s as Viewport, am as WithChildren, aj as WithId, ak as WithPuckProps, W as WithSlotProps, m as migrate, x as overrideKeys, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-Cvtjzg9C.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import react__default, { ReactNode, SyntheticEvent, ReactElement, CSSProperties } from 'react';