pandorga 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df6a05990dd61bd1ec65a55988e6ff3c905dac4368c1205bb963b261440adf2c
4
- data.tar.gz: 4f28891d107c9dd8b19afdef872ae025f82f9106369477214d07ff10576b22a5
3
+ metadata.gz: 8c9fcaebfa09f151225a005f9ca49ccb34320f516aefd0f8f28eff721dbe3726
4
+ data.tar.gz: 2ffe1e36ff882618935d75ba11d14c678aff17ebe3e9cebb170c2ac2c249f59a
5
5
  SHA512:
6
- metadata.gz: 755cc712729fdde1c7c04fa76ce617b4045dd0da9e73e88c8aa945e823c5db21e1c8da95c9b2240cb46d28328ecf25bf9d37fc129317715e13ed52c111188131
7
- data.tar.gz: fc897b6820e06bf5b87bed93001605b5ac744025564427ad1b4cb9637d0ff9b9002d6a67e136f56363b762422bf5cb25017145f7226c31ea9c5309ccdd739e9d
6
+ metadata.gz: 6be58d5f4bed12c2fdc76c49aafd1f3d554548eb45e88407d0da69c7e78d4814d879baac2db12dd178c16cf656a5e141fb62f5255c7f1a8073a5084e139a920b
7
+ data.tar.gz: bdcf073db0cc976f72121ecd865fce8028136e24ddb260cc74b3372d03064759247db4fca3b611d804343734e1c11d37086890f73057274f70d68857ee24ae6b
data/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [2.2.2] — 2026-10-28
6
+
7
+ ### Added
8
+
9
+ - CR-15: Hero longest line clamp divisor updated to upright Ancizar factor (~6.9em), with `--hero-name-fit` default updated to 6.9, so stacked hero titles fit cleanly within copy measure while desktop resolves near 73px (`--hero-name-max`) (PLT-AC-68).
10
+ - CR-16: Bumped project/inventory logo icon and sibling mark font-sizes by +2pt across all breakpoints (`calc(... + 2pt)`) (PLT-AC-69).
11
+ - CR-17: Home band section titles stepped up to `--type-section` below 768px and `--type-section-lg` from 768px, ensuring section headings clearly outrank featured project names (PLT-AC-70).
12
+ - CR-20: Detail reading-progress bar position changed to `position: fixed; top: 0` (bisect note: changed from 4.25rem added in 2.1.0 to stay fixed at viewport top regardless of sticky top bar hide-on-scroll state) (PLT-AC-72).
13
+ - Regression gate: Additive headless browser CI regression gate testing home, articles list, EN article detail, and PT post detail across 320, 390, 1440 viewports in light and dark themes for zero horizontal overflow, non-overlapping stacked elements, hero family bounding, and progress bar alignment (PLT-AC-73).
14
+
15
+ ### Changed
16
+
17
+ - CR-19: Mobile article/post detail (<768px) meta and actions block redesign: published/updated dates stack vertically with breathing room; thin divider lines separate the block from the header plate and reading column; action controls (Back, Share, Cite, reading size, PDF) set as a `nowrap` equal-size icon-only row with visually hidden labels and accessible `aria-label`s fitting 320px viewports without overflow; clear gap added before prose and drop cap (PLT-AC-71).
18
+
19
+ ## [2.2.1] — 2026-10-28
20
+
21
+ ### Fixed
22
+
23
+ - CR-18: Mobile article/post detail meta restores `flex-wrap: wrap` so action buttons (Back, Share, Cite, reading size) wrap to the next row when dates and actions cannot share one line, preventing button crushing and clipping on narrow screens (regression from 2.1.0) (PLT-AC-67).
24
+
5
25
  ## [2.2.0] — 2026-10-28
6
26
 
7
27
  ### Added
@@ -32,8 +32,8 @@
32
32
  position: fixed;
33
33
  left: 0;
34
34
  right: 0;
35
- /* Approx sticky nav stack: wordmark row + padding (shell sticky nav). */
36
- top: 4.25rem;
35
+ /* Fixed at viewport top so the bar stays visible when sticky nav hides on scroll (CR-20). */
36
+ top: 0;
37
37
  z-index: 40;
38
38
  height: 2px;
39
39
  background: var(--color-primary);
@@ -1233,19 +1233,37 @@ nav.text-page-nav:not(:has(a)) {
1233
1233
  padding-bottom: var(--space-md);
1234
1234
  }
1235
1235
 
1236
- /* On mobile, date row and action buttons share one compact horizontal band on one non-wrapping row. */
1236
+ /* The reading column has a clear gap before the prose / drop cap. */
1237
+ .text-page-main:is([data-dynamic-article-detail],
1238
+ [data-dynamic-post-detail],
1239
+ [data-dynamic-project-detail],
1240
+ [data-dynamic-product-detail],
1241
+ [data-dynamic-portfolio-detail]) {
1242
+ margin-top: var(--space-lg);
1243
+ }
1244
+
1245
+ .text-detail-sidebar .article-sidebar-heading {
1246
+ border-bottom: 0;
1247
+ }
1248
+
1249
+ /* On mobile, date block is stacked vertically and separated by thin dividers. */
1237
1250
  .text-detail-sidebar .article-meta {
1238
1251
  display: flex;
1239
- flex-direction: row;
1240
- flex-wrap: nowrap;
1241
- align-items: center;
1242
- justify-content: space-between;
1243
- gap: var(--space-xs) var(--space-sm);
1244
- margin-bottom: 0;
1245
- padding-bottom: 0;
1252
+ flex-direction: column;
1253
+ align-items: stretch;
1254
+ gap: var(--space-md);
1255
+ margin-top: var(--space-md);
1256
+ margin-bottom: var(--space-md);
1257
+ padding-top: var(--space-md);
1258
+ padding-bottom: var(--space-md);
1259
+ border-top: 1px solid var(--border-gentle-divider);
1260
+ border-bottom: 1px solid var(--border-gentle-divider);
1246
1261
  }
