@haruhimemoe/ui 0.5.0 → 0.5.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
CHANGED
|
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.5.1] - 2026-09-28
|
|
10
|
+
|
|
11
|
+
### Security
|
|
12
|
+
|
|
13
|
+
- `JsonLd` also escapes `>`, `&`, U+2028 and U+2029 as JSON unicode escapes, not only `<`. The data parses back unchanged.
|
|
14
|
+
|
|
9
15
|
## [0.5.0] - 2026-09-28
|
|
10
16
|
|
|
11
17
|
### Added
|
|
@@ -86,7 +92,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
86
92
|
- `className` on every component, and the extras passed to `buttonClasses` and `fieldClasses`, merge with tailwind-merge: a caller's class replaces a built-in one that sets the same property (`fieldClasses("w-auto")` drops `w-full`).
|
|
87
93
|
- Shell: `SiteHeader` (brand slot, nav links as data with `aria-current`, actions slot), `NavLinks`, `SiteFooter` (link columns as data, fine print, the haruhime.moe wordmark and a GitHub link) and `PageShell` (skip link, header, main, footer).
|
|
88
94
|
|
|
89
|
-
[unreleased]: https://github.com/haruhimemoe/ui/compare/v0.5.
|
|
95
|
+
[unreleased]: https://github.com/haruhimemoe/ui/compare/v0.5.1...HEAD
|
|
96
|
+
[0.5.1]: https://github.com/haruhimemoe/ui/compare/v0.5.0...v0.5.1
|
|
90
97
|
[0.5.0]: https://github.com/haruhimemoe/ui/compare/v0.4.0...v0.5.0
|
|
91
98
|
[0.4.0]: https://github.com/haruhimemoe/ui/compare/v0.3.0...v0.4.0
|
|
92
99
|
[0.3.0]: https://github.com/haruhimemoe/ui/compare/v0.2.0...v0.3.0
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @file src/components/meta/JsonLd.tsx
|
|
3
|
-
* @desc schema.org structured data as a JSON-LD script tag.
|
|
4
|
-
*
|
|
3
|
+
* @desc schema.org structured data as a JSON-LD script tag. "<", ">", "&" and the line and
|
|
4
|
+
* paragraph separators (U+2028, U+2029) are written as JSON escapes, so no string in the
|
|
5
|
+
* data (a user-supplied name, say) can close the tag, open a comment or break the script.
|
|
5
6
|
* @author David @dvhsh (https://dvh.sh)
|
|
6
7
|
* @created Wed Sep 23, 2026
|
|
7
8
|
* @modified Mon Sep 28, 2026
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** Characters written as JSON unicode escapes inside the script tag. */
|
|
3
|
+
const UNSAFE = /[<>&\u2028\u2029]/g;
|
|
2
4
|
/**
|
|
3
5
|
* @function jsonLdString
|
|
4
6
|
* @param data {Record<string, unknown>} a schema.org object
|
|
5
|
-
* @returns {string} JSON with `@context` added and
|
|
7
|
+
* @returns {string} JSON with `@context` added and "<", ">", "&", U+2028 and U+2029 written as
|
|
8
|
+
* `\uXXXX` escapes (still the same JSON once parsed)
|
|
6
9
|
*/
|
|
7
|
-
const jsonLdString = (data) => JSON.stringify({ "@context": "https://schema.org", ...data }).replace(
|
|
10
|
+
const jsonLdString = (data) => JSON.stringify({ "@context": "https://schema.org", ...data }).replace(UNSAFE, (char) => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
8
11
|
/**
|
|
9
12
|
* @function JsonLd
|
|
10
13
|
* @param props {JsonLdProps} the schema.org data, plus native script props
|
|
@@ -12,6 +15,6 @@ const jsonLdString = (data) => JSON.stringify({ "@context": "https://schema.org"
|
|
|
12
15
|
*/
|
|
13
16
|
export function JsonLd({ data, ...props }) {
|
|
14
17
|
return (_jsx("script", { ...props, type: "application/ld+json",
|
|
15
|
-
// biome-ignore lint/security/noDangerouslySetInnerHtml: JSON-LD must be raw JSON; jsonLdString escapes
|
|
18
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: JSON-LD must be raw JSON; jsonLdString escapes the unsafe characters.
|
|
16
19
|
dangerouslySetInnerHTML: { __html: jsonLdString(data) } }));
|
|
17
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haruhimemoe/ui",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "React components for the haruhime.moe osu! tools on Next.js: the osu!-web-style palette as a Tailwind theme, buttons, cards, form fields and confirms, filter controls, tables, osu! beatmap display pieces and the site header and footer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|