@measured/puck 0.21.0-canary.6dae6cb7 → 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,27 +111,32 @@ 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
  }
@@ -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,
@@ -295,7 +300,8 @@ init_react_import();
295
300
  var defaultViewports = [
296
301
  { width: 360, height: "auto", icon: "Smartphone", label: "Small" },
297
302
  { width: 768, height: "auto", icon: "Tablet", label: "Medium" },
298
- { width: 1280, height: "auto", icon: "Monitor", label: "Large" }
303
+ { width: 1280, height: "auto", icon: "Monitor", label: "Large" },
304
+ { width: "100%", height: "auto", icon: "FullWidth", label: "Full-width" }
299
305
  ];
300
306
 
301
307
  // store/default-app-state.ts
@@ -317,7 +323,8 @@ var defaultAppState = {
317
323
  options: [],
318
324
  controlsVisible: true
319
325
  },
320
- field: { focus: null }
326
+ field: { focus: null },
327
+ plugin: { current: null }
321
328
  },
322
329
  indexes: {
323
330
  nodes: {},
@@ -681,19 +688,19 @@ init_react_import();
681
688
 
682
689
  // lib/get-changed.ts
683
690
  init_react_import();
684
- import fdeq from "fast-deep-equal";
691
+ import { deepEqual } from "fast-equals";
685
692
  var getChanged = (newItem, oldItem) => {
686
693
  return newItem ? Object.keys(newItem.props || {}).reduce((acc, item) => {
687
694
  const newItemProps = (newItem == null ? void 0 : newItem.props) || {};
688
695
  const oldItemProps = (oldItem == null ? void 0 : oldItem.props) || {};
689
696
  return __spreadProps(__spreadValues({}, acc), {
690
- [item]: !fdeq(oldItemProps[item], newItemProps[item])
697
+ [item]: !deepEqual(oldItemProps[item], newItemProps[item])
691
698
  });
692
699
  }, {}) : {};
693
700
  };
694
701
 
695
702
  // lib/resolve-component-data.ts
696
- import fdeq2 from "fast-deep-equal";
703
+ import { deepEqual as deepEqual2 } from "fast-equals";
697
704
  var cache = { lastChange: {} };
698
705
  var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
699
706
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
@@ -702,7 +709,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
702
709
  const id = "id" in item.props ? item.props.id : "root";
703
710
  if (shouldRunResolver) {
704
711
  const { item: oldItem = null, resolved = {} } = cache.lastChange[id] || {};
705
- if (trigger !== "force" && item && fdeq2(item, oldItem)) {
712
+ if (trigger !== "force" && item && deepEqual2(item, oldItem)) {
706
713
  return { node: resolved, didChange: false };
707
714
  }
708
715
  const changed = getChanged(item, oldItem);
@@ -752,7 +759,7 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
752
759
  };
753
760
  return {
754
761
  node: itemWithResolvedChildren,
755
- didChange: !fdeq2(item, itemWithResolvedChildren)
762
+ didChange: !deepEqual2(item, itemWithResolvedChildren)
756
763
  };
757
764
  });
758
765