1247
1262
 
1248
1263
  .text-detail-sidebar .article-meta > div {
1264
+ display: flex;
1265
+ flex-direction: column;
1266
+ gap: var(--space-xs);
1249
1267
  margin: 0;
1250
1268
  padding: 0;
1251
1269
  }
@@ -1256,9 +1274,48 @@ nav.text-page-nav:not(:has(a)) {
1256
1274
  }
1257
1275
 
1258
1276
  .text-detail-sidebar .article-meta .detail-actions {
1277
+ display: flex;
1278
+ flex-direction: row;
1279
+ flex-wrap: nowrap;
1280
+ justify-content: space-between;
1281
+ align-items: center;
1282
+ gap: var(--space-xs);
1283
+ width: 100%;
1259
1284
  margin-top: 0;
1260
- padding-top: 0;
1261
- border-top: 0;
1285
+ padding-top: var(--space-xs);
1286
+ border-top: 1px dashed var(--border-gentle-faint);
1287
+ }
1288
+
1289
+ .text-detail-sidebar .article-meta .detail-action,
1290
+ .text-detail-sidebar .article-meta .detail-type-size {
1291
+ flex: 1 1 0;
1292
+ min-width: 0;
1293
+ }
1294
+
1295
+ .text-detail-sidebar .article-meta .detail-action,
1296
+ .text-detail-sidebar .article-meta .detail-type-size-trigger {
1297
+ width: 100%;
1298
+ height: 2.5rem;
1299
+ padding: 0;
1300
+ margin: 0;
1301
+ display: inline-flex;
1302
+ justify-content: center;
1303
+ align-items: center;
1304
+ border-radius: var(--radius-pill);
1305
+ }
1306
+
1307
+ .text-detail-sidebar .article-meta .detail-action-label,
1308
+ .text-detail-sidebar .article-meta .detail-type-size-value,
1309
+ .text-detail-sidebar .article-meta .detail-type-size-caret {
1310
+ position: absolute;
1311
+ width: 1px;
1312
+ height: 1px;
1313
+ padding: 0;
1314
+ margin: -1px;
1315
+ overflow: hidden;
1316
+ clip: rect(0, 0, 0, 0);
1317
+ white-space: nowrap;
1318
+ border: 0;
1262
1319
  }
1263
1320
 
1264
1321
  .text-detail-sidebar .article-sidebar-description,
@@ -152,13 +152,13 @@
152
152
  }
153
153
 
154
154
  /* Name spans the copy column (container query on .home-hero-copy). Divisor
155
- is calculated for Ancizar Serif at -0.02em tracking (~5.55em phone
155
+ is calculated for Ancizar Serif at -0.02em tracking (~6.9em phone
156
156
  family-line width). From 640px the floor follows `.section-title` up to
157
157
  `--type-section-lg`. Wider columns still grow toward `--type-page-lg`. */
158
158
  .home-hero-title {
159
159
  font-family: var(--font-title);
160
160
  font-weight: 400;
161
- font-size: clamp(var(--type-section), calc(100cqi * 0.92 / 5.55), var(--type-page-lg));
161
+ font-size: clamp(var(--type-section), calc(100cqi * 0.92 / 6.9), var(--type-page-lg));
162
162
  line-height: 1.05;
163
163
  letter-spacing: -0.02em;
164
164
  color: var(--color-on-surface);
@@ -187,7 +187,7 @@
187
187
 
188
188
  @media (min-width: 640px) {
189
189
  .home-hero-title {
190
- font-size: clamp(var(--type-section-lg), calc(100cqi * 0.92 / 5.55), var(--type-page-lg));
190
+ font-size: clamp(var(--type-section-lg), calc(100cqi * 0.92 / 6.9), var(--type-page-lg));
191
191
  }
192
192
  }
193
193
 
@@ -196,14 +196,14 @@
196
196
  @media (max-width: 639px) {
197
197
  .home-hero-title {
198
198
  white-space: normal;
199
- font-size: calc(clamp(var(--type-section), calc(100cqi * 0.92 / 5.55), var(--type-page-lg)) + 3pt);
199
+ font-size: calc(clamp(var(--type-section), calc(100cqi * 0.92 / 6.9), var(--type-page-lg)) + 3pt);
200
200
  }
201
201
  }
202
202
 
203
203
  @media (min-width: 640px) and (max-width: 767px) {
204
204
  .home-hero-title {
205
205
  white-space: normal;
206
- font-size: calc(clamp(var(--type-section-lg), calc(100cqi * 0.92 / 5.55), var(--type-page-lg)) + 3pt);
206
+ font-size: calc(clamp(var(--type-section-lg), calc(100cqi * 0.92 / 6.9), var(--type-page-lg)) + 3pt);
207
207
  }
208
208
  }
209
209
 
@@ -215,6 +215,12 @@
215
215
  }
216
216
  }
217
217
 
