@measured/puck 0.19.1-canary.c0055df8 → 0.19.1
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/{chunk-H4SMAS54.mjs → chunk-IM42S4YL.mjs} +253 -249
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +947 -925
- package/dist/index.mjs +21 -3
- package/dist/rsc.d.mts +2 -2
- package/dist/rsc.d.ts +2 -2
- package/dist/rsc.js +5 -4
- package/dist/rsc.mjs +1 -5
- package/dist/{walk-tree-DBd3aQ_5.d.mts → walk-tree-DrJNb8b-.d.mts} +2 -1
- package/dist/{walk-tree-DBd3aQ_5.d.ts → walk-tree-DrJNb8b-.d.ts} +2 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -25,7 +25,7 @@ import {
|
|
25
25
|
walkAppState,
|
26
26
|
walkField,
|
27
27
|
walkTree
|
28
|
-
} from "./chunk-
|
28
|
+
} from "./chunk-IM42S4YL.mjs";
|
29
29
|
|
30
30
|
// ../../node_modules/classnames/index.js
|
31
31
|
var require_classnames = __commonJS({
|
@@ -813,9 +813,27 @@ var replaceAction = (state, action, appStore) => {
|
|
813
813
|
`Can't change the id during a replace action. Please us "remove" and "insert" to define a new node.`
|
814
814
|
);
|
815
815
|
}
|
816
|
-
const
|
816
|
+
const newSlotIds = [];
|
817
|
+
const data = walkTree(action.data, appStore.config, (contents, opts) => {
|
818
|
+
newSlotIds.push(`${opts.parentId}:${opts.propName}`);
|
819
|
+
return contents.map((item) => {
|
820
|
+
const id = generateId(item.type);
|
821
|
+
return __spreadProps(__spreadValues({}, item), {
|
822
|
+
props: __spreadValues({ id }, item.props)
|
823
|
+
});
|
824
|
+
});
|
825
|
+
});
|
826
|
+
const stateWithDeepSlotsRemoved = __spreadValues({}, state);
|
827
|
+
Object.keys(state.indexes.zones).forEach((zoneCompound) => {
|
828
|
+
const id = zoneCompound.split(":")[0];
|
829
|
+
if (id === originalId) {
|
830
|
+
if (!newSlotIds.includes(zoneCompound)) {
|
831
|
+
delete stateWithDeepSlotsRemoved.indexes.zones[zoneCompound];
|
832
|
+
}
|
833
|
+
}
|
834
|
+
});
|
817
835
|
return walkAppState(
|
818
|
-
|
836
|
+
stateWithDeepSlotsRemoved,
|
819
837
|
appStore.config,
|
820
838
|
(content, zoneCompound) => {
|
821
839
|
const newContent = [...content];
|
package/dist/rsc.d.mts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-DrJNb8b-.mjs';
|
3
|
+
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DrJNb8b-.mjs';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
2
|
-
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-
|
3
|
-
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-
|
2
|
+
import { a as Config, U as UserGenerics, M as Metadata } from './walk-tree-DrJNb8b-.js';
|
3
|
+
export { af as migrate, ah as resolveAllData, ag as transformProps, w as walkTree } from './walk-tree-DrJNb8b-.js';
|
4
4
|
import 'react';
|
5
5
|
|
6
6
|
declare function Render<UserConfig extends Config = Config, G extends UserGenerics<UserConfig> = UserGenerics<UserConfig>>({ config, data, metadata, }: {
|
package/dist/rsc.js
CHANGED
@@ -659,7 +659,7 @@ function forRelatedZones(item, data, cb, path = []) {
|
|
659
659
|
}
|
660
660
|
|
661
661
|
// lib/data/flatten-node.ts
|
662
|
-
var import_flat = require("flat");
|
662
|
+
var import_flat = __toESM(require("flat"));
|
663
663
|
|
664
664
|
// lib/data/strip-slots.ts
|
665
665
|
var stripSlots = (data, config) => {
|
@@ -667,9 +667,10 @@ var stripSlots = (data, config) => {
|
|
667
667
|
};
|
668
668
|
|
669
669
|
// lib/data/flatten-node.ts
|
670
|
+
var { flatten: flatten2, unflatten } = import_flat.default;
|
670
671
|
var flattenNode = (node, config) => {
|
671
672
|
return __spreadProps(__spreadValues({}, node), {
|
672
|
-
props: (
|
673
|
+
props: flatten2(stripSlots(node, config).props)
|
673
674
|
});
|
674
675
|
};
|
675
676
|
|
@@ -824,7 +825,7 @@ var migrations = [
|
|
824
825
|
const { indexes } = walkAppState(appState, config);
|
825
826
|
const deletedCompounds = [];
|
826
827
|
walkAppState(appState, config, (content, zoneCompound, zoneType) => {
|
827
|
-
var _a2, _b;
|
828
|
+
var _a2, _b, _c;
|
828
829
|
if (zoneType === "dropzone") {
|
829
830
|
const [id, slotName] = zoneCompound.split(":");
|
830
831
|
const nodeData = indexes.nodes[id].data;
|
@@ -832,7 +833,7 @@ var migrations = [
|
|
832
833
|
const configForComponent = id === "root" ? config.root : config.components[componentType];
|
833
834
|
if (((_b = (_a2 = configForComponent == null ? void 0 : configForComponent.fields) == null ? void 0 : _a2[slotName]) == null ? void 0 : _b.type) === "slot") {
|
834
835
|
updatedItems[id] = __spreadProps(__spreadValues({}, nodeData), {
|
835
|
-
props: __spreadProps(__spreadValues({}, nodeData.props), {
|
836
|
+
props: __spreadProps(__spreadValues(__spreadValues({}, nodeData.props), (_c = updatedItems[id]) == null ? void 0 : _c.props), {
|
836
837
|
[slotName]: content
|
837
838
|
})
|
838
839
|
});
|
package/dist/rsc.mjs
CHANGED
@@ -346,10 +346,11 @@ type PrivateAppState<UserData extends Data = Data> = AppState<UserData> & {
|
|
346
346
|
};
|
347
347
|
};
|
348
348
|
type DefaultAllProps = Record<string, DefaultComponentProps>;
|
349
|
+
type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined;
|
349
350
|
/**
|
350
351
|
* Recursively walk T and replace Slots with SlotComponents
|
351
352
|
*/
|
352
|
-
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends object ? {
|
353
|
+
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
353
354
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
354
355
|
} : T;
|
355
356
|
|
@@ -346,10 +346,11 @@ type PrivateAppState<UserData extends Data = Data> = AppState<UserData> & {
|
|
346
346
|
};
|
347
347
|
};
|
348
348
|
type DefaultAllProps = Record<string, DefaultComponentProps>;
|
349
|
+
type BuiltinTypes = Date | RegExp | Error | Function | symbol | null | undefined;
|
349
350
|
/**
|
350
351
|
* Recursively walk T and replace Slots with SlotComponents
|
351
352
|
*/
|
352
|
-
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends object ? {
|
353
|
+
type WithDeepSlots<T, SlotType = T> = T extends Slot ? SlotType : T extends (infer U)[] ? Array<WithDeepSlots<U, SlotType>> : T extends (infer U)[] ? WithDeepSlots<U, SlotType>[] : T extends BuiltinTypes ? T : T extends object ? {
|
353
354
|
[K in keyof T]: WithDeepSlots<T[K], SlotType>;
|
354
355
|
} : T;
|
355
356
|
|