@measured/puck 0.19.0-canary.896a6279 → 0.19.0-canary.8e1d7223
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/README.md +2 -4
- package/dist/chunk-HGAPIQP5.mjs +949 -0
- package/dist/index.css +187 -181
- package/dist/index.d.mts +21 -10
- package/dist/index.d.ts +21 -10
- package/dist/index.js +1722 -1464
- package/dist/index.mjs +6501 -1905
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +631 -3726
- package/dist/rsc.mjs +7 -103
- package/dist/{resolve-all-data-Cs8PfTrg.d.mts → walk-tree-DBd3aQ_5.d.mts} +68 -35
- package/dist/{resolve-all-data-Cs8PfTrg.d.ts → walk-tree-DBd3aQ_5.d.ts} +68 -35
- package/package.json +13 -8
- package/dist/chunk-LT6HN46T.mjs +0 -5350
- package/dist/rsc.css +0 -338
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { H as History,
|
2
|
-
export {
|
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-DBd3aQ_5.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-DBd3aQ_5.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';
|
@@ -22,6 +22,8 @@ type HistorySlice<D = any> = {
|
|
22
22
|
|
23
23
|
type NodeMethods = {
|
24
24
|
sync: () => void;
|
25
|
+
hideOverlay: () => void;
|
26
|
+
showOverlay: () => void;
|
25
27
|
};
|
26
28
|
type PuckNodeInstance = {
|
27
29
|
id: string;
|
@@ -60,6 +62,7 @@ type FieldsSlice = {
|
|
60
62
|
fields: Fields | Partial<Fields>;
|
61
63
|
loading: boolean;
|
62
64
|
lastResolvedData: Partial<ComponentOrRootData>;
|
65
|
+
id: string | undefined;
|
63
66
|
};
|
64
67
|
|
65
68
|
type Status = "LOADING" | "MOUNTED" | "READY";
|
@@ -226,9 +229,9 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
|
|
226
229
|
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
227
230
|
declare namespace Puck {
|
228
231
|
var Components: () => react_jsx_runtime.JSX.Element;
|
229
|
-
var Fields: ({ wrapFields }: {
|
232
|
+
var Fields: react.MemoExoticComponent<({ wrapFields }: {
|
230
233
|
wrapFields?: boolean;
|
231
|
-
}) => react_jsx_runtime.JSX.Element
|
234
|
+
}) => react_jsx_runtime.JSX.Element>;
|
232
235
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
233
236
|
var Preview: ({ id }: {
|
234
237
|
id?: string;
|
@@ -246,18 +249,19 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
246
249
|
metadata?: Metadata;
|
247
250
|
}): react_jsx_runtime.JSX.Element;
|
248
251
|
|
249
|
-
declare function migrate(data: Data): Data;
|
250
|
-
|
251
252
|
type WithGet<T> = T & {
|
252
253
|
get: () => T;
|
253
254
|
};
|
254
255
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
255
256
|
appState: AppState;
|
256
|
-
config:
|
257
|
+
config: UserConfig;
|
257
258
|
dispatch: AppStore["dispatch"];
|
258
259
|
getPermissions: GetPermissions<UserConfig>;
|
259
260
|
refreshPermissions: RefreshPermissions<UserConfig>;
|
260
261
|
selectedItem: G["UserComponentData"] | null;
|
262
|
+
getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
|
263
|
+
getItemById: (id: string) => ComponentData | undefined;
|
264
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
261
265
|
history: {
|
262
266
|
back: HistorySlice["back"];
|
263
267
|
forward: HistorySlice["forward"];
|
@@ -269,7 +273,8 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
269
273
|
hasFuture: boolean;
|
270
274
|
};
|
271
275
|
};
|
272
|
-
type
|
276
|
+
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
277
|
+
type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
|
273
278
|
/**
|
274
279
|
* createUsePuck
|
275
280
|
*
|
@@ -279,7 +284,13 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
|
|
279
284
|
*
|
280
285
|
* @returns a typed usePuck function
|
281
286
|
*/
|
282
|
-
declare function createUsePuck<UserConfig extends Config = Config>(): <T =
|
287
|
+
declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
|
283
288
|
declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
|
289
|
+
/**
|
290
|
+
* Get the latest state without relying on a render
|
291
|
+
*
|
292
|
+
* @returns PuckApi
|
293
|
+
*/
|
294
|
+
declare function useGetPuck(): () => UsePuckStore<Config>;
|
284
295
|
|
285
|
-
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, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck,
|
296
|
+
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,
|
2
|
-
export {
|
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-DBd3aQ_5.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-DBd3aQ_5.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';
|
@@ -22,6 +22,8 @@ type HistorySlice<D = any> = {
|
|
22
22
|
|
23
23
|
type NodeMethods = {
|
24
24
|
sync: () => void;
|
25
|
+
hideOverlay: () => void;
|
26
|
+
showOverlay: () => void;
|
25
27
|
};
|
26
28
|
type PuckNodeInstance = {
|
27
29
|
id: string;
|
@@ -60,6 +62,7 @@ type FieldsSlice = {
|
|
60
62
|
fields: Fields | Partial<Fields>;
|
61
63
|
loading: boolean;
|
62
64
|
lastResolvedData: Partial<ComponentOrRootData>;
|
65
|
+
id: string | undefined;
|
63
66
|
};
|
64
67
|
|
65
68
|
type Status = "LOADING" | "MOUNTED" | "READY";
|
@@ -226,9 +229,9 @@ type PuckProps<UserConfig extends Config = Config, G extends UserGenerics<UserCo
|
|
226
229
|
declare function Puck<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>(props: PuckProps<UserConfig>): react_jsx_runtime.JSX.Element;
|
227
230
|
declare namespace Puck {
|
228
231
|
var Components: () => react_jsx_runtime.JSX.Element;
|
229
|
-
var Fields: ({ wrapFields }: {
|
232
|
+
var Fields: react.MemoExoticComponent<({ wrapFields }: {
|
230
233
|
wrapFields?: boolean;
|
231
|
-
}) => react_jsx_runtime.JSX.Element
|
234
|
+
}) => react_jsx_runtime.JSX.Element>;
|
232
235
|
var Outline: () => react_jsx_runtime.JSX.Element;
|
233
236
|
var Preview: ({ id }: {
|
234
237
|
id?: string;
|
@@ -246,18 +249,19 @@ declare function Render<UserConfig extends Config = Config, G extends UserGeneri
|
|
246
249
|
metadata?: Metadata;
|
247
250
|
}): react_jsx_runtime.JSX.Element;
|
248
251
|
|
249
|
-
declare function migrate(data: Data): Data;
|
250
|
-
|
251
252
|
type WithGet<T> = T & {
|
252
253
|
get: () => T;
|
253
254
|
};
|
254
255
|
type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>> = {
|
255
256
|
appState: AppState;
|
256
|
-
config:
|
257
|
+
config: UserConfig;
|
257
258
|
dispatch: AppStore["dispatch"];
|
258
259
|
getPermissions: GetPermissions<UserConfig>;
|
259
260
|
refreshPermissions: RefreshPermissions<UserConfig>;
|
260
261
|
selectedItem: G["UserComponentData"] | null;
|
262
|
+
getItemBySelector: (selector: ItemSelector) => ComponentData | undefined;
|
263
|
+
getItemById: (id: string) => ComponentData | undefined;
|
264
|
+
getSelectorForId: (id: string) => Required<ItemSelector> | undefined;
|
261
265
|
history: {
|
262
266
|
back: HistorySlice["back"];
|
263
267
|
forward: HistorySlice["forward"];
|
@@ -269,7 +273,8 @@ type UsePuckData<UserConfig extends Config = Config, G extends UserGenerics<User
|
|
269
273
|
hasFuture: boolean;
|
270
274
|
};
|
271
275
|
};
|
272
|
-
type
|
276
|
+
type PuckApi<UserConfig extends Config = Config> = UsePuckData<UserConfig>;
|
277
|
+
type UsePuckStore<UserConfig extends Config = Config> = WithGet<PuckApi<UserConfig>>;
|
273
278
|
/**
|
274
279
|
* createUsePuck
|
275
280
|
*
|
@@ -279,7 +284,13 @@ type UsePuckStore<UserConfig extends Config = Config> = WithGet<UsePuckData<User
|
|
279
284
|
*
|
280
285
|
* @returns a typed usePuck function
|
281
286
|
*/
|
282
|
-
declare function createUsePuck<UserConfig extends Config = Config>(): <T =
|
287
|
+
declare function createUsePuck<UserConfig extends Config = Config>(): <T = PuckApi<UserConfig>>(selector: (state: UsePuckStore<UserConfig>) => T) => T;
|
283
288
|
declare function usePuck<UserConfig extends Config = Config>(): UsePuckStore<UserConfig>;
|
289
|
+
/**
|
290
|
+
* Get the latest state without relying on a render
|
291
|
+
*
|
292
|
+
* @returns PuckApi
|
293
|
+
*/
|
294
|
+
declare function useGetPuck(): () => UsePuckStore<Config>;
|
284
295
|
|
285
|
-
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, ResolveDataTrigger, RootDataWithProps, UiState, type UsePuckData, UserGenerics, Viewports, createUsePuck,
|
296
|
+
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 };
|