Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb491adae6 | ||
|
|
df117e67bb | ||
|
|
6c7ed22970 | ||
|
|
842c8a9b37 | ||
|
|
f859780eaa | ||
|
|
d1ad17f4be | ||
|
|
20c47c927a | ||
|
|
a142ece51d | ||
|
|
f55d9d9b45 | ||
|
|
a3ba692669 |
No files matched your search
@@ -3,6 +3,7 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
vendor/
|
vendor/
|
||||||
.phpunit.result.cache
|
.phpunit.result.cache
|
||||||
|
.pytest_cache/
|
||||||
dist/
|
dist/
|
||||||
.wp-env.override.json
|
.wp-env.override.json
|
||||||
test-results/
|
test-results/
|
||||||
|
|||||||
@@ -83,13 +83,14 @@ responsive_output=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-responsive.XXXXXX")
|
|||||||
|
|
||||||
The rebuild rejects symlinks, nested paths, nonexistent paths, and destinations
|
The rebuild rejects symlinks, nested paths, nonexistent paths, and destinations
|
||||||
outside the canonical system temporary directory. The automated smoke test
|
outside the canonical system temporary directory. The automated smoke test
|
||||||
byte-compares all 52 generated files: 42 binary derivatives and 10 manifests.
|
byte-compares all 76 generated files: 62 binary derivatives and 14 manifests.
|
||||||
The inventory has nine portrait families at 384 px and 768 px, plus the Podcast
|
The inventory has eleven portrait families at 384 px and 768 px, plus three
|
||||||
background family at 384 px, 768 px, and 1536 px. Every 384/768 derivative is
|
landscape background families (Podcast, About, and Projects) at 384 px, 768 px,
|
||||||
limited to 160 KiB; each 1536 px Podcast derivative is limited to 260 KiB. The
|
and 1536 px. Every 384/768 derivative is
|
||||||
|
limited to 160 KiB; each 1536 px background derivative is limited to 260 KiB. The
|
||||||
collage, Gaming half-body, and Podcast families are capped at 400 KiB, 340 KiB,
|
collage, Gaming half-body, and Podcast families are capped at 400 KiB, 340 KiB,
|
||||||
and 620 KiB respectively, while all generated binaries together are capped at
|
and 620 KiB respectively, while all generated binaries together are capped at
|
||||||
2.75 MiB. The complete inventory, including manifests, must rebuild
|
3 MiB. The complete inventory, including manifests, must rebuild
|
||||||
byte-identically.
|
byte-identically.
|
||||||
|
|
||||||
The builder uses transactional publication with rollback: a failed promotion
|
The builder uses transactional publication with rollback: a failed promotion
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
background: var(--wp--preset--color--night);
|
background: var(--wp--preset--color--night);
|
||||||
color: var(--wp--preset--color--text);
|
color: var(--wp--preset--color--text);
|
||||||
|
overflow-wrap: break-word;
|
||||||
}
|
}
|
||||||
|
|
||||||
img,
|
img,
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ footer a {
|
|||||||
|
|
||||||
.chrnx-featured-stories > h2,
|
.chrnx-featured-stories > h2,
|
||||||
.chrnx-journal-stream > h2,
|
.chrnx-journal-stream > h2,
|
||||||
.chrnx-home-projects > h2,
|
.chrnx-home-projects h2,
|
||||||
.chrnx-home-music h2,
|
.chrnx-home-music h2,
|
||||||
.chrnx-home-about-preview h2 {
|
.chrnx-home-about-preview h2 {
|
||||||
font-size: var(--wp--preset--font-size--x-large);
|
font-size: var(--wp--preset--font-size--x-large);
|
||||||
@@ -313,12 +313,18 @@ footer a {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Break an unbroken token so it cannot widen the card, but never clip:
|
||||||
|
* card titles stay fully readable by contract.
|
||||||
|
*/
|
||||||
.chrnx-featured-story__title,
|
.chrnx-featured-story__title,
|
||||||
.chrnx-journal-card__title,
|
.chrnx-journal-card__title,
|
||||||
.chrnx-podcast-card__title,
|
.chrnx-podcast-card__title,
|
||||||
.chrnx-related-card__title {
|
.chrnx-related-card__title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-size: var(--wp--preset--font-size--large);
|
font-size: var(--wp--preset--font-size--large);
|
||||||
|
word-break: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-featured-story__excerpt,
|
.chrnx-featured-story__excerpt,
|
||||||
@@ -326,6 +332,20 @@ footer a {
|
|||||||
.chrnx-podcast-card__excerpt,
|
.chrnx-podcast-card__excerpt,
|
||||||
.chrnx-related-card__excerpt {
|
.chrnx-related-card__excerpt {
|
||||||
color: var(--chrnx-muted);
|
color: var(--chrnx-muted);
|
||||||
|
word-break: normal;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The placeholder ships as a <picture>, so the wrapper must fill the slot. */
|
||||||
|
.chrnx-featured-story__link > .chrnx-responsive-portrait,
|
||||||
|
.chrnx-journal-card__link > .chrnx-responsive-portrait,
|
||||||
|
.chrnx-podcast-card__link > .chrnx-responsive-portrait,
|
||||||
|
.chrnx-related-card__link > .chrnx-responsive-portrait,
|
||||||
|
.chrnx-release-card__art > .chrnx-responsive-portrait,
|
||||||
|
.chrnx-release-detail__art > .chrnx-responsive-portrait {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-featured-story__fallback,
|
.chrnx-featured-story__fallback,
|
||||||
@@ -337,6 +357,11 @@ footer a {
|
|||||||
radial-gradient(circle at 76% 24%, var(--chrnx-accent-soft) 0 14%, transparent 15%);
|
radial-gradient(circle at 76% 24%, var(--chrnx-accent-soft) 0 14%, transparent 15%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The placeholder sits at half opacity over the per-topic gradient, so a grid
|
||||||
|
* of missing images still varies by topic instead of repeating one bright
|
||||||
|
* wedge. Its dark corner is favoured in narrow card slots.
|
||||||
|
*/
|
||||||
.chrnx-featured-story__fallback,
|
.chrnx-featured-story__fallback,
|
||||||
.chrnx-journal-card__fallback,
|
.chrnx-journal-card__fallback,
|
||||||
.chrnx-podcast-card__fallback,
|
.chrnx-podcast-card__fallback,
|
||||||
@@ -345,6 +370,8 @@ footer a {
|
|||||||
background-image:
|
background-image:
|
||||||
linear-gradient(135deg, transparent 0 46%, color-mix(in srgb, var(--chrnx-card-accent, var(--chrnx-green)) 35%, transparent) 47% 52%, transparent 53%),
|
linear-gradient(135deg, transparent 0 46%, color-mix(in srgb, var(--chrnx-card-accent, var(--chrnx-green)) 35%, transparent) 47% 52%, transparent 53%),
|
||||||
radial-gradient(circle at 72% 28%, color-mix(in srgb, var(--chrnx-card-accent, var(--chrnx-green)) 28%, transparent) 0 15%, transparent 16%);
|
radial-gradient(circle at 72% 28%, color-mix(in srgb, var(--chrnx-card-accent, var(--chrnx-green)) 28%, transparent) 0 15%, transparent 16%);
|
||||||
|
object-position: 22% 18%;
|
||||||
|
opacity: 0.55;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-featured-story__fallback.is-topic-code,
|
.chrnx-featured-story__fallback.is-topic-code,
|
||||||
@@ -353,6 +380,12 @@ footer a {
|
|||||||
--chrnx-card-accent: #59c3c3;
|
--chrnx-card-accent: #59c3c3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chrnx-featured-story__fallback.is-topic-projects,
|
||||||
|
.chrnx-journal-card__fallback.is-topic-projects,
|
||||||
|
.chrnx-related-card__fallback.is-topic-projects {
|
||||||
|
--chrnx-card-accent: #4fb0a8;
|
||||||
|
}
|
||||||
|
|
||||||
.chrnx-featured-story__fallback.is-topic-research,
|
.chrnx-featured-story__fallback.is-topic-research,
|
||||||
.chrnx-journal-card__fallback.is-topic-research,
|
.chrnx-journal-card__fallback.is-topic-research,
|
||||||
.chrnx-related-card__fallback.is-topic-research {
|
.chrnx-related-card__fallback.is-topic-research {
|
||||||
@@ -460,47 +493,53 @@ footer a {
|
|||||||
border-top: 0;
|
border-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home > .chrnx-home-music {
|
/* Both wrappers now delegate their surface to the stage, so neither pads. */
|
||||||
|
.chrnx-home > .chrnx-home-music,
|
||||||
|
.chrnx-home > .chrnx-home-projects {
|
||||||
padding-block: 0;
|
padding-block: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ponytail: bare wrapper. The frame, background and min-height belong to
|
||||||
|
* .chrnx-character-stage inside it; duplicating them here drew two
|
||||||
|
* nested boxes.
|
||||||
|
*/
|
||||||
.chrnx-home-projects {
|
.chrnx-home-projects {
|
||||||
position: relative;
|
position: relative;
|
||||||
isolation: isolate;
|
|
||||||
min-height: 34rem;
|
|
||||||
overflow: hidden;
|
|
||||||
padding-inline: clamp(1.5rem, 5vw, 4rem);
|
|
||||||
border: 1px solid var(--chrnx-line);
|
|
||||||
border-radius: calc(var(--chrnx-radius) * 1.5);
|
|
||||||
background-color: var(--chrnx-surface);
|
|
||||||
background-image:
|
|
||||||
linear-gradient(125deg, var(--chrnx-surface) 0 58%, transparent 58%),
|
|
||||||
radial-gradient(circle at 80% 35%, var(--chrnx-accent-soft), transparent 48%);
|
|
||||||
box-shadow: var(--chrnx-shadow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects > h2,
|
.chrnx-selected-work__list {
|
||||||
.chrnx-home-projects > .wp-block-columns {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
max-width: 62%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-projects .wp-block-columns {
|
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0;
|
gap: 0;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
margin-bottom: 0;
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
border-top: 1px solid var(--chrnx-line);
|
border-top: 1px solid var(--chrnx-line);
|
||||||
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects .wp-block-column {
|
.chrnx-selected-work__item {
|
||||||
padding-block: 1.25rem;
|
padding-block: 1.25rem;
|
||||||
border-bottom: 1px solid var(--chrnx-line);
|
border-bottom: 1px solid var(--chrnx-line);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects .wp-block-column h3 {
|
.chrnx-selected-work__title {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
overflow-wrap: anywhere;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-selected-work__title a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-selected-work__title a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-selected-work__empty {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-responsive-portrait {
|
.chrnx-responsive-portrait {
|
||||||
@@ -514,22 +553,6 @@ footer a {
|
|||||||
filter: drop-shadow(0 2rem 2rem rgb(0 0 0 / 28%));
|
filter: drop-shadow(0 2rem 2rem rgb(0 0 0 / 28%));
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects > .chrnx-responsive-portrait {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 1;
|
|
||||||
right: clamp(0.5rem, 3vw, 2rem);
|
|
||||||
bottom: 0;
|
|
||||||
width: min(41%, 23rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-projects > .chrnx-responsive-portrait:last-child {
|
|
||||||
z-index: 0;
|
|
||||||
right: 24%;
|
|
||||||
width: min(28%, 15rem);
|
|
||||||
opacity: 0.38;
|
|
||||||
filter: saturate(0.55) contrast(1.08) drop-shadow(0 1rem 2rem rgb(0 0 0 / 24%));
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-music .wp-block-columns {
|
.chrnx-home-music .wp-block-columns {
|
||||||
position: relative;
|
position: relative;
|
||||||
isolation: isolate;
|
isolation: isolate;
|
||||||
@@ -699,7 +722,7 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
.chrnx-archive > h1,
|
.chrnx-archive > h1,
|
||||||
.chrnx-search > h1,
|
.chrnx-search > h1,
|
||||||
.chrnx-not-found > h1 {
|
.chrnx-not-found > h1 {
|
||||||
font-size: var(--wp--preset--font-size--display);
|
font-size: var(--wp--preset--font-size--x-large);
|
||||||
letter-spacing: -0.035em;
|
letter-spacing: -0.035em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -796,14 +819,311 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
object-position: bottom;
|
object-position: bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reads as a pull quote without claiming to quote anyone. */
|
||||||
|
.chrnx-music-note {
|
||||||
|
position: relative;
|
||||||
|
max-width: 46rem;
|
||||||
|
margin-block: clamp(2rem, 5vw, 3.5rem);
|
||||||
|
padding: clamp(1.5rem, 3vw, 2.25rem) clamp(1.5rem, 3vw, 2.5rem);
|
||||||
|
border-left: 3px solid var(--chrnx-accent);
|
||||||
|
border-radius: 0 var(--chrnx-radius) var(--chrnx-radius) 0;
|
||||||
|
background: color-mix(in srgb, var(--chrnx-surface) 90%, transparent);
|
||||||
|
font-size: clamp(1.1rem, 1rem + 0.55vw, 1.45rem);
|
||||||
|
line-height: 1.5;
|
||||||
|
text-wrap: pretty;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-music-note::before {
|
||||||
|
position: absolute;
|
||||||
|
top: -0.35em;
|
||||||
|
left: 0.35rem;
|
||||||
|
color: var(--chrnx-accent);
|
||||||
|
content: "\201C";
|
||||||
|
font-family: var(--wp--preset--font-family--heading);
|
||||||
|
font-size: 5rem;
|
||||||
|
line-height: 1;
|
||||||
|
opacity: 0.28;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.chrnx-release-list {
|
.chrnx-release-list {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Grunge release cards: torn light, heavy rule, dirt in the corners. */
|
||||||
.chrnx-release-card {
|
.chrnx-release-card {
|
||||||
padding: 1.5rem;
|
position: relative;
|
||||||
|
isolation: isolate;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 1.75rem 1.5rem 1.5rem;
|
||||||
|
border-color: color-mix(in srgb, var(--chrnx-accent) 30%, var(--chrnx-line));
|
||||||
|
border-top: 3px solid var(--chrnx-accent);
|
||||||
|
background-color: var(--chrnx-surface-raised);
|
||||||
|
background-image:
|
||||||
|
linear-gradient(118deg, transparent 0 44%, color-mix(in srgb, var(--chrnx-accent) 14%, transparent) 44.5% 46%, transparent 46.5%),
|
||||||
|
linear-gradient(154deg, transparent 0 72%, color-mix(in srgb, var(--chrnx-green) 10%, transparent) 72.5% 73.5%, transparent 74%),
|
||||||
|
radial-gradient(ellipse at 88% 6%, color-mix(in srgb, var(--chrnx-accent) 22%, transparent), transparent 58%),
|
||||||
|
radial-gradient(ellipse at 4% 100%, rgb(0 0 0 / 34%), transparent 46%);
|
||||||
|
transition: transform 160ms ease, border-color 160ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card::after {
|
||||||
|
position: absolute;
|
||||||
|
z-index: -1;
|
||||||
|
inset: 0;
|
||||||
|
background-image: repeating-linear-gradient(96deg, rgb(255 255 255 / 3.5%) 0 1px, transparent 1px 4px);
|
||||||
|
content: "";
|
||||||
|
mix-blend-mode: overlay;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card:hover {
|
||||||
|
border-top-color: var(--chrnx-green);
|
||||||
|
transform: translateY(-3px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__link {
|
||||||
|
display: block;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__art {
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
border: 1px solid var(--chrnx-line);
|
||||||
|
border-radius: calc(var(--chrnx-radius) * 0.6);
|
||||||
|
aspect-ratio: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__cover,
|
||||||
|
.chrnx-release-card__fallback {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__fallback,
|
||||||
|
.chrnx-release-detail__fallback {
|
||||||
|
background-color: var(--chrnx-surface);
|
||||||
|
background-image:
|
||||||
|
linear-gradient(132deg, transparent 0 46%, color-mix(in srgb, var(--chrnx-accent) 42%, transparent) 47% 50%, transparent 51%),
|
||||||
|
linear-gradient(28deg, transparent 0 64%, color-mix(in srgb, var(--chrnx-green) 26%, transparent) 65% 67%, transparent 68%),
|
||||||
|
radial-gradient(circle at 70% 28%, color-mix(in srgb, var(--chrnx-accent) 34%, transparent), transparent 52%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__title {
|
||||||
|
margin: 0 0 0.4rem;
|
||||||
|
text-wrap: balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__link:hover .chrnx-release-card__title {
|
||||||
|
color: var(--chrnx-green);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-card__status,
|
||||||
|
.chrnx-release-detail__status {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
font-family: var(--wp--preset--font-family--metadata);
|
||||||
|
font-size: var(--wp--preset--font-size--small);
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Platform icons: only rendered when a URL exists, never as dead links. */
|
||||||
|
.chrnx-platform-links {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.35rem;
|
||||||
|
margin: 0.85rem 0 0;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-platform-links__link {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-width: 44px;
|
||||||
|
min-height: 44px;
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-platform-links__link:hover,
|
||||||
|
.chrnx-platform-links__link:focus-visible {
|
||||||
|
background: color-mix(in srgb, var(--chrnx-green) 18%, transparent);
|
||||||
|
color: var(--chrnx-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Album page. */
|
||||||
|
.chrnx-release-detail__head {
|
||||||
|
display: grid;
|
||||||
|
gap: clamp(1.5rem, 4vw, 3rem);
|
||||||
|
grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
|
||||||
|
align-items: start;
|
||||||
|
margin-bottom: clamp(2rem, 5vw, 3.5rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-detail__head.is-bare {
|
||||||
|
grid-template-columns: minmax(0, 22rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-detail__art {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--chrnx-accent) 34%, var(--chrnx-line));
|
||||||
|
border-radius: var(--chrnx-radius);
|
||||||
|
aspect-ratio: 1;
|
||||||
|
box-shadow: var(--chrnx-shadow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-detail__cover,
|
||||||
|
.chrnx-release-detail__fallback {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-detail__description {
|
||||||
|
margin: 0.75rem 0 0;
|
||||||
|
color: var(--chrnx-text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-release-detail__empty {
|
||||||
|
padding: 2rem;
|
||||||
|
border: 1px dashed var(--chrnx-line);
|
||||||
|
border-radius: var(--chrnx-radius);
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tracklist: number, player, then title. */
|
||||||
|
.chrnx-tracklist {
|
||||||
|
display: grid;
|
||||||
|
gap: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border-top: 1px solid var(--chrnx-line);
|
||||||
|
list-style: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Explicit columns so a track without audio keeps its title in place. */
|
||||||
|
.chrnx-tracklist__item {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem 1rem;
|
||||||
|
grid-template-columns: 2.5rem minmax(0, 17rem) minmax(0, 1fr);
|
||||||
|
align-items: center;
|
||||||
|
padding-block: 1rem;
|
||||||
|
border-bottom: 1px solid var(--chrnx-line);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__player {
|
||||||
|
grid-column: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__body {
|
||||||
|
grid-column: 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__item:hover {
|
||||||
|
background: color-mix(in srgb, var(--chrnx-accent) 7%, transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__number {
|
||||||
|
grid-column: 1;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
font-family: var(--wp--preset--font-family--metadata);
|
||||||
|
font-size: var(--wp--preset--font-size--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__title {
|
||||||
|
margin: 0;
|
||||||
|
font-size: var(--wp--preset--font-size--medium);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__title a {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__title a:hover {
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__body .chrnx-platform-links {
|
||||||
|
margin-top: 0.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-player {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 17rem;
|
||||||
|
height: 2.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Single track page. */
|
||||||
|
.chrnx-track-meta {
|
||||||
|
display: grid;
|
||||||
|
gap: 1rem 1.5rem;
|
||||||
|
grid-template-columns: minmax(0, 20rem) minmax(0, 1fr);
|
||||||
|
align-items: center;
|
||||||
|
margin-block: 2rem;
|
||||||
|
padding: 1.25rem;
|
||||||
|
border: 1px solid color-mix(in srgb, var(--chrnx-accent) 30%, var(--chrnx-line));
|
||||||
|
border-left: 3px solid var(--chrnx-accent);
|
||||||
|
border-radius: var(--chrnx-radius);
|
||||||
|
background: var(--chrnx-surface-raised);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-meta__release {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-meta__label,
|
||||||
|
.chrnx-track-meta__number {
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
font-family: var(--wp--preset--font-family--metadata);
|
||||||
|
font-size: var(--wp--preset--font-size--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-meta__number {
|
||||||
|
display: block;
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-meta .chrnx-platform-links {
|
||||||
|
margin-top: 0.35rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
|
||||||
|
.chrnx-release-detail__head,
|
||||||
|
.chrnx-track-meta {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__item {
|
||||||
|
grid-template-columns: 2.5rem minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__body {
|
||||||
|
grid-column: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-tracklist__player {
|
||||||
|
grid-row: 2;
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-track-player {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-podcast-landing > .chrnx-responsive-portrait {
|
.chrnx-podcast-landing > .chrnx-responsive-portrait {
|
||||||
@@ -818,36 +1138,6 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
display: none;
|
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-journal-stream__empty,
|
||||||
.chrnx-not-found .wp-block-search,
|
.chrnx-not-found .wp-block-search,
|
||||||
.chrnx-search .wp-block-query-no-results {
|
.chrnx-search .wp-block-query-no-results {
|
||||||
@@ -899,11 +1189,6 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects > h2,
|
|
||||||
.chrnx-home-projects > .wp-block-columns {
|
|
||||||
max-width: 70%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-topic-hero {
|
.chrnx-topic-hero {
|
||||||
grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.6fr);
|
grid-template-columns: minmax(0, 1fr) minmax(12rem, 0.6fr);
|
||||||
}
|
}
|
||||||
@@ -957,30 +1242,12 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
min-height: 10rem;
|
min-height: 10rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home-projects {
|
|
||||||
min-height: 36rem;
|
|
||||||
padding-inline: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-projects > h2,
|
|
||||||
.chrnx-home-projects > .wp-block-columns {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-projects > .chrnx-responsive-portrait {
|
|
||||||
right: 0;
|
|
||||||
width: min(68%, 19rem);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-projects > .chrnx-responsive-portrait:last-child {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-home-music .wp-block-columns {
|
.chrnx-home-music .wp-block-columns {
|
||||||
padding: 2rem 1.5rem 0;
|
padding: 2rem 1.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-home > .chrnx-home-music {
|
.chrnx-home > .chrnx-home-music,
|
||||||
|
.chrnx-home > .chrnx-home-projects {
|
||||||
padding-block: 0;
|
padding-block: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1029,16 +1296,6 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
margin: 0 auto 2rem;
|
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) {
|
@media (prefers-reduced-motion: reduce) {
|
||||||
@@ -1056,10 +1313,6 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
.chrnx-related-card:hover {
|
.chrnx-related-card:hover {
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-about__portraits {
|
|
||||||
scroll-behavior: auto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Shared character-led section frame. */
|
/* Shared character-led section frame. */
|
||||||
@@ -1169,6 +1422,24 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The copy surface stays solid so text contrast stays guaranteed and testable.
|
||||||
|
* This strip continues it into the art column so the panel stops ending in a
|
||||||
|
* hard vertical line. It lives inside the art column to avoid overflowing the
|
||||||
|
* stage, and sits under the character. Text never reaches it.
|
||||||
|
*/
|
||||||
|
.chrnx-character-stage__art::after {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 0;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
width: clamp(2rem, 14%, 6rem);
|
||||||
|
background-image: linear-gradient(to right, var(--chrnx-character-copy-surface), transparent);
|
||||||
|
content: "";
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.chrnx-character-stage__art::before {
|
.chrnx-character-stage__art::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
@@ -1203,15 +1474,19 @@ html[data-theme="light"] .chrnx-home-music p {
|
|||||||
filter: var(--chrnx-character-shadow) saturate(0.96) contrast(1.04);
|
filter: var(--chrnx-character-shadow) saturate(0.96) contrast(1.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* An echo, not a second subject: pushed to the edge and faint enough that it
|
||||||
|
* reads as depth. At 0.34 next to the primary it looked like a duplicate.
|
||||||
|
*/
|
||||||
.chrnx-character-stage__secondary-art {
|
.chrnx-character-stage__secondary-art {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
right: 27%;
|
right: 2%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: min(29%, 18rem);
|
width: min(24%, 15rem);
|
||||||
height: auto;
|
height: auto;
|
||||||
opacity: 0.34;
|
opacity: 0.13;
|
||||||
filter: saturate(0.55) contrast(1.08) drop-shadow(0 1rem 2rem rgb(0 0 0 / 24%));
|
filter: saturate(0.25) contrast(1.12) blur(1px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-character-stage__atmosphere > .chrnx-responsive-portrait {
|
.chrnx-character-stage__atmosphere > .chrnx-responsive-portrait {
|
||||||
@@ -1291,6 +1566,18 @@ html[data-theme="light"] .chrnx-music-landing .chrnx-character-stage {
|
|||||||
--chrnx-character-copy-surface: rgb(13 17 23 / 86%);
|
--chrnx-character-copy-surface: rgb(13 17 23 / 86%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
|
||||||
|
:root:not([data-theme]) .chrnx-character-stage {
|
||||||
|
--chrnx-character-copy-surface: rgb(255 253 247 / 90%);
|
||||||
|
}
|
||||||
|
|
||||||
|
:root:not([data-theme]) .chrnx-home-music .chrnx-character-stage,
|
||||||
|
:root:not([data-theme]) .chrnx-music-landing .chrnx-character-stage {
|
||||||
|
--chrnx-character-copy-surface: rgb(13 17 23 / 86%);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.chrnx-home-music .chrnx-character-stage__content,
|
.chrnx-home-music .chrnx-character-stage__content,
|
||||||
.chrnx-home-music .chrnx-character-stage__content h2,
|
.chrnx-home-music .chrnx-character-stage__content h2,
|
||||||
.chrnx-home-music .chrnx-character-stage__content p,
|
.chrnx-home-music .chrnx-character-stage__content p,
|
||||||
@@ -1325,6 +1612,25 @@ html[data-theme="light"] .chrnx-music-landing .chrnx-character-stage {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Landscape backdrops sit behind everything and stay quiet under the copy. */
|
||||||
|
.chrnx-character-stage__atmosphere > .chrnx-responsive-atmosphere {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 0;
|
||||||
|
inset: 0;
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-character-stage__backdrop {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
object-position: right center;
|
||||||
|
opacity: 0.62;
|
||||||
|
}
|
||||||
|
|
||||||
.chrnx-music-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait,
|
.chrnx-music-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait,
|
||||||
.chrnx-podcast-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait {
|
.chrnx-podcast-landing .chrnx-character-stage__atmosphere > .chrnx-responsive-portrait {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -1417,16 +1723,6 @@ html[data-theme="light"] .chrnx-music-landing .chrnx-character-stage {
|
|||||||
box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 18%);
|
box-shadow: 0 1.5rem 3rem rgb(0 0 0 / 18%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-character-facets {
|
|
||||||
position: relative;
|
|
||||||
z-index: 0;
|
|
||||||
opacity: 0.84;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-character-facets .chrnx-section-portrait {
|
|
||||||
filter: saturate(0.72) contrast(1.02) drop-shadow(0 1rem 1.25rem rgb(0 0 0 / 20%));
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 780px) {
|
@media (max-width: 780px) {
|
||||||
|
|
||||||
.chrnx-topic-hero {
|
.chrnx-topic-hero {
|
||||||
@@ -1491,3 +1787,72 @@ html[data-theme="light"] .chrnx-music-landing .chrnx-character-stage {
|
|||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Subscribe form: rendered only when a provider endpoint is configured. */
|
||||||
|
.chrnx-subscribe-form {
|
||||||
|
max-width: 42rem;
|
||||||
|
margin-block: clamp(2rem, 5vw, 3rem);
|
||||||
|
padding: clamp(1.5rem, 4vw, 2.5rem);
|
||||||
|
border: 1px solid color-mix(in srgb, var(--chrnx-green) 30%, var(--chrnx-line));
|
||||||
|
border-left: 3px solid var(--chrnx-green);
|
||||||
|
border-radius: var(--chrnx-radius);
|
||||||
|
background: var(--chrnx-surface-raised);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__title {
|
||||||
|
margin: 0 0 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__note {
|
||||||
|
margin: 0 0 1.25rem;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__form {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem;
|
||||||
|
grid-template-columns: minmax(0, 1fr) auto;
|
||||||
|
align-items: end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__label {
|
||||||
|
grid-column: 1 / -1;
|
||||||
|
color: var(--chrnx-muted);
|
||||||
|
font-family: var(--wp--preset--font-family--metadata);
|
||||||
|
font-size: var(--wp--preset--font-size--small);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__input {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 45px;
|
||||||
|
padding-inline: 0.75rem;
|
||||||
|
border: 1px solid var(--chrnx-line);
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
background: var(--chrnx-bg);
|
||||||
|
color: var(--chrnx-text);
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__button {
|
||||||
|
min-height: 45px;
|
||||||
|
padding-inline: 1.25rem;
|
||||||
|
border: 0;
|
||||||
|
border-radius: 0.35rem;
|
||||||
|
background: var(--chrnx-green);
|
||||||
|
color: var(--chrnx-bg);
|
||||||
|
font: inherit;
|
||||||
|
font-weight: 700;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__button:hover {
|
||||||
|
background: color-mix(in srgb, var(--chrnx-green) 82%, var(--chrnx-text));
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 599px) {
|
||||||
|
|
||||||
|
.chrnx-subscribe-form__form {
|
||||||
|
grid-template-columns: minmax(0, 1fr);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,26 +101,64 @@ html[data-theme="light"] header.wp-block-template-part {
|
|||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-mobile-menu-toggle {
|
/* One icon language in the header: no resting outline, chip on hover/focus. */
|
||||||
|
.chrnx-mobile-menu-toggle,
|
||||||
|
.chrnx-header-search button,
|
||||||
|
.chrnx-theme-control > [data-chrnx-theme-button] {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 45px;
|
min-width: 45px;
|
||||||
min-height: 45px;
|
min-height: 45px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 1px solid currentcolor;
|
border: 0;
|
||||||
|
border-radius: 0.35rem;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
font-size: 1.4rem;
|
font: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.65;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-mobile-menu-toggle[hidden] {
|
.chrnx-mobile-menu-toggle:hover,
|
||||||
|
.chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||||
|
.chrnx-header-search button:hover,
|
||||||
|
.chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||||
|
.chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
|
||||||
|
color: var(--wp--preset--color--text);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-theme="light"] .chrnx-mobile-menu-toggle:hover,
|
||||||
|
html[data-theme="light"] .chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||||
|
html[data-theme="light"] .chrnx-header-search button:hover,
|
||||||
|
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||||
|
html[data-theme="light"] .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||||
|
color: var(--wp--preset--color--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
|
||||||
|
:root:not([data-theme]) .chrnx-mobile-menu-toggle:hover,
|
||||||
|
:root:not([data-theme]) .chrnx-mobile-menu-toggle[aria-expanded="true"],
|
||||||
|
:root:not([data-theme]) .chrnx-header-search button:hover,
|
||||||
|
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button]:hover,
|
||||||
|
:root:not([data-theme]) .chrnx-theme-control > [data-chrnx-theme-button][aria-expanded="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||||
|
color: var(--wp--preset--color--ink);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The shared rule above sets display, so hidden must win back explicitly. */
|
||||||
|
.chrnx-mobile-menu-toggle[hidden],
|
||||||
|
.chrnx-theme-control > [data-chrnx-theme-button][hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-primary-navigation a,
|
.chrnx-primary-navigation a,
|
||||||
.chrnx-footer-navigation a,
|
.chrnx-footer-navigation a,
|
||||||
.chrnx-header-search button,
|
|
||||||
.chrnx-header-search input {
|
.chrnx-header-search input {
|
||||||
min-width: 45px;
|
min-width: 45px;
|
||||||
min-height: 45px;
|
min-height: 45px;
|
||||||
@@ -155,18 +193,6 @@ html[data-theme="light"] header.wp-block-template-part {
|
|||||||
padding-inline: 0.75rem;
|
padding-inline: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-header-search button {
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0 0.75rem;
|
|
||||||
border: 1px solid currentcolor;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
font: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chrnx-screen-reader-text {
|
.chrnx-screen-reader-text {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
@@ -193,7 +219,7 @@ html[data-theme="light"] header.wp-block-template-part {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-theme-toggle legend {
|
.chrnx-theme-toggle__legend {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 1px;
|
height: 1px;
|
||||||
@@ -205,29 +231,50 @@ html[data-theme="light"] header.wp-block-template-part {
|
|||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-theme-toggle label {
|
/* No resting outline: the active choice reads as a filled chip instead. */
|
||||||
|
.chrnx-theme-toggle [data-chrnx-theme-value] {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 45px;
|
min-width: 45px;
|
||||||
min-height: 45px;
|
min-height: 45px;
|
||||||
padding: 0 0.45rem;
|
padding: 0;
|
||||||
border: 1px solid transparent;
|
border: 0;
|
||||||
border-radius: 0.35rem;
|
border-radius: 0.35rem;
|
||||||
|
background: transparent;
|
||||||
|
color: inherit;
|
||||||
|
font: inherit;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
opacity: 0.65;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-theme-toggle label:has(input:checked) {
|
.chrnx-theme-toggle [data-chrnx-theme-value] svg {
|
||||||
border-color: currentcolor;
|
width: 20px;
|
||||||
background: var(--wp--preset--color--panel);
|
height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-theme="light"] .chrnx-theme-toggle label:has(input:checked) {
|
.chrnx-theme-toggle [data-chrnx-theme-value]:hover {
|
||||||
background: var(--wp--preset--color--surface);
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-theme-toggle input {
|
/* Quiet chip, full-contrast label: accent-on-accent fails WCAG AA. */
|
||||||
accent-color: var(--wp--preset--color--green);
|
.chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--green) 24%, transparent);
|
||||||
|
color: var(--wp--preset--color--text);
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
html[data-theme="light"] .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||||
|
color: var(--wp--preset--color--ink);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
|
||||||
|
:root:not([data-theme]) .chrnx-theme-toggle [data-chrnx-theme-value][aria-pressed="true"] {
|
||||||
|
background: color-mix(in srgb, var(--wp--preset--color--light-green) 20%, transparent);
|
||||||
|
color: var(--wp--preset--color--ink);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.js .chrnx-header-search[data-expanded="false"] input {
|
.js .chrnx-header-search[data-expanded="false"] input {
|
||||||
@@ -407,16 +454,8 @@ html[data-theme="light"] footer.wp-block-template-part {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-theme-control > [data-chrnx-theme-button] {
|
.chrnx-theme-control > [data-chrnx-theme-button] {
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 45px;
|
width: 45px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
padding: 0;
|
|
||||||
border: 1px solid currentcolor;
|
|
||||||
background: transparent;
|
|
||||||
color: inherit;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-navigation-enhanced .chrnx-theme-control > [data-chrnx-theme-button] {
|
.chrnx-navigation-enhanced .chrnx-theme-control > [data-chrnx-theme-button] {
|
||||||
@@ -441,20 +480,25 @@ html[data-theme="light"] footer.wp-block-template-part {
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
border: 1px solid currentcolor;
|
border: 1px solid color-mix(in srgb, currentcolor 18%, transparent);
|
||||||
border-radius: 0.35rem;
|
border-radius: 0.35rem;
|
||||||
background: var(--wp--preset--color--panel);
|
background: var(--wp--preset--color--panel);
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 28%);
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-theme="light"].chrnx-navigation-enhanced .chrnx-theme-toggle {
|
html[data-theme="light"].chrnx-navigation-enhanced .chrnx-theme-toggle {
|
||||||
background: var(--wp--preset--color--surface);
|
background: var(--wp--preset--color--surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chrnx-navigation-enhanced .chrnx-theme-toggle label {
|
/*
|
||||||
|
* 45px, not 44: a floor set exactly at the WCAG minimum rounds to
|
||||||
|
* 43.99997px in Firefox and fails the target-size check.
|
||||||
|
*/
|
||||||
|
.chrnx-navigation-enhanced .chrnx-theme-toggle [data-chrnx-theme-value] {
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
min-width: 44px;
|
min-width: 45px;
|
||||||
min-height: 44px;
|
min-height: 45px;
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"source": "about-grunge.png",
|
||||||
|
"formats": [ "avif", "webp" ],
|
||||||
|
"widths": [ 384, 768, 1536 ]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"source": "placeholder-post.png",
|
||||||
|
"formats": [ "avif", "webp" ],
|
||||||
|
"widths": [ 384, 768 ]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"source": "placeholder-release.png",
|
||||||
|
"formats": [ "avif", "webp" ],
|
||||||
|
"widths": [ 384, 768 ]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"source": "projects-grunge.png",
|
||||||
|
"formats": [ "avif", "webp" ],
|
||||||
|
"widths": [ 384, 768, 1536 ]
|
||||||
|
}
|
||||||
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 3.4 MiB |
|
After Width: | Height: | Size: 2.4 MiB |
@@ -0,0 +1,50 @@
|
|||||||
|
( function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function initialize( doc, media ) {
|
||||||
|
const input = doc.querySelector( '[data-chrnx-release-cover]' );
|
||||||
|
const button = doc.querySelector( '[data-chrnx-release-cover-pick]' );
|
||||||
|
const preview = doc.querySelector( '[data-chrnx-release-cover-preview]' );
|
||||||
|
if ( ! input || ! button || ! preview || typeof media !== 'function' ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let frame = null;
|
||||||
|
button.addEventListener( 'click', function () {
|
||||||
|
if ( ! frame ) {
|
||||||
|
frame = media( {
|
||||||
|
title: button.textContent,
|
||||||
|
library: { type: 'image' },
|
||||||
|
multiple: false,
|
||||||
|
} );
|
||||||
|
frame.on( 'select', function () {
|
||||||
|
const attachment = frame.state().get( 'selection' ).first().toJSON();
|
||||||
|
input.value = attachment.id;
|
||||||
|
const source = attachment.sizes?.medium?.url || attachment.url;
|
||||||
|
preview.innerHTML = '';
|
||||||
|
const image = doc.createElement( 'img' );
|
||||||
|
image.src = source;
|
||||||
|
image.alt = attachment.alt || '';
|
||||||
|
image.style.maxWidth = '240px';
|
||||||
|
image.style.height = 'auto';
|
||||||
|
preview.append( image );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
frame.open();
|
||||||
|
} );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( typeof module !== 'undefined' && module.exports ) {
|
||||||
|
module.exports = { initialize };
|
||||||
|
} else if ( typeof document !== 'undefined' ) {
|
||||||
|
const start = function () {
|
||||||
|
initialize( document, window.wp && window.wp.media );
|
||||||
|
};
|
||||||
|
if ( document.readyState === 'loading' ) {
|
||||||
|
document.addEventListener( 'DOMContentLoaded', start, { once: true } );
|
||||||
|
} else {
|
||||||
|
start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} )();
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
( function ( factory ) {
|
||||||
|
if ( typeof module === 'object' && module.exports ) {
|
||||||
|
module.exports = factory();
|
||||||
|
} else {
|
||||||
|
factory().initialize( window.wp );
|
||||||
|
}
|
||||||
|
} )( function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function getTranslator( wp ) {
|
||||||
|
return wp.i18n && typeof wp.i18n.__ === 'function'
|
||||||
|
? wp.i18n.__
|
||||||
|
: function ( text ) {
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateMeta( editPost, currentMeta, key, value ) {
|
||||||
|
if ( typeof editPost !== 'function' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
editPost( { meta: { ...( currentMeta || {} ), [ key ]: value } } );
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasRequiredGlobals( wp ) {
|
||||||
|
return Boolean(
|
||||||
|
wp &&
|
||||||
|
wp.components &&
|
||||||
|
wp.components.ToggleControl &&
|
||||||
|
wp.data &&
|
||||||
|
typeof wp.data.useDispatch === 'function' &&
|
||||||
|
typeof wp.data.useSelect === 'function' &&
|
||||||
|
wp.editPost &&
|
||||||
|
wp.editPost.PluginDocumentSettingPanel &&
|
||||||
|
wp.element &&
|
||||||
|
typeof wp.element.createElement === 'function' &&
|
||||||
|
wp.plugins &&
|
||||||
|
typeof wp.plugins.registerPlugin === 'function',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialize( wp ) {
|
||||||
|
if ( ! hasRequiredGlobals( wp ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const __ = getTranslator( wp );
|
||||||
|
|
||||||
|
function ProjectPanel() {
|
||||||
|
const editorState = wp.data.useSelect( function ( select ) {
|
||||||
|
if ( typeof select !== 'function' ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentEditor = select( 'core/editor' );
|
||||||
|
const core = select( 'core' );
|
||||||
|
if (
|
||||||
|
! currentEditor ||
|
||||||
|
typeof currentEditor.getCurrentPostType !== 'function' ||
|
||||||
|
typeof currentEditor.getEditedPostAttribute !== 'function' ||
|
||||||
|
! core ||
|
||||||
|
typeof core.getEntityRecord !== 'function'
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const topicIds = currentEditor.getEditedPostAttribute( 'topic' );
|
||||||
|
return {
|
||||||
|
meta: currentEditor.getEditedPostAttribute( 'meta' ) || {},
|
||||||
|
postType: currentEditor.getCurrentPostType(),
|
||||||
|
topic:
|
||||||
|
Array.isArray( topicIds ) && topicIds.length === 1
|
||||||
|
? core.getEntityRecord( 'taxonomy', 'chrnx_topic', topicIds[ 0 ] )
|
||||||
|
: null,
|
||||||
|
};
|
||||||
|
}, [] );
|
||||||
|
const editorDispatch = wp.data.useDispatch( 'core/editor' );
|
||||||
|
if ( ! editorState || editorState.postType !== 'post' || ! editorDispatch?.editPost ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! editorState.topic || editorState.topic.slug !== 'projects' ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = editorState.meta;
|
||||||
|
|
||||||
|
return wp.element.createElement(
|
||||||
|
wp.editPost.PluginDocumentSettingPanel,
|
||||||
|
{ name: 'chrnx-project', title: __( 'Project', 'chrnx' ) },
|
||||||
|
wp.element.createElement( wp.components.ToggleControl, {
|
||||||
|
label: __( 'Show in Selected work', 'chrnx' ),
|
||||||
|
help: __(
|
||||||
|
'Selected work lists these first, then fills the rest with the most recent projects.',
|
||||||
|
'chrnx',
|
||||||
|
),
|
||||||
|
checked: Boolean( meta.chrnx_project_featured ),
|
||||||
|
onChange( value ) {
|
||||||
|
updateMeta( editorDispatch.editPost, meta, 'chrnx_project_featured', Boolean( value ) );
|
||||||
|
},
|
||||||
|
} ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
wp.plugins.registerPlugin( 'chrnx-project-meta', { render: ProjectPanel } );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { initialize, updateMeta };
|
||||||
|
} );
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
( function ( factory ) {
|
||||||
|
if ( typeof module === 'object' && module.exports ) {
|
||||||
|
module.exports = factory();
|
||||||
|
} else {
|
||||||
|
factory().initialize( window.wp );
|
||||||
|
}
|
||||||
|
} )( function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
function platformFields( __ ) {
|
||||||
|
return [
|
||||||
|
{ key: 'chrnx_track_url_suno', label: __( 'Suno URL', 'chrnx' ) },
|
||||||
|
{ key: 'chrnx_track_url_spotify', label: __( 'Spotify URL', 'chrnx' ) },
|
||||||
|
{ key: 'chrnx_track_url_apple', label: __( 'Apple Music URL', 'chrnx' ) },
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTranslator( wp ) {
|
||||||
|
return wp.i18n && typeof wp.i18n.__ === 'function'
|
||||||
|
? wp.i18n.__
|
||||||
|
: function ( text ) {
|
||||||
|
return text;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateMeta( editPost, currentMeta, key, value ) {
|
||||||
|
if ( typeof editPost !== 'function' ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
editPost( { meta: { ...( currentMeta || {} ), [ key ]: value } } );
|
||||||
|
}
|
||||||
|
|
||||||
|
function hasRequiredGlobals( wp ) {
|
||||||
|
return Boolean(
|
||||||
|
wp &&
|
||||||
|
wp.components &&
|
||||||
|
wp.components.TextControl &&
|
||||||
|
wp.components.Button &&
|
||||||
|
wp.blockEditor &&
|
||||||
|
wp.blockEditor.MediaUpload &&
|
||||||
|
wp.data &&
|
||||||
|
typeof wp.data.useDispatch === 'function' &&
|
||||||
|
typeof wp.data.useSelect === 'function' &&
|
||||||
|
wp.editPost &&
|
||||||
|
wp.editPost.PluginDocumentSettingPanel &&
|
||||||
|
wp.element &&
|
||||||
|
typeof wp.element.createElement === 'function' &&
|
||||||
|
wp.plugins &&
|
||||||
|
typeof wp.plugins.registerPlugin === 'function',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function initialize( wp ) {
|
||||||
|
if ( ! hasRequiredGlobals( wp ) ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const __ = getTranslator( wp );
|
||||||
|
const el = wp.element.createElement;
|
||||||
|
|
||||||
|
function TrackPanel() {
|
||||||
|
const editorState = wp.data.useSelect( function ( select ) {
|
||||||
|
if ( typeof select !== 'function' ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const currentEditor = select( 'core/editor' );
|
||||||
|
const core = select( 'core' );
|
||||||
|
if (
|
||||||
|
! currentEditor ||
|
||||||
|
typeof currentEditor.getCurrentPostType !== 'function' ||
|
||||||
|
typeof currentEditor.getEditedPostAttribute !== 'function' ||
|
||||||
|
! core ||
|
||||||
|
typeof core.getEntityRecord !== 'function'
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const topicIds = currentEditor.getEditedPostAttribute( 'topic' );
|
||||||
|
return {
|
||||||
|
meta: currentEditor.getEditedPostAttribute( 'meta' ) || {},
|
||||||
|
postType: currentEditor.getCurrentPostType(),
|
||||||
|
topic:
|
||||||
|
Array.isArray( topicIds ) && topicIds.length === 1
|
||||||
|
? core.getEntityRecord( 'taxonomy', 'chrnx_topic', topicIds[ 0 ] )
|
||||||
|
: null,
|
||||||
|
};
|
||||||
|
}, [] );
|
||||||
|
const editorDispatch = wp.data.useDispatch( 'core/editor' );
|
||||||
|
if ( ! editorState || editorState.postType !== 'post' || ! editorDispatch?.editPost ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! editorState.topic || editorState.topic.slug !== 'music' ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = editorState.meta;
|
||||||
|
const setMeta = function ( key, value ) {
|
||||||
|
updateMeta( editorDispatch.editPost, meta, key, value );
|
||||||
|
};
|
||||||
|
|
||||||
|
return el(
|
||||||
|
wp.editPost.PluginDocumentSettingPanel,
|
||||||
|
{ name: 'chrnx-track', title: __( 'Track', 'chrnx' ) },
|
||||||
|
el( wp.components.TextControl, {
|
||||||
|
label: __( 'Track number', 'chrnx' ),
|
||||||
|
type: 'number',
|
||||||
|
min: 0,
|
||||||
|
value: meta.chrnx_track_number ?? '',
|
||||||
|
onChange( value ) {
|
||||||
|
const number = Number.parseInt( value, 10 );
|
||||||
|
setMeta( 'chrnx_track_number', Number.isInteger( number ) ? Math.max( 0, number ) : 0 );
|
||||||
|
},
|
||||||
|
} ),
|
||||||
|
el( wp.blockEditor.MediaUpload, {
|
||||||
|
allowedTypes: [ 'audio' ],
|
||||||
|
value: meta.chrnx_track_audio || 0,
|
||||||
|
onSelect( attachment ) {
|
||||||
|
setMeta( 'chrnx_track_audio', attachment?.id ? Number( attachment.id ) : 0 );
|
||||||
|
},
|
||||||
|
render( { open } ) {
|
||||||
|
return el(
|
||||||
|
wp.components.Button,
|
||||||
|
{ variant: 'secondary', onClick: open },
|
||||||
|
meta.chrnx_track_audio
|
||||||
|
? __( 'Replace audio file', 'chrnx' )
|
||||||
|
: __( 'Select audio file', 'chrnx' ),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
} ),
|
||||||
|
meta.chrnx_track_audio
|
||||||
|
? el(
|
||||||
|
wp.components.Button,
|
||||||
|
{
|
||||||
|
variant: 'link',
|
||||||
|
isDestructive: true,
|
||||||
|
onClick() {
|
||||||
|
setMeta( 'chrnx_track_audio', 0 );
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__( 'Remove audio file', 'chrnx' ),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
...platformFields( __ ).map( function ( platform ) {
|
||||||
|
return el( wp.components.TextControl, {
|
||||||
|
key: platform.key,
|
||||||
|
label: platform.label,
|
||||||
|
type: 'url',
|
||||||
|
value: meta[ platform.key ] || '',
|
||||||
|
onChange( value ) {
|
||||||
|
setMeta( platform.key, value );
|
||||||
|
},
|
||||||
|
} );
|
||||||
|
} ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
wp.plugins.registerPlugin( 'chrnx-track-meta', { render: TrackPanel } );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { initialize, updateMeta, platformFields };
|
||||||
|
} );
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
const shell = menuButton && menuButton.parentElement;
|
const shell = menuButton && menuButton.parentElement;
|
||||||
const brand = shell && shell.querySelector( '.chrnx-site-brand' );
|
const brand = shell && shell.querySelector( '.chrnx-site-brand' );
|
||||||
const navLink = nav && nav.querySelector( 'a[href]' );
|
const navLink = nav && nav.querySelector( 'a[href]' );
|
||||||
const themeRadio = themePanel && themePanel.querySelector( 'input[type="radio"]' );
|
const themeRadio = themePanel && themePanel.querySelector( '[data-chrnx-theme-value]' );
|
||||||
const required = [
|
const required = [
|
||||||
menuButton,
|
menuButton,
|
||||||
nav,
|
nav,
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
let activePanel = null;
|
let activePanel = null;
|
||||||
|
|
||||||
const currentThemeRadio = () =>
|
const currentThemeRadio = () =>
|
||||||
themePanel.querySelector( 'input[type="radio"]:checked' ) || themeRadio;
|
themePanel.querySelector( '[data-chrnx-theme-value][aria-pressed="true"]' ) || themeRadio;
|
||||||
const restoreOriginalOrder = () => {
|
const restoreOriginalOrder = () => {
|
||||||
elements.forEach( ( element ) => {
|
elements.forEach( ( element ) => {
|
||||||
const anchor = anchors.get( element );
|
const anchor = anchors.get( element );
|
||||||
|
|||||||
@@ -77,7 +77,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const controls = [ ...doc.querySelectorAll( '[data-chrnx-theme-toggle] input[type="radio"]' ) ];
|
const controls = [
|
||||||
|
...doc.querySelectorAll( '[data-chrnx-theme-toggle] [data-chrnx-theme-value]' ),
|
||||||
|
];
|
||||||
const groups = [ ...doc.querySelectorAll( '[data-chrnx-theme-toggle]' ) ];
|
const groups = [ ...doc.querySelectorAll( '[data-chrnx-theme-toggle]' ) ];
|
||||||
let explicitPreference = readPreference( storage );
|
let explicitPreference = readPreference( storage );
|
||||||
let listening = false;
|
let listening = false;
|
||||||
@@ -89,7 +91,8 @@
|
|||||||
applyTheme( doc, resolved );
|
applyTheme( doc, resolved );
|
||||||
const selected = explicitPreference || 'system';
|
const selected = explicitPreference || 'system';
|
||||||
controls.forEach( ( control ) => {
|
controls.forEach( ( control ) => {
|
||||||
control.checked = control.value === selected;
|
const pressed = control.dataset.chrnxThemeValue === selected;
|
||||||
|
control.setAttribute( 'aria-pressed', String( pressed ) );
|
||||||
} );
|
} );
|
||||||
groups.forEach( ( group ) => {
|
groups.forEach( ( group ) => {
|
||||||
const status = group.querySelector( '[data-chrnx-theme-status]' );
|
const status = group.querySelector( '[data-chrnx-theme-status]' );
|
||||||
@@ -119,19 +122,52 @@
|
|||||||
listening = shouldListen;
|
listening = shouldListen;
|
||||||
};
|
};
|
||||||
const onChange = ( event ) => {
|
const onChange = ( event ) => {
|
||||||
const value = event.currentTarget.value;
|
const value = event.currentTarget.dataset.chrnxThemeValue;
|
||||||
explicitPreference = normalizePreference( value );
|
explicitPreference = normalizePreference( value );
|
||||||
writePreference( storage, value );
|
writePreference( storage, value );
|
||||||
setMediaListening( ! explicitPreference );
|
setMediaListening( ! explicitPreference );
|
||||||
update();
|
update();
|
||||||
};
|
};
|
||||||
|
|
||||||
controls.forEach( ( control ) => control.addEventListener( 'change', onChange ) );
|
// Buttons do not get the arrow-key roving a native radio group provides,
|
||||||
|
// so the group reimplements it: move focus and select, like radios did.
|
||||||
|
const STEPS = { ArrowLeft: -1, ArrowUp: -1, ArrowRight: 1, ArrowDown: 1 };
|
||||||
|
const onKeydown = ( event ) => {
|
||||||
|
const step = STEPS[ event.key ];
|
||||||
|
const toStart = event.key === 'Home';
|
||||||
|
const toEnd = event.key === 'End';
|
||||||
|
if ( step === undefined && ! toStart && ! toEnd ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const group = event.currentTarget.closest( '[data-chrnx-theme-toggle]' );
|
||||||
|
const siblings = group ? [ ...group.querySelectorAll( '[data-chrnx-theme-value]' ) ] : [];
|
||||||
|
const index = siblings.indexOf( event.currentTarget );
|
||||||
|
if ( index < 0 ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
let next = 0;
|
||||||
|
if ( toEnd ) {
|
||||||
|
next = siblings.length - 1;
|
||||||
|
} else if ( ! toStart ) {
|
||||||
|
next = ( index + step + siblings.length ) % siblings.length;
|
||||||
|
}
|
||||||
|
siblings[ next ].focus();
|
||||||
|
siblings[ next ].click();
|
||||||
|
};
|
||||||
|
|
||||||
|
controls.forEach( ( control ) => {
|
||||||
|
control.addEventListener( 'click', onChange );
|
||||||
|
control.addEventListener( 'keydown', onKeydown );
|
||||||
|
} );
|
||||||
setMediaListening( ! explicitPreference );
|
setMediaListening( ! explicitPreference );
|
||||||
update();
|
update();
|
||||||
|
|
||||||
cleanupCurrent = () => {
|
cleanupCurrent = () => {
|
||||||
controls.forEach( ( control ) => control.removeEventListener( 'change', onChange ) );
|
controls.forEach( ( control ) => {
|
||||||
|
control.removeEventListener( 'click', onChange );
|
||||||
|
control.removeEventListener( 'keydown', onKeydown );
|
||||||
|
} );
|
||||||
setMediaListening( false );
|
setMediaListening( false );
|
||||||
cleanupCurrent = null;
|
cleanupCurrent = null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/featured-stories",
|
"name": "chrnx/featured-stories",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Featured Stories",
|
"title": "Featured Stories",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "A sticky-led selection of topic-diverse stories.",
|
"description": "A sticky-led selection of topic-diverse stories.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/footer-content",
|
"name": "chrnx/footer-content",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "CHRNX Footer Content",
|
"title": "CHRNX Footer Content",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Display translated internal footer navigation and site credit.",
|
"description": "Display translated internal footer navigation and site credit.",
|
||||||
|
|||||||
@@ -5,28 +5,7 @@
|
|||||||
* @package CHRNX
|
* @package CHRNX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$chrnx_footer_links = array(
|
$chrnx_footer_links = chrnx_get_navigation_links( 'chrnx-footer' );
|
||||||
array(
|
|
||||||
'label' => __( 'Journal', 'chrnx' ),
|
|
||||||
'url' => home_url( '/journal/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Projects', 'chrnx' ),
|
|
||||||
'url' => home_url( '/projects/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Music', 'chrnx' ),
|
|
||||||
'url' => home_url( '/music/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Podcasts', 'chrnx' ),
|
|
||||||
'url' => home_url( '/podcasts/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'About', 'chrnx' ),
|
|
||||||
'url' => home_url( '/about/' ),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
$chrnx_site_name = get_bloginfo( 'name' );
|
$chrnx_site_name = get_bloginfo( 'name' );
|
||||||
$chrnx_current_url = chrnx_get_current_navigation_destination();
|
$chrnx_current_url = chrnx_get_current_navigation_destination();
|
||||||
$chrnx_copyright = sprintf(
|
$chrnx_copyright = sprintf(
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/header-tools",
|
"name": "chrnx/header-tools",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "CHRNX Header Tools",
|
"title": "CHRNX Header Tools",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Display translated primary navigation and progressive site search.",
|
"description": "Display translated primary navigation and progressive site search.",
|
||||||
|
|||||||
@@ -5,28 +5,7 @@
|
|||||||
* @package CHRNX
|
* @package CHRNX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$chrnx_header_links = array(
|
$chrnx_header_links = chrnx_get_navigation_links( 'chrnx-primary' );
|
||||||
array(
|
|
||||||
'label' => __( 'Journal', 'chrnx' ),
|
|
||||||
'url' => home_url( '/journal/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Projects', 'chrnx' ),
|
|
||||||
'url' => home_url( '/projects/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Music', 'chrnx' ),
|
|
||||||
'url' => home_url( '/music/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'Podcasts', 'chrnx' ),
|
|
||||||
'url' => home_url( '/podcasts/' ),
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'label' => __( 'About', 'chrnx' ),
|
|
||||||
'url' => home_url( '/about/' ),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
$chrnx_search_label = __( 'Search', 'chrnx' );
|
$chrnx_search_label = __( 'Search', 'chrnx' );
|
||||||
$chrnx_search_id = wp_unique_id( 'chrnx-search-' );
|
$chrnx_search_id = wp_unique_id( 'chrnx-search-' );
|
||||||
$chrnx_search_panel_id = wp_unique_id( 'chrnx-search-panel-' );
|
$chrnx_search_panel_id = wp_unique_id( 'chrnx-search-panel-' );
|
||||||
@@ -52,7 +31,7 @@ $chrnx_current_url = chrnx_get_current_navigation_destination();
|
|||||||
data-label-open="<?php echo esc_attr__( 'Open search', 'chrnx' ); ?>"
|
data-label-open="<?php echo esc_attr__( 'Open search', 'chrnx' ); ?>"
|
||||||
data-label-submit="<?php echo esc_attr( $chrnx_search_label ); ?>"
|
data-label-submit="<?php echo esc_attr( $chrnx_search_label ); ?>"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true">⌕</span>
|
<?php echo chrnx_get_icon_markup( 'search' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
|
||||||
<span class="chrnx-screen-reader-text"><?php echo esc_html( $chrnx_search_label ); ?></span>
|
<span class="chrnx-screen-reader-text"><?php echo esc_html( $chrnx_search_label ); ?></span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/journal-link",
|
"name": "chrnx/journal-link",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Journal Link",
|
"title": "Journal Link",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Display a translated portable link to the full Journal.",
|
"description": "Display a translated portable link to the full Journal.",
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/journal-stream",
|
"name": "chrnx/journal-stream",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Journal Stream",
|
"title": "Journal Stream",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "The filterable chronological journal.",
|
"description": "The filterable chronological journal.",
|
||||||
"textdomain": "chrnx",
|
"textdomain": "chrnx",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
|
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] },
|
||||||
|
"topic": { "type": "string", "default": "" }
|
||||||
},
|
},
|
||||||
"supports": { "html": false, "align": ["wide", "full"] },
|
"supports": { "html": false, "align": ["wide", "full"] },
|
||||||
"style": "file:./style.css",
|
"style": "file:./style.css",
|
||||||
|
|||||||
@@ -5,9 +5,15 @@
|
|||||||
* @package CHRNX
|
* @package CHRNX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// A pinned topic reuses the taxonomy-archive path: same fixed-filter UI, same
|
||||||
|
// hidden input, same clear link, without needing an archive route.
|
||||||
|
$chrnx_pinned_slug = chrnx_validate_editorial_term_slug( $attributes['topic'] ?? '', 'chrnx_topic' );
|
||||||
|
$chrnx_pinned_term = '' !== $chrnx_pinned_slug ? get_term_by( 'slug', $chrnx_pinned_slug, 'chrnx_topic' ) : null;
|
||||||
|
$chrnx_pinned_term = $chrnx_pinned_term instanceof WP_Term ? $chrnx_pinned_term : null;
|
||||||
|
|
||||||
// Read-only filters do not change server state; every value is validated by the query service.
|
// Read-only filters do not change server state; every value is validated by the query service.
|
||||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||||
$chrnx_request = chrnx_get_journal_request_context( is_array( $_GET ) ? $_GET : array() );
|
$chrnx_request = chrnx_get_journal_request_context( is_array( $_GET ) ? $_GET : array(), $chrnx_pinned_term );
|
||||||
$chrnx_args = chrnx_get_journal_query_args( $chrnx_request );
|
$chrnx_args = chrnx_get_journal_query_args( $chrnx_request );
|
||||||
$chrnx_query = chrnx_run_eligible_query( $chrnx_args );
|
$chrnx_query = chrnx_run_eligible_query( $chrnx_args );
|
||||||
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
|
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
|
||||||
@@ -17,10 +23,12 @@ $chrnx_show = chrnx_validate_editorial_term_slug( $chrnx_request['chrnx_show
|
|||||||
$chrnx_search = $chrnx_args['s'] ?? '';
|
$chrnx_search = $chrnx_args['s'] ?? '';
|
||||||
$chrnx_form_url = chrnx_get_journal_base_url();
|
$chrnx_form_url = chrnx_get_journal_base_url();
|
||||||
$chrnx_title_id = wp_unique_id( 'chrnx-journal-title-' );
|
$chrnx_title_id = wp_unique_id( 'chrnx-journal-title-' );
|
||||||
$chrnx_fixed = chrnx_get_journal_archive_filter();
|
$chrnx_fixed = chrnx_get_journal_archive_filter( $chrnx_pinned_term );
|
||||||
|
// A pinned stream is not the Journal; it is that topic's list, so it says so.
|
||||||
|
$chrnx_title = null !== $chrnx_pinned_term ? $chrnx_pinned_term->name : __( 'Journal', 'chrnx' );
|
||||||
?>
|
?>
|
||||||
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>">
|
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-journal-stream' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-labelledby="<?php echo esc_attr( $chrnx_title_id ); ?>">
|
||||||
<h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html__( 'Journal', 'chrnx' ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
<h<?php echo esc_attr( $chrnx_heading ); ?> id="<?php echo esc_attr( $chrnx_title_id ); ?>"><?php echo esc_html( $chrnx_title ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||||
<form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>">
|
<form class="chrnx-journal-stream__filters" method="get" action="<?php echo esc_url( $chrnx_form_url ); ?>">
|
||||||
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?>
|
<?php if ( isset( $chrnx_fixed['taxonomy'] ) && 'chrnx_topic' === $chrnx_fixed['taxonomy'] ) : ?>
|
||||||
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
|
<p class="chrnx-journal-stream__fixed-filter"><span><?php echo esc_html__( 'Topic', 'chrnx' ); ?></span> <strong><?php echo esc_html( $chrnx_fixed['label'] ); ?></strong></p>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/latest-podcast",
|
"name": "chrnx/latest-podcast",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Latest Podcast",
|
"title": "Latest Podcast",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "A linked card for the latest podcast episode.",
|
"description": "A linked card for the latest podcast episode.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/mobile-menu-toggle",
|
"name": "chrnx/mobile-menu-toggle",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "CHRNX Mobile Menu Toggle",
|
"title": "CHRNX Mobile Menu Toggle",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Progressively reveal the primary navigation on small screens.",
|
"description": "Progressively reveal the primary navigation on small screens.",
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ $chrnx_close_label = __( 'Close primary navigation', 'chrnx' );
|
|||||||
data-label-open="<?php echo esc_attr( $chrnx_open_label ); ?>"
|
data-label-open="<?php echo esc_attr( $chrnx_open_label ); ?>"
|
||||||
data-label-close="<?php echo esc_attr( $chrnx_close_label ); ?>"
|
data-label-close="<?php echo esc_attr( $chrnx_close_label ); ?>"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true">☰</span>
|
<?php echo chrnx_get_icon_markup( 'menu' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
|
||||||
</button>
|
</button>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/podcast-meta",
|
"name": "chrnx/podcast-meta",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Podcast Metadata",
|
"title": "Podcast Metadata",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Safe episode details for the current post.",
|
"description": "Safe episode details for the current post.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/reading-time",
|
"name": "chrnx/reading-time",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Reading Time",
|
"title": "Reading Time",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Display a localized estimate based on the current post content.",
|
"description": "Display a localized estimate based on the current post content.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/related-posts",
|
"name": "chrnx/related-posts",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Related Posts",
|
"title": "Related Posts",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Related stories selected by topic, tags, and recency.",
|
"description": "Related stories selected by topic, tags, and recency.",
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 3,
|
||||||
|
"name": "chrnx/release-detail",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"title": "Release Detail",
|
||||||
|
"category": "theme",
|
||||||
|
"description": "Album cover, listening links, and the ordered tracklist.",
|
||||||
|
"textdomain": "chrnx",
|
||||||
|
"attributes": {
|
||||||
|
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
|
||||||
|
},
|
||||||
|
"supports": { "html": false },
|
||||||
|
"render": "file:./render.php"
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Release Detail block render.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
$chrnx_term = get_queried_object();
|
||||||
|
if ( ! $chrnx_term instanceof WP_Term || 'chrnx_release' !== $chrnx_term->taxonomy ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
|
||||||
|
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
|
||||||
|
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
|
||||||
|
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
|
||||||
|
$chrnx_tracks = chrnx_get_release_track_ids( $chrnx_term->slug );
|
||||||
|
$chrnx_track_h = min( 6, $chrnx_heading + 1 );
|
||||||
|
// Without status, description or links there is no second column to fill.
|
||||||
|
$chrnx_has_intro = '' !== $chrnx_status || '' !== $chrnx_term->description || ! empty( $chrnx_links );
|
||||||
|
$chrnx_head_class = 'chrnx-release-detail__head' . ( $chrnx_has_intro ? '' : ' is-bare' );
|
||||||
|
?>
|
||||||
|
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-detail' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||||
|
<div class="<?php echo esc_attr( $chrnx_head_class ); ?>">
|
||||||
|
<div class="chrnx-release-detail__art">
|
||||||
|
<?php if ( $chrnx_cover > 0 ) : ?>
|
||||||
|
<?php echo wp_get_attachment_image( $chrnx_cover, 'large', false, array( 'class' => 'chrnx-release-detail__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-detail__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="chrnx-release-detail__intro">
|
||||||
|
<?php if ( '' !== $chrnx_status ) : ?>
|
||||||
|
<p class="chrnx-release-detail__status"><?php echo esc_html( $chrnx_status ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( '' !== $chrnx_term->description ) : ?>
|
||||||
|
<p class="chrnx-release-detail__description"><?php echo esc_html( $chrnx_term->description ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if ( empty( $chrnx_tracks ) ) : ?>
|
||||||
|
<p class="chrnx-release-detail__empty"><?php echo esc_html__( 'No published tracks yet.', 'chrnx' ); ?></p>
|
||||||
|
<?php else : ?>
|
||||||
|
<ol class="chrnx-tracklist">
|
||||||
|
<?php
|
||||||
|
foreach ( $chrnx_tracks as $chrnx_index => $chrnx_track_id ) :
|
||||||
|
$chrnx_number = absint( get_post_meta( $chrnx_track_id, 'chrnx_track_number', true ) );
|
||||||
|
$chrnx_player = chrnx_get_track_player_markup( $chrnx_track_id );
|
||||||
|
?>
|
||||||
|
<li class="chrnx-tracklist__item">
|
||||||
|
<span class="chrnx-tracklist__number" aria-hidden="true"><?php echo esc_html( str_pad( (string) ( $chrnx_number > 0 ? $chrnx_number : $chrnx_index + 1 ), 2, '0', STR_PAD_LEFT ) ); ?></span>
|
||||||
|
<?php if ( '' !== $chrnx_player ) : ?>
|
||||||
|
<div class="chrnx-tracklist__player"><?php echo $chrnx_player; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="chrnx-tracklist__body">
|
||||||
|
<h<?php echo esc_attr( $chrnx_track_h ); ?> class="chrnx-tracklist__title">
|
||||||
|
<a href="<?php echo esc_url( get_permalink( $chrnx_track_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_track_id ) ); ?></a>
|
||||||
|
</h<?php echo esc_attr( $chrnx_track_h ); ?>>
|
||||||
|
<?php echo chrnx_get_platform_links_markup( chrnx_get_track_links( $chrnx_track_id ), 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 3,
|
||||||
|
"name": "chrnx/release-list",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"title": "Release List",
|
||||||
|
"category": "theme",
|
||||||
|
"description": "The No Names releases, each linking to its album page.",
|
||||||
|
"textdomain": "chrnx",
|
||||||
|
"attributes": {
|
||||||
|
"headingLevel": { "type": "integer", "default": 4, "enum": [2, 3, 4, 5, 6] }
|
||||||
|
},
|
||||||
|
"supports": { "html": false },
|
||||||
|
"render": "file:./render.php"
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Release List block render.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 4, 4 );
|
||||||
|
$chrnx_terms = get_terms(
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'chrnx_release',
|
||||||
|
'hide_empty' => false,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ( is_wp_error( $chrnx_terms ) || empty( $chrnx_terms ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-release-list' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||||
|
<?php
|
||||||
|
foreach ( $chrnx_terms as $chrnx_term ) :
|
||||||
|
$chrnx_link = get_term_link( $chrnx_term );
|
||||||
|
$chrnx_status = (string) get_term_meta( $chrnx_term->term_id, 'chrnx_release_status', true );
|
||||||
|
$chrnx_cover = absint( get_term_meta( $chrnx_term->term_id, 'chrnx_release_cover', true ) );
|
||||||
|
$chrnx_links = chrnx_get_release_links( $chrnx_term->term_id );
|
||||||
|
?>
|
||||||
|
<article class="chrnx-release-card">
|
||||||
|
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
|
||||||
|
<a class="chrnx-release-card__link" href="<?php echo esc_url( $chrnx_link ); ?>">
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="chrnx-release-card__art">
|
||||||
|
<?php if ( $chrnx_cover > 0 ) : ?>
|
||||||
|
<?php echo wp_get_attachment_image( $chrnx_cover, 'chrnx-card', false, array( 'class' => 'chrnx-release-card__cover' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php echo chrnx_get_topic_portrait_markup( 'placeholder-release', '', 'chrnx-release-card__fallback' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</span>
|
||||||
|
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-release-card__title"><?php echo esc_html( $chrnx_term->name ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||||
|
<?php if ( '' !== $chrnx_status ) : ?>
|
||||||
|
<p class="chrnx-release-card__status"><?php echo esc_html( $chrnx_status ); ?></p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ( ! is_wp_error( $chrnx_link ) ) : ?>
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
</article>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 3,
|
||||||
|
"name": "chrnx/selected-work",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"title": "Selected Work",
|
||||||
|
"category": "theme",
|
||||||
|
"description": "Hand-picked projects first, then the most recent ones.",
|
||||||
|
"textdomain": "chrnx",
|
||||||
|
"attributes": {
|
||||||
|
"limit": { "type": "integer", "default": 3, "minimum": 1, "maximum": 12 },
|
||||||
|
"headingLevel": { "type": "integer", "default": 3, "enum": [2, 3, 4, 5, 6] }
|
||||||
|
},
|
||||||
|
"supports": { "html": false },
|
||||||
|
"render": "file:./render.php"
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Selected Work block render.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
$chrnx_limit = isset( $attributes['limit'] ) ? min( 12, max( 1, absint( $attributes['limit'] ) ) ) : 3;
|
||||||
|
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 3, 3 );
|
||||||
|
$chrnx_ids = chrnx_get_selected_project_ids( $chrnx_limit );
|
||||||
|
?>
|
||||||
|
<div <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-selected-work' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||||
|
<?php if ( empty( $chrnx_ids ) ) : ?>
|
||||||
|
<p class="chrnx-selected-work__empty"><?php echo esc_html__( 'No projects published yet.', 'chrnx' ); ?></p>
|
||||||
|
<?php else : ?>
|
||||||
|
<ul class="chrnx-selected-work__list">
|
||||||
|
<?php foreach ( $chrnx_ids as $chrnx_project_id ) : ?>
|
||||||
|
<li class="chrnx-selected-work__item">
|
||||||
|
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-selected-work__title">
|
||||||
|
<a href="<?php echo esc_url( get_permalink( $chrnx_project_id ) ); ?>"><?php echo esc_html( get_the_title( $chrnx_project_id ) ); ?></a>
|
||||||
|
</h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/site-brand",
|
"name": "chrnx/site-brand",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "CHRNX Site Brand",
|
"title": "CHRNX Site Brand",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Display the local CHRNX wordmark linked to the site home.",
|
"description": "Display the local CHRNX wordmark linked to the site home.",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/subscribe-cta",
|
"name": "chrnx/subscribe-cta",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Subscribe CTA",
|
"title": "Subscribe CTA",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "A call to action linked to the configured subscribe page.",
|
"description": "A call to action linked to the configured subscribe page.",
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 3,
|
||||||
|
"name": "chrnx/subscribe-form",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"title": "Subscribe Form",
|
||||||
|
"category": "theme",
|
||||||
|
"description": "The email subscription form, rendered only when a provider endpoint is configured.",
|
||||||
|
"textdomain": "chrnx",
|
||||||
|
"attributes": {
|
||||||
|
"headingLevel": { "type": "integer", "default": 2, "enum": [2, 3, 4, 5, 6] }
|
||||||
|
},
|
||||||
|
"supports": { "html": false },
|
||||||
|
"render": "file:./render.php"
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Subscribe Form block render.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
$chrnx_endpoint = chrnx_get_subscribe_endpoint();
|
||||||
|
// Nothing invented: without a configured provider there is no form to show.
|
||||||
|
if ( '' === $chrnx_endpoint ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chrnx_field = chrnx_get_subscribe_field_name();
|
||||||
|
$chrnx_heading = chrnx_get_heading_level( $attributes['headingLevel'] ?? 2, 2 );
|
||||||
|
$chrnx_input_id = wp_unique_id( 'chrnx-subscribe-email-' );
|
||||||
|
?>
|
||||||
|
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-subscribe-form' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||||
|
<h<?php echo esc_attr( $chrnx_heading ); ?> class="chrnx-subscribe-form__title"><?php echo esc_html__( 'Get new work by email', 'chrnx' ); ?></h<?php echo esc_attr( $chrnx_heading ); ?>>
|
||||||
|
<p class="chrnx-subscribe-form__note"><?php echo esc_html__( 'New stories, releases, and episodes. No tracking, and you can leave whenever you want.', 'chrnx' ); ?></p>
|
||||||
|
<form class="chrnx-subscribe-form__form" method="post" action="<?php echo esc_url( $chrnx_endpoint ); ?>" target="_blank" rel="noopener noreferrer">
|
||||||
|
<label class="chrnx-subscribe-form__label" for="<?php echo esc_attr( $chrnx_input_id ); ?>"><?php echo esc_html__( 'Email address', 'chrnx' ); ?></label>
|
||||||
|
<input
|
||||||
|
class="chrnx-subscribe-form__input"
|
||||||
|
id="<?php echo esc_attr( $chrnx_input_id ); ?>"
|
||||||
|
type="email"
|
||||||
|
name="<?php echo esc_attr( $chrnx_field ); ?>"
|
||||||
|
autocomplete="email"
|
||||||
|
inputmode="email"
|
||||||
|
spellcheck="false"
|
||||||
|
required
|
||||||
|
>
|
||||||
|
<button class="chrnx-subscribe-form__button" type="submit"><?php echo esc_html__( 'Subscribe', 'chrnx' ); ?></button>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/theme-toggle",
|
"name": "chrnx/theme-toggle",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Theme Toggle",
|
"title": "Theme Toggle",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "Choose a light, dark, or system color theme.",
|
"description": "Choose a light, dark, or system color theme.",
|
||||||
|
|||||||
@@ -5,9 +5,23 @@
|
|||||||
* @package CHRNX
|
* @package CHRNX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$chrnx_control_name = wp_unique_id( 'chrnx-theme-' );
|
|
||||||
$chrnx_panel_id = wp_unique_id( 'chrnx-theme-panel-' );
|
$chrnx_panel_id = wp_unique_id( 'chrnx-theme-panel-' );
|
||||||
|
$chrnx_legend_id = wp_unique_id( 'chrnx-theme-legend-' );
|
||||||
$chrnx_button_label = __( 'Choose color theme', 'chrnx' );
|
$chrnx_button_label = __( 'Choose color theme', 'chrnx' );
|
||||||
|
$chrnx_choices = array(
|
||||||
|
'light' => array(
|
||||||
|
'label' => __( 'Light', 'chrnx' ),
|
||||||
|
'icon' => '<circle cx="12" cy="12" r="4"/><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"/>',
|
||||||
|
),
|
||||||
|
'dark' => array(
|
||||||
|
'label' => __( 'Dark', 'chrnx' ),
|
||||||
|
'icon' => '<path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5Z"/>',
|
||||||
|
),
|
||||||
|
'system' => array(
|
||||||
|
'label' => __( 'System', 'chrnx' ),
|
||||||
|
'icon' => '<rect x="3" y="4" width="18" height="12" rx="2"/><path d="M8 20h8M12 16v4"/>',
|
||||||
|
),
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
<div class="chrnx-theme-control">
|
<div class="chrnx-theme-control">
|
||||||
<button
|
<button
|
||||||
@@ -18,10 +32,12 @@ $chrnx_button_label = __( 'Choose color theme', 'chrnx' );
|
|||||||
aria-expanded="false"
|
aria-expanded="false"
|
||||||
aria-label="<?php echo esc_attr( $chrnx_button_label ); ?>"
|
aria-label="<?php echo esc_attr( $chrnx_button_label ); ?>"
|
||||||
>
|
>
|
||||||
<span aria-hidden="true">◐</span>
|
<?php echo chrnx_get_icon_markup( 'theme' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns a fixed literal SVG. ?>
|
||||||
</button>
|
</button>
|
||||||
<fieldset
|
<div
|
||||||
id="<?php echo esc_attr( $chrnx_panel_id ); ?>"
|
id="<?php echo esc_attr( $chrnx_panel_id ); ?>"
|
||||||
|
role="group"
|
||||||
|
aria-labelledby="<?php echo esc_attr( $chrnx_legend_id ); ?>"
|
||||||
<?php
|
<?php
|
||||||
// WordPress escapes each generated wrapper attribute.
|
// WordPress escapes each generated wrapper attribute.
|
||||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
@@ -38,11 +54,20 @@ $chrnx_button_label = __( 'Choose color theme', 'chrnx' );
|
|||||||
data-status-system-light="<?php esc_attr_e( 'Light theme active, following system preference', 'chrnx' ); ?>"
|
data-status-system-light="<?php esc_attr_e( 'Light theme active, following system preference', 'chrnx' ); ?>"
|
||||||
data-status-system-dark="<?php esc_attr_e( 'Dark theme active, following system preference', 'chrnx' ); ?>"
|
data-status-system-dark="<?php esc_attr_e( 'Dark theme active, following system preference', 'chrnx' ); ?>"
|
||||||
>
|
>
|
||||||
<legend><?php esc_html_e( 'Color theme', 'chrnx' ); ?></legend>
|
<span class="chrnx-theme-toggle__legend" id="<?php echo esc_attr( $chrnx_legend_id ); ?>"><?php esc_html_e( 'Color theme', 'chrnx' ); ?></span>
|
||||||
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="light"> <?php esc_html_e( 'Light', 'chrnx' ); ?></label>
|
<?php
|
||||||
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="dark"> <?php esc_html_e( 'Dark', 'chrnx' ); ?></label>
|
foreach ( $chrnx_choices as $chrnx_value => $chrnx_choice ) {
|
||||||
<label><input type="radio" name="<?php echo esc_attr( $chrnx_control_name ); ?>" value="system" checked> <?php esc_html_e( 'System', 'chrnx' ); ?></label>
|
printf(
|
||||||
|
// The icon geometry is a fixed literal above, never user input.
|
||||||
|
'<button type="button" data-chrnx-theme-value="%1$s" aria-pressed="%2$s" title="%3$s"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%4$s</svg><span class="chrnx-screen-reader-text">%3$s</span></button>',
|
||||||
|
esc_attr( $chrnx_value ),
|
||||||
|
'system' === $chrnx_value ? 'true' : 'false',
|
||||||
|
esc_html( $chrnx_choice['label'] ),
|
||||||
|
$chrnx_choice['icon'] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
);
|
||||||
|
}
|
||||||
|
?>
|
||||||
<output data-chrnx-theme-status aria-live="polite"><?php esc_html_e( 'Following system theme', 'chrnx' ); ?></output>
|
<output data-chrnx-theme-status aria-live="polite"><?php esc_html_e( 'Following system theme', 'chrnx' ); ?></output>
|
||||||
</fieldset>
|
</div>
|
||||||
<noscript><p class="chrnx-theme-noscript"><?php esc_html_e( 'Enable JavaScript to choose a color theme.', 'chrnx' ); ?></p></noscript>
|
<noscript><p class="chrnx-theme-noscript"><?php esc_html_e( 'Enable JavaScript to choose a color theme.', 'chrnx' ); ?></p></noscript>
|
||||||
</div>
|
</div>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
"apiVersion": 3,
|
"apiVersion": 3,
|
||||||
"name": "chrnx/topic-hero",
|
"name": "chrnx/topic-hero",
|
||||||
"version": "0.1.0",
|
"version": "0.2.0",
|
||||||
"title": "Topic Hero",
|
"title": "Topic Hero",
|
||||||
"category": "theme",
|
"category": "theme",
|
||||||
"description": "A fixed-art hero for an editorial topic.",
|
"description": "A fixed-art hero for an editorial topic.",
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||||
|
"apiVersion": 3,
|
||||||
|
"name": "chrnx/track-meta",
|
||||||
|
"version": "0.2.0",
|
||||||
|
"title": "Track Meta",
|
||||||
|
"category": "theme",
|
||||||
|
"description": "Player, listening links, and album for one song.",
|
||||||
|
"textdomain": "chrnx",
|
||||||
|
"supports": { "html": false },
|
||||||
|
"render": "file:./render.php"
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Track Meta block render.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
$chrnx_post_id = isset( $block->context['postId'] ) ? absint( $block->context['postId'] ) : get_the_ID();
|
||||||
|
if ( ! chrnx_is_eligible_editorial_post( $chrnx_post_id ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chrnx_release = chrnx_get_track_release( $chrnx_post_id );
|
||||||
|
$chrnx_player = chrnx_get_track_player_markup( $chrnx_post_id );
|
||||||
|
$chrnx_links = chrnx_get_track_links( $chrnx_post_id );
|
||||||
|
$chrnx_number = absint( get_post_meta( $chrnx_post_id, 'chrnx_track_number', true ) );
|
||||||
|
|
||||||
|
// Nothing invented: without any track data this block stays silent.
|
||||||
|
if ( null === $chrnx_release && '' === $chrnx_player && empty( $chrnx_links ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$chrnx_release_link = null !== $chrnx_release ? get_term_link( $chrnx_release ) : null;
|
||||||
|
?>
|
||||||
|
<section <?php echo get_block_wrapper_attributes( array( 'class' => 'chrnx-track-meta' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> aria-label="<?php echo esc_attr__( 'Track details', 'chrnx' ); ?>">
|
||||||
|
<?php if ( '' !== $chrnx_player ) : ?>
|
||||||
|
<div class="chrnx-track-meta__player"><?php echo $chrnx_player; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="chrnx-track-meta__facts">
|
||||||
|
<?php if ( null !== $chrnx_release && ! is_wp_error( $chrnx_release_link ) ) : ?>
|
||||||
|
<p class="chrnx-track-meta__release">
|
||||||
|
<span class="chrnx-track-meta__label"><?php echo esc_html__( 'From', 'chrnx' ); ?></span>
|
||||||
|
<a href="<?php echo esc_url( $chrnx_release_link ); ?>"><?php echo esc_html( $chrnx_release->name ); ?></a>
|
||||||
|
<?php if ( $chrnx_number > 0 ) : ?>
|
||||||
|
<span class="chrnx-track-meta__number">
|
||||||
|
<?php
|
||||||
|
/* translators: %d: track number within the album. */
|
||||||
|
echo esc_html( sprintf( __( 'Track %d', 'chrnx' ), $chrnx_number ) );
|
||||||
|
?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php echo chrnx_get_platform_links_markup( $chrnx_links, 'chrnx-platform-links' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
define( 'CHRNX_VERSION', '0.1.0' );
|
define( 'CHRNX_VERSION', '0.2.0' );
|
||||||
|
|
||||||
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
|
||||||
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
|
foreach ( array( 'setup', 'assets', 'taxonomies', 'editor', 'podcast-meta', 'project-meta', 'release-meta', 'track-meta', 'settings', 'queries', 'media', 'blocks', 'theme-preference' ) as $module ) {
|
||||||
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
|
||||||
$path = get_theme_file_path( "inc/{$module}.php" );
|
$path = get_theme_file_path( "inc/{$module}.php" );
|
||||||
if ( file_exists( $path ) ) {
|
if ( file_exists( $path ) ) {
|
||||||
|
|||||||
@@ -95,9 +95,106 @@ function chrnx_get_card_media_markup( $post_id, $class_name ) {
|
|||||||
array( 'class' => $class_name . '__image' )
|
array( 'class' => $class_name . '__image' )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A track with no art of its own borrows its album cover before falling back.
|
||||||
|
$release = function_exists( 'chrnx_get_track_release' ) ? chrnx_get_track_release( $post_id ) : null;
|
||||||
|
if ( null !== $release ) {
|
||||||
|
$cover_id = absint( get_term_meta( $release->term_id, 'chrnx_release_cover', true ) );
|
||||||
|
if ( $cover_id > 0 ) {
|
||||||
|
return wp_get_attachment_image(
|
||||||
|
$cover_id,
|
||||||
|
'chrnx-card',
|
||||||
|
false,
|
||||||
|
array( 'class' => $class_name . '__image' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$topic = chrnx_get_post_topic_slug( $post_id );
|
$topic = chrnx_get_post_topic_slug( $post_id );
|
||||||
$class = $class_name . '__fallback' . ( '' !== $topic ? ' is-topic-' . sanitize_html_class( $topic ) : '' );
|
$class = $class_name . '__fallback' . ( '' !== $topic ? ' is-topic-' . sanitize_html_class( $topic ) : '' );
|
||||||
return '<span class="' . esc_attr( $class ) . '" aria-hidden="true"></span>';
|
return chrnx_get_topic_portrait_markup( 'placeholder-post', '', $class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the navigation links for one theme menu location.
|
||||||
|
*
|
||||||
|
* The built-in list is a fallback, not a contract: a site whose pages are named
|
||||||
|
* differently would otherwise get a header full of 404s.
|
||||||
|
*
|
||||||
|
* @param string $location Registered menu location.
|
||||||
|
* @return array<int,array<string,string>> Label and URL pairs.
|
||||||
|
*/
|
||||||
|
function chrnx_get_navigation_links( $location ) {
|
||||||
|
$assigned = get_nav_menu_locations();
|
||||||
|
$menu_id = isset( $assigned[ $location ] ) ? absint( $assigned[ $location ] ) : 0;
|
||||||
|
if ( $menu_id > 0 ) {
|
||||||
|
$items = wp_get_nav_menu_items( $menu_id );
|
||||||
|
if ( is_array( $items ) ) {
|
||||||
|
$links = array();
|
||||||
|
foreach ( $items as $item ) {
|
||||||
|
// Only top-level entries: the header is a single flat row.
|
||||||
|
if ( absint( $item->menu_item_parent ) > 0 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$url = esc_url_raw( (string) $item->url );
|
||||||
|
$label = trim( wp_strip_all_tags( (string) $item->title ) );
|
||||||
|
if ( '' !== $url && '' !== $label ) {
|
||||||
|
$links[] = array(
|
||||||
|
'label' => $label,
|
||||||
|
'url' => $url,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( ! empty( $links ) ) {
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaults = array( 'journal', 'projects', 'music', 'podcasts', 'about' );
|
||||||
|
$labels = array(
|
||||||
|
'journal' => __( 'Journal', 'chrnx' ),
|
||||||
|
'projects' => __( 'Projects', 'chrnx' ),
|
||||||
|
'music' => __( 'Music', 'chrnx' ),
|
||||||
|
'podcasts' => __( 'Podcasts', 'chrnx' ),
|
||||||
|
'about' => __( 'About', 'chrnx' ),
|
||||||
|
);
|
||||||
|
$links = array();
|
||||||
|
foreach ( $defaults as $slug ) {
|
||||||
|
$links[] = array(
|
||||||
|
'label' => $labels[ $slug ],
|
||||||
|
'url' => home_url( '/' . $slug . '/' ),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render one allowlisted interface icon.
|
||||||
|
*
|
||||||
|
* Unicode glyphs render inconsistently across platforms and fonts, so every
|
||||||
|
* control icon comes from this one place instead.
|
||||||
|
*
|
||||||
|
* @param string $name Allowlisted icon name.
|
||||||
|
* @param int $size Square pixel size.
|
||||||
|
* @return string Escaped inline SVG, or an empty string for unknown names.
|
||||||
|
*/
|
||||||
|
function chrnx_get_icon_markup( $name, $size = 20 ) {
|
||||||
|
$icons = array(
|
||||||
|
'search' => '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.6-3.6"/>',
|
||||||
|
'menu' => '<path d="M4 7h16M4 12h16M4 17h16"/>',
|
||||||
|
'theme' => '<circle cx="12" cy="12" r="9"/><path d="M12 3a9 9 0 0 1 0 18Z" fill="currentColor" stroke="none"/>',
|
||||||
|
);
|
||||||
|
if ( ! isset( $icons[ $name ] ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf(
|
||||||
|
// The path data is a fixed literal, never user input.
|
||||||
|
'<svg viewBox="0 0 24 24" width="%1$d" height="%1$d" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%2$s</svg>',
|
||||||
|
absint( $size ),
|
||||||
|
$icons[ $name ] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,16 +212,16 @@ function chrnx_get_editorial_card_markup( $post_id, $heading_level = 3, $class_n
|
|||||||
$post = get_post( $post_id );
|
$post = get_post( $post_id );
|
||||||
$heading_level = chrnx_get_heading_level( $heading_level, 3 );
|
$heading_level = chrnx_get_heading_level( $heading_level, 3 );
|
||||||
$topic_terms = get_the_terms( $post_id, 'chrnx_topic' );
|
$topic_terms = get_the_terms( $post_id, 'chrnx_topic' );
|
||||||
$topic_label = ! is_wp_error( $topic_terms ) && ! empty( $topic_terms ) ? $topic_terms[0]->name : '';
|
// A card without a topic left an empty slot and knocked the row out of alignment.
|
||||||
$excerpt = wp_trim_words( wp_strip_all_tags( get_the_excerpt( $post ) ), 24 );
|
// Untopiced posts are still Journal entries, so that is the honest fallback.
|
||||||
|
$topic_label = ! is_wp_error( $topic_terms ) && ! empty( $topic_terms ) ? $topic_terms[0]->name : __( 'Journal', 'chrnx' );
|
||||||
|
$excerpt = wp_trim_words( wp_strip_all_tags( get_the_excerpt( $post ) ), 24 );
|
||||||
|
|
||||||
$markup = '<article class="' . esc_attr( $class_name ) . '">';
|
$markup = '<article class="' . esc_attr( $class_name ) . '">';
|
||||||
$markup .= '<a class="' . esc_attr( $class_name . '__link' ) . '" href="' . esc_url( get_permalink( $post ) ) . '">';
|
$markup .= '<a class="' . esc_attr( $class_name . '__link' ) . '" href="' . esc_url( get_permalink( $post ) ) . '">';
|
||||||
$markup .= chrnx_get_card_media_markup( $post_id, $class_name );
|
$markup .= chrnx_get_card_media_markup( $post_id, $class_name );
|
||||||
$markup .= '<span class="' . esc_attr( $class_name . '__content' ) . '">';
|
$markup .= '<span class="' . esc_attr( $class_name . '__content' ) . '">';
|
||||||
if ( '' !== $topic_label ) {
|
$markup .= '<span class="' . esc_attr( $class_name . '__badge' ) . '">' . esc_html( $topic_label ) . '</span>';
|
||||||
$markup .= '<span class="' . esc_attr( $class_name . '__badge' ) . '">' . esc_html( $topic_label ) . '</span>';
|
|
||||||
}
|
|
||||||
$markup .= '<h' . $heading_level . ' class="' . esc_attr( $class_name . '__title' ) . '">' . esc_html( get_the_title( $post ) ) . '</h' . $heading_level . '>';
|
$markup .= '<h' . $heading_level . ' class="' . esc_attr( $class_name . '__title' ) . '">' . esc_html( get_the_title( $post ) ) . '</h' . $heading_level . '>';
|
||||||
if ( '' !== $excerpt ) {
|
if ( '' !== $excerpt ) {
|
||||||
$markup .= '<span class="' . esc_attr( $class_name . '__excerpt' ) . '">' . esc_html( $excerpt ) . '</span>';
|
$markup .= '<span class="' . esc_attr( $class_name . '__excerpt' ) . '">' . esc_html( $excerpt ) . '</span>';
|
||||||
@@ -135,7 +232,7 @@ function chrnx_get_editorial_card_markup( $post_id, $heading_level = 3, $class_n
|
|||||||
|
|
||||||
/** Register all block metadata directories that exist. */
|
/** Register all block metadata directories that exist. */
|
||||||
function chrnx_register_editorial_blocks() {
|
function chrnx_register_editorial_blocks() {
|
||||||
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link' );
|
$blocks = array( 'featured-stories', 'journal-stream', 'latest-podcast', 'podcast-meta', 'topic-hero', 'related-posts', 'subscribe-cta', 'theme-toggle', 'site-brand', 'mobile-menu-toggle', 'footer-content', 'header-tools', 'reading-time', 'journal-link', 'selected-work', 'release-list', 'release-detail', 'track-meta', 'subscribe-form' );
|
||||||
foreach ( $blocks as $block ) {
|
foreach ( $blocks as $block ) {
|
||||||
$name = 'chrnx/' . $block;
|
$name = 'chrnx/' . $block;
|
||||||
if ( WP_Block_Type_Registry::get_instance()->is_registered( $name ) ) {
|
if ( WP_Block_Type_Registry::get_instance()->is_registered( $name ) ) {
|
||||||
|
|||||||
@@ -45,7 +45,25 @@ function chrnx_enqueue_editor_assets() {
|
|||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
wp_enqueue_script(
|
||||||
|
'chrnx-editor-project',
|
||||||
|
get_theme_file_uri( 'assets/js/editor-project.js' ),
|
||||||
|
array( 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
|
||||||
|
CHRNX_VERSION,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
wp_enqueue_script(
|
||||||
|
'chrnx-editor-track',
|
||||||
|
get_theme_file_uri( 'assets/js/editor-track.js' ),
|
||||||
|
array( 'wp-block-editor', 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-element', 'wp-i18n', 'wp-plugins' ),
|
||||||
|
CHRNX_VERSION,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
wp_set_script_translations( 'chrnx-editor-taxonomies', 'chrnx', get_theme_file_path( 'languages' ) );
|
wp_set_script_translations( 'chrnx-editor-taxonomies', 'chrnx', get_theme_file_path( 'languages' ) );
|
||||||
wp_set_script_translations( 'chrnx-editor-podcast', 'chrnx', get_theme_file_path( 'languages' ) );
|
wp_set_script_translations( 'chrnx-editor-podcast', 'chrnx', get_theme_file_path( 'languages' ) );
|
||||||
|
wp_set_script_translations( 'chrnx-editor-project', 'chrnx', get_theme_file_path( 'languages' ) );
|
||||||
|
wp_set_script_translations( 'chrnx-editor-track', 'chrnx', get_theme_file_path( 'languages' ) );
|
||||||
}
|
}
|
||||||
add_action( 'enqueue_block_editor_assets', 'chrnx_enqueue_editor_assets' );
|
add_action( 'enqueue_block_editor_assets', 'chrnx_enqueue_editor_assets' );
|
||||||
@@ -37,7 +37,10 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
|
|||||||
$markup = '<picture class="chrnx-responsive-portrait"' . $decorative . '>';
|
$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/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 .= '<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="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
// The fallback is the 768 WebP, not the multi-megabyte master: every browser
|
||||||
|
// that renders <picture> has supported WebP since 2020, and shipping design
|
||||||
|
// masters as a runtime fallback cost megabytes per image.
|
||||||
|
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-768.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '"' . $priority . ' decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||||
$markup .= '</picture>';
|
$markup .= '</picture>';
|
||||||
|
|
||||||
return $markup;
|
return $markup;
|
||||||
@@ -51,7 +54,7 @@ function chrnx_get_topic_portrait_markup( string $topic_slug, string $alt = '',
|
|||||||
* @return string Safe picture markup or an empty string.
|
* @return string Safe picture markup or an empty string.
|
||||||
*/
|
*/
|
||||||
function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = '' ): string {
|
function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = '' ): string {
|
||||||
if ( 'podcast-frequency' !== $asset_key ) {
|
if ( ! in_array( $asset_key, array( 'podcast-frequency', 'about-grunge', 'projects-grunge' ), true ) ) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +76,7 @@ function chrnx_get_atmosphere_markup( string $asset_key, string $class_name = ''
|
|||||||
$markup = '<picture class="chrnx-responsive-atmosphere" aria-hidden="true">';
|
$markup = '<picture class="chrnx-responsive-atmosphere" aria-hidden="true">';
|
||||||
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w, ' . esc_url( $base_uri . '-1536.avif' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
|
$markup .= '<source type="image/avif" srcset="' . esc_url( $base_uri . '-384.avif' ) . ' 384w, ' . esc_url( $base_uri . '-768.avif' ) . ' 768w, ' . esc_url( $base_uri . '-1536.avif' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
|
||||||
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w, ' . esc_url( $base_uri . '-1536.webp' ) . ' 1536w" sizes="' . esc_attr( $sizes ) . '">';
|
$markup .= '<source type="image/webp" srcset="' . esc_url( $base_uri . '-384.webp' ) . ' 384w, ' . esc_url( $base_uri . '-768.webp' ) . ' 768w, ' . esc_url( $base_uri . '-1536.webp' ) . ' 1536w" 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="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
$markup .= '<img' . ( '' !== $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . ' src="' . esc_url( $base_uri . '-1536.webp' ) . '" width="' . esc_attr( $dimensions[0] ) . '" height="' . esc_attr( $dimensions[1] ) . '" loading="' . esc_attr( $loading ) . '" decoding="async" sizes="' . esc_attr( $sizes ) . '" alt="' . esc_attr( $alt ) . '">';
|
||||||
$markup .= '</picture>';
|
$markup .= '</picture>';
|
||||||
|
|
||||||
return $markup;
|
return $markup;
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Project post metadata.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require permission to edit the post owning project metadata.
|
||||||
|
*
|
||||||
|
* @param bool $allowed Previously calculated permission.
|
||||||
|
* @param string $meta_key Metadata key.
|
||||||
|
* @param int $post_id Post ID.
|
||||||
|
* @return bool Whether the current user can edit the post.
|
||||||
|
*/
|
||||||
|
function chrnx_auth_project_meta( $allowed, $meta_key, $post_id ) {
|
||||||
|
return current_user_can( 'edit_post', $post_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register project metadata for posts.
|
||||||
|
*/
|
||||||
|
function chrnx_register_project_meta() {
|
||||||
|
register_post_meta(
|
||||||
|
'post',
|
||||||
|
'chrnx_project_featured',
|
||||||
|
array(
|
||||||
|
'type' => 'boolean',
|
||||||
|
'single' => true,
|
||||||
|
'default' => false,
|
||||||
|
'show_in_rest' => array( 'schema' => array( 'type' => 'boolean' ) ),
|
||||||
|
'sanitize_callback' => 'rest_sanitize_boolean',
|
||||||
|
'auth_callback' => 'chrnx_auth_project_meta',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'init', 'chrnx_register_project_meta' );
|
||||||
@@ -262,6 +262,59 @@ function chrnx_get_featured_story_ids( int $limit = 3 ): array {
|
|||||||
return $selected;
|
return $selected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select projects for the Selected work stage: hand-picked first, then recent.
|
||||||
|
*
|
||||||
|
* Sticky already belongs to the home featured stories, so the editorial choice
|
||||||
|
* lives in its own per-post flag instead of competing for the same signal.
|
||||||
|
*
|
||||||
|
* @param int $limit Maximum projects, bounded to 12.
|
||||||
|
* @return int[] Selected project post IDs.
|
||||||
|
*/
|
||||||
|
function chrnx_get_selected_project_ids( int $limit = 3 ): array {
|
||||||
|
$limit = min( 12, max( 0, $limit ) );
|
||||||
|
if ( 0 === $limit ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$topic_query = array(
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'chrnx_topic',
|
||||||
|
'field' => 'slug',
|
||||||
|
'terms' => 'projects',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
$selected = chrnx_get_eligible_editorial_post_ids(
|
||||||
|
array(
|
||||||
|
'posts_per_page' => $limit,
|
||||||
|
'tax_query' => $topic_query,
|
||||||
|
'meta_query' => array(
|
||||||
|
array(
|
||||||
|
'key' => 'chrnx_project_featured',
|
||||||
|
'value' => '1',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$remaining = $limit - count( $selected );
|
||||||
|
if ( $remaining > 0 ) {
|
||||||
|
$selected = array_merge(
|
||||||
|
$selected,
|
||||||
|
chrnx_get_eligible_editorial_post_ids(
|
||||||
|
array(
|
||||||
|
'posts_per_page' => $remaining,
|
||||||
|
'post__not_in' => $selected,
|
||||||
|
'tax_query' => $topic_query,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $selected;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a request taxonomy slug against an existing editorial term.
|
* Validate a request taxonomy slug against an existing editorial term.
|
||||||
*
|
*
|
||||||
@@ -624,15 +677,20 @@ function chrnx_get_related_post_ids( int $post_id, int $limit = 3 ): array {
|
|||||||
*/
|
*/
|
||||||
function chrnx_get_topic_art_asset( string $topic_slug ): string {
|
function chrnx_get_topic_art_asset( string $topic_slug ): string {
|
||||||
$mapping = array(
|
$mapping = array(
|
||||||
'research' => 'alter-ego-research.png',
|
'research' => 'alter-ego-research.png',
|
||||||
'code' => 'alter-ego-code.png',
|
'code' => 'alter-ego-code.png',
|
||||||
'literature' => 'alter-ego-literature.png',
|
'projects' => 'alter-ego-code.png',
|
||||||
'music' => 'the-no-names-musician-cutout.png',
|
'literature' => 'alter-ego-literature.png',
|
||||||
'music-collage' => 'the-no-names-collage.jpeg',
|
'music' => 'the-no-names-musician-cutout.png',
|
||||||
'podcast-frequency' => 'podcast-frequency-grunge.png',
|
'music-collage' => 'the-no-names-collage.jpeg',
|
||||||
'podcasts' => 'alter-ego-podcasts.png',
|
'podcast-frequency' => 'podcast-frequency-grunge.png',
|
||||||
'life' => 'alter-ego-life.png',
|
'about-grunge' => 'about-grunge.png',
|
||||||
'gaming' => 'alter-ego-gaming-half-body.png',
|
'placeholder-post' => 'placeholder-post.png',
|
||||||
|
'placeholder-release' => 'placeholder-release.png',
|
||||||
|
'projects-grunge' => 'projects-grunge.png',
|
||||||
|
'podcasts' => 'alter-ego-podcasts.png',
|
||||||
|
'life' => 'alter-ego-life.png',
|
||||||
|
'gaming' => 'alter-ego-gaming-half-body.png',
|
||||||
);
|
);
|
||||||
return isset( $mapping[ $topic_slug ] ) ? 'assets/images/' . $mapping[ $topic_slug ] : '';
|
return isset( $mapping[ $topic_slug ] ) ? 'assets/images/' . $mapping[ $topic_slug ] : '';
|
||||||
}
|
}
|
||||||
@@ -648,9 +706,18 @@ function chrnx_get_topic_art_dimensions( string $topic_slug ): array {
|
|||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'podcast-frequency' === $topic_slug ) {
|
// The landscape atmosphere backgrounds share one intrinsic size.
|
||||||
|
if ( in_array( $topic_slug, array( 'podcast-frequency', 'about-grunge', 'projects-grunge' ), true ) ) {
|
||||||
return array( 1536, 1024 );
|
return array( 1536, 1024 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( 'placeholder-post' === $topic_slug ) {
|
||||||
|
return array( 1440, 960 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'placeholder-release' === $topic_slug ) {
|
||||||
|
return array( 1536, 1536 );
|
||||||
|
}
|
||||||
|
|
||||||
return 'gaming' === $topic_slug ? array( 1024, 1536 ) : array( 1122, 1402 );
|
return 'gaming' === $topic_slug ? array( 1024, 1536 ) : array( 1122, 1402 );
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,258 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Release (album) term metadata and shared platform links.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the supported streaming platforms in display order.
|
||||||
|
*
|
||||||
|
* @return array<string,array<string,string>> Platform key to label and icon path data.
|
||||||
|
*/
|
||||||
|
function chrnx_get_release_platforms() {
|
||||||
|
return array(
|
||||||
|
'suno' => array(
|
||||||
|
'label' => __( 'Suno', 'chrnx' ),
|
||||||
|
'icon' => '<path d="M12 3a9 9 0 1 0 9 9"/><path d="M8 12a4 4 0 1 0 4-4"/>',
|
||||||
|
),
|
||||||
|
'spotify' => array(
|
||||||
|
'label' => __( 'Spotify', 'chrnx' ),
|
||||||
|
'icon' => '<circle cx="12" cy="12" r="9"/><path d="M7.5 9.5c3-.8 6.2-.5 8.8 1M8 12.6c2.4-.6 5-.4 7.2.9M8.6 15.6c1.9-.5 4-.3 5.7.7"/>',
|
||||||
|
),
|
||||||
|
'apple' => array(
|
||||||
|
'label' => __( 'Apple Music', 'chrnx' ),
|
||||||
|
'icon' => '<path d="M9 18V6.5l9-1.5V16"/><circle cx="7" cy="18" r="2"/><circle cx="16" cy="16" r="2"/>',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize an external listening URL and require HTTPS.
|
||||||
|
*
|
||||||
|
* @param mixed $value Submitted value.
|
||||||
|
* @return string Valid HTTPS URL or an empty string.
|
||||||
|
*/
|
||||||
|
function chrnx_sanitize_https_url( $value ) {
|
||||||
|
if ( ! is_string( $value ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = esc_url_raw( trim( $value ) );
|
||||||
|
$scheme = wp_parse_url( $url, PHP_URL_SCHEME );
|
||||||
|
$host = wp_parse_url( $url, PHP_URL_HOST );
|
||||||
|
|
||||||
|
return '' !== $url && 'https' === $scheme && ! empty( $host ) ? $url : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the release term meta keys and their sanitizers.
|
||||||
|
*
|
||||||
|
* @return array<string,callable-string> Meta key to sanitize callback.
|
||||||
|
*/
|
||||||
|
function chrnx_get_release_meta_definitions() {
|
||||||
|
$definitions = array(
|
||||||
|
'chrnx_release_cover' => 'absint',
|
||||||
|
'chrnx_release_status' => 'sanitize_text_field',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
|
||||||
|
$definitions[ 'chrnx_release_url_' . $platform ] = 'chrnx_sanitize_https_url';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $definitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require permission to manage release term metadata.
|
||||||
|
*
|
||||||
|
* @return bool Whether the current user can manage categories.
|
||||||
|
*/
|
||||||
|
function chrnx_auth_release_meta() {
|
||||||
|
return current_user_can( 'manage_categories' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register release term metadata.
|
||||||
|
*/
|
||||||
|
function chrnx_register_release_meta() {
|
||||||
|
foreach ( chrnx_get_release_meta_definitions() as $meta_key => $sanitize ) {
|
||||||
|
register_term_meta(
|
||||||
|
'chrnx_release',
|
||||||
|
$meta_key,
|
||||||
|
array(
|
||||||
|
'type' => 'chrnx_release_cover' === $meta_key ? 'integer' : 'string',
|
||||||
|
'single' => true,
|
||||||
|
'show_in_rest' => true,
|
||||||
|
'sanitize_callback' => $sanitize,
|
||||||
|
'auth_callback' => 'chrnx_auth_release_meta',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'init', 'chrnx_register_release_meta' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the stored external links for one release term.
|
||||||
|
*
|
||||||
|
* @param int $term_id Release term ID.
|
||||||
|
* @return array<string,string> Platform key to URL, omitting empty ones.
|
||||||
|
*/
|
||||||
|
function chrnx_get_release_links( $term_id ) {
|
||||||
|
$links = array();
|
||||||
|
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
|
||||||
|
$url = chrnx_sanitize_https_url( get_term_meta( $term_id, 'chrnx_release_url_' . $platform, true ) );
|
||||||
|
if ( '' !== $url ) {
|
||||||
|
$links[ $platform ] = $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render a row of platform links, or nothing when none are stored.
|
||||||
|
*
|
||||||
|
* @param array<string,string> $links Platform key to URL.
|
||||||
|
* @param string $class_name Wrapper class.
|
||||||
|
* @return string Escaped markup or an empty string.
|
||||||
|
*/
|
||||||
|
function chrnx_get_platform_links_markup( array $links, $class_name = 'chrnx-platform-links' ) {
|
||||||
|
$platforms = chrnx_get_release_platforms();
|
||||||
|
$items = '';
|
||||||
|
|
||||||
|
foreach ( $links as $platform => $url ) {
|
||||||
|
if ( ! isset( $platforms[ $platform ] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$items .= sprintf(
|
||||||
|
// The icon path data is a fixed literal, never user input.
|
||||||
|
'<li><a class="%1$s__link" href="%2$s" target="_blank" rel="noopener noreferrer external"><svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">%3$s</svg><span class="chrnx-screen-reader-text">%4$s</span></a></li>',
|
||||||
|
esc_attr( $class_name ),
|
||||||
|
esc_url( $url ),
|
||||||
|
$platforms[ $platform ]['icon'], // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
|
esc_html( $platforms[ $platform ]['label'] )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( '' === $items ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<ul class="' . esc_attr( $class_name ) . '">' . $items . '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print one release meta field row for the term edit screen.
|
||||||
|
*
|
||||||
|
* @param string $meta_key Meta key.
|
||||||
|
* @param string $label Field label.
|
||||||
|
* @param string $value Current value.
|
||||||
|
* @param string $type Input type.
|
||||||
|
* @param string $help Optional description.
|
||||||
|
*/
|
||||||
|
function chrnx_print_release_field( $meta_key, $label, $value, $type = 'url', $help = '' ) {
|
||||||
|
printf(
|
||||||
|
'<tr class="form-field"><th scope="row"><label for="%1$s">%2$s</label></th><td><input name="%1$s" id="%1$s" type="%3$s" value="%4$s" class="regular-text"%5$s>%6$s</td></tr>',
|
||||||
|
esc_attr( $meta_key ),
|
||||||
|
esc_html( $label ),
|
||||||
|
esc_attr( $type ),
|
||||||
|
esc_attr( $value ),
|
||||||
|
'chrnx_release_cover' === $meta_key ? ' data-chrnx-release-cover' : '',
|
||||||
|
'' !== $help ? '<p class="description">' . esc_html( $help ) . '</p>' : ''
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the release metadata fields on the term edit screen.
|
||||||
|
*
|
||||||
|
* @param WP_Term $term Release term.
|
||||||
|
*/
|
||||||
|
function chrnx_render_release_edit_fields( $term ) {
|
||||||
|
$cover_id = absint( get_term_meta( $term->term_id, 'chrnx_release_cover', true ) );
|
||||||
|
chrnx_print_release_field(
|
||||||
|
'chrnx_release_cover',
|
||||||
|
__( 'Cover image ID', 'chrnx' ),
|
||||||
|
(string) ( $cover_id > 0 ? $cover_id : '' ),
|
||||||
|
'number',
|
||||||
|
__( 'Media library attachment ID for the album artwork.', 'chrnx' )
|
||||||
|
);
|
||||||
|
echo '<tr class="form-field"><th scope="row"></th><td>';
|
||||||
|
echo '<button type="button" class="button" data-chrnx-release-cover-pick>' . esc_html__( 'Select cover', 'chrnx' ) . '</button>';
|
||||||
|
echo '<div data-chrnx-release-cover-preview>';
|
||||||
|
if ( $cover_id > 0 ) {
|
||||||
|
echo wp_get_attachment_image( $cover_id, 'medium' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core returns escaped markup.
|
||||||
|
}
|
||||||
|
echo '</div></td></tr>';
|
||||||
|
|
||||||
|
chrnx_print_release_field(
|
||||||
|
'chrnx_release_status',
|
||||||
|
__( 'Status', 'chrnx' ),
|
||||||
|
(string) get_term_meta( $term->term_id, 'chrnx_release_status', true ),
|
||||||
|
'text',
|
||||||
|
__( 'Shown under the title, for example: 13-track debut album — in production.', 'chrnx' )
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( chrnx_get_release_platforms() as $platform => $definition ) {
|
||||||
|
chrnx_print_release_field(
|
||||||
|
'chrnx_release_url_' . $platform,
|
||||||
|
/* translators: %s: streaming platform name. */
|
||||||
|
sprintf( __( '%s URL', 'chrnx' ), $definition['label'] ),
|
||||||
|
(string) get_term_meta( $term->term_id, 'chrnx_release_url_' . $platform, true ),
|
||||||
|
'url',
|
||||||
|
__( 'HTTPS only. Leave empty to hide this icon.', 'chrnx' )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'chrnx_release_edit_form_fields', 'chrnx_render_release_edit_fields' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Persist release term metadata from the term edit screen.
|
||||||
|
*
|
||||||
|
* @param int $term_id Release term ID.
|
||||||
|
*/
|
||||||
|
function chrnx_save_release_meta( $term_id ) {
|
||||||
|
if ( ! chrnx_auth_release_meta() ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Core supplies and verifies the add/update term nonce on these screens.
|
||||||
|
$nonce = isset( $_POST['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) : '';
|
||||||
|
if ( ! wp_verify_nonce( $nonce, 'update-tag_' . $term_id ) && ! wp_verify_nonce( $nonce, 'add-tag' ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( chrnx_get_release_meta_definitions() as $meta_key => $sanitize ) {
|
||||||
|
if ( ! isset( $_POST[ $meta_key ] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = call_user_func( $sanitize, wp_unslash( $_POST[ $meta_key ] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Sanitized by the mapped callback.
|
||||||
|
if ( '' === $value || 0 === $value ) {
|
||||||
|
delete_term_meta( $term_id, $meta_key );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
update_term_meta( $term_id, $meta_key, $value );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'edited_chrnx_release', 'chrnx_save_release_meta' );
|
||||||
|
add_action( 'created_chrnx_release', 'chrnx_save_release_meta' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueue the media picker only on the release term screen.
|
||||||
|
*
|
||||||
|
* @param string $hook_suffix Current admin page.
|
||||||
|
*/
|
||||||
|
function chrnx_enqueue_release_admin_assets( $hook_suffix ) {
|
||||||
|
$taxonomy = isset( $_GET['taxonomy'] ) ? sanitize_key( wp_unslash( $_GET['taxonomy'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only screen routing.
|
||||||
|
if ( ! in_array( $hook_suffix, array( 'term.php', 'edit-tags.php' ), true ) || 'chrnx_release' !== $taxonomy ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wp_enqueue_media();
|
||||||
|
wp_enqueue_script(
|
||||||
|
'chrnx-admin-release',
|
||||||
|
get_theme_file_uri( 'assets/js/admin-release.js' ),
|
||||||
|
array( 'media-editor' ),
|
||||||
|
CHRNX_VERSION,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'admin_enqueue_scripts', 'chrnx_enqueue_release_admin_assets' );
|
||||||
@@ -70,3 +70,99 @@ function chrnx_get_subscribe_url(): string {
|
|||||||
$url = get_permalink( $page );
|
$url = get_permalink( $page );
|
||||||
return is_string( $url ) ? $url : '';
|
return is_string( $url ) ? $url : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize the subscription form endpoint and require HTTPS.
|
||||||
|
*
|
||||||
|
* @param mixed $value Submitted option value.
|
||||||
|
* @return string Valid HTTPS URL or an empty string.
|
||||||
|
*/
|
||||||
|
function chrnx_sanitize_subscribe_endpoint( $value ) {
|
||||||
|
return chrnx_sanitize_https_url( $value );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitize the provider's email field name.
|
||||||
|
*
|
||||||
|
* @param mixed $value Submitted option value.
|
||||||
|
* @return string Safe field name, defaulting to email.
|
||||||
|
*/
|
||||||
|
function chrnx_sanitize_subscribe_field( $value ) {
|
||||||
|
if ( ! is_string( $value ) ) {
|
||||||
|
return 'email';
|
||||||
|
}
|
||||||
|
$name = trim( $value );
|
||||||
|
// Providers use names like email, EMAIL, or fields[email].
|
||||||
|
return 1 === preg_match( '/^[A-Za-z0-9_\[\]-]{1,64}$/', $name ) ? $name : 'email';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Render the subscription endpoint field. */
|
||||||
|
function chrnx_render_subscribe_endpoint_field() {
|
||||||
|
printf(
|
||||||
|
'<input type="url" name="chrnx_subscribe_endpoint" id="chrnx_subscribe_endpoint" value="%s" class="regular-text" placeholder="https://">',
|
||||||
|
esc_attr( (string) get_option( 'chrnx_subscribe_endpoint', '' ) )
|
||||||
|
);
|
||||||
|
echo '<p class="description">' . esc_html__( 'HTTPS form endpoint from your email provider. Leave empty to hide the form.', 'chrnx' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Render the subscription email field-name input. */
|
||||||
|
function chrnx_render_subscribe_field_field() {
|
||||||
|
printf(
|
||||||
|
'<input type="text" name="chrnx_subscribe_field" id="chrnx_subscribe_field" value="%s" class="regular-text">',
|
||||||
|
esc_attr( chrnx_get_subscribe_field_name() )
|
||||||
|
);
|
||||||
|
echo '<p class="description">' . esc_html__( 'Name of the email input your provider expects, for example email or EMAIL.', 'chrnx' ) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Register the subscription form settings and Reading fields. */
|
||||||
|
function chrnx_register_subscribe_form_settings() {
|
||||||
|
register_setting(
|
||||||
|
'reading',
|
||||||
|
'chrnx_subscribe_endpoint',
|
||||||
|
array(
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => '',
|
||||||
|
'sanitize_callback' => 'chrnx_sanitize_subscribe_endpoint',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
register_setting(
|
||||||
|
'reading',
|
||||||
|
'chrnx_subscribe_field',
|
||||||
|
array(
|
||||||
|
'type' => 'string',
|
||||||
|
'default' => 'email',
|
||||||
|
'sanitize_callback' => 'chrnx_sanitize_subscribe_field',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
add_settings_field(
|
||||||
|
'chrnx_subscribe_endpoint',
|
||||||
|
esc_html__( 'Subscribe form endpoint', 'chrnx' ),
|
||||||
|
'chrnx_render_subscribe_endpoint_field',
|
||||||
|
'reading'
|
||||||
|
);
|
||||||
|
add_settings_field(
|
||||||
|
'chrnx_subscribe_field',
|
||||||
|
esc_html__( 'Subscribe email field name', 'chrnx' ),
|
||||||
|
'chrnx_render_subscribe_field_field',
|
||||||
|
'reading'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action( 'admin_init', 'chrnx_register_subscribe_form_settings' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the configured subscription form endpoint.
|
||||||
|
*
|
||||||
|
* @return string Valid HTTPS endpoint or an empty string.
|
||||||
|
*/
|
||||||
|
function chrnx_get_subscribe_endpoint(): string {
|
||||||
|
return chrnx_sanitize_https_url( get_option( 'chrnx_subscribe_endpoint', '' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the configured email field name.
|
||||||
|
*
|
||||||
|
* @return string Safe field name.
|
||||||
|
*/
|
||||||
|
function chrnx_get_subscribe_field_name(): string {
|
||||||
|
return chrnx_sanitize_subscribe_field( get_option( 'chrnx_subscribe_field', 'email' ) );
|
||||||
|
}
|
||||||
@@ -13,9 +13,69 @@ function chrnx_setup() {
|
|||||||
add_theme_support( 'post-thumbnails' );
|
add_theme_support( 'post-thumbnails' );
|
||||||
add_theme_support( 'responsive-embeds' );
|
add_theme_support( 'responsive-embeds' );
|
||||||
add_theme_support( 'editor-styles' );
|
add_theme_support( 'editor-styles' );
|
||||||
add_editor_style( array( 'assets/css/base.css', 'assets/css/layout.css' ) );
|
add_editor_style( array( 'assets/css/base.css', 'assets/css/layout.css', 'assets/css/components.css' ) );
|
||||||
remove_action( 'wp_footer', 'the_block_template_skip_link' );
|
remove_action( 'wp_footer', 'the_block_template_skip_link' );
|
||||||
|
|
||||||
add_image_size( 'chrnx-card', 720, 480, true );
|
add_image_size( 'chrnx-card', 720, 480, true );
|
||||||
|
|
||||||
|
register_nav_menus(
|
||||||
|
array(
|
||||||
|
'chrnx-primary' => __( 'Primary navigation', 'chrnx' ),
|
||||||
|
'chrnx-footer' => __( 'Footer navigation', 'chrnx' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// No template renders a comment thread, so nothing is collected silently.
|
||||||
|
remove_post_type_support( 'post', 'comments' );
|
||||||
|
remove_post_type_support( 'page', 'comments' );
|
||||||
}
|
}
|
||||||
add_action( 'after_setup_theme', 'chrnx_setup' );
|
add_action( 'after_setup_theme', 'chrnx_setup' );
|
||||||
|
add_filter( 'comments_open', '__return_false' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print Open Graph and Twitter card tags for the current request.
|
||||||
|
*
|
||||||
|
* ponytail: hand-rolled because the theme needs four tags, not an SEO plugin.
|
||||||
|
*/
|
||||||
|
function chrnx_print_social_meta() {
|
||||||
|
if ( is_singular() ) {
|
||||||
|
$title = get_the_title();
|
||||||
|
$url = get_permalink();
|
||||||
|
$description = wp_strip_all_tags( get_the_excerpt() );
|
||||||
|
$type = 'article';
|
||||||
|
$image_id = get_post_thumbnail_id();
|
||||||
|
} else {
|
||||||
|
$title = get_bloginfo( 'name' );
|
||||||
|
$url = home_url( '/' );
|
||||||
|
$description = get_bloginfo( 'description' );
|
||||||
|
$type = 'website';
|
||||||
|
$image_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generated derivative, not the design master: masters are not shipped.
|
||||||
|
$image = $image_id
|
||||||
|
? wp_get_attachment_image_url( $image_id, 'full' )
|
||||||
|
: get_theme_file_uri( 'assets/images/generated/about-grunge-1536.webp' );
|
||||||
|
|
||||||
|
$tags = array(
|
||||||
|
'og:site_name' => get_bloginfo( 'name' ),
|
||||||
|
'og:type' => $type,
|
||||||
|
'og:title' => $title,
|
||||||
|
'og:description' => $description,
|
||||||
|
'og:url' => $url,
|
||||||
|
'og:image' => $image,
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $tags as $property => $content ) {
|
||||||
|
if ( '' === $content ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
printf(
|
||||||
|
'<meta property="%1$s" content="%2$s" />' . "\n",
|
||||||
|
esc_attr( $property ),
|
||||||
|
esc_attr( $content )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
echo '<meta name="twitter:card" content="summary_large_image" />' . "\n";
|
||||||
|
}
|
||||||
|
add_action( 'wp_head', 'chrnx_print_social_meta' );
|
||||||
@@ -19,6 +19,7 @@ function chrnx_get_editorial_taxonomies() {
|
|||||||
'terms' => array(
|
'terms' => array(
|
||||||
'research' => __( 'Research', 'chrnx' ),
|
'research' => __( 'Research', 'chrnx' ),
|
||||||
'code' => __( 'Code', 'chrnx' ),
|
'code' => __( 'Code', 'chrnx' ),
|
||||||
|
'projects' => __( 'Projects', 'chrnx' ),
|
||||||
'literature' => __( 'Literature', 'chrnx' ),
|
'literature' => __( 'Literature', 'chrnx' ),
|
||||||
'music' => __( 'Music', 'chrnx' ),
|
'music' => __( 'Music', 'chrnx' ),
|
||||||
'podcasts' => __( 'Podcasts', 'chrnx' ),
|
'podcasts' => __( 'Podcasts', 'chrnx' ),
|
||||||
@@ -43,6 +44,16 @@ function chrnx_get_editorial_taxonomies() {
|
|||||||
'silicon-ranch' => __( 'Silicon Ranch', 'chrnx' ),
|
'silicon-ranch' => __( 'Silicon Ranch', 'chrnx' ),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'chrnx_release' => array(
|
||||||
|
'singular' => __( 'Release', 'chrnx' ),
|
||||||
|
'plural' => __( 'Releases', 'chrnx' ),
|
||||||
|
'rest_base' => 'release',
|
||||||
|
'terms' => array(
|
||||||
|
'el-hermoso-caos' => __( 'El Hermoso Caos que habita en mi cabeza', 'chrnx' ),
|
||||||
|
'ando-bien-arriba' => __( 'Ando Bien Arriba', 'chrnx' ),
|
||||||
|
'aqui-se-rompio-una-jerga' => __( 'Aquí se Rompió una Jerga', 'chrnx' ),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,11 +102,21 @@ function chrnx_seed_editorial_terms() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ( $definition['terms'] as $slug => $name ) {
|
foreach ( $definition['terms'] as $slug => $name ) {
|
||||||
if ( ! term_exists( $slug, $taxonomy_name ) ) {
|
/*
|
||||||
$result = wp_insert_term( $name, $taxonomy_name, array( 'slug' => $slug ) );
|
* term_exists() reads a cache that is not always warm during theme
|
||||||
if ( is_wp_error( $result ) || false === $result ) {
|
* activation, which let a second activation insert duplicates with
|
||||||
chrnx_store_editorial_notice( '', 'vocabulary_setup_failed' );
|
* a "-2" slug. Ask the taxonomy directly, by slug and by name.
|
||||||
}
|
*/
|
||||||
|
if ( get_term_by( 'slug', $slug, $taxonomy_name ) instanceof WP_Term ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( get_term_by( 'name', $name, $taxonomy_name ) instanceof WP_Term ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = wp_insert_term( $name, $taxonomy_name, array( 'slug' => $slug ) );
|
||||||
|
if ( is_wp_error( $result ) || false === $result ) {
|
||||||
|
chrnx_store_editorial_notice( '', 'vocabulary_setup_failed' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,177 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Track (song) post metadata.
|
||||||
|
*
|
||||||
|
* @package CHRNX
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Require permission to edit the post owning track metadata.
|
||||||
|
*
|
||||||
|
* @param bool $allowed Previously calculated permission.
|
||||||
|
* @param string $meta_key Metadata key.
|
||||||
|
* @param int $post_id Post ID.
|
||||||
|
* @return bool Whether the current user can edit the post.
|
||||||
|
*/
|
||||||
|
function chrnx_auth_track_meta( $allowed, $meta_key, $post_id ) {
|
||||||
|
return current_user_can( 'edit_post', $post_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the track meta keys and their sanitizers.
|
||||||
|
*
|
||||||
|
* @return array<string,callable-string> Meta key to sanitize callback.
|
||||||
|
*/
|
||||||
|
function chrnx_get_track_meta_definitions() {
|
||||||
|
$definitions = array(
|
||||||
|
'chrnx_track_number' => 'absint',
|
||||||
|
'chrnx_track_audio' => 'absint',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
|
||||||
|
$definitions[ 'chrnx_track_url_' . $platform ] = 'chrnx_sanitize_https_url';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $definitions;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register track metadata for posts.
|
||||||
|
*/
|
||||||
|
function chrnx_register_track_meta() {
|
||||||
|
foreach ( chrnx_get_track_meta_definitions() as $meta_key => $sanitize ) {
|
||||||
|
$is_number = in_array( $meta_key, array( 'chrnx_track_number', 'chrnx_track_audio' ), true );
|
||||||
|
register_post_meta(
|
||||||
|
'post',
|
||||||
|
$meta_key,
|
||||||
|
array(
|
||||||
|
'type' => $is_number ? 'integer' : 'string',
|
||||||
|
'single' => true,
|
||||||
|
'show_in_rest' => array(
|
||||||
|
'schema' => $is_number
|
||||||
|
? array(
|
||||||
|
'type' => 'integer',
|
||||||
|
'minimum' => 0,
|
||||||
|
)
|
||||||
|
: array( 'type' => 'string' ),
|
||||||
|
),
|
||||||
|
'sanitize_callback' => $sanitize,
|
||||||
|
'auth_callback' => 'chrnx_auth_track_meta',
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'init', 'chrnx_register_track_meta' );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the stored external links for one track.
|
||||||
|
*
|
||||||
|
* @param int $post_id Track post ID.
|
||||||
|
* @return array<string,string> Platform key to URL, omitting empty ones.
|
||||||
|
*/
|
||||||
|
function chrnx_get_track_links( $post_id ) {
|
||||||
|
$links = array();
|
||||||
|
foreach ( array_keys( chrnx_get_release_platforms() ) as $platform ) {
|
||||||
|
$url = chrnx_sanitize_https_url( get_post_meta( $post_id, 'chrnx_track_url_' . $platform, true ) );
|
||||||
|
if ( '' !== $url ) {
|
||||||
|
$links[ $platform ] = $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $links;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the playable audio source for one track.
|
||||||
|
*
|
||||||
|
* @param int $post_id Track post ID.
|
||||||
|
* @return string Audio URL, or an empty string when nothing is attached.
|
||||||
|
*/
|
||||||
|
function chrnx_get_track_audio_url( $post_id ) {
|
||||||
|
$attachment_id = absint( get_post_meta( $post_id, 'chrnx_track_audio', true ) );
|
||||||
|
if ( 0 === $attachment_id || 'attachment' !== get_post_type( $attachment_id ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
if ( 0 !== strpos( (string) get_post_mime_type( $attachment_id ), 'audio/' ) ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$url = wp_get_attachment_url( $attachment_id );
|
||||||
|
return is_string( $url ) ? $url : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the native mini player for one track, or nothing without audio.
|
||||||
|
*
|
||||||
|
* @param int $post_id Track post ID.
|
||||||
|
* @return string Escaped markup or an empty string.
|
||||||
|
*/
|
||||||
|
function chrnx_get_track_player_markup( $post_id ) {
|
||||||
|
$src = chrnx_get_track_audio_url( $post_id );
|
||||||
|
if ( '' === $src ) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// ponytail: native <audio>, no player library. Controls are styled with CSS.
|
||||||
|
return sprintf(
|
||||||
|
'<audio class="chrnx-track-player" controls preload="none" src="%1$s" aria-label="%2$s"></audio>',
|
||||||
|
esc_url( $src ),
|
||||||
|
/* translators: %s: track title. */
|
||||||
|
esc_attr( sprintf( __( 'Play %s', 'chrnx' ), get_the_title( $post_id ) ) )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the release term assigned to one track.
|
||||||
|
*
|
||||||
|
* @param int $post_id Track post ID.
|
||||||
|
* @return WP_Term|null Release term or null.
|
||||||
|
*/
|
||||||
|
function chrnx_get_track_release( $post_id ) {
|
||||||
|
$terms = get_the_terms( $post_id, 'chrnx_release' );
|
||||||
|
if ( is_wp_error( $terms ) || empty( $terms ) ) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$term = reset( $terms );
|
||||||
|
return $term instanceof WP_Term ? $term : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the ordered track IDs for one release.
|
||||||
|
*
|
||||||
|
* @param string $release_slug Release term slug.
|
||||||
|
* @param int $limit Maximum tracks, bounded to 60.
|
||||||
|
* @return int[] Track post IDs ordered by stored track number.
|
||||||
|
*/
|
||||||
|
function chrnx_get_release_track_ids( string $release_slug, int $limit = 30 ): array {
|
||||||
|
$slug = chrnx_validate_editorial_term_slug( $release_slug, 'chrnx_release' );
|
||||||
|
if ( '' === $slug ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$query = chrnx_run_eligible_query(
|
||||||
|
array(
|
||||||
|
'post_type' => 'post',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'posts_per_page' => min( 60, max( 1, $limit ) ),
|
||||||
|
'orderby' => array(
|
||||||
|
'meta_value_num' => 'ASC',
|
||||||
|
'date' => 'ASC',
|
||||||
|
),
|
||||||
|
'meta_key' => 'chrnx_track_number', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- Tracklist order is the feature.
|
||||||
|
'ignore_sticky_posts' => true,
|
||||||
|
'no_found_rows' => true,
|
||||||
|
'fields' => 'ids',
|
||||||
|
'suppress_filters' => false,
|
||||||
|
'chrnx_require_nonempty_title' => true,
|
||||||
|
'tax_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_tax_query -- Scoped to one release.
|
||||||
|
array(
|
||||||
|
'taxonomy' => 'chrnx_release',
|
||||||
|
'field' => 'slug',
|
||||||
|
'terms' => $slug,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return array_values( array_map( 'absint', $query->posts ) );
|
||||||
|
}
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
"lint:js": "wp-scripts lint-js assets/js tests/js tests/e2e",
|
"lint:js": "wp-scripts lint-js assets/js tests/js tests/e2e",
|
||||||
"lint:css": "wp-scripts lint-style 'assets/css/**/*.css' 'blocks/**/*.css'",
|
"lint:css": "wp-scripts lint-style 'assets/css/**/*.css' 'blocks/**/*.css'",
|
||||||
"lint:md": "wp-scripts lint-md-docs docs README.md",
|
"lint:md": "wp-scripts lint-md-docs docs README.md",
|
||||||
"test": "npm run test:smoke && npm run lint:js && npm run lint:css && npm run phpcs && npm run test:js && npm run test:php && npm run test:e2e"
|
"test": "npm run test:smoke && npm run lint:js && npm run lint:css && npm run phpcs && npm run test:js && npm run test:php && npm run test:e2e",
|
||||||
|
"package": "./scripts/package-theme.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@playwright/test": "1.62.1",
|
"@playwright/test": "1.62.1",
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
*/
|
*/
|
||||||
$chrnx_research_url = esc_url( 'https://arxiv.org/abs/2603.05352' );
|
$chrnx_research_url = esc_url( 'https://arxiv.org/abs/2603.05352' );
|
||||||
?>
|
?>
|
||||||
<!-- wp:group {"tagName":"section","className":"chrnx-about","layout":{"type":"constrained","contentSize":"70ch"}} -->
|
<!-- wp:group {"tagName":"section","className":"chrnx-about","layout":{"type":"constrained"}} -->
|
||||||
<section class="wp-block-group chrnx-about">
|
<section class="wp-block-group chrnx-about">
|
||||||
<!-- wp:group {"className":"chrnx-character-stage","layout":{"type":"constrained"}} -->
|
<!-- wp:group {"className":"chrnx-character-stage","layout":{"type":"constrained"}} -->
|
||||||
<div class="wp-block-group chrnx-character-stage">
|
<div class="wp-block-group chrnx-character-stage">
|
||||||
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"></div><!-- /wp:html -->
|
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"><?php echo chrnx_get_atmosphere_markup( 'about-grunge', 'chrnx-character-stage__backdrop' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
||||||
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
|
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
|
||||||
<div class="wp-block-group chrnx-character-stage__content">
|
<div class="wp-block-group chrnx-character-stage__content">
|
||||||
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading"><?php echo esc_html__( 'About', 'chrnx' ); ?></h2><!-- /wp:heading -->
|
<!-- wp:heading {"level":2} --><h2 class="wp-block-heading"><?php echo esc_html__( 'About', 'chrnx' ); ?></h2><!-- /wp:heading -->
|
||||||
@@ -28,11 +28,5 @@ $chrnx_research_url = esc_url( 'https://arxiv.org/abs/2603.05352' );
|
|||||||
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'life', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'life', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
<!-- wp:group {"className":"chrnx-character-facets chrnx-about__portraits","layout":{"type":"flex","flexWrap":"wrap"}} -->
|
|
||||||
<div class="wp-block-group chrnx-character-facets chrnx-about__portraits">
|
|
||||||
<!-- 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 -->
|
|
||||||
</section>
|
</section>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
@@ -13,17 +13,11 @@
|
|||||||
<section class="wp-block-group chrnx-home-projects">
|
<section class="wp-block-group chrnx-home-projects">
|
||||||
<!-- wp:group {"className":"chrnx-character-stage","layout":{"type":"constrained"}} -->
|
<!-- wp:group {"className":"chrnx-character-stage","layout":{"type":"constrained"}} -->
|
||||||
<div class="wp-block-group chrnx-character-stage">
|
<div class="wp-block-group chrnx-character-stage">
|
||||||
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"><?php echo chrnx_get_topic_portrait_markup( 'research', '', 'chrnx-character-stage__secondary-art' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
<!-- wp:html --><div class="chrnx-character-stage__atmosphere" aria-hidden="true"><?php echo chrnx_get_atmosphere_markup( 'projects-grunge', 'chrnx-character-stage__backdrop' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?><?php echo chrnx_get_topic_portrait_markup( 'research', '', 'chrnx-character-stage__secondary-art' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
||||||
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
|
<!-- wp:group {"className":"chrnx-character-stage__content","layout":{"type":"constrained"}} -->
|
||||||
<div class="wp-block-group chrnx-character-stage__content">
|
<div class="wp-block-group chrnx-character-stage__content">
|
||||||
<!-- wp:heading --><h2 class="wp-block-heading"><?php echo esc_html__( 'Selected work', 'chrnx' ); ?></h2><!-- /wp:heading -->
|
<!-- wp:heading --><h2 class="wp-block-heading"><?php echo esc_html__( 'Selected work', 'chrnx' ); ?></h2><!-- /wp:heading -->
|
||||||
<!-- wp:columns -->
|
<!-- wp:chrnx/selected-work /-->
|
||||||
<div class="wp-block-columns">
|
|
||||||
<!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Expressive Tea', 'chrnx' ); ?></h3><!-- /wp:heading --></div><!-- /wp:column -->
|
|
||||||
<!-- wp:column --><div class="wp-block-column"><!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Ailed', 'chrnx' ); ?></h3><!-- /wp:heading --></div><!-- /wp:column -->
|
|
||||||
<!-- 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 -->
|
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'code', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
<!-- wp:html --><div class="chrnx-character-stage__art"><?php echo chrnx_get_topic_portrait_markup( 'code', '', 'chrnx-section-portrait' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Helper returns escaped, allowlisted markup. ?></div><!-- /wp:html -->
|
||||||
|
|||||||
@@ -24,14 +24,8 @@
|
|||||||
<!-- wp:html --><div class="chrnx-character-stage__art"><?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. ?></div><!-- /wp:html -->
|
<!-- wp:html --><div class="chrnx-character-stage__art"><?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. ?></div><!-- /wp:html -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
<!-- wp:paragraph --><p><?php echo esc_html__( 'El proceso usa generative AI anclada en la voz humana real de Chrnx. Es una herramienta de producción, no una mitología ficticia ni una promesa sobre lo que la tecnología puede hacer.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
|
<!-- wp:paragraph {"className":"chrnx-music-note"} --><p class="chrnx-music-note"><?php echo esc_html__( 'El proceso usa generative AI anclada en la voz humana real de Chrnx. Es una herramienta de producción, no una mitología ficticia ni una promesa sobre lo que la tecnología puede hacer.', 'chrnx' ); ?></p><!-- /wp:paragraph -->
|
||||||
<!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Releases in progress', 'chrnx' ); ?></h3><!-- /wp:heading -->
|
<!-- wp:heading {"level":3} --><h3 class="wp-block-heading"><?php echo esc_html__( 'Releases in progress', 'chrnx' ); ?></h3><!-- /wp:heading -->
|
||||||
<!-- wp:group {"className":"chrnx-release-list","layout":{"type":"grid","minimumColumnWidth":"18rem"}} -->
|
<!-- wp:chrnx/release-list /-->
|
||||||
<div class="wp-block-group chrnx-release-list">
|
|
||||||
<!-- wp:group {"tagName":"article","className":"chrnx-release-card"} --><article class="wp-block-group chrnx-release-card"><!-- wp:heading {"level":4} --><h4 class="wp-block-heading"><?php echo esc_html__( 'El Hermoso Caos que habita en mi cabeza', 'chrnx' ); ?></h4><!-- /wp:heading --><!-- wp:paragraph --><p><?php echo esc_html__( '13-track debut album — draft/in production', 'chrnx' ); ?></p><!-- /wp:paragraph --></article><!-- /wp:group -->
|
|
||||||
<!-- wp:group {"tagName":"article","className":"chrnx-release-card"} --><article class="wp-block-group chrnx-release-card"><!-- wp:heading {"level":4} --><h4 class="wp-block-heading"><?php echo esc_html__( 'Ando Bien Arriba', 'chrnx' ); ?></h4><!-- /wp:heading --><!-- wp:paragraph --><p><?php echo esc_html__( 'six-track bright mirrored EP — draft/in production', 'chrnx' ); ?></p><!-- /wp:paragraph --></article><!-- /wp:group -->
|
|
||||||
<!-- wp:group {"tagName":"article","className":"chrnx-release-card"} --><article class="wp-block-group chrnx-release-card"><!-- wp:heading {"level":4} --><h4 class="wp-block-heading"><?php echo esc_html__( 'Aquí se Rompió una Jerga', 'chrnx' ); ?></h4><!-- /wp:heading --><!-- wp:paragraph --><p><?php echo esc_html__( 'six-track dark mirrored EP — draft/in production', 'chrnx' ); ?></p><!-- /wp:paragraph --></article><!-- /wp:group -->
|
|
||||||
</div>
|
|
||||||
<!-- /wp:group -->
|
|
||||||
</section>
|
</section>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
@@ -137,6 +137,7 @@ chrnx_build_responsive_image() {
|
|||||||
chrnx_image_basename=$1
|
chrnx_image_basename=$1
|
||||||
chrnx_image_source_name=$2
|
chrnx_image_source_name=$2
|
||||||
chrnx_image_webp_quality=${3:-78}
|
chrnx_image_webp_quality=${3:-78}
|
||||||
|
chrnx_image_avif_quality=${4:-58}
|
||||||
chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_source_name"
|
chrnx_image_source="$chrnx_image_root/assets/images/$chrnx_image_source_name"
|
||||||
chrnx_image_source_extension=${chrnx_image_source_name##*.}
|
chrnx_image_source_extension=${chrnx_image_source_name##*.}
|
||||||
if [ ! -f "$chrnx_image_source" ]; then
|
if [ ! -f "$chrnx_image_source" ]; then
|
||||||
@@ -148,7 +149,7 @@ chrnx_build_responsive_image() {
|
|||||||
chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.$chrnx_image_source_extension"
|
chrnx_image_resized="$chrnx_image_tmp/$chrnx_image_basename-$chrnx_image_width.$chrnx_image_source_extension"
|
||||||
sips --resampleWidth "$chrnx_image_width" "$chrnx_image_source" --out "$chrnx_image_resized" >/dev/null
|
sips --resampleWidth "$chrnx_image_width" "$chrnx_image_source" --out "$chrnx_image_resized" >/dev/null
|
||||||
cwebp -quiet -preset picture -q "$chrnx_image_webp_quality" -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_build_output/$chrnx_image_basename-$chrnx_image_width.webp"
|
cwebp -quiet -preset picture -q "$chrnx_image_webp_quality" -alpha_q 90 -m 6 -metadata none "$chrnx_image_resized" -o "$chrnx_image_build_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_build_output/$chrnx_image_basename-$chrnx_image_width.avif" >/dev/null
|
avifenc --ignore-exif --ignore-xmp --ignore-icc --qcolor "$chrnx_image_avif_quality" --qalpha 85 --speed 6 "$chrnx_image_resized" "$chrnx_image_build_output/$chrnx_image_basename-$chrnx_image_width.avif" >/dev/null
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +178,12 @@ done
|
|||||||
chrnx_build_responsive_image "alter-ego-gaming-half-body" "alter-ego-gaming-half-body.png"
|
chrnx_build_responsive_image "alter-ego-gaming-half-body" "alter-ego-gaming-half-body.png"
|
||||||
printf '{\n\t"source": "alter-ego-gaming-half-body.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_build_output/alter-ego-gaming-half-body.json"
|
printf '{\n\t"source": "alter-ego-gaming-half-body.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_build_output/alter-ego-gaming-half-body.json"
|
||||||
|
|
||||||
|
for chrnx_image_placeholder in placeholder-post placeholder-release; do
|
||||||
|
# Placeholders sit at half opacity behind text; they do not need full quality.
|
||||||
|
chrnx_build_responsive_image "$chrnx_image_placeholder" "$chrnx_image_placeholder.png" 48 40
|
||||||
|
printf '{\n\t"source": "%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' "$chrnx_image_placeholder" > "$chrnx_image_build_output/$chrnx_image_placeholder.json"
|
||||||
|
done
|
||||||
|
|
||||||
chrnx_build_responsive_image "the-no-names-musician-cutout" "the-no-names-musician-cutout.png"
|
chrnx_build_responsive_image "the-no-names-musician-cutout" "the-no-names-musician-cutout.png"
|
||||||
printf '{\n\t"source": "the-no-names-musician-cutout.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_build_output/the-no-names-musician-cutout.json"
|
printf '{\n\t"source": "the-no-names-musician-cutout.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768 ]\n}\n' > "$chrnx_image_build_output/the-no-names-musician-cutout.json"
|
||||||
|
|
||||||
@@ -185,6 +192,10 @@ printf '{\n\t"source": "the-no-names-collage.jpeg",\n\t"formats": [ "avif", "web
|
|||||||
|
|
||||||
chrnx_build_responsive_background "podcast-frequency-grunge" "podcast-frequency-grunge.png"
|
chrnx_build_responsive_background "podcast-frequency-grunge" "podcast-frequency-grunge.png"
|
||||||
printf '{\n\t"source": "podcast-frequency-grunge.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768, 1536 ]\n}\n' > "$chrnx_image_build_output/podcast-frequency-grunge.json"
|
printf '{\n\t"source": "podcast-frequency-grunge.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768, 1536 ]\n}\n' > "$chrnx_image_build_output/podcast-frequency-grunge.json"
|
||||||
|
for chrnx_image_background in about-grunge projects-grunge; do
|
||||||
|
chrnx_build_responsive_background "$chrnx_image_background" "$chrnx_image_background.png"
|
||||||
|
printf '{\n\t"source": "%s.png",\n\t"formats": [ "avif", "webp" ],\n\t"widths": [ 384, 768, 1536 ]\n}\n' "$chrnx_image_background" > "$chrnx_image_build_output/$chrnx_image_background.json"
|
||||||
|
done
|
||||||
|
|
||||||
chrnx_validate_staged_family() {
|
chrnx_validate_staged_family() {
|
||||||
chrnx_image_basename=$1
|
chrnx_image_basename=$1
|
||||||
@@ -215,12 +226,16 @@ for chrnx_image_topic in code gaming life literature podcasts research; do
|
|||||||
done
|
done
|
||||||
chrnx_validate_staged_family "alter-ego-gaming-half-body" 384 768
|
chrnx_validate_staged_family "alter-ego-gaming-half-body" 384 768
|
||||||
chrnx_validate_staged_family "the-no-names-musician-cutout" 384 768
|
chrnx_validate_staged_family "the-no-names-musician-cutout" 384 768
|
||||||
|
chrnx_validate_staged_family "placeholder-post" 384 768
|
||||||
|
chrnx_validate_staged_family "placeholder-release" 384 768
|
||||||
chrnx_validate_staged_family "the-no-names-collage" 384 768
|
chrnx_validate_staged_family "the-no-names-collage" 384 768
|
||||||
chrnx_validate_staged_family "podcast-frequency-grunge" 384 768 1536
|
chrnx_validate_staged_family "podcast-frequency-grunge" 384 768 1536
|
||||||
|
chrnx_validate_staged_family "about-grunge" 384 768 1536
|
||||||
|
chrnx_validate_staged_family "projects-grunge" 384 768 1536
|
||||||
|
|
||||||
set -- "$chrnx_image_stage"/*
|
set -- "$chrnx_image_stage"/*
|
||||||
if [ "$#" -ne 52 ]; then
|
if [ "$#" -ne 76 ]; then
|
||||||
echo "Responsive image staging expected 52 files, got $#." >&2
|
echo "Responsive image staging expected 76 files, got $#." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
for chrnx_image_staged in "$@"; do
|
for chrnx_image_staged in "$@"; do
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Build a distributable theme ZIP containing only what WordPress runs.
|
||||||
|
# Everything ships from an explicit allowlist, so a new dev file is excluded
|
||||||
|
# by default instead of leaking into the package.
|
||||||
|
|
||||||
|
chrnx_package_script_dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
||||||
|
chrnx_package_root=$(dirname -- "$chrnx_package_script_dir")
|
||||||
|
chrnx_package_slug=chrnx
|
||||||
|
chrnx_package_out=${1:-"$chrnx_package_root/dist"}
|
||||||
|
|
||||||
|
case "$chrnx_package_out" in
|
||||||
|
/*) ;;
|
||||||
|
*)
|
||||||
|
echo "Package output must be an explicit absolute path." >&2
|
||||||
|
exit 2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ "$chrnx_package_out" = "/" ] || [ "$chrnx_package_out" = "$chrnx_package_root" ]; then
|
||||||
|
echo "Refusing broad package output path: $chrnx_package_out" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
if [ -L "$chrnx_package_out" ]; then
|
||||||
|
echo "Refusing symbolic-link package output: $chrnx_package_out" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
if ! command -v zip >/dev/null 2>&1; then
|
||||||
|
echo "Required tool is missing: zip" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chrnx_package_version=$(sed -n 's/^Version:[[:space:]]*\(.*\)$/\1/p' "$chrnx_package_root/style.css" | head -1)
|
||||||
|
if [ -z "$chrnx_package_version" ]; then
|
||||||
|
echo "style.css must declare Version metadata." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
chrnx_package_php_version=$(sed -n "s/^define( 'CHRNX_VERSION', '\(.*\)' );$/\1/p" "$chrnx_package_root/functions.php" | head -1)
|
||||||
|
if [ "$chrnx_package_version" != "$chrnx_package_php_version" ]; then
|
||||||
|
echo "style.css ($chrnx_package_version) and CHRNX_VERSION ($chrnx_package_php_version) disagree." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p -- "$chrnx_package_out"
|
||||||
|
chrnx_package_stage=$(mktemp -d "${TMPDIR:-/tmp}/chrnx-package.XXXXXX")
|
||||||
|
trap 'rm -rf -- "$chrnx_package_stage"' EXIT HUP INT TERM
|
||||||
|
chrnx_package_dir="$chrnx_package_stage/$chrnx_package_slug"
|
||||||
|
mkdir -p -- "$chrnx_package_dir"
|
||||||
|
|
||||||
|
# Runtime files only. Tests, tooling, docs and sources stay out.
|
||||||
|
for chrnx_package_entry in style.css functions.php theme.json readme.txt; do
|
||||||
|
if [ -f "$chrnx_package_root/$chrnx_package_entry" ]; then
|
||||||
|
cp -- "$chrnx_package_root/$chrnx_package_entry" "$chrnx_package_dir/"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
for chrnx_package_entry in inc blocks patterns parts templates assets; do
|
||||||
|
if [ ! -d "$chrnx_package_root/$chrnx_package_entry" ]; then
|
||||||
|
echo "Required theme directory is missing: $chrnx_package_entry" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cp -R -- "$chrnx_package_root/$chrnx_package_entry" "$chrnx_package_dir/"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Editor sources and design masters are not runtime assets. Every image is
|
||||||
|
# served from assets/images/generated, so the multi-megabyte sources stay out.
|
||||||
|
rm -rf -- "$chrnx_package_dir/assets/js/editor-"*
|
||||||
|
find "$chrnx_package_dir/assets/images" -maxdepth 1 -type f \( -name '*.png' -o -name '*.jpeg' -o -name '*.jpg' \) -delete
|
||||||
|
find "$chrnx_package_dir" -name '.DS_Store' -delete
|
||||||
|
find "$chrnx_package_dir" -name '*.asset.php' -delete
|
||||||
|
|
||||||
|
if [ ! -f "$chrnx_package_dir/style.css" ] || [ ! -f "$chrnx_package_dir/functions.php" ]; then
|
||||||
|
echo "Package is missing required theme files." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
chrnx_package_zip="$chrnx_package_out/$chrnx_package_slug-$chrnx_package_version.zip"
|
||||||
|
rm -f -- "$chrnx_package_zip"
|
||||||
|
( cd "$chrnx_package_stage" && zip -q -r -X "$chrnx_package_zip" "$chrnx_package_slug" )
|
||||||
|
|
||||||
|
for chrnx_package_forbidden in tests scripts node_modules vendor docs .git .worktrees composer.json package.json; do
|
||||||
|
if unzip -Z1 "$chrnx_package_zip" | grep -q "^$chrnx_package_slug/$chrnx_package_forbidden"; then
|
||||||
|
echo "Package unexpectedly contains: $chrnx_package_forbidden" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "CHRNX_PACKAGE $chrnx_package_zip $(unzip -Z1 "$chrnx_package_zip" | wc -l | tr -d ' ') files $(du -h "$chrnx_package_zip" | cut -f1)"
|
||||||
@@ -134,9 +134,22 @@ foreach ( $chrnx_seed_posts as $chrnx_seed_index => $chrnx_seed_post ) {
|
|||||||
wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_show', false );
|
wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_show', false );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration', 'canonical_episode_url' ) as $chrnx_seed_meta_key ) {
|
if ( isset( $chrnx_seed_post['release'] ) ) {
|
||||||
|
wp_set_object_terms( $chrnx_seed_post_id, sanitize_key( $chrnx_seed_post['release'] ), 'chrnx_release', false );
|
||||||
|
} else {
|
||||||
|
wp_set_object_terms( $chrnx_seed_post_id, array(), 'chrnx_release', false );
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( array( 'chrnx_episode_number', 'chrnx_episode_duration', 'canonical_episode_url', 'chrnx_project_featured' ) as $chrnx_seed_meta_key ) {
|
||||||
delete_post_meta( $chrnx_seed_post_id, $chrnx_seed_meta_key );
|
delete_post_meta( $chrnx_seed_post_id, $chrnx_seed_meta_key );
|
||||||
}
|
}
|
||||||
|
if ( ! empty( $chrnx_seed_post['projectFeatured'] ) ) {
|
||||||
|
update_post_meta( $chrnx_seed_post_id, 'chrnx_project_featured', true );
|
||||||
|
}
|
||||||
|
delete_post_meta( $chrnx_seed_post_id, 'chrnx_track_number' );
|
||||||
|
if ( isset( $chrnx_seed_post['trackNumber'] ) ) {
|
||||||
|
update_post_meta( $chrnx_seed_post_id, 'chrnx_track_number', absint( $chrnx_seed_post['trackNumber'] ) );
|
||||||
|
}
|
||||||
if ( isset( $chrnx_seed_post['episodeNumber'] ) ) {
|
if ( isset( $chrnx_seed_post['episodeNumber'] ) ) {
|
||||||
update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_number', absint( $chrnx_seed_post['episodeNumber'] ) );
|
update_post_meta( $chrnx_seed_post_id, 'chrnx_episode_number', absint( $chrnx_seed_post['episodeNumber'] ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ Theme Name: CHRNX
|
|||||||
Description: A native block theme for chrnx.dev.
|
Description: A native block theme for chrnx.dev.
|
||||||
Requires at least: 6.9
|
Requires at least: 6.9
|
||||||
Requires PHP: 8.1
|
Requires PHP: 8.1
|
||||||
Version: 0.1.0
|
Version: 0.2.0
|
||||||
Text Domain: chrnx
|
Text Domain: chrnx
|
||||||
*/
|
*/
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||||
|
|
||||||
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-not-found","layout":{"type":"constrained","contentSize":"70ch"}} -->
|
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-not-found","layout":{"type":"constrained"}} -->
|
||||||
<main id="chrnx-main" class="wp-block-group chrnx-not-found" tabindex="-1">
|
<main id="chrnx-main" class="wp-block-group chrnx-not-found" tabindex="-1">
|
||||||
<!-- wp:heading {"level":1} --><h1 class="wp-block-heading">Page not found</h1><!-- /wp:heading -->
|
<!-- wp:heading {"level":1} --><h1 class="wp-block-heading">Page not found</h1><!-- /wp:heading -->
|
||||||
<!-- wp:paragraph --><p>This address does not lead to a published page. Search the site or return to a known starting point.</p><!-- /wp:paragraph -->
|
<!-- wp:paragraph --><p>This address does not lead to a published page. Search the site or return to a known starting point.</p><!-- /wp:paragraph -->
|
||||||
|
|||||||
@@ -1,25 +1,9 @@
|
|||||||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||||
|
|
||||||
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","layout":{"type":"constrained"}} -->
|
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-archive","layout":{"type":"constrained"}} -->
|
||||||
<main id="chrnx-main" class="wp-block-group" tabindex="-1">
|
<main id="chrnx-main" class="wp-block-group chrnx-archive" tabindex="-1">
|
||||||
<!-- wp:query {"queryId":0,"query":{"inherit":true},"layout":{"type":"default"}} -->
|
<!-- wp:query-title {"type":"archive","level":1,"showPrefix":false} /-->
|
||||||
<div class="wp-block-query">
|
<!-- wp:chrnx/journal-stream /-->
|
||||||
<!-- wp:post-template -->
|
|
||||||
<!-- wp:group {"tagName":"article","layout":{"type":"constrained"}} -->
|
|
||||||
<article class="wp-block-group">
|
|
||||||
<!-- wp:post-title {"isLink":true} /-->
|
|
||||||
<!-- wp:post-excerpt /-->
|
|
||||||
</article>
|
|
||||||
<!-- /wp:group -->
|
|
||||||
<!-- /wp:post-template -->
|
|
||||||
|
|
||||||
<!-- wp:query-pagination {"layout":{"type":"flex","justifyContent":"space-between"}} -->
|
|
||||||
<!-- wp:query-pagination-previous /-->
|
|
||||||
<!-- wp:query-pagination-numbers /-->
|
|
||||||
<!-- wp:query-pagination-next /-->
|
|
||||||
<!-- /wp:query-pagination -->
|
|
||||||
</div>
|
|
||||||
<!-- /wp:query -->
|
|
||||||
</main>
|
</main>
|
||||||
<!-- /wp:group -->
|
<!-- /wp:group -->
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||||
|
|
||||||
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-entry chrnx-entry--page","layout":{"type":"constrained","contentSize":"70ch"}} -->
|
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-entry chrnx-entry--page","layout":{"type":"constrained"}} -->
|
||||||
<main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--page" tabindex="-1">
|
<main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--page" tabindex="-1">
|
||||||
<!-- wp:post-title {"level":1} /-->
|
<!-- wp:post-title {"level":1} /-->
|
||||||
<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
|
<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||||
|
|
||||||
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-entry chrnx-entry--single","layout":{"type":"constrained","contentSize":"70ch"}} -->
|
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-entry chrnx-entry--single","layout":{"type":"constrained"}} -->
|
||||||
<main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--single" tabindex="-1">
|
<main id="chrnx-main" class="wp-block-group chrnx-entry chrnx-entry--single" tabindex="-1">
|
||||||
<!-- wp:post-title {"level":1} /-->
|
<!-- wp:post-title {"level":1} /-->
|
||||||
<!-- wp:group {"className":"chrnx-entry__meta","layout":{"type":"flex","flexWrap":"wrap"}} -->
|
<!-- wp:group {"className":"chrnx-entry__meta","layout":{"type":"flex","flexWrap":"wrap"}} -->
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
<!-- wp:post-featured-image {"aspectRatio":"3/2"} /-->
|
<!-- wp:post-featured-image {"aspectRatio":"3/2"} /-->
|
||||||
<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
|
<!-- wp:post-content {"layout":{"type":"constrained"}} /-->
|
||||||
<!-- wp:chrnx/podcast-meta /-->
|
<!-- wp:chrnx/podcast-meta /-->
|
||||||
|
<!-- wp:chrnx/track-meta /-->
|
||||||
<!-- wp:chrnx/related-posts /-->
|
<!-- wp:chrnx/related-posts /-->
|
||||||
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
|
<!-- wp:chrnx/subscribe-cta {"className":"is-style-quiet"} /-->
|
||||||
</main>
|
</main>
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<!-- wp:template-part {"slug":"header","tagName":"header"} /-->
|
||||||
|
|
||||||
|
<!-- wp:group {"tagName":"main","anchor":"chrnx-main","className":"chrnx-archive chrnx-release-archive","layout":{"type":"constrained"}} -->
|
||||||
|
<main id="chrnx-main" class="wp-block-group chrnx-archive chrnx-release-archive" tabindex="-1">
|
||||||
|
<!-- wp:query-title {"type":"archive","level":1,"showPrefix":false} /-->
|
||||||
|
<!-- wp:chrnx/release-detail /-->
|
||||||
|
</main>
|
||||||
|
<!-- /wp:group -->
|
||||||
|
|
||||||
|
<!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
|
||||||
@@ -42,4 +42,11 @@ test( 'editorial and podcast controls initialize in the real post editor', async
|
|||||||
await expect( page.getByLabel( 'Duration', { exact: true } ) ).toBeVisible();
|
await expect( page.getByLabel( 'Duration', { exact: true } ) ).toBeVisible();
|
||||||
await expect( page.getByLabel( 'Participants (one per line)', { exact: true } ) ).toBeVisible();
|
await expect( page.getByLabel( 'Participants (one per line)', { exact: true } ) ).toBeVisible();
|
||||||
await expect( page.getByLabel( 'Canonical episode URL', { exact: true } ) ).toBeVisible();
|
await expect( page.getByLabel( 'Canonical episode URL', { exact: true } ) ).toBeVisible();
|
||||||
|
|
||||||
|
// Switching topic swaps which per-topic panel is offered.
|
||||||
|
await openPanel( 'Topic' );
|
||||||
|
await page.getByRole( 'radio', { name: 'Projects', exact: true } ).check();
|
||||||
|
await expect( page.getByLabel( 'Episode number', { exact: true } ) ).toBeHidden();
|
||||||
|
await openPanel( 'Project' );
|
||||||
|
await expect( page.getByLabel( 'Show in Selected work', { exact: true } ) ).toBeVisible();
|
||||||
} );
|
} );
|
||||||
@@ -7,7 +7,7 @@ const landings = [
|
|||||||
path: '/music/',
|
path: '/music/',
|
||||||
root: '.chrnx-music-landing',
|
root: '.chrnx-music-landing',
|
||||||
atmosphere: '.chrnx-character-stage__collage',
|
atmosphere: '.chrnx-character-stage__collage',
|
||||||
art: 'img[src*="the-no-names-musician-cutout.png"]',
|
art: 'img[src*="the-no-names-musician-cutout-768.webp"]',
|
||||||
internalHeadings: ':scope > h3, .chrnx-release-card h4',
|
internalHeadings: ':scope > h3, .chrnx-release-card h4',
|
||||||
internalHeadingCount: 4,
|
internalHeadingCount: 4,
|
||||||
next: ':scope > p',
|
next: ':scope > p',
|
||||||
@@ -17,7 +17,7 @@ const landings = [
|
|||||||
path: '/podcasts/',
|
path: '/podcasts/',
|
||||||
root: '.chrnx-podcast-landing',
|
root: '.chrnx-podcast-landing',
|
||||||
atmosphere: '.chrnx-character-stage__frequency',
|
atmosphere: '.chrnx-character-stage__frequency',
|
||||||
art: 'img[src*="alter-ego-podcasts.png"]',
|
art: 'img[src*="alter-ego-podcasts-768.webp"]',
|
||||||
internalHeadings: '.chrnx-podcast-card__title',
|
internalHeadings: '.chrnx-podcast-card__title',
|
||||||
internalHeadingCount: 1,
|
internalHeadingCount: 1,
|
||||||
next: ':scope > .wp-block-chrnx-latest-podcast',
|
next: ':scope > .wp-block-chrnx-latest-podcast',
|
||||||
@@ -550,24 +550,26 @@ const immutableSurfaces = [
|
|||||||
name: 'Projects',
|
name: 'Projects',
|
||||||
path: '/projects/',
|
path: '/projects/',
|
||||||
root: '.chrnx-home-projects',
|
root: '.chrnx-home-projects',
|
||||||
art: 'img[src*="alter-ego-code.png"]',
|
art: 'img[src*="alter-ego-code-768.webp"]',
|
||||||
atmosphereCount: 1,
|
atmosphereCount: 2,
|
||||||
imageSources: [ 'alter-ego-research.png', 'alter-ego-code.png' ],
|
imageSources: [
|
||||||
headings: [ 'Selected work', 'Expressive Tea', 'Ailed', 'Published research' ],
|
'projects-grunge-1536.webp',
|
||||||
|
'alter-ego-research-768.webp',
|
||||||
|
'alter-ego-code-768.webp',
|
||||||
|
],
|
||||||
|
// Project names come from chrnx/selected-work: picked projects newest-first,
|
||||||
|
// then the most recent ones. This is the seeded order, not a frozen string.
|
||||||
|
headings: [ 'Selected work', 'Ailed', 'Expressive Tea', 'Published research' ],
|
||||||
paragraphs: [],
|
paragraphs: [],
|
||||||
contentText: 'Selected work Expressive Tea Ailed Published research',
|
contentText: 'Selected work Ailed Expressive Tea Published research',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'About',
|
name: 'About',
|
||||||
path: '/about/',
|
path: '/about/',
|
||||||
root: '.chrnx-about',
|
root: '.chrnx-about',
|
||||||
art: 'img[src*="alter-ego-life.png"]',
|
art: 'img[src*="alter-ego-life-768.webp"]',
|
||||||
atmosphereCount: 0,
|
atmosphereCount: 1,
|
||||||
imageSources: [
|
imageSources: [ 'about-grunge-1536.webp', 'alter-ego-life-768.webp' ],
|
||||||
'alter-ego-life.png',
|
|
||||||
'alter-ego-literature.png',
|
|
||||||
'alter-ego-gaming-half-body.png',
|
|
||||||
],
|
|
||||||
headings: [ 'About', 'Beyond the work' ],
|
headings: [ 'About', 'Beyond the work' ],
|
||||||
paragraphs: [
|
paragraphs: [
|
||||||
'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.',
|
'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.',
|
||||||
|
|||||||
@@ -547,12 +547,12 @@ test.describe( 'site navigation shell', () => {
|
|||||||
expect( themeBox.x ).toBeGreaterThanOrEqual( 0 );
|
expect( themeBox.x ).toBeGreaterThanOrEqual( 0 );
|
||||||
expect( themeBox.x + themeBox.width ).toBeLessThanOrEqual( width );
|
expect( themeBox.x + themeBox.width ).toBeLessThanOrEqual( width );
|
||||||
for ( const name of [ 'Light', 'Dark', 'System' ] ) {
|
for ( const name of [ 'Light', 'Dark', 'System' ] ) {
|
||||||
const radio = header.getByRole( 'radio', { name, exact: true } );
|
const radio = header.getByRole( 'button', { name, exact: true } );
|
||||||
await expect( radio ).toBeVisible();
|
await expect( radio ).toBeVisible();
|
||||||
const radioBox = await getBox( radio );
|
const radioBox = await getBox( radio );
|
||||||
expect( radioBox.width ).toBeGreaterThan( 0 );
|
expect( radioBox.width ).toBeGreaterThan( 0 );
|
||||||
expect( radioBox.height ).toBeGreaterThan( 0 );
|
expect( radioBox.height ).toBeGreaterThan( 0 );
|
||||||
await expectContainedTarget( radio.locator( '..' ), width );
|
await expectContainedTarget( radio, width );
|
||||||
}
|
}
|
||||||
await expectNoHorizontalOverflow( page, header );
|
await expectNoHorizontalOverflow( page, header );
|
||||||
} );
|
} );
|
||||||
@@ -566,17 +566,20 @@ test.describe( 'site navigation shell', () => {
|
|||||||
await page.setViewportSize( { width, height: 844 } );
|
await page.setViewportSize( { width, height: 844 } );
|
||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
if ( scenario === 'long translated labels' ) {
|
if ( scenario === 'long translated labels' ) {
|
||||||
await page.locator( '[data-chrnx-theme-panel] label' ).evaluateAll( ( labels ) => {
|
await page
|
||||||
const translations = [
|
.locator( '[data-chrnx-theme-panel] [data-chrnx-theme-value]' )
|
||||||
'Helles Erscheinungsbild verwenden',
|
.evaluateAll( ( buttons ) => {
|
||||||
'Dunkles Erscheinungsbild verwenden',
|
const translations = [
|
||||||
'Automatisch dem Farbschema des Betriebssystems folgen',
|
'Helles Erscheinungsbild verwenden',
|
||||||
];
|
'Dunkles Erscheinungsbild verwenden',
|
||||||
labels.forEach( ( label, index ) => {
|
'Automatisch dem Farbschema des Betriebssystems folgen',
|
||||||
const text = Array.from( label.childNodes ).find( ( node ) => node.nodeType === 3 );
|
];
|
||||||
text.nodeValue = ` ${ translations[ index ] }`;
|
// The label is the accessible name only; icons carry the layout.
|
||||||
|
buttons.forEach( ( button, index ) => {
|
||||||
|
button.querySelector( '.chrnx-screen-reader-text' ).textContent =
|
||||||
|
translations[ index ];
|
||||||
|
} );
|
||||||
} );
|
} );
|
||||||
} );
|
|
||||||
} else {
|
} else {
|
||||||
await page.evaluate( () => {
|
await page.evaluate( () => {
|
||||||
document.documentElement.style.fontSize = '200%';
|
document.documentElement.style.fontSize = '200%';
|
||||||
@@ -650,7 +653,7 @@ test.describe( 'site navigation shell', () => {
|
|||||||
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
|
const themePanel = header.locator( '[data-chrnx-theme-panel]' );
|
||||||
await expect( nav ).toBeVisible();
|
await expect( nav ).toBeVisible();
|
||||||
await expect( themePanel ).toBeVisible();
|
await expect( themePanel ).toBeVisible();
|
||||||
await expect( header.getByRole( 'radio', { name: 'System', exact: true } ) ).toBeVisible();
|
await expect( header.getByRole( 'button', { name: 'System', exact: true } ) ).toBeVisible();
|
||||||
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeHidden();
|
await expect( header.locator( '[data-chrnx-menu-toggle]' ) ).toBeHidden();
|
||||||
await expect( header.locator( '[data-chrnx-theme-button]' ) ).toBeHidden();
|
await expect( header.locator( '[data-chrnx-theme-button]' ) ).toBeHidden();
|
||||||
await expect( header.getByRole( 'button', { name: 'Open search' } ) ).toBeVisible();
|
await expect( header.getByRole( 'button', { name: 'Open search' } ) ).toBeVisible();
|
||||||
@@ -791,7 +794,9 @@ test.describe( 'site navigation shell', () => {
|
|||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
header = page.getByRole( 'banner' );
|
header = page.getByRole( 'banner' );
|
||||||
let themeButton = header.locator( '[data-chrnx-theme-button]' );
|
let themeButton = header.locator( '[data-chrnx-theme-button]' );
|
||||||
let checkedTheme = header.locator( '[data-chrnx-theme-panel] input:checked' );
|
let checkedTheme = header.locator(
|
||||||
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
||||||
|
);
|
||||||
await expect( themeButton ).toBeVisible();
|
await expect( themeButton ).toBeVisible();
|
||||||
await themeButton.focus();
|
await themeButton.focus();
|
||||||
await page.setViewportSize( { width: 600, height: 844 } );
|
await page.setViewportSize( { width: 600, height: 844 } );
|
||||||
@@ -818,7 +823,9 @@ test.describe( 'site navigation shell', () => {
|
|||||||
await page.setViewportSize( { width: 600, height: 844 } );
|
await page.setViewportSize( { width: 600, height: 844 } );
|
||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
header = page.getByRole( 'banner' );
|
header = page.getByRole( 'banner' );
|
||||||
checkedTheme = header.locator( '[data-chrnx-theme-panel] input:checked' );
|
checkedTheme = header.locator(
|
||||||
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
||||||
|
);
|
||||||
themeButton = header.locator( '[data-chrnx-theme-button]' );
|
themeButton = header.locator( '[data-chrnx-theme-button]' );
|
||||||
await checkedTheme.focus();
|
await checkedTheme.focus();
|
||||||
await page.setViewportSize( { width: 390, height: 844 } );
|
await page.setViewportSize( { width: 390, height: 844 } );
|
||||||
@@ -832,7 +839,9 @@ test.describe( 'site navigation shell', () => {
|
|||||||
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
const menuButton = header.locator( '[data-chrnx-menu-toggle]' );
|
||||||
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
const themeButton = header.locator( '[data-chrnx-theme-button]' );
|
||||||
const journal = header.getByRole( 'link', { name: 'Journal', exact: true } );
|
const journal = header.getByRole( 'link', { name: 'Journal', exact: true } );
|
||||||
const checkedTheme = header.locator( '[data-chrnx-theme-panel] input:checked' );
|
const checkedTheme = header.locator(
|
||||||
|
'[data-chrnx-theme-panel] [data-chrnx-theme-value][aria-pressed="true"]',
|
||||||
|
);
|
||||||
|
|
||||||
await menuButton.click();
|
await menuButton.click();
|
||||||
await journal.focus();
|
await journal.focus();
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ const patterns = [
|
|||||||
patternTitle: 'Music landing',
|
patternTitle: 'Music landing',
|
||||||
pageSlug: 'music',
|
pageSlug: 'music',
|
||||||
patternSlug: 'chrnx/music-landing',
|
patternSlug: 'chrnx/music-landing',
|
||||||
atmosphereAsset: 'the-no-names-collage.jpeg',
|
atmosphereAsset: 'the-no-names-collage-768.webp',
|
||||||
artAsset: 'the-no-names-musician-cutout.png',
|
artAsset: 'the-no-names-musician-cutout-768.webp',
|
||||||
contentCopy: 'The No Names es una banda activa',
|
contentCopy: 'The No Names es una banda activa',
|
||||||
supportingCopy: 'El proceso usa generative AI',
|
supportingCopy: 'El proceso usa generative AI',
|
||||||
},
|
},
|
||||||
@@ -16,8 +16,8 @@ const patterns = [
|
|||||||
patternTitle: 'Podcast landing',
|
patternTitle: 'Podcast landing',
|
||||||
pageSlug: 'podcasts',
|
pageSlug: 'podcasts',
|
||||||
patternSlug: 'chrnx/podcast-landing',
|
patternSlug: 'chrnx/podcast-landing',
|
||||||
atmosphereAsset: 'podcast-frequency-grunge.png',
|
atmosphereAsset: 'podcast-frequency-grunge-1536.webp',
|
||||||
artAsset: 'alter-ego-podcasts.png',
|
artAsset: 'alter-ego-podcasts-768.webp',
|
||||||
contentCopy: 'Conversations about the work behind software, research, music, and games.',
|
contentCopy: 'Conversations about the work behind software, research, music, and games.',
|
||||||
supportingCopy: '<!-- wp:chrnx/latest-podcast /-->',
|
supportingCopy: '<!-- wp:chrnx/latest-podcast /-->',
|
||||||
},
|
},
|
||||||
@@ -55,12 +55,15 @@ async function closeWelcomeGuide( page ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function waitForEditor( page ) {
|
async function waitForEditor( page ) {
|
||||||
|
// The Site Editor boots slower than the default 5s poll under load.
|
||||||
await expect
|
await expect
|
||||||
.poll( () =>
|
.poll(
|
||||||
page.evaluate( () => {
|
() =>
|
||||||
const editor = window.wp?.data?.select( 'core/block-editor' );
|
page.evaluate( () => {
|
||||||
return typeof editor?.getBlocks === 'function' && editor.getBlocks().length > 0;
|
const editor = window.wp?.data?.select( 'core/block-editor' );
|
||||||
} ),
|
return typeof editor?.getBlocks === 'function' && editor.getBlocks().length > 0;
|
||||||
|
} ),
|
||||||
|
{ timeout: 20_000 },
|
||||||
)
|
)
|
||||||
.toBe( true );
|
.toBe( true );
|
||||||
}
|
}
|
||||||
@@ -70,7 +73,12 @@ async function waitForPatternEditorState( page ) {
|
|||||||
.poll(
|
.poll(
|
||||||
() =>
|
() =>
|
||||||
page.evaluate( () => {
|
page.evaluate( () => {
|
||||||
const store = window.wp.data.select( 'core/block-editor' );
|
// The editor may still be booting on the first poll; returning an
|
||||||
|
// empty list retries instead of throwing out of expect.poll.
|
||||||
|
const store = window.wp?.data?.select( 'core/block-editor' );
|
||||||
|
if ( typeof store?.getBlocks !== 'function' ) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
const flatten = ( blocks ) =>
|
const flatten = ( blocks ) =>
|
||||||
blocks.flatMap( ( block ) => [ block, ...flatten( block.innerBlocks || [] ) ] );
|
blocks.flatMap( ( block ) => [ block, ...flatten( block.innerBlocks || [] ) ] );
|
||||||
const all = flatten( store.getBlocks() );
|
const all = flatten( store.getBlocks() );
|
||||||
|
|||||||
@@ -47,25 +47,31 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
const groups = page.locator( '[data-chrnx-theme-toggle]' );
|
const groups = page.locator( '[data-chrnx-theme-toggle]' );
|
||||||
await expect( groups.first() ).toHaveAccessibleName( 'Color theme' );
|
await expect( groups.first() ).toHaveAccessibleName( 'Color theme' );
|
||||||
await groups.first().getByRole( 'radio', { name: 'Light', exact: true } ).check();
|
await groups.first().getByRole( 'button', { name: 'Light', exact: true } ).click();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
|
||||||
await expect
|
await expect
|
||||||
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
||||||
.toBe( 'light' );
|
.toBe( 'light' );
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'light' );
|
||||||
await expect( page.getByRole( 'radio', { name: 'Light', exact: true } ) ).toBeChecked();
|
await expect( page.getByRole( 'button', { name: 'Light', exact: true } ) ).toHaveAttribute(
|
||||||
await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check();
|
'aria-pressed',
|
||||||
|
'true',
|
||||||
|
);
|
||||||
|
await page.getByRole( 'button', { name: 'Dark', exact: true } ).click();
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toBeChecked();
|
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveAttribute(
|
||||||
|
'aria-pressed',
|
||||||
|
'true',
|
||||||
|
);
|
||||||
const instances = await page.locator( '[data-chrnx-theme-toggle]' ).count();
|
const instances = await page.locator( '[data-chrnx-theme-toggle]' ).count();
|
||||||
if ( instances > 1 ) {
|
if ( instances > 1 ) {
|
||||||
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toHaveCount(
|
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveCount(
|
||||||
instances,
|
instances,
|
||||||
);
|
);
|
||||||
for ( const radio of await page.getByRole( 'radio', { name: 'Dark', exact: true } ).all() ) {
|
for ( const radio of await page.getByRole( 'button', { name: 'Dark', exact: true } ).all() ) {
|
||||||
await expect( radio ).toBeChecked();
|
await expect( radio ).toHaveAttribute( 'aria-pressed', 'true' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
@@ -85,7 +91,10 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await page.reload();
|
await page.reload();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
|
||||||
const savedName = saved[ 0 ].toUpperCase() + saved.slice( 1 );
|
const savedName = saved[ 0 ].toUpperCase() + saved.slice( 1 );
|
||||||
await expect( page.getByRole( 'radio', { name: savedName, exact: true } ) ).toBeChecked();
|
await expect( page.getByRole( 'button', { name: savedName, exact: true } ) ).toHaveAttribute(
|
||||||
|
'aria-pressed',
|
||||||
|
'true',
|
||||||
|
);
|
||||||
await page.emulateMedia( { colorScheme: saved } );
|
await page.emulateMedia( { colorScheme: saved } );
|
||||||
await page.emulateMedia( { colorScheme: operatingSystem } );
|
await page.emulateMedia( { colorScheme: operatingSystem } );
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', saved );
|
||||||
@@ -102,7 +111,7 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await page.emulateMedia( { colorScheme: 'light' } );
|
await page.emulateMedia( { colorScheme: 'light' } );
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
await page.getByRole( 'radio', { name: 'System', exact: true } ).check();
|
await page.getByRole( 'button', { name: 'System', exact: true } ).click();
|
||||||
await expect
|
await expect
|
||||||
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
||||||
.toBeNull();
|
.toBeNull();
|
||||||
@@ -110,7 +119,10 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await page.emulateMedia( { colorScheme: 'dark' } );
|
await page.emulateMedia( { colorScheme: 'dark' } );
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
await page.reload();
|
await page.reload();
|
||||||
await expect( page.getByRole( 'radio', { name: 'System', exact: true } ) ).toBeChecked();
|
await expect( page.getByRole( 'button', { name: 'System', exact: true } ) ).toHaveAttribute(
|
||||||
|
'aria-pressed',
|
||||||
|
'true',
|
||||||
|
);
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
await expect
|
await expect
|
||||||
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
.poll( () => page.evaluate( ( key ) => localStorage.getItem( key ), preferenceKey ) )
|
||||||
@@ -139,7 +151,7 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await expect( trigger ).toHaveAttribute( 'aria-expanded', 'false' );
|
await expect( trigger ).toHaveAttribute( 'aria-expanded', 'false' );
|
||||||
|
|
||||||
await trigger.click();
|
await trigger.click();
|
||||||
await page.getByRole( 'radio', { name: 'System', exact: true } ).focus();
|
await page.getByRole( 'button', { name: 'System', exact: true } ).focus();
|
||||||
await page.getByText( 'Made in Sinaloa, shared from home.', { exact: true } ).click();
|
await page.getByText( 'Made in Sinaloa, shared from home.', { exact: true } ).click();
|
||||||
await expect( panel ).toBeHidden();
|
await expect( panel ).toBeHidden();
|
||||||
await expect( trigger ).toBeVisible();
|
await expect( trigger ).toBeVisible();
|
||||||
@@ -176,16 +188,21 @@ test.describe( 'real theme preference shell', () => {
|
|||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'native radios expose state, keyboard interaction, status, and 44px targets', async ( {
|
test( 'native toggle buttons expose state, keyboard interaction, status, and 44px targets', async ( {
|
||||||
page,
|
page,
|
||||||
} ) => {
|
} ) => {
|
||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
const light = page.getByRole( 'radio', { name: 'Light', exact: true } );
|
const light = page.getByRole( 'button', { name: 'Light', exact: true } );
|
||||||
await light.focus();
|
await light.focus();
|
||||||
await page.keyboard.press( 'ArrowRight' );
|
await page.keyboard.press( 'ArrowRight' );
|
||||||
await expect( page.getByRole( 'radio', { name: 'Dark', exact: true } ) ).toBeChecked();
|
await expect( page.getByRole( 'button', { name: 'Dark', exact: true } ) ).toHaveAttribute(
|
||||||
|
'aria-pressed',
|
||||||
|
'true',
|
||||||
|
);
|
||||||
await expect( page.locator( '[data-chrnx-theme-status]' ) ).toHaveText( 'Dark theme active' );
|
await expect( page.locator( '[data-chrnx-theme-status]' ) ).toHaveText( 'Dark theme active' );
|
||||||
for ( const label of await page.locator( '[data-chrnx-theme-toggle] label' ).all() ) {
|
for ( const label of await page
|
||||||
|
.locator( '[data-chrnx-theme-toggle] [data-chrnx-theme-value]' )
|
||||||
|
.all() ) {
|
||||||
const box = await label.boundingBox();
|
const box = await label.boundingBox();
|
||||||
expect( box.width ).toBeGreaterThanOrEqual( 44 );
|
expect( box.width ).toBeGreaterThanOrEqual( 44 );
|
||||||
expect( box.height ).toBeGreaterThanOrEqual( 44 );
|
expect( box.height ).toBeGreaterThanOrEqual( 44 );
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ test( 'lower home sections keep the layered Music stage contained in both themes
|
|||||||
|
|
||||||
const result = await page.locator( '.chrnx-home' ).evaluate( ( home, order ) => {
|
const result = await page.locator( '.chrnx-home' ).evaluate( ( home, order ) => {
|
||||||
const selectors = [
|
const selectors = [
|
||||||
'.chrnx-home-projects',
|
'.chrnx-home-projects > .chrnx-character-stage',
|
||||||
'.chrnx-home-music > .chrnx-character-stage',
|
'.chrnx-home-music > .chrnx-character-stage',
|
||||||
'.chrnx-latest-podcast',
|
'.chrnx-latest-podcast',
|
||||||
'.chrnx-home-about-preview',
|
'.chrnx-home-about-preview',
|
||||||
@@ -372,7 +372,7 @@ test( 'lower home sections keep the layered Music stage contained in both themes
|
|||||||
} ),
|
} ),
|
||||||
] );
|
] );
|
||||||
expect( result.collageLazy ).toBe( 'lazy' );
|
expect( result.collageLazy ).toBe( 'lazy' );
|
||||||
expect( result.collageFallback ).toContain( 'the-no-names-collage.jpeg' );
|
expect( result.collageFallback ).toContain( 'the-no-names-collage-768.webp' );
|
||||||
expect( result.collageContained ).toBeTruthy();
|
expect( result.collageContained ).toBeTruthy();
|
||||||
expect( result.collageTreated ).toBeTruthy();
|
expect( result.collageTreated ).toBeTruthy();
|
||||||
expect( result.copyPosition ).not.toBe( 'static' );
|
expect( result.copyPosition ).not.toBe( 'static' );
|
||||||
@@ -540,7 +540,7 @@ test( 'explicit themes use an atmospheric canvas and a compact home introduction
|
|||||||
for ( const theme of [ 'Dark', 'Light' ] ) {
|
for ( const theme of [ 'Dark', 'Light' ] ) {
|
||||||
await page.setViewportSize( { width: 1440, height: 900 } );
|
await page.setViewportSize( { width: 1440, height: 900 } );
|
||||||
await page.goto( '/' );
|
await page.goto( '/' );
|
||||||
await page.getByRole( 'radio', { name: theme, exact: true } ).check();
|
await page.getByRole( 'button', { name: theme, exact: true } ).click();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', theme.toLowerCase() );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', theme.toLowerCase() );
|
||||||
|
|
||||||
const desktop = await page.evaluate( () => {
|
const desktop = await page.evaluate( () => {
|
||||||
@@ -649,9 +649,9 @@ test( 'topic, music, podcast, and about surfaces use real content and approved a
|
|||||||
page,
|
page,
|
||||||
} ) => {
|
} ) => {
|
||||||
for ( const [ path, heading, asset ] of [
|
for ( const [ path, heading, asset ] of [
|
||||||
[ '/topic/code/', 'Code', 'alter-ego-code.png' ],
|
[ '/topic/code/', 'Code', 'alter-ego-code-768.webp' ],
|
||||||
[ '/topic/research/', 'Research', 'alter-ego-research.png' ],
|
[ '/topic/research/', 'Research', 'alter-ego-research-768.webp' ],
|
||||||
[ '/topic/gaming/', 'Gaming', 'alter-ego-gaming-half-body.png' ],
|
[ '/topic/gaming/', 'Gaming', 'alter-ego-gaming-half-body-768.webp' ],
|
||||||
] ) {
|
] ) {
|
||||||
await page.goto( path );
|
await page.goto( path );
|
||||||
await expect( page.getByRole( 'heading', { level: 1, name: heading } ) ).toBeVisible();
|
await expect( page.getByRole( 'heading', { level: 1, name: heading } ) ).toBeVisible();
|
||||||
@@ -705,12 +705,12 @@ test( 'topic, music, podcast, and about surfaces use real content and approved a
|
|||||||
await expect( page.getByRole( 'heading', { level: 1, name: 'Music' } ) ).toBeVisible();
|
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.getByText( 'Grunge mexicano para cerebros que no se callan.' ) ).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( 'picture img[src*="the-no-names-musician-cutout.png"]' ),
|
page.locator( 'picture img[src*="the-no-names-musician-cutout-768.webp"]' ),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
await page.goto( '/podcasts/' );
|
await page.goto( '/podcasts/' );
|
||||||
await expect( page.getByRole( 'heading', { level: 1, name: 'Podcasts' } ) ).toBeVisible();
|
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( 'picture img[src*="alter-ego-podcasts-768.webp"]' ) ).toBeVisible();
|
||||||
await expect( page.locator( 'iframe, audio' ) ).toHaveCount( 0 );
|
await expect( page.locator( 'iframe, audio' ) ).toHaveCount( 0 );
|
||||||
|
|
||||||
await page.goto( '/about/' );
|
await page.goto( '/about/' );
|
||||||
@@ -722,8 +722,8 @@ test( 'topic, music, podcast, and about surfaces use real content and approved a
|
|||||||
await expect( page.locator( '.chrnx-about .chrnx-character-stage__art > picture' ) ).toHaveCount(
|
await expect( page.locator( '.chrnx-about .chrnx-character-stage__art > picture' ) ).toHaveCount(
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
await expect( page.locator( '.chrnx-about__portraits > picture' ) ).toHaveCount( 2 );
|
// One backdrop in the atmosphere layer plus the portrait in the art layer.
|
||||||
await expect( page.locator( '.chrnx-about picture' ) ).toHaveCount( 3 );
|
await expect( page.locator( '.chrnx-about picture' ) ).toHaveCount( 2 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'long, incomplete, empty, and missing states stay usable', async ( { page } ) => {
|
test( 'long, incomplete, empty, and missing states stay usable', async ( { page } ) => {
|
||||||
@@ -888,7 +888,7 @@ test( 'reduced motion removes card transitions while theme preference remains us
|
|||||||
);
|
);
|
||||||
expect( duration ).toBeLessThanOrEqual( 0.001 );
|
expect( duration ).toBeLessThanOrEqual( 0.001 );
|
||||||
await expect( page.locator( '.chrnx-home-music h2' ) ).toHaveCSS( 'color', 'rgb(230, 237, 243)' );
|
await expect( page.locator( '.chrnx-home-music h2' ) ).toHaveCSS( 'color', 'rgb(230, 237, 243)' );
|
||||||
await page.getByRole( 'radio', { name: 'Dark', exact: true } ).check();
|
await page.getByRole( 'button', { name: 'Dark', exact: true } ).click();
|
||||||
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
await expect( page.locator( 'html' ) ).toHaveAttribute( 'data-theme', 'dark' );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@@ -970,8 +970,10 @@ test( 'character stage geometry, layering, effects, loading, and inspection capt
|
|||||||
}
|
}
|
||||||
expect( geometry.contentArtIntersect ).toBeFalsy();
|
expect( geometry.contentArtIntersect ).toBeFalsy();
|
||||||
expect( geometry.followingIntersections ).toBe( 0 );
|
expect( geometry.followingIntersections ).toBe( 0 );
|
||||||
|
// 'about' is absent: its stage is now the last thing on the page, so
|
||||||
|
// there is no following surface left to check for overlap.
|
||||||
if (
|
if (
|
||||||
[ 'home-projects', 'home-music', 'projects', 'music', 'podcasts', 'about' ].includes(
|
[ 'home-projects', 'home-music', 'projects', 'music', 'podcasts' ].includes(
|
||||||
surface.name,
|
surface.name,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@@ -991,7 +993,8 @@ test( 'character stage geometry, layering, effects, loading, and inspection capt
|
|||||||
const sourceName = new URL( image.src ).pathname
|
const sourceName = new URL( image.src ).pathname
|
||||||
.split( '/' )
|
.split( '/' )
|
||||||
.pop()
|
.pop()
|
||||||
.replace( /\.png$/, '' );
|
// The src is a generated derivative now: strip -<width>.<ext>.
|
||||||
|
.replace( /-\d+\.(?:png|jpe?g|webp|avif)$/, '' );
|
||||||
const [ naturalWidth, naturalHeight, x0, y0, x1, y1 ] = boundsByAsset[ sourceName ];
|
const [ naturalWidth, naturalHeight, x0, y0, x1, y1 ] = boundsByAsset[ sourceName ];
|
||||||
const imageRect = image.getBoundingClientRect();
|
const imageRect = image.getBoundingClientRect();
|
||||||
const stageRect = element.getBoundingClientRect();
|
const stageRect = element.getBoundingClientRect();
|
||||||
@@ -1057,10 +1060,6 @@ test( 'character stage geometry, layering, effects, loading, and inspection capt
|
|||||||
expect( collageContract.hiddenAncestor ).toBeFalsy();
|
expect( collageContract.hiddenAncestor ).toBeFalsy();
|
||||||
expect( collageContract.alt ).toBe( 'The No Names collage' );
|
expect( collageContract.alt ).toBe( 'The No Names collage' );
|
||||||
}
|
}
|
||||||
if ( surface.name === 'about' ) {
|
|
||||||
expect( geometry.facetsOpacity ).toBeLessThan( 1 );
|
|
||||||
expect( geometry.facetsZ ).toBeLessThan( geometry.pictureZ );
|
|
||||||
}
|
|
||||||
await expectNoHorizontalOverflow( page );
|
await expectNoHorizontalOverflow( page );
|
||||||
|
|
||||||
if ( initial.top >= viewport.height ) {
|
if ( initial.top >= viewport.height ) {
|
||||||
@@ -1310,8 +1309,8 @@ const musicPodcastLandingCases = [
|
|||||||
path: '/music/',
|
path: '/music/',
|
||||||
root: '.chrnx-music-landing',
|
root: '.chrnx-music-landing',
|
||||||
copy: 'The No Names es una banda activa',
|
copy: 'The No Names es una banda activa',
|
||||||
atmosphere: 'img[src*="the-no-names-collage.jpeg"]',
|
atmosphere: 'img[src*="the-no-names-collage-768.webp"]',
|
||||||
art: 'img[src*="the-no-names-musician-cutout.png"]',
|
art: 'img[src*="the-no-names-musician-cutout-768.webp"]',
|
||||||
latestMedia: null,
|
latestMedia: null,
|
||||||
supporting: 'text=El proceso usa generative AI',
|
supporting: 'text=El proceso usa generative AI',
|
||||||
},
|
},
|
||||||
@@ -1320,8 +1319,8 @@ const musicPodcastLandingCases = [
|
|||||||
path: '/podcasts/',
|
path: '/podcasts/',
|
||||||
root: '.chrnx-podcast-landing',
|
root: '.chrnx-podcast-landing',
|
||||||
copy: 'Conversations about the work behind software, research, music, and games.',
|
copy: 'Conversations about the work behind software, research, music, and games.',
|
||||||
atmosphere: 'img[src*="podcast-frequency-grunge.png"]',
|
atmosphere: 'img[src*="podcast-frequency-grunge-1536.webp"]',
|
||||||
art: 'img[src*="alter-ego-podcasts.png"]',
|
art: 'img[src*="alter-ego-podcasts-768.webp"]',
|
||||||
latestMedia:
|
latestMedia:
|
||||||
'.chrnx-latest-podcast .chrnx-podcast-card__image, .chrnx-latest-podcast .chrnx-podcast-card__fallback',
|
'.chrnx-latest-podcast .chrnx-podcast-card__image, .chrnx-latest-podcast .chrnx-podcast-card__fallback',
|
||||||
supporting: '.chrnx-latest-podcast',
|
supporting: '.chrnx-latest-podcast',
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
"slug": "projects",
|
"slug": "projects",
|
||||||
"title": "Projects",
|
"title": "Projects",
|
||||||
"status": "publish",
|
"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\"} /-->"
|
"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:chrnx/journal-stream {\"topic\":\"projects\"} /-->"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "page-music",
|
"fixtureKey": "page-music",
|
||||||
@@ -46,6 +46,6 @@
|
|||||||
"slug": "subscribe",
|
"slug": "subscribe",
|
||||||
"title": "Subscribe",
|
"title": "Subscribe",
|
||||||
"status": "publish",
|
"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 -->"
|
"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.</p><!-- /wp:paragraph --><!-- wp:chrnx/subscribe-form /-->"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -9,6 +9,35 @@
|
|||||||
"featured": true,
|
"featured": true,
|
||||||
"fixtureState": "unbroken-code"
|
"fixtureState": "unbroken-code"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-project-expressive-tea",
|
||||||
|
"title": "Expressive Tea",
|
||||||
|
"slug": "expressive-tea",
|
||||||
|
"excerpt": "Full-stack product work in JavaScript and Python, built with a small team and a long memory.",
|
||||||
|
"content": "<!-- wp:paragraph --><p>Lead development on a full-stack product built with JavaScript and Python, where the interesting constraints are organizational as often as technical.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "projects",
|
||||||
|
"language": "en",
|
||||||
|
"projectFeatured": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-project-ailed",
|
||||||
|
"title": "Ailed",
|
||||||
|
"slug": "ailed",
|
||||||
|
"excerpt": "An expressive agent that models hesitation instead of resolving it away.",
|
||||||
|
"content": "<!-- wp:paragraph --><p>An experiment in emotion modeling for game AI: the agent is allowed to be uncertain, and that uncertainty is part of its behavior rather than a defect.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "projects",
|
||||||
|
"language": "en",
|
||||||
|
"projectFeatured": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-project-published-research",
|
||||||
|
"title": "Published research",
|
||||||
|
"slug": "published-research",
|
||||||
|
"excerpt": "Independent research on emotion modeling and expressive systems.",
|
||||||
|
"content": "<!-- wp:paragraph --><p>Independent research published on arXiv, covering emotion modeling and the design of systems that can express internal state.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "projects",
|
||||||
|
"language": "en"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "post-research-primary",
|
"fixtureKey": "post-research-primary",
|
||||||
"title": "What game AI can learn from the uncomfortable space between intention and action",
|
"title": "What game AI can learn from the uncomfortable space between intention and action",
|
||||||
@@ -47,6 +76,39 @@
|
|||||||
"language": "es",
|
"language": "es",
|
||||||
"fixtureState": "missing-media"
|
"fixtureState": "missing-media"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-track-uno",
|
||||||
|
"title": "La primera que se rompió",
|
||||||
|
"slug": "la-primera-que-se-rompio",
|
||||||
|
"excerpt": "Fixture local de canción: letra y notas de proceso sin publicar material real.",
|
||||||
|
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph --><!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Por qué existe</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Nota de proceso de ejemplo para validar la plantilla de canción.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "music",
|
||||||
|
"language": "es",
|
||||||
|
"release": "el-hermoso-caos",
|
||||||
|
"trackNumber": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-track-dos",
|
||||||
|
"title": "Cuarto sin ventanas",
|
||||||
|
"slug": "cuarto-sin-ventanas",
|
||||||
|
"excerpt": "Fixture local de canción para validar el orden de la lista de pistas.",
|
||||||
|
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "music",
|
||||||
|
"language": "es",
|
||||||
|
"release": "el-hermoso-caos",
|
||||||
|
"trackNumber": 2
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fixtureKey": "post-track-tres",
|
||||||
|
"title": "Jerga rota",
|
||||||
|
"slug": "jerga-rota",
|
||||||
|
"excerpt": "Fixture local de canción asignada a otro disco.",
|
||||||
|
"content": "<!-- wp:heading {\"level\":2} --><h2 class=\"wp-block-heading\">Letra</h2><!-- /wp:heading --><!-- wp:paragraph --><p>Este contenido existe únicamente como fixture local del tema.</p><!-- /wp:paragraph -->",
|
||||||
|
"topic": "music",
|
||||||
|
"language": "es",
|
||||||
|
"release": "aqui-se-rompio-una-jerga",
|
||||||
|
"trackNumber": 1
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"fixtureKey": "post-podcast-episode",
|
"fixtureKey": "post-podcast-episode",
|
||||||
"title": "Silicon Ranch: conversaciones sin diapositivas",
|
"title": "Silicon Ranch: conversaciones sin diapositivas",
|
||||||
|
|||||||
@@ -0,0 +1,102 @@
|
|||||||
|
const modulePath = '../../assets/js/editor-project.js';
|
||||||
|
|
||||||
|
function flatten( node ) {
|
||||||
|
if ( ! node || typeof node !== 'object' ) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return [ node ].concat( ( node.children || [] ).flatMap( flatten ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWp( topicSlug = 'projects', meta = { unrelated: 'keep' } ) {
|
||||||
|
const editPost = jest.fn();
|
||||||
|
const registerPlugin = jest.fn();
|
||||||
|
const state = { meta, topic: [ 12 ] };
|
||||||
|
const wp = {
|
||||||
|
components: { ToggleControl: 'ToggleControl' },
|
||||||
|
i18n: { __: jest.fn( ( text ) => text ) },
|
||||||
|
data: {
|
||||||
|
select: ( store ) => {
|
||||||
|
if ( store === 'core/editor' ) {
|
||||||
|
return {
|
||||||
|
getCurrentPostType: () => 'post',
|
||||||
|
getEditedPostAttribute: ( key ) => state[ key ],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
getEntityRecord: () => ( topicSlug ? { id: 12, slug: topicSlug } : undefined ),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
dispatch: () => ( { editPost } ),
|
||||||
|
useDispatch: ( store ) => wp.data.dispatch( store ),
|
||||||
|
useSelect: ( mapper ) => mapper( wp.data.select ),
|
||||||
|
},
|
||||||
|
editPost: { PluginDocumentSettingPanel: 'PluginDocumentSettingPanel' },
|
||||||
|
element: {
|
||||||
|
createElement: ( type, props, ...children ) => ( { type, props: props || {}, children } ),
|
||||||
|
},
|
||||||
|
plugins: { registerPlugin },
|
||||||
|
};
|
||||||
|
return { wp, editPost, registerPlugin };
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderPanel( context ) {
|
||||||
|
const { initialize } = require( modulePath );
|
||||||
|
expect( initialize( context.wp ) ).toBe( true );
|
||||||
|
const [ , plugin ] = context.registerPlugin.mock.calls[ 0 ];
|
||||||
|
return plugin.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
describe( 'project editor panel', () => {
|
||||||
|
beforeEach( () => {
|
||||||
|
jest.resetModules();
|
||||||
|
} );
|
||||||
|
|
||||||
|
test( 'refuses to initialize without the required editor globals', () => {
|
||||||
|
const { initialize } = require( modulePath );
|
||||||
|
expect( initialize( undefined ) ).toBe( false );
|
||||||
|
expect( initialize( {} ) ).toBe( false );
|
||||||
|
} );
|
||||||
|
|
||||||
|
test( 'renders the Selected work toggle only for the projects topic', () => {
|
||||||
|
const context = createWp( 'projects' );
|
||||||
|
const toggles = flatten( renderPanel( context ) ).filter(
|
||||||
|
( node ) => node.type === 'ToggleControl',
|
||||||
|
);
|
||||||
|
expect( toggles ).toHaveLength( 1 );
|
||||||
|
expect( toggles[ 0 ].props.checked ).toBe( false );
|
||||||
|
} );
|
||||||
|
|
||||||
|
test.each( [ 'podcasts', 'code', null ] )( 'renders nothing for the %s topic', ( slug ) => {
|
||||||
|
expect( renderPanel( createWp( slug ) ) ).toBeNull();
|
||||||
|
} );
|
||||||
|
|
||||||
|
test( 'reflects an existing flag and preserves unrelated meta when toggling', () => {
|
||||||
|
const context = createWp( 'projects', { unrelated: 'keep', chrnx_project_featured: true } );
|
||||||
|
const toggle = flatten( renderPanel( context ) ).find(
|
||||||
|
( node ) => node.type === 'ToggleControl',
|
||||||
|
);
|
||||||
|
expect( toggle.props.checked ).toBe( true );
|
||||||
|
|
||||||
|
toggle.props.onChange( false );
|
||||||
|
expect( context.editPost ).toHaveBeenCalledWith( {
|
||||||
|
meta: { unrelated: 'keep', chrnx_project_featured: false },
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
test( 'coerces the toggle value to a boolean', () => {
|
||||||
|
const context = createWp( 'projects' );
|
||||||
|
const toggle = flatten( renderPanel( context ) ).find(
|
||||||
|
( node ) => node.type === 'ToggleControl',
|
||||||
|
);
|
||||||
|
|
||||||
|
toggle.props.onChange( 'yes' );
|
||||||
|
expect( context.editPost ).toHaveBeenCalledWith( {
|
||||||
|
meta: { unrelated: 'keep', chrnx_project_featured: true },
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
|
test( 'updateMeta ignores a missing dispatcher', () => {
|
||||||
|
const { updateMeta } = require( modulePath );
|
||||||
|
expect( () => updateMeta( undefined, {}, 'chrnx_project_featured', true ) ).not.toThrow();
|
||||||
|
} );
|
||||||
|
} );
|
||||||