@glw907/cairn-cms 0.57.0 → 0.58.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/components/CairnMediaLibrary.svelte +997 -7
  3. package/dist/components/EditPage.svelte +1 -0
  4. package/dist/components/MediaHeroField.svelte +17 -8
  5. package/dist/components/MediaHeroField.svelte.d.ts +13 -5
  6. package/dist/components/admin-icons.d.ts +4 -0
  7. package/dist/components/admin-icons.js +4 -0
  8. package/dist/components/cairn-admin.css +255 -3
  9. package/dist/content/frontmatter.js +5 -0
  10. package/dist/content/media-rewrite.d.ts +65 -0
  11. package/dist/content/media-rewrite.js +442 -0
  12. package/dist/content/types.d.ts +2 -0
  13. package/dist/content/validate.js +4 -0
  14. package/dist/log/events.d.ts +1 -1
  15. package/dist/media/rewrite-plan.d.ts +65 -0
  16. package/dist/media/rewrite-plan.js +61 -0
  17. package/dist/render/registry.js +1 -1
  18. package/dist/sveltekit/cairn-admin.d.ts +5 -0
  19. package/dist/sveltekit/cairn-admin.js +9 -0
  20. package/dist/sveltekit/content-routes.d.ts +92 -2
  21. package/dist/sveltekit/content-routes.js +338 -4
  22. package/dist/sveltekit/index.d.ts +1 -1
  23. package/package.json +1 -1
  24. package/src/lib/components/CairnMediaLibrary.svelte +997 -7
  25. package/src/lib/components/EditPage.svelte +1 -0
  26. package/src/lib/components/MediaHeroField.svelte +17 -8
  27. package/src/lib/components/admin-icons.ts +4 -0
  28. package/src/lib/content/frontmatter.ts +4 -0
  29. package/src/lib/content/media-rewrite.ts +555 -0
  30. package/src/lib/content/types.ts +2 -0
  31. package/src/lib/content/validate.ts +3 -0
  32. package/src/lib/log/events.ts +4 -1
  33. package/src/lib/media/rewrite-plan.ts +122 -0
  34. package/src/lib/render/registry.ts +1 -1
  35. package/src/lib/sveltekit/cairn-admin.ts +9 -0
  36. package/src/lib/sveltekit/content-routes.ts +451 -6
  37. package/src/lib/sveltekit/index.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,58 @@
2
2
 
3
3
  All notable changes to this project are recorded here, most recent first.
4
4
 
