@puckeditor/plugin-pages 0.8.0-canary.9c5fbcbb → 0.8.0-canary.a74e3a2e
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.js +14 -4
- package/dist/index.mjs +18 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -29856,6 +29856,17 @@ var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
|
29856
29856
|
var cx9 = getClassNameFactory2("Pages", styles_module_default7);
|
|
29857
29857
|
var cxPage = getClassNameFactory2("PagesPage", styles_module_default7);
|
|
29858
29858
|
var cxVersion = getClassNameFactory2("PagesVersion", styles_module_default7);
|
|
29859
|
+
function registerDynamicConfig(config2, data) {
|
|
29860
|
+
const dynamicConfig = data.root?.props?._dynamicConfig;
|
|
29861
|
+
if (!dynamicConfig?.components) return;
|
|
29862
|
+
for (const [name, def] of Object.entries(dynamicConfig.components)) {
|
|
29863
|
+
if (config2.components[name]) continue;
|
|
29864
|
+
config2.components[name] = {
|
|
29865
|
+
fields: { ...def.fields ?? {} },
|
|
29866
|
+
render: () => null
|
|
29867
|
+
};
|
|
29868
|
+
}
|
|
29869
|
+
}
|
|
29859
29870
|
var PagePlugin = (opts) => {
|
|
29860
29871
|
const getPuck = (0, import_core11.useGetPuck)();
|
|
29861
29872
|
const [confirmModalOpen, setConfirmModalOpen] = (0, import_react25.useState)(false);
|
|
@@ -29899,10 +29910,9 @@ var PagePlugin = (opts) => {
|
|
|
29899
29910
|
const getPageState = (0, import_react25.useCallback)(
|
|
29900
29911
|
async (data) => {
|
|
29901
29912
|
const { appState, config: config2 } = getPuck();
|
|
29902
|
-
const
|
|
29903
|
-
|
|
29904
|
-
|
|
29905
|
-
);
|
|
29913
|
+
const pageData = data && Object.keys(data).length > 0 ? data : appState.data;
|
|
29914
|
+
registerDynamicConfig(config2, pageData);
|
|
29915
|
+
const resolvedData = await (0, import_core11.resolveAllData)(pageData, config2);
|
|
29906
29916
|
const nextState = {
|
|
29907
29917
|
...appState,
|
|
29908
29918
|
data: resolvedData,
|
package/dist/index.mjs
CHANGED
|
@@ -13546,7 +13546,10 @@ var styles_module_default7 = { "Pages": "_Pages_ey49w_5", "Pages-addPage": "_Pag
|
|
|
13546
13546
|
|
|
13547
13547
|
// src/components/PagePlugin/index.tsx
|
|
13548
13548
|
import { useCallback as useCallback9, useEffect as useEffect29, useMemo as useMemo22, useRef as useRef22, useState as useState30 } from "react";
|
|
13549
|
-
import {
|
|
13549
|
+
import {
|
|
13550
|
+
resolveAllData as resolveAllData2,
|
|
13551
|
+
useGetPuck as useGetPuck2
|
|
13552
|
+
} from "@puckeditor/core";
|
|
13550
13553
|
|
|
13551
13554
|
// src/components/CreateForm/index.tsx
|
|
13552
13555
|
init_react_import();
|
|
@@ -29848,6 +29851,17 @@ import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
|
29848
29851
|
var cx9 = getClassNameFactory2("Pages", styles_module_default7);
|
|
29849
29852
|
var cxPage = getClassNameFactory2("PagesPage", styles_module_default7);
|
|
29850
29853
|
var cxVersion = getClassNameFactory2("PagesVersion", styles_module_default7);
|
|
29854
|
+
function registerDynamicConfig(config2, data) {
|
|
29855
|
+
const dynamicConfig = data.root?.props?._dynamicConfig;
|
|
29856
|
+
if (!dynamicConfig?.components) return;
|
|
29857
|
+
for (const [name, def] of Object.entries(dynamicConfig.components)) {
|
|
29858
|
+
if (config2.components[name]) continue;
|
|
29859
|
+
config2.components[name] = {
|
|
29860
|
+
fields: { ...def.fields ?? {} },
|
|
29861
|
+
render: () => null
|
|
29862
|
+
};
|
|
29863
|
+
}
|
|
29864
|
+
}
|
|
29851
29865
|
var PagePlugin = (opts) => {
|
|
29852
29866
|
const getPuck = useGetPuck2();
|
|
29853
29867
|
const [confirmModalOpen, setConfirmModalOpen] = useState30(false);
|
|
@@ -29891,10 +29905,9 @@ var PagePlugin = (opts) => {
|
|
|
29891
29905
|
const getPageState = useCallback9(
|
|
29892
29906
|
async (data) => {
|
|
29893
29907
|
const { appState, config: config2 } = getPuck();
|
|
29894
|
-
const
|
|
29895
|
-
|
|
29896
|
-
|
|
29897
|
-
);
|
|
29908
|
+
const pageData = data && Object.keys(data).length > 0 ? data : appState.data;
|
|
29909
|
+
registerDynamicConfig(config2, pageData);
|
|
29910
|
+
const resolvedData = await resolveAllData2(pageData, config2);
|
|
29898
29911
|
const nextState = {
|
|
29899
29912
|
...appState,
|
|
29900
29913
|
data: resolvedData,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puckeditor/plugin-pages",
|
|
3
|
-
"version": "0.8.0-canary.
|
|
3
|
+
"version": "0.8.0-canary.a74e3a2e",
|
|
4
4
|
"author": "Chris Villa <chris@puckeditor.com>",
|
|
5
5
|
"repository": "puckeditor/puck",
|
|
6
6
|
"bugs": "https://github.com/puckeditor/puck/issues",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"zustand": "^5.0.8"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@puckeditor/core": "0.22.0
|
|
34
|
+
"@puckeditor/core": "0.22.0",
|
|
35
35
|
"@puckeditor/platform-types": "workspace:*",
|
|
36
36
|
"@radix-ui/react-popover": "^1.1.15",
|
|
37
37
|
"@testing-library/dom": "^10.4.1",
|