@nickpaustian/tela 0.3.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/CHANGELOG.md CHANGED
@@ -1,6 +1,35 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.4.0
4
+
5
+ ### Upgrading from 0.3.x
6
+
7
+ - **`collapsed: true` on a group now means "starts at rest"**, not "starts shut": a group at rest shows its one line or its summary, as "Closed sections show" says. A group is no longer a `<details>` element, so project CSS aimed at `details` or `summary` inside the form no longer matches.
8
+ - **The media library is `@pseudolux-ui/media-library` 0.2.** The Media page and the image picker mount its `LibraryFrame`; `AssetGrid` and `AssetInspector` are gone from that package, so a project component that mounted either has to mount the frame instead. The `--px-tile` token is no longer mapped.
9
+ - **A list row's open and shut chevron (`.sec-toggle`) is gone**; the three state buttons (`.sec-density`) take its place.
10
+ - **The server takes request bodies up to 300 MB**, so the library's 250 MB uploads reach it. A proxy in front of Tela needs to allow the same.
11
+
12
+ ### Added
13
+
14
+ - **Three states for a group of fields**: minimal (one line beside the title), summary (a read-only glance at what is inside) and full (the fields). The title is one button that opens the fields or puts them away; three buttons beside it set the state directly. Above the form, "Closed sections show" sets how every closed group rests, with Open all and Close all. Both choices are remembered in the browser, per collection. An entry being written for the first time starts with its groups open; one opened later starts with them at rest.
15
+ - **`glance` and `rest` on a group**: `glance` is a list of summary parts, one to a row, drawn in the summary state; `rest` is `"summary"` (the default) or `"minimal"`. A group with no `glance` shows each field that holds something, by its type; one with no `peek` gets its first few values as its line.
16
+ - **A shut section glances at what it holds**: in a list of sections, a closed row shows the same summary rows a group does, following "Closed sections show". With "One line" it shows its title only, as before. Each section has the same three buttons a group has, to set it to one line, a glance or its fields on its own; they take the place of the open and shut chevron. Rows of a plain list have them too, so a list inside a section rests the same way.
17
+ - **A picture at a glance** (`PictureSummary`): a group's default summary shows a chosen picture small, with its alt text (or that it has none) and credit; pressing it shows it large in a popover.
18
+ - **A list's pictures at a glance** (`PicturesSummary`): a list whose rows each hold a picture, such as tiles, slides or logos, shows them small in a row above what the rows say, up to six and then how many more, each opening large.
19
+ - **Better default summaries by type**: a date reads as `21 Nov 2026` and a time as `5:30pm`; a toggle says its own words, or Yes and No; a list says its rows' first words (`Adult 15, Member 10 +1 more`) and falls back to a count; a link shows its address; a field inside a block is named on its own unless two would read the same. A field drawn by its own component is summarised by the summary component of the same name where a project has one (`video` by `VideoSummary`).
20
+
21
+ ### Changed
22
+
23
+ - **The media library speaks through Tela's toasts**: what it says in passing, such as a colour copied to the clipboard, is handed to `ui.toast`, so there is one kind of toast on the page. Needs a `@pseudolux-ui/media-library` with the `notify` option; an older one ignores it.
24
+ - **The Media page is the library's new frame**: a wall of pictures at their own shape under a sentence that says what is showing, a peek under the row, a full-screen editor with every crop and the focal point, describing one after another, and a batch screen for uploads. It needs `@pseudolux-ui/media-library` with `LibraryFrame`. A field's picker is the same frame in its picking mode: the picture looked at is the one chosen, and the editor opens over the dialog. It is mounted only while the dialog is open, where the grid before it loaded once for every image field on a page.
25
+ - A group is a section with a button for its title, no longer a `<details>` element. `collapsed: true` now means "starts at rest" rather than "starts shut".
26
+
27
+ ### Fixed
28
+
29
+ - **An upload to the media library that gets no answer is followed up, and a real failure says so.** A file the library could not read used to be reported as "still processing" and never mentioned again. It is now a failure with a sentence. Only no answer in time is "pending", and it comes with a ticket: `GET /api/media/uploads/:ticket` says whether the picture has landed, so the browser can ask until it has. Upload requests also keep their connection open while the library works, and the server takes bodies up to 300 MB (Bun's own ceiling was 128 MB, under the library's 250 MB).
30
+ - **`tela republish` and `tela media-sync` call the publish hooks**, as a publish from the admin does, so a service that waits on `afterPublish` hears about what they commit.
31
+
32
+ ## 0.3.0
4
33
 
5
34
  ### Added
6
35
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nickpaustian/tela",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "A Git-backed headless CMS: collections of fields in TypeScript, edited in a Lightspeed admin, published as JSON commits to a content repo.",
5
5
  "license": "MIT",
6
6
  "author": "Nick Paustian",
@@ -65,7 +65,7 @@
65
65
  "markdown-it": "^15.0.0",
66
66
  "prosemirror-markdown": "^1.13.0",
67
67
  "@pseudolux-ui/client": "^0.1.0",
68
- "@pseudolux-ui/media-library": "^0.1.0",
68
+ "@pseudolux-ui/media-library": "^0.2.2",
69
69
  "vite": "^6.3.5"
70
70
  },
