@vedyua/cms 0.1.0 → 0.1.2

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 CHANGED
@@ -7,17 +7,9 @@ Universal inline editor for static JSON content.
7
7
  - Save drafts to JSON files
8
8
  - Publish via pluggable adapters (safe background rebuild)
9
9
 
10
- > npm allows **private** packages only with a scope (`@vedy/...`). Unscoped names cannot use `--access restricted`.
11
-
12
- ## Install (private npm)
13
-
14
- Create the `@vedy` org on npm (once), then:
10
+ ## Install
15
11
 
16
12
  ```bash
17
- # .npmrc
18
- @vedyua:registry=https://registry.npmjs.org/
19
- //registry.npmjs.org/:_authToken=${NPM_TOKEN}
20
-
21
13
  npm i @vedyua/cms
22
14
  ```
23
15
 
@@ -30,13 +22,29 @@ npm i @vedyua/cms
30
22
  | `@vedyua/cms/next` | `createContentApi` for App Router |
31
23
  | `@vedyua/cms/styles.css` | Admin UI styles |
32
24
 
25
+ ## Develop
26
+
27
+ ```bash
28
+ npm install
29
+ npm run build
30
+ npm run dev
31
+ ```
32
+
33
+ ### Playground (single-page preview)
34
+
35
+ Run a local Vite page that imports `src/` directly (HMR) and mocks save/publish APIs:
36
+
37
+ ```bash
38
+ npm run playground
39
+ ```
40
+
41
+ Open http://localhost:5173 — toggle edit mode, click outlined text, try **Save draft** / **Publish** / **Page settings**.
42
+
33
43
  ## Publish (maintainers)
34
44
 
35
45
  ```bash
36
46
  npm login
37
- # once: create org https://www.npmjs.com/org/create → @vedyua
38
- cd packages/vedy-cms
39
- npm publish --access restricted
47
+ npm publish --access public
40
48
  ```
41
49
 
42
50
  ## Minimal wiring
@@ -48,21 +56,11 @@ import { commandPublish, passwordAuth } from "@vedyua/cms/server";
48
56
  export const api = createContentApi({
49
57
  config,
50
58
  sessionSecret: process.env.CONTENT_CMS_SESSION_SECRET!,
51
- publicOrigin: "https://example.com",
52
59
  auth: passwordAuth({
53
- users: [{ username: "admin", password: process.env.CONTENT_CMS_PASSWORD! }],
60
+ password: process.env.CONTENT_CMS_PASSWORD!,
54
61
  }),
55
62
  publish: commandPublish({
56
- cwd: process.cwd(),
57
- command: "npm run build",
58
- detached: true,
63
+ command: process.env.CONTENT_CMS_PUBLISH_COMMAND!,
59
64
  }),
60
65
  });