5
+ ## 0.58.0
6
+
7
+ <!-- release-size: minor -->
8
+
9
+ The Media Library learns to fix an image everywhere it is used. Two new operations rewrite every
10
+ placement of one asset in a single commit to `main`, each behind a preview an editor confirms before
11
+ anything changes. Both read usage across `main` and every open edit branch, both report the held edits
12
+ they will not touch, and both fail closed when usage cannot be verified.
13
+
14
+ Replace swaps the file behind an image without revisiting the pages that use it. cairn is
15
+ content-addressed, so a corrected upload is a new object with a new content hash; replace repoints
16
+ every published reference from the old hash to the new one and keeps the slug, so `media:first-light.<old>`
17
+ becomes `media:first-light.<new>` and the name an author sees is unchanged. The old row and its R2 bytes
18
+ are kept, recoverable from git history, rather than erased. A typed-slug confirm gates the apply, since
19
+ it rewrites published content and can break a draft, and the preview names the open edit branches still
20
+ on the old file. Those branches keep the old file until they republish; they are never rewritten.
21
+
22
+ Push alt fills missing descriptions from one place. An image's default alt copies into every placement
23
+ that has none, in one atomic commit. An explicit opt-in, off by default, also overwrites placements
24
+ that already carry a custom alt, since that replaces an author's words. A frontmatter hero marked
25
+ decorative is skipped, because its empty alt is deliberate. The media manifest is not changed: the
26
+ default alt is read from the row, never rewritten there. Alt fill is reversible and frequent, so it
27
+ carries no typed-slug gate.
28
+
29
+ No consumer action is required. Both operations are admin-side and additive, with no public surface
30
+ change and no content-format change. An editor walkthrough is in
31
+ [manage the media library](docs/guides/manage-the-media-library.md), and the design rationale is in
32
+ [media storage](docs/explanation/media-storage.md).
33
+
34
+ ## 0.57.1
35
+
36
+ Media polish and cutover DX, the first follow-on after the `0.57.0` media stack. The Media Library
37
+ gains the action feedback it lacked: a delete, a rename, and a commit conflict now land on a strip
38
+ that confirms the result or shows the error, instead of a silent page. With the detail slide-over open
39
+ and focus in the search box, Escape now clears the search and leaves the panel open, rather than doing
40
+ both at once. A frontmatter hero marked decorative persists that choice as an additive `decorative` key
41
+ on the `image` object, so a deliberately decorative hero stops reading as needs-alt after a reload (a
42
+ decorative body image still cannot persist the choice, since markdown alt text has no slot for it). The
43
+ reserved-`figure` build error now names the colliding component and points at the fix.
44
+
45
+ The rest is documentation. The public media resolver wiring moved into the required media setup steps
46
+ in both the upgrade guide and the wire-the-delivery guide, since a published `media:` token ships bare
47
+ without it. The reserved-`figure` collision is now a prominent breaking callout. A new
48
+ [content authoring syntax reference](docs/reference/authoring-syntax.md) documents the `cairn:` and
49
+ `media:` token schemes together. The guides now show the `wrangler.toml` binding dialect, the
50
+ `@glw907/cairn-cms/media` import path, the empty-`media.json` bootstrap, and the `.site-main` re-scope
51
+ for the figure placement CSS.
52
+
53
+ No consumer action is required. The `decorative` key is additive and optional, so existing content
54
+ parses and builds unchanged, and the feedback strip, the Escape fix, and the registry error message
55
+ are admin or build-time with no public surface change.
56
+
5
57
  ## 0.57.0
6
58
 
7
59
  Images become first-class. An editor can paste, drag, or insert an image straight into a post, and
@@ -93,6 +145,21 @@ default, so a site serves full-size bytes until it opts in. The wiring steps are
93
145
  in [the media reference](docs/reference/media.md) and
94
146
  [the sveltekit reference](docs/reference/sveltekit.md).
95
147
 
148
+ Consumers must also wire the public media resolver for any public image. The bucket, route, and
149
+ `assets` block make media work for the editor, but a published `![](media:...)` (a body image or a
150
+ frontmatter hero) ships a bare token to the live page unless the site threads a resolver into the
151
+ render path and `createPublicRoutes`. Build one with
152
+ `makeMediaResolver(mediaManifest, normalizeAssets({ bucketBinding: 'MEDIA_BUCKET' }))` from
153
+ `@glw907/cairn-cms/media`, where `mediaManifest` is the committed `src/content/.cairn/media.json`
154
+ (create it as `{}` on a fresh site so the import resolves). The
155
+ [upgrade guide](docs/guides/upgrade-cairn.md) gives the full snippet.
156
+
157
+ Breaking: `figure` is now a reserved directive name. `defineRegistry` throws if a site registers a
158
+ component named `figure`, which hard-fails both `cairn-manifest` and the build. A custom `figure` that
159
+ the engine's built-in figure now covers should be removed so the site adopts the engine's; a `figure`
160
+ that does something else should be renamed. Check too for any hand-authored `:::figure` block in your
161
+ content, which now renders as an engine figure.
162
+
96
163
  Recommended, not required: regenerate the content manifest (`cairn-manifest`) and commit it so the
97
164
  Media Library's `main` where-used is accurate. The `mediaRefs` field is additive, so a site builds
98
165
  without it, but an un-regenerated manifest reads every published media reference as absent until it