71
71
  "devDependencies": {
@@ -2,6 +2,8 @@ import { readdir } from "fs/promises"
2
2
  import { join } from "path"
3
3
  import { republishPictures } from "../src/content/export.ts"
4
4
  import { commitContent } from "../src/content/git.ts"
5
+ import { noticeOf, notifyHooks } from "../src/content/hooks.ts"
6
+ import { config } from "../src/config/load.ts"
5
7
 
6
8
  /**
7
9
  * Every published picture checked against the media library: a credit
@@ -37,5 +39,6 @@ const commit = await commitContent(exported, {
37
39
  message: `Update pictures from the media library\n\nRebuild: ${exported.cells.join(" ")}\n`,
38
40
  push: process.env.TELA_PUSH !== "false",
39
41
  })
42
+ await notifyHooks(config.afterPublish, noticeOf("published", commit))
40
43
  console.log(`${ids.length} checked; updated ${exported.files.join(", ")}${commit.sha ? ` in ${commit.sha.slice(0, 7)}` : ""}.`)
41
44
  process.exit(0)
@@ -1,5 +1,7 @@
1
1
  import { republishEntries } from "../src/content/export.ts"
2
2
  import { commitContent } from "../src/content/git.ts"
3
+ import { noticeOf, notifyHooks } from "../src/content/hooks.ts"
4
+ import { config } from "../src/config/load.ts"
3
5
 
4
6
  /**
5
7
  * Every published entry written again under the rules publishing follows now,
@@ -20,5 +22,6 @@ const commit = await commitContent(exported, {
20
22
  message: `Republish under the current rules\n\nRebuild: ${exported.cells.join(" ")}\n`,
21
23
  push: process.env.TELA_PUSH !== "false",
22
24
  })
25
+ await notifyHooks(config.afterPublish, noticeOf("published", commit))
23
26
  console.log(commit.sha ? `Rewrote ${commit.files.length} file(s) in ${commit.sha.slice(0, 7)}.` : "Everything already matches.")
24
27
  process.exit(0)
@@ -258,6 +258,19 @@
258
258
 
259
259
  <p class="note checking sr-only" role="status" $show="state.checking">Checking…</p>
260
260
 
261
+ <!-- How much the sections show while they are not being edited: said
262
+ once for the page, and remembered. Each section can still be set
263
+ on its own. -->
264
+ <div class="group-rest" $show="state.hasGroups">
265
+ <span class="subtle" id="group-rest-label">Closed sections show</span>
266
+ <div class="segmented" role="group" aria-labelledby="group-rest-label">
267
+ <button type="button" $aria-pressed="state.groupRest === 'summary' ? 'true' : 'false'" @click="restGroups('summary')">Summary</button>
268
+ <button type="button" $aria-pressed="state.groupRest === 'minimal' ? 'true' : 'false'" @click="restGroups('minimal')">One line</button>
269
+ </div>
270
+ <button class="btn btn-ghost btn-sm" type="button" @click="allGroups('full')">Open all</button>
271
+ <button class="btn btn-ghost btn-sm" type="button" @click="allGroups('rest')">Close all</button>
272
+ </div>
273
+
261
274
  <!--
262
275
  The field registry. Each field names the component that renders it, so
263
276
  `component` names it, falling back to `type` - so a plain text field
@@ -572,6 +585,7 @@ import {
572
585
  tagsRows,
573
586
  } from '../config/components.ts'
574
587
  import { seed, assemble } from '../content/entry.ts'
588
+ import { REST, THIS_BROWSER, memoryKey, readMemory, writeMemory } from '../content/glance.ts'
575
589
  import { diffEntry, describeValue } from '../content/changes.ts'
576
590
  import { personName } from '../content/person.ts'
577
591
  import { withScheme } from '../content/preview.ts'
@@ -591,6 +605,21 @@ const params = shared('route').value?.params ?? {}
591
605
  * its parent mounted to find out something about itself. The editor is the
592
606
  * only writer; every field is a reader.
593
607
  */
608
+ const groupStorage = () => (typeof localStorage === 'undefined' ? undefined : localStorage)
609
+
610
+ /** How every closed section on this page rests, remembered for this collection. */
611
+ function restGroups(rest) {
612
+ const key = memoryKey(THIS_BROWSER, state.collection)
613
+ writeMemory(groupStorage(), key, { ...readMemory(groupStorage(), key), rest })
614
+ state.groupRest = rest
615
+ shared('groups:rest', '').set(rest)
616
+ }
617
+
618
+ /** Every section opened, or put away. Stamped, so asking twice is heard twice. */
619
+ function allGroups(to) {
620
+ shared('groups:all', null).set({ to, at: Date.now() })
621
+ }
622
+
594
623
  const issueCell = shared('entry:issues', {})
595
624
 
596
625
  /**
@@ -669,6 +698,8 @@ function setUi(path, patch) {
669
698
  }
670
699
 
671
700
  const state = reactive({
701
+ hasGroups: false,
702
+ groupRest: REST,
672
703
  /** Tooltips naming shortcuts the way this keyboard labels them. */
673
704
  tips: {
674
705
  focus: 'Focus mode: hides the menus so the form and preview get the room. ' + keyLabel('Mod+Shift+F') + ', or Esc to leave.',
@@ -812,6 +843,8 @@ onMounted(async () => {
812
843
 
813
844
  const collection = schema.data.collection
814
845
  state.fields = collection.fields
846
+ state.hasGroups = collection.fields.some((field) => field.type === 'group' || (field.type === 'repeater' && Array.isArray(field.blocks)))
847
+ state.groupRest = readMemory(groupStorage(), memoryKey(THIS_BROWSER, state.collection)).rest || REST
815
848
  // Resolved once, against what is actually registered - a field naming a
816
849
  // component nobody built says so rather than leaving a gap.
817
850
  // No list at all means the registry could not be read, which is not the
@@ -3108,4 +3141,11 @@ window.addEventListener('keydown', (event) => {
3108
3141
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
3109
3142
  }
3110
3143
  }
3144
+
3145
+ .group-rest {
3146
+ display: flex;
3147
+ flex-wrap: wrap;
3148
+ align-items: center;
3149
+ gap: var(--sp-2) var(--sp-3);
3150
+ }
3111
3151
  </style>