lazycodex-ai 5.1.34 → 5.1.38

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.
Files changed (134) hide show
  1. package/dist/cli/index.js +122 -48
  2. package/dist/cli-node/index.js +122 -48
  3. package/package.json +1 -1
  4. package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
  5. package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
  6. package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
  7. package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
  8. package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
  9. package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
  10. package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
  11. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
  12. package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
  13. package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
  14. package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
  15. package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
  16. package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
  17. package/packages/omo-codex/plugin/components/rules/package.json +1 -1
  18. package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
  19. package/packages/omo-codex/plugin/components/teammode/package.json +2 -2
  20. package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +2 -1
  21. package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +2 -1
  22. package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
  23. package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
  24. package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
  25. package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
  26. package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
  27. package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
  28. package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
  29. package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
  30. package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
  31. package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
  32. package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
  33. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
  34. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
  35. package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
  36. package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
  37. package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
  38. package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
  39. package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
  40. package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
  41. package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
  42. package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
  43. package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
  44. package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
  45. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
  46. package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
  47. package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
  48. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
  49. package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
  50. package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
  51. package/packages/omo-codex/plugin/package-lock.json +18 -17
  52. package/packages/omo-codex/plugin/package.json +1 -1
  53. package/packages/omo-codex/plugin/shared/package.json +1 -1
  54. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +4 -4
  55. package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +2 -2
  56. package/packages/omo-codex/plugin/skills/frontend/SKILL.md +8 -1
  57. package/packages/omo-codex/plugin/skills/frontend/references/design/README.md +3 -2
  58. package/packages/omo-codex/plugin/skills/frontend/references/perfection/README.md +2 -1
  59. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/color.ts +132 -0
  60. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/css-parse.ts +103 -0
  61. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/declarations.ts +156 -0
  62. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/findings.ts +34 -0
  63. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/gradient.ts +70 -0
  64. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/lint.ts +110 -0
  65. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/markup.ts +148 -0
  66. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/selector.ts +46 -0
  67. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts +117 -0
  68. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/check-accent-stripes.ts +50 -0
  69. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/exempt-states.css +4 -0
  70. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/flat-stripe-side.tsx +11 -0
  71. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/full-surface-gradients.css +34 -0
  72. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/inline-ok.tsx +7 -0
  73. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/neutral-and-flat.css +6 -0
  74. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/pseudo-overlays.css +3 -0
  75. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/tailwind-ok.tsx +11 -0
  76. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/uniform-and-rings.css +3 -0
  77. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/wide-blocks-and-hairlines.css +3 -0
  78. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/apply.css +3 -0
  79. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/border-top-card.css +5 -0
  80. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/cva-variant.ts +1 -0
  81. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/gradient-edges.css +26 -0
  82. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/inline-styles.tsx +6 -0
  83. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/inset-shadow.css +4 -0
  84. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/non-visible-focus-and-nested.tsx +6 -0
  85. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/pseudo-bar.css +13 -0
  86. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/split-rule-and-token.scss +14 -0
  87. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/styled-components.tsx +14 -0
  88. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-cards.tsx +8 -0
  89. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-inset-and-style.vue +11 -0
  90. package/packages/omo-codex/plugin/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-pseudo.html +3 -0
  91. package/packages/omo-codex/plugin/skills/ulw-research/references/report-gates.md +1 -1
  92. package/packages/omo-codex/plugin/skills/ulw-research/scripts/gates-figures.mjs +22 -6
  93. package/packages/omo-codex/scripts/install-dist/install-local.mjs +51 -4
  94. package/packages/shared-skills/skills/browser/runtime/omowright/index.js +4 -4
  95. package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +2 -2
  96. package/packages/shared-skills/skills/frontend/SKILL.md +8 -1
  97. package/packages/shared-skills/skills/frontend/references/design/README.md +3 -2
  98. package/packages/shared-skills/skills/frontend/references/perfection/README.md +2 -1
  99. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/color.ts +132 -0
  100. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/css-parse.ts +103 -0
  101. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/declarations.ts +156 -0
  102. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/findings.ts +34 -0
  103. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/gradient.ts +70 -0
  104. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/lint.ts +110 -0
  105. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/markup.ts +148 -0
  106. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/selector.ts +46 -0
  107. package/packages/shared-skills/skills/frontend/scripts/perfection/accent-stripes/tailwind.ts +117 -0
  108. package/packages/shared-skills/skills/frontend/scripts/perfection/check-accent-stripes.test.ts +86 -0
  109. package/packages/shared-skills/skills/frontend/scripts/perfection/check-accent-stripes.ts +50 -0
  110. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/exempt-states.css +4 -0
  111. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/flat-stripe-side.tsx +11 -0
  112. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/full-surface-gradients.css +34 -0
  113. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/inline-ok.tsx +7 -0
  114. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/neutral-and-flat.css +6 -0
  115. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/pseudo-overlays.css +3 -0
  116. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/tailwind-ok.tsx +11 -0
  117. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/uniform-and-rings.css +3 -0
  118. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/negative/wide-blocks-and-hairlines.css +3 -0
  119. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/apply.css +3 -0
  120. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/border-top-card.css +5 -0
  121. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/cva-variant.ts +1 -0
  122. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/gradient-edges.css +26 -0
  123. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/inline-styles.tsx +6 -0
  124. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/inset-shadow.css +4 -0
  125. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/non-visible-focus-and-nested.tsx +6 -0
  126. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/pseudo-bar.css +13 -0
  127. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/split-rule-and-token.scss +14 -0
  128. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/styled-components.tsx +14 -0
  129. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-cards.tsx +8 -0
  130. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-inset-and-style.vue +11 -0
  131. package/packages/shared-skills/skills/frontend/scripts/perfection/fixtures/accent-stripes/positive/tailwind-pseudo.html +3 -0
  132. package/packages/shared-skills/skills/ulw-research/references/report-gates.md +1 -1
  133. package/packages/shared-skills/skills/ulw-research/scripts/gates-figures.mjs +22 -6
  134. package/packages/shared-skills/skills/ulw-research/scripts/gates-static.test.ts +13 -0
