@measured/puck 0.21.0-canary.7dca3a5a → 0.21.0-canary.7ed9655b

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.
@@ -21,14 +21,14 @@ import {
21
21
  setDeep,
22
22
  useGetPuck,
23
23
  usePuck
24
- } from "./chunk-FKDVYRQW.mjs";
24
+ } from "./chunk-QOZ6ZSWO.mjs";
25
25
  import {
26
26
  init_react_import,
27
27
  migrate,
28
28
  resolveAllData,
29
29
  transformProps,
30
30
  walkTree
31
- } from "./chunk-6SIKCDJJ.mjs";
31
+ } from "./chunk-IDP5ATXM.mjs";
32
32
 
33
33
  // bundle/no-external.ts
34
34
  init_react_import();
package/dist/rsc.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DS1xB387.mjs';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DS1xB387.mjs';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CI7CLsRf.mjs';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CI7CLsRf.mjs';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
package/dist/rsc.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-DS1xB387.js';
3
- export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-DS1xB387.js';
2
+ import { C as Config, U as UserGenerics, M as Metadata } from './walk-tree-CI7CLsRf.js';
3
+ export { m as migrate, r as resolveAllData, t as transformProps, w as walkTree } from './walk-tree-CI7CLsRf.js';
4
4
  import 'react';
5
5
 
6
6
  declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
package/dist/rsc.js CHANGED
@@ -346,8 +346,9 @@ var Item = ({
346
346
  );
347
347
  };
