@sonordev/contracts 2.7.0 → 2.7.1
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 +4 -0
- package/README.md +4 -0
- package/dist/editorial-media.js +1 -0
- package/dist/editorial-media.mjs +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.7.1
|
|
4
|
+
|
|
5
|
+
- Preserve article photo source identity during duplicate detection when a responsive image optimizer rewrites the displayed URL.
|
|
6
|
+
|
|
3
7
|
## 2.7.0
|
|
4
8
|
|
|
5
9
|
- Add `editorial-media`: shared section/takeaway text identities, article photo placement diagnostics, and source-image eligibility constants for APIs and site renderers.
|
package/README.md
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
The rules Sonor's sites, APIs and dashboard have to agree on, as one package.
|
|
4
4
|
Pure functions and types: no dependencies, no DOM, no network.
|
|
5
5
|
|
|
6
|
+
The `editorial-media` placement resolver recognizes an image's canonical
|
|
7
|
+
`data-sk-editorial-source` as well as its displayed `src`. Responsive image
|
|
8
|
+
delivery can change URLs without inserting the same approved photo twice.
|
|
9
|
+
|
|
6
10
|
```bash
|
|
7
11
|
pnpm add @sonordev/contracts
|
|
8
12
|
```
|
package/dist/editorial-media.js
CHANGED
|
@@ -57,6 +57,7 @@ function resolveArticlePhotoPlacements(html, photos = []) {
|
|
|
57
57
|
}
|
|
58
58
|
const attrs = attributes(tag);
|
|
59
59
|
if (name === "img" && attrs.has("src")) existing.add(attrs.get("src"));
|
|
60
|
+
if (name === "img" && attrs.has("data-sk-editorial-source")) existing.add(attrs.get("data-sk-editorial-source"));
|
|
60
61
|
if (name === "figure" && /^\d+$/.test(attrs.get("data-sk-editorial-photo") ?? "")) existingSlots.add(Number(attrs.get("data-sk-editorial-photo")));
|
|
61
62
|
if (voidElements.has(name) || /\/\s*>$/.test(tag)) continue;
|
|
62
63
|
stack.push({ name, start: token.index, inner: pattern.lastIndex, id: attrs.get("id"), eligible: !stack.some((frame) => excludedAncestors.has(frame.name)) });
|
package/dist/editorial-media.mjs
CHANGED
|
@@ -55,6 +55,7 @@ function resolveArticlePhotoPlacements(html, photos = []) {
|
|
|
55
55
|
}
|
|
56
56
|
const attrs = attributes(tag);
|
|
57
57
|
if (name === "img" && attrs.has("src")) existing.add(attrs.get("src"));
|
|
58
|
+
if (name === "img" && attrs.has("data-sk-editorial-source")) existing.add(attrs.get("data-sk-editorial-source"));
|
|
58
59
|
if (name === "figure" && /^\d+$/.test(attrs.get("data-sk-editorial-photo") ?? "")) existingSlots.add(Number(attrs.get("data-sk-editorial-photo")));
|
|
59
60
|
if (voidElements.has(name) || /\/\s*>$/.test(tag)) continue;
|
|
60
61
|
stack.push({ name, start: token.index, inner: pattern.lastIndex, id: attrs.get("id"), eligible: !stack.some((frame) => excludedAncestors.has(frame.name)) });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonordev/contracts",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, the forms honeypot, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics, the house voice's contraction rule, how a proposal's site plan counts its pages, what separates an error page from a page's content, which stored JSON-LD is a template's unfilled placeholder, where prose splits into sentences, and which Sonor records Signal reads into a project's knowledge and the address each one is stored under. Pure functions, no dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|