@@ -0,0 +1,5 @@
1
+ .feature-card {
2
+ padding: 24px;
3
+ border-radius: 12px;
4
+ border-top: 4px solid #6366f1;
5
+ }
@@ -0,0 +1 @@
1
+ export const card = cva("rounded-xl bg-white p-6 border-l-4 border-rose-500")
@@ -0,0 +1,26 @@
1
+ .hard-stop {
2
+ border-radius: 12px;
3
+ background: linear-gradient(to right, #6366f1 4px, #fff 4px);
4
+ }
5
+
6
+ .image-border {
7
+ border-radius: 12px;
8
+ border-left: 4px solid;
9
+ border-image: linear-gradient(#6366f1, #a855f7) 1;
10
+ }
11
+
12
+ .glow { position: relative; border-radius: 12px; }
13
+ .glow::before {
14
+ content: "";
15
+ position: absolute;
16
+ top: 0;
17
+ bottom: 0;
18
+ left: 0;
19
+ width: 3px;
20
+ background: linear-gradient(to bottom, #6366f1, #a855f7);
21
+ }
22
+
23
+ .end-band {
24
+ border-radius: 12px;
25
+ background-image: linear-gradient(to right, #fff calc(100% - 4px), #f43f5e calc(100% - 4px));
26
+ }
@@ -0,0 +1,6 @@
1
+ export const Tip = () => (
2
+ <>
3
+ <div style={{ borderRadius: 12, borderLeft: "4px solid #ef4444" }}>Careful</div>
4
+ <div className="rounded-lg" style={{ borderTop: '3px solid var(--brand)' }}>New</div>
5
+ </>
6
+ )
@@ -0,0 +1,4 @@
1
+ .note {
2
+ border-radius: 8px;
3
+ box-shadow: inset 4px 0 0 0 oklch(0.65 0.2 250), 0 1px 2px rgb(0 0 0 / 0.06);
4
+ }
@@ -0,0 +1,6 @@
1
+ const css = css`
2
+ .card:focus-within { border-radius: 12px; border-left: 3px solid #6366f1; }
3
+ td .promo-card { border-radius: 8px; border-left: 4px solid #f43f5e; }
4
+ `
5
+
6
+ export const Focused = () => <div className="rounded-xl focus:border-l-4 focus:border-indigo-500">Card</div>
@@ -0,0 +1,13 @@
1
+ .stat {
2
+ position: relative;
3
+ border-radius: 12px;
4
+ overflow: hidden;
5
+ }
6
+
7
+ .stat::before {
8
+ content: "";
9
+ position: absolute;
10
+ inset: 0 auto 0 0;
11
+ width: 4px;
12
+ background: #10b981;
13
+ }
@@ -0,0 +1,14 @@
1
+ .callout {
2
+ border-radius: 0.75rem;
3
+ border-left: 3px solid var(--color-accent);
4
+ }
5
+
6
+ .tile {
7
+ border-radius: 16px;
8
+ background: var(--surface);
9
+ &.is-featured {
10
+ border-left-width: 4px;
11
+ border-left-style: solid;
12
+ border-left-color: hsl(262 83% 58%);
13
+ }
14
+ }
@@ -0,0 +1,14 @@
1
+ import styled, { createGlobalStyle } from "styled-components"
2
+
3
+ export const Banner = styled.div`
4
+ padding: ${({ theme }) => theme.space[4]}px;
5
+ border-radius: 12px;
6
+ border-left: 4px solid #2563eb;
7
+ `
8
+
9
+ export const Global = createGlobalStyle`
10
+ .promo-card {
11
+ border-radius: 8px;
12
+ border-top: 3px solid var(--color-brand);
13
+ }
14
+ `
@@ -0,0 +1,8 @@
1
+ export function Cards({ featured }: { featured: boolean }) {
2
+ return (
3
+ <section>
4
+ <div className="rounded-xl border-l-4 border-indigo-500 bg-white p-6">Fast</div>
5
+ <article className={cn("rounded-2xl p-4", featured && "border-t-4 border-t-primary")}>Plans</article>
6
+ </section>
7
+ )
8
+ }
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div class="rounded-md p-4 shadow-[inset_3px_0_0_0_#f59e0b]">Heads up</div>
3
+ <div class="quote">Quote</div>
4
+ </template>
5
+
6
+ <style scoped>
7
+ .quote {
8
+ border-radius: 10px;
9
+ border-left: 5px solid rebeccapurple;
10
+ }
11
+ </style>
@@ -0,0 +1,3 @@
1
+ <div class="relative overflow-hidden rounded-lg p-6 before:absolute before:inset-y-0 before:left-0 before:w-1 before:bg-emerald-500">
2
+ Uptime 99.99%
3
+ </div>
@@ -19,7 +19,7 @@ This reference catalogs every defect code the report gates (`static`, `layout`,
19
19
  | `chart_without_figure` | major | false | An image or chart lacks a figure wrapper with a caption. Uncaptioned charts isolate visuals from narrative flow. | Wrap the image or chart in a figure container with a caption. |
20
20
  | `chart_svg_no_text` | major | false | An SVG chart or diagram lacks a title, axis labels, units, or value labels. Visuals cannot stand alone without text guidance. | Give the chart a title, axis labels, units, and value labels as SVG text. |
21
21
  | `chart_svg_missing_labels` | minor | false | An SVG chart has some labels (e.g., title) but is missing others (e.g., axis ticks or unit). | Add the missing title, axis ticks, or unit label to the chart. |
22
- | `report_without_visual` | major | false | The report body has no chart, diagram, or figure image at all (header logos, icons, and images marked decorative do not count; only rendered output counts, so a Mermaid source block or a zero-size image does not). A text-only report hides structure and trends the reader would see at a glance. | Add at least one captioned visual of the findings: a chart from the data table, a rendered Mermaid diagram, or a figure image (references/report-visualization.md). |
22
+ | `report_without_visual` | major | false | The report body has no chart, diagram, or figure image at all (header logos, icons, and images marked decorative do not count; only rendered output counts, so a Mermaid source block or an image with any zero dimension (attribute, inline style, or viewBox) does not; an element with no declared size counts, because the browser sizes it, and the layout gate is where rendering is proven). A text-only report hides structure and trends the reader would see at a glance. | Add at least one captioned visual of the findings: a chart from the data table, a rendered Mermaid diagram, or a figure image (references/report-visualization.md). |
23
23
  | `image_missing_alt` | minor | false | A figure image has a missing or empty `alt` and is not marked decorative. Screen readers and failed image loads leave the reader with nothing. An image is decorative only with an empty `alt` plus `role="presentation"` (or `role="none"`, or `aria-hidden="true"`): it raises nothing here and does not count as a visual. | Give the image an alt attribute that states what it shows, not its file name; mark a purely decorative image alt="" with role="presentation". |
24
24
  | `korean_serif_font` | major | false | A serif or brush Korean font family is applied to Korean text. The design spec mandates gothic (sans) Korean typefaces. | Use a gothic (sans) Korean family; serif and brush families are banned by the design spec. |
25
25
  | `section_without_citation` | major | false | A major section or subsection contains no in-text citations or reference marks. Source attribution is missing. | Cite at least one source inside this section or merge it into a cited one. |
@@ -27,14 +27,30 @@ function pixels(value) {
27
27
  return match ? Number(match[1]) : null
28
28
  }
29
29
 
30
+ function fromStyle(node, prop) {
31
+ return pixels(new RegExp(`(?:^|;)\\s*${prop}\\s*:\\s*([^;]+)`, "i").exec(node.attrs.style ?? "")?.[1])
32
+ }
33
+
34
+ function viewBoxSize(node) {
35
+ const box = String(node.attrs.viewbox ?? "").trim().split(/[\s,]+/).map(Number)
36
+ return box.length === 4 && box.every(Number.isFinite) ? { width: box[2], height: box[3] } : null
37
+ }
38
+
30
39
  /** Largest declared dimension: width/height attributes or style, else the viewBox. */
31
40
  function declaredSize(node) {
32
- const style = node.attrs.style ?? ""
33
- const fromStyle = (prop) => pixels(new RegExp(`(?:^|;)\\s*${prop}\\s*:\\s*([^;]+)`, "i").exec(style)?.[1])
34
- const sizes = [pixels(node.attrs.width), pixels(node.attrs.height), fromStyle("width"), fromStyle("height")].filter((n) => n !== null)
41
+ const sizes = [pixels(node.attrs.width), pixels(node.attrs.height), fromStyle(node, "width"), fromStyle(node, "height")].filter((n) => n !== null)
35
42
  if (sizes.length) return Math.max(...sizes)
36
- const box = String(node.attrs.viewbox ?? "").trim().split(/[\s,]+/).map(Number)
37
- return box.length === 4 && box.every(Number.isFinite) ? Math.max(box[2], box[3]) : null
43
+ const box = viewBoxSize(node)
44
+ return box ? Math.max(box.width, box.height) : null
45
+ }
46
+
47
+ /**
48
+ * True when any declared dimension is zero, so the element cannot render visibly. Each axis reads its inline
49
+ * style first, then its attribute, then the viewBox. An undeclared axis is not zero: the browser sizes it.
50
+ */
51
+ function hasZeroDimension(node) {
52
+ const box = viewBoxSize(node)
53
+ return ["width", "height"].some((axis) => (fromStyle(node, axis) ?? pixels(node.attrs[axis]) ?? box?.[axis] ?? null) === 0)
38
54
  }
39
55
 
40
56
  function isIcon(ctx, node) {
@@ -174,7 +190,7 @@ export const figureGates = [
174
190
  {
175
191
  codes: ["report_without_visual"],
176
192
  run(ctx) {
177
- if (visuals(ctx).some((node) => declaredSize(node) !== 0 && !isDecorative(node))) return []
193
+ if (visuals(ctx).some((node) => !hasZeroDimension(node) && !isDecorative(node))) return []
178
194
  return [ctx.defect("report_without_visual", ctx.body, "the report has no chart, diagram, or figure image")]
179
195
  },
180
196
  },
@@ -263,6 +263,19 @@ describe("report-level visuals", () => {
263
263
  expect(chartCodes(htmlLabels)).toEqual(["chart_svg_no_text"])
264
264
  })
265
265
 
266
+ test("#given a single visual with one zero dimension #when checked #then report_without_visual is raised; viewBox-only and unsized visuals still count", () => {
267
+ // given
268
+ const only = (el: string) => `<figure>${el}<figcaption>c</figcaption></figure>`
269
+ const flat = only('<img src="data:image/png;base64,iVBORw0KGgo=" alt="chart" width="600" height="0">')
270
+ const narrow = only('<svg width="0" height="300"><text>A</text></svg>')
271
+ const styled = only('<img src="data:image/png;base64,iVBORw0KGgo=" alt="chart" width="600" height="300" style="height: 0">')
272
+ const viewBoxOnly = only('<svg viewBox="0 0 600 300" aria-roledescription="flowchart-v2"><text>A</text></svg>')
273
+ const unsized = only('<img src="data:image/png;base64,iVBORw0KGgo=" alt="Deploys per week">')
274
+ // when / then
275
+ for (const html of [flat, narrow, styled]) expect(has(html, "report_without_visual")).toBe(true)
276
+ for (const html of [viewBoxOnly, unsized]) expect(has(html, "report_without_visual")).toBe(false)
277
+ })
278
+
266
279
  test("#given figure images with no alt, a bare empty alt, role- and aria-marked decorative alts and a descriptive alt #when checked #then only the unmarked two raise image_missing_alt", () => {
267
280
  // given
268
281
  const img = (alt: string) => `<figure><img src="data:image/png;base64,iVBORw0KGgo=" ${alt} width="480" height="240"><figcaption>c</figcaption></figure>`