@pramen/cms-editor 0.0.50 → 0.0.51
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 +45 -2
- package/dist/config.js +14 -4
- package/dist/index.html +4 -2
- package/dist/main.a0tgw8hg.js +399 -0
- package/package.json +1 -1
- package/src/app-context.tsx +21 -2
- package/src/brand.ts +96 -0
- package/src/components.tsx +33 -6
- package/src/main.tsx +10 -0
- package/src/routes/_layout.tsx +12 -5
- package/src/routes/page.tsx +12 -3
- package/src/types.ts +19 -0
- package/dist/main.bx4zkbes.js +0 -399
package/README.md
CHANGED
|
@@ -26,8 +26,8 @@ allow-lists, and the review/publish gates are all enforced server-side.
|
|
|
26
26
|
## Run it
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
bun --cwd packages/cms-editor
|
|
30
|
-
bun --cwd packages/cms-editor
|
|
29
|
+
bun run --cwd packages/cms-editor build # → dist/ (index.html + hashed JS)
|
|
30
|
+
bun run --cwd packages/cms-editor dev # watch + preview on http://localhost:5175
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
It's a **standalone static SPA** (no server-package dependency — local types + `fetch`).
|
|
@@ -43,6 +43,49 @@ rewrite to `/index.html` (Cloudflare Pages/`assets` handle this by default). The
|
|
|
43
43
|
referenced by an **absolute** path (`/main.<hash>.js`), so it loads correctly from any route
|
|
44
44
|
depth — don't rewrite it to a relative path.
|
|
45
45
|
|
|
46
|
+
## Configure it (`/config.js`)
|
|
47
|
+
|
|
48
|
+
`dist/config.js` is loaded before the app boots and sets `window.PRAMEN_CMS_EDITOR`. Override
|
|
49
|
+
that one file on your host — no rebuild, no fork. Every field is optional, and the shipped
|
|
50
|
+
file has them all commented out; **add them one at a time**:
|
|
51
|
+
|
|
52
|
+
```js
|
|
53
|
+
window.PRAMEN_CMS_EDITOR = {
|
|
54
|
+
brand: { name: "Acme", suffix: "cms" }, // the wordmark — see below
|
|
55
|
+
// signInUrl: "/signin/", // ONLY once that page exists — see the warning
|
|
56
|
+
// hidePages: true, // collections-only deployments
|
|
57
|
+
// extraNav: [{ label: "Curation", href: "/curate" }],
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **`signInUrl` must be a page that exists, and same-origin needs care.** An unauthenticated
|
|
62
|
+
> load calls it after clearing the stored session, so if the path 404s into this SPA's own
|
|
63
|
+
> catch-all (which a same-origin extensionless path does — see the SPA-fallback note above),
|
|
64
|
+
> the editor bounces between the redirect and itself with no session to recover from. Point
|
|
65
|
+
> it at a page you have already deployed, and prefer a separate origin.
|
|
66
|
+
|
|
67
|
+
**Set `brand` when you deploy this for a client.** The editor ships as a package an agency
|
|
68
|
+
installs on someone else's behalf, so the default wordmark — `pramen · cms editor`, in the
|
|
69
|
+
topbar, on the Setup screen and in the browser tab — puts the framework's name where the
|
|
70
|
+
client's belongs. `name` replaces it; `suffix: null` drops the `· cms` half entirely. A
|
|
71
|
+
configured brand replaces the whole string, including the word "editor", so nothing English
|
|
72
|
+
is appended to a client's name. Configure nothing and every surface renders exactly as it
|
|
73
|
+
did before this option existed.
|
|
74
|
+
|
|
75
|
+
A malformed `brand` can never take the editor down: a non-string value is ignored rather
|
|
76
|
+
than thrown on, and a `brand` that yields no usable name logs a console warning instead of
|
|
77
|
+
silently shipping "pramen" to your client.
|
|
78
|
+
|
|
79
|
+
The `<title>` in `index.html` is baked at build time, before any config exists, so the app
|
|
80
|
+
re-applies the configured brand on boot; the static tag is the pre-hydration fallback, which
|
|
81
|
+
means the default shows for the moment before the bundle runs.
|
|
82
|
+
|
|
83
|
+
A clean build regenerates `config.js` when it is missing, but never overwrites one that is
|
|
84
|
+
already there — including on every `dev` rebuild — so an edit you are previewing survives.
|
|
85
|
+
|
|
86
|
+
Settings → About still reports `pramen · cms-editor`. That row names the *software* you are
|
|
87
|
+
running, not the deployment, which is what an About panel is for.
|
|
88
|
+
|
|
46
89
|
Routes are file-based: `src/routes/*` is scanned by the Bun plugin at build time, which
|
|
47
90
|
(re)generates the checked-in `src/buzola.gen.ts`. After adding or renaming a route, run
|
|
48
91
|
`bun run codegen` (the build does it automatically) so tsc sees the new route.
|
package/dist/config.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
// Runtime configuration for the pramen CMS editor. Override this file in your host app
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// window.PRAMEN_CMS_EDITOR = {
|
|
1
|
+
// Runtime configuration for the pramen CMS editor. Override this file in your host app —
|
|
2
|
+
// no rebuild needed. Every field is optional:
|
|
3
|
+
//
|
|
4
|
+
// window.PRAMEN_CMS_EDITOR = {
|
|
5
|
+
// // Send unauthenticated / expired sessions to your own sign-in page instead of the
|
|
6
|
+
// // built-in Setup screen (?setup=1 still forces Setup, to paste a first-admin JWT):
|
|
7
|
+
// signInUrl: "/signin/",
|
|
8
|
+
// // The wordmark in the topbar, on the Setup screen and in the browser tab. Set this
|
|
9
|
+
// // when you deploy the editor for a client — the default says "pramen", which is the
|
|
10
|
+
// // framework's name, not theirs. `suffix: null` drops the "· cms" half.
|
|
11
|
+
// brand: { name: "Acme", suffix: "cms" },
|
|
12
|
+
// hidePages: true, // collections-only deployments
|
|
13
|
+
// extraNav: [{ label: "Curation", href: "/curate" }],
|
|
14
|
+
// };
|
|
5
15
|
window.PRAMEN_CMS_EDITOR = window.PRAMEN_CMS_EDITOR || {};
|
package/dist/index.html
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
<link rel="stylesheet" href="/fonts.css" />
|
|
8
8
|
<link rel="stylesheet" href="/app.css" />
|
|
9
9
|
<!-- Runtime config, loaded before the app so window.PRAMEN_CMS_EDITOR is set at boot.
|
|
10
|
-
A default config.js ships in dist; a host overrides it to set e.g. signInUrl
|
|
10
|
+
A default config.js ships in dist; a host overrides it to set e.g. signInUrl or
|
|
11
|
+
the wordmark. The <title> below is the pre-hydration fallback — the app re-applies
|
|
12
|
+
the configured brand on boot, since this file is baked before any config exists. -->
|
|
11
13
|
<script src="/config.js"></script>
|
|
12
14
|
</head>
|
|
13
15
|
<body>
|
|
14
16
|
<div id="app"></div>
|
|
15
|
-
<script type="module" src="/main.
|
|
17
|
+
<script type="module" src="/main.a0tgw8hg.js"></script>
|
|
16
18
|
</body>
|
|
17
19
|
</html>
|