61
66
  ```
62
-
63
- ## Edit flow
64
-
65
- 1. `/admin` → sign in with username/password
66
- 2. Open the site for editing
67
- 3. Click highlighted text → **Save draft**
68
- 4. **Publish** → rebuild the live site
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
3
  type AdminBarProps = {
4
4
  /** Optional brand label shown on the left. */
@@ -7,6 +7,6 @@ type AdminBarProps = {
7
7
  /**
8
8
  * Floating toolbar for edit mode. Hides itself when `editMode` is false.
9
9
  */
10
- declare function AdminBar({ title }: AdminBarProps): react_jsx_runtime.JSX.Element | null;
10
+ declare function AdminBar({ title }: AdminBarProps): react.JSX.Element | null;
11
11
 
12
12
  export { AdminBar, type AdminBarProps };
package/dist/admin-bar.js CHANGED
@@ -2,26 +2,23 @@
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { useContentCms } from "./context";
5
- import { getDocument, listTextFields } from "./define";
5
+ import { getDocument } from "./define";
6
6
  import { PageSettingsPanel } from "./page-settings";
7
7
  function AdminBar({ title = "Content CMS" }) {
8
8
  const {
9
9
  config,
10
10
  editMode,
11
- session,
12
11
  publishEnabled,
13
12
  dirtyCount,
14
13
  saving,
15
14
  publishing,
16
15
  lastError,
17
- lastPublishSha,
18
16
  saveDrafts,
19
17
  publish,
20
18
  discardDrafts
21
19
  } = useContentCms();
22
20
  const [pageSettingsOpen, setPageSettingsOpen] = useState(false);
23
21
  if (!editMode) return null;
24
- const fields = listTextFields(config);
25
22
  const busy = saving || publishing;
26
23
  const logoutPath = config.logoutPath ?? "/api/content/auth/logout";
27
24
  const seoDocumentName = config.seoDocument ?? "seo";
@@ -30,13 +27,10 @@ function AdminBar({ title = "Content CMS" }) {
30
27
  /* @__PURE__ */ jsxs("div", { className: "scms-admin-bar__main", children: [
31
28
  /* @__PURE__ */ jsxs("div", { className: "scms-admin-bar__brand", children: [
32
29
  /* @__PURE__ */ jsx("strong", { children: title }),
33
- /* @__PURE__ */ jsxs("span", { className: "scms-admin-bar__meta", children: [
34
- session ? `${session.name} \xB7 ` : "",
35
- fields.length,
36
- " text fields \xB7 ",
37
- dirtyCount > 0 ? `${dirtyCount} unsaved` : "clean",
38
- lastPublishSha ? ` \xB7 published ${lastPublishSha.slice(0, 7)}` : ""
39
- ] })
30
+ dirtyCount > 0 ? /* @__PURE__ */ jsxs("span", { className: "scms-admin-bar__meta", children: [
31
+ dirtyCount,
32
+ " unsaved"
33
+ ] }) : null
40
34
  ] }),
41
35
  /* @__PURE__ */ jsxs("div", { className: "scms-admin-bar__actions", children: [
42
36
  hasPageSettings ? /* @__PURE__ */ jsx(
@@ -45,7 +39,6 @@ function AdminBar({ title = "Content CMS" }) {
45
39
  type: "button",
46
40
  className: `scms-btn ${pageSettingsOpen ? "scms-btn--primary" : "scms-btn--ghost"}`,
47
41
  onClick: () => setPageSettingsOpen((open) => !open),
48
- title: "Edit title, description, favicon and SEO for pages",
49
42
  children: "Page settings"
50
43
  }
51
44
  ) : null,
@@ -76,7 +69,7 @@ function AdminBar({ title = "Content CMS" }) {
76
69
  className: "scms-btn scms-btn--primary",
77
70
  disabled: !publishEnabled || busy,
78
71
  onClick: () => void publish(),
79
- title: !publishEnabled ? "Publish adapter is not configured" : publishing ? "Rebuild already in progress" : "Save drafts, then rebuild the site safely in the background",
72
+ title: !publishEnabled ? "Publish adapter is not configured" : void 0,
80
73
  children: publishing ? "Building\u2026" : "Publish"
81
74
  }
82
75
  ),
@@ -84,8 +77,7 @@ function AdminBar({ title = "Content CMS" }) {
84
77
  ] })
85
78
  ] }),
86
79
  pageSettingsOpen ? /* @__PURE__ */ jsx(PageSettingsPanel, { open: pageSettingsOpen, onClose: () => setPageSettingsOpen(false) }) : null,
87
- lastError ? /* @__PURE__ */ jsx("p", { className: "scms-admin-bar__error", children: lastError }) : null,
88
- /* @__PURE__ */ jsx("p", { className: "scms-admin-bar__hint", children: "Save writes JSON on disk. Publish rebuilds the site in the background \u2014 the live site stays up until the new build is ready; a failed build rolls back." })
80
+ lastError ? /* @__PURE__ */ jsx("p", { className: "scms-admin-bar__error", children: lastError }) : null
89
81
  ] });
90
82
  }
91
83
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/admin-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\n\nimport { useContentCms } from \"./context\";\nimport { getDocument, listTextFields } from \"./define\";\nimport { PageSettingsPanel } from \"./page-settings\";\n\nexport type AdminBarProps = {\n /** Optional brand label shown on the left. */\n title?: string;\n};\n\n/**\n * Floating toolbar for edit mode. Hides itself when `editMode` is false.\n */\nexport function AdminBar({ title = \"Content CMS\" }: AdminBarProps) {\n const {\n config,\n editMode,\n session,\n publishEnabled,\n dirtyCount,\n saving,\n publishing,\n lastError,\n lastPublishSha,\n saveDrafts,\n publish,\n discardDrafts,\n } = useContentCms();\n const [pageSettingsOpen, setPageSettingsOpen] = useState(false);\n\n if (!editMode) return null;\n\n const fields = listTextFields(config);\n const busy = saving || publishing;\n const logoutPath = config.logoutPath ?? \"/api/content/auth/logout\";\n const seoDocumentName = config.seoDocument ?? \"seo\";\n const hasPageSettings =\n Boolean(getDocument(config, seoDocumentName)) && (config.pages?.length ?? 0) > 0;\n\n return (\n <div className=\"scms-admin-bar\" role=\"region\" aria-label=\"Content editor toolbar\">\n <div className=\"scms-admin-bar__main\">\n <div className=\"scms-admin-bar__brand\">\n <strong>{title}</strong>\n <span className=\"scms-admin-bar__meta\">\n {session ? `${session.name} · ` : \"\"}\n {fields.length} text fields · {dirtyCount > 0 ? `${dirtyCount} unsaved` : \"clean\"}\n {lastPublishSha ? ` · published ${lastPublishSha.slice(0, 7)}` : \"\"}\n </span>\n </div>\n <div className=\"scms-admin-bar__actions\">\n {hasPageSettings ? (\n <button\n type=\"button\"\n className={`scms-btn ${pageSettingsOpen ? \"scms-btn--primary\" : \"scms-btn--ghost\"}`}\n onClick={() => setPageSettingsOpen((open) => !open)}\n title=\"Edit title, description, favicon and SEO for pages\"\n >\n Page settings\n </button>\n ) : null}\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--ghost\"\n disabled={dirtyCount === 0 || busy}\n onClick={() => discardDrafts()}\n >\n Discard\n </button>\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--ghost\"\n disabled={dirtyCount === 0 || busy}\n onClick={() => void saveDrafts()}\n >\n {saving ? \"Saving…\" : \"Save draft\"}\n </button>\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--primary\"\n disabled={!publishEnabled || busy}\n onClick={() => void publish()}\n title={\n !publishEnabled\n ? \"Publish adapter is not configured\"\n : publishing\n ? \"Rebuild already in progress\"\n : \"Save drafts, then rebuild the site safely in the background\"\n }\n >\n {publishing ? \"Building…\" : \"Publish\"}\n </button>\n <a className=\"scms-btn scms-btn--ghost\" href={logoutPath}>\n Log out\n </a>\n </div>\n </div>\n {pageSettingsOpen ? (\n <PageSettingsPanel open={pageSettingsOpen} onClose={() => setPageSettingsOpen(false)} />\n ) : null}\n {lastError ? <p className=\"scms-admin-bar__error\">{lastError}</p> : null}\n <p className=\"scms-admin-bar__hint\">\n Save writes JSON on disk. Publish rebuilds the site in the background — the live site stays\n up until the new build is ready; a failed build rolls back.\n </p>\n </div>\n );\n}\n"],"mappings":";AA8CU,cACA,YADA;AA5CV,SAAS,gBAAgB;AAEzB,SAAS,qBAAqB;AAC9B,SAAS,aAAa,sBAAsB;AAC5C,SAAS,yBAAyB;AAU3B,SAAS,SAAS,EAAE,QAAQ,cAAc,GAAkB;AACjE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA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,KAAK,WAAW;AAAA,YAE9B,mBAAS,iBAAY;AAAA;AAAA,QACxB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAU;AAAA,YACV,UAAU,CAAC,kBAAkB;AAAA,YAC7B,SAAS,MAAM,KAAK,QAAQ;AAAA,YAC5B,OACE,CAAC,iBACG,sCACA,aACE,gCACA;AAAA,YAGP,uBAAa,mBAAc;AAAA;AAAA,QAC9B;AAAA,QACA,oBAAC,OAAE,WAAU,4BAA2B,MAAM,YAAY,qBAE1D;AAAA,SACF;AAAA,OACF;AAAA,IACC,mBACC,oBAAC,qBAAkB,MAAM,kBAAkB,SAAS,MAAM,oBAAoB,KAAK,GAAG,IACpF;AAAA,IACH,YAAY,oBAAC,OAAE,WAAU,yBAAyB,qBAAU,IAAO;AAAA,IACpE,oBAAC,OAAE,WAAU,wBAAuB,0KAGpC;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/admin-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\n\nimport { useContentCms } from \"./context\";\nimport { getDocument } from \"./define\";\nimport { PageSettingsPanel } from \"./page-settings\";\n\nexport type AdminBarProps = {\n /** Optional brand label shown on the left. */\n title?: string;\n};\n\n/**\n * Floating toolbar for edit mode. Hides itself when `editMode` is false.\n */\nexport function AdminBar({ title = \"Content CMS\" }: AdminBarProps) {\n const {\n config,\n editMode,\n publishEnabled,\n dirtyCount,\n saving,\n publishing,\n lastError,\n saveDrafts,\n publish,\n discardDrafts,\n } = useContentCms();\n const [pageSettingsOpen, setPageSettingsOpen] = useState(false);\n\n if (!editMode) return null;\n\n const busy = saving || publishing;\n const logoutPath = config.logoutPath ?? \"/api/content/auth/logout\";\n const seoDocumentName = config.seoDocument ?? \"seo\";\n const hasPageSettings =\n Boolean(getDocument(config, seoDocumentName)) && (config.pages?.length ?? 0) > 0;\n\n return (\n <div className=\"scms-admin-bar\" role=\"region\" aria-label=\"Content editor toolbar\">\n <div className=\"scms-admin-bar__main\">\n <div className=\"scms-admin-bar__brand\">\n <strong>{title}</strong>\n {dirtyCount > 0 ? (\n <span className=\"scms-admin-bar__meta\">\n {dirtyCount} unsaved\n </span>\n ) : null}\n </div>\n <div className=\"scms-admin-bar__actions\">\n {hasPageSettings ? (\n <button\n type=\"button\"\n className={`scms-btn ${pageSettingsOpen ? \"scms-btn--primary\" : \"scms-btn--ghost\"}`}\n onClick={() => setPageSettingsOpen((open) => !open)}\n >\n Page settings\n </button>\n ) : null}\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--ghost\"\n disabled={dirtyCount === 0 || busy}\n onClick={() => discardDrafts()}\n >\n Discard\n </button>\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--ghost\"\n disabled={dirtyCount === 0 || busy}\n onClick={() => void saveDrafts()}\n >\n {saving ? \"Saving…\" : \"Save draft\"}\n </button>\n <button\n type=\"button\"\n className=\"scms-btn scms-btn--primary\"\n disabled={!publishEnabled || busy}\n onClick={() => void publish()}\n title={!publishEnabled ? \"Publish adapter is not configured\" : undefined}\n >\n {publishing ? \"Building…\" : \"Publish\"}\n </button>\n <a className=\"scms-btn scms-btn--ghost\" href={logoutPath}>\n Log out\n </a>\n </div>\n </div>\n {pageSettingsOpen ? (\n <PageSettingsPanel open={pageSettingsOpen} onClose={() => setPageSettingsOpen(false)} />\n ) : null}\n {lastError ? <p className=\"scms-admin-bar__error\">{lastError}</p> : null}\n </div>\n );\n}\n"],"mappings":";AA2CU,cAEE,YAFF;AAzCV,SAAS,gBAAgB;AAEzB,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,yBAAyB;AAU3B,SAAS,SAAS,EAAE,QAAQ,cAAc,GAAkB;AACjE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI,cAAc;AAClB,QAAM,CAAC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mBAAc;AAAA;AAAA,QAC9B;AAAA,QACA,oBAAC,OAAE,WAAU,4BAA2B,MAAM,YAAY,qBAE1D;AAAA,SACF;AAAA,OACF;AAAA,IACC,mBACC,oBAAC,qBAAkB,MAAM,kBAAkB,SAAS,MAAM,oBAAoB,KAAK,GAAG,IACpF;AAAA,IACH,YAAY,oBAAC,OAAE,WAAU,yBAAyB,qBAAU,IAAO;AAAA,KACtE;AAEJ;","names":[]}
@@ -1,7 +1,6 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ContentEditorSession } from './context.js';
3
3
  import { ContentConfig } from './types.js';
