stitch2 0.24.1 → 0.24.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.
package/dist/audit.js CHANGED
@@ -842,8 +842,17 @@ export async function audit(opts) {
842
842
  if (!el.matches('nav, [role=navigation], [role=tablist]') && !el.querySelector('nav, [role=navigation], [role=tablist]'))
843
843
  continue;
844
844
  const items = [...el.querySelectorAll('a[href], button, [role=tab]')].filter((i) => shown(i) && !i.parentElement?.closest('a[href], button, [role=tab]'));
845
- if (items.length > 5)
846
- push('warning', 'nav-destinations', el, items.length + " destinations in the bottom navigation: Material's navigation bar holds 3–5");
845
+ // The destinations stand in one row. A panel above them (a workout that is running, a player) belongs to the bar
846
+ // but is not a destination: the widest row counts.
847
+ const tops = items.map((i) => i.getBoundingClientRect().top).sort((a, b) => a - b);
848
+ let widest = 0;
849
+ for (let from = 0, row = 0; row < tops.length; row++) {
850
+ if (tops[row] - tops[from] > 12)
851
+ from = row;
852
+ widest = Math.max(widest, row - from + 1);
853
+ }
854
+ if (widest > 5)
855
+ push('warning', 'nav-destinations', el, widest + " destinations in the bottom navigation: Material's navigation bar holds 3–5");
847
856
  }
848
857
  // 6h. Keyboard focus is visible (Material's focus state, web.dev, WCAG 2.4.7): focusing a control changes how
849
858
  // it or its frame looks. Transitions are paused so a ring that fades in still counts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stitch2",
3
- "version": "0.24.1",
3
+ "version": "0.24.2",
4
4
  "description": "A design canvas, layout and type checks, component consistency and screen versioning for agent-built UI, on Google's DESIGN.md format.",
5
5
  "license": "MIT",
6
6
  "author": "ifokeev",
@@ -71,7 +71,8 @@ the rest are judged from the render. Where Google and DESIGN.md disagree, DESIGN
71
71
  ## Components
72
72
 
73
73
  - **Navigation bar:** three to five destinations, each an icon with a one-line label; more destinations go to a
74
- rail, a drawer or a page **(check: nav-destinations; label-wraps)**.
74
+ rail, a drawer or a page **(check: nav-destinations; label-wraps)**. The check counts the destinations in one row:
75
+ a panel stacked above them in the same bar (a running workout's Resume and Discard, a player) is not a destination.
75
76
  - **Button emphasis:** filled for the one main action, tonal or outlined for secondary, text buttons for
76
77
  low-emphasis; one floating action button at most.
77
78
  - **Icon-only controls have a name** that says what they do ("Share", not "Share button"); repeated items in a