@sarimarcus/content-sites-ui 0.75.0 → 0.76.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 +8 -0
- package/package.json +2 -2
- package/src/editorial/MetaPlate.astro +72 -0
- package/src/editorial/index.ts +1 -0
- package/src/internal/labels.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All packages in the platform release in lockstep; entries are per release version.
|
|
4
4
|
|
|
5
|
+
## 0.76.0 (2026-11-19)
|
|
6
|
+
|
|
7
|
+
- New `MetaPlate` (`editorial`): an article meta line (desk, author, date or "Updated" date, reading minutes, source count, tags) with English and Italian labels. `variant="rail"` fits ArticlePage's `rail` slot: one wrapping line on mobile, one item per line from `lg`. It replaces curiosity-engineering-it's local copy, which `rewrite-imports.mjs --delete-local` removes at the pin bump (SLA-4358).
|
|
8
|
+
|
|
9
|
+
### Breaking
|
|
10
|
+
|
|
11
|
+
- `validate-no-recreate` refuses a site's local `components/home/MetaPlate.astro` from 0.76.0. curiosity-engineering-it runs `rewrite-imports.mjs --delete-local` (same props, so only the import changes), then `scripts/platform/migrations/meta-plate.mjs`, which asserts the move and writes nothing (SLA-4358).
|
|
12
|
+
|
|
5
13
|
## 0.75.0 (2026-11-18)
|
|
6
14
|
|
|
7
15
|
- No source change; lockstep release with the tourism What's on fixes (SLA-4349).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarimarcus/content-sites-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"description": "Universal Astro UI components, layout shell and design tokens shared by the content sites.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,6 +51,6 @@
|
|
|
51
51
|
"@lucide/astro": "^1.23.0",
|
|
52
52
|
"astro": "^7.0.6",
|
|
53
53
|
"tailwindcss": "^4.1.18",
|
|
54
|
-
"@sarimarcus/content-sites-core": "0.
|
|
54
|
+
"@sarimarcus/content-sites-core": "0.76.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
/**
|
|
3
|
+
* MetaPlate — an article's meta line: desk, author, date (or "Updated" date), reading minutes, source count, tags.
|
|
4
|
+
* `variant="rail"` is for ArticlePage's `rail` slot: one wrapping line on mobile, one item per line from lg.
|
|
5
|
+
* Items carry `data-k` so a site can style one (e.g. `[data-k="sources"]`).
|
|
6
|
+
*/
|
|
7
|
+
import { formatDisplayDay } from '@sarimarcus/content-sites-core/dates';
|
|
8
|
+
import { isUpdatedAfterPublication } from '@sarimarcus/content-sites-core/articles';
|
|
9
|
+
import { readingTime } from '@sarimarcus/content-sites-core/text';
|
|
10
|
+
import { getLabels } from '../internal/labels';
|
|
11
|
+
|
|
12
|
+
interface MetaPlateData {
|
|
13
|
+
author?: string;
|
|
14
|
+
category?: string;
|
|
15
|
+
tags?: readonly string[];
|
|
16
|
+
datePublished?: string;
|
|
17
|
+
dateModified?: string;
|
|
18
|
+
sections?: Parameters<typeof readingTime>[0]['sections'];
|
|
19
|
+
sources?: readonly unknown[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
/** The article's data, or its content collection entry. */
|
|
24
|
+
article: MetaPlateData | { data: MetaPlateData };
|
|
25
|
+
categoryLabels?: Readonly<Record<string, string>>;
|
|
26
|
+
tagLabels?: Readonly<Record<string, string>>;
|
|
27
|
+
locale?: string;
|
|
28
|
+
timeZone?: string;
|
|
29
|
+
/** How many tags to show (default none). */
|
|
30
|
+
tags?: number;
|
|
31
|
+
skip?: ReadonlyArray<'desk' | 'author' | 'sources'>;
|
|
32
|
+
variant?: 'inline' | 'rail';
|
|
33
|
+
class?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
article,
|
|
38
|
+
categoryLabels = {},
|
|
39
|
+
tagLabels = {},
|
|
40
|
+
locale = Astro.currentLocale && Astro.currentLocale !== 'en' ? Astro.currentLocale : 'en-GB',
|
|
41
|
+
timeZone = 'Europe/Madrid',
|
|
42
|
+
tags = 0,
|
|
43
|
+
skip = [],
|
|
44
|
+
variant = 'inline',
|
|
45
|
+
class: className,
|
|
46
|
+
} = Astro.props;
|
|
47
|
+
const d: MetaPlateData = 'data' in article ? article.data : article;
|
|
48
|
+
const l =getLabels(locale).metaPlate;
|
|
49
|
+
const updated = isUpdatedAfterPublication(d);
|
|
50
|
+
const iso = updated ? d.dateModified! : (d.datePublished ?? '');
|
|
51
|
+
const dateLabel = formatDisplayDay(iso, locale, timeZone);
|
|
52
|
+
const mins = d.sections ? readingTime({ sections: d.sections }) : 1;
|
|
53
|
+
const sources = d.sources?.length ?? 0;
|
|
54
|
+
const desk = d.category ? categoryLabels[d.category] : undefined;
|
|
55
|
+
const tagList = (d.tags ?? []).slice(0, tags).map((t) => tagLabels[t] ?? t);
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
<ul
|
|
59
|
+
class:list={[
|
|
60
|
+
'meta-plate m-0 p-0 list-none flex flex-wrap gap-x-4 gap-y-1 text-xs font-bold uppercase tracking-wider text-muted-foreground',
|
|
61
|
+
variant === 'rail' && 'lg:grid lg:gap-1.5',
|
|
62
|
+
className,
|
|
63
|
+
]}
|
|
64
|
+
data-meta-plate={variant}
|
|
65
|
+
>
|
|
66
|
+
{desk && !skip.includes('desk') && <li data-k="desk">{desk}</li>}
|
|
67
|
+
{d.author && !skip.includes('author') && <li data-k="author">{d.author}</li>}
|
|
68
|
+
{dateLabel && <li data-k="date"><time datetime={iso}>{updated ? `${l.updatedPrefix} ${dateLabel}` : dateLabel}</time></li>}
|
|
69
|
+
<li data-k="mins">{mins} {l.minutesSuffix}</li>
|
|
70
|
+
{sources > 0 && !skip.includes('sources') && <li data-k="sources">{sources} {l.sourcesSuffix}</li>}
|
|
71
|
+
{tagList.map((t) => <li data-k="tag">#{t}</li>)}
|
|
72
|
+
</ul>
|
package/src/editorial/index.ts
CHANGED
|
@@ -95,6 +95,7 @@ export type { ArticleHubSubTag } from './ArticleHubSection.astro';
|
|
|
95
95
|
export { default as ArticleTagPage } from './ArticleTagPage.astro';
|
|
96
96
|
export type { ArticleTagPill } from './ArticleTagPage.astro';
|
|
97
97
|
export { default as ShareButtons } from './ShareButtons.astro';
|
|
98
|
+
export { default as MetaPlate } from './MetaPlate.astro';
|
|
98
99
|
export { buildShareUrls } from './share';
|
|
99
100
|
export type { ShareUrlInput, ShareUrls } from './share';
|
|
100
101
|
export { default as ArticlePage } from './ArticlePage.astro';
|
package/src/internal/labels.ts
CHANGED
|
@@ -86,6 +86,7 @@ export const LABELS = {
|
|
|
86
86
|
articleFeatureCard: { readLabel: 'Read article', updatedLabel: 'Updated' },
|
|
87
87
|
articleEmbed: { playLabel: 'Play video', privacyNote: 'Loads YouTube when you play' },
|
|
88
88
|
articleCardGrid: { readLabel: 'Read', updatedLabel: 'Updated', minutesSuffix: 'min' },
|
|
89
|
+
metaPlate: { updatedPrefix: 'Updated', minutesSuffix: 'min', sourcesSuffix: 'sources' },
|
|
89
90
|
articleHubSection: { moreLabel: 'See all' },
|
|
90
91
|
articleTagPage: {
|
|
91
92
|
homeLabel: 'Home',
|
|
@@ -346,6 +347,7 @@ export const LABELS_IT: typeof LABELS = {
|
|
|
346
347
|
articleFeatureCard: { readLabel: 'Leggi l’articolo', updatedLabel: 'Aggiornato' },
|
|
347
348
|
articleEmbed: { playLabel: 'Riproduci il video', privacyNote: 'Carica YouTube quando lo riproduci' },
|
|
348
349
|
articleCardGrid: { readLabel: 'Leggi', updatedLabel: 'Aggiornato', minutesSuffix: 'min' },
|
|
350
|
+
metaPlate: { updatedPrefix: 'Agg.', minutesSuffix: 'min', sourcesSuffix: 'fonti' },
|
|
349
351
|
articleHubSection: { moreLabel: 'Vedi tutti' },
|
|
350
352
|
articleTagPage: {
|
|
351
353
|
homeLabel: 'Home',
|