@measured/puck 0.18.3-canary.154e7f7 → 0.18.3-canary.1d484ee

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.
@@ -91,6 +91,49 @@ var init_react_import = __esm({
91
91
  }
92
92
  });
93
93
 
94
+ // lib/transform-props.ts
95
+ init_react_import();
96
+
97
+ // lib/default-data.ts
98
+ init_react_import();
99
+ var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
100
+ root: data.root || {},
101
+ content: data.content || []
102
+ });
103
+
104
+ // lib/transform-props.ts
105
+ function transformProps(data, propTransforms) {
106
+ const mapItem = (item) => {
107
+ if (propTransforms[item.type]) {
108
+ return __spreadProps(__spreadValues({}, item), {
109
+ props: propTransforms[item.type](item.props)
110
+ });
111
+ }
112
+ return item;
113
+ };
114
+ const defaultedData = defaultData(data);
115
+ const rootProps = defaultedData.root.props || defaultedData.root;
116
+ let newRoot = __spreadValues({}, defaultedData.root);
117
+ if (propTransforms["root"]) {
118
+ if (defaultedData.root.props) {
119
+ newRoot.props = propTransforms["root"](rootProps);
120
+ } else {
121
+ newRoot = propTransforms["root"](rootProps);
122
+ }
123
+ }
124
+ const afterPropTransforms = __spreadProps(__spreadValues({}, defaultedData), {
125
+ root: newRoot,
126
+ content: defaultedData.content.map(mapItem),
127
+ zones: Object.keys(data.zones || {}).reduce(
128
+ (acc, zoneKey) => __spreadProps(__spreadValues({}, acc), {
129
+ [zoneKey]: data.zones[zoneKey].map(mapItem)
130
+ }),
131
+ {}
132
+ )
133
+ });
134
+ return afterPropTransforms;
135
+ }
136
+
94
137
  // lib/resolve-all-data.ts
95
138
  init_react_import();
96
139
 
@@ -181,13 +224,6 @@ function resolveRootData(data, config) {
181
224
  });
182
225
  }
183
226
 
184
- // lib/default-data.ts
185
- init_react_import();
186
- var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
187
- root: data.root || {},
188
- content: data.content || []
189
- });
190
-
191
227
  // lib/resolve-all-data.ts
192
228
  function resolveAllData(data, config, onResolveStart, onResolveEnd) {
193
229
  return __async(this, null, function* () {
@@ -251,6 +287,6 @@ export {
251
287
  getChanged,
252
288
  resolveComponentData,
253
289
  resolveRootData,
254
- defaultData,
290
+ transformProps,
255
291
  resolveAllData
256
292
  };
package/dist/index.css CHANGED
@@ -612,6 +612,19 @@ textarea._Input-input_g5w3n_26 {
612
612
  }
613
613
  }
614
614
 
615
+ /* components/Sortable/styles.css */
616
+ [data-dnd-placeholder] * {
617
+ opacity: 0 !important;
618
+ }
619
+ [data-dnd-placeholder] {
620
+ background: var(--puck-color-azure-09) !important;
621
+ border: none !important;
622
+ color: #00000000 !important;
623
+ opacity: 0.3 !important;
624
+ outline: none !important;
625
+ transition: none !important;
626
+ }
627
+
615
628
  /* css-module:/home/runner/work/puck/puck/packages/core/components/ExternalInput/styles.module.css/#css-module-data */
616
629
  ._ExternalInput-actions_91ls0_1 {
617
630
  display: flex;
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-ppm982Jh.mjs';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-ppm982Jh.mjs';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, H as History, A as AppState, E as ExtractPropsFromConfig, h as ExtractRootPropsFromConfig, i as ComponentDataMap } from './resolve-all-data-ChsqfT2w.mjs';
2
+ export { K as Adaptor, G as ArrayField, q as ArrayState, a3 as AsFieldProps, B as BaseData, x as BaseField, s as ComponentConfig, v as ComponentData, w as Content, W as CustomField, a0 as DefaultComponentProps, Z as DefaultRootFieldProps, $ as DefaultRootProps, _ as DefaultRootRenderProps, j as Direction, k as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, n as FieldRenderFunctions, X as Fields, p as ItemWithId, M as MappedItem, N as NumberField, J as ObjectField, m as OverrideKey, r as PuckComponent, Y as PuckContext, z as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, y as TextareaField, l as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.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 } from 'react';
@@ -140,17 +140,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
140
140
 
141
141
  declare function migrate(data: Data): Data;
142
142
 
143
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
144
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
145
- [key: string]: any;
146
- }) => Props[ComponentName];
147
- } & {
148
- root: (props: RootProps & {
149
- [key: string]: any;
150
- }) => RootProps;
151
- }>;
152
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
153
-
154
143
  type HistoryStore<D = any> = {
155
144
  index: number;
156
145
  hasPast: boolean;
@@ -194,4 +183,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
194
183
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
195
184
  };
