smoodly 0.0.20 → 0.0.22
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 +1 -1
- package/dist/admin/ops-impl.js +8 -8
- package/dist/admin/shell/PagesList.js +3 -3
- package/dist/store.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -307,7 +307,7 @@ Implemented:
|
|
|
307
307
|
subtree plus the old and the new parent; `entries.move` expires the
|
|
308
308
|
entry and its descendants. The Pages list IS that tree — `admin/shell/pages-tree.ts`
|
|
309
309
|
is the pure view model (indent per depth, chevron on parents, the
|
|
310
|
-
derived path as the
|
|
310
|
+
derived path as the URL column, and per row its kind, status, sibling
|
|
311
311
|
position and whether it may take children), rendered by
|
|
312
312
|
`admin/shell/PagesList.tsx` with a row menu over the tree ops (New
|
|
313
313
|
subpage, New subpath, Add page here, Rename…, Delete — reordering is
|
package/dist/admin/ops-impl.js
CHANGED
|
@@ -72,13 +72,13 @@ const classify = (e) => {
|
|
|
72
72
|
return err("blocked", message);
|
|
73
73
|
if (message.includes("already taken"))
|
|
74
74
|
return err("conflict", message);
|
|
75
|
-
if (message.includes("already has a
|
|
75
|
+
if (message.includes("already has a page type"))
|
|
76
76
|
return err("conflict", message);
|
|
77
77
|
if (message.includes("exceed the tree depth") || message.includes("has child"))
|
|
78
78
|
return err("blocked", message);
|
|
79
79
|
// The tree guards: editing a folder as a page, moving a node into its
|
|
80
80
|
// own subtree, and the home page's no-children invariant.
|
|
81
|
-
if (message.includes("is a
|
|
81
|
+
if (message.includes("is a path") ||
|
|
82
82
|
message.includes("cannot be moved under itself") ||
|
|
83
83
|
message.includes("cannot have child pages")) {
|
|
84
84
|
return err("blocked", message);
|
|
@@ -277,9 +277,9 @@ export function createAdminOps(deps) {
|
|
|
277
277
|
if (input.template !== null) {
|
|
278
278
|
const registration = openTemplate(input.template);
|
|
279
279
|
if (!registration)
|
|
280
|
-
return err("validation", `smoodly: no page
|
|
280
|
+
return err("validation", `smoodly: no page type named "${input.template}".`);
|
|
281
281
|
if (registration.schema.slug !== undefined) {
|
|
282
|
-
return err("validation", `smoodly: page
|
|
282
|
+
return err("validation", `smoodly: page type "${input.template}" is fixed — Smoodly creates that page for you.`);
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
if (input.parentId !== null) {
|
|
@@ -324,7 +324,7 @@ export function createAdminOps(deps) {
|
|
|
324
324
|
const draft = record.template === null ? null : await pages.getDraftTree(id, locale);
|
|
325
325
|
if (!draft) {
|
|
326
326
|
return record.template === null
|
|
327
|
-
? err("blocked", `smoodly: "${nameOf(record)}" is a
|
|
327
|
+
? err("blocked", `smoodly: "${nameOf(record)}" is a path — give it a page type first.`)
|
|
328
328
|
: err("blocked", `smoodly: "${row.slug}" has no draft to publish.`);
|
|
329
329
|
}
|
|
330
330
|
const fieldErrors = [];
|
|
@@ -410,7 +410,7 @@ export function createAdminOps(deps) {
|
|
|
410
410
|
if (!record.locales[locale])
|
|
411
411
|
return err("not_found", `smoodly: page "${id}" does not exist in locale "${locale}".`);
|
|
412
412
|
if (record.template === null)
|
|
413
|
-
return err("blocked", `smoodly: "${nameOf(record)}" is a
|
|
413
|
+
return err("blocked", `smoodly: "${nameOf(record)}" is a path — it has no versions.`);
|
|
414
414
|
const version = typeof versionId === "string" ? await pages.getVersion(versionId) : null;
|
|
415
415
|
if (!version || version.pageId !== id || version.locale !== locale) {
|
|
416
416
|
return err("not_found", `smoodly: no version "${String(versionId)}" of this page in ${locale}.`);
|
|
@@ -491,9 +491,9 @@ export function createAdminOps(deps) {
|
|
|
491
491
|
}
|
|
492
492
|
const registration = openTemplate(template);
|
|
493
493
|
if (!registration)
|
|
494
|
-
return err("validation", `smoodly: no page
|
|
494
|
+
return err("validation", `smoodly: no page type named "${template}".`);
|
|
495
495
|
if (registration.schema.slug !== undefined) {
|
|
496
|
-
return err("validation", `smoodly: page
|
|
496
|
+
return err("validation", `smoodly: page type "${template}" is fixed — Smoodly creates that page for you.`);
|
|
497
497
|
}
|
|
498
498
|
const withTemplate = await pages.setTemplate(id, template, by);
|
|
499
499
|
expireTree();
|
|
@@ -105,7 +105,7 @@ export function PagesList({ ops, registry }) {
|
|
|
105
105
|
return null;
|
|
106
106
|
if (creatable.length === 1)
|
|
107
107
|
return creatable[0].name;
|
|
108
|
-
return window.prompt(`
|
|
108
|
+
return window.prompt(`Page type? (${creatable.map((p) => p.name).join(", ")})`) || null;
|
|
109
109
|
};
|
|
110
110
|
/** New page and New path (a folder in the tree) create in the SELECTED locale (spec §6). */
|
|
111
111
|
const newNode = (parentId, kind) => {
|
|
@@ -202,8 +202,8 @@ export function PagesList({ ops, registry }) {
|
|
|
202
202
|
const items = menu ? menuItems(menu.row) : [];
|
|
203
203
|
return (_jsxs(_Fragment, { children: [_jsx(ListView, { title: "Pages", titleTrailing: multilingual && _jsx(LocalePicker, { locales: registry.locales.supported, value: locale, onChange: pickLocale }), actions: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "secondary", onClick: () => newNode(null, "folder"), children: "+ New path" }), _jsx(Button, { onClick: () => newNode(null, "page"), disabled: noOpen, title: noOpen ? "Every page registration is fixed — add an open one (a page schema with no `slug`) to create pages here." : undefined, children: "+ New page" })] }), columns: [
|
|
204
204
|
{ label: "Title", width: "minmax(160px,1fr)" },
|
|
205
|
-
{ label: "
|
|
206
|
-
{ label: "
|
|
205
|
+
{ label: "URL", width: "minmax(140px,260px)" },
|
|
206
|
+
{ label: "Page type", width: "minmax(100px,160px)" },
|
|
207
207
|
{ label: "Status", width: "170px" },
|
|
208
208
|
{ label: "", width: "32px" },
|
|
209
209
|
], empty: pages ? "No pages yet." : "Loading…", sortable: { hook: sortable, canDrag: (i) => canDragRow(rows[i]) }, rows: rows.map((row, i) => {
|
package/dist/store.js
CHANGED
|
@@ -31,9 +31,9 @@ export function pathOptions(options) {
|
|
|
31
31
|
export const pageErrors = {
|
|
32
32
|
notFound: (id) => new Error(`smoodly: no page "${id}".`),
|
|
33
33
|
slugTaken: (slug) => new Error(`smoodly: a page with slug "${slug}" already exists under this parent.`),
|
|
34
|
-
folder: (id) => new Error(`smoodly: "${id}" is a
|
|
34
|
+
folder: (id) => new Error(`smoodly: "${id}" is a path — give it a page type first.`),
|
|
35
35
|
nothingPublished: (id, locale) => new Error(`smoodly: page "${id}" has nothing published in locale "${locale}" — there is no version to restore.`),
|
|
36
|
-
hasTemplate: (id) => new Error(`smoodly: "${id}" already has a
|
|
36
|
+
hasTemplate: (id) => new Error(`smoodly: "${id}" already has a page type.`),
|
|
37
37
|
homeChildren: () => new Error("smoodly: the home page cannot have child pages."),
|
|
38
38
|
cycle: () => new Error("smoodly: a page cannot be moved under itself."),
|
|
39
39
|
hasChildren: (id) => new Error(`smoodly: "${id}" has child pages — move or delete them first.`),
|
package/package.json
CHANGED