@bettercms-ai/next 0.36.3 → 0.38.0
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 +46 -0
- package/dist/bettercms-snapshot.js +23 -13
- package/dist/bettercms-snapshot.js.map +1 -1
- package/dist/config.cjs +68 -0
- package/dist/config.cjs.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +33 -15
- package/dist/index.js +163 -61
- package/dist/index.js.map +1 -1
- package/dist/page-context.d.ts +14 -0
- package/dist/page-context.js +16 -0
- package/dist/page-context.js.map +1 -0
- package/package.json +15 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type PageSnapshot = Record<string, unknown> & {
|
|
5
|
+
slug?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
declare function BcmsPage({ value, children }: {
|
|
9
|
+
value: PageSnapshot;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}): react.FunctionComponentElement<react.ProviderProps<PageSnapshot>>;
|
|
12
|
+
declare function useBcmsPage<T extends PageSnapshot = PageSnapshot>(): T;
|
|
13
|
+
|
|
14
|
+
export { BcmsPage, useBcmsPage };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/page-context.tsx
|
|
4
|
+
import { createContext, createElement, useContext } from "react";
|
|
5
|
+
var PageContext = createContext({});
|
|
6
|
+
function BcmsPage({ value, children }) {
|
|
7
|
+
return createElement(PageContext.Provider, { value }, children);
|
|
8
|
+
}
|
|
9
|
+
function useBcmsPage() {
|
|
10
|
+
return useContext(PageContext);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
BcmsPage,
|
|
14
|
+
useBcmsPage
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=page-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/page-context.tsx"],"sourcesContent":["/**\n * <BcmsPage value> + useBcmsPage(): the page's values (what `bcmsPage()` returned on the server) handed\n * to its client components. The same object renders on the server and hydrates in the browser, so the\n * markup matches and a publish shows in both — a client file that imported `bcms-content/<slug>.json`\n * itself would hydrate the build's copy over the published one.\n *\n * import { useBcmsPage } from \"@bettercms-ai/next/page\";\n * const page = useBcmsPage();\n *\n * Outside a <BcmsPage>, `{}`: every value falls back to the copy in the code.\n */\nimport { createContext, createElement, useContext, type ReactNode } from \"react\";\nimport type { PageSnapshot } from \"./page-content.js\";\n\nconst PageContext = createContext<PageSnapshot>({});\n\nexport function BcmsPage({ value, children }: { value: PageSnapshot; children?: ReactNode }) {\n return createElement(PageContext.Provider, { value }, children);\n}\n\nexport function useBcmsPage<T extends PageSnapshot = PageSnapshot>(): T {\n return useContext(PageContext) as T;\n}\n"],"mappings":";;;AAWA,SAAS,eAAe,eAAe,kBAAkC;AAGzE,IAAM,cAAc,cAA4B,CAAC,CAAC;AAE3C,SAAS,SAAS,EAAE,OAAO,SAAS,GAAkD;AAC3F,SAAO,cAAc,YAAY,UAAU,EAAE,MAAM,GAAG,QAAQ;AAChE;AAEO,SAAS,cAAwD;AACtE,SAAO,WAAW,WAAW;AAC/B;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bettercms-ai/next",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The BetterCMS adapter for Next.js — typed, cache-aware content reads (getEntry/listEntries), draft preview, build-time content snapshot, and llms.txt generation for the App Router. The /blocks, /form, /field, /search and /visual-editing entries are framework-free React and work in any React app (see the React+TS starter), which is why `next` is an OPTIONAL peer.",
|
|
6
6
|
"bin": {
|
|
@@ -55,6 +55,17 @@
|
|
|
55
55
|
"types": "./dist/elements.d.ts",
|
|
56
56
|
"import": "./dist/elements.js",
|
|
57
57
|
"default": "./dist/elements.js"
|
|
58
|
+
},
|
|
59
|
+
"./page": {
|
|
60
|
+
"types": "./dist/page-context.d.ts",
|
|
61
|
+
"import": "./dist/page-context.js",
|
|
62
|
+
"default": "./dist/page-context.js"
|
|
63
|
+
},
|
|
64
|
+
"./config": {
|
|
65
|
+
"types": "./dist/config.d.ts",
|
|
66
|
+
"import": "./dist/config.js",
|
|
67
|
+
"require": "./dist/config.cjs",
|
|
68
|
+
"default": "./dist/config.js"
|
|
58
69
|
}
|
|
59
70
|
},
|
|
60
71
|
"files": [
|
|
@@ -70,10 +81,10 @@
|
|
|
70
81
|
"dependencies": {
|
|
71
82
|
"@bettercms-ai/icons": "^0.4.0",
|
|
72
83
|
"@bettercms-ai/image-url": "^0.4.0",
|
|
73
|
-
"@bettercms-ai/richtext": "^0.
|
|
74
|
-
"@bettercms-ai/sdk": "^1.
|
|
84
|
+
"@bettercms-ai/richtext": "^0.19.0",
|
|
85
|
+
"@bettercms-ai/sdk": "^1.42.0",
|
|
75
86
|
"@bettercms-ai/types": "^1.60.0",
|
|
76
|
-
"@bettercms-ai/ui": "^0.
|
|
87
|
+
"@bettercms-ai/ui": "^0.27.0",
|
|
77
88
|
"react-phone-number-input": "^3.4.18"
|
|
78
89
|
},
|
|
79
90
|
"peerDependencies": {
|