feat: complete CHRNX responsive content states

This commit is contained in:
chrnx committed 2026-08-12 08:42:20 -05:00
1 parent 9385c1b9fb
commit 5073178492
60 files changed
+1699 -22

No files matched your search

+31
View File
@@ -33,6 +33,37 @@ Run the configuration smoke test with:
npm run test:smoke
```
## Local visual review
Seed the local `wp-env` site with deterministic review content:
```sh
./scripts/seed-test-content.sh
```
The script accepts only `localhost` or `127.0.0.1`. It updates records marked
with `_chrnx_fixture_key` and leaves unrelated local content alone. Repeated
runs reuse the same pages and posts.
Rebuild the responsive portrait derivatives on macOS with `sips`, `cwebp`, and
`avifenc`:
```sh
./scripts/build-responsive-images.sh
```
The PNG masters remain unchanged. WordPress serves 384 px and 768 px AVIF or
WebP sources, with the PNG as a fallback.
Capture the approved local review routes with Chromium:
```sh
node scripts/capture-visual-review.mjs
```
The capture script rejects public hosts and writes its screenshots to
`tmp/imagegen/`, which Git ignores.
Use `npm run env:stop` to stop the local WordPress environment.
If Homebrew's Docker CLI cannot find an existing standalone Compose v2 binary,
+849
View File
@@ -0,0 +1,849 @@
/*
* Theme-state and responsive component variants intentionally follow
* their base rules.
*/
/* stylelint-disable no-descending-specificity */
:root {
--chrnx-bg: #0d1117;
--chrnx-surface: #151b23;
--chrnx-surface-raised: #1b222c;
--chrnx-text: #e6edf3;
--chrnx-muted: #a1acb8;
--chrnx-line: rgb(139 148 158 / 28%);
--chrnx-accent: #7c6cf0;
--chrnx-accent-soft: rgb(124 108 240 / 16%);
--chrnx-green: #69c795;
--chrnx-link: #a99df8;
--chrnx-shadow: 0 1.5rem 4rem rgb(0 0 0 / 24%);
--chrnx-radius: 1.25rem;
}
html[data-theme="light"] {
--chrnx-bg: #f6f2e9;
--chrnx-surface: #fffdf7;
--chrnx-surface-raised: #fff;
--chrnx-text: #25221f;
--chrnx-muted: #625c54;
--chrnx-line: rgb(70 61 51 / 18%);
--chrnx-accent: #674ca4;
--chrnx-accent-soft: rgb(103 76 164 / 12%);
--chrnx-green: #327854;
--chrnx-link: #60408e;
--chrnx-shadow: 0 1.5rem 4rem rgb(70 61 51 / 12%);
}
@media (prefers-color-scheme: light) {
:root:not([data-theme]) {
--chrnx-bg: #f6f2e9;
--chrnx-surface: #fffdf7;
--chrnx-surface-raised: #fff;
--chrnx-text: #25221f;
--chrnx-muted: #625c54;
--chrnx-line: rgb(70 61 51 / 18%);
--chrnx-accent: #674ca4;
--chrnx-accent-soft: rgb(103 76 164 / 12%);
--chrnx-green: #327854;
--chrnx-link: #60408e;
--chrnx-shadow: 0 1.5rem 4rem rgb(70 61 51 / 12%);
}
}
body {
background-color: var(--chrnx-bg);
background-image:
radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--chrnx-accent) 14%, transparent), transparent 34rem),
linear-gradient(var(--chrnx-line) 1px, transparent 1px),
linear-gradient(90deg, var(--chrnx-line) 1px, transparent 1px);
background-position: 0 0, center, center;
background-size: auto, 3rem 3rem, 3rem 3rem;
color: var(--chrnx-text);
}
.wp-site-blocks {
overflow: clip;
}
.wp-site-blocks > main {
margin-block-start: 0;
}
main a,
footer a {
color: var(--chrnx-link);
text-underline-offset: 0.2em;
text-decoration-thickness: 0.08em;
}
.chrnx-primary-navigation a,
.chrnx-footer-navigation a {
color: var(--chrnx-link);
}
.wp-site-blocks h1,
.wp-site-blocks h2,
.wp-site-blocks h3,
.wp-site-blocks h4 {
color: var(--chrnx-text);
text-wrap: balance;
}
.wp-site-blocks p,
.wp-site-blocks li {
text-wrap: pretty;
}
.chrnx-home > section,
.chrnx-home > .wp-block-group,
.chrnx-home > .wp-block-chrnx-featured-stories,
.chrnx-home > .wp-block-chrnx-journal-stream,
.chrnx-home > .wp-block-chrnx-latest-podcast {
max-width: var(--wp--style--global--wide-size);
margin-inline: auto;
padding-block: clamp(3.5rem, 7vw, 7rem);
}
.chrnx-home > * + * {
border-top: 1px solid var(--chrnx-line);
}
.chrnx-home-intro {
position: relative;
display: grid;
min-height: min(74vh, 48rem);
align-content: center;
padding-right: clamp(0rem, 15vw, 12rem);
}
.chrnx-home-intro::before {
display: block;
margin-bottom: 1.25rem;
color: var(--chrnx-green);
content: "CHR/NX · NIGHT WORKSHOP";
font-family: var(--wp--preset--font-family--metadata);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.16em;
}
.chrnx-home-intro::after {
position: absolute;
right: 2%;
bottom: 14%;
width: clamp(5rem, 11vw, 8.5rem);
aspect-ratio: 1;
border: 1px solid var(--chrnx-line);
border-radius: 50%;
box-shadow: inset 0 0 0 1.25rem var(--chrnx-accent-soft);
content: "";
}
.chrnx-home-intro h1 {
max-width: 13ch;
margin: 0;
font-size: var(--wp--preset--font-size--display);
letter-spacing: -0.035em;
}
.chrnx-home-intro p {
max-width: 58ch;
margin-top: 1.5rem;
color: var(--chrnx-muted);
font-size: var(--wp--preset--font-size--large);
}
.chrnx-featured-stories > h2,
.chrnx-journal-stream > h2,
.chrnx-home-projects > h2,
.chrnx-home-music h2,
.chrnx-home-about-preview h2 {
font-size: var(--wp--preset--font-size--x-large);
}
.chrnx-featured-stories__grid {
align-items: stretch;
margin-top: 2rem;
}
.chrnx-featured-story,
.chrnx-journal-card,
.chrnx-podcast-card,
.chrnx-related-card,
.chrnx-release-card {
position: relative;
overflow: hidden;
border: 1px solid var(--chrnx-line);
border-radius: var(--chrnx-radius);
background: color-mix(in srgb, var(--chrnx-surface) 92%, transparent);
box-shadow: 0 0.5rem 2rem rgb(0 0 0 / 8%);
}
.chrnx-featured-story__link,
.chrnx-journal-card__link,
.chrnx-podcast-card__link,
.chrnx-related-card__link {
color: inherit;
text-decoration: none;
}
.chrnx-featured-story__link:hover,
.chrnx-journal-card__link:hover,
.chrnx-podcast-card__link:hover,
.chrnx-related-card__link:hover {
color: inherit;
}
.chrnx-featured-story__content,
.chrnx-journal-card__content,
.chrnx-podcast-card__content,
.chrnx-related-card__content {
display: grid;
gap: 0.75rem;
padding: clamp(1.25rem, 2.5vw, 2rem);
}
.chrnx-featured-story__badge,
.chrnx-journal-card__badge,
.chrnx-podcast-card__badge,
.chrnx-related-card__badge,
.chrnx-page-kicker {
color: var(--chrnx-green);
font-family: var(--wp--preset--font-family--metadata);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.12em;
text-transform: uppercase;
}
.chrnx-featured-story__title,
.chrnx-journal-card__title,
.chrnx-podcast-card__title,
.chrnx-related-card__title {
margin: 0;
font-size: var(--wp--preset--font-size--large);
}
.chrnx-featured-story__excerpt,
.chrnx-journal-card__excerpt,
.chrnx-podcast-card__excerpt,
.chrnx-related-card__excerpt {
color: var(--chrnx-muted);
}
.chrnx-featured-story__fallback,
.chrnx-journal-card__fallback,
.chrnx-related-card__fallback {
background-color: var(--chrnx-surface-raised);
background-image:
linear-gradient(145deg, transparent 0 48%, color-mix(in srgb, var(--chrnx-green) 35%, transparent) 49% 51%, transparent 52%),
radial-gradient(circle at 76% 24%, var(--chrnx-accent-soft) 0 14%, transparent 15%);
}
.chrnx-featured-story__fallback,
.chrnx-journal-card__fallback,
.chrnx-podcast-card__fallback,
.chrnx-related-card__fallback {
background-position: right bottom;
background-repeat: no-repeat;
background-size: auto 125%;
}
.chrnx-featured-story__fallback.is-topic-code,
.chrnx-journal-card__fallback.is-topic-code,
.chrnx-related-card__fallback.is-topic-code {
background-image: url(../images/generated/alter-ego-code-384.webp);
}
.chrnx-featured-story__fallback.is-topic-research,
.chrnx-journal-card__fallback.is-topic-research,
.chrnx-related-card__fallback.is-topic-research {
background-image: url(../images/generated/alter-ego-research-384.webp);
}
.chrnx-featured-story__fallback.is-topic-gaming,
.chrnx-journal-card__fallback.is-topic-gaming,
.chrnx-related-card__fallback.is-topic-gaming {
background-image: url(../images/generated/alter-ego-gaming-384.webp);
}
.chrnx-featured-story__fallback.is-topic-literature,
.chrnx-journal-card__fallback.is-topic-literature,
.chrnx-related-card__fallback.is-topic-literature {
background-image: url(../images/generated/alter-ego-literature-384.webp);
}
.chrnx-featured-story__fallback.is-topic-life,
.chrnx-journal-card__fallback.is-topic-life,
.chrnx-related-card__fallback.is-topic-life {
background-image: url(../images/generated/alter-ego-life-384.webp);
}
.chrnx-featured-story__fallback.is-topic-podcasts,
.chrnx-journal-card__fallback.is-topic-podcasts,
.chrnx-podcast-card__fallback.is-topic-podcasts,
.chrnx-related-card__fallback.is-topic-podcasts {
background-color: #10151d;
background-image: url(../images/generated/alter-ego-podcasts-384.webp);
}
.chrnx-featured-story__fallback.is-topic-music,
.chrnx-journal-card__fallback.is-topic-music,
.chrnx-related-card__fallback.is-topic-music {
background-color: #160f0b;
background-image: url(../images/generated/the-no-names-musician-cutout-384.webp);
}
.chrnx-journal-stream__filters {
align-items: end;
margin-block: 2rem;
padding: 1rem;
border: 1px solid var(--chrnx-line);
border-radius: 0.75rem;
background: var(--chrnx-surface);
}
.chrnx-journal-stream__filters label {
min-width: min(100%, 11rem);
color: var(--chrnx-muted);
font-family: var(--wp--preset--font-family--metadata);
font-size: var(--wp--preset--font-size--small);
}
.chrnx-journal-stream__filters input,
.chrnx-journal-stream__filters select {
min-height: 45px;
padding: 0.6rem 0.75rem;
border: 1px solid var(--chrnx-line);
border-radius: 0.4rem;
background: var(--chrnx-bg);
color: var(--chrnx-text);
}
.chrnx-journal-stream__filters button,
.chrnx-subscribe-cta a {
min-height: 45px;
padding: 0.7rem 1.1rem;
border: 0;
border-radius: 999px;
background: var(--chrnx-green);
color: var(--chrnx-bg);
font-weight: 700;
text-decoration: none;
}
.chrnx-journal-stream__list {
grid-template-columns: repeat(2, minmax(0, 1fr));
margin: 0;
}
.chrnx-journal-stream__list > li {
min-width: 0;
}
.chrnx-journal-card__link {
display: grid;
grid-template-columns: minmax(7rem, 0.45fr) minmax(0, 1fr);
height: 100%;
}
.chrnx-journal-card__fallback,
.chrnx-journal-card__image {
height: 100%;
min-height: 13rem;
object-fit: cover;
}
.chrnx-home-projects {
position: relative;
isolation: isolate;
min-height: 38rem;
overflow: hidden;
border-radius: calc(var(--chrnx-radius) * 1.5);
background:
linear-gradient(125deg, var(--chrnx-surface) 0 58%, transparent 58%),
radial-gradient(circle at 80% 35%, var(--chrnx-accent-soft), transparent 48%);
}
.chrnx-home-projects > h2,
.chrnx-home-projects > .wp-block-columns {
position: relative;
z-index: 2;
max-width: 62%;
}
.chrnx-home-projects .wp-block-columns {
display: grid;
gap: 0;
grid-template-columns: 1fr;
border-top: 1px solid var(--chrnx-line);
}
.chrnx-home-projects .wp-block-column {
padding-block: 1.25rem;
border-bottom: 1px solid var(--chrnx-line);
}
.chrnx-home-projects .wp-block-column h3 {
margin: 0;
}
.chrnx-responsive-portrait {
display: block;
}
.chrnx-section-portrait {
display: block;
width: 100%;
height: auto;
filter: drop-shadow(0 2rem 2rem rgb(0 0 0 / 28%));
}
.chrnx-home-projects > .chrnx-responsive-portrait {
position: absolute;
z-index: 1;
right: -2rem;
bottom: 0;
width: min(43%, 25rem);
}
.chrnx-home-projects > .chrnx-responsive-portrait:last-child {
z-index: 0;
right: 22%;
width: min(30%, 17rem);
opacity: 0.3;
filter: saturate(0.6);
}
.chrnx-home-music .wp-block-columns {
position: relative;
overflow: hidden;
min-height: 34rem;
padding: clamp(2rem, 6vw, 5rem);
border: 1px solid rgb(197 88 35 / 35%);
border-radius: calc(var(--chrnx-radius) * 1.5);
background:
linear-gradient(110deg, rgb(13 17 23 / 98%) 0 45%, rgb(13 17 23 / 30%) 70%),
linear-gradient(145deg, #54260f, #0d1117 75%);
color: #e6edf3;
}
.chrnx-home-music h2 {
color: #e6edf3;
}
.chrnx-home-music p {
color: #c6ced7;
}
html[data-theme="light"] .chrnx-home-music h2,
html[data-theme="light"] .chrnx-home-music p {
color: #e6edf3;
}
@media (prefers-color-scheme: light) {
:root:not([data-theme]) .chrnx-home-music h2,
:root:not([data-theme]) .chrnx-home-music p {
color: #e6edf3;
}
}
.chrnx-home-music .wp-block-column:first-child {
position: relative;
z-index: 2;
}
.chrnx-home-music .wp-block-column:last-child {
align-self: end;
}
.chrnx-home-music .chrnx-responsive-portrait {
width: min(100%, 29rem);
margin: auto auto -5rem;
}
.chrnx-latest-podcast {
position: relative;
}
.chrnx-latest-podcast::before {
display: block;
margin-bottom: 1.5rem;
color: var(--chrnx-green);
content: "LATEST CONVERSATION";
font-family: var(--wp--preset--font-family--metadata);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.12em;
}
.chrnx-podcast-card__link {
display: block;
padding: clamp(1.5rem, 4vw, 3rem);
}
.chrnx-home-about-preview,
.chrnx-subscribe-cta {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: end;
gap: 2rem;
}
.chrnx-home-about-preview p,
.chrnx-subscribe-cta p {
max-width: 58ch;
color: var(--chrnx-muted);
}
.chrnx-entry,
.chrnx-archive,
.chrnx-search,
.chrnx-not-found {
padding-block: clamp(3.5rem, 7vw, 7rem);
}
.chrnx-entry > h1,
.chrnx-archive > h1,
.chrnx-search > h1,
.chrnx-not-found > h1 {
font-size: var(--wp--preset--font-size--display);
letter-spacing: -0.035em;
}
.chrnx-entry--page > .wp-block-post-title,
.chrnx-archive > .wp-block-query-title {
width: min(100%, var(--wp--style--global--content-size));
margin-inline: auto;
color: var(--chrnx-green);
font-family: var(--wp--preset--font-family--metadata);
font-size: var(--wp--preset--font-size--small);
letter-spacing: 0.14em;
text-transform: uppercase;
}
.chrnx-entry__meta {
padding-block: 1rem;
border-block: 1px solid var(--chrnx-line);
color: var(--chrnx-muted);
}
.chrnx-entry pre {
overflow-x: auto;
padding: 1.25rem;
border: 1px solid var(--chrnx-line);
border-radius: 0.75rem;
background: #090c10;
color: #d9e7df;
font-size: 0.9rem;
}
.chrnx-topic-hero {
display: grid;
min-height: 30rem;
grid-template-columns: minmax(0, 1fr) minmax(15rem, 0.65fr);
align-items: end;
overflow: hidden;
margin-bottom: 3rem;
border: 1px solid var(--chrnx-line);
border-radius: calc(var(--chrnx-radius) * 1.5);
background: linear-gradient(135deg, var(--chrnx-surface), var(--chrnx-accent-soft));
}
.chrnx-topic-hero__content {
padding: clamp(2rem, 6vw, 5rem);
}
.chrnx-topic-hero__title {
margin: 0;
font-size: var(--wp--preset--font-size--display);
}
.chrnx-topic-hero__art {
align-self: end;
}
.chrnx-topic-hero__art .chrnx-section-portrait {
max-height: 34rem;
object-fit: contain;
object-position: bottom;
}
.chrnx-music-landing,
.chrnx-podcast-landing,
.chrnx-about {
position: relative;
}
.chrnx-music-landing > h2,
.chrnx-podcast-landing > h2,
.chrnx-about > h2 {
font-size: var(--wp--preset--font-size--display);
}
.chrnx-music-landing__art {
display: grid;
grid-template-columns: minmax(0, 1.25fr) minmax(15rem, 0.75fr);
overflow: hidden;
margin-block: 3rem;
border-radius: calc(var(--chrnx-radius) * 1.5);
background: #15100d;
}
.chrnx-music-landing__art > img {
width: 100%;
height: 100%;
max-height: 40rem;
object-fit: cover;
}
.chrnx-music-landing__art .chrnx-responsive-portrait {
align-self: end;
}
.chrnx-music-landing__portrait {
max-height: 38rem;
object-fit: contain;
object-position: bottom;
}
.chrnx-release-list {
display: grid;
gap: 1rem;
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.chrnx-release-card {
padding: 1.5rem;
}
.chrnx-podcast-landing > .chrnx-responsive-portrait {
float: right;
width: min(45%, 24rem);
margin: -7rem 0 2rem 2rem;
}
.chrnx-podcast-landing [data-type="core/group"]:empty,
.chrnx-podcast-landing > .wp-block-group:empty,
.chrnx-podcast-show > .wp-block-group:empty {
display: none;
}
.chrnx-about__portraits {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
align-items: end;
overflow: hidden;
margin-block: 2rem 3rem;
border: 1px solid var(--chrnx-line);
border-radius: calc(var(--chrnx-radius) * 1.5);
background: linear-gradient(145deg, var(--chrnx-surface), var(--chrnx-accent-soft));
}
.chrnx-about__portraits .chrnx-responsive-portrait {
min-width: 0;
margin: 0 -14%;
}
.chrnx-about__portraits .chrnx-responsive-portrait:first-child {
margin-left: 0;
}
.chrnx-about__portraits .chrnx-responsive-portrait:last-child {
margin-right: 0;
}
.chrnx-about__portraits .chrnx-section-portrait {
max-height: 24rem;
object-fit: contain;
object-position: bottom;
}
.chrnx-journal-stream__empty,
.chrnx-not-found .wp-block-search,
.chrnx-search .wp-block-query-no-results {
padding: 2rem;
border: 1px dashed var(--chrnx-line);
border-radius: var(--chrnx-radius);
background: var(--chrnx-surface);
}
.chrnx-journal-stream__pagination a,
.chrnx-journal-stream__pagination span {
display: inline-flex;
min-width: 45px;
min-height: 45px;
align-items: center;
justify-content: center;
border: 1px solid var(--chrnx-line);
border-radius: 50%;
}
.chrnx-journal-stream__pagination .current {
background: var(--chrnx-green);
color: var(--chrnx-bg);
}
@media (hover: hover) {
.chrnx-featured-story,
.chrnx-journal-card,
.chrnx-podcast-card,
.chrnx-related-card {
transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.chrnx-featured-story:hover,
.chrnx-journal-card:hover,
.chrnx-podcast-card:hover,
.chrnx-related-card:hover {
border-color: color-mix(in srgb, var(--chrnx-green) 62%, var(--chrnx-line));
box-shadow: var(--chrnx-shadow);
transform: translateY(-0.25rem);
}
}
@media (max-width: 900px) {
.chrnx-journal-stream__list,
.chrnx-release-list {
grid-template-columns: 1fr;
}
.chrnx-home-projects > h2,
.chrnx-home-projects > .wp-block-columns {
max-width: 70%;
}
.chrnx-topic-hero {
grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.6fr);
}
}
@media (max-width: 599px) {
body {
background-size: auto, 2rem 2rem, 2rem 2rem;
}
.chrnx-home > section,
.chrnx-home > .wp-block-group,
.chrnx-home > .wp-block-chrnx-featured-stories,
.chrnx-home > .wp-block-chrnx-journal-stream,
.chrnx-home > .wp-block-chrnx-latest-podcast {
padding-block: 3.5rem;
}
.chrnx-home-intro {
min-height: 38rem;
padding-right: 0;
}
.chrnx-home-intro::after {
display: none;
}
.chrnx-journal-stream__filters,
.chrnx-home-about-preview,
.chrnx-subscribe-cta {
display: grid;
grid-template-columns: 1fr;
}
.chrnx-journal-stream__filters label,
.chrnx-journal-stream__filters input,
.chrnx-journal-stream__filters select,
.chrnx-journal-stream__filters button {
width: 100%;
}
.chrnx-journal-card__link {
grid-template-columns: 1fr;
}
.chrnx-journal-card__fallback,
.chrnx-journal-card__image {
min-height: 10rem;
}
.chrnx-home-projects {
min-height: 42rem;
padding-inline: 1.5rem;
}
.chrnx-home-projects > h2,
.chrnx-home-projects > .wp-block-columns {
max-width: 100%;
}
.chrnx-home-projects > .chrnx-responsive-portrait {
right: -3rem;
width: min(72%, 21rem);
}
.chrnx-home-projects > .chrnx-responsive-portrait:last-child {
display: none;
}
.chrnx-home-music .wp-block-columns {
padding: 2rem 1.5rem 0;
}
.chrnx-topic-hero {
min-height: 36rem;
grid-template-columns: 1fr;
}
.chrnx-topic-hero__art {
width: min(88%, 24rem);
margin: -4rem auto 0;
}
.chrnx-music-landing__art {
grid-template-columns: 1fr;
}
.chrnx-music-landing__art > img {
max-height: 24rem;
}
.chrnx-podcast-landing > .chrnx-responsive-portrait {
float: none;
width: min(85%, 22rem);
margin: 0 auto 2rem;
}
.chrnx-about__portraits {
grid-template-columns: repeat(3, 70%);
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.chrnx-about__portraits .chrnx-responsive-portrait {
margin: 0;
scroll-snap-align: center;
}
}
@media (prefers-reduced-motion: reduce) {
.chrnx-featured-story,
.chrnx-journal-card,
.chrnx-podcast-card,
.chrnx-related-card {
transition: none;
}
.chrnx-featured-story:hover,
.chrnx-journal-card:hover,
.chrnx-podcast-card:hover,
.chrnx-related-card:hover {
transform: none;
}
.chrnx-about__portraits {
scroll-behavior: auto;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-code.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-gaming.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-life.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-literature.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-podcasts.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

@@ -0,0 +1,5 @@
{
"source": "alter-ego-research.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

@@ -0,0 +1,5 @@
{
"source": "the-no-names-musician-cutout.png",
"formats": [ "avif", "webp" ],
"widths": [ 384, 768 ]
}
+1 -1
View File
@@ -25,7 +25,7 @@ $chrnx_label = $chrnx_term instanceof WP_Term ? $chrnx_term->name : ucfirst( $
</div>
<div class="chrnx-topic-hero__art">
<?php if ( is_readable( get_theme_file_path( $chrnx_asset ) ) ) : ?>
<img src="<?php echo esc_url( get_theme_file_uri( $chrnx_asset ) ); ?>" width="<?php echo esc_attr( $chrnx_size[0] ); ?>" height="<?php echo esc_attr( $chrnx_size[1] ); ?>" loading="lazy" decoding="async" alt="" aria-hidden="true">
<?php echo chrnx_get_topic_portrait_markup( $chrnx_topic, '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
<?php else : ?>
<span class="chrnx-topic-hero__fallback" aria-hidden="true"></span>
<?php endif; ?>
+1 -1
View File
@@ -2,7 +2,7 @@
define( 'CHRNX_VERSION', '0.1.0' );
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'settings', 'queries', 'blocks', 'theme-preference' ) as $module ) {
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$path = get_theme_file_path( "inc/{$module}.php" );
if ( file_exists( $path ) ) {
+6
View File
@@ -21,5 +21,11 @@ function chrnx_enqueue_assets() {
array( 'chrnx-base' ),
CHRNX_VERSION
);
wp_enqueue_style(
'chrnx-components',
get_theme_file_uri( 'assets/css/components.css' ),
array( 'chrnx-layout' ),
CHRNX_VERSION
);
}
add_action( 'wp_enqueue_scripts', 'chrnx_enqueue_assets' );
+38
View File
@@ -0,0 +1,38 @@
<?php
/**
* Responsive theme-owned media helpers.
*
* @package CHRNX
*/
/**
* Render an allowlisted topic portrait using modern derivatives and a PNG fallback.
*
* @param string $topic_slug Topic slug.
* @param string $alt Alternative text. Empty is valid for decorative art.
* @param string $class_name Optional image class.
* @return string Safe picture markup or an empty string.
*/
function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '', string $class_name = '' ): string {
$source = chrnx_get_topic_art_asset( $topic_slug );
$dimensions = chrnx_get_topic_art_dimensions( $topic_slug );
if ( '' === $source || 2 !== count( $dimensions ) ) {
return '';
}
$basename = pathinfo( $source, PATHINFO_FILENAME );
$base_uri = get_theme_file_uri( 'assets/images/generated/' . $basename );
$sizes = '(max-width: 599px) 70vw, 384px';
$split_classes = preg_split( '/\s+/', trim( $class_name ) );
$classes = is_array( $split_classes ) ? array_filter( $split_classes ) : array();
$class = implode( ' ', array_map( 'sanitize_html_class', $classes ) );
$decorative = '' === $alt ? ' aria-hidden="true"' : '';
$markup = '<picture class="chrnx-responsive-portrait"' . $decorative . '>';
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w" sizes="' . esc_attr( $sizes ) . '">';
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( get_theme_file_uri( $source ) ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="lazy" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
$markup .= '</picture>';
return $markup;
}
+7
View File
@@ -12,6 +12,13 @@ $chrnx_research_url = esc_url( 'https://arxiv.org/abs/2603.05352' );
?>
<!-- wp:group {"tagName":"section","className":"chrnx-about","layout":{"type":"constrained","contentSize":"70ch"}} -->
<section class="wp-block-group chrnx-about">
<!-- wp:group {"className":"chrnx-about__portraits","layout":{"type":"flex","flexWrap":"wrap"}} -->
<div class="wp-block-group chrnx-about__portraits">
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'life', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'literature', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'gaming', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
</div>
<!-- /wp:group -->
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading"><?php echo esc_html__( 'About', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:paragraph --><p><?php echo esc_html__( 'I work as Lead Developer @Expressive Tea, building full-stack software with JavaScript and Python. I am also an independent researcher exploring emotion modeling and game AI; my practice includes open source work and amateur data science.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
<!-- wp:paragraph --><p><?php echo esc_html__( 'I am a published researcher. My current paper is available on', 'chrnx' ); ?> <a href="<?php echo $chrnx_research_url; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped at assignment. ?>" target="_blank" rel="noopener noreferrer external"><?php echo esc_html__( 'arXiv:2603.05352', 'chrnx' ); ?></a>.</p><!-- /wp:paragraph -->
+1 -2
View File
@@ -8,7 +8,6 @@
*
* @package CHRNX
*/
$chrnx_home_music_art = get_theme_file_uri( 'assets/images/the-no-names-musician-cutout.png' );
?>
<!-- wp:group {"tagName":"section","className":"chrnx-home-music","layout":{"type":"constrained"}} -->
<section class="wp-block-group chrnx-home-music">
@@ -20,7 +19,7 @@ $chrnx_home_music_art = get_theme_file_uri( 'assets/images/the-no-names-musician
<!-- wp:paragraph --><p><?php echo esc_html__( 'Un proyecto de banda activo hecho en Sinaloa: estudio crudo, cero live.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
</div><!-- /wp:column -->
<!-- wp:column {"verticalAlignment":"center"} --><div class="wp-block-column is-vertically-aligned-center">
<!-- wp:html --><img class="chrnx-home-music__art" src="<?php echo esc_url( $chrnx_home_music_art ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="<?php echo esc_attr__( 'The No Names musician portrait', 'chrnx' ); ?>"><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'music', __( 'The No Names musician portrait', 'chrnx' ), 'chrnx-home-music__art' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
</div><!-- /wp:column -->
</div>
<!-- /wp:columns -->
+2
View File
@@ -11,6 +11,7 @@
?>
<!-- wp:group {"tagName":"section","className":"chrnx-home-projects","layout":{"type":"constrained"}} -->
<section class="wp-block-group chrnx-home-projects">
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'code', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
<!-- wp:heading --><h2 class="wp-block-heading"><?php echo esc_html__( 'Selected work', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:columns -->
<div class="wp-block-columns">
@@ -19,5 +20,6 @@
<!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Published research', 'chrnx' ); ?></h3><!-- /wp:heading --></div><!-- /wp:column -->
</div>
<!-- /wp:columns -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'research', '', 'chrnx-section-portrait chrnx-section-portrait--secondary' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
</section>
<!-- /wp:group -->
+1 -2
View File
@@ -9,7 +9,6 @@
* @package CHRNX
*/
$chrnx_music_collage = get_theme_file_uri( 'assets/images/the-no-names-collage.jpeg' );
$chrnx_music_cutout = get_theme_file_uri( 'assets/images/the-no-names-musician-cutout.png' );
?>
<!-- wp:group {"tagName":"section","className":"chrnx-music-landing","layout":{"type":"constrained"}} -->
<section class="wp-block-group chrnx-music-landing">
@@ -20,7 +19,7 @@ $chrnx_music_cutout = get_theme_file_uri( 'assets/images/the-no-names-musician-
<!-- wp:group {"className":"chrnx-music-landing__art","layout":{"type":"flex","flexWrap":"wrap"}} -->
<div class="wp-block-group chrnx-music-landing__art">
<!-- wp:html --><img src="<?php echo esc_url( $chrnx_music_collage ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="<?php echo esc_attr__( 'The No Names collage', 'chrnx' ); ?>"><!-- /wp:html -->
<!-- wp:html --><img src="<?php echo esc_url( $chrnx_music_cutout ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="<?php echo esc_attr__( 'The No Names musician portrait', 'chrnx' ); ?>"><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'music', __( 'The No Names musician portrait', 'chrnx' ), 'chrnx-music-landing__portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
</div>
<!-- /wp:group -->
<!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Releases in progress', 'chrnx' ); ?></h3><!-- /wp:heading -->
+1 -2
View File
@@ -8,12 +8,11 @@
*
* @package CHRNX
*/
$chrnx_podcast_art = get_theme_file_uri( 'assets/images/alter-ego-podcasts.png' );
?>
<!-- wp:group {"tagName":"section","className":"chrnx-podcast-landing","layout":{"type":"constrained"}} -->
<section class="wp-block-group chrnx-podcast-landing">
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading"><?php echo esc_html__( 'Podcasts', 'chrnx' ); ?></h2><!-- /wp:heading -->
<!-- wp:html --><img class="chrnx-podcast-landing__art" src="<?php echo esc_url( $chrnx_podcast_art ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="" aria-hidden="true"><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'podcasts', '', 'chrnx-podcast-landing__art chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
<!-- wp:group {"metadata":{"name":"chrnx/podcast-show-discovery"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
<!-- wp:group {"metadata":{"name":"chrnx/podcast-latest"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
<!-- wp:group {"metadata":{"name":"chrnx/podcast-archive"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
+1 -2
View File
@@ -8,11 +8,10 @@
*
* @package CHRNX
*/
$chrnx_podcast_show_art = get_theme_file_uri( 'assets/images/alter-ego-podcasts.png' );
?>
<!-- wp:group {"tagName":"article","className":"chrnx-podcast-show","layout":{"type":"constrained"}} -->
<article class="wp-block-group chrnx-podcast-show">
<!-- wp:html --><img class="chrnx-podcast-show__art" src="<?php echo esc_url( $chrnx_podcast_show_art ); ?>" width="1122" height="1402" loading="lazy" decoding="async" alt="" aria-hidden="true"><!-- /wp:html -->
<!-- wp:html --><?php echo chrnx_get_topic_portrait_markup( 'podcasts', '', 'chrnx-podcast-show__art chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><!-- /wp:html -->
<!-- wp:group {"metadata":{"name":"chrnx/show-cover"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
<!-- wp:group {"metadata":{"name":"chrnx/show-description"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
<!-- wp:group {"metadata":{"name":"chrnx/show-hosts"},"layout":{"type":"constrained"}} --><div class="wp-block-group"></div><!-- /wp:group -->
+41
View File
@@ -0,0 +1,41 @@
#!/bin/sh
set -eu
chrnx_image_script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
chrnx_image_root=$(dirname -- "$chrnx_image_script_dir")
chrnx_image_output="$chrnx_image_root/assets/images/generated"
chrnx_image_tmp=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-images.XXXXXX")
trap 'rm -rf -- "$chrnx_image_tmp"' EXIT HUP INT TERM
for chrnx_image_tool in sips cwebp avifenc; do
if ! command -v "$chrnx_image_tool" >/dev/null 2>&1; then
echo "Required image tool is missing: $chrnx_image_tool" >&2
exit 1
fi
done
mkdir -p -- "$chrnx_image_output"
chrnx_build_portrait() {
chrnx_image_basename=$1
chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_basename.png"
if [ ! -f "$chrnx_image_source" ]; then
echo "Source portrait is missing: $chrnx_image_source" >&2
exit 1
fi
for chrnx_image_width in 384 768; do
chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.png"
sips --resampleWidth "$chrnx_image_width" "$chrnx_image_source" --out "$chrnx_image_resized" >/dev/null
cwebp -quiet -preset picture -q 78 -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.webp"
avifenc --ignore-exif --ignore-xmp --ignore-icc --qcolor 58 --qalpha 85 --speed 6 "$chrnx_image_resized" "$chrnx_image_output/$chrnx_image_basename-$chrnx_image_width.avif" >/dev/null
done
}
for chrnx_image_topic in code gaming life literature podcasts research; do
chrnx_build_portrait "alter-ego-$chrnx_image_topic"
printf '{\n\t"source": "alter-ego-%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' "$chrnx_image_topic" > "$chrnx_image_output/alter-ego-$chrnx_image_topic.json"
done
chrnx_build_portrait "the-no-names-musician-cutout"
printf '{\n\t"source": "the-no-names-musician-cutout.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_output/the-no-names-musician-cutout.json"
+77
View File
@@ -0,0 +1,77 @@
import { mkdir } from 'node:fs/promises';
import { chromium } from '@playwright/test';
const baseURL = process.env.CHRNX_REVIEW_URL || 'http://localhost:8888';
const host = new URL(baseURL).hostname;
if (!['localhost', '127.0.0.1'].includes(host)) {
throw new Error('Visual review capture is restricted to local WordPress.');
}
const output = new URL('../tmp/imagegen/', import.meta.url);
await mkdir(output, { recursive: true });
const browser = await chromium.launch();
async function capture({ name, path, theme, viewport, fullPage = true }) {
const context = await browser.newContext({
viewport,
colorScheme: theme,
reducedMotion: 'reduce',
});
await context.addInitScript(
(preference) => localStorage.setItem('chrnx-theme', preference),
theme,
);
const page = await context.newPage();
await page.goto(new URL(path, baseURL).href, { waitUntil: 'networkidle' });
await page.addStyleTag({
content: '*,*::before,*::after{animation:none!important;transition:none!important}',
});
await page.evaluate(async () => {
await document.fonts.ready;
for (let y = 0; y <= document.documentElement.scrollHeight; y += window.innerHeight) {
window.scrollTo(0, y);
await new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve)));
}
await Promise.race([
Promise.all(
[...document.images].map((image) =>
image.complete ? Promise.resolve() : image.decode().catch(() => {}),
),
),
new Promise((resolve) => setTimeout(resolve, 3000)),
]);
window.scrollTo(0, 0);
});
await page.screenshot({ path: new URL(`${name}.png`, output).pathname, fullPage });
console.log(
`${name}.png ${await page.evaluate(
() => `${document.documentElement.scrollWidth}x${document.documentElement.scrollHeight}`,
)}`,
);
await context.close();
}
const desktop = { width: 1440, height: 900 };
const mobile = { width: 375, height: 812 };
for (const spec of [
{ name: 'home-desktop-dark', path: '/', theme: 'dark', viewport: desktop },
{ name: 'home-desktop-light', path: '/', theme: 'light', viewport: desktop },
{ name: 'home-mobile-dark', path: '/', theme: 'dark', viewport: mobile },
{ name: 'home-mobile-light', path: '/', theme: 'light', viewport: mobile },
{ name: 'topic-code-desktop-dark', path: '/topic/code/', theme: 'dark', viewport: desktop },
{
name: 'topic-research-desktop-dark',
path: '/topic/research/',
theme: 'dark',
viewport: desktop,
},
{ name: 'topic-gaming-desktop-dark', path: '/topic/gaming/', theme: 'dark', viewport: desktop },
{ name: 'music-desktop-dark', path: '/music/', theme: 'dark', viewport: desktop },
{ name: 'podcasts-desktop-dark', path: '/podcasts/', theme: 'dark', viewport: desktop },
{ name: 'about-desktop-dark', path: '/about/', theme: 'dark', viewport: desktop },
]) {
await capture(spec);
}
await browser.close();
+152
View File
@@ -0,0 +1,152 @@
<?php
/**
* Seed deterministic, local-only visual review fixtures.
*
* Run through scripts/seed-test-content.sh, never against a public site.
*
* @package CHRNX
*/
$chrnx_seed_host = wp_parse_url( home_url( '/' ), PHP_URL_HOST );
if ( ! in_array( $chrnx_seed_host, array( 'localhost', '127.0.0.1' ), true ) ) {
WP_CLI::error( 'Refusing to seed a non-local WordPress site.' );
}
/**
* Read one fixture JSON document from the mapped theme.
*
* @param string $filename Fixture filename.
* @return array<int,array<string,mixed>> Fixture records.
*/
function chrnx_seed_read_fixture( string $filename ): array {
$path = get_theme_file_path( 'tests/fixtures/' . $filename );
if ( ! is_readable( $path ) ) {
WP_CLI::error( 'Fixture is not readable: ' . $filename );
}
// phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- This is a local mapped theme fixture, never a URL.
$data = json_decode( (string) file_get_contents( $path ), true );
if ( ! is_array( $data ) || ! array_is_list( $data ) ) {
WP_CLI::error( 'Fixture JSON is invalid: ' . $filename );
}
return $data;
}
/**
* Find the post managed by one stable fixture key.
*
* @param string $fixture_key Fixture key.
* @param string $post_type Post type.
* @return int Post ID or zero.
*/
function chrnx_seed_find_post( string $fixture_key, string $post_type ): int {
$ids = get_posts(
array(
'post_type' => $post_type,
'post_status' => 'any',
'posts_per_page' => 1,
'fields' => 'ids',
'no_found_rows' => true,
'suppress_filters' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'meta_key' => '_chrnx_fixture_key',
'meta_value' => $fixture_key,
)
);
return empty( $ids ) ? 0 : absint( $ids[0] );
}
/**
* Insert or update one fixture-owned post without touching unrelated content.
*
* @param array<string,mixed> $fixture Fixture record.
* @param string $post_type Post type.
* @param int $offset Stable publication-date offset.
* @return int Post ID.
*/
function chrnx_seed_upsert_post( array $fixture, string $post_type, int $offset ): int {
$key = isset( $fixture['fixtureKey'] ) ? sanitize_key( $fixture['fixtureKey'] ) : '';
if ( '' === $key ) {
WP_CLI::error( 'Every fixture requires a fixtureKey.' );
}
$post_id = chrnx_seed_find_post( $key, $post_type );
$payload = array(
'ID' => $post_id,
'post_type' => $post_type,
'post_status' => sanitize_key( $fixture['status'] ?? 'publish' ),
'post_title' => sanitize_text_field( $fixture['title'] ?? '' ),
'post_name' => sanitize_title( $fixture['slug'] ?? $fixture['title'] ?? $key ),
'post_excerpt' => wp_kses_post( $fixture['excerpt'] ?? '' ),
'post_content' => wp_kses_post( $fixture['content'] ?? '' ),
'post_date' => gmdate( 'Y-m-d H:i:s', strtotime( '2026-08-01 18:00:00 UTC' ) + ( $offset * HOUR_IN_SECONDS ) ),
);
$result = $post_id ? wp_update_post( $payload, true ) : wp_insert_post( $payload, true );
if ( is_wp_error( $result ) ) {
WP_CLI::error( 'Could not upsert fixture ' . $key . '.' );
}
update_post_meta( $result, '_chrnx_fixture_key', $key );
return absint( $result );
}
chrnx_seed_editorial_terms();
$chrnx_seed_pages = chrnx_seed_read_fixture( 'pages.json' );
$chrnx_seed_posts = chrnx_seed_read_fixture( 'posts.json' );
$chrnx_seed_page_ids = array();
$chrnx_seed_post_ids = array();
foreach ( $chrnx_seed_pages as $chrnx_seed_index => $chrnx_seed_page ) {
$chrnx_seed_page_id = chrnx_seed_upsert_post( $chrnx_seed_page, 'page', $chrnx_seed_index );
$chrnx_seed_page_ids[ $chrnx_seed_page['slug'] ] = $chrnx_seed_page_id;
}
foreach ( $chrnx_seed_posts as $chrnx_seed_index => $chrnx_seed_post ) {
$chrnx_seed_post_id = chrnx_seed_upsert_post( $chrnx_seed_post, 'post', 24 + $chrnx_seed_index );
wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['topic'] ?? '' ), 'chrnx_topic', false );
wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['language'] ?? '' ), 'chrnx_language', false );
if ( isset( $chrnx_seed_post['show'] ) ) {
wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['show'] ), 'chrnx_show', false );
} else {
wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_show', false );
}
foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration' ) as $chrnx_seed_meta_key ) {
delete_post_meta( $chrnx_seed_post_id, $chrnx_seed_meta_key );
}
if ( isset( $chrnx_seed_post['episodeNumber'] ) ) {
update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_number', absint( $chrnx_seed_post['episodeNumber'] ) );
}
if ( isset( $chrnx_seed_post['episodeDuration'] ) ) {
update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_duration', chrnx_sanitize_episode_duration( $chrnx_seed_post['episodeDuration'] ) );
}
$chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ] = $chrnx_seed_post_id;
}
$chrnx_seed_sticky_ids = array();
foreach ( $chrnx_seed_posts as $chrnx_seed_post ) {
if ( ! empty( $chrnx_seed_post['featured'] ) && isset( $chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ] ) ) {
$chrnx_seed_sticky_ids[] = $chrnx_seed_post_ids[ $chrnx_seed_post['fixtureKey'] ];
}
}
update_option( 'sticky_posts', $chrnx_seed_sticky_ids );
update_option( 'blogname', 'CHRNX' );
update_option( 'blogdescription', 'Ideas made tangible.' );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $chrnx_seed_page_ids['home'] );
update_option( 'page_for_posts', 0 );
update_option( 'chrnx_subscribe_page_id', $chrnx_seed_page_ids['subscribe'] );
update_option( 'permalink_structure', '/%postname%/' );
flush_rewrite_rules( false );
WP_CLI::log(
sprintf(
'CHRNX_FIXTURES pages=%d posts=%d front=%d',
count( $chrnx_seed_page_ids ),
count( $chrnx_seed_post_ids ),
$chrnx_seed_page_ids['home']
)
);
+22
View File
@@ -0,0 +1,22 @@
#!/bin/sh
set -eu
chrnx_script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
chrnx_project_dir=$(dirname -- "$chrnx_script_dir")
chrnx_docker_cli_dir=${CHRNX_DOCKER_CLI_DIR:-/opt/homebrew/opt/docker/bin}
if [ ! -x "$chrnx_docker_cli_dir/docker" ]; then
echo "Docker CLI not found at the approved Colima path: $chrnx_docker_cli_dir/docker" >&2
exit 1
fi
cd -- "$chrnx_project_dir"
chrnx_seed_probe=$(PATH="$chrnx_docker_cli_dir:$PATH" npm exec -- wp-env run cli wp eval 'echo "CHRNX_HOST=" . wp_parse_url( home_url( "/" ), PHP_URL_HOST );')
case "$chrnx_seed_probe" in
*CHRNX_HOST=localhost*|*CHRNX_HOST=127.0.0.1*) ;;
*)
echo "Refusing to seed anything except localhost or 127.0.0.1." >&2
exit 1
;;
esac
PATH="$chrnx_docker_cli_dir:$PATH" npm exec -- wp-env run cli wp eval-file wp-content/themes/chrnx/scripts/seed-test-content.php
+21
View File
@@ -0,0 +1,21 @@
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-home","layout":{"type":"default"}} -->
<main id="chrnx-main" class="wp-block-group chrnx-home" tabindex="-1">
<!-- wp:pattern {"slug":"chrnx/home-intro"} /-->
<!-- wp:chrnx/featured-stories /-->
<!-- wp:chrnx/journal-stream /-->
<!-- wp:pattern {"slug":"chrnx/home-projects"} /-->
<!-- wp:pattern {"slug":"chrnx/home-music"} /-->
<!-- wp:chrnx/latest-podcast /-->
<!-- wp:group {"className":"chrnx-home-about-preview","layout":{"type":"constrained"}} -->
<div class="wp-block-group chrnx-home-about-preview">
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading">About</h2><!-- /wp:heading -->
<!-- wp:paragraph --><p>Independent research, software, music, games, and the human life around the work.</p><!-- /wp:paragraph -->
</div>
<!-- /wp:group -->
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
</main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
+5 -5
View File
@@ -1,9 +1,9 @@
import { execFileSync } from 'node:child_process';
export default function globalSetup() {
execFileSync(
'npm',
[ 'exec', '--', 'wp-env', 'run', 'cli', 'wp', 'eval', 'chrnx_seed_editorial_terms();' ],
{ cwd: process.cwd(), env: process.env, stdio: 'inherit' },
);
execFileSync( './scripts/seed-test-content.sh', [], {
cwd: process.cwd(),
env: process.env,
stdio: 'inherit',
} );
}
+140
View File
@@ -0,0 +1,140 @@
import { expect, test } from '@playwright/test';
import { injectAxe } from 'axe-playwright';
const viewports = [
{ width: 375, height: 812 },
{ width: 768, height: 1024 },
{ width: 1440, height: 900 },
{ width: 2560, height: 1440 },
];
async function expectNoHorizontalOverflow( page ) {
const overflow = await page.evaluate( () => ( {
document: document.documentElement.scrollWidth - window.innerWidth,
body: document.body.scrollWidth - window.innerWidth,
} ) );
expect( overflow.document ).toBeLessThanOrEqual( 1 );
expect( overflow.body ).toBeLessThanOrEqual( 1 );
}
test( 'home remains coherent at all approved review viewports', async ( { page } ) => {
for ( const viewport of viewports ) {
await page.setViewportSize( viewport );
await page.goto( '/' );
await expect( page.getByRole( 'banner' ) ).toBeVisible();
await expect( page.locator( 'main#chrnx-main' ) ).toBeVisible();
await expect( page.getByRole( 'contentinfo' ) ).toBeVisible();
await expect( page.getByRole( 'heading', { level: 1 } ) ).toHaveCount( 1 );
await expect( page.getByText( 'Selected work', { exact: true } ) ).toBeVisible();
await expect( page.getByText( 'The No Names', { exact: true } ).first() ).toBeVisible();
await expect( page.locator( 'picture source[type="image/avif"]' ).first() ).toHaveAttribute(
'srcset',
/384\.avif 384w/,
);
await expectNoHorizontalOverflow( page );
}
} );
test( 'topic, music, podcast, and about surfaces use real content and approved art', async ( {
page,
} ) => {
for ( const [ path, heading, asset ] of [
[ '/topic/code/', 'Code', 'alter-ego-code' ],
[ '/topic/research/', 'Research', 'alter-ego-research' ],
[ '/topic/gaming/', 'Gaming', 'alter-ego-gaming' ],
] ) {
await page.goto( path );
await expect( page.getByRole( 'heading', { level: 1, name: heading } ) ).toBeVisible();
await expect( page.locator( `.chrnx-topic-hero img[src*="${ asset }.png"]` ) ).toBeVisible();
await expectNoHorizontalOverflow( page );
}
await page.goto( '/music/' );
await expect( page.getByRole( 'heading', { level: 1, name: 'Music' } ) ).toBeVisible();
await expect( page.getByText( 'Grunge mexicano para cerebros que no se callan.' ) ).toBeVisible();
await expect(
page.locator( 'picture img[src*="the-no-names-musician-cutout.png"]' ),
).toBeVisible();
await page.goto( '/podcasts/' );
await expect( page.getByRole( 'heading', { level: 1, name: 'Podcasts' } ) ).toBeVisible();
await expect( page.locator( 'picture img[src*="alter-ego-podcasts.png"]' ) ).toBeVisible();
await expect( page.locator( 'iframe, audio' ) ).toHaveCount( 0 );
await page.goto( '/about/' );
await expect( page.getByRole( 'heading', { level: 1, name: 'About' } ) ).toBeVisible();
await expect( page.getByRole( 'link', { name: 'arXiv:2603.05352' } ) ).toHaveAttribute(
'href',
'https://arxiv.org/abs/2603.05352',
);
await expect( page.locator( '.chrnx-about__portraits picture' ) ).toHaveCount( 3 );
} );
test( 'long, incomplete, empty, and missing states stay usable', async ( { page } ) => {
await page.goto( '/?s=fixture-that-cannot-exist' );
await expect( page.getByText( 'No journal entries match these filters yet.' ) ).toBeVisible();
await expect( page.getByRole( 'link', { name: 'Browse the full Journal' } ) ).toBeVisible();
await page.goto( '/conversacion-pendiente-de-datos-editoriales/' );
await expect(
page.getByRole( 'heading', { level: 1, name: 'Conversación pendiente de datos editoriales' } ),
).toBeVisible();
await expect( page.locator( '.chrnx-podcast-meta' ) ).toHaveCount( 0 );
await page.goto( '/emotion-is-not-a-slider-designing-expressive-systems-that-can-hesitate/' );
await expect( page.locator( 'pre code' ) ).toContainText( 'const state' );
await expectNoHorizontalOverflow( page );
await page.goto( '/this-route-does-not-exist/' );
await expect( page ).toHaveTitle( /Page not found/i );
await expect( page.getByRole( 'heading', { level: 1, name: 'Page not found' } ) ).toBeVisible();
} );
test( 'reduced motion removes card transitions while theme preference remains user-controlled', async ( {
page,
} ) => {
await page.emulateMedia( { reducedMotion: 'reduce', colorScheme: 'light' } );
await page.goto( '/' );
const card = page.locator( '.chrnx-featured-story' ).first();
const duration = await card.evaluate( ( element ) =>
Number.parseFloat( window.getComputedStyle( element ).transitionDuration ),
);
expect( duration ).toBeLessThanOrEqual( 0.001 );
await expect( page.locator( '.chrnx-home-music h2' ) ).toHaveCSS( 'color', 'rgb(230, 237, 243)' );
await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check();
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
} );
test( 'key public surfaces pass automated WCAG 2.2 AA checks', async ( { page }, testInfo ) => {
test.skip(
testInfo.project.name !== 'chromium',
'One engine is sufficient for deterministic axe rules.',
);
const tags = [ 'wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa' ];
for ( const viewport of [ viewports[ 0 ], viewports[ 2 ] ] ) {
await page.setViewportSize( viewport );
for ( const path of [
'/',
'/music/',
'/podcasts/',
'/about/',
'/topic/code/',
'/?s=fixture-that-cannot-exist',
'/this-route-does-not-exist/',
] ) {
await page.goto( path );
await injectAxe( page );
const violations = await page.evaluate( async ( runOnly ) => {
const result = await globalThis.axe.run( document, {
runOnly: { type: 'tag', values: runOnly },
} );
return result.violations.map( ( violation ) => ( {
id: violation.id,
impact: violation.impact,
nodes: violation.nodes.map( ( node ) => node.target ),
} ) );
}, tags );
expect( violations, `${ path } at ${ viewport.width }px` ).toEqual( [] );
}
}
} );
+51
View File
@@ -0,0 +1,51 @@
[
{
"fixtureKey": "page-home",
"slug": "home",
"title": "CHRNX",
"status": "publish",
"content": ""
},
{
"fixtureKey": "page-journal",
"slug": "journal",
"title": "Journal",
"status": "publish",
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Notas desde el taller</p><!-- /wp:paragraph --><!-- wp:chrnx/journal-stream /-->"
},
{
"fixtureKey": "page-projects",
"slug": "projects",
"title": "Projects",
"status": "publish",
"content": "<!-- wp:paragraph {\"className\":\"chrnx-page-kicker\"} --><p class=\"chrnx-page-kicker\">Software · investigación · sistemas expresivos</p><!-- /wp:paragraph --><!-- wp:pattern {\"slug\":\"chrnx/home-projects\"} /--><!-- wp:pattern {\"slug\":\"chrnx/project-detail\"} /-->"
},
{
"fixtureKey": "page-music",
"slug": "music",
"title": "Music",
"status": "publish",
"content": "<!-- wp:pattern {\"slug\":\"chrnx/music-landing\"} /-->"
},
{
"fixtureKey": "page-podcasts",
"slug": "podcasts",
"title": "Podcasts",
"status": "publish",
"content": "<!-- wp:pattern {\"slug\":\"chrnx/podcast-landing\"} /--><!-- wp:chrnx/latest-podcast /-->"
},
{
"fixtureKey": "page-about",
"slug": "about",
"title": "About",
"status": "publish",
"content": "<!-- wp:pattern {\"slug\":\"chrnx/about\"} /-->"
},
{
"fixtureKey": "page-subscribe",
"slug": "subscribe",
"title": "Subscribe",
"status": "publish",
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Stay close to the work</h2><!-- /wp:heading --><!-- wp:paragraph --><p>New notes, experiments, music, and conversations. The final subscription provider will be connected before launch.</p><!-- /wp:paragraph -->"
}
]
+107
View File
@@ -0,0 +1,107 @@
[
{
"fixtureKey": "post-code-primary",
"title": "Emotion is not a slider: designing expressive systems that can hesitate",
"excerpt": "A working note on modeling emotional state without flattening behavior into a single number.",
"content": "<!-- wp:paragraph --><p>Expressive software gets interesting when uncertainty is part of the model instead of an error to erase.</p><!-- /wp:paragraph --><!-- wp:code --><pre class=\"wp-block-code\"><code>const state = observe(world);\nconst choice = agent.respond(state, { uncertainty: true });</code></pre><!-- /wp:code -->",
"topic": "code",
"language": "en",
"featured": true
},
{
"fixtureKey": "post-research-primary",
"title": "What game AI can learn from the uncomfortable space between intention and action",
"excerpt": "Research notes from the intersection of emotion modeling, agency, and believable play.",
"content": "<!-- wp:paragraph --><p>My research asks how internal state becomes behavior players can read without turning a character into a dashboard.</p><!-- /wp:paragraph -->",
"topic": "research",
"language": "en",
"featured": true
},
{
"fixtureKey": "post-gaming-primary",
"title": "The save file remembers what the hero pretends to forget",
"excerpt": "A design sketch about memory, consequence, and the stories systems tell behind our backs.",
"content": "<!-- wp:paragraph --><p>Games become personal when the system remembers a decision after the player has renamed it.</p><!-- /wp:paragraph -->",
"topic": "gaming",
"language": "en",
"featured": true
},
{
"fixtureKey": "post-literature-long",
"title": "Escribir cuando la casa por fin se queda en silencio y cada pequeño ruido parece tener una opinión larguísima sobre el borrador abierto",
"excerpt": "Notas sobre escribir de noche, editar sin piedad y conservar la parte que todavía respira.",
"content": "<!-- wp:paragraph --><p>La noche no vuelve más inteligente al texto, pero sí deja escuchar dónde está fingiendo.</p><!-- /wp:paragraph -->",
"topic": "literature",
"language": "es",
"fixtureState": "long-title"
},
{
"fixtureKey": "post-music-studio",
"title": "Una cuerda rota también puede decidir el arreglo",
"excerpt": "Diario de producción de The No Names: estudio crudo, cero live.",
"content": "<!-- wp:paragraph --><p>La toma no quedó limpia. Quedó viva, que para este disco importa bastante más.</p><!-- /wp:paragraph -->",
"topic": "music",
"language": "es",
"fixtureState": "missing-media"
},
{
"fixtureKey": "post-podcast-episode",
"title": "Silicon Ranch: conversaciones sin diapositivas",
"excerpt": "Un episodio local de demostración para probar estructura, metadatos y estados sin publicar datos de cohosts.",
"content": "<!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
"topic": "podcasts",
"language": "es",
"show": "silicon-ranch",
"episodeNumber": 2,
"episodeDuration": "58:24"
},
{
"fixtureKey": "post-podcast-missing-meta",
"title": "Conversación pendiente de datos editoriales",
"excerpt": "Estado de prueba para un episodio sin show ni duración asignados.",
"content": "<!-- wp:paragraph --><p>El tema debe seguir siendo claro aunque la ficha editorial todavía esté incompleta.</p><!-- /wp:paragraph -->",
"topic": "podcasts",
"language": "es",
"fixtureState": "missing-podcast-meta"
},
{
"fixtureKey": "post-life-fatherhood",
"title": "Tres voces en casa y una idea que tendrá que esperar",
"excerpt": "La vida diaria no interrumpe el trabajo: le da escala, límites y sentido.",
"content": "<!-- wp:paragraph --><p>Hay ideas que mejoran cuando esperan a que termine la tarea, el juego o la conversación importante.</p><!-- /wp:paragraph -->",
"topic": "life",
"language": "es"
},
{
"fixtureKey": "post-code-open-source",
"title": "Small interfaces, fewer lies",
"excerpt": "Why narrow APIs often produce software that is easier to trust and maintain.",
"content": "<!-- wp:paragraph --><p>A public interface is a promise. Smaller promises leave less room for accidental fiction.</p><!-- /wp:paragraph -->",
"topic": "code",
"language": "en"
},
{
"fixtureKey": "post-research-paper",
"title": "From a paper to a playable question",
"excerpt": "Turning published research into experiments that can be felt, inspected, and challenged.",
"content": "<!-- wp:paragraph --><p>Publication is not the end of an idea. It is where other people finally get a fair chance to disagree with it.</p><!-- /wp:paragraph -->",
"topic": "research",
"language": "en"
},
{
"fixtureKey": "post-gaming-accessibility",
"title": "Difficulty is a conversation, not a gate",
"excerpt": "A note about challenge, access, and respecting different ways of reading a game.",
"content": "<!-- wp:paragraph --><p>Accessibility does not remove authorship. It gives more players a route into it.</p><!-- /wp:paragraph -->",
"topic": "gaming",
"language": "en"
},
{
"fixtureKey": "post-literature-draft",
"title": "El monstruo en el margen",
"excerpt": "Un fragmento breve sobre notas que empiezan como correcciones y terminan confesando otra historia.",
"content": "<!-- wp:quote --><blockquote class=\"wp-block-quote\"><p>La tinta sabía algo que el narrador todavía no.</p></blockquote><!-- /wp:quote -->",
"topic": "literature",
"language": "es"
}
]
+5 -4
View File
@@ -59,10 +59,11 @@ class PatternsTest extends WP_UnitTestCase {
/** Local art is generated through escaped theme URIs with intrinsic dimensions. */
public function test_art_patterns_use_only_escaped_local_theme_images() {
foreach ( array( 'home-music', 'music-landing', 'podcast-landing', 'podcast-show' ) as $name ) {
$source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
$content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) );
$this->assertStringContainsString( 'get_theme_file_uri(', $source, $name );
$this->assertStringContainsString( 'esc_url(', $source, $name );
$source = file_get_contents( get_theme_file_path( 'patterns/' . $name . '.php' ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- Local test fixture.
$content = $this->render_pattern( get_theme_file_path( 'patterns/' . $name . '.php' ) );
$uses_responsive_helper = str_contains( $source, 'chrnx_get_topic_portrait_markup(' );
$uses_direct_uri = str_contains( $source, 'get_theme_file_uri(' ) && str_contains( $source, 'esc_url(' );
$this->assertTrue( $uses_responsive_helper || $uses_direct_uri, $name );
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bwidth="1122"[^>]*\bheight="1402"/i', $content, $name );
$this->assertMatchesRegularExpression( '/<img\b[^>]*\bloading="lazy"[^>]*\bdecoding="async"/i', $content, $name );
}
+30
View File
@@ -0,0 +1,30 @@
<?php
/**
* Responsive theme media tests.
*
* @package CHRNX
*/
/** Responsive asset helper coverage. */
class ResponsiveMediaTest extends WP_UnitTestCase {
/** Approved topic portraits render a compact picture element with a PNG fallback. */
public function test_topic_portrait_picture_markup_has_modern_sources_and_dimensions() {
$markup = chrnx_get_topic_portrait_markup( 'code', 'Code workshop portrait', 'chrnx-section-portrait' );
$this->assertStringContainsString( '<picture', $markup );
$this->assertStringContainsString( 'type="image/avif"', $markup );
$this->assertStringContainsString( 'type="image/webp"', $markup );
$this->assertStringContainsString( 'alter-ego-code.png', $markup );
$this->assertStringContainsString( 'width="1122"', $markup );
$this->assertStringContainsString( 'height="1402"', $markup );
$this->assertStringContainsString( 'loading="lazy"', $markup );
$this->assertStringContainsString( 'decoding="async"', $markup );
$this->assertStringContainsString( 'sizes="(max-width: 599px) 70vw, 384px"', $markup );
$this->assertStringContainsString( 'alt="Code workshop portrait"', $markup );
}
/** Unknown topic values cannot synthesize asset paths. */
public function test_unknown_topic_portrait_returns_empty_markup() {
$this->assertSame( '', chrnx_get_topic_portrait_markup( '../../private', '', '' ) );
}
}
+5 -3
View File
@@ -2,13 +2,15 @@ import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import test from 'node:test';
test( 'Playwright seeds editorial prerequisites once outside browser workers', async () => {
test( 'Playwright seeds deterministic local fixtures once outside browser workers', async () => {
const config = await readFile( 'playwright.config.mjs', 'utf8' );
const setup = await readFile( 'tests/e2e/global-setup.mjs', 'utf8' );
const seed = await readFile( 'scripts/seed-test-content.php', 'utf8' );
const spec = await readFile( 'tests/e2e/editorial-editor.spec.mjs', 'utf8' );
assert.match( config, /globalSetup:\s*['"]\.\/tests\/e2e\/global-setup\.mjs['"]/ );
assert.match( setup, /wp-env.*chrnx_seed_editorial_terms\(\);/s );
assert.equal( setup.match( /chrnx_seed_editorial_terms/g )?.length, 1 );
assert.match( setup, /execFileSync\(\s*['"]\.\/scripts\/seed-test-content\.sh['"]/s );
assert.equal( setup.match( /seed-test-content\.sh/g )?.length, 1 );
assert.equal( seed.match( /chrnx_seed_editorial_terms\(\);/g )?.length, 1 );
assert.doesNotMatch( spec, /wp-env|execFileSync|beforeAll/ );
} );
+69
View File
@@ -0,0 +1,69 @@
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { test } from 'node:test';
const read = ( path ) => readFileSync( new URL( `../../${ path }`, import.meta.url ), 'utf8' );
test( 'local visual fixtures define stable pages and representative editorial states', () => {
const pages = JSON.parse( read( 'tests/fixtures/pages.json' ) );
const posts = JSON.parse( read( 'tests/fixtures/posts.json' ) );
assert.deepEqual(
pages.map( ( page ) => page.slug ),
[ 'home', 'journal', 'projects', 'music', 'podcasts', 'about', 'subscribe' ],
);
assert.ok( pages.every( ( page ) => page.fixtureKey && page.status === 'publish' ) );
assert.ok( posts.length >= 10 );
assert.ok( posts.some( ( post ) => post.title.length > 100 ) );
assert.ok( posts.some( ( post ) => post.content.includes( 'wp:code' ) ) );
assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-media' ) );
assert.ok( posts.some( ( post ) => post.fixtureState === 'missing-podcast-meta' ) );
for ( const topic of [ 'code', 'research', 'gaming', 'literature', 'music', 'podcasts', 'life' ] ) {
assert.ok( posts.some( ( post ) => post.topic === topic ), `missing ${ topic } fixture` );
}
} );
test( 'the seed entrypoint is explicitly local-only and uses a stable fixture key', () => {
const shell = read( 'scripts/seed-test-content.sh' );
const php = read( 'scripts/seed-test-content.php' );
assert.match( shell, /localhost|127\.0\.0\.1/ );
assert.match( shell, /wp eval-file/ );
assert.match( php, /_chrnx_fixture_key/ );
assert.match( php, /show_on_front/ );
assert.match( php, /page_on_front/ );
assert.match( php, /page_for_posts/ );
} );
test( 'the visual layer is separately enqueued and covers responsive accessible states', () => {
const assets = read( 'inc/assets.php' );
const components = read( 'assets/css/components.css' );
assert.match( assets, /chrnx-components/ );
assert.match( components, /\.chrnx-section-portrait/ );
assert.match( components, /prefers-reduced-motion/ );
assert.match( components, /@media \(max-width: 599px\)/ );
assert.match( components, /html\[data-theme="light"\]/ );
} );
test( 'all approved portraits expose reproducible WebP and AVIF derivatives', () => {
for ( const topic of [ 'code', 'gaming', 'life', 'literature', 'podcasts', 'research' ] ) {
const manifest = JSON.parse( read( `assets/images/generated/alter-ego-${ topic }.json` ) );
assert.equal( manifest.source, `alter-ego-${ topic }.png` );
assert.deepEqual( manifest.formats, [ 'avif', 'webp' ] );
assert.deepEqual( manifest.widths, [ 384, 768 ] );
}
} );
test( 'front page and section pages connect the real editorial patterns', () => {
const front = read( 'templates/front-page.html' );
assert.match( front, /chrnx\/home-intro/ );
assert.match( front, /chrnx\/featured-stories/ );
assert.match( front, /chrnx\/journal-stream/ );
assert.match( front, /chrnx\/latest-podcast/ );
const fixtures = read( 'tests/fixtures/pages.json' );
for ( const slug of [ 'chrnx/about', 'chrnx/music-landing', 'chrnx/podcast-landing' ] ) {
assert.match( fixtures, new RegExp( slug.replace( '/', '\\/' ) ) );
}
} );