196
185
 
197
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
186
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, A as AppState, E as ExtractPropsFromConfig, j as ExtractRootPropsFromConfig, k as ComponentDataMap } from './resolve-all-data-ppm982Jh.js';
2
- export { Q as Adaptor, K as ArrayField, s as ArrayState, a3 as AsFieldProps, B as BaseData, z as BaseField, u as ComponentConfig, x as ComponentData, y as Content, Y as CustomField, a0 as DefaultRootProps, $ as DefaultRootRenderProps, l as Direction, m as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, q as FieldRenderFunctions, Z as Fields, r as ItemWithId, M as MappedItem, N as NumberField, L as ObjectField, p as OverrideKey, t as PuckComponent, _ as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, n as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a5 as resolveAllData } from './resolve-all-data-ppm982Jh.js';
1
+ import { F as FieldProps, a as Field, D as DropZoneProps, C as Config, U as UserGenerics, b as Data, c as UiState, O as OnAction, P as Permissions, d as Plugin, e as Overrides, f as PuckAction, V as Viewports, I as IframeConfig, g as InitialHistory, H as History, A as AppState, E as ExtractPropsFromConfig, h as ExtractRootPropsFromConfig, i as ComponentDataMap } from './resolve-all-data-ChsqfT2w.js';
2
+ export { K as Adaptor, G as ArrayField, q as ArrayState, a3 as AsFieldProps, B as BaseData, x as BaseField, s as ComponentConfig, v as ComponentData, w as Content, W as CustomField, a0 as DefaultComponentProps, Z as DefaultRootFieldProps, $ as DefaultRootProps, _ as DefaultRootRenderProps, j as Direction, k as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, n as FieldRenderFunctions, X as Fields, p as ItemWithId, M as MappedItem, N as NumberField, J as ObjectField, m as OverrideKey, r as PuckComponent, Y as PuckContext, z as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, y as TextareaField, l as Viewport, a4 as WithChildren, a1 as WithId, a2 as WithPuckProps, o as overrideKeys, a6 as resolveAllData, a5 as transformProps } from './resolve-all-data-ChsqfT2w.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 } from 'react';
@@ -140,17 +140,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
140
140
 
141
141
  declare function migrate(data: Data): Data;
142
142
 
143
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
144
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
145
- [key: string]: any;
146
- }) => Props[ComponentName];
147
- } & {
148
- root: (props: RootProps & {
149
- [key: string]: any;
150
- }) => RootProps;
151
- }>;
152
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
153
-
154
143
  type HistoryStore<D = any> = {
155
144
  index: number;
156
145
  hasPast: boolean;
@@ -194,4 +183,4 @@ declare const usePuck: <UserConfig extends Config = Config>() => {
194
183
  selectedItem: ComponentDataMap<ExtractPropsFromConfig<UserConfig>> | null;
195
184
  };
196
185
 
197
- export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, transformProps, usePuck };
186
+ export { Action, ActionBar, AppState, AutoField, Button, ComponentDataMap, Config, Data, Drawer, DropZone, ExtractPropsFromConfig, ExtractRootPropsFromConfig, Field, FieldLabel, FieldProps, Group, History, IconButton, IframeConfig, InitialHistory, Label, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, UserGenerics, Viewports, migrate, usePuck };