@measured/puck 0.14.0-canary.1c4c076 → 0.14.0-canary.2c15323
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.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-
|
2
|
-
export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-
|
1
|
+
import { C as Config, D as Data, I as ItemSelector, U as UiState, A as AppState, F as Field, a as DefaultComponentProps, b as DefaultRootProps, M as MappedItem, R as RootDataWithProps, c as RootData } from './Config-0bf39037.js';
|
2
|
+
export { g as Adaptor, f as ArrayField, r as ArrayState, n as BaseData, B as BaseField, m as ComponentConfig, o as ComponentData, k as Content, i as CustomField, s as DropZone, h as ExternalField, E as ExternalFieldWithAdaptor, j as Fields, q as ItemWithId, N as NumberField, O as ObjectField, P as PuckComponent, l as PuckContext, e as RadioField, p as RootDataWithoutProps, S as SelectField, T as TextField, d as TextareaField } from './Config-0bf39037.js';
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
4
4
|
import * as react from 'react';
|
5
5
|
import { ReactNode, CSSProperties, ReactElement, SyntheticEvent } from 'react';
|
@@ -275,10 +275,34 @@ declare const resolveAllData: (data: Data, config: Config<any, any, any>, onReso
|
|
275
275
|
zones: Record<string, MappedItem[]>;
|
276
276
|
}>;
|
277
277
|
|
278
|
+
type History<D = any> = {
|
279
|
+
id: string;
|
280
|
+
data: D;
|
281
|
+
};
|
282
|
+
type HistoryStore<D = any> = {
|
283
|
+
index: number;
|
284
|
+
currentHistory: History;
|
285
|
+
hasPast: boolean;
|
286
|
+
hasFuture: boolean;
|
287
|
+
record: (data: D) => void;
|
288
|
+
back: VoidFunction;
|
289
|
+
forward: VoidFunction;
|
290
|
+
nextHistory: History<D> | null;
|
291
|
+
prevHistory: History<D> | null;
|
292
|
+
histories: History<D>[];
|
293
|
+
};
|
294
|
+
|
295
|
+
type PuckHistory = {
|
296
|
+
back: VoidFunction;
|
297
|
+
forward: VoidFunction;
|
298
|
+
historyStore: HistoryStore;
|
299
|
+
};
|
300
|
+
|
278
301
|
declare const usePuck: () => {
|
279
302
|
appState: AppState;
|
280
303
|
config: Config<any, any, any>;
|
281
304
|
dispatch: (action: PuckAction) => void;
|
305
|
+
history: Partial<PuckHistory>;
|
282
306
|
};
|
283
307
|
|
284
308
|
export { AppState, Button, Config, Data, DefaultComponentProps, DefaultRootProps, Drawer, DropZoneProvider, Field, FieldLabel, IconButton, MappedItem, Puck, PuckAction, Render, RootData, RootDataWithProps, UiState, dropZoneContext, migrate, resolveAllData, transformProps, usePuck };
|
package/dist/index.js
CHANGED
@@ -31011,7 +31011,10 @@ var useResolvedData = (appState, config, dispatch) => {
|
|
31011
31011
|
);
|
31012
31012
|
const runResolvers = () => __async(void 0, null, function* () {
|
31013
31013
|
const newData = newAppState.data;
|
31014
|
-
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) =>
|
31014
|
+
const flatContent = Object.keys(newData.zones || {}).reduce((acc, zone) => [...acc, ...newData.zones[zone]], newData.content).filter((item) => {
|
31015
|
+
var _a;
|
31016
|
+
return !!((_a = config.components[item.type]) == null ? void 0 : _a.resolveData);
|
31017
|
+
});
|
31015
31018
|
const applyIfChange = (dynamicDataMap, dynamicRoot) => {
|
31016
31019
|
const processed = applyDynamicProps(
|
31017
31020
|
appState.data,
|
@@ -31343,6 +31346,7 @@ var ArrayField = ({
|
|
31343
31346
|
!readOnly && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("actions"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: getClassNameItem2("action"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
31344
31347
|
IconButton,
|
31345
31348
|
{
|
31349
|
+
disabled: field.min !== void 0 && field.min >= localState.arrayState.items.length,
|
31346
31350
|
onClick: (e) => {
|
31347
31351
|
e.stopPropagation();
|
31348
31352
|
const existingValue = [
|
@@ -31407,6 +31411,7 @@ var ArrayField = ({
|
|
31407
31411
|
"button",
|
31408
31412
|
{
|
31409
31413
|
className: getClassName10("addButton"),
|
31414
|
+
disabled: field.max !== void 0 && localState.arrayState.items.length >= field.max,
|
31410
31415
|
onClick: () => {
|
31411
31416
|
const existingValue = value || [];
|
31412
31417
|
const newValue = [
|
@@ -31416,7 +31421,7 @@ var ArrayField = ({
|
|
31416
31421
|
const newArrayState = regenerateArrayState(newValue);
|
31417
31422
|
onChange(newValue, mapArrayStateToUi(newArrayState));
|
31418
31423
|
},
|
31419
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size:
|
31424
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Plus, { size: 21 })
|
31420
31425
|
}
|
31421
31426
|
)
|
31422
31427
|
]
|
@@ -33225,8 +33230,8 @@ var resolveAllData = (data, config, onResolveStart, onResolveEnd) => __async(voi
|
|
33225
33230
|
// lib/use-puck.ts
|
33226
33231
|
init_react_import();
|
33227
33232
|
var usePuck = () => {
|
33228
|
-
const { state: appState, config, dispatch } = useAppContext();
|
33229
|
-
return { appState, config, dispatch };
|
33233
|
+
const { state: appState, config, history, dispatch } = useAppContext();
|
33234
|
+
return { appState, config, dispatch, history };
|
33230
33235
|
};
|
33231
33236
|
// Annotate the CommonJS export names for ESM import in node:
|
33232
33237
|
0 && (module.exports = {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { C as Config, D as Data } from './Config-
|
2
|
+
import { C as Config, D as Data } from './Config-0bf39037.js';
|
3
3
|
import 'react';
|
4
4
|
|
5
5
|
declare function Render<UserConfig extends Config<any, any, any> = Config<any, any, any>>({ config, data }: {
|
package/package.json
CHANGED