@measured/puck 0.19.0-canary.de23f9d → 0.19.0-canary.e62832e

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
 
@@ -187,13 +230,6 @@ function resolveRootData(data, config, metadata) {
187
230
  });
188
231
  }
189
232
 
190
- // lib/default-data.ts
191
- init_react_import();
192
- var defaultData = (data) => __spreadProps(__spreadValues({}, data), {
193
- root: data.root || {},
194
- content: data.content || []
195
- });
196
-
197
233
  // lib/resolve-all-data.ts
198
234
  function resolveAllData(_0, _1) {
199
235
  return __async(this, arguments, function* (data, config, metadata = {}, onResolveStart, onResolveEnd) {
@@ -267,6 +303,6 @@ export {
267
303
  getChanged,
268
304
  resolveComponentData,
269
305
  resolveRootData,
270
- defaultData,
306
+ transformProps,
271
307
  resolveAllData
272
308
  };
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, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-wwgDuTnC.mjs';
2
- export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-wwgDuTnC.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, M as Metadata, H as History, h as ComponentData, i as Fields, A as AppState, j as ComponentConfig } from './resolve-all-data-3XjIPfNh.mjs';
2
+ export { K as Adaptor, G as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, w as ComponentDataMap, x as Content, W as CustomField, $ as DefaultComponentProps, Y as DefaultRootFieldProps, _ as DefaultRootProps, Z as DefaultRootRenderProps, k as Direction, l as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, p as FieldRenderFunctions, q as ItemWithId, v as MappedItem, N as NumberField, J as ObjectField, n as OverrideKey, s as PuckComponent, X as PuckContext, E as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a7 as resolveAllData, a6 as transformProps } from './resolve-all-data-3XjIPfNh.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';
@@ -148,17 +148,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
148
148
 
149
149
  declare function migrate(data: Data): Data;
150
150
 
151
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
152
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
153
- [key: string]: any;
154
- }) => Props[ComponentName];
155
- } & {
156
- root: (props: RootProps & {
157
- [key: string]: any;
158
- }) => RootProps;
159
- }>;
160
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
161
-
162
151
  type HistorySlice<D = any> = {
163
152
  index: number;
164
153
  hasPast: () => boolean;
@@ -294,4 +283,4 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
294
283
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = UsePuckData<UserConfig, UserGenerics<UserConfig>>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
295
284
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
296
285
 
297
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, transformProps, usePuck };
286
+ 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, Render, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, 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, M as Metadata, h as DefaultComponentProps, i as DefaultRootFieldProps, H as History, j as ComponentData, k as Fields, A as AppState, l as ComponentConfig } from './resolve-all-data-wwgDuTnC.js';
2
- export { Q as Adaptor, K as ArrayField, t as ArrayState, a2 as AsFieldProps, B as BaseData, E as BaseField, y as ComponentDataMap, z as Content, Y as CustomField, $ as DefaultRootProps, _ as DefaultRootRenderProps, m as Direction, n as DragAxis, X as ExternalField, W as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, x as MappedItem, N as NumberField, L as ObjectField, q as OverrideKey, u as PuckComponent, Z as PuckContext, J as RadioField, w as RootData, R as RootDataWithProps, v as RootDataWithoutProps, S as SelectField, T as TextField, G as TextareaField, o as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, p as overrideKeys, a6 as resolveAllData } from './resolve-all-data-wwgDuTnC.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, M as Metadata, H as History, h as ComponentData, i as Fields, A as AppState, j as ComponentConfig } from './resolve-all-data-3XjIPfNh.js';
2
+ export { K as Adaptor, G as ArrayField, r as ArrayState, a2 as AsFieldProps, B as BaseData, y as BaseField, w as ComponentDataMap, x as Content, W as CustomField, $ as DefaultComponentProps, Y as DefaultRootFieldProps, _ as DefaultRootProps, Z as DefaultRootRenderProps, k as Direction, l as DragAxis, Q as ExternalField, L as ExternalFieldWithAdaptor, a4 as ExtractPropsFromConfig, a5 as ExtractRootPropsFromConfig, p as FieldRenderFunctions, q as ItemWithId, v as MappedItem, N as NumberField, J as ObjectField, n as OverrideKey, s as PuckComponent, X as PuckContext, E as RadioField, u as RootData, R as RootDataWithProps, t as RootDataWithoutProps, S as SelectField, T as TextField, z as TextareaField, m as Viewport, a3 as WithChildren, a0 as WithId, a1 as WithPuckProps, o as overrideKeys, a7 as resolveAllData, a6 as transformProps } from './resolve-all-data-3XjIPfNh.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 } from 'react';
@@ -148,17 +148,6 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
148
148
 
149
149
  declare function migrate(data: Data): Data;
150
150
 
151
- type PropTransform<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps> = Partial<{
152
- [ComponentName in keyof Props]: (props: Props[ComponentName] & {
153
- [key: string]: any;
154
- }) => Props[ComponentName];
155
- } & {
156
- root: (props: RootProps & {
157
- [key: string]: any;
158
- }) => RootProps;
159
- }>;
160
- declare function transformProps<Props extends DefaultComponentProps = DefaultComponentProps, RootProps extends DefaultComponentProps = DefaultRootFieldProps>(data: Partial<Data>, propTransforms: PropTransform<Props, RootProps>): Data;
161
-
162
151
  type HistorySlice<D = any> = {
163
152
  index: number;
164
153
  hasPast: () => boolean;
@@ -294,4 +283,4 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
294
283
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = UsePuckData<UserConfig, UserGenerics<UserConfig>>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
295
284
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
296
285
 
297
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Data, DefaultComponentProps, DefaultRootFieldProps, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, Render, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, transformProps, usePuck };
286
+ 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, Render, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, migrate, renderContext, usePuck };