348
348
  var SlotRender = (0, import_react3.forwardRef)(
349
- function SlotRenderInternal({ className, style, content, config, metadata }, ref) {
350
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, style, ref, children: content.map((item) => {
349
+ function SlotRenderInternal({ className, style, content, config, metadata, as }, ref) {
350
+ const El = as != null ? as : "div";
351
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(El, { className, style, ref, children: content.map((item) => {
351
352
  if (!config.components[item.type]) {
352
353
  return null;
353
354
  }
@@ -474,7 +475,7 @@ var getChanged = (newItem, oldItem) => {
474
475
  // lib/resolve-component-data.ts
475
476
  var import_fast_equals2 = require("fast-equals");
476
477
  var cache = { lastChange: {} };
477
- var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
478
+ var resolveComponentData = (_0, _1, ..._2) => __async(null, [_0, _1, ..._2], function* (item, config, metadata = {}, onResolveStart, onResolveEnd, trigger = "replace") {
478
479
  const configForItem = "type" in item && item.type !== "root" ? config.components[item.type] : config.root;
479
480
  const resolvedItem = __spreadValues({}, item);
480
481
  const shouldRunResolver = (configForItem == null ? void 0 : configForItem.resolveData) && item.props;
@@ -502,11 +503,11 @@ var resolveComponentData = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], f
502
503
  let itemWithResolvedChildren = yield mapFields(
503
504
  resolvedItem,
504
505
  {
505
- slot: (_02) => __async(void 0, [_02], function* ({ value }) {
506
+ slot: (_02) => __async(null, [_02], function* ({ value }) {
506
507
  const content = value;
507
508
  return yield Promise.all(
508
509
  content.map(
509
- (childItem) => __async(void 0, null, function* () {
510
+ (childItem) => __async(null, null, function* () {
510
511
  return (yield resolveComponentData(
511
512
  childItem,
512
513
  config,
@@ -554,7 +555,7 @@ function resolveAllData(_0, _1) {
554
555
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
555
556
  var _a;
556
557
  const defaultedData = defaultData(data);
557
- const resolveNode = (_node) => __async(this, null, function* () {
558
+ const resolveNode = (_node) => __async(null, null, function* () {
558
559
  const node = toComponent(_node);
559
560
  onResolveStart == null ? void 0 : onResolveStart(node);
560
561
  const resolved = (yield resolveComponentData(
@@ -575,13 +576,13 @@ function resolveAllData(_0, _1) {
575
576
  onResolveEnd == null ? void 0 : onResolveEnd(toComponent(resolvedDeep));
576
577
  return resolvedDeep;
577
578
  });
578
- const processContent = (content) => __async(this, null, function* () {
579
+ const processContent = (content) => __async(null, null, function* () {
579
580
  return Promise.all(content.map(resolveNode));
580
581
  });
581
- const processZones = () => __async(this, null, function* () {
582
+ const processZones = () => __async(null, null, function* () {
582
583
  var _a2;
583
584
  const zones = (_a2 = data.zones) != null ? _a2 : {};
584
- Object.entries(zones).forEach((_02) => __async(this, [_02], function* ([zoneKey, content]) {
585
+ Object.entries(zones).forEach((_02) => __async(null, [_02], function* ([zoneKey, content]) {
585
586
  zones[zoneKey] = yield Promise.all(content.map(resolveNode));
586
587
  }));
587
588
  return zones;
@@ -591,7 +592,7 @@ function resolveAllData(_0, _1) {
591
592
  content: yield processContent(defaultedData.content),
592
593
  zones: yield processZones()
593
594
  };
594
- Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(this, null, function* () {
595
+ Object.keys((_a = defaultedData.zones) != null ? _a : {}).forEach((zoneKey) => __async(null, null, function* () {
595
596
  const content = defaultedData.zones[zoneKey];
596
597
  dynamic.zones[zoneKey] = yield processContent(content);
597
598
  }), {});
package/dist/rsc.mjs CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  transformProps,
13
13
  useSlots,
14
14
  walkTree
15
- } from "./chunk-6SIKCDJJ.mjs";
15
+ } from "./chunk-IDP5ATXM.mjs";
16
16
 
17
17
  // bundle/rsc.tsx
18
18
  init_react_import();
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
1
+ import { ReactElement, ReactNode, CSSProperties, ElementType, JSX } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
@@ -53,7 +53,7 @@ interface ArrayField<Props extends {
53
53
  } ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
54
54
  };
55
55
  defaultItemProps?: Props[0] | ((index: number) => Props[0]);
56
- getItemSummary?: (item: Props[0], index?: number) => string;
56
+ getItemSummary?: (item: Props[0], index?: number) => ReactNode;
57
57
  max?: number;
58
58
  min?: number;
59
59
  }
@@ -80,7 +80,7 @@ type ExternalFieldWithAdaptor<Props extends any = {
80
80
  placeholder?: string;
81
81
  adaptor: Adaptor<any, any, Props>;
82
82
  adaptorParams?: object;
83
- getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
83
+ getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
84
84
  };
85
85
  type CacheOpts = {
86
86
  enabled?: boolean;
@@ -97,7 +97,7 @@ interface ExternalField<Props extends any = {
97
97
  }) => Promise<any[] | null>;
98
98
  mapProp?: (value: any) => Props;
99
99
  mapRow?: (value: any) => Record<string, string | number | ReactElement>;
100
- getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
100
+ getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
101
101
  showSearch?: boolean;
102
102
  renderFooter?: (props: {
103
103
  items: any[];
@@ -118,6 +118,7 @@ interface CustomField<Value extends any> extends BaseField {
118
118
  type: "custom";
119
119
  render: CustomFieldRender<Value>;
120
120
  contentEditable?: boolean;
121
+ key?: string;
121
122
  }
122
123
  interface SlotField extends BaseField {
123
124
  type: "slot";
@@ -145,9 +146,10 @@ type DropZoneProps = {
145
146
  allow?: string[];
146
147
  disallow?: string[];
147
148
  style?: CSSProperties;
148
- minEmptyHeight?: number;
149
+ minEmptyHeight?: CSSProperties["minHeight"] | number;
149
150
  className?: string;
150
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
151
153
  };
152
154
 
153
155
  type PuckContext = {
@@ -238,6 +240,7 @@ UserField extends BaseField = {}> = {
238
240
  permissions: Partial<Permissions>;
239
241
  appState: AppState;
240
242
  lastData: DataShape | null;
243
+ parent: ComponentData | null;
241
244
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
242
245
  metadata?: ComponentMetadata;
243
246
  } & ComponentConfigExtensions;
@@ -331,6 +334,7 @@ interface FieldMetadata extends Metadata {
331
334
  type ItemWithId = {
332
335
  _arrayId: string;
333
336
  _originalIndex: number;
337
+ _currentIndex: number;
334
338
  };
335
339
  type ArrayState = {
336
340
  items: ItemWithId[];
@@ -1,4 +1,4 @@
1
- import { ReactElement, CSSProperties, ReactNode, JSX } from 'react';
1
+ import { ReactElement, ReactNode, CSSProperties, ElementType, JSX } from 'react';
2
2
 
3
3
  type ItemSelector = {
4
4
  index: number;
@@ -53,7 +53,7 @@ interface ArrayField<Props extends {
53
53
  } ? Field<Props[0][SubPropName], UserField> | UserField : Field<Props[0][SubPropName], UserField>;
54
54
  };
55
55
  defaultItemProps?: Props[0] | ((index: number) => Props[0]);
56
- getItemSummary?: (item: Props[0], index?: number) => string;
56
+ getItemSummary?: (item: Props[0], index?: number) => ReactNode;
57
57
  max?: number;
58
58
  min?: number;
59
59
  }
@@ -80,7 +80,7 @@ type ExternalFieldWithAdaptor<Props extends any = {
80
80
  placeholder?: string;
81
81
  adaptor: Adaptor<any, any, Props>;
82
82
  adaptorParams?: object;
83
- getItemSummary: (item: NotUndefined<Props>, index?: number) => string;
83
+ getItemSummary: (item: NotUndefined<Props>, index?: number) => ReactNode;
84
84
  };
85
85
  type CacheOpts = {
86
86
  enabled?: boolean;
@@ -97,7 +97,7 @@ interface ExternalField<Props extends any = {
97
97
  }) => Promise<any[] | null>;
98
98
  mapProp?: (value: any) => Props;
99
99
  mapRow?: (value: any) => Record<string, string | number | ReactElement>;
100
- getItemSummary?: (item: NotUndefined<Props>, index?: number) => string;
100
+ getItemSummary?: (item: NotUndefined<Props>, index?: number) => ReactNode;
101
101
  showSearch?: boolean;
102
102
  renderFooter?: (props: {
103
103
  items: any[];
@@ -118,6 +118,7 @@ interface CustomField<Value extends any> extends BaseField {
118
118
  type: "custom";
119
119
  render: CustomFieldRender<Value>;
120
120
  contentEditable?: boolean;
121
+ key?: string;
121
122
  }
122
123
  interface SlotField extends BaseField {
123
124
  type: "slot";
@@ -145,9 +146,10 @@ type DropZoneProps = {
145
146
  allow?: string[];
146
147
  disallow?: string[];
147
148
  style?: CSSProperties;
148
- minEmptyHeight?: number;
149
+ minEmptyHeight?: CSSProperties["minHeight"] | number;
149
150
  className?: string;
150
151
  collisionAxis?: DragAxis;
152
+ as?: ElementType;
151
153
  };
152
154
 
153
155
  type PuckContext = {
@@ -238,6 +240,7 @@ UserField extends BaseField = {}> = {
238
240
  permissions: Partial<Permissions>;
239
241
  appState: AppState;
240
242
  lastData: DataShape | null;
243
+ parent: ComponentData | null;
241
244
  }) => Promise<Partial<Permissions>> | Partial<Permissions>;
242
245
  metadata?: ComponentMetadata;
243
246
  } & ComponentConfigExtensions;
@@ -331,6 +334,7 @@ interface FieldMetadata extends Metadata {
331
334
  type ItemWithId = {
332
335
  _arrayId: string;
333
336
  _originalIndex: number;
337
+ _currentIndex: number;
334
338
  };
335
339
  type ArrayState = {
336
340
  items: ItemWithId[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@measured/puck",
3
- "version": "0.21.0-canary.7dca3a5a",
3
+ "version": "0.21.0-canary.7ed9655b",
4
4
  "description": "The open-source visual editor for React",
5
5
  "author": "Chris Villa <chris@puckeditor.com>",
6
6
  "repository": "measuredco/puck",