foldkit-cms 0.2.0 → 0.4.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 CHANGED
@@ -155,18 +155,29 @@ Editor.Message.PublishAsked() // also: ScheduleAsked({ at }), UnscheduleAsked, D
155
155
  // RestoreAsked({ revision }), UnpublishAsked, ArchiveAsked, UnarchiveAsked, ReloadAsked, OverwriteAsked
156
156
 
157
157
  PostEditor.status(model) // Opened | Editing | Saving | Saved | Conflict | Publishing | Published | ...
158
- PostEditor.state(model) // the entry's lifecycle state, as the server last derived it
159
- PostEditor.pageId(model) // the row's id, or the entry's until there is a row: what a preview shows under
158
+ PostEditor.state(model) // Option: the entry's lifecycle state, as the server last derived it
159
+ PostEditor.may(model, 'publish') // whether the server's `allow` lets this principal ask it; false until read
160
+ PostEditor.pageId(model) // Option: the row's id, or the entry's until there is a row: what a preview shows under
161
+ PostEditor.storedEntry(model) // Option: the entry the server knows, none until something new is first saved
160
162
  ```
161
163
 
162
164
  - **Saving is automatic and is not publishing.** Each edit starts a rest (`rest`,
163
165
  one second by default), and the edit that is still the last one when its rest
164
166
  ends saves the form as it stands, valid or not. There is no Save button to
165
167
  forget, and a validation error never costs an author their work.
168
+ - **A publish the form's own checks stop is `Incomplete`**, not whatever the
169
+ last save said: nothing was sent, the failing fields say why, and the next
170
+ edit clears it. One waiting for a check still running (an address being
171
+ looked up) is `Publishing` until the check answers.
166
172
  - **What counts as an edit is the form's answer, not a Message tag.** The editor
167
173
  asks `form.authoredChanged(before, after)`, so a blur, a refusal, or a repeated
168
174
  value starts no rest, while a control the editor has never heard of — a
169
175
  stateful or Bundle-backed one — autosaves exactly like a text field.
176
+ - **A form control backed by a Bundle keeps running inside the editor.** Its
177
+ Subscriptions and Resources (see
178
+ [`Input.bundle`](../form/README.md#a-control-with-a-model-of-its-own)) run
179
+ while an entry is open and stop when the editor closes. A runtime that runs
180
+ the editor provides their Resources, as for any Bundle that has some.
170
181
  - **`Editing` means there are edits that are not saved yet**, and `Opened` means
171
182
  the form is as it was found. A draft the editor filled the form from is on the
172
183
  server already, so it reads `Saved`.
@@ -231,15 +242,29 @@ EntryTable({ page, renderers: Cms.displayRenderers() }, h)
231
242
 
232
243
  | Kind | What it is |
233
244
  | --- | --- |
234
- | `Cms.Input.Slug` | Text shown after the address it completes. `Cms.slug(from, { prefix?, through? })` makes one that follows `from` through `Cms.slugify`. A form filled with a published slug does not follow: an address must not move because its title did. |
245
+ | `Cms.Input.Slug` | Text shown after the address it completes. `Cms.slug(from, { prefix?, through? })` makes one that follows `from` through `Cms.slugify`. A form filled with a published slug does not follow: an address must not move because its title did. Drawn as the prefix in `FieldSlots.affix` and the input in `text`, together in `group`. |
235
246
  | `Cms.Input.DateTime` | A moment. Text that is none is `Invalid`, not submitted. |
236
- | `Cms.Display.State` | An entry's state as words: `Changed, scheduled`, `New, overdue`. `of({ words })` takes yours. Its renderer is a `span` with `data-cms-state` and `data-cms-schedule` to style. |
247
+ | `Cms.Display.State` | An entry's state as words: `Changed, scheduled`, `New, overdue`. `of({ words })` takes yours, text with blanks as every words object is: each state, `scheduled`, `overdue`, and `withSchedule` (`'{state}, {schedule}'`). Its renderer is a `span` with `data-cms-state` and `data-cms-schedule` to style. |
237
248
  | `Cms.Display.Moment` | A time. `of({ now })` reads relative to that clock (`3 days ago`), and you decide how often it moves; without one it is the date and time. Its renderer is a `time`. |
238
249
 
239
250
  `Cms.Entities` already say how they are shown: an entry's `state` is a `State`,
240
251
  and its times are `Moment`s, so a `Crud.list` over `Cms.Entries` needs only the
241
252
  renderers.
242
253
 
254
+ Entry-level views live beside the kinds: `Cms.stateBadge` for the state,
255
+ `Cms.revisionsOf` for the open entry's published revisions, `Cms.historyCard`
256
+ for the timeline, `Cms.moreCard` for the rest of what can happen to it. They
257
+ draw on your own slot builders, so you keep your slots and styles; who
258
+ published and the archive button's icon are yours to name:
259
+
260
+ ```ts
261
+ Cms.historyCard(slots, h, Cms.revisionsOf(model, history), {
262
+ state,
263
+ restore: revision => Message.RestoreAsked({ revision }),
264
+ authorName: name => directoryName(name),
265
+ })
266
+ ```
267
+
243
268
  ## Entities and operations
244
269
 
245
270
  `Cms.Entities` is `Entry`, `Draft` and `Revision`, related: an entry has one