@simmalugnt-se/payload-content-health 0.8.0 → 0.9.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,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0
4
+
5
+ - New check `media.video-description-missing` (Accessibility), turned on per collection with
6
+ `videoDescription`: a video without a description, its text alternative, in a language. Reads
7
+ `description` by default, as in `@simmalugnt-se/payload-mux`.
8
+
3
9
  ## 0.8.0
4
10
 
5
11
  - The editor assistant (0.15.0 or later, with `extensions: { "content-health": true }`) reads the
package/README.md CHANGED
@@ -27,6 +27,7 @@ Requires Payload `>=3.90.2 <4`, Next 16 and React 19. The widget uses Payload's
27
27
  collections: {
28
28
  pages: { seo: true },
29
29
  images: { altText: true },
30
+ videos: { videoDescription: true },
30
31
  },
31
32
  }),
32
33
  ];
@@ -41,6 +42,7 @@ Requires Payload `>=3.90.2 <4`, Next 16 and React 19. The widget uses Payload's
41
42
  | Check | Option | Finds |
42
43
  | --------------------------- | ------------------ | ---------------------------------------------- |
43
44
  | `media.alt-missing` | `altText` | Images (`image/*`) with an empty alt field |
45
+ | `media.video-description-missing` | `videoDescription` | Videos with an empty description (`description`, as in `@simmalugnt-se/payload-mux`) |
44
46
  | `seo.title-missing` | `seo` | Empty meta title |
45
47
  | `seo.title-length` | `seo` | Meta title outside 50–60 characters |
46
48
  | `seo.title-duplicate` | `seo` | Meta title another document also uses |
@@ -18,7 +18,7 @@ export const CATEGORY_CHECKS = {
18
18
  "links.broken",
19
19
  ],
20
20
  translations: ["content.untranslated"],
21
- accessibility: ["media.alt-missing"],
21
+ accessibility: ["media.alt-missing", "media.video-description-missing"],
22
22
  };
23
23
  export function categoryOf(check) {
24
24
  return CATEGORY_IDS.find((id) => CATEGORY_CHECKS[id].includes(check));
package/dist/checks.js CHANGED
@@ -18,6 +18,11 @@ export function rulesFor(options) {
18
18
  const field = (options.altText === true ? undefined : options.altText.field) ?? "alt";
19
19
  rules.push({ check: "media.alt-missing", kind: "required", path: field, imagesOnly: true });
20
20
  }
21
+ if (options.videoDescription) {
22
+ const field = (options.videoDescription === true ? undefined : options.videoDescription.field) ??
23
+ "description";
24
+ rules.push({ check: "media.video-description-missing", kind: "required", path: field });
25
+ }
21
26
  if (options.seo) {
22
27
  const seo = options.seo === true ? {} : options.seo;
23
28
  const title = seo.title ?? SEO_DEFAULTS.title;
package/dist/copy.js CHANGED
@@ -4,6 +4,7 @@ export function uiLanguage(adminLanguage) {
4
4
  export const CHECK_LABELS = {
5
5
  en: {
6
6
  "media.alt-missing": "Missing alt text",
7
+ "media.video-description-missing": "Missing video description",
7
8
  "seo.title-missing": "Missing meta title",
8
9
  "seo.title-length": "Meta title length",
9
10
  "seo.title-duplicate": "Duplicate meta title",
@@ -20,6 +21,7 @@ export const CHECK_LABELS = {
20
21
  },
21
22
  sv: {
22
23
  "media.alt-missing": "Alt-text saknas",
24
+ "media.video-description-missing": "Videobeskrivning saknas",
23
25
  "seo.title-missing": "Metatitel saknas",
24
26
  "seo.title-length": "Metatitelns längd",
25
27
  "seo.title-duplicate": "Dubblerad metatitel",
@@ -98,6 +100,7 @@ export const COPY = {
98
100
  export const ASK = {
99
101
  en: {
100
102
  "media.alt-missing": () => "Write an alt text for this image.",
103
+ "media.video-description-missing": () => "Write a description of this video for readers who cannot see it.",
101
104
  "seo.title-missing": ({ range }) => range
102
105
  ? `Write a meta title for this page, ${range.min}–${range.max} characters.`
103
106
  : "Write a meta title for this page.",
@@ -130,6 +133,7 @@ export const ASK = {
130
133
  },
131
134
  sv: {
132
135
  "media.alt-missing": () => "Skriv en alt-text för den här bilden.",
136
+ "media.video-description-missing": () => "Skriv en beskrivning av den här videon för den som inte kan se den.",
133
137
  "seo.title-missing": ({ range }) => range
134
138
  ? `Skriv en metatitel för den här sidan, ${range.min}–${range.max} tecken.`
135
139
  : "Skriv en metatitel för den här sidan.",
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const CHECK_IDS: readonly ["media.alt-missing", "seo.title-missing", "seo.title-length", "seo.title-duplicate", "seo.description-missing", "seo.description-length", "seo.description-duplicate", "seo.image-missing", "content.h1-missing", "content.h1-multiple", "content.heading-skip", "content.thin", "links.broken", "content.untranslated"];
1
+ export declare const CHECK_IDS: readonly ["media.alt-missing", "media.video-description-missing", "seo.title-missing", "seo.title-length", "seo.title-duplicate", "seo.description-missing", "seo.description-length", "seo.description-duplicate", "seo.image-missing", "content.h1-missing", "content.h1-multiple", "content.heading-skip", "content.thin", "links.broken", "content.untranslated"];
2
2
  export type CheckId = (typeof CHECK_IDS)[number];
3
3
  export type LengthRange = {
4
4
  min: number;
@@ -94,11 +94,20 @@ export type AltTextOptions = {
94
94
  /** Field holding the alt text. Default `alt`. */
95
95
  field?: string;
96
96
  };
97
+ export type VideoDescriptionOptions = {
98
+ /** Field holding the description. Default `description`, as in `@simmalugnt-se/payload-mux`. */
99
+ field?: string;
100
+ };
97
101
  export type CollectionHealthOptions = {
98
102
  /** SEO checks on the fields `@payloadcms/plugin-seo` adds, or the paths given here. */
99
103
  seo?: boolean | SeoOptions;
100
104
  /** Alt text on images in an upload collection. Files that are not images are skipped. */
101
105
  altText?: boolean | AltTextOptions;
106
+ /**
107
+ * A description on every video, its text alternative for readers who cannot see it, as an alt
108
+ * text is for an image. For a videos collection such as `@simmalugnt-se/payload-mux`'s.
109
+ */
110
+ videoDescription?: boolean | VideoDescriptionOptions;
102
111
  /** Heading structure and thin content, read from the page body. */
103
112
  content?: ContentOptions;
104
113
  /**
package/dist/types.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export const CHECK_IDS = [
2
2
  "media.alt-missing",
3
+ "media.video-description-missing",
3
4
  "seo.title-missing",
4
5
  "seo.title-length",
5
6
  "seo.title-duplicate",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simmalugnt-se/payload-content-health",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Content health checks and dashboard widgets for Payload Admin: alt texts, SEO fields and more",
5
5
  "keywords": [
6
6
  "payload",