4
- import 'react';
5
4
 
6
5
  type AdminEntryProps = {
7
6
  config: ContentConfig;
@@ -19,6 +18,6 @@ type AdminEntryProps = {
19
18
  /**
20
19
  * `/admin` landing page: login (if needed), then enter visual edit mode.
21
20
  */
22
- declare function AdminEntry({ config, session, authLabel, authKind, publishEnabled, configured, siteHref, title, }: AdminEntryProps): react_jsx_runtime.JSX.Element;
21
+ declare function AdminEntry({ config, session, authLabel, authKind, publishEnabled, configured, siteHref, title, }: AdminEntryProps): react.JSX.Element;
23
22
 
24
23
  export { AdminEntry, type AdminEntryProps };
@@ -2,7 +2,6 @@
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
4
  import { writeBrowserCookie } from "./cookies";
5
- import { listTextFields } from "./define";
6
5
  function AdminEntry({
7
6
  config,
8
7
  session = null,
@@ -14,11 +13,6 @@ function AdminEntry({
14
13
  title = "Content editor"
15
14
  }) {
16
15
  const cookieName = config.editCookie ?? "scms_edit";
17
- const seoDocument = config.seoDocument ?? "seo";
18
- const fields = listTextFields(config).filter(
19
- (item) => !(item.document === seoDocument && item.field.startsWith("pages."))
20
- );
21
- const pageCount = config.pages?.length ?? 0;
22
16
  const loginPath = config.loginPath ?? "/api/content/auth/login";
23
17
  const logoutPath = config.logoutPath ?? "/api/content/auth/logout";
24
18
  const [username, setUsername] = useState("");
@@ -50,11 +44,6 @@ function AdminEntry({
50
44
  return /* @__PURE__ */ jsx("main", { className: "scms-admin-entry", children: /* @__PURE__ */ jsxs("div", { className: "scms-admin-entry__card", children: [
51
45
  /* @__PURE__ */ jsx("p", { className: "scms-admin-entry__eyebrow", children: "Content CMS" }),
52
46
  /* @__PURE__ */ jsx("h1", { children: title }),
53
- /* @__PURE__ */ jsxs("p", { children: [
54
- "Edit marked text fields on the live site. Use ",
55
- /* @__PURE__ */ jsx("strong", { children: "Page settings" }),
56
- " in the top bar for title, description, favicon and SEO. Save writes JSON on disk; Publish rebuilds the site safely in the background."
57
- ] }),
58
47
  /* @__PURE__ */ jsx("div", { className: "scms-admin-entry__actions", children: !configured ? null : session ? /* @__PURE__ */ jsxs(Fragment, { children: [
59
48
  /* @__PURE__ */ jsx(
60
49
  "a",
@@ -114,24 +103,7 @@ function AdminEntry({
114
103
  /* @__PURE__ */ jsx("strong", { children: session.name }),
115
104
  session.email ? ` (${session.email})` : "",
116
105
  publishEnabled ? " \xB7 publish enabled" : " \xB7 publish adapter not configured"
117
- ] }) : /* @__PURE__ */ jsx("p", { className: "scms-admin-entry__session", children: "Sign in to enable editing and publishing." }),
118
- /* @__PURE__ */ jsxs("section", { className: "scms-admin-entry__fields", children: [
119
- /* @__PURE__ */ jsx("h2", { children: "Registered fields" }),
120
- pageCount > 0 ? /* @__PURE__ */ jsxs("p", { style: { marginBottom: 12, fontSize: 13, color: "var(--scms-muted)" }, children: [
121
- pageCount,
122
- " pages with editable SEO (title / description / OG image)"
123
- ] }) : null,
124
- /* @__PURE__ */ jsx("ul", { children: fields.map((item) => /* @__PURE__ */ jsxs("li", { children: [
125
- /* @__PURE__ */ jsx("strong", { children: item.label }),
126
- /* @__PURE__ */ jsxs("span", { children: [
127
- item.documentLabel,
128
- " \xB7 ",
129
- item.document,
130
- ".",
131
- item.field
132
- ] })
133
- ] }, `${item.document}.${item.field}`)) })
134
- ] })
106
+ ] }) : null
135
107
  ] }) });
136
108
  }
137
109
  export {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/admin-entry.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type FormEvent } from \"react\";\n\nimport { writeBrowserCookie } from \"./cookies\";\nimport type { ContentEditorSession } from \"./context\";\nimport { listTextFields } from \"./define\";\nimport type { ContentConfig } from \"./types\";\n\nexport type AdminEntryProps = {\n config: ContentConfig;\n session?: ContentEditorSession | null;\n authLabel?: string;\n /** @default \"password\" */\n authKind?: \"password\" | \"oauth\" | \"instant\";\n publishEnabled?: boolean;\n /** When false, login is disabled and a setup hint is shown. @default true */\n configured?: boolean;\n /** Site URL opened after enabling edit mode. @default \"/\" */\n siteHref?: string;\n title?: string;\n};\n\n/**\n * `/admin` landing page: login (if needed), then enter visual edit mode.\n */\nexport function AdminEntry({\n config,\n session = null,\n authLabel = \"Sign in\",\n authKind = \"password\",\n publishEnabled = false,\n configured = true,\n siteHref = \"/\",\n title = \"Content editor\",\n}: AdminEntryProps) {\n const cookieName = config.editCookie ?? \"scms_edit\";\n const seoDocument = config.seoDocument ?? \"seo\";\n const fields = listTextFields(config).filter(\n (item) => !(item.document === seoDocument && item.field.startsWith(\"pages.\")),\n );\n const pageCount = config.pages?.length ?? 0;\n const loginPath = config.loginPath ?? \"/api/content/auth/login\";\n const logoutPath = config.logoutPath ?? \"/api/content/auth/logout\";\n\n const [username, setUsername] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n async function onPasswordLogin(event: FormEvent) {\n event.preventDefault();\n setBusy(true);\n setError(null);\n try {\n const response = await fetch(loginPath, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ username, password, returnTo: \"/admin\" }),\n });\n const payload = (await response.json().catch(() => null)) as\n | { ok?: boolean; error?: string }\n | null;\n if (!response.ok || !payload?.ok) {\n throw new Error(payload?.error ?? `Login failed (${response.status})`);\n }\n writeBrowserCookie(cookieName, \"1\");\n window.location.href = \"/admin\";\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Login failed\");\n } finally {\n setBusy(false);\n }\n }\n\n return (\n <main className=\"scms-admin-entry\">\n <div className=\"scms-admin-entry__card\">\n <p className=\"scms-admin-entry__eyebrow\">Content CMS</p>\n <h1>{title}</h1>\n <p>\n Edit marked text fields on the live site. Use <strong>Page settings</strong> in the top\n bar for title, description, favicon and SEO. Save writes JSON on disk; Publish rebuilds\n the site safely in the background.\n </p>\n\n <div className=\"scms-admin-entry__actions\">\n {!configured ? null : session ? (\n <>\n <a\n className=\"scms-btn scms-btn--primary\"\n href={siteHref}\n onClick={() => writeBrowserCookie(cookieName, \"1\")}\n >\n Open site for editing\n </a>\n <a className=\"scms-btn scms-btn--ghost\" href={logoutPath}>\n Log out\n </a>\n </>\n ) : authKind === \"password\" ? (\n <form className=\"scms-login-form\" onSubmit={(event) => void onPasswordLogin(event)}>\n <label>\n <span>Username</span>\n <input\n name=\"username\"\n autoComplete=\"username\"\n value={username}\n onChange={(event) => setUsername(event.target.value)}\n required\n />\n </label>\n <label>\n <span>Password</span>\n <input\n name=\"password\"\n type=\"password\"\n autoComplete=\"current-password\"\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n required\n />\n </label>\n {error ? <p className=\"scms-login-form__error\">{error}</p> : null}\n <button className=\"scms-btn scms-btn--primary\" type=\"submit\" disabled={busy}>\n {busy ? \"Signing in…\" : authLabel}\n </button>\n </form>\n ) : (\n <a\n className=\"scms-btn scms-btn--primary\"\n href={`${loginPath}?returnTo=${encodeURIComponent(\"/admin\")}`}\n >\n {authLabel}\n </a>\n )}\n </div>\n\n {!configured ? (\n <p className=\"scms-admin-entry__session\">\n CMS env is not configured on this server yet. Public site still works; set{\" \"}\n <code>CONTENT_CMS_SESSION_SECRET</code> and editor password to enable editing.\n </p>\n ) : session ? (\n <p className=\"scms-admin-entry__session\">\n Signed in as <strong>{session.name}</strong>\n {session.email ? ` (${session.email})` : \"\"}\n {publishEnabled ? \" · publish enabled\" : \" · publish adapter not configured\"}\n </p>\n ) : (\n <p className=\"scms-admin-entry__session\">Sign in to enable editing and publishing.</p>\n )}\n\n <section className=\"scms-admin-entry__fields\">\n <h2>Registered fields</h2>\n {pageCount > 0 ? (\n <p style={{ marginBottom: 12, fontSize: 13, color: \"var(--scms-muted)\" }}>\n {pageCount} pages with editable SEO (title / description / OG image)\n </p>\n ) : null}\n <ul>\n {fields.map((item) => (\n <li key={`${item.document}.${item.field}`}>\n <strong>{item.label}</strong>\n <span>\n {item.documentLabel} · {item.document}.{item.field}\n </span>\n </li>\n ))}\n </ul>\n </section>\n </div>\n </main>\n );\n}\n"],"mappings":";AA8EQ,SAUI,UAVJ,KAEA,YAFA;AA5ER,SAAS,gBAAgC;AAEzC,SAAS,0BAA0B;AAEnC,SAAS,sBAAsB;AAoBxB,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,QAAQ;AACV,GAAoB;AAClB,QAAM,aAAa,OAAO,cAAc;AACxC,QAAM,cAAc,OAAO,eAAe;AAC1C,QAAM,SAAS,eAAe,MAAM,EAAE;AAAA,IACpC,CAAC,SAAS,EAAE,KAAK,aAAa,eAAe,KAAK,MAAM,WAAW,QAAQ;AAAA,EAC7E;AACA,QAAM,YAAY,OAAO,OAAO,UAAU;AAC1C,QAAM,YAAY,OAAO,aAAa;AACtC,QAAM,aAAa,OAAO,cAAc;AAExC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,iBAAe,gBAAgB,OAAkB;AAC/C,UAAM,eAAe;AACrB,YAAQ,IAA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MACJ,oBAAC,QACE,iBAAO,IAAI,CAAC,SACX,qBAAC,QACC;AAAA,4BAAC,YAAQ,eAAK,OAAM;AAAA,QACpB,qBAAC,UACE;AAAA,eAAK;AAAA,UAAc;AAAA,UAAI,KAAK;AAAA,UAAS;AAAA,UAAE,KAAK;AAAA,WAC/C;AAAA,WAJO,GAAG,KAAK,QAAQ,IAAI,KAAK,KAAK,EAKvC,CACD,GACH;AAAA,OACF;AAAA,KACF,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/admin-entry.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, type FormEvent } from \"react\";\n\nimport { writeBrowserCookie } from \"./cookies\";\nimport type { ContentEditorSession } from \"./context\";\nimport type { ContentConfig } from \"./types\";\n\nexport type AdminEntryProps = {\n config: ContentConfig;\n session?: ContentEditorSession | null;\n authLabel?: string;\n /** @default \"password\" */\n authKind?: \"password\" | \"oauth\" | \"instant\";\n publishEnabled?: boolean;\n /** When false, login is disabled and a setup hint is shown. @default true */\n configured?: boolean;\n /** Site URL opened after enabling edit mode. @default \"/\" */\n siteHref?: string;\n title?: string;\n};\n\n/**\n * `/admin` landing page: login (if needed), then enter visual edit mode.\n */\nexport function AdminEntry({\n config,\n session = null,\n authLabel = \"Sign in\",\n authKind = \"password\",\n publishEnabled = false,\n configured = true,\n siteHref = \"/\",\n title = \"Content editor\",\n}: AdminEntryProps) {\n const cookieName = config.editCookie ?? \"scms_edit\";\n const loginPath = config.loginPath ?? \"/api/content/auth/login\";\n const logoutPath = config.logoutPath ?? \"/api/content/auth/logout\";\n\n const [username, setUsername] = useState(\"\");\n const [password, setPassword] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n async function onPasswordLogin(event: FormEvent) {\n event.preventDefault();\n setBusy(true);\n setError(null);\n try {\n const response = await fetch(loginPath, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ username, password, returnTo: \"/admin\" }),\n });\n const payload = (await response.json().catch(() => null)) as\n | { ok?: boolean; error?: string }\n | null;\n if (!response.ok || !payload?.ok) {\n throw new Error(payload?.error ?? `Login failed (${response.status})`);\n }\n writeBrowserCookie(cookieName, \"1\");\n window.location.href = \"/admin\";\n } catch (err) {\n setError(err instanceof Error ? err.message : \"Login failed\");\n } finally {\n setBusy(false);\n }\n }\n\n return (\n <main className=\"scms-admin-entry\">\n <div className=\"scms-admin-entry__card\">\n <p className=\"scms-admin-entry__eyebrow\">Content CMS</p>\n <h1>{title}</h1>\n\n <div className=\"scms-admin-entry__actions\">\n {!configured ? null : session ? (\n <>\n <a\n className=\"scms-btn scms-btn--primary\"\n href={siteHref}\n onClick={() => writeBrowserCookie(cookieName, \"1\")}\n >\n Open site for editing\n </a>\n <a className=\"scms-btn scms-btn--ghost\" href={logoutPath}>\n Log out\n </a>\n </>\n ) : authKind === \"password\" ? (\n <form className=\"scms-login-form\" onSubmit={(event) => void onPasswordLogin(event)}>\n <label>\n <span>Username</span>\n <input\n name=\"username\"\n autoComplete=\"username\"\n value={username}\n onChange={(event) => setUsername(event.target.value)}\n required\n />\n </label>\n <label>\n <span>Password</span>\n <input\n name=\"password\"\n type=\"password\"\n autoComplete=\"current-password\"\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n required\n />\n </label>\n {error ? <p className=\"scms-login-form__error\">{error}</p> : null}\n <button className=\"scms-btn scms-btn--primary\" type=\"submit\" disabled={busy}>\n {busy ? \"Signing in…\" : authLabel}\n </button>\n </form>\n ) : (\n <a\n className=\"scms-btn scms-btn--primary\"\n href={`${loginPath}?returnTo=${encodeURIComponent(\"/admin\")}`}\n >\n {authLabel}\n </a>\n )}\n </div>\n\n {!configured ? (\n <p className=\"scms-admin-entry__session\">\n CMS env is not configured on this server yet. Public site still works; set{\" \"}\n <code>CONTENT_CMS_SESSION_SECRET</code> and editor password to enable editing.\n </p>\n ) : session ? (\n <p className=\"scms-admin-entry__session\">\n Signed in as <strong>{session.name}</strong>\n {session.email ? ` (${session.email})` : \"\"}\n {publishEnabled ? \" · publish enabled\" : \" · publish adapter not configured\"}\n </p>\n ) : null}\n </div>\n </main>\n );\n}\n"],"mappings":";AAwEQ,SAKI,UALJ,KAKI,YALJ;AAtER,SAAS,gBAAgC;AAEzC,SAAS,0BAA0B;AAqB5B,SAAS,WAAW;AAAA,EACzB;AAAA,EACA,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,WAAW;AAAA,EACX,QAAQ;AACV,GAAoB;AAClB,QAAM,aAAa,OAAO,cAAc;AACxC,QAAM,YAAY,OAAO,aAAa;AACtC,QAAM,aAAa,OAAO,cAAc;AAExC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,IAAI;AAEtD,iBAAe,gBAAgB,OAAkB;AAC/C,UAAM,eAAe;AACrB,YAAQ,IAAI;AACZ,aAAS,IAAI;AACb,QAAI;AACF,YAAM,WAAW,MAAM,MAAM,WAAW;AAAA,QACtC,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,QAC9C,MAAM,KAAK,UAAU,EAAE,UAAU,UAAU,UAAU,SAAS,CAAC;AAAA,MACjE,CAAC;AACD,YAAM,UAAW,MAAM,SAAS,KAAK,EAAE,MAAM,MAAM,IAAI;AAGvD,UAAI,CAAC,SAAS,MAAM,CAAC,SAAS,IAAI;AAChC,cAAM,IAAI,MAAM,SAAS,SAAS,iBAAiB,SAAS,MAAM,GAAG;AAAA,MACvE;AACA,yBAAmB,YAAY,GAAG;AAClC,aAAO,SAAS,OAAO;AAAA,IACzB,SAAS,KAAK;AACZ,eAAS,eAAe,QAAQ,IAAI,UAAU,cAAc;AAAA,IAC9D,UAAE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aAAa,mBAAmB,QAAQ,CAAC;AAAA,QAE1D;AAAA;AAAA,IACH,GAEJ;AAAA,IAEC,CAAC,aACA,qBAAC,OAAE,WAAU,6BAA4B;AAAA;AAAA,MACoC;AAAA,MAC3E,oBAAC,UAAK,wCAA0B;AAAA,MAAO;AAAA,OACzC,IACE,UACF,qBAAC,OAAE,WAAU,6BAA4B;AAAA;AAAA,MAC1B,oBAAC,YAAQ,kBAAQ,MAAK;AAAA,MAClC,QAAQ,QAAQ,KAAK,QAAQ,KAAK,MAAM;AAAA,MACxC,iBAAiB,0BAAuB;AAAA,OAC3C,IACE;AAAA,KACN,GACF;AAEJ;","names":[]}
package/dist/context.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ContentConfig, ContentDocuments, TextFieldType } from './types.js';
2
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
3
3
  import { ReactNode } from 'react';
4
4
 
5
5
  type ContentEditorSession = {
@@ -35,7 +35,7 @@ type ContentCmsProviderProps = {
35
35
  publishEnabled?: boolean;
36
36
  children: ReactNode;
37
37
  };
38
- declare function ContentCmsProvider({ config, documents: initialDocuments, editMode, session, publishEnabled, children, }: ContentCmsProviderProps): react_jsx_runtime.JSX.Element;
38
+ declare function ContentCmsProvider({ config, documents: initialDocuments, editMode, session, publishEnabled, children, }: ContentCmsProviderProps): react.JSX.Element;
39
39
  declare function useContentCms(): ContentCmsContextValue;
40
40
  declare function useContentCmsOptional(): ContentCmsContextValue | null;
41
41
  declare function useEditableField(document: string, field: string): {
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ElementType, CSSProperties, ReactNode } from 'react';
3
3
 
4
4
  type EditableTextProps = {
@@ -15,6 +15,6 @@ type EditableTextProps = {
15
15
  */
16
16
  children?: ReactNode;
17
17
  };
18
- declare function EditableText({ document: documentName, field, as: Tag, className, style, id, children, }: EditableTextProps): react_jsx_runtime.JSX.Element;
18
+ declare function EditableText({ document: documentName, field, as: Tag, className, style, id, children, }: EditableTextProps): react.JSX.Element;
19
19
 
20
20
  export { EditableText, type EditableTextProps };
package/dist/index.d.ts CHANGED
@@ -7,5 +7,4 @@ export { EditableText, EditableTextProps } from './editable-text.js';
7
7
  export { PageSettingsPanel, PageSettingsPanelProps } from './page-settings.js';
8
8
  export { asString, getPathValue, setPathValue } from './path.js';
9
9
  export { ContentConfig, ContentDocumentDef, ContentDocuments, ContentFieldDef, ContentFieldRef, ContentPageDef, ContentPatch, TextFieldType } from './types.js';
10
- import 'react/jsx-runtime';
11
10
  import 'react';
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
 
3
3
  type PageSettingsPanelProps = {
4
4
  open: boolean;
@@ -7,6 +7,6 @@ type PageSettingsPanelProps = {
7
7
  /**
8
8
  * Top panel for editing favicon + SEO fields for the current (or selected) page.
9
9
  */
10
- declare function PageSettingsPanel({ open, onClose }: PageSettingsPanelProps): react_jsx_runtime.JSX.Element | null;
10
+ declare function PageSettingsPanel({ open, onClose }: PageSettingsPanelProps): react.JSX.Element | null;
11
11
 
12
12
  export { PageSettingsPanel, type PageSettingsPanelProps };
package/dist/styles.css CHANGED
@@ -83,17 +83,12 @@
83
83
  letter-spacing: 0.02em;
84
84
  }
85
85
 
86
- .scms-admin-bar__meta,
87
- .scms-admin-bar__hint {
86
+ .scms-admin-bar__meta {
88
87
  color: var(--scms-muted);
89
88
  font-size: 12px;
90
89
  margin: 0;
91
90
  }
92
91
 
93
- .scms-admin-bar__hint {
94
- margin-top: 8px;
95
- }
96
-
97
92
  .scms-admin-bar__error {
98
93
  margin: 8px 0 0;
99
94
  color: var(--scms-danger);
@@ -150,7 +145,7 @@
150
145
  }
151
146
 
152
147
  .scms-admin-entry__card {
153
- max-width: 640px;
148
+ max-width: 400px;
154
149
  margin: 0 auto;
155
150
  background: rgba(17, 24, 39, 0.88);
156
151
  border: 1px solid #374151;
@@ -222,7 +217,8 @@
222
217
  }
223
218
 
224
219
  .scms-login-form .scms-btn {
225
- justify-self: start;
220
+ width: 100%;
221
+ justify-content: center;
226
222
  }
227
223
 
228
224
  .scms-admin-entry__session {
@@ -230,49 +226,8 @@
230
226
  font-size: 13px;
231
227
  }
232
228
 
233
- .scms-admin-entry__fields {
234
- margin-top: 28px;
235
- padding-top: 20px;
236
- border-top: 1px solid #374151;
237
- }
238
-
239
- .scms-admin-entry__fields h2 {
240
- margin: 0 0 12px;
241
- font-size: 14px;
242
- text-transform: uppercase;
243
- letter-spacing: 0.08em;
244
- color: var(--scms-muted);
245
- }
246
-
247
- .scms-admin-entry__fields ul {
248
- list-style: none;
249
- margin: 0;
250
- padding: 0;
251
- display: grid;
252
- gap: 10px;
253
- }
254
-
255
- .scms-admin-entry__fields li {
256
- display: flex;
257
- flex-direction: column;
258
- gap: 2px;
259
- padding: 10px 12px;
260
- border-radius: 10px;
261
- background: #0b1220;
262
- border: 1px solid #1f2937;
263
- }
264
-
265
- .scms-admin-entry__fields li strong {
266
- font-size: 14px;
267
- }
268
-
269
- .scms-admin-entry__fields li span {
270
- font-size: 12px;
271
- color: var(--scms-muted);
272
- }
273
-
274
229
  body:has(.scms-admin-bar) {
275
- scroll-padding-top: 88px;
230
+ scroll-padding-top: 64px;
276
231
  }
277
232
 
278
233
  .scms-visually-hidden {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vedyua/cms",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Universal inline content editor for static JSON sites (Next.js)",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
@@ -32,13 +32,14 @@
32
32
  "scripts": {
33
33
  "build": "tsup && cp src/styles.css dist/styles.css",
34
34
  "dev": "tsup --watch --onSuccess \"cp src/styles.css dist/styles.css\"",
35
+ "playground": "vite --config preview/vite.config.ts",
35
36
  "typecheck": "tsc -p tsconfig.json --noEmit",
36
37
  "lint": "tsc -p tsconfig.json --noEmit",
37
38
  "prepare": "npm run build",
38
39
  "prepublishOnly": "npm run typecheck && npm run build"
39
40
  },
40
41
  "publishConfig": {
41
- "access": "restricted",
42
+ "access": "public",
42
43
  "registry": "https://registry.npmjs.org/"
43
44
  },
44
45
  "peerDependencies": {
@@ -49,10 +50,12 @@
49
50
  "@types/node": "^24.12.3",
50
51
  "@types/react": "^19.2.14",
51
52
  "@types/react-dom": "^19.2.3",
53
+ "@vitejs/plugin-react": "^5.1.1",
52
54
  "react": "^19.2.6",
53
55
  "react-dom": "^19.2.6",
54
56
  "tsup": "^8.5.0",
55
- "typescript": "~6.0.2"
57
+ "typescript": "~6.0.2",
58
+ "vite": "^7.2.4"
56
59
  },
57
60
  "keywords": [
58
61
  "cms",
@@ -60,10 +63,5 @@
60
63
  "nextjs",
61
64
  "inline-editor",
62
65
  "vedy"
63
- ],
64
- "repository": {
65
- "type": "git",
66
- "url": "git+https://github.com/sourfanta/ququ-monorepo.git",
67
- "directory": "packages/vedy-cms"
68
- }
66
+ ]
69
67
  }