218
+ @media (min-width: 768px) and (max-width: 1023px) {
219
+ .home-hero-title {
220
+ font-size: clamp(var(--type-section-lg), calc(100cqi * 0.92 / 10.81), var(--type-page-lg));
221
+ }
222
+ }
223
+
218
224
  @media (min-width: 768px) {
219
225
  .home-hero-title {
220
226
  white-space: nowrap;
@@ -408,11 +414,11 @@ html[data-theme="light"] .home-hero-plate {
408
414
  }
409
415
 
410
416
  /* --hero-name-fit is the longer name part in em at the title's tracking
411
- (Ancizar full-name default ~10.81em); a site with a longer word raises it.
417
+ (Ancizar stacked-line default ~6.9em); a site with a longer word raises it.
412
418
  The selector outranks a site's one-line size written as .home-ledger .home-hero-title. */
413
419
  .home-ledger .home-hero-title {
414
420
  white-space: normal;
415
- font-size: min(calc(100cqi / var(--hero-name-fit, 10.81)), var(--hero-name-max, 4.5rem));
421
+ font-size: min(calc(100cqi / var(--hero-name-fit, 6.9)), var(--hero-name-max, 4.5rem));
416
422
  }
417
423
 
418
424
  .home-hero-given,
@@ -476,7 +482,7 @@ html[data-theme="light"] .home-hero-plate {
476
482
  grid-column: 1;
477
483
  grid-row: 2;
478
484
  margin: 0;
479
- font-size: var(--type-section-sm);
485
+ font-size: var(--type-section);
480
486
  }
481
487
 
482
488
  .home-band .home-section-aside {
@@ -503,7 +509,7 @@ html[data-theme="light"] .home-hero-plate {
503
509
 
504
510
  @media (min-width: 768px) {
505
511
  .home-band .ledger-section-banner .section-title {
506
- font-size: var(--type-section);
512
+ font-size: var(--type-section-lg);
507
513
  }
508
514
 
509
515
  .home-band .home-section-note {
@@ -1158,20 +1164,20 @@ html[data-theme="light"] .home-hero-plate {
1158
1164
  width: 2.25rem;
1159
1165
  height: 2.25rem;
1160
1166
  margin: var(--space-sm);
1161
- font-size: 1.25rem;
1167
+ font-size: calc(1.25rem + 2pt);
1162
1168
  background: var(--color-surface-card);
1163
1169
  color: var(--color-primary);
1164
1170
  }
1165
1171
 
1166
1172
  @media (max-width: 899px) {
1167
1173
  .home-specimen-figure:has(> .ledger-poster)>.home-specimen-badge {
1168
- font-size: 1.375rem;
1174
+ font-size: calc(1.375rem + 2pt);
1169
1175
  }
1170
1176
 
1171
1177
  /* Two classes: the Material Symbols sheet loads after this one and resets
1172
1178
  the glyph size on a single class. */
1173
1179
  .home-project-inventory-row .home-project-inventory-glyph {
1174
- font-size: 1.375rem;
1180
+ font-size: calc(1.375rem + 2pt);
1175
1181
  }
1176
1182
 
1177
1183
  .home-project-inventory-row .home-project-inventory-glyph--initial {
@@ -1299,7 +1305,7 @@ button.home-project-inventory-row {
1299
1305
  display: inline-flex;
1300
1306
  align-items: center;
1301
1307
  justify-content: center;
1302
- font-size: 1.25rem;
1308
+ font-size: calc(1.25rem + 2pt);
1303
1309
  line-height: 1;
1304
1310
  color: var(--color-on-surface-variant);
1305
1311
  }
@@ -1425,7 +1431,7 @@ button.home-project-inventory-row {
1425
1431
  }
1426
1432
 
1427
1433
  .home-project-inventory-mark .material-symbols-outlined {
1428
- font-size: 1.75rem;
1434
+ font-size: calc(1.75rem + 2pt);
1429
1435
  }
1430
1436
 
1431
1437
  .home-project-inventory-mark--initial {
@@ -24,7 +24,7 @@ module Pandorga
24
24
 
25
25
  gem "pandorga", "~> 2.0"
26
26
  # Local checkout: gem "pandorga", path: "../pandorga"
27
- # GitHub tag: gem "pandorga", github: "alexandrelheinen/pandorga", tag: "v2.2.0"
27
+ # GitHub tag: gem "pandorga", github: "alexandrelheinen/pandorga", tag: "v2.2.2"
28
28
  gem "csv"
29
29
  gem "base64"
30
30
  RUBY
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pandorga
4
- VERSION = "2.2.0"
4
+ VERSION = "2.2.2"
5
5
  end
@@ -259,7 +259,7 @@ require_declarations(
259
259
  )
260
260
  require_declarations(
261
261
  errors, "assets/css/ledger/home.css", home_sheet,
262
- ".home-project-inventory-row .home-project-inventory-glyph", ["font-size: 1.375rem"]
262
+ ".home-project-inventory-row .home-project-inventory-glyph", ["font-size: calc(1.375rem + 2pt)"]
263
263
  )
264
264
  [
265
265
  "45.6%",
@@ -300,12 +300,37 @@ if declaration_bodies(home_sheet, ".home-hero-summary").any? { |body| declaratio
300
300
  errors << "assets/css/ledger/home.css: .home-hero-summary must use --color-legend (PLT-AC-23)"
301
301
  end
302
302
 
303
- # PLT-AC-62. Hero cqi clamp divisors calculated for Ancizar at -0.02em tracking (~5.55 / ~10.81). Cinzel comments removed.
304
- if home_sheet.match?(/Cinzel/i)
305
- errors << "assets/css/ledger/home.css must not contain Cinzel comments or references (PLT-AC-62)"
303
+ # PLT-AC-62 / PLT-AC-68. Hero cqi clamp divisors calculated for Ancizar (~6.9 / ~10.81). Cinzel and 5.55 comments removed.
304
+ if home_sheet.match?(/Cinzel/i) || home_sheet.include?("5.55")
305
+ errors << "assets/css/ledger/home.css must not contain Cinzel or obsolete 5.55 comments/divisors (PLT-AC-68)"
306
306
  end
307
- if home_sheet.include?("14.5") || home_sheet.include?("8.4")
308
- errors << "assets/css/ledger/home.css: hero clamp divisors must use Ancizar factors (~5.55 / ~10.81) instead of Cinzel (PLT-AC-62)"
307
+ unless home_sheet.include?("calc(100cqi * 0.92 / 6.9)") && home_sheet.include?("var(--hero-name-fit, 6.9)")
308
+ errors << "assets/css/ledger/home.css: hero clamp divisors must use Ancizar longer-part factor (~6.9) (PLT-AC-68)"
309
+ end
310
+
311
+ # PLT-AC-69. Inventory / project logo icon font-sizes +2pt.
312
+ require_declarations(
313
+ errors, "assets/css/ledger/home.css", home_sheet,
314
+ ".home-project-inventory-glyph", ["font-size: calc(1.25rem + 2pt)"]
315
+ )
316
+ unless home_sheet.include?("calc(1.375rem + 2pt)") && home_sheet.include?("calc(1.75rem + 2pt)")
317
+ errors << "assets/css/ledger/home.css: inventory icon sizes must be +2pt larger than 2.2.1 rem values (PLT-AC-69)"
318
+ end
319
+
320
+ # PLT-AC-70. Home section titles one step larger (--type-section / --type-section-lg).
321
+ require_declarations(
322
+ errors, "assets/css/ledger/home.css", home_sheet,
323
+ ".home-band .ledger-section-banner .section-title", ["font-size: var(--type-section)"]
324
+ )
325
+
326
+ # PLT-AC-71. Mobile article/post detail meta + actions redesign.
327
+ unless detail_sheet.include?("flex-direction: column") && detail_sheet.include?("detail-actions")
328
+ errors << "assets/css/ledger/detail.css: mobile detail meta must stack and include detail-actions (PLT-AC-71)"
329
+ end
330
+
331
+ # PLT-AC-72. Detail reading-progress bar uses top: 0 (not top: 4.25rem).
332
+ if detail_sheet.include?("top: 4.25rem") || !detail_sheet.include?("top: 0")
333
+ errors << "assets/css/ledger/detail.css: reading progress bar must use top: 0 instead of 4.25rem (PLT-AC-72)"
309
334
  end
310
335
 
311
336
  # PLT-AC-63. Page header markup must not hardcode class="italic" on title span.
@@ -224,7 +224,7 @@ item(6) do
224
224
  title = ".home-ledger .home-hero-title"
225
225
  expect_decl(title, "white-space", "normal", media: DESKTOP)
226
226
  expect_decl(title, "font-size",
227
- "min(calc(100cqi / var(--hero-name-fit, 10.81)), var(--hero-name-max, 4.5rem))",
227
+ "min(calc(100cqi / var(--hero-name-fit, 6.9)), var(--hero-name-max, 4.5rem))",
228
228
  media: DESKTOP)
229
229
  %w[.home-hero-given .home-hero-family].each do |sel|
230
230
  expect_decl(sel, "display", "inline-block", media: DESKTOP)
@@ -132,19 +132,20 @@ check!(long["family"] == (1..8).map { |index| "Tok#{index}" }.join(" "),
132
132
  symbols = Pandorga::IdentityName.resolve({ first_name: "Ada", last_name: "Rivera Santos" })
133
133
  check!(symbols["family"] == "Rivera Santos", "symbol keys work, got #{symbols.inspect}")
134
134
 
135
- # ── PLT-AC-15 ───────────────────────────────────────────────────────────────
135
+ # ── PLT-AC-15 / PLT-AC-68 ───────────────────────────────────────────────────
136
136
 
137
137
  hero = css[/\.home-hero-title \{.*?(?=\.home-hero-summary)/m]
138
138
  check!(hero, "missing hero title block")
139
- check!(hero.include?("font-size: clamp(var(--type-section), calc(100cqi * 0.92 / 5.55), var(--type-page-lg));"),
140
- "base name size uses Ancizar clamp")
139
+ check!(hero.include?("font-size: clamp(var(--type-section), calc(100cqi * 0.92 / 6.9), var(--type-page-lg));"),
140
+ "base name size uses Ancizar 6.9 clamp")
141
141
  check!(hero.include?("@media (max-width: 639px)"), "missing phone size query")
142
- check!(hero.include?("calc(clamp(var(--type-section), calc(100cqi * 0.92 / 5.55), var(--type-page-lg)) + 3pt)"),
142
+ check!(hero.include?("calc(clamp(var(--type-section), calc(100cqi * 0.92 / 6.9), var(--type-page-lg)) + 3pt)"),
143
143
  "below 640px the name must be the current clamp plus 3pt")
144
144
  check!(hero.include?("@media (min-width: 640px) and (max-width: 767px)"),
145
145
  "missing 640-767 size query")
146
- check!(hero.include?("calc(clamp(var(--type-section-lg), calc(100cqi * 0.92 / 5.55), var(--type-page-lg)) + 3pt)"),
146
+ check!(hero.include?("calc(clamp(var(--type-section-lg), calc(100cqi * 0.92 / 6.9), var(--type-page-lg)) + 3pt)"),
147
147
  "from 640px to 767px the name must be the section-lg clamp plus 3pt")
148
+ check!(css.include?("var(--hero-name-fit, 6.9)"), "desktop hero-name-fit default must be 6.9")
148
149
 
149
150
  plain = hero.index("@media (min-width: 640px) {")
150
151
  banded = hero.index("@media (min-width: 640px) and (max-width: 767px)")
@@ -75,7 +75,7 @@ def parse_css_rules(css_text)
75
75
  rules
76
76
  end
77
77
 
78
- # 1. Article page top on mobile
78
+ # 1. Article page top on mobile (PLT-AC-71)
79
79
  detail_css = strip_comments(File.read(CSS.join("ledger/detail.css")))
80
80
  detail_rules = parse_css_rules(detail_css)
81
81
 
@@ -83,12 +83,32 @@ meta_mobile_rules = detail_rules.select do |r|
83
83
  r[:media] && r[:media].include?("max-width:767px") && r[:sel] == ".text-detail-sidebar .article-meta"
84
84
  end
85
85
 
86
- has_row_layout = meta_mobile_rules.any? do |r|
87
- r[:decls].any? { |p, v| p == "flex-direction" && v == "row" }
86
+ has_col_layout = meta_mobile_rules.any? do |r|
87
+ r[:decls].any? { |p, v| p == "flex-direction" && v == "column" }
88
88
  end
89
89
 
90
- unless has_row_layout
91
- fail!("detail.css must set flex-direction: row on .text-detail-sidebar .article-meta under @media (max-width: 767px)")
90
+ unless has_col_layout
91
+ fail!("detail.css must set flex-direction: column on .text-detail-sidebar .article-meta under @media (max-width: 767px) (PLT-AC-71)")
92
+ end
93
+
94
+ actions_mobile_rules = detail_rules.select do |r|
95
+ r[:media] && r[:media].include?("max-width:767px") && r[:sel].include?("detail-actions")
96
+ end
97
+
98
+ has_nowrap_actions = actions_mobile_rules.any? do |r|
99
+ r[:decls].any? { |p, v| p == "flex-wrap" && v == "nowrap" }
100
+ end
101
+
102
+ unless has_nowrap_actions
103
+ fail!("detail.css must set flex-wrap: nowrap on .detail-actions under @media (max-width: 767px) (PLT-AC-71)")
104
+ end
105
+
106
+ has_divider_border = meta_mobile_rules.any? do |r|
107
+ r[:decls].any? { |p, v| (p == "border-top" || p == "border-bottom" || p == "border-block") && v.include?("border") }
108
+ end
109
+
110
+ unless has_divider_border
111
+ fail!("detail.css must set divider borders on .text-detail-sidebar .article-meta under @media (max-width: 767px) (PLT-AC-71)")
92
112
  end
93
113
 
94
114
  toc_disclosure_mobile = detail_rules.select do |r|
@@ -0,0 +1,385 @@
1
+ #!/usr/bin/env node
2
+ // Additive headless browser regression gate (PLT-AC-73).
3
+ // Tests home, articles list, EN article detail, PT post detail
4
+ // across 320, 390, 1440 viewports in light and dark themes.
5
+
6
+ import { spawn, execSync } from 'node:child_process';
7
+ import { existsSync } from 'node:fs';
8
+ import { mkdtemp, readFile, rm } from 'node:fs/promises';
9
+ import { createServer } from 'node:net';
10
+ import { tmpdir } from 'node:os';
11
+ import { join, resolve } from 'node:path';
12
+ import { setTimeout as delay } from 'node:timers/promises';
13
+ import { fileURLToPath } from 'node:url';
14
+
15
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
16
+ const ROOT = resolve(__dirname, '../..');
17
+ const SITE_DIR = join(ROOT, 'examples/full/_site');
18
+
19
+ function ensureSiteBuilt() {
20
+ if (existsSync(join(SITE_DIR, 'index.html'))) return;
21
+ console.log('Building examples/full site for regression gate...');
22
+ execSync('ruby scripts/test/test-examples-build.rb', { cwd: ROOT, stdio: 'inherit' });
23
+ }
24
+
25
+ function freePort() {
26
+ return new Promise((resolve, reject) => {
27
+ const server = createServer();
28
+ server.once('error', reject);
29
+ server.listen(0, '127.0.0.1', () => {
30
+ const { port } = server.address();
31
+ server.close(() => resolve(port));
32
+ });
33
+ });
34
+ }
35
+
36
+ class Cdp {
37
+ constructor(ws) {
38
+ this.ws = ws;
39
+ this.next = 1;
40
+ this.pending = new Map();
41
+ this.listeners = [];
42
+ ws.addEventListener('message', (event) => {
43
+ const message = JSON.parse(event.data);
44
+ if (message.id && this.pending.has(message.id)) {
45
+ const { resolve, reject } = this.pending.get(message.id);
46
+ this.pending.delete(message.id);
47
+ if (message.error) reject(new Error(message.error.message || JSON.stringify(message.error)));
48
+ else resolve(message.result || {});
49
+ return;
50
+ }
51
+ if (message.method) this.listeners.forEach((listen) => listen(message));
52
+ });
53
+ }
54
+
55
+ send(method, params = {}, sessionId) {
56
+ const id = this.next++;
57
+ const payload = { id, method, params };
58
+ if (sessionId) payload.sessionId = sessionId;
59
+ return new Promise((resolve, reject) => {
60
+ this.pending.set(id, { resolve, reject });
61
+ this.ws.send(JSON.stringify(payload));
62
+ });
63
+ }
64
+
65
+ once(method, sessionId) {
66
+ return new Promise((resolve) => {
67
+ const listen = (message) => {
68
+ if (message.method !== method) return;
69
+ if (sessionId && message.sessionId !== sessionId) return;
70
+ this.listeners = this.listeners.filter((entry) => entry !== listen);
71
+ resolve(message.params || {});
72
+ };
73
+ this.listeners.push(listen);
74
+ });
75
+ }
76
+ }
77
+
78
+ async function activePort(profile) {
79
+ try {
80
+ const text = await readFile(join(profile, 'DevToolsActivePort'), 'utf8');
81
+ const value = Number(text.split('\n')[0]);
82
+ return Number.isInteger(value) && value > 0 ? value : null;
83
+ } catch (_error) {
84
+ return null;
85
+ }
86
+ }
87
+
88
+ async function waitForDevtools(port, chrome, profile) {
89
+ let stderr = '';
90
+ if (chrome.stderr) {
91
+ chrome.stderr.on('data', (chunk) => { stderr += chunk; });
92
+ }
93
+ for (let attempt = 0; attempt < 200; attempt += 1) {
94
+ if (chrome.exitCode !== null) {
95
+ throw new Error(`Chrome exited ${chrome.exitCode}: ${stderr.slice(-500)}`);
96
+ }
97
+ const opened = await activePort(profile);
98
+ const candidates = opened && opened !== port ? [opened, port] : [port];
99
+ for (const candidate of candidates) {
100
+ try {
101
+ const response = await fetch(`http://127.0.0.1:${candidate}/json/version`);
102
+ if (response.ok) return response.json();
103
+ } catch (_error) {
104
+ // Chrome is starting.
105
+ }
106
+ }
107
+ await delay(100);
108
+ }
109
+ const opened = await activePort(profile);
110
+ throw new Error(`Chrome DevTools did not answer on ${port}${opened ? ` (active port ${opened})` : ''}`);
111
+ }
112
+
113
+ async function openSocket(url) {
114
+ const ws = new WebSocket(url);
115
+ await new Promise((resolve, reject) => {
116
+ ws.addEventListener('open', resolve, { once: true });
117
+ ws.addEventListener('error', () => reject(new Error('DevTools socket failed')), { once: true });
118
+ });
119
+ return ws;
120
+ }
121
+
122
+ function findChrome() {
123
+ const candidates = [
124
+ process.env.CHROME_PATH,
125
+ '/usr/bin/google-chrome-stable',
126
+ '/usr/bin/google-chrome',
127
+ '/usr/bin/chromium',
128
+ '/usr/bin/chromium-browser'
129
+ ].filter(Boolean);
130
+ for (const c of candidates) {
131
+ if (c && existsSync(c)) return c;
132
+ }
133
+ return 'google-chrome';
134
+ }
135
+
136
+ async function launchChrome() {
137
+ const chromePath = findChrome();
138
+ const profile = await mkdtemp(join(tmpdir(), 'pandorga-regression-'));
139
+ const port = await freePort();
140
+ const chrome = spawn(chromePath, [
141
+ '--headless=new',
142
+ '--no-sandbox',
143
+ '--disable-gpu',
144
+ '--disable-dev-shm-usage',
145
+ '--no-first-run',
146
+ '--remote-allow-origins=*',
147
+ '--remote-debugging-address=127.0.0.1',
148
+ `--remote-debugging-port=${port}`,
149
+ `--user-data-dir=${profile}`,
150
+ 'about:blank'
151
+ ], { stdio: ['ignore', 'ignore', 'pipe'] });
152
+ return { chrome, profile, port };
153
+ }
154
+
155
+ async function stopProcess(proc) {
156
+ if (!proc) return;
157
+ proc.kill('SIGKILL');
158
+ await delay(100);
159
+ }
160
+
161
+ async function navigate(browser, sessionId, url) {
162
+ const loaded = browser.once('Page.loadEventFired', sessionId);
163
+ await browser.send('Page.navigate', { url }, sessionId);
164
+ await Promise.race([
165
+ loaded,
166
+ delay(15000).then(() => { throw new Error(`Navigation timeout for ${url}`); })
167
+ ]);
168
+ await delay(250);
169
+ }
170
+
171
+ const PAGES = [
172
+ '/',
173
+ '/pages/articles/',
174
+ '/articles/welcome/',
175
+ '/posts/note/'
176
+ ];
177
+
178
+ const VIEWPORTS = [
179
+ { name: '320', width: 320, height: 700, mobile: true },
180
+ { name: '390', width: 390, height: 844, mobile: true },
181
+ { name: '1440', width: 1440, height: 900, mobile: false }
182
+ ];
183
+
184
+ const THEMES = ['light', 'dark'];
185
+
186
+ const ASSERT_EXPRESSION = `
187
+ (function() {
188
+ const errors = [];
189
+
190
+ // 1. Horizontal overflow (1px tolerance)
191
+ const root = document.documentElement;
192
+ const body = document.body;
193
+ const scrollWidth = Math.max(root.scrollWidth, body.scrollWidth);
194
+ const clientWidth = root.clientWidth;
195
+ if (scrollWidth > clientWidth + 1) {
196
+ errors.push('Horizontal overflow: scrollWidth=' + scrollWidth + ' > clientWidth=' + clientWidth);
197
+ }
198
+
199
+ // 2. Home hero family right edge
200
+ const family = document.querySelector('.home-hero-family');
201
+ const copyCol = document.querySelector('.home-hero-copy');
202
+ if (family && copyCol) {
203
+ const fRect = family.getBoundingClientRect();
204
+ const cRect = copyCol.getBoundingClientRect();
205
+ if (fRect.right > cRect.right + 1.5) {
206
+ errors.push('Hero family right edge (' + Math.round(fRect.right) + ') exceeds copy column (' + Math.round(cRect.right) + ')');
207
+ }
208
+ }
209
+
210
+ // 3. Detail element overlaps
211
+ const isDetail = window.location.pathname.includes('/articles/') || window.location.pathname.includes('/posts/');
212
+ if (isDetail) {
213
+ const title = document.querySelector('.text-detail-sidebar .text-title, .text-detail-sidebar .article-sidebar-heading h1');
214
+ const cover = document.querySelector('.text-detail-sidebar .article-sidebar-thumbnail, .text-detail-sidebar .article-sidebar-heading figure');
215
+ const meta = document.querySelector('.text-detail-sidebar .article-meta');
216
+ const actions = document.querySelector('.detail-actions');
217
+ const prose = document.querySelector('.article-content > p:first-of-type, .article-content > *');
218
+
219
+ const detailElems = [
220
+ { name: 'title', el: title },
221
+ { name: 'cover', el: cover },
222
+ { name: 'meta', el: meta },
223
+ { name: 'actions', el: actions },
224
+ { name: 'prose', el: prose }
225
+ ].filter(item => item.el && item.el.getBoundingClientRect().height > 0);
226
+
227
+ for (let i = 0; i < detailElems.length - 1; i++) {
228
+ const curr = detailElems[i];
229
+ const next = detailElems[i + 1];
230
+ const rCurr = curr.el.getBoundingClientRect();
231
+ const rNext = next.el.getBoundingClientRect();
232
+ if (rNext.top < rCurr.bottom - 1.5) {
233
+ errors.push('Vertical overlap: ' + next.name + ' top (' + Math.round(rNext.top) + ') < ' + curr.name + ' bottom (' + Math.round(rCurr.bottom) + ')');
234
+ }
235
+ }
236
+
237
+ // 4. Progress bar position at current scroll
238
+ const detailRoot = document.querySelector('[data-dynamic-article-detail], [data-dynamic-post-detail], [data-detail-view], .text-page-main');
239
+ if (detailRoot) {
240
+ const cs = window.getComputedStyle(detailRoot, '::before');
241
+ const topVal = cs.getPropertyValue('top');
242
+ const posVal = cs.getPropertyValue('position');
243
+ if (posVal === 'fixed' && topVal !== '0px') {
244
+ errors.push('Progress bar ::before top is ' + topVal + ', expected 0px (PLT-AC-72)');
245
+ }
246
+ }
247
+ }
248
+
249
+ return { errors };
250
+ })()
251
+ `;
252
+
253
+ async function main() {
254
+ ensureSiteBuilt();
255
+
256
+ const serverPort = await freePort();
257
+ const server = spawn('python3', [
258
+ join(ROOT, 'scripts/lighthouse_server.py'),
259
+ String(serverPort),
260
+ SITE_DIR
261
+ ], { stdio: 'ignore' });
262
+
263
+ await delay(500);
264
+
265
+ const LAUNCH_ATTEMPTS = 3;
266
+ let chromeStarted;
267
+ let devtoolsVersion;
268
+
269
+ for (let attempt = 1; attempt <= LAUNCH_ATTEMPTS; attempt += 1) {
270
+ try {
271
+ chromeStarted = await launchChrome();
272
+ devtoolsVersion = await waitForDevtools(chromeStarted.port, chromeStarted.chrome, chromeStarted.profile);
273
+ break;
274
+ } catch (err) {
275
+ if (chromeStarted) {
276
+ await stopProcess(chromeStarted.chrome);
277
+ await rm(chromeStarted.profile, { recursive: true, force: true });
278
+ }
279
+ if (attempt === LAUNCH_ATTEMPTS) throw err;
280
+ console.warn(`WARN: Chrome launch attempt ${attempt} failed: ${err.message}; retrying...`);
281
+ await delay(200);
282
+ }
283
+ }
284
+
285
+ const { chrome, profile } = chromeStarted;
286
+ let failed = false;
287
+
288
+ try {
289
+ const ws = await openSocket(devtoolsVersion.webSocketDebuggerUrl);
290
+ const browser = new Cdp(ws);
291
+ const created = await browser.send('Target.createTarget', { url: 'about:blank' });
292
+ const attached = await browser.send('Target.attachToTarget', {
293
+ targetId: created.targetId,
294
+ flatten: true
295
+ });
296
+ const sessionId = attached.sessionId;
297
+ await browser.send('Page.enable', {}, sessionId);
298
+ await browser.send('Runtime.enable', {}, sessionId);
299
+
300
+ console.log('Testing regression gate assertions across viewports, themes, and pages...');
301
+
302
+ for (const pagePath of PAGES) {
303
+ const targetUrl = `http://127.0.0.1:${serverPort}${pagePath}`;
304
+ const isDetailPage = pagePath.includes('/articles/') || pagePath.includes('/posts/');
305
+
306
+ for (const vp of VIEWPORTS) {
307
+ await browser.send('Emulation.setDeviceMetricsOverride', {
308
+ width: vp.width,
309
+ height: vp.height,
310
+ deviceScaleFactor: vp.mobile ? 2 : 1,
311
+ mobile: vp.mobile
312
+ }, sessionId);
313
+
314
+ await navigate(browser, sessionId, targetUrl);
315
+
316
+ for (const theme of THEMES) {
317
+ await browser.send('Runtime.evaluate', {
318
+ expression: `document.documentElement.setAttribute('data-theme', '${theme}');`
319
+ }, sessionId);
320
+ await delay(50);
321
+
322
+ // Assert at scroll 0%
323
+ const evalResult = await browser.send('Runtime.evaluate', {
324
+ expression: ASSERT_EXPRESSION,
325
+ returnByValue: true
326
+ }, sessionId);
327
+
328
+ const result = (evalResult.result && evalResult.result.value) || { errors: [] };
329
+ if (result.errors && result.errors.length > 0) {
330
+ console.error(`FAIL: ${pagePath} (${vp.name}px, ${theme} theme, scroll 0%):`);
331
+ for (const err of result.errors) {
332
+ console.error(` - ${err}`);
333
+ }
334
+ failed = true;
335
+ }
336
+
337
+ // If detail page, re-assert progress bar at scroll 50% and 90%
338
+ if (isDetailPage) {
339
+ for (const pct of [0.5, 0.9]) {
340
+ await browser.send('Runtime.evaluate', {
341
+ expression: `window.scrollTo(0, Math.max(100, document.body.scrollHeight * ${pct}));`
342
+ }, sessionId);
343
+ await delay(100);
344
+
345
+ const scrollResult = await browser.send('Runtime.evaluate', {
346
+ expression: ASSERT_EXPRESSION,
347
+ returnByValue: true
348
+ }, sessionId);
349
+
350
+ const sRes = (scrollResult.result && scrollResult.result.value) || { errors: [] };
351
+ if (sRes.errors && sRes.errors.length > 0) {
352
+ console.error(`FAIL: ${pagePath} (${vp.name}px, ${theme} theme, scroll ${Math.round(pct * 100)}%):`);
353
+ for (const err of sRes.errors) {
354
+ console.error(` - ${err}`);
355
+ }
356
+ failed = true;
357
+ }
358
+ }
359
+
360
+ // Scroll back to top
361
+ await browser.send('Runtime.evaluate', { expression: 'window.scrollTo(0, 0);' }, sessionId);
362
+ }
363
+ }
364
+ }
365
+ }
366
+
367
+ ws.close();
368
+ } finally {
369
+ await stopProcess(chrome);
370
+ await rm(profile, { recursive: true, force: true });
371
+ await stopProcess(server);
372
+ }
373
+
374
+ if (failed) {
375
+ console.error('Regression gate failed (PLT-AC-73)');
376
+ process.exit(1);
377
+ }
378
+
379
+ console.log('PASS test-regression-gate (PLT-AC-73)');
380
+ }
381
+
382
+ main().catch((err) => {
383
+ console.error(`ERROR in test-regression-gate: ${err.stack || err}`);
384
+ process.exit(1);
385
+ });
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # Additive headless browser regression gate (PLT-AC-73).
5
+ require "pathname"
6
+ require "open3"
7
+
8
+ ROOT = Pathname.new(__dir__).join("../..").expand_path
9
+ MJS = ROOT.join("scripts/test/test-regression-gate.mjs")
10
+
11
+ unless MJS.file?
12
+ warn "FAIL test-regression-gate: missing #{MJS}"
13
+ exit 1
14
+ end
15
+
16
+ stdout, stderr, status = Open3.capture3("node", MJS.to_s, chdir: ROOT.to_s)
17
+ if status.success?
18
+ puts stdout
19
+ else
20
+ warn "FAIL test-regression-gate:\n#{stdout}\n#{stderr}"
21
+ exit 1
22
+ end
@@ -296,9 +296,9 @@ item(5) do
296
296
  expect(h, ".home-band .ledger-section-banner .ledger-kicker", { "grid-column" => "1 / -1", "grid-row" => "1" })
297
297
  expect(h, ".home-band .ledger-kicker:empty", { "display" => "none" })
298
298
  expect(h, ".home-band .ledger-section-banner .section-title", {
299
- "grid-column" => "1", "grid-row" => "2", "font-size" => "var(--type-section-sm)"
299
+ "grid-column" => "1", "grid-row" => "2", "font-size" => "var(--type-section)"
300
300
  })
301
- expect(h, ".home-band .ledger-section-banner .section-title", { "font-size" => "var(--type-section)" }, media: WIDE)
301
+ expect(h, ".home-band .ledger-section-banner .section-title", { "font-size" => "var(--type-section-lg)" }, media: WIDE)
302
302
  expect(h, ".home-band .home-section-aside", { "grid-column" => "2", "grid-row" => "2" })
303
303
  expect(h, ".home-band .home-section-note", {
304
304
  "grid-column" => "1 / -1", "grid-row" => "3", "font-size" => "var(--type-dek)"
data/scripts/validate.sh CHANGED
@@ -81,6 +81,7 @@ TESTS=(
81
81
  scripts/test/test-home-article-cards.rb
82
82
  scripts/test/test-parallel-content-publish.rb
83
83
  scripts/test/test-mobile-density-home-measure.rb
84
+ scripts/test/test-regression-gate.rb
84
85
  )
85
86
 
86
87
  failed=0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pandorga
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Pandorga contributors
@@ -465,6 +465,8 @@ files:
465
465
  - scripts/test/test-r2-json-sync.rb
466
466
  - scripts/test/test-rascunhos-licence.rb
467
467
  - scripts/test/test-registry-home.rb
468
+ - scripts/test/test-regression-gate.mjs
469
+ - scripts/test/test-regression-gate.rb
468
470
  - scripts/test/test-runtime-js-syntax.rb
469
471
  - scripts/test/test-shell-a11y.rb
470
472
  - scripts/test/test-slim-writing-index.rb