@measured/puck 0.19.0-canary.a6dd529f → 0.19.0-canary.a967ca42

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.
package/dist/index.css CHANGED
@@ -1092,27 +1092,25 @@ textarea._Input-input_4xor1_26 {
1092
1092
  }
1093
1093
 
1094
1094
  /* css-module:/home/runner/work/puck/puck/packages/core/components/Drawer/styles.module.css/#css-module-data */
1095
- ._Drawer_fkqfo_1 {
1095
+ ._Drawer_pl7z0_1 {
1096
1096
  display: flex;
1097
1097
  flex-direction: column;
1098
1098
  font-family: var(--puck-font-family);
1099
1099
  gap: 12px;
1100
1100
  }
1101
- ._Drawer-draggable_fkqfo_8 {
1101
+ ._Drawer-draggable_pl7z0_8 {
1102
1102
  position: relative;
1103
1103
  }
1104
- ._Drawer-draggableBg_fkqfo_12 {
1104
+ ._Drawer-draggableBg_pl7z0_12 {
1105
1105
  position: absolute;
1106
1106
  top: 0;
1107
1107
  right: 0;
1108
1108
  bottom: 0;
1109
1109
  left: 0;
1110
1110
  pointer-events: none;
1111
+ z-index: -1;
1111
1112
  }
1112
- ._Drawer-draggableFg_fkqfo_21 {
1113
- z-index: 1;
1114
- }
1115
- ._DrawerItem-draggable_fkqfo_25 {
1113
+ ._DrawerItem-draggable_pl7z0_22 {
1116
1114
  background: var(--puck-color-white);
1117
1115
  cursor: grab;
1118
1116
  padding: 12px;
@@ -1124,27 +1122,27 @@ textarea._Input-input_4xor1_26 {
1124
1122
  align-items: center;
1125
1123
  transition: background-color 50ms ease-in, color 50ms ease-in;
1126
1124
  }
1127
- ._DrawerItem--disabled_fkqfo_38 ._DrawerItem-draggable_fkqfo_25 {
1125
+ ._DrawerItem--disabled_pl7z0_35 ._DrawerItem-draggable_pl7z0_22 {
1128
1126
  background: var(--puck-color-grey-11);
1129
1127
  color: var(--puck-color-grey-05);
1130
1128
  cursor: not-allowed;
1131
1129
  }
1132
- ._DrawerItem_fkqfo_25:focus-visible {
1130
+ ._DrawerItem_pl7z0_22:focus-visible {
1133
1131
  outline: 0;
1134
1132
  }
1135
- ._Drawer_fkqfo_1:not(._Drawer--isDraggingFrom_fkqfo_48) ._DrawerItem_fkqfo_25:focus-visible ._DrawerItem-draggable_fkqfo_25 {
1133
+ ._Drawer_pl7z0_1:not(._Drawer--isDraggingFrom_pl7z0_45) ._DrawerItem_pl7z0_22:focus-visible ._DrawerItem-draggable_pl7z0_22 {
1136
1134
  border-radius: 4px;
1137
1135
  outline: 2px solid var(--puck-color-azure-05);
1138
1136
  outline-offset: 2px;
1139
1137
  }
1140
1138
  @media (hover: hover) and (pointer: fine) {
1141
- ._Drawer_fkqfo_1:not(._Drawer--isDraggingFrom_fkqfo_48) ._DrawerItem_fkqfo_25:not(._DrawerItem--disabled_fkqfo_38) ._DrawerItem-draggable_fkqfo_25:hover {
1139
+ ._Drawer_pl7z0_1:not(._Drawer--isDraggingFrom_pl7z0_45) ._DrawerItem_pl7z0_22:not(._DrawerItem--disabled_pl7z0_35) ._DrawerItem-draggable_pl7z0_22:hover {
1142
1140
  background-color: var(--puck-color-azure-12);
1143
1141
  color: var(--puck-color-azure-04);
1144
1142
  transition: none;
1145
1143
  }
1146
1144
  }
1147
- ._DrawerItem-name_fkqfo_66 {
1145
+ ._DrawerItem-name_pl7z0_63 {
1148
1146
  overflow-x: hidden;
1149
1147
  text-overflow: ellipsis;
1150
1148
  white-space: nowrap;
@@ -1236,7 +1234,7 @@ textarea._Input-input_4xor1_26 {
1236
1234
  [data-puck-disabled] {
1237
1235
  cursor: pointer;
1238
1236
  }
1239
- [data-puck-dragging]:not([data-dnd-dragging]) {
1237
+ [data-dnd-placeholder] {
1240
1238
  background: var(--puck-color-azure-06) !important;
1241
1239
  border: none !important;
1242
1240
  color: #00000000 !important;
@@ -1244,9 +1242,9 @@ textarea._Input-input_4xor1_26 {
1244
1242
  outline: none !important;
1245
1243
  transition: none !important;
1246
1244
  }
1247
- [data-puck-dragging]:not([data-dnd-dragging]) *,
1248
- [data-puck-dragging]:not([data-dnd-dragging])::after,
1249
- [data-puck-dragging]:not([data-dnd-dragging])::before {
1245
+ [data-dnd-placeholder] *,
1246
+ [data-dnd-placeholder]::after,
1247
+ [data-dnd-placeholder]::before {
1250
1248
  opacity: 0 !important;
1251
1249
  }
1252
1250
  [data-dnd-dragging][data-puck-component] {
@@ -1256,7 +1254,7 @@ textarea._Input-input_4xor1_26 {
1256
1254
  }
1257
1255
 
1258
1256
  /* css-module:/home/runner/work/puck/puck/packages/core/components/DropZone/styles.module.css/#css-module-data */
1259
- ._DropZone_3dmev_1 {
1257
+ ._DropZone_1i2sv_1 {
1260
1258
  --resize-animation-ms: 150ms;
1261
1259
  position: relative;
1262
1260
  height: 100%;
@@ -1264,47 +1262,47 @@ textarea._Input-input_4xor1_26 {
1264
1262
  outline-offset: -2px;
1265
1263
  width: 100%;
1266
1264
  }
1267
- ._DropZone--hasChildren_3dmev_11 {
1265
+ ._DropZone--hasChildren_1i2sv_11 {
1268
1266
  min-height: 0;
1269
1267
  }
1270
- ._DropZone_3dmev_1:empty {
1268
+ ._DropZone_1i2sv_1:empty {
1271
1269
  min-height: var(--min-empty-height);
1272
1270
  }
1273
- ._DropZone_3dmev_1:not(._DropZone--userIsDragging_3dmev_19) {
1271
+ [data-puck-entry]:not([data-puck-dragging]) ._DropZone_1i2sv_1 {
1274
1272
  transition: min-height var(--resize-animation-ms) ease-in;
1275
1273
  }
1276
- ._DropZone--isAreaSelected_3dmev_23,
1277
- ._DropZone--hoveringOverArea_3dmev_24:not(._DropZone--isRootZone_3dmev_24) {
1274
+ ._DropZone--isAreaSelected_1i2sv_24,
1275
+ ._DropZone--hoveringOverArea_1i2sv_25:not(._DropZone--isRootZone_1i2sv_25) {
1278
1276
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
1279
1277
  outline: 2px dashed var(--puck-color-azure-08);
1280
1278
  }
1281
- ._DropZone_3dmev_1:empty {
1279
+ ._DropZone_1i2sv_1:empty {
1282
1280
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent);
1283
1281
  outline: 2px dashed var(--puck-color-azure-08);
1284
1282
  }
1285
- ._DropZone--isDestination_3dmev_34 {
1283
+ ._DropZone--isDestination_1i2sv_35 {
1286
1284
  outline: 2px dashed var(--puck-color-azure-04) !important;
1287
1285
  }
1288
- ._DropZone--isDestination_3dmev_34:not(._DropZone--isRootZone_3dmev_24) {
1286
+ ._DropZone--isDestination_1i2sv_35:not(._DropZone--isRootZone_1i2sv_25) {
1289
1287
  background: color-mix(in srgb, var(--puck-color-azure-09) 30%, transparent) !important;
1290
1288
  }
1291
- ._DropZone-item_3dmev_46 {
1289
+ ._DropZone-item_1i2sv_47 {
1292
1290
  position: relative;
1293
1291
  }
1294
- ._DropZone-hitbox_3dmev_50 {
1292
+ ._DropZone-hitbox_1i2sv_51 {
1295
1293
  position: absolute;
1296
1294
  bottom: -12px;
1297
1295
  height: 24px;
1298
1296
  width: 100%;
1299
1297
  z-index: 1;
1300
1298
  }
1301
- ._DropZone--isEnabled_3dmev_58._DropZone--userIsDragging_3dmev_19 {
1299
+ [data-puck-dragging] ._DropZone--isEnabled_1i2sv_59 {
1302
1300
  outline: 2px dashed var(--puck-color-azure-06);
1303
1301
  }
1304
- ._DropZone_3dmev_1 > *:not([data-puck-component]) {
1302
+ ._DropZone_1i2sv_1 > *:not([data-puck-component]) {
1305
1303
  opacity: 0;
1306
1304
  }
1307
- body:has(._DropZone--isAnimating_3dmev_67:empty) [data-puck-overlay] {
1305
+ body:has(._DropZone--isAnimating_1i2sv_68:empty) [data-puck-overlay] {
1308
1306
  opacity: 0 !important;
1309
1307
  }
1310
1308
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as RootData, m as Content, n as ItemSelector } from './resolve-all-data-BFRAghCj.mjs';
2
- export { X as Adaptor, Q as ArrayField, v as ArrayState, a7 as AsFieldProps, B as BaseData, G as BaseField, E as ComponentDataMap, _ as CustomField, a4 as DefaultComponentProps, a1 as DefaultRootFieldProps, a3 as DefaultRootProps, a2 as DefaultRootRenderProps, o as Direction, p as DragAxis, Z as ExternalField, Y as ExternalFieldWithAdaptor, a9 as ExtractPropsFromConfig, aa as ExtractRootPropsFromConfig, t as FieldRenderFunctions, u as ItemWithId, z as MappedItem, N as NumberField, W as ObjectField, s as OverrideKey, w as PuckComponent, a0 as PuckContext, L as RadioField, x as RootConfig, y as RootDataWithoutProps, K as SelectField, S as Slot, $ as SlotField, T as TextField, J as TextareaField, q as Viewport, a8 as WithChildren, a5 as WithId, a6 as WithPuckProps, r as overrideKeys, ac as resolveAllData, ab as transformProps } from './resolve-all-data-BFRAghCj.mjs';
1
+ import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-DOB5QZVq.mjs';
2
+ export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DOB5QZVq.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';
@@ -60,6 +60,7 @@ type FieldsSlice = {
60
60
  fields: Fields | Partial<Fields>;
61
61
  loading: boolean;
62
62
  lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
63
64
  };
64
65
 
65
66
  type Status = "LOADING" | "MOUNTED" | "READY";
@@ -246,20 +247,12 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
246
247
  metadata?: Metadata;
247
248
  }): react_jsx_runtime.JSX.Element;
248
249
 
249
- declare function migrate(data: Data, config?: Config): Data;
250
-
251
- type MapSlotOptions = {
252
- parentId: string;
253
- propName: string;
254
- };
255
- declare function mapSlotsPublic<T extends ComponentData | RootData>(item: T, config: Config, map: (data: Content, options: MapSlotOptions) => Content): T;
256
-
257
250
  type WithGet<T> = T & {
258
251
  get: () => T;
259
252
  };
260
253
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
261
254
  appState: AppState;
262
- config: Config;
255
+ config: UserConfig;
263
256
  dispatch: AppStore["dispatch"];
264
257
  getPermissions: GetPermissions<UserConfig>;
265
258
  refreshPermissions: RefreshPermissions<UserConfig>;
@@ -291,5 +284,11 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConf
291
284
  */
292
285
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
293
286
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
287
+ /**
288
+ * Get the latest state without relying on a render
289
+ *
290
+ * @returns PuckApi
291
+ */
292
+ declare function useGetPuck(): () => UsePuckStore<Config>;
294
293
 
295
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Content, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootData, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, mapSlotsPublic as mapSlots, migrate, renderContext, usePuck };
294
+ 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as RootData, m as Content, n as ItemSelector } from './resolve-all-data-BFRAghCj.js';
2
- export { X as Adaptor, Q as ArrayField, v as ArrayState, a7 as AsFieldProps, B as BaseData, G as BaseField, E as ComponentDataMap, _ as CustomField, a4 as DefaultComponentProps, a1 as DefaultRootFieldProps, a3 as DefaultRootProps, a2 as DefaultRootRenderProps, o as Direction, p as DragAxis, Z as ExternalField, Y as ExternalFieldWithAdaptor, a9 as ExtractPropsFromConfig, aa as ExtractRootPropsFromConfig, t as FieldRenderFunctions, u as ItemWithId, z as MappedItem, N as NumberField, W as ObjectField, s as OverrideKey, w as PuckComponent, a0 as PuckContext, L as RadioField, x as RootConfig, y as RootDataWithoutProps, K as SelectField, S as Slot, $ as SlotField, T as TextField, J as TextareaField, q as Viewport, a8 as WithChildren, a5 as WithId, a6 as WithPuckProps, r as overrideKeys, ac as resolveAllData, ab as transformProps } from './resolve-all-data-BFRAghCj.js';
1
+ import { H as History, P as Permissions, C as ComponentData, a 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 Field, h as FieldProps, D as DropZoneProps, i as Data, j as OnAction, k as InitialHistory, l as ItemSelector } from './walk-tree-DOB5QZVq.js';
2
+ export { _ as Adaptor, Y as ArrayField, t as ArrayState, ab as AsFieldProps, B as BaseData, K as BaseField, G as ComponentDataMap, z as ComponentDataOptionalId, J as Content, a2 as CustomField, a1 as CustomFieldRender, a8 as DefaultComponentProps, a5 as DefaultRootFieldProps, a7 as DefaultRootProps, a6 as DefaultRootRenderProps, m as Direction, n as DragAxis, a0 as ExternalField, $ as ExternalFieldWithAdaptor, ad as ExtractPropsFromConfig, ae as ExtractRootPropsFromConfig, r as FieldRenderFunctions, s as ItemWithId, E as MappedItem, N as NumberField, Z as ObjectField, q as OverrideKey, u as PuckComponent, a4 as PuckContext, X as RadioField, v as RootConfig, y as RootData, x as RootDataWithoutProps, Q as SelectField, S as Slot, a3 as SlotField, T as TextField, L as TextareaField, o as Viewport, ac as WithChildren, a9 as WithId, aa as WithPuckProps, W as WithSlotProps, af as migrate, p as overrideKeys, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DOB5QZVq.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';
@@ -60,6 +60,7 @@ type FieldsSlice = {
60
60
  fields: Fields | Partial<Fields>;
61
61
  loading: boolean;
62
62
  lastResolvedData: Partial<ComponentOrRootData>;
63
+ id: string | undefined;
63
64
  };
64
65
 
65
66
  type Status = "LOADING" | "MOUNTED" | "READY";
@@ -246,20 +247,12 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
246
247
  metadata?: Metadata;
247
248
  }): react_jsx_runtime.JSX.Element;
248
249
 
249
- declare function migrate(data: Data, config?: Config): Data;
250
-
251
- type MapSlotOptions = {
252
- parentId: string;
253
- propName: string;
254
- };
255
- declare function mapSlotsPublic<T extends ComponentData | RootData>(item: T, config: Config, map: (data: Content, options: MapSlotOptions) => Content): T;
256
-
257
250
  type WithGet<T> = T & {
258
251
  get: () => T;
259
252
  };
260
253
  type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
261
254
  appState: AppState;
262
- config: Config;
255
+ config: UserConfig;
263
256
  dispatch: AppStore["dispatch"];
264
257
  getPermissions: GetPermissions<UserConfig>;
265
258
  refreshPermissions: RefreshPermissions<UserConfig>;
@@ -291,5 +284,11 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConf
291
284
  */
292
285
  declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
293
286
  declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
287
+ /**
288
+ * Get the latest state without relying on a render
289
+ *
290
+ * @returns PuckApi
291
+ */
292
+ declare function useGetPuck(): () => UsePuckStore<Config>;
294
293
 
295
- export { Action, ActionBar, AppState, AutoField, Button, ComponentConfig, ComponentData, Config, Content, Data, Drawer, DropZone, Field, FieldLabel, FieldProps, Fields, Group, History, IconButton, IframeConfig, InitialHistory, Label, Metadata, OnAction, Overrides, Permissions, Plugin, Puck, PuckAction, type PuckApi, Render, ResolveDataTrigger, RootData, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, mapSlotsPublic as mapSlots, migrate, renderContext, usePuck };
294
+ 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, type PuckApi, Render, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck, renderContext, useGetPuck, usePuck };